added support for using purify, cegdb, gdb, mpi with user defined

compilers, user defined compiler flags etc...
This commit is contained in:
dwalker 1999-03-12 00:45:21 +00:00
parent 004824dfe0
commit bbeac980ad
4 changed files with 1729 additions and 453 deletions

2
aclocal.m4 vendored
View File

@ -1,5 +1,5 @@
sinclude(/home/casc/software/autoconfig/macros/casc_libs_and_headers.m4)
sinclude(/home/casc/software/autoconfig/macros/casc_mpi.m4)
sinclude(casc_mpi.m4)
sinclude(/home/casc/software/autoconfig/macros/casc_fortran.m4)
sinclude(/home/casc/software/autoconfig/macros/casc_opt_debug.m4)
sinclude(/home/casc/software/autoconfig/macros/casc_misc.m4)

1591
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -49,30 +49,43 @@ unset F77
casc_user_chose_compilers=no
casc_user_chose_mpi=no
casc_using_pthreads=no
casc_using_purify=no
AC_ARG_WITH(CC,
[ --with-CC=ARG manually set C compiler to ARG],
[ --with-CC=ARG manually set C compiler to ARG],
CC=$withval
casc_user_chose_compilers=yes)
AC_ARG_WITH(CXX,
[ --with-CXX=ARG manually set C++ compiler to ARG],
[ --with-CXX=ARG manually set C++ compiler to ARG],
CXX=$withval
casc_user_chose_compilers=yes)
AC_ARG_WITH(F77,
[ --with-f77=ARG manually set f77 compiler to ARG],
[ --with-f77=ARG manually set f77 compiler to ARG],
F77=$withval
casc_user_chose_compilers=yes)
AC_ARG_WITH(mpi-include, [ --with-mpi-include=DIR mpi.h is in DIR],
AC_ARG_WITH(CFLAGS,
[ --with-CFLAGS=ARG manually set c compiler flags],
CFLAGS=$withval)
AC_ARG_WITH(CXXFLAGS,
[ --with-CXXFLAGS=ARG manually set c++ compiler flags],
CXXFLAGS=$withval)
AC_ARG_WITH(F77FLAGS,
[ --with-F77FLAGS=ARG manually set f77 compiler flags],
F77FLAGS=$withval)
AC_ARG_WITH(mpi-include,
[ --with-mpi-include=DIR mpi.h is in DIR],
for mpi_dir in $withval; do
MPIINCLUDE="$MPIINCLUDE -I$withval"
done; casc_user_chose_mpi=yes)
AC_ARG_WITH(mpi-libs,
[ --with-mpi-libs=LIBS LIBS is space-separated list of library names
[ --with-mpi-libs=LIBS LIBS is space-separated list of library names
needed for MPI, e.g. \"nsl socket mpi\"],
for mpi_lib in $withval; do
MPILIBS="$MPILIBS -l$mpi_lib"
@ -80,34 +93,60 @@ AC_ARG_WITH(mpi-libs,
AC_ARG_WITH(mpi-lib-dirs,
[ --with-mpi-lib-dirs=DIRS
DIRS is space-separated list of directories
DIRS is space-separated list of directories
containing the libraries specified by
\`--with-mpi-libs', e.g \"/usr/lib /usr/local/mpi/lib\"],
for mpi_lib_dir in $withval; do
MPILIBDIRS="-L$mpi_lib_dir $MPILIBDIRS"
done; casc_user_chose_mpi=yes)
AC_ARG_WITH(mpi-flags,
[ --with-mpi-flags=FLAGS FLAGS is space-separated list of
whatever flags other than -l and -L are needed
to link with mpi libraries],
MPIFLAGS=$withval)
[ --with-mpi-flags=FLAGS FLAGS is a space seperated list of whatever
flags other than -l and -L are needed to link with
MPI libraries-- Does not de-activate auto search
for other MPI information],
MPIFLAGS=$withval)
AC_ARG_WITH(purify,
[ --with-purify use purify-- finds mpi for use with non MPICH compiler],
casc_using_purify=yes
casc_user_chose_compilers=yes
casc_user_chose_mpi=yes
CC=gcc
MPIINCLUDE="$MPIINCLUDE -I/usr/local/mpi/mpich/lib/solaris/ch_p4 -I/usr/local/mpi/mpich/include"
MPILIBS="$MPILIBS -lpmpich -lmpich -lsocket -lnsl -lpthread"
MPILIBDIRS="-L/usr/local/mpi/mpich/lib/solaris/ch_p4 $MPILIBDIRS"
)
[ --with-purify assign gcc if not already set by user and
prepends "purify" to compile/link line],
if test "$casc_user_chose_compilers" = "no"
then
CC=gcc
CXX=g++
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
casc_user_chose_compilers=yes
fi
PREPEND=purify)
AC_ARG_WITH(cegdb,
[ --with-cegdb assign gcc and -g and link in -lcegdb and include cegdb.h],
CC=gcc
CXX=g++
casc_users_chose_compilers=yes
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
CASC_CHECK_HEADER(cegdb.h, /home/casc/include,
CASC_ADD_LIB(cegdb, cegdb, /home/casc/lib, LD)
))
AC_ARG_WITH(gdb,
[ --with-gdb assign gcc and -g and link in -lgdb and include
gdb.h],
CC=gcc
CXX=g++
casc_users_chose_compilers=yes
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
CASC_CHECK_HEADER(gdb.h, /usr/local/include /usr/include,
CASC_ADD_LIB(gdb, gdb, /usr/local/lib /usr/lib, LD)
))
dnl *********************************************************************
dnl * If the user has specified any other command line options (without-MPI,
dnl * with-pthreads, with-dmalloc etc.) then this section identifies the
@ -168,6 +207,9 @@ dnl * flags are set as needed. The supported platforms are IRIX, DEC alpha,
dnl * sun/solaris, IBM rs6000, Intel ??, and SGI ??.
dnl *********************************************************************
if test -z "$CC"
then
case $HOSTNAME in
sasn100 )
@ -232,7 +274,7 @@ case $HOSTNAME in
;;
esac
fi
if test -z "$CC"
then
@ -481,6 +523,17 @@ AC_PROG_CPP
AC_PROG_CXXCPP
CASC_PROG_FPP
if test "$casc_user_chose_compilers" = "yes" &&
test "$casc_using_mpi" = "yes" &&
test "$casc_user_chose_mpi" = "no"
then
HYPRE_FIND_MPI
fi
dnl *********************************************************************
dnl * This macro uses the values assigned to CASC_SET_COPT and
dnl * CASC_SET_CDEBUG (and C++ and Fortan counterparts) to set either
@ -489,24 +542,11 @@ dnl * on the command line. If neither is selected then all selected
dnl * flags remain on.
dnl *********************************************************************
CASC_OPT_DEBUG_CHOICES
dnl *********************************************************************
dnl * When debugging was chosen, look for debugging libraries and headers,
dnl * if they are available. Note that if neither debug or opt is chosen
dnl * or if both debug and opt are chosen OPTCHOICE is set to O.
dnl * adds -l flags to LDLIBS, adds -L flags to LDLIBDIRS, if necessary
dnl *********************************************************************
if test "$OPTCHOICE" = "g"
if test "$casc_user_chose_compilers" = "no"
then
CASC_CHECK_HEADER(cegdb.h, /home/casc/include,
CASC_ADD_LIB(cegdb, cegdb, /home/casc/lib, LD)
)
CASC_OPT_DEBUG_CHOICES
fi
dnl *********************************************************************
dnl * Add flags to LIBS and LIBDIRS
dnl * Note: CASC_ADD_LIB calls should be placed in the order you want the
@ -536,6 +576,10 @@ AC_SUBST(LDLIBS)
AC_SUBST(LDLIBDIRS)
AC_SUBST(ARCH)
AC_SUBST(RANLIB)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(F77FLAGS)
AC_SUBST(PREPEND)
dnl *********************************************************************
dnl * Use CASC_CONFIG_OUTPUT_LIST with AC_OUTPUT if you want to handle the

View File

@ -125,6 +125,475 @@ AC_DEFUN(HYPRE_ADD_LIB,
])dnl
dnl ********************************************************************
dnl * HYPRE_FIND_MPI will determine the libraries, directories, and other
dnl * flags needed to compile and link programs with MPI function calls.
dnl * This macro runs tests on the script found by the CASC_PROG_MPICC
dnl * macro. If there is no such mpicc-type script in the PATH
dnl * then this macro will not work.
dnl *
dnl * One may question why these settings would need to be determined if
dnl * there already is mpicc available, and that is a valid question. I
dnl * can think of a couple of reasons one may want to use these settings
dnl * rather than using mpicc directly. First, these settings allow you
dnl * to choose the C compiler you wish to use rather than using whatever
dnl * compiler is written into mpicc. Also, the settings determined by
dnl * this macro should also work with C++ and Fortran compilers, so you
dnl * won't need to have mpiCC and mpif77 alongside mpicc. This is
dnl * especially helpful on systems that don't have mpiCC. The advantage
dnl * of this macro over CASC_SET_MPI is that this one doesn't require
dnl * a test of the machine type and thus will hopefully work on unknown
dnl * architectures. The main disadvantage is that it relies on mpicc.
dnl *
dnl * --with-mpi-include, --with-mpi-libs, and --with-mpi-lib-dirs can be
dnl * used to manually override the automatic test, just as with
dnl * CASC_SET_MPI. If any one of these three options are used, the
dnl * automatic test will not be run, so it is best to call all three
dnl * whenever one is called. In addition, the option --with-mpi-flags is
dnl * available here to set any other flags that may be needed, but it
dnl * does not override the automatic test. Flags set by --with-mpi-flags
dnl * will be added to the variable MPIFLAGS. This way, if the macro, for
dnl * whatever reason, leaves off a necessary flag, the flag can be added
dnl * to MPIFLAGS without eliminating anything else. The other variables
dnl * set are MPIINCLUDE, MPILIBS, and MPILIBDIRS, just as in
dnl * CASC_SET_MPI. This macro also incorporates CASC_SET_MPI as a backup
dnl * plan, where if there is no mpicc, it will use the settings
dnl * determined by architecture name in CASC_SET_MPI
dnl ********************************************************************
AC_DEFUN(HYPRE_FIND_MPI,
[
casc_find_mpi_cache_used=yes
AC_MSG_CHECKING(for MPI)
AC_CACHE_VAL(casc_cv_mpi_include, casc_find_mpi_cache_used=no)
AC_CACHE_VAL(casc_cv_mpi_libs, casc_find_mpi_cache_used=no)
AC_CACHE_VAL(casc_cv_mpi_lib_dirs, casc_find_mpi_cache_used=no)
AC_CACHE_VAL(casc_cv_mpi_flags, casc_find_mpi_cache_used=no)
AC_MSG_RESULT( )
if test "$casc_find_mpi_cache_used" = "yes"; then
AC_MSG_CHECKING(for location of mpi.h)
MPIINCLUDE=$casc_cv_mpi_include
AC_MSG_RESULT("\(cached\) $MPIINCLUDE")
AC_MSG_CHECKING(for MPI library directories)
MPILIBDIRS=$casc_cv_mpi_lib_dirs
AC_MSG_RESULT("\(cached\) $MPILIBDIRS")
AC_MSG_CHECKING(for MPI libraries)
MPILIBS=$casc_cv_mpi_libs
AC_MSG_RESULT("\(cached\) $MPILIBS")
AC_MSG_CHECKING(for other MPI-related flags)
MPIFLAGS=$casc_cv_mpi_flags
AC_MSG_RESULT("\(cached\) $MPIFLAGS")
else
dnl * Set up user options. If user uses any of the fist three options,
dnl * then automatic tests are not run.
casc_user_chose_mpi=no
AC_ARG_WITH(mpi-include, [ --with-mpi-include=DIR mpi.h is in DIR],
for mpi_dir in $withval; do
MPIINCLUDE="$MPIINCLUDE -I$withval"
done; casc_user_chose_mpi=yes)
AC_ARG_WITH(mpi-libs,
[ --with-mpi-libs=LIBS LIBS is space-separated list of library names
needed for MPI, e.g. \"nsl socket mpi\"],
for mpi_lib in $withval; do
MPILIBS="$MPILIBS -l$mpi_lib"
done; casc_user_chose_mpi=yes)
AC_ARG_WITH(mpi-lib-dirs,
[ --with-mpi-lib-dirs=DIRS
DIRS is space-separated list of directories
containing the libraries specified by
\`--with-mpi-libs', e.g \"/usr/lib /usr/local/mpi/lib\"],
for mpi_lib_dir in $withval; do
MPILIBDIRS="-L$mpi_lib_dir $MPILIBDIRS"
done; casc_user_chose_mpi=yes)
dnl * --with-mpi-flags only adds to automatic selections,
dnl * does not override
AC_ARG_WITH(mpi-flags,
[ --with-mpi-flags=FLAGS FLAGS is space-separated list of whatever flags other
than -l and -L are needed to link with mpi libraries],
MPIFLAGS=$withval)
AC_CHECK_PROGS(MPICC, mpcc mpicc tmcc hcc)
if test -z "$MPICC"; then
AC_MSG_WARN([no acceptable mpicc found in \$PATH])
CASC_SET_MPI
if test -z "$MPILIBS"; then
AC_MSG_WARN([MPI not found - must set manually using --with flags])
fi
dnl * When $MPICC is there, run the automatic test
dnl * here begins the hairy stuff
else
changequote(, )dnl
AC_MSG_CHECKING(for location of mpi.h)
dnl * Create a minimal MPI program. It will be compiled using
dnl * $CC with verbose output.
cat > mpconftest.c << EOF
#include "mpi.h"
main(int argc, char **argv)
{
int rank, size;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
return 0;
}
EOF
casc_mplibs=
casc_mplibdirs=
casc_flags=
casc_lmpi_exists=no
dnl * These are various ways to produce verbose output from $MPICC
dnl * All of their outputs are stuffed into variable
dnl * $casc_mpoutput
for casc_command in "$MPICC -show"\
"$MPICC -v"\
"$MPICC -#"\
"$MPICC"; do
casc_this_output=`$casc_command mpconftest.c -o mpconftest 2>&1`
dnl * If $MPICC uses xlc, then commas must be removed from output
xlc_p=`echo $casc_this_output | grep xlcentry`
if test -n "$xlc_p"; then
casc_this_output=`echo $casc_this_output | sed 's/,/ /g'`
fi
dnl * Turn on flag once -lmpi is found in output
lmpi_p=`echo $casc_this_output | grep "\-lmpi"`
if test -n "$lmpi_p"; then
casc_lmpi_exists=yes
fi
casc_mpoutput="$casc_mpoutput $casc_this_output"
casc_this_output=
done
rm -rf mpconftest*
dnl * little test to identify $CC as IBM's xlc
echo "main() {}" > cc_conftest.c
cc_output=`${CC-cc} -v -o cc_conftest cc_conftest.c 2>&1`
xlc_p=`echo $cc_output | grep xlcentry`
if test -n "$xlc_p"; then
casc_compiler_is_xlc=yes
fi
rm -rf cc_conftest*
dnl * $MPICC might not produce '-lmpi', but we still need it.
dnl * Add -lmpi to $casc_mplibs if it was never found
if test "$casc_lmpi_exists" = "no"; then
casc_mplibs="-lmpi"
else
casc_mplibs=
fi
casc_want_arg=
dnl * Loop through every word in output to find possible flags.
dnl * If the word is the absolute path of a library, it is added
dnl * to $casc_flags. Any "-llib", "-L/dir", "-R/dir" and
dnl * "-I/dir" is kept. If '-l', '-L', '-R', '-I', '-u', or '-Y'
dnl * appears alone, then the next word is checked. If the next
dnl * word is another flag beginning with '-', then the first
dnl * word is discarded. If the next word is anything else, then
dnl * the two words are coupled in the $casc_arg variable.
dnl * "-binitfini:poe_remote_main" is a flag needed especially
dnl * for IBM MPI, and it is always kept if it is found.
dnl * Any other word is discarded. Also, after a word is found
dnl * and kept once, it is discarded if it appears again
for casc_arg in $casc_mpoutput; do
casc_old_want_arg=$casc_want_arg
casc_want_arg=
if test -n "$casc_old_want_arg"; then
case "$casc_arg" in
-*)
casc_old_want_arg=
;;
esac
fi
case "$casc_old_want_arg" in
'')
case $casc_arg in
/*.a)
exists=false
for f in $casc_flags; do
if test x$casc_arg = x$f; then
exists=true
fi
done
if $exists; then
casc_arg=
else
casc_flags="$casc_flags $casc_arg"
fi
;;
-binitfini:poe_remote_main)
exists=false
for f in $casc_flags; do
if test x$casc_arg = x$f; then
exists=true
fi
done
if $exists; then
casc_arg=
else
casc_flags="$casc_flags $casc_arg"
fi
;;
-lang*)
casc_arg=
;;
-[lLR])
casc_want_arg=$casc_arg
casc_arg=
;;
-[lLR]*)
exists=false
for f in $casc_flags; do
if test x$casc_arg = x$f; then
exists=true
fi
done
if $exists; then
casc_arg=
else
casc_flags="$casc_flags $casc_arg"
fi
;;
-u)
casc_want_arg=$casc_arg
casc_arg=
;;
-Y)
casc_want_arg=$casc_arg
casc_arg=
;;
-I)
casc_want_arg=$casc_arg
casc_arg=
;;
-I*)
exists=false
for f in $casc_flags; do
if test x$casc_arg = x$f; then
exists=true
fi
done
if $exists; then
casc_arg=
else
casc_flags="$casc_flags $casc_arg"
fi
;;
*)
casc_arg=
;;
esac
;;
-[lLRI])
casc_arg="casc_old_want_arg $casc_arg"
;;
-u)
casc_arg="-u $casc_arg"
;;
-Y)
casc_arg=`echo $casc_arg | sed -e 's%^P,%%'`
SAVE_IFS=$IFS
IFS=:
casc_list=
for casc_elt in $casc_arg; do
casc_list="$casc_list -L$casc_elt"
done
IFS=$SAVE_IFS
casc_arg="$casc_list"
;;
esac
dnl * Still inside the big for loop, we separate each flag
dnl * into includes, libdirs, libs, flags
if test -n "$casc_arg"; then
case $casc_arg in
-I*)
dnl * if the directory given in this flag contains mpi.h
dnl * then the flag is assigned to $MPIINCLUDE
if test -z "$MPIINCLUDE"; then
casc_cppflags="$casc_cppflags $casc_arg"
casc_include_dir=`echo "$casc_arg" | sed 's/-I//g'`
SAVE_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$casc_cppflags"
changequote([, ])dnl
unset ac_cv_header_mpi_h
AC_CHECK_HEADER(mpi.h,
MPIINCLUDE="$casc_cppflags")
changequote(, )dnl
CPPFLAGS="$SAVE_CPPFLAGS"
else
casc_arg=
fi
;;
-[LR]*)
dnl * These are the lib directory flags
casc_mplibdirs="$casc_mplibdirs $casc_arg"
;;
-l* | /*)
dnl * These are the libraries
casc_mplibs="$casc_mplibs $casc_arg"
;;
-binitfini:poe_remote_main)
if test "$casc_compiler_is_xlc" = "yes"; then
casc_mpflags="$casc_mpflags $casc_arg"
fi
;;
*)
dnl * any other flag that has been kept goes here
casc_mpflags="$casc_mpflags $casc_arg"
;;
esac
dnl * Upcoming test needs $LIBS to contain the flags
dnl * we've found
LIBS_SAVE=$LIBS
LIBS="$MPIINCLUDE $casc_mpflags $casc_mplibdirs $casc_mplibs"
if test -n "`echo $LIBS | grep '\-R/'`"; then
LIBS=`echo $LIBS | sed 's/-R\//-R \//'`
fi
changequote([, ])dnl
dnl * Test to see if flags found up to this point are
dnl * sufficient to compile and link test program. If not,
dnl * the loop keeps going to the next word
AC_TRY_LINK(
ifelse(AC_LANG, CPLUSPLUS,
[#ifdef __cplusplus
extern "C"
#endif
])dnl
[#include "mpi.h"
], [int rank, size;
int argc;
char **argv;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
],
casc_result=yes)
LIBS=$LIBS_SAVE
if test "$casc_result" = yes; then
casc_result=
break
fi
fi
done
dnl * After loop is done, set variables to be substituted
MPILIBS=$casc_mplibs
MPILIBDIRS=$casc_mplibdirs
MPIFLAGS="$MPIFLAGS $casc_mpflags"
dnl * IBM MPI uses /usr/lpp/ppe.poe/libc.a instead of /lib/libc.a
dnl * so we need to make sure that -L/lib is not part of the
dnl * linking line when we use IBM MPI. This only appears in
dnl * configure when CASC_FIND_MPI is called first.
ifdef([AC_PROVIDE_CASC_FIND_F77LIBS],
if test -n "`echo $F77LIBFLAGS | grep '\-L/lib '`"; then
if test -n "`echo $F77LIBFLAGS | grep xlf`"; then
F77LIBFLAGS=`echo $F77LIBFLAGS | sed 's/-L\/lib //g'`
fi
fi
)
if test -n "`echo $MPILIBS | grep pmpich`" &&
test -z "`echo $MPILIBS | grep pthread`"; then
LIBS_SAVE=$LIBS
LIBS="$MPIINCLUDE $MPIFLAGS $MPILIBDIRS $MPILIBS -lpthread"
AC_TRY_LINK(
ifelse(AC_LANG, CPLUSPLUS,
[#ifdef __cplusplus
extern "C"
#endif
])dnl
[#include "mpi.h"
], [int rank, size;
int argc;
char **argv;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Finalize();
],
MPILIBS="$MPILIBS -lpthread")
LIBS=$LIBS_SAVE
fi
AC_MSG_RESULT($MPIINCLUDE)
AC_MSG_CHECKING(for MPI library directories)
AC_MSG_RESULT($MPILIBDIRS)
AC_MSG_CHECKING(for MPI libraries)
AC_MSG_RESULT($MPILIBS)
AC_MSG_CHECKING(for other MPI-related flags)
AC_MSG_RESULT($MPIFLAGS)
fi
AC_CACHE_VAL(casc_cv_mpi_include, casc_cv_mpi_include=$MPIINCLUDE)
AC_CACHE_VAL(casc_cv_mpi_lib_dirs, casc_cv_mpi_lib_dirs=$MPILIBDIRS)
AC_CACHE_VAL(casc_cv_mpi_libs, casc_cv_mpi_libs=$MPILIBS)
AC_CACHE_VAL(casc_cv_mpi_flags, casc_cv_mpi_flags=$MPIFLAGS)
fi
AC_SUBST(MPIINCLUDE)
AC_SUBST(MPILIBDIRS)
AC_SUBST(MPILIBS)
AC_SUBST(MPIFLAGS)
])dnl