📄 acgeneral.m4
字号:
dnl AC_CONFIG_AUX_DIR(DIR)AC_DEFUN(AC_CONFIG_AUX_DIR,[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)])dnl The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'.dnl There's no need to call this macro explicitly; just AC_REQUIRE it.AC_DEFUN(AC_CONFIG_AUX_DIR_DEFAULT,[AC_CONFIG_AUX_DIRS($srcdir $srcdir/.. $srcdir/../..)])dnl Internal subroutine.dnl Search for the configuration auxiliary files in directory list $1.dnl We look only for install-sh, so users of AC_PROG_INSTALLdnl do not automatically need to distribute the other auxiliary files.dnl AC_CONFIG_AUX_DIRS(DIR ...)AC_DEFUN(AC_CONFIG_AUX_DIRS,[ac_aux_dir=for ac_dir in $1; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break fidoneif test -z "$ac_aux_dir"; then AC_MSG_ERROR([can not find install-sh or install.sh in $1])fiac_config_guess=$ac_aux_dir/config.guessac_config_sub=$ac_aux_dir/config.subac_configure=$ac_aux_dir/configure # This should be Cygnus configure.AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl])dnl Canonicalize the host, target, and build system types.AC_DEFUN(AC_CANONICAL_SYSTEM,[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnlAC_BEFORE([$0], [AC_ARG_PROGRAM])# Do some error checking and defaulting for the host and target type.# The inputs are:# configure --host=HOST --target=TARGET --build=BUILD NONOPT## The rules are:# 1. You are not allowed to specify --host, --target, and nonopt at the# same time.# 2. Host defaults to nonopt.# 3. If nonopt is not specified, then host defaults to the current host,# as determined by config.guess.# 4. Target and build default to nonopt.# 5. If nonopt is not specified, then target and build default to host.# The aliases save the names the user supplied, while $host etc.# will get canonicalized.case $host---$target---$nonopt inNONE---*---* | *---NONE---* | *---*---NONE) ;;*) AC_MSG_ERROR(can only configure for one host and one target at a time) ;;esacAC_CANONICAL_HOSTAC_CANONICAL_TARGETAC_CANONICAL_BUILDtest "$host_alias" != "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}-])dnl Subroutines of AC_CANONICAL_SYSTEM.AC_DEFUN(AC_CANONICAL_HOST,[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl# Make sure we can run config.sub.if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :else AC_MSG_ERROR(can not run $ac_config_sub)fiAC_MSG_CHECKING(host system type)dnl Set host_alias.host_alias=$hostcase "$host_alias" inNONE) case $nonopt in NONE) if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : else AC_MSG_ERROR(can not guess host type; you must specify one) fi ;; *) host_alias=$nonopt ;; esac ;;esacdnl Set the other host vars.changequote(<<, >>)dnlhost=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`changequote([, ])dnlAC_MSG_RESULT($host)AC_SUBST(host)dnlAC_SUBST(host_alias)dnlAC_SUBST(host_cpu)dnlAC_SUBST(host_vendor)dnlAC_SUBST(host_os)dnl])dnl Internal use only.AC_DEFUN(AC_CANONICAL_TARGET,[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnlAC_MSG_CHECKING(target system type)dnl Set target_alias.target_alias=$targetcase "$target_alias" inNONE) case $nonopt in NONE) target_alias=$host_alias ;; *) target_alias=$nonopt ;; esac ;;esacdnl Set the other target vars.changequote(<<, >>)dnltarget=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias`target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`changequote([, ])dnlAC_MSG_RESULT($target)AC_SUBST(target)dnlAC_SUBST(target_alias)dnlAC_SUBST(target_cpu)dnlAC_SUBST(target_vendor)dnlAC_SUBST(target_os)dnl])dnl Internal use only.AC_DEFUN(AC_CANONICAL_BUILD,[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnlAC_MSG_CHECKING(build system type)dnl Set build_alias.build_alias=$buildcase "$build_alias" inNONE) case $nonopt in NONE) build_alias=$host_alias ;; *) build_alias=$nonopt ;; esac ;;esacdnl Set the other build vars.changequote(<<, >>)dnlbuild=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`changequote([, ])dnlAC_MSG_RESULT($build)AC_SUBST(build)dnlAC_SUBST(build_alias)dnlAC_SUBST(build_cpu)dnlAC_SUBST(build_vendor)dnlAC_SUBST(build_os)dnl])dnl AC_VALIDATE_CACHED_SYSTEM_TUPLE[(cmd)]dnl if the cache file is inconsistent with the current host,dnl target and build system types, execute CMD or print a defaultdnl error message.AC_DEFUN(AC_VALIDATE_CACHED_SYSTEM_TUPLE, [ AC_REQUIRE([AC_CANONICAL_SYSTEM]) AC_MSG_CHECKING([cached system tuple]) if { test x"${ac_cv_host_system_type+set}" = x"set" && test x"$ac_cv_host_system_type" != x"$host"; } || { test x"${ac_cv_build_system_type+set}" = x"set" && test x"$ac_cv_build_system_type" != x"$build"; } || { test x"${ac_cv_target_system_type+set}" = x"set" && test x"$ac_cv_target_system_type" != x"$target"; }; then AC_MSG_RESULT([different]) ifelse($#, 1, [$1], [AC_MSG_ERROR([remove config.cache and re-run configure])]) else AC_MSG_RESULT(ok) fi ac_cv_host_system_type="$host" ac_cv_build_system_type="$build" ac_cv_target_system_type="$target"])dnl ### Caching test resultsdnl Look for site or system specific initialization scripts.dnl AC_SITE_LOAD()define(AC_SITE_LOAD,[# Prefer explicitly selected file to automatically selected ones.if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fififor ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then echo "loading site script $ac_site_file" . "$ac_site_file" fidone])dnl AC_CACHE_LOAD()define(AC_CACHE_LOAD,[if test -r "$cache_file"; then echo "loading cache $cache_file" . $cache_fileelse echo "creating cache $cache_file" > $cache_filefi])dnl AC_CACHE_SAVE()define(AC_CACHE_SAVE,[cat > confcache <<\EOF# This file is a shell script that caches the results of configure# tests run on this system so they can be shared between configure# scripts and configure runs. It is not useful on other systems.# If it contains results you don't want to keep, you may remove or edit it.## By default, configure uses ./config.cache as the cache file,# creating it if it does not exist already. You can give configure# the --cache-file=FILE option to use a different cache file; that is# what configure does when it calls configure scripts in# subdirectories, so they share the cache.# Giving --cache-file=/dev/null disables caching, for debugging configure.# config.status only pays attention to the cache file if you give it the# --recheck option to rerun configure.#EOFdnl Allow a site initialization script to override cache values.# The following way of writing the cache mishandles newlines in values,# but we know of no workaround that is simple, portable, and efficient.# So, don't put newlines in cache variables' values.# Ultrix sh set writes to stderr and can't be redirected directly,# and sets the high bit in the cache file unless we assign to the vars.changequote(, )dnl(set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). sed -n \ -e "s/'/'\\\\''/g" \ -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' ;; esac >> confcachechangequote([, ])dnlif cmp -s $cache_file confcache; then :else if test -w $cache_file; then echo "updating cache $cache_file" cat confcache > $cache_file else echo "not updating unwritable cache $cache_file" fifirm -f confcache])dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved.dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT)define(AC_CACHE_VAL,[dnl We used to use the below line, but it fails if the 1st arg is adnl shell variable, so we need the eval.dnl if test "${$1+set}" = set; thendnl the '' avoids an AIX 4.1 sh bug ("invalid expansion").if eval "test \"`echo '$''{'$1'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&AC_FD_MSGelse $2fi])dnl AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS)define(AC_CACHE_CHECK,[AC_MSG_CHECKING([$1])AC_CACHE_VAL([$2], [$3])AC_MSG_RESULT([$]$2)])dnl ### Defining symbolsdnl Set VARIABLE to VALUE, verbatim, or 1.dnl AC_DEFINE(VARIABLE [, VALUE])define(AC_DEFINE,[cat >> confdefs.h <<\EOF[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)EOF])dnl Similar, but perform shell substitutions $ ` \ once on VALUE.define(AC_DEFINE_UNQUOTED,[cat >> confdefs.h <<EOF[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)EOF])dnl ### Setting output variablesdnl This macro protects VARIABLE from being diverted twicednl if this macro is called twice for it.dnl AC_SUBST(VARIABLE)define(AC_SUBST,[ifdef([AC_SUBST_$1], ,[define([AC_SUBST_$1], )dnlAC_DIVERT_PUSH(AC_DIVERSION_SED)dnls%@$1@%[$]$1%gAC_DIVERT_POP()dnl])])dnl AC_SUBST_FILE(VARIABLE)define(AC_SUBST_FILE,[ifdef([AC_SUBST_$1], ,[define([AC_SUBST_$1], )dnlAC_DIVERT_PUSH(AC_DIVERSION_SED)dnl/@$1@/r [$]$1s%@$1@%%gAC_DIVERT_POP()dnl])])dnl ### Printing messagesdnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)define(AC_MSG_CHECKING,[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSGecho "configure:__oline__: checking $1" >&AC_FD_CC])dnl AC_CHECKING(FEATURE-DESCRIPTION)define(AC_CHECKING,[echo "checking $1" 1>&AC_FD_MSGecho "configure:__oline__: checking $1" >&AC_FD_CC])dnl AC_MSG_RESULT(RESULT-DESCRIPTION)define(AC_MSG_RESULT,[echo "$ac_t""$1" 1>&AC_FD_MSG])dnl AC_VERBOSE(RESULT-DESCRIPTION)define(AC_VERBOSE,[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnlecho " $1" 1>&AC_FD_MSG])dnl AC_MSG_WARN(PROBLEM-DESCRIPTION)define(AC_MSG_WARN,[echo "configure: warning: $1" 1>&2])dnl AC_MSG_ERROR(ERROR-DESCRIPTION)define(AC_MSG_ERROR,[{ echo "configure: error: $1" 1>&2; exit 1; }])dnl ### Selecting which language to use for testingdnl AC_LANG_C()AC_DEFUN(AC_LANG_C,[define([AC_LANG], [C])dnlac_ext=c# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.ac_cpp='$CPP $CPPFLAGS'ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'cross_compiling=$ac_cv_prog_cc_cross])dnl AC_LANG_CPLUSPLUS()AC_DEFUN(AC_LANG_CPLUSPLUS,[define([AC_LANG], [CPLUSPLUS])dnlac_ext=C# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.ac_cpp='$CXXCPP $CPPFLAGS'ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'cross_compiling=$ac_cv_prog_cxx_cross])dnl AC_LANG_FORTRAN77()AC_DEFUN(AC_LANG_FORTRAN77,[define([AC_LANG], [FORTRAN77])dnlac_ext=fac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&AC_FD_CC'ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC'cross_compiling=$ac_cv_prog_f77_cross])dnl Push the current language on a stack.dnl AC_LANG_SAVE()define(AC_LANG_SAVE,[pushdef([AC_LANG_STACK], AC_LANG)])dnl Restore the current language from the stack.dnl AC_LANG_RESTORE()pushdef([AC_LANG_RESTORE],[ifelse(AC_LANG_STACK, [C], [AC_LANG_C],dnlAC_LANG_STACK, [CPLUSPLUS], [AC_LANG_CPLUSPLUS],dnlAC_LANG_STACK, [FORTRAN77], [AC_LANG_FORTRAN77])[]popdef([AC_LANG_STACK])])
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -