📄 aclocal.m4
字号:
dnldnl Additional macros for using autoconf to build configure scriptsdnldnl NOTES ON ADDING TO THISdnl It is important to end ALL definitions with "dnl" to insure that dnl there are NO blank lines before the "/bin/sh" in the configure script.dnldnldnl PAC_TEST_PROGRAM is like AC_TEST_PROGRAM, except that it makes it easierdnl to find out what failed.dnldefine(PAC_TEST_PROGRAM,[AC_PROVIDE([$0])AC_REQUIRE([AC_CROSS_CHECK])if test "$cross_compiling" = 1 -a -z "$TESTCC" ; then ifelse([$4], , ,$4) Pac_CV_NAME=0else if test -n "$TESTCC" ; then CCsav="$CC" CC="$TESTCC" fi cat > conftest.c <<EOF#include "confdefs.h"[$1]EOF eval $compile if test ! -s conftest ; then echo "Could not build executable program:" echo "${CC-cc} $CFLAGS conftest.c -o conftest $LIBS" ${CC-cc} $CFLAGS conftest.c -o conftest $LIBS ifelse([$3], , , [$3]) else /bin/rm -f conftestout if test -s conftest && (./conftest; exit) 2>conftestout; then ifelse([$2], , :, [$2]) else if test [$2] != "MMAP=1"; then if test [$2] != "SEMGET=1"; then echo "Execution of test program failed" fi fi ifelse([$3], , , [$3]) if test -s conftestout ; then cat conftestout fi fi fi if test -n "$TESTCC" ; then CC="$CCsav" fi rm -fr conftest*fi])dnldnldnl Some systems (particularly parallel systems) do not return correctdnl values for exit codes; for this reason, it is better to get thednl sizes by running the programs and then comparing themdnldnl PAC_GET_TYPE_SIZE(typename,var_for_size)dnldnl sets var_for_size to the size. Ignores if the size cannot be determineddnl Also sets typename_len to the size; if that is already set, just usesdnl thatdnldefine(PAC_GET_TYPE_SIZE,[Pac_name="$1" Pac_varname=`echo "$Pac_name" | sed -e 's/ /_/g' -e 's/\*/star/g'`eval Pac_testval=\$"${Pac_varname}_len"if test -n "$Pac_testval" ; then Pac_CV_NAME=$Pac_testvalelse AC_MSG_CHECKING([for size of $Pac_name]) /bin/rm -f conftestval PAC_TEST_PROGRAM([#include <stdio.h>main() { FILE *f=fopen("conftestval","w"); if (!f) exit(1); fprintf( f, "%d\n", sizeof($Pac_name)); exit(0);}],Pac_CV_NAME=`cat conftestval`,Pac_CV_NAME="") if test -n "$Pac_CV_NAME" -a "$Pac_CV_NAME" != 0 ; then AC_MSG_RESULT($Pac_CV_NAME) eval ${Pac_varname}_len=$Pac_CV_NAME else AC_MSG_RESULT(unavailable) fifi$2=$Pac_CV_NAME])dnldnldnldnl Define test for 64-bit pointersdnldefine(PAC_POINTER_64_BITS,[pointersize=""PAC_GET_TYPE_SIZE(void *,pointersize)AC_MSG_CHECKING([for pointers greater than 32 bits])if test -z "$pointersize" ; then AC_MSG_RESULT(can not determine; assuming not)elif test $pointersize -gt 4 ; then ifelse($1,,AC_DEFINE(POINTER_64_BITS),AC_DEFINE($1)) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fi])dnldnldefine(PAC_INT_LT_POINTER,[intsize=""PAC_GET_TYPE_SIZE(int,intsize)if test -z "$pointersize" ; then PAC_GET_TYPE_SIZE(void *,pointersize)fiAC_MSG_CHECKING([for int large enough for pointers])if test -n "$pointersize" -a -n "$intsize" ; then if test $pointersize -le $intsize ; then AC_MSG_RESULT(yes) else AC_DEFINE(INT_LT_POINTER) AC_MSG_RESULT(no) fielse AC_MSG_RESULT(can not determine; assuming it is)fi])dnldnldnl Define the test for the long long typednl This is made more interesting because some compilers implement it, dnl but not correctly. If they can't do it right, turn it off.define(PAC_LONG_LONG_INT,[AC_REQUIRE([AC_PROG_CC])dnlAC_MSG_CHECKING([for long long])AC_TEST_PROGRAM([int main() {/* See long double test; this handles the possibility that long long has the same problem on some systems */exit(sizeof(long long) < sizeof(long)); }],AC_MSG_RESULT(yes);has_long_long=1,AC_MSG_RESULT(no);has_long_long=0)if test "$has_long_long" = 1 ; then AC_MSG_CHECKING(that compiler can handle loops with long long) dnl We'd like to use AC_COMPILE_CHECK, but this example dies only when dnl used with arrays ([]). changequote(,) cat > conftest.c <<EOFvoid MPIR_SUM_ext( invec, inoutvec, len )void *invec, *inoutvec;int len;{ int i; long long *a = (long long *)inoutvec; long long *b = (long long *)invec; for ( i=0; i<len; i++ ) a[i] = a[i]+b[i];}int main(){return 0;}EOF changequote([,]) if eval $compile ; then rm -rf conftest* AC_MSG_RESULT(yes) else rm -rf conftest* AC_MSG_RESULT(no!) has_long_long=0 fifiif test "$has_long_long" = 1 ; then AC_DEFINE(HAVE_LONG_LONG_INT)fi])dnldnldnl The AC_LONG_DOUBLE macro is junk because it assumes that thednl long double type is valid in the language! In other words, thatdnl the compiler is ANSI Cdnldefine(PAC_LONG_DOUBLE,[AC_REQUIRE([AC_PROG_CC])dnlAC_MSG_CHECKING([for long double])if test -n "$GCC"; thenAC_DEFINE(HAVE_LONG_DOUBLE)AC_MSG_RESULT(yes)elseAC_COMPILE_CHECK(,,long double a;return 0;,ldok=1,ldok=0)if test $ldok = 1 ; thenAC_TEST_PROGRAM([int main() {/* On Ultrix 4.3 cc, long double is 4 and double is 8. */exit(sizeof(long double) < sizeof(double)); }],AC_DEFINE(HAVE_LONG_DOUBLE)AC_MSG_RESULT(yes),AC_MSG_RESULT(no))elseAC_MSG_RESULT(no)fifi])dnldnldnl PAC_HAVE_VOLATILEdnl dnl Defines HAS_VOLATILE if the C compiler accepts "volatile" dnldefine(PAC_HAVE_VOLATILE,[AC_MSG_CHECKING([for volatile])AC_COMPILE_CHECK(,[volatile int a;],main();,AC_DEFINE(HAS_VOLATILE)AC_MSG_RESULT(yes),AC_MSG_RESULT(no))])dnldnldnldnldefine(PAC_WORDS_BIGENDIAN,[AC_MSG_CHECKING([byte ordering])AC_TEST_PROGRAM([main () { /* Are we little or big endian? From Harbison&Steele. */ union { long l; char c[sizeof (long)]; } u; u.l = 1; exit (u.c[sizeof (long) - 1] == 1);}], ,pac_r=1)if test -z "$pac_r" ; then AC_MSG_RESULT(little endian)else AC_MSG_RESULT(big endian) ifelse($1,,AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE($1))fi])dnldnldnl Define the test to look for wish (the tcl/tk windowing shell)dnl This is under development and is derived from the FINDX commanddnl FIND_WISH looks in the path and in places that we've found wish.dnl It sets "wishloc" to the location that it found, or to thednl empty string if it can't find wish.dnl Note that we need tk version 3.3 or later, so we don't check for the dnl earlier versionsdnldnl Some systems are now (probably wisely, given the number of dnl incompatibilities) using names like "wish4.2" or "wish-3.6" and the like.define(PAC_FIND_WISH,[wishloc=""AC_MSG_CHECKING([for wish])# Look for wish in the pathIFS="${IFS= }"; saveifs="$IFS"; IFS="${IFS}:"for dir in $PATH ; do if test -x $dir/wish ; then wishloc=$dir/wish break elif test -x $dir/tcl7.3-tk3.6/bin/wish ; then wishloc=$dir/tcl7.3-tk3.6/bin/wish break elif test -x $dir/tcl7.4-tk4.0/bin/wish ; then wishloc=$dir/tcl7.4-tk4.0/bin/wish break else for file in $dir/wish3.? $dir/wish-3.? $dir/wish4.? $dir/wish* ; do if test -x $file ; then wishloc=$file break fi if test -n "$wishloc" ; then break ; fi done fidoneIFS="$saveifs"# Look for wish elsewhereif test -z "$wishloc" ; thenfor dir in \ /usr/local/bin \ /usr/local/tk-3.3/bin \ /usr/local/tcl7.3-tk3.6/bin \ /usr/local/tcl7.0/bin \ /usr/local/tcl7.0-tk3.3/bin \ /usr/contrib/bin \ /usr/contrib/tk3.6/bin \ /usr/contrib/tcl7.3-tk3.6/bin \ /usr/contrib/tk3.3/bin \ /usr/contrib/tcl7.0-tk3.3/bin \ $HOME/tcl/bin \ $HOME/tcl7.3/bin \ /opt/Tcl/bin \ /opt/bin \ /usr/unsupported \ /usr/unsupported/bin \ /usr/bin \ /bin \ /usr/sgitcl \ /local/encap/tcl-7.1/bin ; do if test -x $dir/wish ; then wishloc=$dir/wish break fidonefiif test -n "$wishloc" ; then AC_MSG_RESULT(found $wishloc)else AC_MSG_RESULT(no)fi])dnldnldnl We can use wish to find tcl and tk libraries withdnl puts stdout $tk_librarydnl tclsh can be used with dnl puts stdout $tcl_librarydnldnldefine(PAC_FIND_TCL,[# Look for Tclif test -z "$TCL_DIR" ; thenPAC_PROGRAM_CHECK(TCLSH,tclsh,1,,tclshloc)AC_MSG_CHECKING([for Tcl])# See if tclsh is in the path# If there is a tclsh, it MAY provide tk.if test -n "$tclshloc" ; then cat >conftest <<EOFputs stdout [\$]tcl_libraryEOF tcllibloc=`$tclshloc conftest 2>/dev/null` # The tcllibloc is the directory containing the .tcl files. # The .a files may be one directory up if test -n "$tcllibloc" ; then tcllibloc=`dirname $tcllibloc` # and the lib directory one above that tcllibs="$tcllibloc `dirname $tcllibloc`" fi /bin/rm -f conftest fifor dir in $tcllibs \ /usr \ /usr/local \ /usr/local/tcl7.5 \ /usr/local/tcl7.3 \ /usr/local/tcl7.3-tk3.6 \ /usr/local/tcl7.0 \ /usr/local/tcl7.0-tk3.3 \ /usr/local/tcl7.* \ /usr/contrib \ /usr/contrib/tk3.6 \ /usr/contrib/tcl7.3-tk3.6 \ /usr/contrib/tk3.3 \ /usr/contrib/tcl7.0-tk3.3 \ $HOME/tcl \ $HOME/tcl7.3 \ $HOME/tcl7.5 \ /opt/Tcl \ /opt/local \ /opt/local/tcl7.5 \ /opt/local/tcl7.* \ /usr/bin \ /Tools/tcl \ /usr/sgitcl \ /local/encap/tcl-7.1 ; do if test -r $dir/include/tcl.h ; then # Check for correct version changequote(,) tclversion=`grep 'TCL_MAJOR_VERSION' $dir/include/tcl.h | \ sed -e 's/^.*TCL_MAJOR_VERSION[^0-9]*\([0-9]*\).*$/\1/'` changequote([,]) if test "$tclversion" != "7" ; then # Skip if it is the wrong version continue fi if test -r $dir/lib/libtcl.a -o -r $dir/lib/libtcl.so ; then TCL_DIR=$dir break fi for file in $dir/lib/libtcl*.a ; do if test -r $file ; then TCL_DIR_W="$TCL_DIR_W $file" fi done fidonefiif test -n "$TCL_DIR" ; then AC_MSG_RESULT(found $TCL_DIR/include/tcl.h and $TCL_DIR/lib/libtcl)else if test -n "$TCL_DIR_W" ; then AC_MSG_RESULT(found $TCL_DIR_W but need libtcl.a) else AC_MSG_RESULT(no) fifi# Look for Tk (look in tcl dir if the code is nowhere else)if test -z "$TK_DIR" ; thenAC_MSG_CHECKING([for Tk])if test -n "$wishloc" ; then # Originally, we tried to run wish and get the tkversion from it # unfortunately, this sometimes hung, probably waiting to get a display# cat >conftest <<EOF#puts stdout [\$]tk_library#exit#EOF# tklibloc=`$wishloc -file conftest 2>/dev/null` tklibloc=`strings $wishloc | grep 'lib/tk'` # The tklibloc is the directory containing the .tclk files. # The .a files may be one directory up # There may be multiple lines in tklibloc now. Make sure that we only # test actual directories if test -n "$tklibloc" ; then for tkdirname in $tklibloc ; do if test -d $tkdirname ; then tkdirname=`dirname $tkdirname` # and the lib directory one above that tklibs="$tkdirname `dirname $tkdirname`" fi done fi /bin/rm -f conftest fifor dir in $tklibs \ /usr \ /usr/local \ /usr/local/tk3.6 \ /usr/local/tcl7.3-tk3.6 \ /usr/local/tk3.3 \ /usr/local/tcl7.0-tk3.3 \ /usr/contrib \ /usr/contrib/tk3.6 \ /usr/contrib/tcl7.3-tk3.6 \ /usr/contrib/tk3.3 \ /usr/contrib/tcl7.0-tk3.3 \ $HOME/tcl \ $HOME/tcl7.3 \ /opt/Tcl \ /opt/local \ /opt/local/tk3.6 \ /usr/bin \ /Tools/tk \ /usr/sgitcl \ /local/encap/tk-3.4 $TCL_DIR ; do if test -r $dir/include/tk.h ; then # Check for correct version changequote(,) tkversion=`grep 'TK_MAJOR_VERSION' $dir/include/tk.h | \ sed -e 's/^.*TK_MAJOR_VERSION[^0-9]*\([0-9]*\).*$/\1/'` changequote([,]) if test "$tkversion" != "3" ; then # Skip if it is the wrong version continue fi if test -r $dir/lib/libtk.a -o -r $dir/lib/libtk.so ; then TK_DIR=$dir break fi for file in $dir/lib/libtk*.a ; do if test -r $file ; then TK_DIR_W="$TK_DIR_W $file"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -