📄 c.m4
字号:
done ac_cv_prog_CPP=$CPP ])dnl CPP=$ac_cv_prog_CPPelse ac_cv_prog_CPP=$CPPfiAC_MSG_RESULT([$CPP])_AC_PROG_PREPROC_WORKS_IFELSE([], [AC_MSG_FAILURE([C preprocessor "$CPP" fails sanity check])])AC_SUBST(CPP)dnlAC_LANG_POP(C)dnl])# AC_PROG_CPP# AC_LANG_COMPILER(C)# -------------------# Find the C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.AC_DEFUN([AC_LANG_COMPILER(C)],[AC_REQUIRE([AC_PROG_CC])])# ac_cv_prog_gcc# --------------# We used to name the cache variable this way.AU_DEFUN([ac_cv_prog_gcc],[ac_cv_c_compiler_gnu])# AC_PROG_CC([COMPILER ...])# --------------------------# COMPILER ... is a space separated list of C compilers to search for.# This just gives the user an opportunity to specify an alternative# search list for the C compiler.AN_MAKEVAR([CC], [AC_PROG_CC])AN_PROGRAM([cc], [AC_PROG_CC])AN_PROGRAM([gcc], [AC_PROG_CC])AC_DEFUN([AC_PROG_CC],[AC_LANG_PUSH(C)dnlAC_ARG_VAR([CC], [C compiler command])dnlAC_ARG_VAR([CFLAGS], [C compiler flags])dnl_AC_ARG_VAR_LDFLAGS()dnl_AC_ARG_VAR_CPPFLAGS()dnlm4_ifval([$1], [AC_CHECK_TOOLS(CC, [$1])],[AC_CHECK_TOOL(CC, gcc)if test -z "$CC"; then AC_CHECK_TOOL(CC, cc)fiif test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)fiif test -z "$CC"; then AC_CHECK_TOOLS(CC, cl)fi])test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])# Provide some information about the compiler.echo "$as_me:$LINENO:" \ "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FDac_compiler=`set X $ac_compile; echo $[2]`_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])m4_expand_once([_AC_COMPILER_EXEEXT])[]dnlm4_expand_once([_AC_COMPILER_OBJEXT])[]dnl_AC_LANG_COMPILER_GNUGCC=`test $ac_compiler_gnu = yes && echo yes`_AC_PROG_CC_G_AC_PROG_CC_STDC# Some people use a C++ compiler to compile C. Since we use `exit',# in C++ we need to declare it. In case someone uses the same compiler# for both compiling C and C++ we need to have the C++ compiler decide# the declaration of exit, since it's the most demanding environment._AC_COMPILE_IFELSE([@%:@ifndef __cplusplus choke me@%:@endif], [_AC_PROG_CXX_EXIT_DECLARATION])AC_LANG_POP(C)dnl])# AC_PROG_CC# _AC_PROG_CC_G# -------------# Check whether -g works, even if CFLAGS is set, in case the package# plays around with CFLAGS (such as to build both debugging and normal# versions of a library), tasteless as that idea is.m4_define([_AC_PROG_CC_G],[ac_test_CFLAGS=${CFLAGS+set}ac_save_CFLAGS=$CFLAGSCFLAGS="-g"AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g, [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes], [ac_cv_prog_cc_g=no])])if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGSelif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fielse if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fifi[]dnl])# _AC_PROG_CC_G# AC_PROG_GCC_TRADITIONAL# -----------------------AN_FUNCTION([ioctl], [AC_PROG_GCC_TRADITIONAL])AC_DEFUN([AC_PROG_GCC_TRADITIONAL],[if test $ac_cv_c_compiler_gnu = yes; then AC_CACHE_CHECK(whether $CC needs -traditional, ac_cv_prog_gcc_traditional,[ ac_pattern="Autoconf.*'x'" AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>Autoconf TIOCGETP], ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) if test $ac_cv_prog_gcc_traditional = no; then AC_EGREP_CPP($ac_pattern, [#include <termio.h>Autoconf TCGETA], ac_cv_prog_gcc_traditional=yes) fi]) if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fifi])# AC_PROG_GCC_TRADITIONAL# AC_PROG_CC_C_O# --------------AC_DEFUN([AC_PROG_CC_C_O],[AC_REQUIRE([AC_PROG_CC])dnlif test "x$CC" != xcc; then AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])else AC_MSG_CHECKING([whether cc understands -c and -o together])fiset dummy $CC; ac_cc=`echo $[2] | sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])# Make sure it works both with $CC and with simple cc.# We do the test twice because some compilers refuse to overwrite an# existing .o file with -o, though they will create one.ac_try='$CC -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD'if AC_TRY_EVAL(ac_try) && test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try);then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if AC_TRY_COMMAND(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then ac_try='cc -c conftest.$ac_ext -o conftest.$ac_objext >&AS_MESSAGE_LOG_FD' if AC_TRY_EVAL(ac_try) && test -f conftest.$ac_objext && AC_TRY_EVAL(ac_try); then # cc works too. : else # cc exists but doesn't like -o. eval ac_cv_prog_cc_${ac_cc}_c_o=no fi fi fielse eval ac_cv_prog_cc_${ac_cc}_c_o=nofirm -f conftest*])dnlif eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then AC_MSG_RESULT([yes])else AC_MSG_RESULT([no]) AC_DEFINE(NO_MINUS_C_MINUS_O, 1, [Define to 1 if your C compiler doesn't accept -c and -o together.])fi])# AC_PROG_CC_C_O# ---------------------- ## 3c. The C++ compiler. ## ---------------------- ## AC_LANG_PREPROC(C++)# ---------------------# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.AC_DEFUN([AC_LANG_PREPROC(C++)],[AC_REQUIRE([AC_PROG_CXXCPP])])# AC_PROG_CXXCPP# --------------# Find a working C++ preprocessor.# We shouldn't have to require AC_PROG_CC, but this is due to the concurrency# between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CXX.AC_DEFUN([AC_PROG_CXXCPP],[AC_REQUIRE([AC_PROG_CXX])dnlAC_ARG_VAR([CXXCPP], [C++ preprocessor])dnl_AC_ARG_VAR_CPPFLAGS()dnlAC_LANG_PUSH(C++)dnlAC_MSG_CHECKING([how to run the C++ preprocessor])if test -z "$CXXCPP"; then AC_CACHE_VAL(ac_cv_prog_CXXCPP, [dnl # Double quotes because CXXCPP needs to be expanded for CXXCPP in "$CXX -E" "/lib/cpp" do _AC_PROG_PREPROC_WORKS_IFELSE([break]) done ac_cv_prog_CXXCPP=$CXXCPP ])dnl CXXCPP=$ac_cv_prog_CXXCPPelse ac_cv_prog_CXXCPP=$CXXCPPfiAC_MSG_RESULT([$CXXCPP])_AC_PROG_PREPROC_WORKS_IFELSE([], [AC_MSG_FAILURE([C++ preprocessor "$CXXCPP" fails sanity check])])AC_SUBST(CXXCPP)dnlAC_LANG_POP(C++)dnl])# AC_PROG_CXXCPP# AC_LANG_COMPILER(C++)# ---------------------# Find the C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.AC_DEFUN([AC_LANG_COMPILER(C++)],[AC_REQUIRE([AC_PROG_CXX])])# ac_cv_prog_gxx# --------------# We used to name the cache variable this way.AU_DEFUN([ac_cv_prog_gxx],[ac_cv_cxx_compiler_gnu])# AC_PROG_CXX([LIST-OF-COMPILERS])# --------------------------------# LIST-OF-COMPILERS is a space separated list of C++ compilers to search# for (if not specified, a default list is used). This just gives the# user an opportunity to specify an alternative search list for the C++# compiler.# aCC HP-UX C++ compiler much better than `CC', so test before.# FCC Fujitsu C++ compiler# KCC KAI C++ compiler# RCC Rational C++# xlC_r AIX C Set++ (with support for reentrant code)# xlC AIX C Set++AN_MAKEVAR([CXX], [AC_PROG_CXX])AN_PROGRAM([CC], [AC_PROG_CXX])AN_PROGRAM([c++], [AC_PROG_CXX])AN_PROGRAM([g++], [AC_PROG_CXX])AC_DEFUN([AC_PROG_CXX],[AC_LANG_PUSH(C++)dnlAC_ARG_VAR([CXX], [C++ compiler command])dnlAC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl_AC_ARG_VAR_LDFLAGS()dnl_AC_ARG_VAR_CPPFLAGS()dnlAC_CHECK_TOOLS(CXX, [$CCC m4_default([$1], [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])], g++)# Provide some information about the compiler.echo "$as_me:$LINENO:" \ "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FDac_compiler=`set X $ac_compile; echo $[2]`_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])m4_expand_once([_AC_COMPILER_EXEEXT])[]dnlm4_expand_once([_AC_COMPILER_OBJEXT])[]dnl_AC_LANG_COMPILER_GNUGXX=`test $ac_compiler_gnu = yes && echo yes`_AC_PROG_CXX_G_AC_PROG_CXX_EXIT_DECLARATIONAC_LANG_POP(C++)dnl])# AC_PROG_CXX# _AC_PROG_CXX_G# --------------# Check whether -g works, even if CXXFLAGS is set, in case the package# plays around with CXXFLAGS (such as to build both debugging and# normal versions of a library), tasteless as that idea is.m4_define([_AC_PROG_CXX_G],[ac_test_CXXFLAGS=${CXXFLAGS+set}ac_save_CXXFLAGS=$CXXFLAGSCXXFLAGS="-g"AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g, [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cxx_g=yes], [ac_cv_prog_cxx_g=no])])if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGSelif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fielse if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fifi[]dnl])# _AC_PROG_CXX_G# _AC_PROG_CXX_EXIT_DECLARATION# -----------------------------# Find a valid prototype for exit and declare it in confdefs.h.m4_define([_AC_PROG_CXX_EXIT_DECLARATION],[for ac_declaration in \ ''\ '#include <stdlib.h>' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);'do _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h>$ac_declaration], [exit (42);])], [], [continue]) _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration], [exit (42);])], [break])donerm -f conftest*if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.hfi])# _AC_PROG_CXX_EXIT_DECLARATION## ------------------------------- #### 4. Compilers' characteristics. #### ------------------------------- ### -------------------------------- ## 4b. C compiler characteristics. ## -------------------------------- ## _AC_PROG_CC_STDC# ----------------# If the C compiler in not in ANSI C mode by default, try to add an
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -