| 1 | dnl **** Process this file with autoconf to produce a configure script. | 
| 2 |  | 
| 3 | AC_INIT(OOPSE, 2.0, gezelter@nd.edu, oopse) | 
| 4 | AC_CONFIG_AUX_DIR(ac-tools) | 
| 5 |  | 
| 6 | builtin(include, ac-tools/fortran90.m4) | 
| 7 | builtin(include, ac-tools/aclocal.m4) | 
| 8 |  | 
| 9 | AC_CONFIG_SRCDIR([src/applications/oopse/oopse.cpp]) | 
| 10 |  | 
| 11 | AC_PREFIX_DEFAULT("/usr/local") | 
| 12 |  | 
| 13 | # set program name | 
| 14 | PROGNAME="oopse" | 
| 15 | AC_SUBST(PROGNAME) | 
| 16 |  | 
| 17 | # there are two ways to do debugging.  One with the --enable-debug flag | 
| 18 | # and one using the DEBUG environment variable | 
| 19 |  | 
| 20 | debug=0 | 
| 21 | AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Compile OOPSE in debug mode]), [debug=1]) | 
| 22 | if test "${DEBUG}"; then | 
| 23 | AC_DEFINE(debug, 1, [Code compiled in debug mode]) | 
| 24 | msg="$msg, debug mode" | 
| 25 | fi | 
| 26 | AC_SUBST(debug) | 
| 27 |  | 
| 28 | # who am i | 
| 29 | AC_CANONICAL_HOST | 
| 30 |  | 
| 31 |  | 
| 32 |  | 
| 33 | dnl Checks for C compiler | 
| 34 | AC_PROG_CC([icc xlc gcc cc]) | 
| 35 |  | 
| 36 | dnl Checks for C++ compiler | 
| 37 | AC_PROG_CXX([icpc icc xlc++ xlC CC g++ c++]) | 
| 38 |  | 
| 39 | dnl If we are not running g++ then we might need some other flags | 
| 40 | dnl to get the templates compiled correctly | 
| 41 | OOPSE_TEMPLATE_FLAGS="" | 
| 42 | if test $ac_cv_prog_gxx = no; then | 
| 43 | AC_MSG_CHECKING([checking whether ${CXX} accepts -ptused -no_prelink]) | 
| 44 | echo 'void f(){}' > conftest.cc | 
| 45 | if test -z "`${CXX} -ptused -no_prelink -c conftest.cc 2>&1`"; then | 
| 46 | AC_MSG_RESULT(yes) | 
| 47 | OOPSE_TEMPLATE_FLAGS="-ptused -no_prelink" | 
| 48 | else | 
| 49 | AC_MSG_RESULT(no) | 
| 50 | fi | 
| 51 | rm -f conftest* | 
| 52 | AC_MSG_CHECKING([checking whether ${CXX} accepts -instances=static]) | 
| 53 | echo 'void f(){}' > conftest.cc | 
| 54 | if test -z "`${CXX} -instances=static -c conftest.cc 2>&1`"; then | 
| 55 | AC_MSG_RESULT(yes) | 
| 56 | OOPSE_TEMPLATE_FLAGS="-instances=static" | 
| 57 | else | 
| 58 | AC_MSG_RESULT(no) | 
| 59 | fi | 
| 60 | rm -f conftest* | 
| 61 | AC_MSG_CHECKING([checking whether ${CXX} accepts -pto]) | 
| 62 | echo 'void f(){}' > conftest.cc | 
| 63 | if test -z "`${CXX} -pto -c conftest.cc 2>&1`"; then | 
| 64 | AC_MSG_RESULT(yes) | 
| 65 | OOPSE_TEMPLATE_FLAGS="-pto" | 
| 66 | else | 
| 67 | AC_MSG_RESULT(no) | 
| 68 | fi | 
| 69 | rm -f conftest* | 
| 70 | AC_MSG_CHECKING([checking whether ${CXX} accepts -LANG:std]) | 
| 71 | echo 'void f(){}' > conftest.cc | 
| 72 | if test -z "`${CXX} -LANG:std -c conftest.cc 2>&1`"; then | 
| 73 | AC_MSG_RESULT(yes) | 
| 74 |  | 
| 75 |  | 
| 76 | EXTRA_CC_FLAG=${EXTRA_CC_FLAG}" -LANG:std" | 
| 77 | else | 
| 78 | AC_MSG_RESULT(no) | 
| 79 | fi | 
| 80 | fi | 
| 81 | AC_SUBST(OOPSE_TEMPLATE_FLAGS) | 
| 82 | AC_SUBST(EXTRA_CC_FLAG) | 
| 83 |  | 
| 84 | dnl Fortran 90 compilation checks are next | 
| 85 |  | 
| 86 | AC_PROG_F90([ifort ifc f90 xlf90 pgf90 epcf90 f95 xlf95 lf95 fort g95]) | 
| 87 | dnl Check the flag for Fortran90 preprocessing | 
| 88 | ACX_PROG_F90_PREPFLAG | 
| 89 | dnl Check to see if a flag is required for preprocessing defines | 
| 90 | ACX_PROG_F90_PREPDEFFLAG | 
| 91 | AC_LANG_PUSH(Fortran 90) | 
| 92 | AC_LANG_PREPROC(Fortran 90) | 
| 93 | AC_F90_LIBRARY_LDFLAGS | 
| 94 | dnl How does Fortran mangle function names | 
| 95 | AC_F90_WRAPPERS | 
| 96 | AC_SUBST(F90_FUNC) | 
| 97 | AC_SUBST(F90_FUNC_) | 
| 98 | dnl Fortran 90 module suffix | 
| 99 | AC_CHECK_MODSUFFIX | 
| 100 | dnl Fortran 90 module path specifier | 
| 101 | AC_CHECK_MODDIRFLAG | 
| 102 | AC_F90_MODULE_NAMES | 
| 103 | pat=`echo $ac_cv_f90_module_names | sed 's/.*\(%.*%\).*/\1/'` | 
| 104 | F90_MODULE_NAMES=empty | 
| 105 | case $pat in | 
| 106 | %MODULE%) | 
| 107 | F90_MODULE_NAMES=UPPER ;; | 
| 108 | %Module%) | 
| 109 | F90_MODULE_NAMES=Mixed ;; | 
| 110 | %module%) | 
| 111 | F90_MODULE_NAMES=lower ;; | 
| 112 | *) | 
| 113 | F90_MODULE_NAMES=unknown ;; | 
| 114 | esac | 
| 115 | AC_SUBST(F90_MODULE_NAMES) | 
| 116 | AC_LANG_POP | 
| 117 |  | 
| 118 | AC_LANG_PUSH(C) | 
| 119 | AC_CHECK_HEADERS(unistd.h sys/pstat.h sys/sysmp.h sys/sysinfo.h sys/table.h sys/param.h sys/sysctl.h sys/sytemcfg.h machine/hal_sysinfo.h) | 
| 120 | AC_CHECK_FUNCS(pstat_getstatic sysmp getsysinfo sysctl table) | 
| 121 | # special check for _system_configuration because AIX <4.3.2 do not | 
| 122 | # contain the `physmem' member. | 
| 123 | AC_MSG_CHECKING([for external symbol _system_configuration]) | 
| 124 | AC_TRY_COMPILE([#include <sys/systemcfg.h>], | 
| 125 | [double x = _system_configuration.physmem;], | 
| 126 | [AC_MSG_RESULT([yes]) | 
| 127 | AC_DEFINE(HAVE__SYSTEM_CONFIGURATION, 1, | 
| 128 | [Define if you have the _system_configuration variable.])], | 
| 129 | [AC_MSG_RESULT([no])]) | 
| 130 |  | 
| 131 | dnl check for system getopt | 
| 132 | adl_FUNC_GETOPT_LONG | 
| 133 |  | 
| 134 | dnl check for strong optimization options | 
| 135 |  | 
| 136 | case $debug in | 
| 137 | 1) | 
| 138 | ;; | 
| 139 | *) | 
| 140 | ACX_PROG_CC_MAXOPT | 
| 141 | ACX_PROG_CXX_MAXOPT | 
| 142 | ACX_PROG_F90_MAXOPT | 
| 143 | ;; | 
| 144 | esac | 
| 145 |  | 
| 146 | AC_PROG_INSTALL | 
| 147 | AC_PROG_LN_S | 
| 148 | AC_PROG_MAKE_SET | 
| 149 | AC_PROG_RANLIB | 
| 150 | AC_PROG_YACC | 
| 151 | AC_PROG_LEX | 
| 152 | AC_CHECK_PROG(AR, ar, ar, NONE) | 
| 153 | if test "$AR" = "NONE"; then | 
| 154 | AC_MSG_ERROR(--> Can't find \`ar'!) | 
| 155 | AC_CACHE_SAVE | 
| 156 | exit 1 | 
| 157 | fi | 
| 158 |  | 
| 159 | AC_PATH_PROG(PS, ps) | 
| 160 | AC_CACHE_CHECK([for POSIX ps], ac_cv_prog_ps_posix, [ | 
| 161 | USER=${USER:-${LOGNAME:-`logname`}} | 
| 162 | if $PS -U $USER -opid,args >/dev/null 2>&1; then | 
| 163 | ac_cv_prog_ps_posix=yes | 
| 164 | else | 
| 165 | ac_cv_prog_ps_posix=no | 
| 166 | fi | 
| 167 | ]) | 
| 168 | if test "$ac_cv_prog_ps_posix" = yes; then | 
| 169 | PSTYPE=BSD | 
| 170 | else | 
| 171 | PSTYPE=POSIX | 
| 172 | fi | 
| 173 |  | 
| 174 | AC_SUBST(PS) | 
| 175 | AC_SUBST(PSTYPE) | 
| 176 |  | 
| 177 |  | 
| 178 | AC_ARG_WITH(mpi, | 
| 179 | [AC_HELP_STRING([--with-mpi=<prefix>], | 
| 180 | [compile with MPI installed in <prefix> [default=no]])], | 
| 181 | with_mpi=$withval, | 
| 182 | with_mpi="no") | 
| 183 |  | 
| 184 | case "x$with_mpi" in | 
| 185 | xyes | "x")  USE_MPI=yes;; | 
| 186 | xno) USE_MPI=no ;; | 
| 187 | *) MPI="$with_mpi"; USE_MPI=yes ;; | 
| 188 | esac | 
| 189 | if test "$USE_MPI" = "yes" -a -z "$with_mpi"; then | 
| 190 | MPI="/usr/local" | 
| 191 | fi | 
| 192 | if test "$USE_MPI" = "yes"; then | 
| 193 | ACX_MPI | 
| 194 | fi | 
| 195 | AC_SUBST(USE_MPI) | 
| 196 |  | 
| 197 | AC_ARG_WITH(sprng, | 
| 198 | [AC_HELP_STRING([--with-sprng=<prefix>], | 
| 199 | [compile with SPRNG installed in <prefix> [default=/usr/local]])], | 
| 200 | with_sprng=$withval, | 
| 201 | with_sprng="/usr/local") | 
| 202 |  | 
| 203 | case "x$with_sprng" in | 
| 204 | xyes | "x")  USE_SPRNG=yes;; | 
| 205 | xno) USE_SPRNG=no ;; | 
| 206 | *) SPRNG="$with_sprng"; USE_SPRNG=yes ;; | 
| 207 | esac | 
| 208 | if test "$USE_SPRNG" = "yes" -a -z "$with_sprng"; then | 
| 209 | SPRNG="/usr/local" | 
| 210 | fi | 
| 211 | if test "$USE_SPRNG" = "yes"; then | 
| 212 | ACX_SPRNG | 
| 213 | fi | 
| 214 | AC_SUBST(USE_SPRNG) | 
| 215 |  | 
| 216 |  | 
| 217 | CHECK_MKL | 
| 218 |  | 
| 219 | BB_ENABLE_DOXYGEN | 
| 220 |  | 
| 221 | AC_EXEEXT | 
| 222 | AC_OBJEXT | 
| 223 | OBJEXT=".$OBJEXT" | 
| 224 |  | 
| 225 | OOPSE=oopse | 
| 226 |  | 
| 227 | dnl **** define home dir of oopse | 
| 228 | if test "x${prefix}" = "xNONE" | 
| 229 | then | 
| 230 | OOPSE_HOME=${ac_default_prefix}/oopse | 
| 231 | else | 
| 232 | OOPSE_HOME=${prefix}/oopse | 
| 233 | fi | 
| 234 | AC_ARG_ENABLE(oopse-home, | 
| 235 | [  --enable-oopse-home=DIR      define oopse home dir [PREFIX/oopse]], | 
| 236 | [OOPSE_HOME="${enableval}"]) | 
| 237 |  | 
| 238 | case "x$INSTALL" in | 
| 239 | x/*) ;; | 
| 240 | *) INSTALL=`pwd`/ac-tools/"shtool install -c" ; | 
| 241 | esac | 
| 242 |  | 
| 243 | MKINSTALLDIRS=`pwd`/ac-tools/"shtool mkdir -p -f" | 
| 244 |  | 
| 245 | dnl **** Define CFLAGS etc empty to prevent configure from setting them | 
| 246 | CFLAGS=${CFLAGS-""} | 
| 247 | CXXFLAGS=${CXXFLAGS-""} | 
| 248 | CPPFLAGS=${CPPFLAGS-""} | 
| 249 | FFLAGS=${FFLAGS-""} | 
| 250 | F90FLAGS=${F90FLAGS-""} | 
| 251 | LDFLAGS=${LDFLAGS-""} | 
| 252 | DEBUG=${DEBUG-"-g"} | 
| 253 |  | 
| 254 | case $debug in | 
| 255 | 1) | 
| 256 | FFLAGS="$DEBUG $FFLAGS" | 
| 257 | F90FLAGS="$DEBUG $F90FLAGS" | 
| 258 | ;; | 
| 259 | *) | 
| 260 | ;; | 
| 261 | esac | 
| 262 |  | 
| 263 |  | 
| 264 | AC_SUBST(EXEEXT) | 
| 265 | AC_SUBST(OBJEXT) | 
| 266 | AC_SUBST(BATEXT) | 
| 267 | AC_SUBST(MKINSTALLDIRS) | 
| 268 | AC_SUBST(OOPSE) | 
| 269 | AC_SUBST(OOPSE_HOME) | 
| 270 | AC_SUBST(SUBDIRS) | 
| 271 | AC_SUBST(CFLAGS) | 
| 272 | AC_SUBST(CXXFLAGS) | 
| 273 | AC_SUBST(CPPFLAGS) | 
| 274 | AC_SUBST(FFLAGS) | 
| 275 | AC_SUBST(F90FLAGS) | 
| 276 | AC_SUBST(LDFLAGS) | 
| 277 | AC_SUBST(PREPFLAG) | 
| 278 | AC_SUBST(PREPDEFFLAG) | 
| 279 | AC_SUBST(F90_MODULE_NAMES) | 
| 280 | AC_CONFIG_HEADER([src/config.h]) | 
| 281 | AC_CONFIG_FILES([make/Makefile src/utils/Makefile]) | 
| 282 |  | 
| 283 | AC_OUTPUT |