hypre/configure.in

776 lines
21 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 *********************************************************************
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )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
casc_using_petsc=no
casc_using_openmp=no
casc_using_ibm_smp=no
casc_using_sgi_smp=no
casc_using_pgcc_smp=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(timing, [\
--with-timing use timing routines],
HYPREDEFS="$HYPREDEFS -DHYPRE_TIMING"
)
AC_ARG_WITH(openmp,
[ --with-openmp use openMP],
HYPREDEFS="$HYPREDEFS -DHYPRE_USING_OPENMP"
casc_using_openmp=yes
)
AC_ARG_WITH(IBM_smp,
[ --with-IBM_smp use IBM SMP],
HYPREDEFS="$HYPREDEFS -DHYPRE_USING_IBM_SMP"
casc_using_ibm_smp=yes
)
AC_ARG_WITH(SGI_smp,
[ --with-SGI_smp use SGI SMP],
HYPREDEFS="$HYPREDEFS -DHYPRE_USING_SGI_SMP"
casc_using_sgi_smp=yes
)
AC_ARG_WITH(pgcc_smp,
[ --with-pgcc_smp use pgcc SMP (Red)],
HYPREDEFS="$HYPREDEFS -DHYPRE_USING_PGCC_SMP"
casc_using_pgcc_smp=yes
)
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
)
dnl top level source directory
HYPRE_TOP_SRC_DIR=`pwd`
AC_ARG_WITH(petsc, [\
--with-petsc use petsc],
if test "$withval" != "no"
then
casc_using_petsc=yes
HYPRE_PETSCDEFS="$HYPRE_PETSCDEFS -DPETSC_AVAILABLE"
HYPRE_PETSCLIBDIRS="$HYPRE_TOP_SRC_DIR/PETScMat_linear_solvers/pilut \
$HYPRE_TOP_SRC_DIR/PETSc_linear_solvers/ParILUT "
HYPRE_PETSCLIBS=" -l_HYPRE_PETScSolverParILUT \
-l_HYPRE_PETScMatPilutSolver "
else
HYPRE_PETSCDEFS=""
HYPRE_PETSCLIBDIRS=""
HYPRE_PETSCLIBS=""
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 -silent)
CASC_SET_FDEBUG(-g -silent)
;;
alpha)
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no" &&
test "$casc_using_openmp" = "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
if test "$casc_using_openmp" = "no"
then
AC_CHECK_PROGS(CC,mpicc cc kcc)
AC_CHECK_PROGS(CXX,mpiCC cxx KCC)
AC_CHECK_PROGS(F77,mpif77 f77 kf77)
else
AC_CHECK_PROGS(CC,guidec)
AC_CHECK_PROGS(CXX,guidec++)
AC_CHECK_PROGS(F77,guidef77)
fi
fi
fi
if test "$CC" = "cc" ||
test "$CC" = "kcc" ||
test "$CC" = "guidec" &&
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(-O)
CASC_SET_CXXDEBUG(-g)
;;
rs6000)
AC_ARG_WITH(COMM_SIMPLE, [\
--without-COMM_SIMPLE use MPI derived data types],
if test "$withval" = "no"
then
CFLAGS="$CFLAGS"
else
CFLAGS="$CFLAGS -DHYPRE_COMM_SIMPLE"
fi,
CFLAGS="$CFLAGS -DHYPRE_COMM_SIMPLE"
)
if test "$casc_user_chose_compilers" = "no"
then
if test "$casc_using_mpi" = "no"
then
if test "$casc_using_pthreads" = "no" &&
test "$casc_using_openmp" = "no"
then
AC_CHECK_PROGS(CC,xlc gcc cc c89)
AC_CHECK_PROGS(CXX,xlC KCC g++)
AC_CHECK_PROGS(F77,xlf g77)
else
if test "$casc_using_pthreads" = "yes"
then
AC_CHECK_PROGS(CC,xlc_r gcc)
AC_CHECK_PROGS(CXX,xlC_r g++)
AC_CHECK_PROGS(F77,xlf_r g77)
fi
if test "$casc_using_openmp" = "yes"
then
AC_CHECK_PROGS(CC,guidec)
AC_CHECK_PROGS(CXX,guidec++)
AC_CHECK_PROGS(F77,guidef77)
fi
fi
else
if test "$casc_using_pthreads" = "no" &&
test "$casc_using_openmp" = "no"
then
AC_CHECK_PROGS(CC,mpcc mpicc)
AC_CHECK_PROGS(CXX,mpCC mpiCC)
AC_CHECK_PROGS(F77,mpxlf mpif77)
AC_PROG_CPP
else
if test "$casc_using_pthreads" = "yes"
then
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
if test "$casc_using_openmp" = "yes"
then
AC_CHECK_PROGS(CC,mpguidec)
AC_CHECK_PROGS(CXX,mpguidec++)
AC_CHECK_PROGS(F77,mpguidef77)
fi
fi
fi
fi
CASC_SET_COPT(-O3 -qstrict)
CASC_SET_CDEBUG(-g)
CASC_SET_FOPT(-O3 -qstrict)
CASC_SET_FDEBUG(-g)
CASC_SET_CXXOPT(-O3 -qstrict)
CASC_SET_CXXDEBUG(-g)
CFLAGS="$CFLAGS -qmaxmem=8192"
;;
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
if test "$casc_using_petsc" = "yes"
then
CASC_FIND_PETSC
fi
CC="$PREPEND $CC"
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
CFLAGS="$CFLAGS $COPT $CDEBUG"
CXXFLAGS="$CXXFLAGS $CXXOPT $CXXDEBUG"
F77FLAGS="$F77FLAGS $FOPT $FDEBUG"
dnl *********************************************************************
dnl * Find the BLAS libraries
dnl *********************************************************************
CASC_FIND_BLAS
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 *********************************************************************
dnl ********************************************************************
dnl * The following macros are exported and may be used in Makefile.in's
dnl ********************************************************************
dnl * General purpose header files and libraries and directories for
dnl * those libraries.
AC_SUBST(INCLUDES)
AC_SUBST(LIBS)
AC_SUBST(LIBDIRS)
dnl * MPI-related header files and libraries and directories for
dnl * those libraries
AC_SUBST(MPIINCLUDE)
AC_SUBST(MPILIBS)
AC_SUBST(MPILIBDIRS)
AC_SUBST(MPIFLAGS)
dnl * macro definitions that should be included on compile line
AC_SUBST(HYPREDEFS)
AC_SUBST(TIMERDEFS)
dnl *Libraries and their directories that must be used at compile time
AC_SUBST(LDLIBS)
AC_SUBST(LDLIBDIRS)
AC_SUBST(RANLIB)
dnl * contains compiler flags such as optimization or debugging flags
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(F77FLAGS)
dnl *needed when compiling with another command prior to the compiler command
dnl * for example: purify cc ....
AC_SUBST(PREPEND)
dnl *PETSC-related header files, libraries and directories for those
dnl * libraries
AC_SUBST(PETSCLIBS)
AC_SUBST(PETSCLIBDIRS)
AC_SUBST(PETSCINCLUDE)
AC_SUBST(HYPRE_PETSCDEFS)
AC_SUBST(HYPRE_PETSCLIBS)
AC_SUBST(HYPRE_PETSCLIBDIRS)
AC_SUBST(HYPRE_TOP_SRC_DIR)
AC_SUBST(BLASLIBFLAGS)
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\
struct_matrix_vector\
struct_linear_solvers\
parcsr_matrix_vector\
parcsr_linear_solvers\
seq_matrix_vector\
seq_linear_solvers/pamg\
CI_struct_linear_solvers\
CI_struct_matrix_vector\
PETScMat_linear_solvers/pilut\
PETSc_linear_solvers/ParILUT\
distributed_linear_solvers/pilut\
distributed_matrix\
matrix_matrix\
bmakes\
test\
tools\
docs)
AC_OUTPUT($Makefile_list)