📄 acspecific.m4
字号:
fi])dnl Define SET_MAKE to set ${MAKE} if make doesn't.AC_DEFUN(AC_PROG_MAKE_SET,[AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE})set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'`AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set,[cat > conftestmake <<\EOFall: @echo 'ac_maketemp="${MAKE}"'EOFchangequote(, )dnl# GNU make sometimes prints "make[1]: Entering...", which would confuse us.eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`changequote([, ])dnlif test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yeselse eval ac_cv_prog_make_${ac_make}_set=nofirm -f conftestmake])dnlif eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then AC_MSG_RESULT(yes) SET_MAKE=else AC_MSG_RESULT(no) SET_MAKE="MAKE=${MAKE-make}"fiAC_SUBST([SET_MAKE])dnl])AC_DEFUN(AC_PROG_RANLIB,[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)])dnl Check for mawk first since it's generally faster.AC_DEFUN(AC_PROG_AWK,[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )])AC_DEFUN(AC_PROG_YACC,[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])AC_DEFUN(AC_PROG_CPP,[AC_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"; thenAC_CACHE_VAL(ac_cv_prog_CPP,[ # This must be in double quotes, not single quotes, because CPP may get # substituted into the Makefile and "${CC-cc}" will confuse make. CPP="${CC-cc} -E" # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp.dnl Use a header file that comes with gcc, so configuring glibcdnl with a fresh cross-compiler works. AC_TRY_CPP([#include <assert.h>Syntax Error], , CPP="${CC-cc} -E -traditional-cpp" AC_TRY_CPP([#include <assert.h>Syntax Error], , CPP="${CC-cc} -nologo -E" AC_TRY_CPP([#include <assert.h>Syntax Error], , CPP=/lib/cpp))) ac_cv_prog_CPP="$CPP"])dnl CPP="$ac_cv_prog_CPP"else ac_cv_prog_CPP="$CPP"fiAC_MSG_RESULT($CPP)AC_SUBST(CPP)dnl])AC_DEFUN(AC_PROG_CXXCPP,[AC_MSG_CHECKING(how to run the C++ preprocessor)if test -z "$CXXCPP"; thenAC_CACHE_VAL(ac_cv_prog_CXXCPP,[AC_LANG_SAVE[]dnlAC_LANG_CPLUSPLUS[]dnl CXXCPP="${CXX-g++} -E" AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp) ac_cv_prog_CXXCPP="$CXXCPP"AC_LANG_RESTORE[]dnlfi])dnlCXXCPP="$ac_cv_prog_CXXCPP"AC_MSG_RESULT($CXXCPP)AC_SUBST(CXXCPP)dnl])dnl Require finding the C or C++ preprocessor, whichever is thednl current language.AC_DEFUN(AC_REQUIRE_CPP,[ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])])AC_DEFUN(AC_PROG_LEX,[AC_CHECK_PROG(LEX, flex, flex, lex)if test -z "$LEXLIB"then case "$LEX" in flex*) ac_lib=fl ;; *) ac_lib=l ;; esac AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib")fiAC_SUBST(LEXLIB)])dnl Check if lex declares yytext as a char * by default, not a char[].undefine([AC_DECL_YYTEXT])AC_DEFUN(AC_DECL_YYTEXT,[AC_REQUIRE_CPP()dnlAC_REQUIRE([AC_PROG_LEX])dnlAC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root,[# The minimal lex program is just a single line: %%. But some broken lexes# (Solaris, I think it was) want two %% lines, so accommodate them.echo '%%%%' | $LEXif test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yyelif test -f lexyy.c; then ac_cv_prog_lex_root=lexyyelse AC_MSG_ERROR(cannot find output from $LEX; giving up)fi])LEX_OUTPUT_ROOT=$ac_cv_prog_lex_rootAC_SUBST(LEX_OUTPUT_ROOT)dnlAC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer,[# POSIX says lex can declare yytext either as a pointer or an array; the# default is implementation-dependent. Figure out which it is, since# not all implementations provide the %pointer and %array declarations.ac_cv_prog_lex_yytext_pointer=noecho 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.cac_save_LIBS="$LIBS"LIBS="$LIBS $LEXLIB"AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes)LIBS="$ac_save_LIBS"rm -f "${LEX_OUTPUT_ROOT}.c"])dnlif test $ac_cv_prog_lex_yytext_pointer = yes; then AC_DEFINE(YYTEXT_POINTER)fi])AC_DEFUN(AC_PROG_INSTALL,[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl# Find a good install program. We prefer a C program (faster),# so one script is as good as another. But avoid the broken or# incompatible versions:# SysV /etc/install, /usr/sbin/install# SunOS /usr/etc/install# IRIX /sbin/install# AIX /bin/install# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag# AFS /usr/afsws/bin/install, which mishandles nonexistent args# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"# ./install, which can be erroneously created by make from ./install.sh.AC_MSG_CHECKING(for a BSD compatible install)if test -z "$INSTALL"; thenAC_CACHE_VAL(ac_cv_path_install,[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : else ac_cv_path_install="$ac_dir/$ac_prog -c" break 2 fi fi done ;; esac done IFS="$ac_save_IFS"])dnl if test "${ac_cv_path_install+set}" = set; then INSTALL="$ac_cv_path_install" else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL="$ac_install_sh" fifidnl We do special magic for INSTALL instead of AC_SUBST, to getdnl relative paths right.AC_MSG_RESULT($INSTALL)# Use test -z because SunOS4 sh mishandles braces in ${var-val}.# It thinks the first close brace ends the variable substitution.test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'AC_SUBST(INSTALL_PROGRAM)dnltest -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'AC_SUBST(INSTALL_SCRIPT)dnltest -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'AC_SUBST(INSTALL_DATA)dnl])AC_DEFUN(AC_PROG_LN_S,[AC_MSG_CHECKING(whether ln -s works)AC_CACHE_VAL(ac_cv_prog_LN_S,[rm -f conftestdataif ln -s X conftestdata 2>/dev/nullthen rm -f conftestdata ac_cv_prog_LN_S="ln -s"else ac_cv_prog_LN_S=lnfi])dnlLN_S="$ac_cv_prog_LN_S"if test "$ac_cv_prog_LN_S" = "ln -s"; then AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fiAC_SUBST(LN_S)dnl])define(AC_RSH,[errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code)m4exit(4)])dnl ### Checks for header filesAC_DEFUN(AC_HEADER_STDC,[AC_REQUIRE_CPP()dnlAC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc,[AC_TRY_CPP([#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no)if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI.AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no)fiif test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no)fiif test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.AC_TRY_RUN([#include <ctype.h>#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))int main () { int i; for (i = 0; i < 256; i++)if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);exit (0); }], , ac_cv_header_stdc=no, :)fi])if test $ac_cv_header_stdc = yes; then AC_DEFINE(STDC_HEADERS)fi])AC_DEFUN(AC_UNISTD_H,[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnlAC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))])AC_DEFUN(AC_USG,[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnlAC_MSG_CHECKING([for BSD string and memory functions])AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])])dnl If memchr and the like aren't declared in <string.h>, include <memory.h>.dnl To avoid problems, don't check for gcc2 built-ins.AC_DEFUN(AC_MEMORY_H,[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnlAC_MSG_CHECKING(whether string.h declares mem functions)AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no)AC_MSG_RESULT($ac_found)if test $ac_found = no; then AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)])fi])AC_DEFUN(AC_HEADER_MAJOR,[AC_CACHE_CHECK(whether sys/types.h defines makedev, ac_cv_header_sys_types_h_makedev,[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);], ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no)])if test $ac_cv_header_sys_types_h_makedev = no; thenAC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)]) if test $ac_cv_header_sys_mkdev_h = no; thenAC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)]) fifi])AC_DEFUN(AC_HEADER_DIRENT,[ac_header_dirent=noAC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, [ac_header_dirent=$ac_hdr; break])# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.if test $ac_header_dirent = dirent.h; thenAC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir")elseAC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx")fi])dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILEdnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't.dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND)AC_DEFUN(AC_CHECK_HEADER_DIRENT,[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'`AC_MSG_CHECKING([for $1 that defines DIR])AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe,[AC_TRY_COMPILE([#include <sys/types.h>#include <$1>], [DIR *dirp = 0;], eval "ac_cv_header_dirent_$ac_safe=yes", eval "ac_cv_header_dirent_$ac_safe=no")])dnlif eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then AC_MSG_RESULT(yes) $2else AC_MSG_RESULT(no)fi])dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE thatdnl defines `DIR'.dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION])define(AC_CHECK_HEADERS_DIRENT,[for ac_hdr in $1doAC_CHECK_HEADER_DIRENT($ac_hdr,[changequote(, )dnl ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`changequote([, ])dnl AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnldone])AC_DEFUN(AC_DIR_HEADER,[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnlac_header_dirent=nofor ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break])donecase "$ac_header_dirent" indirent.h) AC_DEFINE(DIRENT) ;;sys/ndir.h) AC_DEFINE(SYSNDIR) ;;sys/dir.h) AC_DEFINE(SYSDIR) ;;ndir.h) AC_DEFINE(NDIR) ;;esacAC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void,[AC_TRY_RUN([#include <sys/types.h>#include <$ac_header_dirent>int closedir(); main() { exit(closedir(opendir(".")) != 0); }], ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)])if test $ac_cv_func_closedir_void = yes; then AC_DEFINE(VOID_CLOSEDIR)fi])AC_DEFUN(AC_HEADER_STAT,[AC_CACHE_CHECK(whether stat file-mode macros are broken, ac_cv_header_stat_broken,[AC_EGREP_CPP([You lose], [#include <sys/types.h>#include <sys/stat.h>#if defined(S_ISBLK) && defined(S_IFDIR)# if S_ISBLK (S_IFDIR)You lose.# endif#endif#if defined(S_ISBLK) && defined(S_IFCHR)# if S_ISBLK (S_IFCHR)You lose.# endif#endif#if defined(S_ISLNK) && defined(S_IFREG)# if S_ISLNK (S_IFREG)You lose.# endif#endif#if defined(S_ISSOCK) && defined(S_IFREG)# if S_ISSOCK (S_IFREG)You lose.# endif#endif], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)])if test $ac_cv_header_stat_broken = yes; then AC_DEFINE(STAT_MACROS_BROKEN)fi])AC_DEFUN(AC_DECL_SYS_SIGLIST,[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h], ac_cv_decl_sys_siglist,[AC_TRY_COMPILE([#include <sys/types.h>#include <signal.h>/* NetBSD declares sys_siglist in unistd.h. */#ifdef HAVE_UNISTD_H#include <unistd.h>#endif], [char *msg = *(sys_siglist + 1);], ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)])if test $ac_cv_decl_sys_siglist = yes; then AC_DEFINE(SYS_SIGLIST_DECLARED)fi])AC_DEFUN(AC_HEADER_SYS_WAIT,[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], ac_cv_header_sys_wait_h,[AC_TRY_COMPILE([#include <sys/types.h>#include <sys/wait.h>#ifndef WEXITSTATUS#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)#endif#ifndef WIFEXITED#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)#endif], [int s;wait (&s);s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;],
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -