📄 lang.m4
字号:
# AC_LANG_PREPROC_REQUIRE# -----------------------# Ensure we have a preprocessor for the current language.AC_DEFUN([AC_LANG_PREPROC_REQUIRE],[m4_require([AC_LANG_PREPROC(]_AC_LANG[)], [AC_LANG_PREPROC])])# AC_REQUIRE_CPP# --------------# Require the preprocessor for the current language.# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?).AC_DEFUN([AC_REQUIRE_CPP],[AC_LANG_PREPROC_REQUIRE])# AC_NO_EXECUTABLES# -----------------# FIXME: The GCC team has specific needs which the current Autoconf# framework cannot solve elegantly. This macro implements a dirty# hack until Autoconf is able to provide the services its users# need.## Several of the support libraries that are often built with GCC can't# assume the tool-chain is already capable of linking a program: the# compiler often expects to be able to link with some of such# libraries.## In several of these libraries, workarounds have been introduced to# avoid the AC_PROG_CC_WORKS test, that would just abort their# configuration. The introduction of AC_EXEEXT, enabled either by# libtool or by CVS autoconf, have just made matters worse.## Unlike an earlier version of this macro, using AC_NO_EXECUTABLES does# not disable link tests at autoconf time, but at configure time.# This allows AC_NO_EXECUTABLES to be invoked conditionally.AC_DEFUN_ONCE([AC_NO_EXECUTABLES],[m4_divert_push([KILL])m4_divert_text([DEFAULTS], [ac_no_link=no])AC_BEFORE([$0], [_AC_COMPILER_EXEEXT])AC_BEFORE([$0], [AC_LINK_IFELSE])m4_define([_AC_COMPILER_EXEEXT],[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])if _AC_DO_VAR(ac_link); then ac_no_link=no ]m4_defn([_AC_COMPILER_EXEEXT])[else ac_no_link=yes # Setting cross_compile will disable run tests; it will # also disable AC_CHECK_FILE but that's generally # correct if we can't link. cross_compiling=yes EXEEXT= _AC_COMPILER_EXEEXT_CROSSfi])m4_define([AC_LINK_IFELSE],[if test x$ac_no_link = xyes; then AC_MSG_ERROR([Link tests are not allowed after AC@&t@_NO_EXECUTABLES.])fi]m4_defn([AC_LINK_IFELSE]))m4_divert_pop()dnl])# AC_NO_EXECUTABLES# ----------------------------- ## Computing EXEEXT and OBJEXT. ## ----------------------------- ## Files to ignore# ---------------# Ignore .d files produced by CFLAGS=-MD.## On UWIN (which uses a cc wrapper for MSVC), the compiler also generates# a .pdb file## When the w32 free Borland C++ command line compiler links a program# (conftest.exe), it also produces a file named `conftest.tds' in# addition to `conftest.obj'.## - *.bb, *.bbg# Created per object by GCC when given -ftest-coverage.## - *.xSYM# Created on BeOS. Seems to be per executable.## - *.map, *.inf# Created by the Green Hills compiler.# _AC_COMPILER_OBJEXT_REJECT# --------------------------# Case/esac pattern matching the files to be ignored when looking for# compiled object files.m4_define([_AC_COMPILER_OBJEXT_REJECT],[*.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf])# _AC_COMPILER_EXEEXT_REJECT# --------------------------# Case/esac pattern matching the files to be ignored when looking for# compiled executables.m4_define([_AC_COMPILER_EXEEXT_REJECT],[_AC_COMPILER_OBJEXT_REJECT | *.o | *.obj])# We must not AU define them, because autoupdate would then remove# them, which is right, but Automake 1.4 would remove the support for# $(EXEEXT) etc.# FIXME: Remove this once Automake fixed.AC_DEFUN([AC_EXEEXT], [])AC_DEFUN([AC_OBJEXT], [])# _AC_COMPILER_EXEEXT_DEFAULT# ---------------------------# Check for the extension used for the default name for executables.## We do this in order to find out what is the extension we must add for# creating executables (see _AC_COMPILER_EXEEXT's comments).## Beware of `expr' that may return `0' or `'. Since this macro is# the first one in touch with the compiler, it should also check that# it compiles properly.## On OpenVMS 7.1 system, the DEC C 5.5 compiler when called through a# GNV (gnv.sourceforge.net) cc wrapper, produces the output file named# `a_out.exe'.m4_define([_AC_COMPILER_EXEEXT_DEFAULT],[# Try to create an executable without -o first, disregard a.out.# It will help us diagnose broken compilers, and finding out an intuition# of exeext.AC_MSG_CHECKING([for _AC_LANG compiler default output file name])ac_link_default=`echo "$ac_link" | sed ['s/ -o *conftest[^ ]*//']`## List of possible output files, starting from the most likely.# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)# only as a last resort. b.out is created by i960 compilers.ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'## The IRIX 6 linker writes into existing files which may not be# executable, retaining their permissions. Remove them first so a# subsequent execution test works.ac_rmfiles=for ac_file in $ac_filesdo case $ac_file in _AC_COMPILER_EXEEXT_REJECT ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esacdonerm -f $ac_rmfilesAS_IF([_AC_DO_VAR(ac_link_default)],[# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'# in a Makefile. We should not override ac_cv_exeext if it was cached,# so that the user can short-circuit this test for compilers unknown to# Autoconf.for ac_file in $ac_filesdo test -f "$ac_file" || continue case $ac_file in _AC_COMPILER_EXEEXT_REJECT ) ;; [[ab]].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esacdonetest "$ac_cv_exeext" = no && ac_cv_exeext=], [_AC_MSG_LOG_CONFTESTAC_MSG_FAILURE([_AC_LANG compiler cannot create executables], 77)])ac_exeext=$ac_cv_exeextAC_MSG_RESULT([$ac_file])])# _AC_COMPILER_EXEEXT_DEFAULT# _AC_COMPILER_EXEEXT_WORKS# -------------------------m4_define([_AC_COMPILER_EXEEXT_WORKS],[# Check that the compiler produces executables we can run. If not, either# the compiler is broken, or we cross compile.AC_MSG_CHECKING([whether the _AC_LANG compiler works])# FIXME: These cross compiler hacks should be removed for Autoconf 3.0# If not cross compiling, check that we can run a simple program.if test "$cross_compiling" != yes; then if _AC_DO_TOKENS([./$ac_file]); then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else AC_MSG_FAILURE([cannot run _AC_LANG compiled programs.If you meant to cross compile, use `--host'.]) fi fifiAC_MSG_RESULT([yes])])# _AC_COMPILER_EXEEXT_WORKS# _AC_COMPILER_EXEEXT_CROSS# -------------------------m4_define([_AC_COMPILER_EXEEXT_CROSS],[# Check that the compiler produces executables we can run. If not, either# the compiler is broken, or we cross compile.AC_MSG_CHECKING([whether we are cross compiling])AC_MSG_RESULT([$cross_compiling])])# _AC_COMPILER_EXEEXT_CROSS# _AC_COMPILER_EXEEXT_O# ---------------------# Check for the extension used when `-o foo'. Try to see if ac_cv_exeext,# as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK.m4_define([_AC_COMPILER_EXEEXT_O],[AC_MSG_CHECKING([for suffix of executables])AS_IF([_AC_DO_VAR(ac_link)],[# If both `conftest.exe' and `conftest' are `present' (well, observable)# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will# work properly (i.e., refer to `conftest.exe'), while it won't with# `rm'.for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in _AC_COMPILER_EXEEXT_REJECT ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` break;; * ) break;; esacdone], [AC_MSG_FAILURE([cannot compute suffix of executables: cannot compile and link])])rm -f conftest$ac_cv_exeextAC_MSG_RESULT([$ac_cv_exeext])])# _AC_COMPILER_EXEEXT_O# _AC_COMPILER_EXEEXT# -------------------# Check for the extension used for executables. It compiles a test# executable. If this is called, the executable extensions will be# automatically used by link commands run by the configure script.## Note that some compilers (cross or not), strictly obey to `-o foo' while# the host requires `foo.exe', so we should not depend upon `-o' to# test EXEEXT. But then, be sure not to destroy user files.## Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT# checks whether the compiler works.m4_define([_AC_COMPILER_EXEEXT],[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])ac_clean_files_save=$ac_clean_filesac_clean_files="$ac_clean_files a.out a.exe b.out"_AC_COMPILER_EXEEXT_DEFAULT_AC_COMPILER_EXEEXT_WORKSrm -f a.out a.exe conftest$ac_cv_exeext b.outac_clean_files=$ac_clean_files_save_AC_COMPILER_EXEEXT_CROSS_AC_COMPILER_EXEEXT_Orm -f conftest.$ac_extAC_SUBST([EXEEXT], [$ac_cv_exeext])dnlac_exeext=$EXEEXT])# _AC_COMPILER_EXEEXT# _AC_COMPILER_OBJEXT# -------------------# Check the object extension used by the compiler: typically `.o' or# `.obj'. If this is called, some other behavior will change,# determined by ac_objext.## This macro is called by AC_LANG_COMPILER, the latter being required# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. And in fact,# don't, since _AC_COMPILE_IFELSE needs to know ac_objext for the `test -s'# it includes. So do it by hand.m4_define([_AC_COMPILER_OBJEXT],[AC_CACHE_CHECK([for suffix of object files], ac_cv_objext,[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])rm -f conftest.o conftest.objAS_IF([_AC_DO_VAR(ac_compile)],[for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in _AC_COMPILER_OBJEXT_REJECT ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esacdone], [_AC_MSG_LOG_CONFTESTAC_MSG_FAILURE([cannot compute suffix of object files: cannot compile])])rm -f conftest.$ac_cv_objext conftest.$ac_ext])AC_SUBST([OBJEXT], [$ac_cv_objext])dnlac_objext=$OBJEXT])# _AC_COMPILER_OBJEXT## ------------------------------- #### 4. Compilers' characteristics. #### ------------------------------- ### AC_LANG_WERROR# ------------------# Treat warnings from the current language's preprocessor, compiler, and# linker as fatal errors.AC_DEFUN([AC_LANG_WERROR],[m4_divert_text([DEFAULTS], [ac_[]_AC_LANG_ABBREV[]_werror_flag=no])ac_[]_AC_LANG_ABBREV[]_werror_flag=yes])# AC_LANG_WERROR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -