diff --git a/configure.ac b/configure.ac index 5906efc535467beca85a742935836dbdc1830bd5..112003b2ddede4e822b375bf2640510fc0550a6f 100644 --- a/configure.ac +++ b/configure.ac @@ -21,10 +21,26 @@ AC_PREREQ(2.61) m4_pattern_allow([AS_TR_SH]) AC_INIT(PPM, 1.0.2) -#AC_CONFIG_SRCDIR([src/ppm.h]) -# Check architecture -AC_CHECK_SIZEOF([long double]) +# Remove existing preprocessing flags +touch ./src/ppm_define.h +rm ./src/ppm_define.h + +# if MPI is enabled try grabbing those compiler wrappers first +use_mpi=no +AC_ARG_ENABLE([mpi], + [AS_HELP_STRING([--enable-mpi[[=impl.]]], + [use MPI (default is no), If the MPI implementation of your choice provides + compile wrappers that are in PATH, I can set them myself, + choose: guess (I will choose the first implementation I can find), openmpi, + lammpi, mpich, mpich2, intelmpi_gnu (Intel's MPI with GNU + Compilers), intelmpi_intel (Intel's MPI with Intel Compilers), sun (Sun MPI), ibm + (IBM AIX POE). Else, set this flag with no value and set CC, CXX and FC to + the appropriate compiler wrappers (safest)])], + [PPM_CHECK_MPI([$enableval]) + # compilers should be chosen + use_mpi=yes], + [AC_MSG_NOTICE([MPI was not enabled. Building non-parallel version of PPM.])]) # Checks for basic compiler and flags AC_PROG_CXX @@ -34,15 +50,22 @@ AC_PROG_RANLIB AC_PROG_FC AC_FC_FREEFORM AC_FC_LIBRARY_LDFLAGS +# Check architecture +AC_CHECK_SIZEOF([long double]) + +if test "x${use_mpi}" == xyes; then + AC_LANG([Fortran]) + AC_CHECK_LIB([mpi],[MPI_Init],[ + echo "#define __MPI" >> ./src/ppm_define.h], + [AC_MSG_ERROR([Cannot build PPM with MPI support like this])]) + AC_LANG([C]) +fi # for now let's use the C compiler to check the vendor we're using here # this of course means that we HAVE to set all compiler flags to compilers of # the same vendor (which is anyway a good idea) AX_COMPILER_VENDOR -# Remove existing preprocessing flags -touch ./src/ppm_define.h -rm ./src/ppm_define.h # Checks for libraries and set preprocessing flags @@ -66,51 +89,7 @@ AX_F90_LIBRARY_SETUP(ppm,[],ppm_module_finalize.$ax_cv_f90_modext,libppm*,[ call ppm_finalize(info) ]) -#have_ppm=no -#AC_SEARCH_LIBS([ppm_module_finalize_mp_ppm_finalize],[ppm],[have_ppm=yes]) -#if test "x${have_ppm}" = xno; then -# echo "------------------------------------------" -# echo " The PPM library is required to build numerics. " -# echo " Either the library is missing or incorrectly compiled/linked." -# echo "------------------------------------------" -# (exit 1); exit 1; -#fi - -#AC_CHECK_LIB([metis],[METIS_PartGraphRecursive]) -#have_metis=no -#AC_SEARCH_LIBS([METIS_PartGraphRecursive],[metis],[have_metis=yes]) -#if test "x${have_metis}" = xno; then -# echo "------------------------------------------" -# echo " The METIS library is required to build PPM. " -# echo " Either the library is missing or incorrectly compiled/linked." -# echo " Stopping... Please download at:" -# echo " http://glaros.dtc.umn.edu/gkhome/metis/metis/download" -# echo "------------------------------------------" -# (exit 1); exit 1; -#else -# echo "#define __METIS" >> ./src/ppm_define.h -#fi -use_mpi=no -AC_ARG_ENABLE([mpi],,[use_mpi=yes]) -if test "x${use_mpi}" = xyes; then - AC_CHECK_PROG([FC],[mpif90],[mpif90]) - AC_CHECK_LIB([mpi],[MPI_Init]) - have_mpi=no - AC_SEARCH_LIBS([MPI_Init],[mpi],[have_mpi=yes]) - if test "x${have_mpi}" = xno; then - echo "------------------------------------------" - echo " The MPI library was not found." - echo " Creating Makefile without parallel support." - echo " Please download at:" - echo " http://www.open-mpi.org/software/ " - echo "------------------------------------------" - else - echo "#define __MPI" >> ./src/ppm_define.h - fi -else - echo "MPI was not enabled. Building non-parallel version of PPM." -fi # Check to see if fftw3 was enabled with -enable-fftw3 #use_fftw3=no @@ -133,61 +112,42 @@ fi #fi # Check to see if linux was enabled with -enable-linux -use_linux=no -AC_ARG_ENABLE([linux],,[use_linux=yes]) -if test "x${use_linux}" = xyes; then - echo "#define __Linux" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([linux],[AS_HELP_STRING([--enable-linux], + [compile for linux (default is no)])],[echo "#define __Linux" >> ./src/ppm_define.h]) # Check to see if etime was enabled with -enable-etime -use_etime=no -AC_ARG_ENABLE([etime],,[use_etime=yes]) -if test "x${use_etime}" = xyes; then - echo "#define __ETIME" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([etime],[AS_HELP_STRING([--enable-etime], + [use etime (default is no)])],[echo "#define __ETIME" >> ./src/ppm_define.h]) # Check to see if vector was enabled with -enable-vector -use_vector=no -AC_ARG_ENABLE([vector],,[use_vector=yes]) -if test "x${use_vector}" = xyes; then - echo "#define __VECTOR" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([vector],[AS_HELP_STRING([--enable-vector], + [enable __VECTOR (default is no)])], + [echo "#define __VECTOR" >> ./src/ppm_define.h]) -use_mathkeisan=no -AC_ARG_ENABLE([mathkeisan],,[use_mathkeisan=yes]) -if test "x${use_mathkeisan}" = xyes; then - echo "#define __MATHKEISAN" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([mathkeisan],[AS_HELP_STRING([--enable-mathkeisan], + [enable __MATHKEISAN (default is no)])], + [echo "#define __MATHKEISAN" >> ./src/ppm_define.h]) -use_sxf90=no -AC_ARG_ENABLE([sxf90],,[use_sxf90=yes]) -if test "x${use_sxf90}" = xyes; then - echo "#define __SXF90" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([sxf90],[AS_HELP_STRING([--enable-sxf90], + [enable __MATHKEISAN (default is no)])], + [echo "#define __SXF90" >> ./src/ppm_define.h]) -use_crayfishpack=no -AC_ARG_ENABLE([crayfishpack],,[use_crayfishpack=yes]) -if test "x${use_crayfishpack}" = xyes; then - echo "#define __CRAYFISHPACK" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([crayfishpack],[AS_HELP_STRING([--enable-crayfishpack], + [enable __CRAYFISHPACK (default is no)])], + [echo "#define __CRAYFISHPACK" >> ./src/ppm_define.h]) -use_hypre=no -AC_ARG_ENABLE([hypre],,[use_hypre=yes]) -if test "x${use_hypre}" = xyes; then - echo "#define __HYPRE" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([hypre],[AS_HELP_STRING([--enable-hypre], + [enable __HYPRE (default is no)])], + [echo "#define __HYPRE" >> ./src/ppm_define.h]) -use_nomicroinstructions=no -AC_ARG_ENABLE([nomicroinstructions],,[use_nomicroinstructions=yes]) -if test "x${use_nomicroinstructions}" = xyes; then - echo "#define __NOMICROINSTRUCTIONS" >> ./src/ppm_define.h -fi +AC_ARG_ENABLE([no-microinstr],[AS_HELP_STRING([--enable-no-microinstr], + [enable __NOMICROINSTRUCTIONS (default is no)])], + [echo "#define __NOMICROINSTRUCTIONS" >> ./src/ppm_define.h]) + +AC_ARG_ENABLE([debug],[AS_HELP_STRING([--enable-debug], + [enable debug mode (default is no)])], + [AC_SUBST(DEBUG,-O0)]) -use_debug=no -AC_ARG_ENABLE([debug],,[use_debug=yes]) -if test "x${use_debug}" = xyes; then - AC_SUBST(DEBUG,-O0) -fi # Switch language back to C for checking libraries AC_LANG([C])