⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acgeneral.m4

📁 这是一个自动生成MAKEFILE的工具。在LINUX工程项目里是很好的帮手。希望对大家有点帮助。
💻 M4
📖 第 1 页 / 共 5 页
字号:
dnl ### Compiler-running mechanicsdnl The purpose of this macro is to "configure:123: command line"dnl written into config.log for every test run.dnl AC_TRY_EVAL(VARIABLE)AC_DEFUN(AC_TRY_EVAL,[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AC_FD_CC; dnl(eval [$]$1) 2>&AC_FD_CC; }])dnl AC_TRY_COMMAND(COMMAND)AC_DEFUN(AC_TRY_COMMAND,[{ ac_try='$1'; AC_TRY_EVAL(ac_try); }])dnl ### Dependencies between macrosdnl AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME)define(AC_BEFORE,[ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1])])])dnl AC_REQUIRE(MACRO-NAME)define(AC_REQUIRE,[ifdef([AC_PROVIDE_$1], ,[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnlindir([$1])AC_DIVERT_POP()dnl])])dnl AC_PROVIDE(MACRO-NAME)define(AC_PROVIDE,[define([AC_PROVIDE_$1], )])dnl AC_OBSOLETE(THIS-MACRO-NAME [, SUGGESTION])define(AC_OBSOLETE,[errprint(__file__:__line__: warning: [$1] is obsolete[$2])])dnl ### Checking for programsdnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUNDdnl               [, [VALUE-IF-NOT-FOUND] [, [PATH] [, [REJECT]]]])AC_DEFUN(AC_CHECK_PROG,[# Extract the first word of "$2", so it can be a program name with args.set dummy $2; ac_word=[$]2AC_MSG_CHECKING([for $ac_word])AC_CACHE_VAL(ac_cv_prog_$1,[if test -n "[$]$1"; then  ac_cv_prog_$1="[$]$1" # Let the user override the test.else  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"ifelse([$6], , , [  ac_prog_rejected=no])dnldnl $ac_dummy forces splitting on constant user-supplied paths.dnl POSIX.2 word splitting is done only on the output of word expansions,dnl not every word.  This closes a longstanding sh security hole.  ac_dummy="ifelse([$5], , $PATH, [$5])"  for ac_dir in $ac_dummy; do    test -z "$ac_dir" && ac_dir=.    if test -f $ac_dir/$ac_word; thenifelse([$6], , , dnl[      if test "[$ac_dir/$ac_word]" = "$6"; then        ac_prog_rejected=yes	continue      fi])dnl      ac_cv_prog_$1="$3"      break    fi  done  IFS="$ac_save_ifs"ifelse([$6], , , [if test $ac_prog_rejected = yes; then  # We found a bogon in the path, so make sure we never use it.  set dummy [$]ac_cv_prog_$1  shift  if test [$]# -gt 0; then    # We chose a different compiler from the bogus one.    # However, it has the same basename, so the bogon will be chosen    # first if we set $1 to just the basename; use the full file name.    shift    set dummy "$ac_dir/$ac_word" "[$]@"    shift    ac_cv_prog_$1="[$]@"ifelse([$2], [$4], dnl[  else    # Default is a loser.    AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnlifelse([$5], , [\$]PATH, [$5])])])dnl  fifi])dnldnl If no 4th arg is given, leave the cache variable unset,dnl so AC_CHECK_PROGS will keep looking.ifelse([$4], , , [  test -z "[$]ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnlfi])dnl$1="$ac_cv_prog_$1"if test -n "[$]$1"; then  AC_MSG_RESULT([$]$1)else  AC_MSG_RESULT(no)fiAC_SUBST($1)dnl])dnl AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]])AC_DEFUN(AC_PATH_PROG,[# Extract the first word of "$2", so it can be a program name with args.set dummy $2; ac_word=[$]2AC_MSG_CHECKING([for $ac_word])AC_CACHE_VAL(ac_cv_path_$1,[case "[$]$1" in  /*)  ac_cv_path_$1="[$]$1" # Let the user override the test with a path.  ;;  ?:/*)			   ac_cv_path_$1="[$]$1" # Let the user override the test with a dos path.  ;;  *)  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"dnl $ac_dummy forces splitting on constant user-supplied paths.dnl POSIX.2 word splitting is done only on the output of word expansions,dnl not every word.  This closes a longstanding sh security hole.  ac_dummy="ifelse([$4], , $PATH, [$4])"  for ac_dir in $ac_dummy; do     test -z "$ac_dir" && ac_dir=.    if test -f $ac_dir/$ac_word; then      ac_cv_path_$1="$ac_dir/$ac_word"      break    fi  done  IFS="$ac_save_ifs"dnl If no 3rd arg is given, leave the cache variable unset,dnl so AC_PATH_PROGS will keep looking.ifelse([$3], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl  ;;esac])dnl$1="$ac_cv_path_$1"if test -n "[$]$1"; then  AC_MSG_RESULT([$]$1)else  AC_MSG_RESULT(no)fiAC_SUBST($1)dnl])dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUNDdnl                [, PATH]])AC_DEFUN(AC_CHECK_PROGS,[for ac_prog in $2doAC_CHECK_PROG($1, [$]ac_prog, [$]ac_prog, , $4)test -n "[$]$1" && breakdoneifelse([$3], , , [test -n "[$]$1" || $1="$3"])])dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUNDdnl               [, PATH]])AC_DEFUN(AC_PATH_PROGS,[for ac_prog in $2doAC_PATH_PROG($1, [$]ac_prog, , $4)test -n "[$]$1" && breakdoneifelse([$3], , , [test -n "[$]$1" || $1="$3"])])dnl Internal subroutine.AC_DEFUN(AC_CHECK_TOOL_PREFIX,[AC_REQUIRE([AC_CANONICAL_HOST])AC_REQUIRE([AC_CANONICAL_BUILD])dnlif test $host != $build; then  ac_tool_prefix=${host_alias}-else  ac_tool_prefix=fi])dnl AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR[, VALUE-IF-NOT-FOUND [, PATH]])AC_DEFUN(AC_CHECK_TOOL,[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnlAC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2,	      ifelse([$3], , [$2], ), $4)ifelse([$3], , , [if test -z "$ac_cv_prog_$1"; thenif test -n "$ac_tool_prefix"; then  AC_CHECK_PROG($1, $2, $2, $3)else  $1="$3"fifi])])dnl Guess the value for the `prefix' variable by looking fordnl the argument program along PATH and taking its parent.dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc,dnl set `prefix' to /usr/local/gnu.dnl This comes too late to find a site file based on the prefix,dnl and it might use a cached value for the path.dnl No big loss, I think, since most configures don't use this macro anyway.dnl AC_PREFIX_PROGRAM(PROGRAM)AC_DEFUN(AC_PREFIX_PROGRAM,[if test "x$prefix" = xNONE; thenchangequote(<<, >>)dnldefine(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnlchangequote([, ])dnldnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle.echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSGAC_PATH_PROG(AC_VAR_NAME, $1)changequote(<<, >>)dnl  if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then    prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'`changequote([, ])dnl  fifiundefine([AC_VAR_NAME])dnl])dnl Try to compile, link and execute TEST-PROGRAM.  Set WORKING-VAR todnl `yes' if the current compiler works, otherwise set it ti `no'.  Setdnl CROSS-VAR to `yes' if the compiler and linker produce non-nativednl executables, otherwise set it to `no'.  Before callingdnl `AC_TRY_COMPILER()', call `AC_LANG_*' to set-up for the rightdnl language.dnl dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-VAR, CROSS-VAR)AC_DEFUN(AC_TRY_COMPILER,[cat > conftest.$ac_ext << EOFifelse(AC_LANG, [FORTRAN77], ,[[#]line __oline__ "configure"#include "confdefs.h"])[$1]EOFif AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then  [$2]=yes  # If we can't run a trivial program, we are probably using a cross compiler.  if (./conftest; exit) 2>/dev/null; then    [$3]=no  else    [$3]=yes  fielse  echo "configure: failed program was:" >&AC_FD_CC  cat conftest.$ac_ext >&AC_FD_CC  [$2]=nofirm -fr conftest*])dnl ### Checking for librariesdnl AC_TRY_LINK_FUNC(func, action-if-found, action-if-not-found)dnl Try to link a program that calls FUNC, handling GCC builtins.  Ifdnl the link succeeds, execute ACTION-IF-FOUND; otherwise, executednl ACTION-IF-NOT-FOUND.AC_DEFUN(AC_TRY_LINK_FUNC,AC_TRY_LINK(dnlifelse([$1], [main], , dnl Avoid conflicting decl of main.[/* Override any gcc2 internal prototype to avoid an error.  */]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplusextern "C"#endif])dnl[/* We use char because int might match the return type of a gcc2    builtin and then its argument prototype would still apply.  */char $1();]),[$1()],[$2],[$3]))dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUNDdnl            [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])dnl Search for a library defining FUNC, if it's not already available.AC_DEFUN(AC_SEARCH_LIBS,[AC_PREREQ([2.13])AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],[ac_func_search_save_LIBS="$LIBS"ac_cv_search_$1="no"AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"])test "$ac_cv_search_$1" = "no" && for i in $2; doLIBS="-l$i $5 $ac_func_search_save_LIBS"AC_TRY_LINK_FUNC([$1],[ac_cv_search_$1="-l$i"break])doneLIBS="$ac_func_search_save_LIBS"])if test "$ac_cv_search_$1" != "no"; then  test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"  $3else :  $4fi])dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUNDdnl              [, OTHER-LIBRARIES]]])AC_DEFUN(AC_CHECK_LIB,[AC_MSG_CHECKING([for $2 in -l$1])dnl Use a cache variable name containing both the library and function name,dnl because the test really is for library $1 defining function $2, notdnl just for library $1.  Separate tests with the same $1 and different $2sdnl may have different results.ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`AC_CACHE_VAL(ac_cv_lib_$ac_lib_var,[ac_save_LIBS="$LIBS"LIBS="-l$1 $5 $LIBS"AC_TRY_LINK(dnlifelse(AC_LANG, [FORTRAN77], ,ifelse([$2], [main], , dnl Avoid conflicting decl of main.[/* Override any gcc2 internal prototype to avoid an error.  */]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplusextern "C"#endif])dnl[/* We use char because int might match the return type of a gcc2    builtin and then its argument prototype would still apply.  */char $2();])),	    [$2()],	    eval "ac_cv_lib_$ac_lib_var=yes",	    eval "ac_cv_lib_$ac_lib_var=no")LIBS="$ac_save_LIBS"])dnlif eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then  AC_MSG_RESULT(yes)  ifelse([$3], ,[changequote(, )dnl  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`changequote([, ])dnl  AC_DEFINE_UNQUOTED($ac_tr_lib)  LIBS="-l$1 $LIBS"], [$3])else  AC_MSG_RESULT(no)ifelse([$4], , , [$4])dnlfi])dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUNDdnl                 [, OTHER-LIBRARIES]]])AC_DEFUN(AC_HAVE_LIBRARY,[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnlchangequote(<<, >>)dnldefine(<<AC_LIB_NAME>>, dnlpatsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnldefine(<<AC_CV_NAME>>, ac_cv_lib_<<>>AC_LIB_NAME)dnlchangequote([, ])dnlAC_MSG_CHECKING([for -l[]AC_LIB_NAME])AC_CACHE_VAL(AC_CV_NAME,[ac_save_LIBS="$LIBS"LIBS="-l[]AC_LIB_NAME[] $4 $LIBS"AC_TRY_LINK( , [main()], AC_CV_NAME=yes, AC_CV_NAME=no)LIBS="$ac_save_LIBS"])dnlAC_MSG_RESULT($AC_CV_NAME)if test "$AC_CV_NAME" = yes; then  ifelse([$2], ,[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z]))  LIBS="-l[]AC_LIB_NAME[] $LIBS"], [$2])ifelse([$3], , , [else  $3])dnlfiundefine([AC_LIB_NAME])dnlundefine([AC_CV_NAME])dnl])dnl ### Examining declarationsdnl AC_TRY_CPP(INCLUDES, [ACTION-IF-TRUE [, ACTION-IF-FALSE]])AC_DEFUN(AC_TRY_CPP,[AC_REQUIRE_CPP()dnlcat > conftest.$ac_ext <<EOF[#]line __oline__ "configure"#include "confdefs.h"[$1]EOFdnl Capture the stderr of cpp.  eval is necessary to expand ac_cpp.dnl We used to copy stderr to stdout and capture it in a variable, butdnl that breaks under sh -x, which writes compile commands startingdnl with ` +' to stderr in eval and subshells.ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"AC_TRY_EVAL(ac_try)ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`if test -z "$ac_err"; then  ifelse([$2], , :, [rm -rf conftest*  $2])else  echo "$ac_err" >&AC_FD_CC  echo "configure: failed program was:" >&AC_FD_CC  cat conftest.$ac_ext >&AC_FD_CCifelse([$3], , , [  rm -rf conftest*  $3])dnlfirm -f conftest*])dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [,dnl                 ACTION-IF-NOT-FOUND])AC_DEFUN(AC_EGREP_HEADER,[AC_EGREP_CPP([$1], [#include <$2>], [$3], [$4])])dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which mustdnl come early, it is not included in AC_BEFORE checks.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -