0
启用功能设置编译器标志是很新的Autoconf的,我想有一个配置文件,当我打电话:configure --enable-gtest=yes
,使得它增加了一个编译器标志。下面的代码我搜索后看起来如下,但没有办法。我如何在autoconf的
非常感谢
这就是我的makefile的样子。
-include Makefile.config
SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)
install: $(OBJ)
$(CC) $(CXXFLAGS) $(DEBUGFLAG) $(OBJ) -o run
%.o:%.cpp
$(CC) $(CXXFLAGS) $(DEBUGFLAG) -c $<
clean:
rm -f *.o
这是我configure.ac
AC_INIT([test], [1.7.0])
AC_PREREQ([2.59])
AC_CONFIG_MACRO_DIR([m4])
AC_CHECK_PROGS(CXX, [g++ c++ clang], ":")
AC_PROG_CXX
AC_SUBST(CXX)
AC_ARG_ENABLE([debug],
[ --enable-debug Turn on debugging],
[case "${enableval}" in
yes) debug=true ;;
no) debug=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac],[debug=false])
AM_CONDITIONAL([DEBUG], [test x$debug = xtrue])
AC_CONFIG_FILES(Makefile.config)
AC_OUTPUT
和我
Makefile.config.in
CC = @[email protected]
CXXFLAGS = -std=c++14
if DEBUG
DBG = debug
else
DBG =
endif
感谢
感谢,我用AC_SUBST和它的工作 – apramc