--- branches/mmeineke/OOPSE/ac-tools/configure.in 2003/03/21 17:42:12 377 +++ trunk/OOPSE/ac-tools/configure.in 2003/10/27 16:20:59 822 @@ -1,167 +1,57 @@ dnl **** Process this file with autoconf to produce a configure script. -AC_INIT(src/oopse.cpp) +AC_INIT(OOPSE, 1.0, gezelter@nd.edu, oopse) AC_CONFIG_AUX_DIR(ac-tools) -AC_CONFIG_HEADER(config.h:ac-tools/config.h.in) - -AC_PREFIX_DEFAULT("/usr/local") - +builtin(include, ac-tools/fortran90.m4) builtin(include, ac-tools/aclocal.m4) -dnl Checks for C compiler -AC_PROG_RANLIB -AC_PROG_YACC -AC_PROG_LEX -AC_SUBST(EXEEXT) -AC_SUBST(OBJEXT) -AC_SUBST(BATEXT) +AC_CONFIG_SRCDIR([src/oopse.cpp]) -AC_SUBST(MKINSTALLDIRS) +AC_PREFIX_DEFAULT("/usr/local") -AC_SUBST(OOPSE) -AC_SUBST(OOPSE_HOME) -AC_SUBST(sprng_libdir) -AC_SUBST(mpich_libdir) -AC_SUBST(sprng_include) -AC_SUBST(mpich_include) -AC_SUBST(mpi_f90_mods) -AC_SUBST(SUBDIRS) +# set program name +PROGNAME="oopse" +AC_SUBST(PROGNAME) -OOPSE=oopse +# there are two ways to do debugging. One with the --enable-debug flag +# and one using the DEBUG environment variable -dnl **** define home dir of oopse -if test "x${prefix}" = "xNONE" -then - OOPSE_HOME=${ac_default_prefix}/oopse -else - OOPSE_HOME=${prefix}/oopse +debug=0 +AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Compile OOPSE in debug mode]), [debug=1]) +if test "${DEBUG}"; then + AC_DEFINE(debug, 1, [Code compiled in debug mode]) + msg="$msg, debug mode" fi -AC_ARG_ENABLE(oopse-home, -[ --enable-oopse-home=DIR define oopse home dir [PREFIX/oopse]], -[OOPSE_HOME="${enableval}"]) +AC_SUBST(debug) -dnl **** define C compiler -CC=${CC-icc} -AC_ARG_WITH(cc, -[ --with-cc=PROG use PROG as C compiler [${CC-icc}]], -[CC="${withval}"]) -AC_PROG_CC([icc gcc cc]) - -dnl **** define C compiler -CXX=${CXX-icc} -AC_ARG_WITH(cxx, -[ --with-cxx=PROG use PROG as C++ compiler [${CXX-icc}]], -[CXX="${withval}"]) -AC_PROG_CXX([icc g++ c++]) - -dnl **** define Fortran compiler -F77=${F77-ifc} -AC_ARG_WITH(f77, -[ --with-f77=PROG use PROG as Fortran compiler [${F77-ifc}]], -[F77="${withval}"]) -AC_PROG_F77([ifc f90]) - -dnl **** check if user wants to compile with debugging support -AC_ARG_ENABLE(debug, -[ --enable-debug turn on debugging [no]], -[case "${enableval}" in - yes) debug=true ;; - no) debug=false ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;; -esac],[debug=false]) - - -dnl **** Define CFLAGS etc empty to prevent configure from setting them -CFLAGS=${CFLAGS-""} -FFLAGS=${FFLAGS-""} -LDFLAGS=${LDFLAGS-""} -OPTIMIZE=${OPTIMIZE-""} -DEBUG=${DEBUG-""} - - -dnl **** Check for host type +# who am i AC_CANONICAL_HOST +dnl Checks for programs. +AC_PROG_CC([icc xlc gcc cc]) +AC_PROG_CXX([icpc icc xlC CC g++ c++]) +AC_PROG_F90([ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) +ACX_PROG_F90_PREPFLAG +ACX_PROG_F90_PREPDEFFLAG -if test "x${CFLAGS}" = "x" -then - if test "x${GCC}" = "xyes" - then - dnl **** default settings for gcc - DEBUG="-g -O2" - OPTIMIZE="-O2" - CFLAGS="-fno-common -Wall -pedantic -Wpointer-arith -Wnested-externs" - - dnl **** check for strength-reduce bug - ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce") - - dnl **** some arch-specific optimizations/settings for gcc - case "${host}" in - i486-*) CPU_FLAGS="-m486";; - i586-*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium, - [CPU_FLAGS=-mcpu=pentium], - [ACX_CHECK_CC_FLAGS(-mpentium,pentium, - [CPU_FLAGS=-mpentium], [CPU_FLAGS=-m486])]) - ;; - i686-*) ACX_CHECK_CC_FLAGS(-mcpu=pentiumpro,cpu_pentiumpro, - [CPU_FLAGS=-mcpu=pentiumpro], - [ACX_CHECK_CC_FLAGS(-mpentiumpro,pentiumpro, - [CPU_FLAGS=-mpentiumpro], [CPU_FLAGS=-m486])]) - ;; - esac - - CFLAGS="$CPU_FLAGS $CFLAGS" - else - case "${host}" in - alpha*-dec-osf4.*) - CFLAGS="-std1 -w0" - OPTIMIZE="-O2" - DEBUG="-g3 -O2" - ;; - hppa*-hp-hpux*) - CFLAGS="-Aa -D_HPUX_SOURCE" - OPTIMIZE="-O" - DEBUG="-g -O" - ;; - mips-sgi-irix6.[[4-9]]*) - CFLAGS="-w" - OPTIMIZE="-O2 -OPT:Olimit=0" - DEBUG="-g3 -O2 -OPT:Olimit=0" - ;; - mips-sgi-irix*) - CFLAGS="-fullwarn -woff 835" - OPTIMIZE="-O2 -Olimit 3500" - ;; - rs6000-ibm-aix*) - CFLAGS="-D_ALL_SOURCE" - OPTIMIZE="-O2" - DEBUG="-g -O2" - ;; - *) - CFLAGS="" - OPTIMIZE="-O" - DEBUG="-g" - ;; - esac - fi -fi - case $debug in - true) CFLAGS="$DEBUG $CFLAGS";; - *) CFLAGS="$OPTIMIZE $CFLAGS";; + 1) + ;; + *) + ACX_PROG_CC_MAXOPT + ACX_PROG_CXX_MAXOPT + ACX_PROG_F90_MAXOPT + ;; esac -dnl **** .exe/.obj file extensions -AC_EXEEXT -AC_OBJEXT - -OBJEXT=".$OBJEXT" - +AC_PROG_INSTALL +AC_PROG_LN_S AC_PROG_MAKE_SET - -dnl **** Checks for programs. +AC_PROG_RANLIB +AC_PROG_YACC +AC_PROG_LEX AC_CHECK_PROG(AR, ar, ar, NONE) if test "$AR" = "NONE"; then AC_MSG_ERROR(--> Can't find \`ar'!) @@ -169,73 +59,101 @@ AC_F77_LIBRARY_LDFLAGS exit 1 fi -AC_F77_LIBRARY_LDFLAGS +AC_LANG_PUSH(Fortran 90) +AC_LANG_PREPROC(Fortran 90) +AC_F90_LIBRARY_LDFLAGS +dnl how Fortran mangles function names +AC_F90_WRAPPERS +AC_SUBST(F90_FUNC) +AC_SUBST(F90_FUNC_) -case $F77 in - ifc) fortran_machine_defs='Linux_ifc_machdep.$(O)' flibs_extra='-lPEPCF90' ;; - *) echo $F77; AC_MSG_ERROR([currently only ifc is supported as the fortran compiler. See README for details]) ;; +AC_MSG_CHECKING([for mpi-directory]) +AC_ARG_WITH(mpi_dir, + [ --with-mpi_dir=MPIDIR give the path for MPI [/usr/local]], + MPI_DIR="$withval", MPI_DIR="/usr/local") +AC_MSG_RESULT([$MPI_DIR]) +AC_SUBST([mpi_dir]) + +AC_MSG_CHECKING([for mpi-lib-directory]) +AC_ARG_WITH(mpi_libdir, + [ --with-mpi-libdir=dir give the path for MPI-libraries [MPI_DIR/lib]], + MPI_LIBDIR="$withval", MPI_LIBDIR="$MPI_DIR/lib") +AC_MSG_RESULT([$MPI_LIBDIR]) +AC_SUBST([MPI_LIBDIR]) + +AC_MSG_CHECKING([for mpi-inc-directory]) +AC_ARG_WITH(mpi_inc, + [ --with-mpi_inc=dir give the path for MPI-include-files [MPI_DIR/include]], + MPI_INC="$withval", MPI_INC="$MPI_DIR/include") +AC_MSG_RESULT([$MPI_INC]) +AC_SUBST([MPI_INC]) + + +AC_MSG_CHECKING([for MPI library]) +MPI_LIB="" +case "$host" in + *-ibm-aix*) dnl IBM/SP2 machines + dnl checking whether to use signal-based MPI + + AC_MSG_CHECKING([whether to use signal-based MPI library]) + AC_MSG_RESULT([$PACX_SIGNAL]) + if test "x$PACX_SIGNAL" = "xyes" ; then + if test -f "$MPI_LIBDIR/libmpi.a" ; then + MPI_LIB="-lmpi" + elif test -f "$MPI_LIBDIR/libmpi.so" ; then + MPI_LIB="-lmpi" + elif test -f "$MPI_LIBDIR/libmpich.a" ; then + MPI_LIB="-lmpich" + else + AC_MSG_ERROR([neither libmpi nor libmpich found; check path for MPI package first...]) + fi + else + if test -f "$MPI_LIBDIR/libmpi_r.a" ; then + MPI_LIB="-lmpi_r" + else + AC_MSG_ERROR([libmpi_r not found; check path for MPI package...]) + fi + fi + AC_MSG_RESULT(found $MPI_LIB) + ;; + *) dnl All other machines + if test -f "$MPI_LIBDIR/libmpi.a" ; then + MPI_LIB="-lmpi" + elif test -f "$MPI_LIBDIR/libmpi.so" ; then + MPI_LIB="-lmpi" + elif test -f "$MPI_LIBDIR/libmpich.a" ; then + MPI_LIB="-lmpich" + else + AC_MSG_ERROR([neither libmpi nor libmpich found; check path for MPI package first...]) + fi + AC_MSG_RESULT(found $MPI_LIB) + ;; esac -AC_SUBST([fortran_machine_defs]) -AC_SUBST([flibs_extra]) +AC_SUBST(MPI_LIB) -AC_ARG_WITH(mpi_f90_mods, -[ --with-mpi_f90_mods= specify the location of the MPI F90 - modules (default is - /usr/local/include/f90choice], - [mpi_f90_mods="${withval}"], - [mpi_f90_mods="/usr/local/include/f90choice"] ) -AC_SUBST(mpi_f90_mods) -if test -r $mpi_f90_mods/MPI.mod; then - AC_DEFINE(USE_MPI_F90_MODS, 1, [define whether we have the MPI f90 modules]) -else - AC_MSG_ERROR(--> Can't find MPI f90 modules!) - AC_CACHE_SAVE - exit 1 -fi +ACX_MPI -AC_ARG_WITH(sprng_include, -[ --with-sprng_include= specify the location of the sprng - headers (default is - /usr/local/include/sprng)], - [sprng_include="$withval"], - [sprng_include="/usr/local/include/sprng"] ) -AC_SUBST(sprng_include) -AC_CHECK_HEADERS([$sprng_include/sprng.h], - AC_DEFINE(USE_SPRNG, 1, [define whether we have the sprng libraries]), - AC_MSG_ERROR(sprng header files not found.)) - -AC_ARG_WITH(sprng_libdir, -[ --with-sprng_libdir= specify the location of the sprng - libraries (default is - /usr/local/lib)], - [sprng_libdir="$withval"], - [sprng_libdir="/usr/local/lib"] ) -AC_SUBST(sprng_libdir) -AC_CHECK_FILE([$sprng_libdir/libsprng.a],, - AC_MSG_ERROR(libsprng.a not found.)) +AM_PATH_SPRNG +CHECK_MKL +AC_CHECK_MPI_F90MOD -AC_ARG_WITH(mpich_include, -[ --with-mpich_include= specify the location of the mpich - headers (default is - /usr/local/include)], - [mpich_include="$withval"], - [mpich_include="/usr/local/include"] ) -AC_SUBST(mpich_include) -AC_CHECK_HEADERS([$mpich_include/mpi.h], - AC_DEFINE(HAVE_MPICH, 1, [define whether we have the mpich libraries]), - AC_MSG_ERROR(mpich header files not found.)) - -AC_ARG_WITH(mpich_libdir, -[ --with-mpich_libdir= specify the location of the mpich - libraries (default is /usr/local/lib)], - [mpich_libdir="$withval"], - [mpich_libdir="/usr/local/lib"] ) -AC_SUBST(mpich_libdir) -AC_CHECK_FILE([$mpich_libdir/libmpich.a],, - AC_MSG_ERROR(libmpi.a not found.)) +AC_EXEEXT +AC_OBJEXT +OBJEXT=".$OBJEXT" +OOPSE=oopse -AC_PROG_INSTALL +dnl **** define home dir of oopse +if test "x${prefix}" = "xNONE" +then + OOPSE_HOME=${ac_default_prefix}/oopse +else + OOPSE_HOME=${prefix}/oopse +fi +AC_ARG_ENABLE(oopse-home, +[ --enable-oopse-home=DIR define oopse home dir [PREFIX/oopse]], +[OOPSE_HOME="${enableval}"]) + case "x$INSTALL" in x/*) ;; *) INSTALL=`pwd`/ac-tools/"shtool install -c" ; @@ -244,7 +162,52 @@ SUBDIRS="libBASS libmdtools src forceFields" MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f" dnl **** Final list of subdirs -SUBDIRS="libBASS libmdtools src forceFields" +SUBDIRS="libBASS libmdtools src forceFields samples utils utils/sysbuilder staticProps" -dnl **** Create Make.conf -AC_OUTPUT(Make.conf:ac-tools/Make.conf.in) +dnl **** Define CFLAGS etc empty to prevent configure from setting them +CFLAGS=${CFLAGS-""} +CXXFLAGS=${CXXFLAGS-""} +CPPFLAGS=${CPPFLAGS-""} +FFLAGS=${FFLAGS-""} +F90FLAGS=${F90FLAGS-""} +LDFLAGS=${LDFLAGS-""} +DEBUG=${DEBUG-"-g"} + +case $debug in + 1) + CFLAGS="$DEBUG $CFLAGS" + CXXFLAGS="$DEBUG $CXXFLAGS" + FFLAGS="$DEBUG $FFLAGS" + F90FLAGS="$DEBUG $F90FLAGS" + ;; + *) + ;; +esac + + +AC_SUBST(EXEEXT) +AC_SUBST(OBJEXT) +AC_SUBST(BATEXT) +AC_SUBST(MKINSTALLDIRS) +AC_SUBST(OOPSE) +AC_SUBST(OOPSE_HOME) +AC_SUBST(SUBDIRS) +AC_SUBST(CFLAGS) +AC_SUBST(CXXFLAGS) +AC_SUBST(CPPFLAGS) +AC_SUBST(FFLAGS) +AC_SUBST(F90FLAGS) +AC_SUBST(LDFLAGS) +AC_SUBST(PREPFLAG) +AC_SUBST(PREPDEFFLAG) +AC_CONFIG_HEADER([libmdtools/config.h]) +AC_CONFIG_FILES([Makefile + libBASS/Makefile libmdtools/Makefile src/Makefile utils/Makefile + utils/sysbuilder/Makefile forceFields/Makefile samples/Makefile + staticProps/Makefile + samples/alkane/Makefile samples/argon/Makefile + samples/beadLipid/Makefile samples/lipid/Makefile + samples/metals/Makefile samples/water/Makefile +]) + +AC_OUTPUT