--- trunk/OOPSE/ac-tools/aclocal.m4 2003/10/27 22:08:36 825 +++ trunk/OOPSE/ac-tools/aclocal.m4 2003/10/27 23:00:59 826 @@ -1,3 +1,116 @@ +dnl +dnl AC_CHECK_MODSUFFIX +dnl +AC_DEFUN([AC_CHECK_MODSUFFIX],[ + +AC_MSG_CHECKING(for module suffix) +rm -f conftest* +# Intel ifc compiler generates files by the name of work.pc and work.pcl (!) +rm -f work* +cat >conftest.f < conftest.out 2>&1 ; then + MOD=`ls conftest* | grep -v conftest.f | grep -v conftest.o` + MOD=`echo "$MOD" | sed -e 's/conftest\.//g'` + if test -z "$MOD" ; then + MOD=`ls CONFTEST* 2>/dev/null \ + | grep -v CONFTEST.f | grep -v CONFTEST.o` + MOD=`echo "$MOD" | sed -e 's/CONFTEST\.//g'` + if test -n "$MOD" ; then + testname="CONFTEST" + modcase="upper" + fi + fi + if test -z "$MOD" ; then + AC_MSG_RESULT(unknown) + # Use mod if we can't figure it out + MOD="mod" + else + AC_MSG_RESULT($MOD) + fi + if test -s work.pcl ; then + AC_MSG_WARN([Compiler generates auxillery files!]) + fi +else + AC_MSG_RESULT(unknown) +fi +AC_SUBST(MOD) + +]) + + +dnl +dnl AC_CHECK_MODDIRFLAG +dnl +AC_DEFUN([AC_CHECK_MODDIRFLAG],[ + +# Check for module include path (some use -I, some (Solaris) use -M, some +# (absoft) use -p). +# Intel compilers use a wierd system: -cl,filename.pcl . If no file is +# specified, work.pcl and work.pc are created. However, if you specify +# a file, it must contain a the name of a file ending in .pc . Ugh! +# Use the module made above +AC_MSG_CHECKING(for module directory path flag) +madedir=0 +if test ! -d conf ; then mkdir conf ; madedir=1; fi +cp $testname.$MOD conf +rm -f conftest* CONFTEST* +cat >conftest1.f < conftest.out 2>&1 ; then + MODDIRFLAG="-I" + F90MODINCSPEC="-I" + AC_MSG_RESULT(-I) +elif $F90 -c -Mconf conftest1.f >> conftest.out 2>&1 ; then + MODDIRFLAG="-M" + F90MODINCSPEC="-M" + AC_MSG_RESULT(-M) +elif $F90 -c -pconf conftest1.f >> conftest.out 2>&1 ; then + MODDIRFLAG="-p" + F90MODINCSPEC="-p" + AC_MSG_RESULT(-p) +elif test -s work.pc ; then + cp work.pc conf/mpimod.pc + echo "mpimod.pc" > conf/mpimod.pcl + echo "`pwd`/conf/mpimod.pc" >> conf/mpimod.pcl + if $F90 -c -cl,conf/mpimod.pcl conftest1.f >>conftest.out 2>&1 ; then + MODDIRFLAG='-cl,mpimod.pcl' + AC_MSG_RESULT([-cl,filename where filename contains a list of files and + directories]) + F90_WORK_FILES_ARG="-cl,mpimod.pcl" + F90MODINCSPEC="-cl,/mod.pcl" + AC_SUBST(F90_WORK_FILES_ARG) + else + # The version of the Intel compiler that I have refuses to let + # you put the "work catalog" list anywhere but the current directory. + # For example, you cannot in + : + fi +fi +if test -z "MODDIRFLAG" ; then + AC_MSG_RESULT(unknown) +fi +AC_SUBST(MODDIRFLAG) +AC_SUBST(F90MODINCSPEC) +rm -f conftest* conf/conftest* conf/CONFTEST* CONFTEST* conf/mpimod* +if test $madedir = 1 ; then rmdir conf ; fi + +]) + + dnl dnl AC_CHECK_MPI_F90MOD dnl @@ -12,7 +125,8 @@ AC_DEFUN([AC_CHECK_MPI_F90MOD],[ AC_LANG_SAVE() AC_LANG([Fortran 90]) ac_save_F90FLAGS=$F90FLAGS - AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} -I${mpi_f90_mods}"]) + + AS_IF([test "$mpi_f90_mods"], [F90FLAGS="${F90FLAGS} ${MODDIRFLAG}${mpi_f90_mods}"]) _AC_COMPILE_IFELSE([ AC_LANG_PROGRAM([ use mpi @@ -26,7 +140,7 @@ call MPI_Init(ierr) if test "$HAVE_MPI_MOD" = 1; then AC_MSG_RESULT(yes) AC_DEFINE(MPI_MOD, 1, [have mpi module]) - MPI_F90_MODS="-I${mpi_f90_mods}" + MPI_F90_MODS="${mpi_f90_mods}" AC_SUBST(MPI_F90_MODS) # The library name: if test -z "$MPI_LIB" ; then