Blame test/mpi/confdb/aclocal_make.m4

Packit 0848f5
dnl
Packit 0848f5
dnl We need routines to check that make works.  Possible problems with
Packit 0848f5
dnl make include
Packit 0848f5
dnl
Packit 0848f5
dnl It is really gnumake, and contrary to the documentation on gnumake,
Packit 0848f5
dnl it insists on screaming everytime a directory is changed.  The fix
Packit 0848f5
dnl is to add the argument --no-print-directory to the make
Packit 0848f5
dnl
Packit 0848f5
dnl It is really BSD 4.4 make, and can't handle 'include'.  For some
Packit 0848f5
dnl systems, this can be fatal; there is no fix (other than removing this
Packit 0848f5
dnl alleged make).
Packit 0848f5
dnl
Packit 0848f5
dnl It is the OSF V3 make, and can't handle a comment in a block of target
Packit 0848f5
dnl code.  There is no acceptable fix.
Packit 0848f5
dnl
Packit 0848f5
dnl
Packit 0848f5
dnl
Packit 0848f5
dnl
Packit 0848f5
dnl Find a make program if none is defined.
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_PROGRAM],[true
Packit 0848f5
if test "X$MAKE" = "X" ; then
Packit 0848f5
   AC_CHECK_PROGS(MAKE,make gnumake nmake pmake smake)
Packit 0848f5
fi
Packit 0848f5
])dnl
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE_INCLUDE - Check whether make supports include
Packit 0848f5
dnl
Packit 0848f5
dnl Synopsis:
Packit 0848f5
dnl PAC_PROG_MAKE_INCLUDE([action if true],[action if false])
Packit 0848f5
dnl
Packit 0848f5
dnl Output Effect:
Packit 0848f5
dnl   None
Packit 0848f5
dnl
Packit 0848f5
dnl Notes:
Packit 0848f5
dnl  This checks for makes that do not support 'include filename'.  Some
Packit 0848f5
dnl  versions of BSD 4.4 make required '#include' instead; some versions of
Packit 0848f5
dnl  'pmake' have the same syntax.
Packit 0848f5
dnl
Packit 0848f5
dnl See Also:
Packit 0848f5
dnl  PAC_PROG_MAKE
Packit 0848f5
dnl
Packit 0848f5
dnl D*/
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_INCLUDE],[
Packit 0848f5
AC_CACHE_CHECK([whether make supports include],pac_cv_prog_make_include,[
Packit 0848f5
AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest
Packit 0848f5
cat > conftest <<.
Packit 0848f5
ALL:
Packit 0848f5
	@echo "success"
Packit 0848f5
.
Packit 0848f5
cat > conftest1 <<.
Packit 0848f5
include conftest
Packit 0848f5
.
Packit 0848f5
pac_str=`$MAKE -f conftest1 2>&1`
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest conftest1
Packit 0848f5
if test "$pac_str" != "success" ; then
Packit 0848f5
    pac_cv_prog_make_include="no"
Packit 0848f5
else
Packit 0848f5
    pac_cv_prog_make_include="yes"
Packit 0848f5
fi
Packit 0848f5
])
Packit 0848f5
if test "$pac_cv_prog_make_include" = "no" ; then
Packit 0848f5
    ifelse([$2],,:,[$2])
Packit 0848f5
else
Packit 0848f5
    ifelse([$1],,:,[$1])
Packit 0848f5
fi
Packit 0848f5
])dnl
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE_ALLOWS_COMMENTS - Check whether comments are allowed in 
Packit 0848f5
dnl   shell commands in a makefile
Packit 0848f5
dnl
Packit 0848f5
dnl Synopsis:
Packit 0848f5
dnl PAC_PROG_MAKE_ALLOWS_COMMENTS([false text])
Packit 0848f5
dnl
Packit 0848f5
dnl Output Effect:
Packit 0848f5
dnl Issues a warning message if comments are not allowed in a makefile.
Packit 0848f5
dnl Executes the argument if one is given.
Packit 0848f5
dnl
Packit 0848f5
dnl Notes:
Packit 0848f5
dnl Some versions of OSF V3 make do not all comments in action commands.
Packit 0848f5
dnl
Packit 0848f5
dnl See Also:
Packit 0848f5
dnl  PAC_PROG_MAKE
Packit 0848f5
dnl D*/
Packit 0848f5
dnl
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_ALLOWS_COMMENTS],[
Packit 0848f5
AC_CACHE_CHECK([whether make allows comments in actions],
Packit 0848f5
pac_cv_prog_make_allows_comments,[
Packit 0848f5
AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest
Packit 0848f5
cat > conftest <<.
Packit 0848f5
SHELL=/bin/sh
Packit 0848f5
ALL:
Packit 0848f5
	@# This is a valid comment!
Packit 0848f5
	@echo "success"
Packit 0848f5
.
Packit 0848f5
pac_str=`$MAKE -f conftest 2>&1`
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest 
Packit 0848f5
if test "$pac_str" != "success" ; then
Packit 0848f5
    pac_cv_prog_make_allows_comments="no"
Packit 0848f5
else
Packit 0848f5
    pac_cv_prog_make_allows_comments="yes"
Packit 0848f5
fi
Packit 0848f5
])
Packit 0848f5
if test "$pac_cv_prog_make_allows_comments" = "no" ; then
Packit 0848f5
    AC_MSG_WARN([Your make does not allow comments in target code.
Packit 0848f5
Using this make may cause problems when building programs.
Packit 0848f5
You should consider using gnumake instead.])
Packit 0848f5
    ifelse([$1],,[$1])
Packit 0848f5
fi
Packit 0848f5
])dnl
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE_VPATH - Check whether make supports source-code paths.
Packit 0848f5
dnl
Packit 0848f5
dnl Synopsis:
Packit 0848f5
dnl PAC_PROG_MAKE_VPATH
Packit 0848f5
dnl
Packit 0848f5
dnl Output Effect:
Packit 0848f5
dnl Sets the variable 'VPATH' to either
Packit 0848f5
dnl.vb
Packit 0848f5
dnl VPATH = .:${srcdir}
Packit 0848f5
dnl.ve
Packit 0848f5
dnl or
Packit 0848f5
dnl.vb
Packit 0848f5
dnl .PATH: . ${srcdir}
Packit 0848f5
dnl.ve
Packit 0848f5
dnl 
Packit 0848f5
dnl Notes:
Packit 0848f5
dnl The test checks that the path works with implicit targets (some makes
Packit 0848f5
dnl support only explicit targets with 'VPATH' or 'PATH').
Packit 0848f5
dnl
Packit 0848f5
dnl NEED TO DO: Check that $< works on explicit targets.
Packit 0848f5
dnl
Packit 0848f5
dnl See Also:
Packit 0848f5
dnl PAC_PROG_MAKE
Packit 0848f5
dnl
Packit 0848f5
dnl D*/
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_VPATH],[
Packit 0848f5
AC_SUBST(VPATH)
Packit 0848f5
dnl AM_IGNORE(VPATH)
Packit 0848f5
AC_CACHE_CHECK([for virtual path format],
Packit 0848f5
pac_cv_prog_make_vpath,[
Packit 0848f5
AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -rf conftest*
Packit 0848f5
mkdir conftestdir
Packit 0848f5
cat >conftestdir/a.c <
Packit 0848f5
A sample file
Packit 0848f5
EOF
Packit 0848f5
cat > conftest <
Packit 0848f5
all: a.o
Packit 0848f5
VPATH=.:conftestdir
Packit 0848f5
.c.o:
Packit 0848f5
	@echo \$<
Packit 0848f5
EOF
Packit 0848f5
ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
Packit 0848f5
if test -n "$ac_out" ; then 
Packit 0848f5
    pac_cv_prog_make_vpath="VPATH"
Packit 0848f5
else
Packit 0848f5
    rm -f conftest
Packit 0848f5
    cat > conftest <
Packit 0848f5
all: a.o
Packit 0848f5
.PATH: . conftestdir
Packit 0848f5
.c.o:
Packit 0848f5
	@echo \$<
Packit 0848f5
EOF
Packit 0848f5
    ac_out=`$MAKE -f conftest 2>&1 | grep 'conftestdir/a.c'`
Packit 0848f5
    if test -n "$ac_out" ; then 
Packit 0848f5
        pac_cv_prog_make_vpath=".PATH"
Packit 0848f5
    else
Packit 0848f5
	pac_cv_prog_make_vpath="neither VPATH nor .PATH works"
Packit 0848f5
    fi
Packit 0848f5
fi
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -rf conftest*
Packit 0848f5
])
Packit 0848f5
if test "$pac_cv_prog_make_vpath" = "VPATH" ; then
Packit 0848f5
    VPATH='VPATH=.:${srcdir}'
Packit 0848f5
elif test "$pac_cv_prog_make_vpath" = ".PATH" ; then
Packit 0848f5
    VPATH='.PATH: . ${srcdir}'
Packit 0848f5
fi
Packit 0848f5
])dnl
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE_SET_CFLAGS - Check whether make sets CFLAGS
Packit 0848f5
dnl
Packit 0848f5
dnl Synopsis:
Packit 0848f5
dnl PAC_PROG_MAKE_SET_CFLAGS([action if true],[action if false])
Packit 0848f5
dnl
Packit 0848f5
dnl Output Effects:
Packit 0848f5
dnl Executes the first argument if 'CFLAGS' is set by 'make'; executes
Packit 0848f5
dnl the second argument if 'CFLAGS' is not set by 'make'.
Packit 0848f5
dnl
Packit 0848f5
dnl Notes:
Packit 0848f5
dnl If 'CFLAGS' is set by make, you may wish to override that choice in your
Packit 0848f5
dnl makefile.
Packit 0848f5
dnl
Packit 0848f5
dnl See Also:
Packit 0848f5
dnl PAC_PROG_MAKE
Packit 0848f5
dnl D*/
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_SET_CFLAGS],[
Packit 0848f5
AC_CACHE_CHECK([whether make sets CFLAGS],
Packit 0848f5
pac_cv_prog_make_set_cflags,[
Packit 0848f5
AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest
Packit 0848f5
cat > conftest <
Packit 0848f5
SHELL=/bin/sh
Packit 0848f5
ALL:
Packit 0848f5
	@echo X[\$]{CFLAGS}X
Packit 0848f5
EOF
Packit 0848f5
pac_str=`$MAKE -f conftest 2>&1`
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest 
Packit 0848f5
if test "$pac_str" = "XX" ; then
Packit 0848f5
    pac_cv_prog_make_set_cflags="no"
Packit 0848f5
else
Packit 0848f5
    pac_cv_prog_make_set_cflags="yes"
Packit 0848f5
fi
Packit 0848f5
])
Packit 0848f5
if test "$pac_cv_prog_make_set_cflags" = "no" ; then
Packit 0848f5
    ifelse([$2],,:,[$2])
Packit 0848f5
else
Packit 0848f5
    ifelse([$1],,:,[$1])
Packit 0848f5
fi
Packit 0848f5
])dnl
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE_CLOCK_SKEW - Check whether there is a problem with 
Packit 0848f5
dnl clock skew in suing make.
Packit 0848f5
dnl
Packit 0848f5
dnl Effect:
Packit 0848f5
dnl Sets the cache variable 'pac_cv_prog_make_found_clock_skew' to yes or no
Packit 0848f5
dnl D*/
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE_CLOCK_SKEW],[
Packit 0848f5
AC_CACHE_CHECK([whether clock skew breaks make],
Packit 0848f5
pac_cv_prog_make_found_clock_skew,[
Packit 0848f5
AC_REQUIRE([PAC_PROG_MAKE_PROGRAM])
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest*
Packit 0848f5
cat > conftest <
Packit 0848f5
ALL:
Packit 0848f5
	@-echo "success"
Packit 0848f5
EOF
Packit 0848f5
$MAKE -f conftest > conftest.out 2>&1
Packit 0848f5
if grep -i skew conftest >/dev/null 2>&1 ; then
Packit 0848f5
    pac_cv_prog_make_found_clock_skew=yes
Packit 0848f5
else
Packit 0848f5
    pac_cv_prog_make_found_clock_skew=no
Packit 0848f5
fi
Packit 0848f5
# This is needed for Mac OSX 10.5
Packit 0848f5
rm -rf conftest.dSYM
Packit 0848f5
rm -f conftest*
Packit 0848f5
])
Packit 0848f5
dnl We should really do something if we detect clock skew.  The question is,
Packit 0848f5
dnl what?
Packit 0848f5
if test "$pac_cv_prog_make_found_clock_skew" = "yes" ; then
Packit 0848f5
    AC_MSG_WARN([Clock skew found by make.  The configure and build may fail.
Packit 0848f5
Consider building in a local instead of NFS filesystem.])
Packit 0848f5
fi
Packit 0848f5
])
Packit 0848f5
Packit 0848f5
dnl/*D
Packit 0848f5
dnl PAC_PROG_MAKE - Checks for the varieties of MAKE, including support for 
Packit 0848f5
dnl VPATH
Packit 0848f5
dnl
Packit 0848f5
dnl Synopsis:
Packit 0848f5
dnl PAC_PROG_MAKE
Packit 0848f5
dnl
Packit 0848f5
dnl Output Effect:
Packit 0848f5
dnl Sets 'MAKE' to the make program to use if 'MAKE' is not already set.
Packit 0848f5
dnl Sets the variable 'SET_CFLAGS' to 'CFLAGS =' if make sets 'CFLAGS'.
Packit 0848f5
dnl
Packit 0848f5
dnl Notes:
Packit 0848f5
dnl This macro uses 'PAC_PROG_MAKE_INCLUDE',
Packit 0848f5
dnl 'PAC_PROG_MAKE_ALLOWS_COMMENTS', 'PAC_PROG_MAKE_VPATH', and
Packit 0848f5
dnl 'PAC_PROG_MAKE_SET_CFLAGS'.  See those commands for details about their
Packit 0848f5
dnl actions.
Packit 0848f5
dnl 
Packit 0848f5
dnl It may call 'AC_PROG_MAKE_SET', which sets 'SET_MAKE' to 'MAKE = @MAKE@'
Packit 0848f5
dnl if the make program does not set the value of make, otherwise 'SET_MAKE'
Packit 0848f5
dnl is set to empty; if the make program echos the directory name, then 
Packit 0848f5
dnl 'SET_MAKE' is set to 'MAKE = $MAKE'.
Packit 0848f5
dnl D*/
Packit 0848f5
AC_DEFUN([PAC_PROG_MAKE],[
Packit 0848f5
PAC_PROG_MAKE_PROGRAM
Packit 0848f5
PAC_PROG_MAKE_CLOCK_SKEW
Packit 0848f5
PAC_PROG_MAKE_INCLUDE
Packit 0848f5
PAC_PROG_MAKE_ALLOWS_COMMENTS
Packit 0848f5
PAC_PROG_MAKE_VPATH
Packit 0848f5
AC_SUBST(SET_CFLAGS)
Packit 0848f5
dnl AM_IGNORE(SET_CFLAGS)
Packit 0848f5
PAC_PROG_MAKE_SET_CFLAGS([SET_CFLAGS='CFLAGS='])
Packit 0848f5
if test "$pac_cv_prog_make_echos_dir" = "no" ; then
Packit 0848f5
    AC_PROG_MAKE_SET
Packit 0848f5
else
Packit 0848f5
    SET_MAKE="MAKE=${MAKE-make}"
Packit 0848f5
fi
Packit 0848f5
])