--- trunk/OOPSE/ac-tools/aclocal.m4 2004/01/13 23:01:43 941 +++ trunk/OOPSE/ac-tools/aclocal.m4 2004/01/14 15:49:26 942 @@ -297,61 +297,9 @@ dnl AC_MSG_RESULT(no) ]) ]) -dnl - - -dnl -dnl CHECK_MPIFH dnl -AC_DEFUN([CHECK_MPIFH], -AC_MSG_CHECKING(for mpif.h include file) - for dir in $withval $MPI_INC $MPI_DIR/include; do - mpifdir="$dir" - if test -f "$dir/mpif.h"; then - found_mpif="yes"; - break; - fi - done - if test x_$found_mpif != x_yes; then - AC_MSG_ERROR(Cannot find mpif.h file) - else - printf "mpif.h found in $mpifdir\n"; - fi - AC_LANG_SAVE() - AC_LANG([Fortran 90]) - ac_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="${CPPFLAGS} -I${mkldir}/include" - ac_save_LDFLAGS=$LDFLAGS - LDFLAGS="${LDFLAGS} -L${mkldir}/lib/32 -lmkl -lvml -lguide" - AC_CHECK_HEADER(mkl.h, [ - AC_CHECK_LIB(mkl, - vslNewStream, - [MKL_LIBDIR="${mkldir}/lib/32", - MKL_LIB="-lmkl -lvml -lguide", - HAVE_MKL="yes"]) - ], [MKL_INC="-I${mkldir}/include"]) - CPPFLAGS=$ac_save_CPPFLAGS - LDFLAGS=$ac_save_LDFLAGS - AC_LANG_RESTORE() - - if test x_$HAVE_MKL != x_yes; then - AC_MSG_ERROR(Can't build with MKL) - fi - AC_SUBST(MKL_LIBDIR) - AC_SUBST(MKL_LIB) - AC_SUBST(MKL_INC) - AC_SUBST(HAVE_MKL) -], -[ - AC_MSG_RESULT(no) -]) -dnl - - - - AC_DEFUN(ACX_CHECK_CC_FLAGS, [ AC_REQUIRE([AC_PROG_CC]) @@ -432,7 +380,7 @@ cat > conftest.c < conftest.c < $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2) yes; # endif @@ -453,12 +401,98 @@ fi fi ]) +AC_DEFUN(ACX_PROG_GXX_VERSION, +[ +AC_REQUIRE([AC_PROG_CXX]) +AC_CACHE_CHECK(whether we are using g++ $1.$2 or later, ac_cv_prog_gxx_$1_$2, +[ +dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp. +cat > conftest.cpp < $1) || (__GNUC__ == $1 && __GNUC_MINOR__ >= $2) + yes; +# endif +#endif +EOF +if AC_TRY_COMMAND(${CXX-c++} -E conftest.cpp) | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx_$1_$2=yes +else + ac_cv_prog_gxx_$1_$2=no +fi +]) +if test "$ac_cv_prog_gxx_$1_$2" = yes; then + : + $3 +else + : + $4 +fi +]) +AC_DEFUN(ACX_PROG_REALLY_GCC, +[ +AC_REQUIRE([AC_PROG_CC]) +AC_CACHE_CHECK(whether we are *really* using gcc, ac_cv_prog_really_gcc, +[ +dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp. +cat > conftest.c </dev/null 2>&1; then + ac_cv_prog_really_gcc=yes +else + ac_cv_prog_really_gcc=no +fi +]) +if test "$ac_cv_prog_really_gcc" = yes; then + : + $1 +else + : + $2 +fi +]) + +AC_DEFUN(ACX_PROG_REALLY_GXX, +[ +AC_REQUIRE([AC_PROG_CXX]) +AC_CACHE_CHECK(whether we are *really* using g++, ac_cv_prog_really_gxx, +[ +dnl The semicolon after "yes" below is to pacify NeXT's syntax-checking cpp. +cat > conftest.cpp </dev/null 2>&1; then + ac_cv_prog_really_gxx=yes +else + ac_cv_prog_really_gxx=no +fi +]) +if test "$ac_cv_prog_really_gxx" = yes; then + : + $1 +else + : + $2 +fi +]) + + AC_DEFUN(ACX_PROG_CC_MAXOPT, [ AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_CANONICAL_HOST]) +ACX_PROG_REALLY_GCC + # Try to determine "good" native compiler flags if none specified on command # line if test "$ac_test_CFLAGS" != "set"; then @@ -512,12 +546,12 @@ if test "$ac_test_CFLAGS" != "set"; then esac # use default flags for gcc on all systems - if test $ac_cv_prog_gcc = yes; then + if test $ac_cv_prog_really_gcc = yes; then CFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic" fi # test for gcc-specific flags: - if test $ac_cv_prog_gcc = yes; then + if test $ac_cv_prog_really_gcc = yes; then # -malign-double for x86 systems ACX_CHECK_CC_FLAGS(-malign-double,align_double, CFLAGS="$CFLAGS -malign-double") # -fstrict-aliasing for gcc-2.95+ @@ -525,7 +559,7 @@ if test "$ac_test_CFLAGS" != "set"; then fi CPU_FLAGS="" - if test "$GCC" = "yes"; then + if test $ac_cv_prog_really_gcc = yes; then dnl try to guess correct CPU flags, at least for linux case "${host_cpu}" in i586*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium, @@ -594,6 +628,8 @@ AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_PROG_CXX]) AC_REQUIRE([AC_CANONICAL_HOST]) +ACX_PROG_REALLY_GXX + # Try to determine "good" native compiler flags if none specified on command # line if test "$ac_test_CXXFLAGS" != "set"; then @@ -638,12 +674,12 @@ if test "$ac_test_CXXFLAGS" != "set"; then esac # use default flags for gcc on all systems - if test $ac_cv_prog_gcc = yes; then + if test $ac_cv_prog_really_gxx = yes; then CXXFLAGS="-O6 -fomit-frame-pointer -Wall -W -Wcast-qual -Wpointer-arith -Wcast-align -pedantic" fi # test for gcc-specific flags: - if test $ac_cv_prog_gcc = yes; then + if test $ac_cv_prog_really_gxx = yes; then # -malign-double for x86 systems ACX_CHECK_CXX_FLAGS(-malign-double,align_double, CXXFLAGS="$CXXFLAGS -malign-double") # -fstrict-aliasing for gcc-2.95+ @@ -651,10 +687,10 @@ if test "$ac_test_CXXFLAGS" != "set"; then fi CPU_FLAGS="" - if test "$GCC" = "yes"; then + if test $ac_cv_prog_really_gxx = yes; then dnl try to guess correct CPU flags, at least for linux case "${host_cpu}" in - i586*) ACX_CHECK_CC_FLAGS(-mcpu=pentium,cpu_pentium, + i586*) ACX_CHECK_CXX_FLAGS(-mcpu=pentium,cpu_pentium, [CPU_FLAGS=-mcpu=pentium], [ACX_CHECK_CXX_FLAGS(-mpentium,pentium, [CPU_FLAGS=-mpentium])]) @@ -671,7 +707,7 @@ if test "$ac_test_CXXFLAGS" != "set"; then ACX_CHECK_CXX_FLAGS(-mcpu=$cputype,m_cpu_60x, CPU_FLAGS=-mcpu=$cputype) elif test "$cputype" = 750; then - ACX_PROG_GCC_VERSION(2,95, + ACX_PROG_GXX_VERSION(2,95, ACX_CHECK_CXX_FLAGS(-mcpu=750,m_cpu_750, CPU_FLAGS=-mcpu=750)) fi @@ -727,7 +763,7 @@ if test x"$F90FLAGS" = x ; then F90FLAGS="" case "${host_cpu}-${host_os}" in - *linux*) if test "$F90" = ifc; then + *linux*) if test "$F90" = ifc -o "$F90" = ifort; then F90FLAGS="-O" fi;; rs6000*-aix*) if test "$F90" = xlf90 -o "$F90" = f90; then @@ -802,7 +838,7 @@ if test "$ac_test_PREPFLAG" != "set"; then PREPFLAG="" case "${host_cpu}-${host_os}" in - *linux*) if test "$F90" = ifc; then + *linux*) if test "$F90" = ifc -o "$F90" = ifort; then PREPFLAG="-fpp1 " fi;; *aix*) if test "$F90" = xlf90 -o "$F90" = f90; then @@ -820,7 +856,7 @@ if test "$ac_test_PREPFLAG" != "set"; then fi AC_MSG_CHECKING(to make sure F90 preprocessor flag works) - AC_LANG_SAVE( + AC_LANG_SAVE() AC_LANG([Fortran 90]) ac_save_ext=$ac_ext ac_ext=F90 @@ -837,7 +873,6 @@ if test "$ac_test_PREPFLAG" != "set"; then ac_ext=$ac_save_ext AC_LANG_RESTORE() - if test "$prepflagworks" = 1; then AC_MSG_RESULT(yes) AC_SUBST(PREPFLAG) @@ -861,7 +896,7 @@ if test "$ac_test_PREPDEFFLAG" != "set"; then PREPDEFFLAG="" case "${host_cpu}-${host_os}" in - *linux*) if test "$F90" = ifc; then + *linux*) if test "$F90" = ifc -o "$F90" = ifort; then PREPDEFFLAG=" " fi;; *aix*) if test "$F90" = xlf90 -o "$F90" = f90; then