--- trunk/OOPSE/ac-tools/configure.in 2003/09/05 21:28:52 747 +++ trunk/OOPSE/ac-tools/configure.in 2004/01/14 22:41:34 944 @@ -6,37 +6,110 @@ builtin(include, ac-tools/aclocal.m4) builtin(include, ac-tools/fortran90.m4) builtin(include, ac-tools/aclocal.m4) - AC_CONFIG_SRCDIR([src/oopse.cpp]) AC_PREFIX_DEFAULT("/usr/local") -# what should I build? - -AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Compile OOPSE in debug mode]), [DEBUG=1]) - # set program name PROGNAME="oopse" AC_SUBST(PROGNAME) +# there are two ways to do debugging. One with the --enable-debug flag +# and one using the DEBUG environment variable + +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]) + AC_DEFINE(debug, 1, [Code compiled in debug mode]) msg="$msg, debug mode" fi -AC_SUBST(DEBUG) +AC_SUBST(debug) # who am i AC_CANONICAL_HOST -dnl Checks for programs. +dnl Checks for C compiler AC_PROG_CC([icc xlc gcc cc]) -ACX_PROG_CC_MAXOPT -AC_PROG_CXX([icpc icc xlC g++ c++]) -ACX_PROG_CXX_MAXOPT -AC_PROG_F90([ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) -ACX_PROG_F90_MAXOPT + +dnl Checks for C++ compiler +AC_PROG_CXX([icpc icc xlC CC g++ c++]) + +dnl If we are not running g++ then we might need some other flags +dnl to get the templates compiled correctly +OOPSE_TEMPLATE_FLAGS="" +if test $ac_cv_prog_gxx = no; then + AC_MSG_CHECKING([checking whether ${CXX} accepts -ptused -no_prelink]) + echo 'void f(){}' > conftest.cc + if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then + AC_MSG_RESULT(yes) + OOPSE_TEMPLATE_FLAGS="-ptused -no_prelink" + else + AC_MSG_RESULT(no) + fi + rm -f conftest* + AC_MSG_CHECKING([checking whether ${CXX} accepts -instances=static]) + echo 'void f(){}' > conftest.cc + if test -z "`${CXX} -instances=static -c conftest.cc 2>&1`"; then + AC_MSG_RESULT(yes) + OOPSE_TEMPLATE_FLAGS="-instances=static" + else + AC_MSG_RESULT(no) + fi + rm -f conftest* + AC_MSG_CHECKING([checking whether ${CXX} accepts -pto]) + echo 'void f(){}' > conftest.cc + if test -z "`${CXX} -pto -c conftest.cc 2>&1`"; then + AC_MSG_RESULT(yes) + OOPSE_TEMPLATE_FLAGS="-pto" + else + AC_MSG_RESULT(no) + fi + rm -f conftest* + AC_MSG_CHECKING([checking whether ${CXX} accepts -LANG:std]) + echo 'void f(){}' > conftest.cc + if test -z "`${CXX} -LANG:std -c conftest.cc 2>&1`"; then + AC_MSG_RESULT(yes) + + + EXTRA_CC_FLAG=${EXTRA_CC_FLAG}" -LANG:std" + else + AC_MSG_RESULT(no) + fi +fi +AC_SUBST(OOPSE_TEMPLATE_FLAGS) +AC_SUBST(EXTRA_CC_FLAG) + +dnl Fortran 90 compilation checks are next + +AC_PROG_F90([ifort ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) +dnl Check the flag for Fortran90 preprocessing ACX_PROG_F90_PREPFLAG +dnl Check to see if a flag is required for preprocessing defines ACX_PROG_F90_PREPDEFFLAG +AC_LANG_PUSH(Fortran 90) +AC_LANG_PREPROC(Fortran 90) +AC_F90_LIBRARY_LDFLAGS +dnl How does Fortran mangle function names +AC_F90_WRAPPERS +AC_SUBST(F90_FUNC) +AC_SUBST(F90_FUNC_) +dnl Fortran 90 module suffix +AC_CHECK_MODSUFFIX +dnl Fortran 90 module path specifier +AC_CHECK_MODDIRFLAG + +dnl check for strong optimization options + +case $debug in + 1) + ;; + *) + ACX_PROG_CC_MAXOPT + ACX_PROG_CXX_MAXOPT + ACX_PROG_F90_MAXOPT + ;; +esac + AC_PROG_INSTALL AC_PROG_LN_S AC_PROG_MAKE_SET @@ -50,89 +123,104 @@ AC_LANG_PUSH(Fortran 90) exit 1 fi -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_) - AC_MSG_CHECKING([for mpi-directory]) -AC_ARG_WITH(MPI_DIR, - [ --with-mpi-dir=MPIDIR give the path for MPI [/usr/local]], +AC_ARG_WITH(mpi, + [ --with-mpi=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_SUBST([mpi]) AC_MSG_CHECKING([for mpi-lib-directory]) -AC_ARG_WITH(MPI_LIBDIR, - [ --with-mpi-lib-dir=dir give the path for MPI-libraries [MPI_DIR/lib]], +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=dir give the path for MPI-include-files [MPI_DIR/include]], +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.h]) +HAVE_MPIDOTH_C="no" +echo '#include ' > conftest.cc +if test -z "`${CXX} -I${MPI_INC} -c conftest.cc 2>&1`"; then + AC_MSG_RESULT(yes) + HAVE_MPIDOTH_C="yes" +else + AC_MSG_RESULT(no! Check MPI include paths) +fi +rm -f conftest* -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 mpif.h is usable]) +HAVE_MPIFDOTH_F90="no" +rm -f conftest* +cat >conftest.f90 < conftest.out 2>&1 ; then + AC_MSG_RESULT(yes) + MPI_F90INC="$MPI_INC" + HAVE_MPIFDOTH_F90="yes" +else + if test -s conftest.out ; then cat conftest.out >> config.log ; fi + AC_MSG_RESULT([no! Check MPI include paths]) +fi +rm -f conftest* +AC_SUBST([MPI_F90INC]) - 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_LANG_PUSH(C) +ac_save_LDFLAGS=$LDFLAGS +LDFLAGS="${LDFLAGS} -L${MPI_LIBDIR} " + +if test x = x"$MPI_LIB"; then + AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi"]) +fi +if test x = x"$MPI_LIB"; then + AC_CHECK_LIB(mpich, MPI_Init, [MPI_LIB="-lmpich"]) +fi +$as_unset ac_cv_lib_mpi_MPI_Init +if test x = x"$MPI_LIB"; then + AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam"], [], + "-llam") +fi + +$as_unset ac_cv_lib_mpi_MPI_Init +if test x = x"$MPI_LIB"; then + AC_CHECK_LIB(mpi, MPI_Init, [MPI_LIB="-lmpi -llam -lpthread"], + [AC_MSG_ERROR([Didn't find liblam, libmpi, or libmpich; check path for MPI package first...])], + [-llam -lpthread]) +fi + +AC_MSG_RESULT(found $MPI_LIB) AC_SUBST(MPI_LIB) -ACX_MPI +AC_MSG_CHECKING([for MPI Fortran library]) +MPI_F90LIB="" +if test -f "$MPI_LIBDIR/libfmpich.a" ; then + MPI_F90LIB="-lfmpich" +elif test -f "$MPI_LIBDIR/liblamf77mpi.a" ; then + MPI_F90LIB="-llamf77mpi" +else + # nothing special found, we'll assume that the C library is all we need + MPI_F90LIB=" " +fi +AC_MSG_RESULT([found $MPI_F90LIB]) +AC_SUBST(MPI_F90LIB) +dnl CHECK_MPI + +dnl I don't think this works right now: +dnl ACX_MPI + AM_PATH_SPRNG CHECK_MKL -AC_CHECK_MPI_F90MOD -case $F90 in - ifc) fortran_machine_defs='Linux_ifc_machdep$(O)' ;; - *) fortran_machine_defs='' ;; -esac -AC_SUBST([fortran_machine_defs]) AC_EXEEXT AC_OBJEXT @@ -159,29 +247,23 @@ SUBDIRS="libBASS libmdtools src forceFields samples ut MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f" dnl **** Final list of subdirs -SUBDIRS="libBASS libmdtools src forceFields samples utils utils/sysbuilder" +SUBDIRS="libBASS libmdtools src forceFields samples utils utils/sysbuilder staticProps third-party" dnl **** Define CFLAGS etc empty to prevent configure from setting them -#CFLAGS=${CFLAGS-""} -#CXXFLAGS=${CXXFLAGS-""} -#CPPFLAGS=${CPPFLAGS-""} -#FFLAGS=${FFLAGS-""} -#LDFLAGS=${LDFLAGS-""} -#OPTIMIZE=${OPTIMIZE-"-O"} -#DEBUG=${DEBUG-"-g"} +CFLAGS=${CFLAGS-""} +CXXFLAGS=${CXXFLAGS-""} +CPPFLAGS=${CPPFLAGS-""} +FFLAGS=${FFLAGS-""} +F90FLAGS=${F90FLAGS-""} +LDFLAGS=${LDFLAGS-""} +DEBUG=${DEBUG-"-g"} case $debug in - true) - CFLAGS="$DEBUG $CFLAGS" - CXXFLAGS="$DEBUG $CXXFLAGS" + 1) FFLAGS="$DEBUG $FFLAGS" F90FLAGS="$DEBUG $F90FLAGS" ;; *) - CFLAGS="$OPTIMIZE $CFLAGS" - CXXFLAGS="$OPTIMIZE $CXXFLAGS" - FFLAGS="$OPTIMIZE $FFLAGS" - F90FLAGS="$OPTIMIZE $F90FLAGS" ;; esac @@ -205,6 +287,8 @@ AC_CONFIG_FILES([Makefile AC_CONFIG_FILES([Makefile libBASS/Makefile libmdtools/Makefile src/Makefile utils/Makefile utils/sysbuilder/Makefile forceFields/Makefile samples/Makefile + staticProps/Makefile + third-party/Makefile samples/alkane/Makefile samples/argon/Makefile samples/beadLipid/Makefile samples/lipid/Makefile samples/metals/Makefile samples/water/Makefile