📄 c.m4
字号:
# Set ac_cpp_err to a non-empty value if the preprocessor failed.# This macro is for all languages, not only C.AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE],[ac_preproc_ok=falsefor ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yesdo # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since # <limits.h> exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@ifdef __STDC__@%:@ include <limits.h>@%:@else@%:@ include <assert.h>@%:@endif Syntax error]])], [], [# Broken: fails on valid input.continue]) # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])], [# Broken: success on invalid input.continue], [# Passes both tests.ac_preproc_ok=:break])done# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.rm -f conftest.err conftest.$ac_extAS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE# AC_PROG_CPP# -----------# 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_CC.AN_MAKEVAR([CPP], [AC_PROG_CPP])AN_PROGRAM([cpp], [AC_PROG_CPP])AC_DEFUN([AC_PROG_CPP],[AC_REQUIRE([AC_PROG_CC])dnlAC_ARG_VAR([CPP], [C preprocessor])dnl_AC_ARG_VAR_CPPFLAGS()dnlAC_LANG_PUSH(C)dnlAC_MSG_CHECKING([how to run the C preprocessor])# On Suns, sometimes $CPP names a directory.if test -n "$CPP" && test -d "$CPP"; then CPP=fiif test -z "$CPP"; then AC_CACHE_VAL([ac_cv_prog_CPP], [dnl # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do _AC_PROG_PREPROC_WORKS_IFELSE([break]) 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_PROG_CPP_WERROR# ------------------# Treat warnings from the preprocessor as errors.AC_DEFUN([AC_PROG_CPP_WERROR],[AC_REQUIRE([AC_PROG_CPP])dnlac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR# 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 dnl Here we want: dnl AC_CHECK_TOOL(CC, cc) dnl but without the check for a tool without the prefix. dnl Until the check is removed from there, copy the code: if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) fifiif test -z "$CC"; then AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)fiif test -z "$CC"; then AC_CHECK_TOOLS(CC, cl.exe)fi])test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])# Provide some information about the compiler._AS_ECHO_LOG([checking for _AC_LANG compiler version])ac_compiler=`set X $ac_compile; echo $[2]`_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD])_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD])_AC_DO([$ac_compiler -V >&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_C89AC_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.# Don't consider -g to work if it generates warnings when plain compiles don't.m4_define([_AC_PROG_CC_G],[ac_test_CFLAGS=${CFLAGS+set}ac_save_CFLAGS=$CFLAGSAC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g, [ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes], [CFLAGS="" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [], [ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes])])]) ac_c_werror_flag=$ac_save_c_werror_flag])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 conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'rm -f conftest2.*if _AC_DO_VAR(ac_try) && test -f conftest2.$ac_objext && _AC_DO_VAR(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_DO_TOKENS(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD' rm -f conftest2.* if _AC_DO_VAR(ac_try) && test -f conftest2.$ac_objext && _AC_DO_VAR(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 core conftest*])dnlif eval test \$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()dnl_AC_ARG_VAR_PRECIOUS([CCC])dnlif test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else AC_CHECK_TOOLS(CXX, [m4_default([$1], [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])], g++) fifi# Provide some information about the compiler._AS_ECHO_LOG([checking for _AC_LANG compiler version])ac_compiler=`set X $ac_compile; echo $[2]`_AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD])_AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD])_AC_DO([$ac_compiler -V >&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_GAC_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.# Don't consider -g to work if it generates warnings when plain compiles don't.m4_define([_AC_PROG_CXX_G],[ac_test_CXXFLAGS=${CXXFLAGS+set}ac_save_CXXFLAGS=$CXXFLAGSAC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g, [ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cxx_g=yes], [CXXFLAGS="" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [], [ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cxx_g=yes])])]) ac_cxx_werror_flag=$ac_save_cxx_werror_flag])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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -