📄 aclocal.m4
字号:
AC_HAVE_LIBRARY(Xt, no_x=,for dir in `echo "$x_includes" | sed s/include/lib/` \ /usr/local/lib \ /usr/unsupported/lib \ /usr/x386/lib \ /usr/local/X11R6/lib \ /usr/local/X11R5/lib \ /usr/local/x11r6/lib \ /usr/local/x11r5/lib \ /usr/lib/X11 \ /usr/lib/X11R4 \ /usr/X11R6/lib \ /usr/X11R5/lib \ /usr/X11/lib \ /usr/openwin/lib \ /usr/lpp/Xamples/lib \ ; \do for extension in a so sl; do if test -r $dir/libXt.$extension; then x_libraries=$dir; no_x= break 2 fi donedone)])dnldnldnl --------------------------------------------------------dnl Test for the VERSION of tk. There are major changes between 3.6 and 4.0dnl (in particular, the type Tk_ColorModel disappeareddnl Put result into TK_VERSION (as, e.g., 3.6 or 4.0). Should test versiondnl as STRING, since we don't control the changes between versions, and dnl only versions that we know should be tested.dnl Note that this may be important ONLY if you include tk.h .dnl TKINCDIR may also be defined if the include files are not where thednl architecture-dependant library files arednldnl TK_LIB and XINCLUDES must be defined (and no_x must NOT be true)dnldefine(PAC_TK_VERSION,[AC_MSG_CHECKING(for version of TK)/bin/rm -f conftestval## Some systems have a separate tcl dir; since we need both tcl and tk# we include both directories# Tk is going to load X11; if no X11, skip this stepif test -z "$no_x" -a -n "$TK_DIR" -a -n "$TCL_DIR" ; then CFLAGSsave="$CFLAGS" CFLAGS="$CFLAGS -I$TK_DIR/include -I$TCL_DIR/include $XINCLUDES" if test -n "$TKINCDIR" ; then CFLAGS="$CFLAGS -I$TKINCDIR/include" fi PAC_TEST_PROGRAM([#include "tk.h"#include <stdio.h>main() { FILE *fp = fopen( "conftestval", "w" ); fprintf( fp, "%d.%d", TK_MAJOR_VERSION, TK_MINOR_VERSION );return 0; }], TK_VERSION=`cat conftestval`,TK_VERSION="unavailable") CFLAGS="$CFLAGSsave"elif test -n "$wishloc" ; then # It is possible to use a wish program with # set tk_version [ string range $tk_patchLevel 0 2 ] # puts stdout $tk_version TK_VERSION="unavailable"else TK_VERSION="unavailable"fiAC_MSG_RESULT($TK_VERSION)])dnldnldnl Redefine these to use msg_checking/resultdnl Also, test for broken LINUX shellsdnldefine([AC_COMPILE_CHECK],[AC_PROVIDE([$0])dnlifelse([$1], , , [AC_MSG_CHECKING(for $1)])dnlif test ! -f confdefs.h ; then AC_MSG_RESULT("!! SHELL ERROR !!") echo "The file confdefs.h created by configure has been removed" echo "This may be a problem with your shell; some versions of LINUX" echo "have this problem. See the Installation guide for more" echo "information." exit 1ficat > conftest.c <<EOF#include "confdefs.h"[$2]int main() { exit(0); }int t() { [$3] }EOFdnl Don't try to run the program, which would prevent cross-configuring.if eval $compile; then ifelse([$1], , , [AC_MSG_RESULT(yes)]) ifelse([$4], , :, [rm -rf conftest* $4])ifelse([$5], , , [else rm -rf conftest* $5])dnl ifelse([$1], , , ifelse([$5], ,else) [AC_MSG_RESULT(no)])firm -f conftest*])dnldnldnl This version compiles an entire function; used to check fordnl things like varargs done correctlydnldnl PAC_COMPILE_CHECK_FUNC(msg,function,if_true,if_false)dnldefine(PAC_COMPILE_CHECK_FUNC,[AC_PROVIDE([$0])dnlifelse([$1], , , [AC_MSG_CHECKING(for $1)])dnlif test ! -f confdefs.h ; then AC_MSG_RESULT("!! SHELL ERROR !!") echo "The file confdefs.h created by configure has been removed" echo "This may be a problem with your shell; some versions of LINUX" echo "have this problem. See the Installation guide for more" echo "information." exit 1ficat > conftest.c <<EOF#include "confdefs.h"[$2]EOFdnl Don't try to run the program, which would prevent cross-configuring.if eval $compile; then ifelse([$1], , , [AC_MSG_RESULT(yes)]) ifelse([$3], , :, [rm -rf conftest* $3])ifelse([$4], , , [else rm -rf conftest* $4])dnl ifelse([$1], , , ifelse([$4], ,else) [AC_MSG_RESULT(no)])firm -f conftest*])dnldnldnldnl checks for compiler characteristicsdnldnl AC_CROSS_CHECK is used to determine if we can run programs to dnl determine system characteristics. The basic GNU autoconf testdnl makes the assumption that return codes are properly handled. In dnl some cases, the system will pretend to run a program and return a dnl 0 return code, but actually will fail. In others, it can run thednl program, but because it doesn't properly handle return codes, mightdnl as well not. define([AC_CROSS_CHECK],[AC_PROVIDE([$0])AC_MSG_CHECKING(whether cross-compiling)# If we cannot run a trivial program, we must be cross compiling.AC_TEST_PROGRAM([main(){exit(0);}], pac_ok=1, pac_ok=0)if test $pac_ok = 1 ; then AC_TEST_PROGRAM([main(){exit(1);}], pac_ok=0 ) if test $pac_ok = 1 ; then AC_MSG_RESULT(no) else cross_compiling=1 AC_MSG_RESULT(yes, because return codes handled incorrectly) fielse cross_compiling=1 AC_MSG_RESULT(yes)fi])dnldnldnl Append SH style definitions to a filednl To generate a site file (for MAKE), use PAC_APPEND_FILE. This allowsdnl you to use configure to create a likely site file.dnldnl PAC_APPEND_FILE(varname,varvalue,file)dnl Example: PAC_APPEND_FILE("CC",$CC,"make.site")dnldefine(PAC_APPEND_FILE,[if test "$3" = "-" ; then echo "$1=$2" ; else echo "$1=$2" >> $3 ; fi])dnldnldnl See if Fortran compiler accepts -Idirectory flagdnl dnl PAC_FORTRAN_HAS_INCDIR(directory,true-action,false-action)dnldnl Fortran compiler is F77 and is passed FFLAGSdnldefine(PAC_FORTRAN_HAS_INCDIR,[AC_MSG_CHECKING([for Fortran include argument])cat > $1/conftestf.h <<EOF call sub()EOFcat > conftest.f <<EOF program main include 'conftestf.h' endEOFif $F77 $FFLAGS -c -I$1 conftest.f > /dev/null 2>&1 ; then ifelse($2,,true,$2) AC_MSG_RESULT([supports -I for include])else ifelse($3,,true,$3) AC_MSG_RESULT([does NOT support -I for include])fi/bin/rm -f conftest.f $1/conftestf.h])dnldnldnl PAC_FORTRAN_GET_INTEGER_SIZE(var_for_size)dnldnl sets var_for_size to the size. Ignores if the size cannot be determineddnldefine(PAC_FORTRAN_GET_INTEGER_SIZE,[AC_MSG_CHECKING([for size of Fortran INTEGER])/bin/rm -f conftestval/bin/rm -f conftestf.f conftestf.ocat <<EOF > conftestf.f subroutine isize( ) integer i(2) call cisize( i(1), i(2) ) endEOFif $F77 $FFLAGS -c conftestf.f >/dev/null 2>&1 ; then SaveLIBS="$LIBS" LIBS="conftestf.o $LIBS" PAC_TEST_PROGRAM([#include <stdio.h>#ifdef FORTRANCAPS#define cisize_ CISIZE#define isize_ ISIZE#elif defined(FORTRANNOUNDERSCORE)#define cisize_ cisize#define isize_ isize#endifstatic int isize_val;void cisize_( i1p, i2p )char *i1p, *i2p;{ isize_val = (i2p - i1p) * sizeof(char);}main() { FILE *f=fopen("conftestval","w"); if (!f) exit(1); isize_(); fprintf( f, "%d\n", isize_val); exit(0);}],Pac_CV_NAME=`cat conftestval`,Pac_CV_NAME="")LIBS="$SaveLIBS"else :fiif test -z "$Pac_CV_NAME" ; then # Try to compile/link with the Fortran compiler instead. This # worked for the NEC SX-4 compile_f='${CC-cc} $CFLAGS -c conftest.c; ${F77-f77} $FFLAGS -o conftest conftest.o $LIBS >/dev/null 2>&1' eval $compile_f if test ! -s conftest ; then echo "Could not build executable program:" echo "${F77-f77} $FFLAGS -o conftest conftest.o $LIBS" else /bin/rm -f conftestout if test -s conftest && (./conftest;exit) 2>conftestout ; then Pac_CV_NAME=`cat conftestval` fi fifi/bin/rm -f conftestf.f conftestf.oif test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then AC_MSG_RESULT($Pac_CV_NAME)else AC_MSG_RESULT(unavailable)fi$1=$Pac_CV_NAME])dnldnldnl PAC_FORTRAN_GET_REAL_SIZE(var_for_size)dnldnl sets var_for_size to the size. Ignores if the size cannot be determineddnldefine(PAC_FORTRAN_GET_REAL_SIZE,[AC_MSG_CHECKING([for size of Fortran REAL])/bin/rm -f conftestval/bin/rm -f conftestf.f conftestf.ocat <<EOF > conftestf.f subroutine isize( ) real i(2) call cisize( i(1), i(2) ) endEOFif $F77 $FFLAGS -c conftestf.f >/dev/null 2>&1 ; then SaveLIBS="$LIBS" LIBS="conftestf.o $LIBS" PAC_TEST_PROGRAM([#include <stdio.h>#ifdef FORTRANCAPS#define cisize_ CISIZE#define isize_ ISIZE#elif defined(FORTRANNOUNDERSCORE)#define cisize_ cisize#define isize_ isize#endifstatic int isize_val;void cisize_( i1p, i2p )char *i1p, *i2p;{ isize_val = (i2p - i1p) * sizeof(char);}main() { FILE *f=fopen("conftestval","w"); if (!f) exit(1); isize_(); fprintf( f, "%d\n", isize_val); exit(0);}],Pac_CV_NAME=`cat conftestval`,Pac_CV_NAME="")LIBS="$SaveLIBS"else :fi/bin/rm -f conftestf.f conftestf.oif test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then AC_MSG_RESULT($Pac_CV_NAME)else AC_MSG_RESULT(unavailable)fi$1=$Pac_CV_NAME])dnldnldnl See if Fortran accepts ! for commentsdnldnl PAC_FORTRAN_HAS_EXCLAM_COMMENTS(action-if-true,action-if-false)dnldefine(PAC_FORTRAN_HAS_EXCLAM_COMMENTS,[AC_MSG_CHECKING([for Fortran accepts ! for comments])cat > conftest.f <<EOF program main! This is a comment endEOFif $F77 $FFLAGS -c conftest.f > /dev/null 2>&1 ; then ifelse($1,,true,$1) AC_MSG_RESULT([yes])else ifelse($2,,true,$2) AC_MSG_RESULT([no])fi/bin/rm -f conftest.f])dnldnldnl Check that signal semantics work correctlydnldefine(PAC_SIGNALS_WORK,[AC_REQUIRE([AC_CROSS_CHECK])AC_MSG_CHECKING([that signals work correctly])cat >conftest.c <<EOF#include <signal.h>static int rc = 0, irc = 1, maxcnt=5;void handler( sig )int sig;{void (*oldsig)();oldsig = signal( SIGUSR1, handler );if (oldsig != handler) rc = 1;irc = 0;}int main(argc, argv)int argc;char **argv;{(void)signal( SIGUSR1, handler );kill( getpid(), SIGUSR1 );while (irc && maxcnt) { sleep(1); maxcnt--;}return rc;}EOFrm -f conftest.outif eval $CC $CFLAGS -o conftest conftest.c > conftest.out 2>&1 ; then if ./conftest ; then AC_MSG_RESULT(yes) else if test -s conftest.out ; then cat conftest.out >> config.log ; fi AC_MSG_RESULT(Signals reset when used!) AC_DEFINE(SIGNALS_RESET_WHEN_USED) fielse AC_MSG_RESULT(Could not compile test program!)fi/bin/rm -f conftest conftest.c conftest.o conftest.out])dnldnldnldnl record top-level directory (this one)dnl A problem. Some systems use an NFS automounter. This can generatednl paths of the form /tmp_mnt/... . On SOME systems, that path isdnl not recognized, and you need to strip off the /tmp_mnt. On others, dnl it IS recognized, so you need to leave it in. Grumble.dnl The real problem is that OTHER nodes on the same NFS system may notdnl be able to find a directory based on a /tmp_mnt/... name.dnldnl It is WRONG to use $PWD, since that is maintained only by the C shell,dnl and if we use it, we may find the 'wrong' directory. To test this, wednl try writing a file to the directory and then looking for it in the dnl current directory. Life would be so much easier if the NFS automounterdnl worked correctly.dnldnl PAC_GETWD(varname [, filename ] )dnl dnl Set varname to current directory. Use filename (relative to currentdnl directory) if provided to double check.dnldnl Need a way to use "automounter fix" for this.dnldefine(PAC_GETWD,[AC_MSG_CHECKING(for current directory name)$1=$PWDif test "${$1}" != "" -a -d "${$1}" ; then if test -r ${$1}/.foo$$ ; then /bin/rm -f ${$1}/.foo$$ /bin/rm -f .foo$$ fi if test -r ${$1}/.foo$$ -o -r .foo$$ ; then $1= else echo "test" > ${$1}/.foo$$ if test ! -r .foo$$ ; then /bin/rm -f ${$1}/.foo$$ $1= else /bin/rm -f ${$1}/.foo$$ fi fifiif test "${$1}" = "" ; then $1=`pwd | sed -e 's%/tmp_mnt/%/%g'`fidnldnl First, test the PWD is sensibleifelse($2,,,if test ! -r ${$1}/$2 ; then dnl PWD must be messed up $1=`pwd` if test ! -r ${$1}/$2 ; then print_error "Cannot determine the root directory!" exit 1 fi $1=`pwd | sed -e 's%/tmp_mnt/%/%g'` if test ! -d ${$1} ; then
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -