1dnl 2dnl record top-level directory (this one) 3dnl A problem. Some systems use an NFS automounter. This can generate 4dnl paths of the form /tmp_mnt/... . On SOME systems, that path is 5dnl not recognized, and you need to strip off the /tmp_mnt. On others, 6dnl it IS recognized, so you need to leave it in. Grumble. 7dnl The real problem is that OTHER nodes on the same NFS system may not 8dnl be able to find a directory based on a /tmp_mnt/... name. 9dnl 10dnl It is WRONG to use $PWD, since that is maintained only by the C shell, 11dnl and if we use it, we may find the 'wrong' directory. To test this, we 12dnl try writing a file to the directory and then looking for it in the 13dnl current directory. Life would be so much easier if the NFS automounter 14dnl worked correctly. 15dnl 16dnl PAC_GETWD(varname [, filename ] ) 17dnl 18dnl Set varname to current directory. Use filename (relative to current 19dnl directory) if provided to double check. 20dnl 21dnl Need a way to use "automounter fix" for this. 22dnl 23define(PAC_GETWD,[ 24AC_MSG_CHECKING(for current directory name) 25$1=$PWD 26if test "${$1}" != "" -a -d "${$1}" ; then 27 if test -r ${$1}/.foo$$ ; then 28 rm -f ${$1}/.foo$$ 29 rm -f .foo$$ 30 fi 31 if test -r ${$1}/.foo$$ -o -r .foo$$ ; then 32 $1= 33 else 34 echo "test" > ${$1}/.foo$$ 35 if test ! -r .foo$$ ; then 36 rm -f ${$1}/.foo$$ 37 $1= 38 else 39 rm -f ${$1}/.foo$$ 40 fi 41 fi 42fi 43if test "${$1}" = "" ; then 44 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'` 45fi 46dnl 47dnl First, test the PWD is sensible 48ifelse($2,,, 49if test ! -r ${$1}/$2 ; then 50 dnl PWD must be messed up 51 $1=`pwd` 52 if test ! -r ${$1}/$2 ; then 53 print_error "Cannot determine the root directory!" 54 exit 1 55 fi 56 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'` 57 if test ! -d ${$1} ; then 58 print_error "Warning: your default path uses the automounter; this may" 59 print_error "cause some problems if you use other NFS-connected systems." 60 $1=`pwd` 61 fi 62fi) 63if test -z "${$1}" ; then 64 $1=`pwd | sed -e 's%/tmp_mnt/%/%g'` 65 if test ! -d ${$1} ; then 66 print_error "Warning: your default path uses the automounter; this may" 67 print_error "cause some problems if you use other NFS-connected systems." 68 $1=`pwd` 69 fi 70fi 71AC_MSG_RESULT(${$1}) 72])dnl 73dnl 74dnl PAC_OUTPUT_EXEC(files[,mode]) - takes files (as shell script or others), 75dnl and applies configure to the them. Basically, this is what AC_OUTPUT 76dnl should do, but without adding a comment line at the top. 77dnl Must be used ONLY after AC_OUTPUT (it needs config.status, which 78dnl AC_OUTPUT creates). 79dnl Optionally, set the mode (+x, a+x, etc) 80dnl 81define(PAC_OUTPUT_EXEC,[ 82CONFIG_FILES="$1" 83export CONFIG_FILES 84./config.status 85CONFIG_FILES="" 86for pac_file in $1 ; do 87 rm -f .pactmp 88 sed -e '1d' $pac_file > .pactmp 89 rm -f $pac_file 90 mv .pactmp $pac_file 91 ifelse($2,,,chmod $2 $pac_file) 92done 93])dnl 94dnl 95dnl We need routines to check that make works. Possible problems with 96dnl make include 97dnl 98dnl It is really gnumake, and contrary to the documentation on gnumake, 99dnl it insists on screaming everytime a directory is changed. The fix 100dnl is to add the argument --no-print-directory to the make 101dnl 102dnl It is really BSD 4.4 make, and can't handle 'include'. For some 103dnl systems, this can be fatal; there is no fix (other than removing this 104dnl aleged make). 105dnl 106dnl It is the OSF V3 make, and can't handle a comment in a block of targe 107dnl code. There is no acceptable fix. 108dnl 109dnl This assumes that "MAKE" holds the name of the make program. If it 110dnl determines that it is an improperly built gnumake, it adds 111dnl --no-print-directorytries to the symbol MAKE. 112define(PAC_MAKE_IS_GNUMAKE,[ 113AC_MSG_CHECKING(gnumake) 114rm -f conftest 115cat > conftest <<. 116SHELL=/bin/sh 117ALL: 118 @(dir=`pwd` ; cd .. ; \$(MAKE) -f \$\$dir/conftest SUB) 119SUB: 120 @echo "success" 121. 122str=`$MAKE -f conftest 2>&1` 123if test "$str" != "success" ; then 124 str=`$MAKE --no-print-directory -f conftest 2>&1` 125 if test "$str" = "success" ; then 126 MAKE="$MAKE --no-print-directory" 127 AC_MSG_RESULT(yes using --no-print-directory) 128 else 129 AC_MSG_RESULT(no) 130 fi 131else 132 AC_MSG_RESULT(no) 133fi 134rm -f conftest 135str="" 136])dnl 137dnl 138dnl PAC_MAKE_IS_BSD44([true text]) 139dnl 140define(PAC_MAKE_IS_BSD44,[ 141AC_MSG_CHECKING(BSD 4.4 make) 142rm -f conftest 143cat > conftest <<. 144ALL: 145 @echo "success" 146. 147cat > conftest1 <<. 148include conftest 149. 150str=`$MAKE -f conftest1 2>&1` 151rm -f conftest conftest1 152if test "$str" != "success" ; then 153 AC_MSG_RESULT(Found BSD 4.4 so-called make) 154 echo "The BSD 4.4 make is INCOMPATIBLE with all other makes." 155 echo "Using this so-called make may cause problems when building programs." 156 echo "You should consider using gnumake instead." 157 ifelse([$1],,[$1]) 158else 159 AC_MSG_RESULT(no - whew) 160fi 161str="" 162])dnl 163dnl 164dnl PAC_MAKE_IS_OSF([true text]) 165dnl 166define(PAC_MAKE_IS_OSF,[ 167AC_MSG_CHECKING(OSF V3 make) 168rm -f conftest 169cat > conftest <<. 170SHELL=/bin/sh 171ALL: 172 @# This is a valid comment! 173 @echo "success" 174. 175str=`$MAKE -f conftest 2>&1` 176rm -f conftest 177if test "$str" != "success" ; then 178 AC_MSG_RESULT(Found OSF V3 make) 179 echo "The OSF V3 make does not allow comments in target code." 180 echo "Using this make may cause problems when building programs." 181 echo "You should consider using gnumake instead." 182 ifelse([$1],,[$1]) 183else 184 AC_MSG_RESULT(no) 185fi 186str="" 187])dnl 188dnl 189dnl Look for a style of VPATH. Known forms are 190dnl VPATH = .:dir 191dnl .PATH: . dir 192dnl 193dnl Defines VPATH or .PATH with . $(srcdir) 194dnl Requires that vpath work with implicit targets 195dnl NEED TO DO: Check that $< works on explicit targets. 196dnl 197define(PAC_MAKE_VPATH,[ 198AC_SUBST(VPATH) 199AC_MSG_CHECKING(for virtual path format) 200rm -rf conftest* 201mkdir conftestdir 202cat >conftestdir/a.c <<EOF 203A sample file 204EOF 205cat > conftest <<EOF 206all: a.o 207VPATH=.:conftestdir 208.c.o: 209 @echo \$< 210EOF 211ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'` 212if test -n "$ac_out" ; then 213 AC_MSG_RESULT(VPATH) 214 VPATH='VPATH=.:$(srcdir)' 215else 216 rm -f conftest 217 cat > conftest <<EOF 218all: a.o 219.PATH: . conftestdir 220.c.o: 221 @echo \$< 222EOF 223 ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'` 224 if test -n "$ac_out" ; then 225 AC_MSG_RESULT(.PATH) 226 VPATH='.PATH: . $(srcdir)' 227 else 228 AC_MSG_RESULT(neither VPATH nor .PATH works) 229 fi 230fi 231rm -rf conftest* 232])dnl 233dnl 234dnl PAC_MSG_ERROR($enable_softerr,ErrorMsg) - 235dnl return AC_MSG_ERROR(ErrorMsg) if "$enable_softerr" = "yes" 236dnl return AC_MSG_WARN(ErrorMsg) + exit 0 otherwise 237dnl 238define(PAC_MSG_ERROR,[ 239if test "$1" = "yes" ; then 240 AC_MSG_WARN([ $2 ]) 241 exit 0 242else 243 AC_MSG_ERROR([ $2 ]) 244fi 245])dnl 246dnl/*D 247dnl PAC_PROG_CHECK_INSTALL_WORKS - Check whether the install program in INSTALL 248dnl works. 249dnl 250dnl Synopsis: 251dnl PAC_PROG_CHECK_INSTALL_WORKS 252dnl 253dnl Output Effect: 254dnl Sets the variable 'INSTALL' to the value of 'ac_sh_install' if 255dnl a file cannot be installed into a local directory with the 'INSTALL' 256dnl program 257dnl 258dnl Notes: 259dnl The 'AC_PROG_INSTALL' scripts tries to avoid broken versions of 260dnl install by avoiding directories such as '/usr/sbin' where some 261dnl systems are known to have bad versions of 'install'. Unfortunately, 262dnl this is exactly the sort of test-on-name instead of test-on-capability 263dnl that 'autoconf' is meant to eliminate. The test in this script 264dnl is very simple but has been adequate for working around problems 265dnl on Solaris, where the '/usr/sbin/install' program (known by 266dnl autoconf to be bad because it is in /usr/sbin) is also reached by a 267dnl soft link through /bin, which autoconf believes is good. 268dnl 269dnl No variables are cached to ensure that we do not make a mistake in 270dnl our choice of install program. 271dnl 272dnl The Solaris configure requires the directory name to immediately 273dnl follow the '-c' argument, rather than the more common 274dnl.vb 275dnl args sourcefiles destination-dir 276dnl.ve 277dnl D*/ 278AC_DEFUN([PAC_PROG_CHECK_INSTALL_WORKS],[ 279if test -z "$INSTALL" ; then 280 AC_MSG_RESULT([No install program available]) 281else 282 # Check that this install really works 283 rm -f conftest 284 echo "Test file" > conftest 285 if test ! -d .conftest ; then mkdir .conftest ; fi 286 AC_MSG_CHECKING([whether install works]) 287 if $INSTALL conftest .conftest >/dev/null 2>&1 ; then 288 installOk=yes 289 else 290 installOk=no 291 fi 292 rm -rf .conftest conftest 293 AC_MSG_RESULT($installOk) 294 if test "$installOk" = no ; then 295 if test -n "$ac_install_sh" ; then 296 INSTALL=$ac_install_sh 297 else 298 AC_MSG_ERROR([Unable to find working install]) 299 fi 300 fi 301fi 302]) 303dnl 304dnl Check for a broken install (fails to preserve file modification times, 305dnl thus breaking libraries. 306dnl 307dnl Create a library, install it, and then try to link against it. 308AC_DEFUN([PAC_PROG_INSTALL_BREAKS_LIBS],[ 309AC_CACHE_CHECK([whether install breaks libraries], 310ac_cv_prog_install_breaks_libs,[ 311AC_REQUIRE([AC_PROG_RANLIB]) 312AC_REQUIRE([AC_PROG_INSTALL]) 313AC_REQUIRE([AC_PROG_CC]) 314ac_cv_prog_install_breaks_libs=yes 315rm -f libconftest* conftest* 316echo 'int foo(int);int foo(int a){return a;}' > conftest1.c 317echo 'extern int foo(int); int main( int argc, char **argv){ return foo(0); }' > conftest2.c 318if ${CC-cc} $CFLAGS -c conftest1.c >conftest.out 2>&1 ; then 319 if ${AR-ar} cr libconftest.a conftest1.o >/dev/null 2>&1 ; then 320 if ${RANLIB-:} libconftest.a >/dev/null 2>&1 ; then 321 # Anything less than sleep 10, and Mac OS/X (Darwin) 322 # will claim that install works because ranlib won't complain 323 sleep 10 324 libinstall="$INSTALL" 325 eval "libinstall=\"$libinstall\"" 326 if ${libinstall} libconftest.a libconftest1.a >/dev/null 2>&1 ; then 327 if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then 328 # Success! Install works 329 ac_cv_prog_install_breaks_libs=no 330 else 331 # Failure! Does install -p work? 332 rm -f libconftest1.a 333 if ${libinstall} -p libconftest.a libconftest1.a >/dev/null 2>&1 ; then 334 if ${CC-cc} $CFLAGS -o conftest conftest2.c $LDFLAGS libconftest1.a >>conftest.out 2>&1 && test -x conftest ; then 335 # Success! Install works 336 ac_cv_prog_install_breaks_libs="no, with -p" 337 fi 338 fi 339 fi 340 fi 341 fi 342 fi 343fi 344rm -f conftest* libconftest*]) 345 346if test -z "$RANLIB_AFTER_INSTALL" ; then 347 RANLIB_AFTER_INSTALL=no 348fi 349case "$ac_cv_prog_install_breaks_libs" in 350 yes) 351 RANLIB_AFTER_INSTALL=yes 352 ;; 353 "no, with -p") 354 INSTALL="$INSTALL -p" 355 ;; 356 *) 357 # Do nothing 358 : 359 ;; 360esac 361AC_SUBST(RANLIB_AFTER_INSTALL) 362]) 363dnl 364dnl 365dnl 366dnl Fixes to bugs in AC_xxx macros 367dnl 368dnl (AC_TRY_COMPILE is missing a newline after the end in the Fortran 369dnl branch; that has been fixed in-place) 370dnl 371dnl (AC_PROG_CC makes many dubious assumptions. One is that -O is safe 372dnl with -g, even with gcc. This isn't true; gcc will eliminate dead code 373dnl when -O is used, even if you added code explicitly for debugging 374dnl purposes. -O shouldn't do dead code elimination when -g is selected, 375dnl unless a specific option is selected. Unfortunately, there is no 376dnl documented option to turn off dead code elimination. 377dnl 378dnl 379dnl (AC_CHECK_HEADER and AC_CHECK_HEADERS both make the erroneous assumption 380dnl that the C-preprocessor and the C (or C++) compilers are the same program 381dnl and have the same search paths. In addition, CHECK_HEADER looks for 382dnl error messages to decide that the file is not available; unfortunately, 383dnl it also interprets messages such as "evaluation copy" and warning messages 384dnl from broken CPP programs (such as IBM's xlc -E, which often warns about 385dnl "lm not a valid option"). Instead, we try a compilation step with the 386dnl C compiler. 387dnl 388dnl AC_CONFIG_AUX_DIRS only checks for install-sh, but assumes other 389dnl values are present. Also doesn't provide a way to override the 390dnl sources of the various configure scripts. This replacement 391dnl version of AC_CONFIG_AUX_DIRS overcomes this. 392dnl Internal subroutine. 393dnl Search for the configuration auxiliary files in directory list $1. 394dnl We look only for install-sh, so users of AC_PROG_INSTALL 395dnl do not automatically need to distribute the other auxiliary files. 396dnl AC_CONFIG_AUX_DIRS(DIR ...) 397dnl Also note that since AC_CONFIG_AUX_DIR_DEFAULT calls this, there 398dnl isn't a easy way to fix it other than replacing it completely. 399dnl This fix applies to 2.13 400dnl/*D 401dnl AC_CONFIG_AUX_DIRS - Find the directory containing auxillery scripts 402dnl for configure 403dnl 404dnl Synopsis: 405dnl AC_CONFIG_AUX_DIRS( [ directories to search ] ) 406dnl 407dnl Output Effect: 408dnl Sets 'ac_config_guess' to location of 'config.guess', 'ac_config_sub' 409dnl to location of 'config.sub', 'ac_install_sh' to the location of 410dnl 'install-sh' or 'install.sh', and 'ac_configure' to the location of a 411dnl Cygnus-style 'configure'. Only 'install-sh' is guaranteed to exist, 412dnl since the other scripts are needed only by some special macros. 413dnl 414dnl The environment variable 'CONFIG_AUX_DIR', if set, overrides the 415dnl directories listed. This is an extension to the 'autoconf' version of 416dnl this macro. 417dnl D*/ 418undefine([AC_CONFIG_AUX_DIRS]) 419AC_DEFUN(AC_CONFIG_AUX_DIRS, 420[if test -f $CONFIG_AUX_DIR/install-sh ; then ac_aux_dir=$CONFIG_AUX_DIR 421else 422ac_aux_dir= 423# We force the test to use the absolute path to ensure that the install 424# program can be used if we cd to a different directory before using 425# install. 426for ac_dir in $1; do 427 if test -f $ac_dir/install-sh; then 428 ac_aux_dir=$ac_dir 429 abs_ac_aux_dir=`(cd $ac_aux_dir && pwd)` 430 ac_install_sh="$abs_ac_aux_dir/install-sh -c" 431 break 432 elif test -f $ac_dir/install.sh; then 433 ac_aux_dir=$ac_dir 434 abs_ac_aux_dir=`(cd $ac_aux_dir && pwd)` 435 ac_install_sh="$abs_ac_aux_dir/install.sh -c" 436 break 437 fi 438done 439fi 440if test -z "$ac_aux_dir"; then 441 AC_MSG_ERROR([can not find install-sh or install.sh in $1]) 442fi 443ac_config_guess=$ac_aux_dir/config.guess 444ac_config_sub=$ac_aux_dir/config.sub 445ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. 446AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl 447]) 448