📄 aclocal.m4
字号:
fi done fidonefiif test -n "$TK_DIR" ; then AC_MSG_RESULT(found $TK_DIR/include/tk.h and $TK_DIR/lib/libtk)else if test -n "$TK_DIR_W" ; then AC_MSG_RESULT(found $TK_DIR_W but need libtk.a (and version 3.6) ) else AC_MSG_RESULT(no) fi AC_MSG_RESULT(no)fi])dnldnldnl Look for a non-standard library by looking in some named places.dnl Check for both foo.a and libfoo.a (and .so)dnl dnl PAC_FIND_USER_LIB(LIB-NAME[,LIB-LIST,ACTION-IF-FOUND,ACTION-IF-NOT-FOUND])dnl (use foo to check for foo.a and libfoo.a)dnl Checks the usual places, as well as /usr/local/LIBNAME anddnl /usr/local/LIBNAME/lib .dnl The location of the library may be found in pac_lib_file.dnl The DIRECTORY of the library may be found in pac_lib_dirdnldefine(PAC_FIND_USER_LIB,[AC_MSG_CHECKING([for library $1])pac_lib_file=""pac_lib_dir=""for dir in $2 \ /usr \ /usr/local \ /usr/local/$1 \ /usr/contrib \ /usr/contrib/$1 \ $HOME/$1 \ /opt/$1 \ /opt/local \ /opt/local/$1 \ /local/encap/$1 ; do for suffix in a so ; do if test -n "$pac_lib_dir" ; then break ; fi if test -r $dir/$1.$suffix ; then pac_lib_file=$dir/$1.$suffix pac_lib_dir=$dir break fi if test -r $dir/lib$1.$suffix ; then pac_lib_file=$dir/lib$1.$suffix pac_lib_dir=$dir break fi if test -r $dir/lib/$1.$suffix ; then pac_lib_file=$dir/lib/$1.$suffix pac_lib_dir=$dir/lib break fi if test -r $dir/lib/lib$1.$suffix ; then pac_lib_file=$dir/lib/lib$1.$suffix pac_lib_dir=$dir/lib break fi donedoneif test -n "$pac_lib_file" ; then AC_MSG_RESULT(found $pac_lib_file) ifelse([$3],,,[$3])else AC_MSG_RESULT(no) ifelse([$4],,,[$4])fi])dnldnldnl Look for a non-standard include by looking in some named places.dnl Check for foo.hdnl dnl PAC_FIND_USER_INCLUDE(FILE-NAME[,DIR-LIST,ACTION-IF-FOUND,ACTION-IF-NOT-FOUND])dnl (use foo to check for foo.h)dnl Checks the usual places, as well as /usr/local/FILENAME anddnl /usr/local/FILENAME/include .dnl The location of the include directory library may be found in pac_inc_dir.dnldefine(PAC_FIND_USER_INCLUDE,[AC_MSG_CHECKING([for include directory for $1])pac_inc_dir=""for dir in $2 \ /usr \ /usr/local \ /usr/local/$1 \ /usr/contrib \ /usr/contrib/$1 \ $HOME/$1 \ /opt/$1 \ /opt/local \ /opt/local/$1 \ /local/encap/$1 ; do if test -r $dir/$1.h ; then pac_inc_dir=$dir break fi if test -r $dir/include/$1.h ; then pac_inc_dir=$dir/include break fi if test -r $dir/lib/lib$1.a ; then pac_lib_file=$dir/lib/lib$1.a break fi if test -r $dir/lib/lib$1.so ; then pac_lib_file=$dir/lib/lib$1.so break fidoneif test -n "$pac_inc_dir" ; then AC_MSG_RESULT(found $pac_inc_dir) ifelse([$3],,,[$3])else AC_MSG_RESULT(no) ifelse([$4],,,[$4])fi])dnldnldnl The AC_CHECK_HEADER assumes that you can use cpp to check for dnl headers for the (CROSS!) compiler. This is ridiculous.dnl I've FIXED the code from version 2dnldnl ### Printing messagesdnldnldnl Check whether to use -n, \c, or newline-tab to separatednl checking messages from result messages.dnl Idea borrowed from dist 3.0.dnl Internal use only.define(AC_PROG_ECHO_N,ac_echo_n=yes[if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c='' ac_t=' ' else ac_n=-n ac_c= ac_t= fielse ac_n= ac_c='\c' ac_t=fiac_echo_test=`echo foo 1>&1`if test -z "$ac_echo_test" ; then print_error "Your sh shell does not handle the output redirection" print_error "1>&1 correctly. Configure will work around this problem," print_error "but you should report the problem to your vendor."fidefine(pac_set_echo_n,1)dnl])dnldnl AC_MSG_CHECKING(FEATURE-DESCRIPTION)define(AC_FD_MSG,1)dnldefine(AC_MSG_CHECKING,[dnldnl ifdef(pac_set_echo_n,,[if test -z "$ac_echo_n" ; thenAC_PROG_ECHO_Nfidnl ])if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; thenecho $ac_n "checking $1""... $ac_c"elseecho $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSGfi])dnldnldnl AC_MSG(msg)dnl generates "msg..." (no newline)define(AC_MSG,[dnlifdef(pac_set_echo_n,,[if test -z "$ac_echo_n" ; thenAC_PROG_ECHO_Nfi])if test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; thenecho $ac_n "$1""... $ac_c"elseecho $ac_n "$1""... $ac_c" 1>&AC_FD_MSGfi])dnldnldnl AC_CHECKING(FEATURE-DESCRIPTION)define(AC_CHECKING,dnl[echo "checking $1" 1>&AC_FD_MSG])dnldnldnl AC_MSG_RESULT(RESULT-DESCRIPTION)define(AC_MSG_RESULT,dnlif test -z "$ac_echo_test" -a AC_FD_MSG = 1 ; then[echo "$ac_t""$1"]else[echo "$ac_t""$1" 1>&AC_FD_MSG]fi)dnldnldnl PAC_CHECK_HEADER(HEADER-FILE, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND],dnl PRE-REQ-HEADERS )dnldnl BUG: AIX 4.1 can't handle a \055 (octal for -) in a tr string (sometimes;dnl it works from the shell but not within a file)dnl I've removed that and hoped that no header will include a - in thednl namednldnl This can fail if the header needs OTHER headers for the compilednl to succeed. Those headers should be specified in the "pre-req-headers"dnl For example dnl PAC_CHECK_HEADER(sys/vfs.h,AC_DEFINE(HAVE_SYS_VFS_H),,dnl [#include <sys/types.h>])dnldefine(PAC_CHECK_HEADER,dnl[dnl Do the transliteration at runtime so arg 1 can be a shell variable.changequote(,)dnlac_safe=`echo "$1" | tr '[a-z]./' '[A-Z]__'`changequote([,])dnlAC_MSG_CHECKING([for $1])dnl AC_CACHE_VAL(ac_cv_header_$ac_safe,[dnlAC_COMPILE_CHECK(,[$4][#include <$1>],main();,eval "ac_cv_header_$ac_safe=yes", eval "ac_cv_header_$ac_safe=no")dnl])dnlif eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2])else AC_MSG_RESULT(no)ifelse([$3], , , [$3])dnlfi])dnldnldnl PAC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])define(PAC_CHECK_HEADERS,[for ac_hdr in $1doPAC_CHECK_HEADER($ac_hdr,[changequote(, )dnl ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./' '[A-Z]__'`changequote([, ])dnl AC_DEFINE($ac_tr_hdr) $2], $3)dnldone])dnldnldnl WARNING: AC_HEADER_STDC uses CPP instead of CC!dnldnldnl Check to see if malloc is declared as char *malloc or void *mallocdnl If stdlib.h is not defined, then this will choose char*malloc.dnldefine(PAC_MALLOC_RETURNS_VOID,[AC_MSG_CHECKING(for malloc return type)AC_COMPILE_CHECK(,[#include <stdlib.h>],[extern void *malloc();],eval "ac_cv_malloc=void",eval "ac_cv_malloc=char")AC_MSG_RESULT($ac_cv_malloc)if test "$ac_cv_malloc" = void ; then AC_DEFINE(MALLOC_RET_VOID)fi])dnldnldnl Check that the compile actually runs. Perform first arg is yes,dnl second if falsednl PAC_CHECK_COMPILER_OK(true-action, false-action)dnldefine(PAC_CHECK_COMPILER_OK,[AC_REQUIRE([AC_CROSS_CHECK])AC_MSG_CHECKING(that the compiler $CC runs)AC_COMPILE_CHECK(,,return 0;,eval "ac_cv_ccworks=yes",eval "ac_cv_ccworks=no")AC_MSG_RESULT($ac_cv_ccworks)if test $ac_cv_ccworks = "yes" ; then ifelse([$1],,:,[$1])else# Generate output from failed test. See COMPILE_CHECK code# It really would be better if the compile tests put the output into# a file for later analysis, like conftest.out#cat > conftest.c <<EOF#include "confdefs.h"int main() { exit(0); }int t() { return 0; }EOF$CC $CFLAGS conftest.c -o conftest $LIBSrm -f conftest* ## End of output ifelse([$2],,:,[$2])fi])dnldnldnl Check that the compile accepts ANSI prototypes. Perform first arg if yes,dnl second if falsednl PAC_CHECK_CC_PROTOTYPES(true-action, false-action)dnldefine(PAC_CHECK_CC_PROTOTYPES,[AC_MSG_CHECKING(that the compiler $CC accepts ANSI prototypes)AC_COMPILE_CHECK(,[int f(double a){return 0;}],,eval "ac_cv_ccworks=yes",eval "ac_cv_ccworks=no")AC_MSG_RESULT($ac_cv_ccworks)if test $ac_cv_ccworks = "yes" ; then ifelse([$1],,:,[$1])else ifelse([$2],,:,[$2])fi])dnldnldnl Check that the compile accepts ANSI const type. Perform first arg if yes,dnl second if falsednl PAC_CHECK_CC_CONST(true-action, false-action)dnldefine(PAC_CHECK_CC_CONST,[AC_MSG_CHECKING(that the compiler $CC accepts const modifier)AC_COMPILE_CHECK(,[int f(const int a){return a;}],,eval "ac_cv_ccworks=yes",eval "ac_cv_ccworks=no")AC_MSG_RESULT($ac_cv_ccworks)if test $ac_cv_ccworks = "yes" ; then ifelse([$1],,:,[$1])else ifelse([$2],,:,[$2])fi])dnldnldnl Test the compiler to see if it actually works. First, check to seednl if the compiler works at alldnl Uses TESTCC, not CCdnl dnl The test directory is ccbugs by default, but can be overridded with dnl CCBUGSdnldefine(PAC_CORRECT_COMPILER,[AC_REQUIRE([AC_CROSS_CHECK])if test -z "$CCBUGS" ; then CCBUGS=ccbugs ; fiif test -d $CCBUGS ; then # Use "LTESTCC" as "local Test CC" if test -z "$TESTCC" ; then LTESTCC="$CC" ; else LTESTCC="$TESTCC" ; fi for file in $CCBUGS/ccfail*.c ; do CFILE=`basename $file .c` AC_MSG_CHECKING(`cat $CCBUGS/$CFILE.title`) cp $file conftest.c broken=1 rm -f conftest.out conftest.rout if eval $LTESTCC $CFLAGS -o conftest conftest.c $LIBS >conftest.out 2>&1 ; then if test -s conftest ; then ./conftest 2>&1 1>conftest.rout if test $? = 0 ; then broken=0 fi fi fi if test $broken = 1 ; then AC_MSG_RESULT(no) cat $CCBUGS/$CFILE.txt | sed 's/^/\*\#/g' if test -s conftest.out ; then echo "Output from compile step was:" cat conftest.out fi if test -s conftest.rout ; then echo "Output from run step was:" cat conftest.rout fi else AC_MSG_RESULT(yes) fi /bin/rm -f conftest conftest.c conftest.o conftest.out conftest.rout done # # These are non-fatal, but must be run for file in $CCBUGS/ccnfail*.c ; do CFILE=`basename $file .c` AC_MSG_CHECKING(`cat $CCBUGS/$CFILE.title`) cp $file conftest.c nbroken=1 rm -f conftest.out conftest.rout if eval $LTESTCC $CFLAGS -o conftest conftest.c $LIBS >conftest.out 2>&1 ; then if test -s conftest ; then ./conftest 2>&1 1>conftest.rout if test $? = 0 ; then nbroken=0 fi fi fi if test $nbroken = 1 ; then AC_MSG_RESULT(no) cat $CCBUGS/$CFILE.txt | sed 's/^/\*\#/g' if test -s conftest.out ; then echo "Output from compile step was:" cat conftest.out fi if test -s conftest.rout ; then echo "Output from run step was:" cat conftest.rout fi else AC_MSG_RESULT(yes) fi /bin/rm -f conftest conftest.c conftest.o conftest.out conftest.rout done # # Now, try the warnings. Note that this just does compiles, not runs for file in $CCBUGS/ccwarn*.c ; do CFILE=`basename $file .c` AC_MSG_CHECKING(`cat $CCBUGS/$CFILE.title`) cp $file conftest.c if eval $CC $CFLAGS \ -DCONFIGURE_ARGS_CLEAN="'"'"'-A -B'"'"'" -c \ conftest.c $LIBS > /dev/null 2>&1 ; then AC_MSG_RESULT(yes) true else AC_MSG_RESULT(no) cat $CCBUGS/$CFILE.txt | sed 's/^/\*\#/g' if test "$CFILE" = "ccwarn1" ; then CONFIGURE_ARGS_CLEAN="`echo $CONFIGURE_ARGS_CLEAN | tr ' ' '_'`" fi fi # set +x /bin/rm -f conftest conftest.[co] done # # After everything, see if there are any problems if test $broken = 1 ; then if test -z "$FAILMSG" ; then echo "Compiler $CC appears broken; aborting configure..." else eval echo "$FAILMSG" fi exit 1 fifi])dnldnldnl Check that the Fortran compiler works. We needed this first for LINUXdnl Perform first arg is yes, second if falsednl PAC_CHECK_F77_COMPILER_OK(true-action, false-action)dnl The name of the compiler is F77dnldefine(PAC_CHECK_F77_COMPILER_OK,[AC_MSG_CHECKING(that the compiler $F77 runs)cat >conftest.f <<EOF program main endEOF/bin/rm -f conftest.out$F77 $FFLAGS -c conftest.f > conftest.out 2>&1if test $? != 0 ; then AC_MSG_RESULT(no) echo "Fortran compiler returned non-zero return code" if test -s conftest.out ; then echo "Output from test was" cat conftest.out fi ifelse([$2],,:,[$2])elif test ! -s conftest.o ; then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -