📄 aclocal_cc.m4
字号:
if test "$pac_cv_c_inline" = "no" ; then AC_DEFINE(inline,,[if C does not support inline])fi])dnldnldnl/*Ddnl PAC_C_CPP_CONCAT - Check whether the C compiler accepts ISO CPP stringdnl concatenationdnldnl Synopsis:dnl PAC_C_CPP_CONCAT([true-action],[false-action])dnldnl Output Effects:dnl Invokes the true or false actiondnldnlD*/AC_DEFUN(PAC_C_CPP_CONCAT,[pac_pound="#"AC_CACHE_CHECK([that the compiler $CC accepts $ac_pound$ac_pound for concatenation in cpp],pac_cv_c_cpp_concat,[AC_TRY_COMPILE([#define concat(a,b) a##b],[int concat(a,b);return ab;],pac_cv_cpp_concat="yes",pac_cv_cpp_concat="no")])if test $pac_cv_c_cpp_concat = "yes" ; then ifelse([$1],,:,[$1])else ifelse([$2],,:,[$2])fi])dnldnldnl/*Ddnl PAC_FUNC_GETTIMEOFDAY - Check whether gettimeofday takes 1 or 2 argumentsdnldnl Synopsisdnl PAC_IS_GETTIMEOFDAY_OK(ok_action,failure_action)dnldnl Notes:dnl One version of Solaris accepted only one argument.dnldnlD*/AC_DEFUN(PAC_FUNC_GETTIMEOFDAY,[AC_CACHE_CHECK([whether gettimeofday takes 2 arguments],pac_cv_func_gettimeofday,[AC_TRY_COMPILE([#include <sys/time.h>],[struct timeval tp;gettimeofday(&tp,(void*)0);return 0;],pac_cv_func_gettimeofday="yes",pac_cv_func_gettimeofday="no")])if test "$pac_cv_func_gettimeofday" = "yes" ; then ifelse($1,,:,$1)else ifelse($2,,:,$2)fi])dnldnl/*Ddnl PAC_C_RESTRICT - Check if C supports restrictdnldnl Synopsis:dnl PAC_C_RESTRICTdnldnl Output Effect:dnl Defines 'restrict' if some version of restrict is supported; otherwisednl defines 'restrict' as empty. This allows you to include 'restrict' in dnl declarations in the same way that 'AC_C_CONST' allows you to use 'const'dnl in declarations even when the C compiler does not support 'const'dnldnl Note that some compilers accept restrict only with additional options.dnl DEC/Compaq/HP Alpha Unix (Tru64 etc.) -accept restrict_keyworddnldnlD*/AC_DEFUN(PAC_C_RESTRICT,[AC_CACHE_CHECK([for restrict],pac_cv_c_restrict,[AC_TRY_COMPILE(,[int * restrict a;],pac_cv_c_restrict="restrict",pac_cv_c_restrict="no")if test "$pac_cv_c_restrict" = "no" ; then AC_TRY_COMPILE(,[int * _Restrict a;],pac_cv_c_restrict="_Restrict", pac_cv_c_restrict="no")fiif test "$pac_cv_c_restrict" = "no" ; then AC_TRY_COMPILE(,[int * __restrict a;],pac_cv_c_restrict="__restrict", pac_cv_c_restrict="no")fi])if test "$pac_cv_c_restrict" = "no" ; then restrict_val=""elif test "$pac_cv_c_restrict" != "restrict" ; then restrict_val=$pac_cv_c_restrictfiif test "$restrict_val" != "restrict" ; then AC_DEFINE_UNQUOTED(restrict,$restrict_val,[if C does not support restrict])fi])dnldnldnl/*Ddnl PAC_HEADER_STDARG - Check whether standard args are defined and whetherdnl they are old style or new stylednldnl Synopsis:dnl PAC_HEADER_STDARG(action if works, action if oldstyle, action if fails)dnldnl Output Effects:dnl Defines HAVE_STDARG_H if the header exists.dnl defines dnldnl Notes:dnl It isn't enough to check for stdarg. Even gcc doesn't get it right;dnl on some systems, the gcc version of stdio.h loads stdarg.h `with the wrongdnl options` (causing it to choose the `old style` 'va_start' etc).dnldnl The original test tried the two-arg version first; the old-stylednl va_start took only a single arg.dnl This turns out to be VERY tricky, because some compilers (e.g., Solaris) dnl are quite happy to accept the *wrong* number of arguments to a macro!dnl Instead, we try to find a clean compile version, using our specialdnl PAC_C_TRY_COMPILE_CLEAN command.dnldnlD*/AC_DEFUN(PAC_HEADER_STDARG,[AC_CHECK_HEADER(stdarg.h)dnl Sets ac_cv_header_stdarg_hif test "$ac_cv_header_stdarg_h" = "yes" ; then dnl results are yes,oldstyle,no. AC_CACHE_CHECK([whether stdarg is oldstyle], pac_cv_header_stdarg_oldstyle,[PAC_C_TRY_COMPILE_CLEAN([#include <stdio.h>#include <stdarg.h>],[int func( int a, ... ){int b;va_list ap;va_start( ap );b = va_arg(ap, int);printf( "%d-%d\n", a, b );va_end(ap);fflush(stdout);return 0;}int main() { func( 1, 2 ); return 0;}],pac_check_compile)case $pac_check_compile in 0) pac_cv_header_stdarg_oldstyle="yes" ;; 1) pac_cv_header_stdarg_oldstyle="may be newstyle" ;; 2) pac_cv_header_stdarg_oldstyle="no" # compile failed ;;esac])if test "$pac_cv_header_stdarg_oldstyle" = "yes" ; then ifelse($2,,:,[$2])else AC_CACHE_CHECK([whether stdarg works], pac_cv_header_stdarg_works,[ PAC_C_TRY_COMPILE_CLEAN([#include <stdio.h>#include <stdarg.h>],[int func( int a, ... ){int b;va_list ap;va_start( ap, a );b = va_arg(ap, int);printf( "%d-%d\n", a, b );va_end(ap);fflush(stdout);return 0;}int main() { func( 1, 2 ); return 0;}],pac_check_compile)case $pac_check_compile in 0) pac_cv_header_stdarg_works="yes" ;; 1) pac_cv_header_stdarg_works="yes with warnings" ;; 2) pac_cv_header_stdarg_works="no" ;;esac])fi # test on oldstyleif test "$pac_cv_header_stdarg_works" = "no" ; then ifelse($3,,:,[$3])else ifelse($1,,:,[$1])fielse ifelse($3,,:,[$3])fi # test on header])dnl/*Ddnl PAC_C_TRY_COMPILE_CLEAN - Try to compile a program, separating successdnl with no warnings from success with warnings.dnldnl Synopsis:dnl PAC_C_TRY_COMPILE_CLEAN(header,program,flagvar)dnldnl Output Effect:dnl The 'flagvar' is set to 0 (clean), 1 (dirty but success ok), or 2dnl (failed).dnldnlD*/AC_DEFUN(PAC_C_TRY_COMPILE_CLEAN,[$3=2dnl Get the compiler output to test againstif test -z "$pac_TRY_COMPLILE_CLEAN" ; then rm -f conftest* echo 'int try(void);int try(void){return 0;}' > conftest.c if ${CC-cc} $CFLAGS -c conftest.c >conftest.bas 2>&1 ; then if test -s conftest.bas ; then pac_TRY_COMPILE_CLEAN_OUT=`cat conftest.bas` fi pac_TRY_COMPILE_CLEAN=1 else AC_MSG_WARN([Could not compile simple test program!]) if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi fifidnldnl Create the program that we need to test withrm -f conftest*cat >conftest.c <<EOF#include "confdefs.h"[$1][$2]EOFdnldnl Compile it and testif ${CC-cc} $CFLAGS -c conftest.c >conftest.bas 2>&1 ; then dnl Success. Is the output the same? if test "$pac_TRY_COMPILE_CLEAN_OUT" = "`cat conftest.bas`" ; then $3=0 else cat conftest.c >>config.log if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi $3=1 fielse dnl Failure. Set flag to 2 cat conftest.c >>config.log if test -s conftest.bas ; then cat conftest.bas >> config.log ; fi $3=2firm -f conftest*])dnldnl/*Ddnl PAC_PROG_C_UNALIGNED_DOUBLES - Check that the C compiler allows unaligneddnl doublesdnldnl Synopsis:dnl PAC_PROG_C_UNALIGNED_DOUBLES(action-if-true,action-if-false,dnl action-if-unknown)dnldnl Notes:dnl 'action-if-unknown' is used in the case of cross-compilation.dnlD*/AC_DEFUN(PAC_PROG_C_UNALIGNED_DOUBLES,[AC_CACHE_CHECK([whether C compiler allows unaligned doubles],pac_cv_prog_c_unaligned_doubles,[AC_TRY_RUN([void fetch_double( v )double *v;{*v = 1.0;}int main( argc, argv )int argc;char **argv;{int p[4];double *p_val;fetch_double( (double *)&(p[0]) );p_val = (double *)&(p[0]);if (*p_val != 1.0) return 1;fetch_double( (double *)&(p[1]) );p_val = (double *)&(p[1]);if (*p_val != 1.0) return 1;return 0;}],pac_cv_prog_c_unaligned_doubles="yes",pac_cv_prog_c_unaligned_doubles="no",pac_cv_prog_c_unaligned_doubles="unknown")])ifelse($1,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "yes" ; then $1fi)ifelse($2,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "no" ; then $2fi)ifelse($3,,,if test "X$pac_cv_prog_c_unaligned_doubles" = "unknown" ; then $3fi)])dnldnl/*D dnl PAC_PROG_C_WEAK_SYMBOLS - Test whether C supports weak symbols.dnldnl Synopsisdnl PAC_PROG_C_WEAK_SYMBOLS(action-if-true,action-if-false)dnldnl Output Effect:dnl Defines one of the following if a weak symbol pragma is found:dnl.vbdnl HAVE_PRAGMA_WEAK - #pragma weakdnl HAVE_PRAGMA_HP_SEC_DEF - #pragma _HP_SECONDARY_DEFdnl HAVE_PRAGMA_CRI_DUP) - #pragma _CRI duplicate x as ydnl.vednl dnlD*/AC_DEFUN(PAC_PROG_C_WEAK_SYMBOLS,[pragma_extra_message=""AC_CACHE_CHECK([for type of weak symbol support],pac_cv_prog_c_weak_symbols,[# Test for weak symbol support...# We can't put # in the message because it causes autoconf to generate# incorrect codeAC_TRY_LINK([extern int PFoo(int);#pragma weak PFoo = Fooint Foo(a) { return a; }],[return PFoo(1);],has_pragma_weak=yes)## Some systems (Linux ia64 and ecc, for example), support weak symbols# only within a single object file! This tests that case.if test "$has_pragma_weak" = yes ; then rm -f conftest* cat >>conftest1.c <<EOF#pragma weak PFoo = Fooint Foo(int);int Foo(a) { return a; }EOF cat >>conftest2.c <<EOFextern int PFoo(int);int main() {return PFoo(0);}EOF ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1' if eval $ac_link2 ; then pac_cv_prog_c_weak_symbols="pragma weak" else echo "$ac_link2" >>config.log echo "Failed program was" >>config.log cat conftest1.c >>config.log cat conftest2.c >>config.log if test -s conftest.out ; then cat conftest.out >> config.log ; fi has_pragma_weak=0 pragma_extra_message="pragma weak does not work outside of a file" fi rm -f conftest*fidnlif test -z "$pac_cv_prog_c_weak_symbols" ; then AC_TRY_LINK([extern int PFoo(int);#pragma _HP_SECONDARY_DEF Foo PFooint Foo(a) { return a; }],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _HP_SECONDARY_DEF")fidnlif test -z "$pac_cv_prog_c_weak_symbols" ; then AC_TRY_LINK([extern int PFoo(int);#pragma _CRI duplicate PFoo as Fooint Foo(a) { return a; }],[return PFoo(1);],pac_cv_prog_c_weak_symbols="pragma _CRI duplicate x as y")fidnlif test -z "$pac_cv_prog_c_weak_symbols" ; then pac_cv_prog_c_weak_symbols="no"fi])dnldnl If there is an extra explanatory message, echo it now so that itdnl doesn't interfere with the cache result valueif test -n "$pragma_extra_message" ; then echo $pragma_extra_messagefidnlif test "$pac_cv_prog_c_weak_symbols" = "no" ; then ifelse([$2],,:,[$2])else case "$pac_cv_prog_c_weak_symbols" in "pragma weak") AC_DEFINE(HAVE_PRAGMA_WEAK,,[Supports weak pragma]) ;; "pragma _HP") AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,,[HP style weak pragma]) ;; "pragma _CRI") AC_DEFINE(HAVE_PRAGMA_CRI_DUP,,[Cray style weak pragma]) ;; esac ifelse([$1],,:,[$1])fi])## This is a replacement that checks that FAILURES are signaled as well# (later configure macros look for the .o file, not just success from the# compiler, but they should not HAVE to#dnl --- insert 2.52 compatibility here ---dnl 2.52 does not have AC_PROG_CC_WORKSifdef([AC_PROG_CC_WORKS],,[AC_DEFUN([AC_PROG_CC_WORKS],)])dnlAC_DEFUN(PAC_PROG_CC_WORKS,[AC_PROG_CC_WORKSAC_MSG_CHECKING([whether the C compiler sets its return status correctly])AC_LANG_SAVEAC_LANG_CAC_TRY_COMPILE(,[int a = bzzzt;],notbroken=no,notbroken=yes)AC_MSG_RESULT($notbroken)if test "$notbroken" = "no" ; then AC_MSG_ERROR([installation or configuration problem: C compiler does notcorrectly set error code when a fatal error occurs])fi])dnldnl/*Ddnl PAC_FUNC_CRYPT - Check that the function crypt is defineddnl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -