--- trunk/OOPSE/ac-tools/configure.in 2003/08/11 22:25:28 679 +++ trunk/OOPSE/ac-tools/configure.in 2004/01/14 22:41:34 944 @@ -1,165 +1,121 @@ 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_PREFIX_DEFAULT("/usr/local") - +builtin(include, ac-tools/fortran90.m4) builtin(include, ac-tools/aclocal.m4) -AC_PROG_RANLIB -AC_PROG_LN_S -AC_PROG_YACC -AC_PROG_LEX +AC_CONFIG_SRCDIR([src/oopse.cpp]) -AC_SUBST(EXEEXT) -AC_SUBST(OBJEXT) -AC_SUBST(BATEXT) +AC_PREFIX_DEFAULT("/usr/local") -AC_SUBST(MKINSTALLDIRS) +# set program name +PROGNAME="oopse" +AC_SUBST(PROGNAME) -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) +# there are two ways to do debugging. One with the --enable-debug flag +# and one using the DEBUG environment variable -OOPSE=oopse - -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 C compiler +AC_PROG_CC([icc xlc gcc cc]) -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 Checks for C++ compiler +AC_PROG_CXX([icpc icc xlC CC g++ c++]) - dnl **** check for strength-reduce bug - ACX_GCC_STRENGTH_REDUCE(CFLAGS="$CFLAGS -fno-strength-reduce") +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) + - 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" + EXTRA_CC_FLAG=${EXTRA_CC_FLAG}" -LANG:std" 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 + AC_MSG_RESULT(no) fi fi +AC_SUBST(OOPSE_TEMPLATE_FLAGS) +AC_SUBST(EXTRA_CC_FLAG) -case $debug in - true) CFLAGS="$DEBUG $CFLAGS";; - *) CFLAGS="$OPTIMIZE $CFLAGS";; -esac +dnl Fortran 90 compilation checks are next -dnl **** .exe/.obj file extensions -AC_EXEEXT -AC_OBJEXT +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 -OBJEXT=".$OBJEXT" +dnl check for strong optimization options -AC_PROG_MAKE_SET +case $debug in + 1) + ;; + *) + ACX_PROG_CC_MAXOPT + ACX_PROG_CXX_MAXOPT + ACX_PROG_F90_MAXOPT + ;; +esac -dnl **** Checks for programs. +AC_PROG_INSTALL +AC_PROG_LN_S +AC_PROG_MAKE_SET +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'!) @@ -167,73 +123,122 @@ AC_F77_LIBRARY_LDFLAGS exit 1 fi -AC_F77_LIBRARY_LDFLAGS +AC_MSG_CHECKING([for mpi-directory]) +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]) -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]) ;; -esac -AC_SUBST([fortran_machine_defs]) -AC_SUBST([flibs_extra]) +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_ARG_WITH(mpi_f90_mods, -[ --with-mpi_f90_mods=