hypre/configure.in
dwalker bbeac980ad added support for using purify, cegdb, gdb, mpi with user defined
compilers, user defined compiler flags etc...
1999-03-12 00:45:21 +00:00

606 lines
16 KiB
Plaintext

dnl *********************************************************************
dnl * configure.in, when autoconf is run, this file is read and
dnl * the script configure is generated. Configure.in is structured
dnl * as follows: initialization, the current architecture is determined,
dnl * user specified compilers are set,
dnl * other user specifieds options are determined and relevant macros
dnl * assigned. Then, given the architecture, an optimal compiler is
dnl * found (if not specified by the user). If the archtecture is
dnl * unknown or none of the preferred compilers are available then
dnl * default compilers are found. For each chosen compiler, the
dnl * appropriate flags are set for optimization or debugging and MPI
dnl * and pthreading (if required). The C preprocessor is also checked.
dnl * Finally, library flags are added and AC_SUBST is used to export
dnl * all necessary macro values.
dnl *********************************************************************
dnl *********************************************************************
dnl * The first macro called must be AC_INIT with a unique file from the
dnl * package as its argument. configure checks for the existence of this
dnl * file to make sure it is located in the right place
dnl *********************************************************************
AC_INIT(utilities/memory.c)
dnl *********************************************************************
dnl * Set the variable ARCH, (CASC_GUESS_ARCH uses tarch). ARCH will
dnl * be used throught this file to determine optimal compilers, options
dnl * flag, etc for each supported architecture. If ARCH is unknown
dnl * then default settings will apply.
dnl *********************************************************************
HYPRE_GUESS_ARCH
dnl *********************************************************************
dnl * If the user has specified a c, c++, or fortran compiler on the
dnl * command line, that compiler will be used. No checks are done
dnl * to assure this compiler is present or working. Additionally,
dnl * if the user indicated any MPI include, library, or directory
dnl * to use with the chosen compiler those options are identified
dnl * and the appropriate macros are assigned values.
dnl *********************************************************************dnl *
unset CC
unset CXX
unset F77
casc_user_chose_compilers=no
casc_user_chose_mpi=no
casc_using_pthreads=no
AC_ARG_WITH(CC,
[ --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],
CXX=$withval
casc_user_chose_compilers=yes)
AC_ARG_WITH(F77,
[ --with-f77=ARG manually set f77 compiler to ARG],
F77=$withval
casc_user_chose_compilers=yes)
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
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)
AC_ARG_WITH(mpi-flags,
[ --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 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
dnl * options and assigns yes or no values to appropriate macros. These
dnl * values will be used to determine compilers, flags and libraries needed.
dnl *********************************************************************
AC_ARG_WITH(MPI,
[ --without-MPI do not use MPI],
if test "$withval" = "no"
then
casc_using_mpi=no
HYPREDEFS="$HYPREDEFS -DHYPRE_SEQUENTIAL"
else
casc_using_mpi=yes
fi,
casc_using_mpi=yes
)
AC_ARG_WITH(dmalloc,
[ --with-dmalloc use dmalloc package],
CASC_ADD_LIB(dmalloc, malloc, /home/casc/lib /usr/local/lib,
LD, HYPREDEFS="$HYPREDEFS -DHYPRE_MEMORY_DMALLOC"
)
)
AC_ARG_WITH(pthreads,
[ --with-pthreads use pthreads],
if test "$withval" != "no"
then
casc_using_pthreads=yes
CASC_CHECK_LIB(pthread, pthread_create, ,
[CASC_CHECK_LIB(pthreads, pthread_create)])
if test "$ac_cv_lib_pthread_pthread_create" = "yes" ||
test "$ac_cv_lib_pthreads_pthread_create" = "yes"
then
HYPREDEFS="$HYPREDEFS -DHYPRE_USE_PTHREADS"
fi
fi
)
AC_PROG_RANLIB
dnl *********************************************************************
dnl * For each ARCH (6 supported platforms and 1 default) the "best"
dnl * compilers are chosen based on, the architecture, MPI or no-MPI,
dnl * pthreads or no pthreads, and the preference list of compilers.
dnl * If none of the preferred compilers are available then the default
dnl * compilers will be searched for (using CASC_FIND_MPI or AC_PROG_CC,
dnl * AC_PROG_CXX, and AC_PROG_F77). Depending on the compiler chosen,
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 )
if test "$casc_user_chose_compilers" = "no"
then
AC_CHECK_PROGS(CC, cicc cc)
AC_CHECK_PROGS(CXX, ciCC CC)
AC_CHECK_PROGS(F77, cif77 f77)
fi
if test "$casc_user_chose_mpi" = "no"
then
if test "$casc_using_mpi" = "yes"
then
CASC_CHECK_HEADER(mpi.h, /opt/intel/tflop/TF98_2.4.1/tflops/cougar/include)
MPIINCLUDE="$MPIINCLUDE $INCLUDES"
CASC_ADD_LIB(mpi, main, /opt/intel/tflop/TF98_2.4.1/tflops/cougar/lib/puma, MPI)
if test -z "$MPILIBS"
then
AC_MSG_WARN([MPI not found-- must set manually using --with-flags])
fi
fi
fi
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
CASC_SET_CXXOPT(-O)
CASC_SET_CXXDEBUG(-g)
CASC_SET_FOPT(-O)
CASC_SET_FDEBUG(-g)
;;
n0* )
if test "$casc_user_chose_compilers" = "no"
then
AC_CHECK_PROGS(CC, cc kcc gcc)
AC_CHECK_PROGS(CXX, CC KCC g++)
AC_CHECK_PROGS(F77, f77 g77)
fi
if test "$casc_user_chose_mpi" = "no"
then
if test "$casc_using_mpi" = "yes"
then
CASC_ADD_LIB(mpi, main, /usr/lib, MPI)
if test -z "$MPILIBS"
then
AC_MSG_WARN([MPI not found-- must set manually using --with-flags])
fi
fi
fi
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
CASC_SET_CXXOPT(-O)
CASC_SET_CXXDEBUG(-g)
CASC_SET_FOPT(-O)
CASC_SET_FDEBUG(-g)
;;
esac
fi
if test -z "$CC"
then
case $ARCH in
sun4 | solaris )
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
AC_CHECK_PROGS(CC, cc gcc kcc)
AC_CHECK_PROGS(CXX, CC g++)
AC_CHECK_PROGS(F77, f77 g77)
else
AC_CHECK_PROGS(CC, mpicc)
AC_CHECK_PROGS(CXX, mpiCC)
AC_CHECK_PROGS(F77, mpif77)
fi
fi
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
CASC_SET_CXXOPT(-O)
CASC_SET_CXXDEBUG(-g)
CASC_SET_FOPT(-O)
CASC_SET_FDEBUG(-g)
;;
alpha)
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
AC_CHECK_PROGS(CC,cc kcc gcc c89)
AC_CHECK_PROGS(CXX,cxx KCC g++)
AC_CHECK_PROGS(F77,f77 kf77 g77)
else
AC_CHECK_PROGS(CC,cc kcc mpicc)
AC_CHECK_PROGS(CXX,cxx KCC mpiCC)
AC_CHECK_PROGS(F77,f77 kf77 mpif77)
fi
fi
if test "$CC" = "cc" ||
test "$CC" = "kcc" &&
test "$casc_user_chose_mpi" = "no" &&
test "$casc_using_mpi" = "yes"
then
CASC_CHECK_HEADER(mpi.h, /usr/include)
MPIINCLUDE="$MPIINCLUDE $INCLUDES"
CASC_ADD_LIB(rt, main, /usr/lib)
HYPRE_ADD_LIB(mpi, main, /usr/opt/MPI170/lib, MPI, ,
CASC_ADD_LIB(mpi, main, /usr/lib, MPI) )
if test -z "$MPILIBS"
then
AC_MSG_WARN([MPI not found-- must set manually using --with-flags])
fi
fi
if test "$CC" = "kcc"
then
CASC_SET_COPT(-o5)
CASC_SET_CDEBUG()
else
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
fi
if test "$F77" = "kf77"
then
CASC_SET_FOPT(-o5)
CASC_SET_FDEBUG()
else
CASC_SET_FOPT(-o5)
CASC_SET_FDEBUG()
fi
CASC_SET_CXXOPT(-0)
CASC_SET_CXXDEBUG(-g)
;;
rs6000)
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
if test "$casc_using_pthreads" = "no"
then
AC_CHECK_PROGS(CC,xlc gcc cc c89)
AC_CHECK_PROGS(CXX,xlC KCC g++)
AC_CHECK_PROGS(F77,xlf g77)
else
AC_CHECK_PROGS(CC,xlc_r gcc)
AC_CHECK_PROGS(CXX,xlC_r g++)
AC_CHECK_PROGS(F77,xlf_r g77)
fi
else
if test "$casc_using_pthreads" = "no"
then
AC_CHECK_PROGS(CC,mpcc mpicc)
AC_CHECK_PROGS(CXX,mpCC mpiCC)
AC_CHECK_PROGS(F77,mpxlf mpif77)
else
AC_CHECK_PROGS(CC,mpxlc_r mpcc_r mpicc)
AC_CHECK_PROGS(CXX,mpxlC_r mpCC_r mpiCC)
AC_CHECK_PROGS(F77,mpxlf_r mpif77)
fi
fi
fi
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
CASC_SET_FOPT(-O)
CASC_SET_FDEBUG(-g)
CASC_SET_CXXOPT(-0)
CASC_SET_CXXDEBUG(-g)
;;
IRIX64)
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
AC_CHECK_PROGS(CC, cc gcc c89)
AC_CHECK_PROGS(CXX, cxx CC g++)
AC_CHECK_PROGS(F77, f77 g77)
else
AC_CHECK_PROGS(CC, mpicc mpcc tmcc hcc)
AC_CHECK_PROGS(CXX, mpiCC)
AC_CHECK_PROGS(F77, mpif77)
if test -z "$CC"
then
AC_CHECK_PROGS(CC, cc gcc)
fi
if test -z "$CXX"
then
AC_CHECK_PROGS(CXX, cxx CC g++)
fi
if test -z "$F77"
then
AC_CHECK_PROGS(F77, f77 g77)
fi
fi
fi
if test "$CC" = "cc" ||
test "$CC" = "gcc" &&
test "$casc_user_chose_mpi" = "no" &&
test "$casc_using_mpi" = "yes"
then
CASC_CHECK_HEADER(mpi.h, /usr/local/mpi/include)
MPIINCLUDE="$MPIINCLUDE -I$INCLUDES"
CASC_ADD_LIB(mpi, main, /usr/local/mpi/lib, MPI)
if test -z "$MPILIBS"
then
AC_MSG_WARN([MPI not found-- must set manually using --with-flags])
fi
fi
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
CASC_SET_CXXOPT(-O)
CASC_SET_CXXDEBUG(-g)
CASC_SET_FOPT(-O)
CASC_SET_FDEBUG(-g)
;;
esac
fi
if test -z "$CC"
then
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
AC_CHECK_PROGS(CC, cc kcc gcc c89)
AC_CHECK_PROGS(CXX, cxx CC KCC g++)
AC_CHECK_PROGS(F77, f77 kf77 g77)
else
AC_CHECK_PROGS(CC, mpicc mpcc tmcc hcc)
AC_CHECK_PROGS(CXX, mpiCC)
AC_CHECK_PROGS(F77, mpif77)
if test -z "$CC"
then
AC_CHECK_PROGS(CC, cc kcc gcc)
fi
if test -z "$CXX"
then
AC_CHECK_PROGS(CXX, cxx CC g++)
fi
if test -z "$F77"
then
AC_CHECK_PROGS(F77, f77 g77)
fi
fi
fi
if test "$CC" = "cc" ||
test "$CC" = "gcc" ||
test "$CC" = "kcc" &&
test "$casc_user_chose_mpi" = "no" &&
test "$casc_using_mpi" = "yes"
then
CASC_CHECK_HEADER(mpi.h, /usr/local/mpi/include)
MPIINCLUDE="$MPIINCLUDE -I$INCLUDES"
CASC_ADD_LIB(mpi, main, /usr/local/mpi/lib, MPI)
if test -z "$MPILIBS"
then
AC_MSG_WARN([MPI not found-- must set manually using --with-flags])
fi
fi
if test "$CC" = "kcc"
then
CASC_SET_COPT(-o5)
CASC_SET_CDEBUG()
else
CASC_SET_COPT(-O)
CASC_SET_CDEBUG(-g)
fi
if test "$F77" = "kf77"
then
CASC_SET_FOPT(-o5)
CASC_SET_FDEBUG()
else
CASC_SET_FOPT(-o5)
CASC_SET_FDEBUG()
fi
fi
dnl ********************************************************************
dnl * a check to find out how to use the preprocessors. This must
dnl * be done AFTER compilers are set is set.
dnl * ******************************************************************
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
dnl * the debug or opt compiler flag depending on what the user enters
dnl * on the command line. If neither is selected then all selected
dnl * flags remain on.
dnl *********************************************************************
if test "$casc_user_chose_compilers" = "no"
then
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
dnl * libraries to appear on the linking line.
dnl *********************************************************************
CASC_ADD_LIB(m, main, /usr/lib /usr/ccs/lib)
dnl *********************************************************************
dnl * AC_SUBST performs the variable substitutions
dnl * Some macros call AC_SUBST for some variables, but it does no damage
dnl * to call it again.
dnl *********************************************************************
AC_SUBST(INCLUDES)
AC_SUBST(LIBS)
AC_SUBST(LIBDIRS)
AC_SUBST(MPIINCLUDE)
AC_SUBST(MPILIBS)
AC_SUBST(MPILIBDIRS)
AC_SUBST(MPIFLAGS)
AC_SUBST(COPT)
AC_SUBST(CDEBUG)
AC_SUBST(HYPREDEFS)
AC_SUBST(TIMERDEFS)
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
dnl * possibility that certain parts of the package are not present.
dnl *********************************************************************
CASC_CONFIG_OUTPUT_LIST(\
.\
utilities\
parcsr_matrix_vector\
parcsr_linear_solvers\
seq_matrix_vector\
struct_matrix_vector\
struct_linear_solvers\
seq_linear_solvers/pamg\
test\
bmakes\
docs)
AC_OUTPUT($Makefile_list)