| 1 | AC_PREREQ(2.62) |
|---|
| 2 | # |
|---|
| 3 | # (C) 2006 by Argonne National Laboratory. |
|---|
| 4 | # See COPYRIGHT in top-level directory. |
|---|
| 5 | # |
|---|
| 6 | dnl Process this file with autoconf to produce a configure script. |
|---|
| 7 | dnl |
|---|
| 8 | dnl aclocal_cache.m4, included by sowing/confdb/aclocal.m4, fixes |
|---|
| 9 | dnl bugs in autoconf caching. |
|---|
| 10 | dnl |
|---|
| 11 | dnl This is a large configure script and it is important to keep it |
|---|
| 12 | dnl clearly organized. In addition, this script must coordinate with |
|---|
| 13 | dnl the other modules that can be used to construct MPICH2, such as |
|---|
| 14 | dnl the communication device and the process manager. Each of these |
|---|
| 15 | dnl may have special features or limitations that other modules or |
|---|
| 16 | dnl this configure may need to take into account. To handle this, there |
|---|
| 17 | dnl are xx major steps in this configure script: |
|---|
| 18 | dnl |
|---|
| 19 | dnl 1. Identify major modules and source any prerequisite scripts |
|---|
| 20 | dnl 2. Determine compiler characteristics |
|---|
| 21 | dnl 3. Setup and configure the other modules |
|---|
| 22 | dnl 4. Determine MPI features and characteristics (such as datatype values) |
|---|
| 23 | dnl |
|---|
| 24 | dnl Each of these is described in more detail below. |
|---|
| 25 | dnl |
|---|
| 26 | dnl 1. Identify the modules (most are specified by |
|---|
| 27 | dnl --with-<modulename>=instance, |
|---|
| 28 | dnl for example, --with-pm=mpd or --with-device=ch3:nemesis). |
|---|
| 29 | dnl For each module, source the file mpich2prereq if present (in the |
|---|
| 30 | dnl module's top-level directory). This |
|---|
| 31 | dnl must be a bourne (sh) shell script; it can access any of the variables |
|---|
| 32 | dnl in the configure script. In addition, there are a few variables that |
|---|
| 33 | dnl are defined and provided to allow the modules to communicate their |
|---|
| 34 | dnl needs or limitations to the other modules. These are: |
|---|
| 35 | dnl MPID_MAX_THREAD_LEVEL - thread level supported by device. |
|---|
| 36 | dnl if unset, is MPI_THREAD_FUNNELED |
|---|
| 37 | dnl MPID_NO_LONG_LONG - if yes, the device does not support the |
|---|
| 38 | dnl long long integer type |
|---|
| 39 | dnl MPID_NO_LONG_DOUBLE - if yes, the device does not support the |
|---|
| 40 | dnl long double type |
|---|
| 41 | dnl MPID_PM_NAMESERVER - if set, provides the name of the nameserver |
|---|
| 42 | dnl that the process manager supports. |
|---|
| 43 | dnl This name server will be used if the |
|---|
| 44 | dnl default name server is selected. |
|---|
| 45 | dnl MPID_NO_PM - If yes, the device does not require any |
|---|
| 46 | dnl PM implementation. |
|---|
| 47 | dnl MPID_NO_PMI - If yes, the device does not require any |
|---|
| 48 | dnl PMI implementation. |
|---|
| 49 | dnl EXTRA_STATUS_DECL - Any extra declarations that the device |
|---|
| 50 | dnl needs added to the definition of MPI_Status. |
|---|
| 51 | dnl MPID_MAX_PROCESSOR_NAME - The maximum number of character in a processor |
|---|
| 52 | dnl name. If not set, 128 will be used. |
|---|
| 53 | dnl PMI_REQUIRES_READABLE_TOKENS - if yes, define the C-preprocessor |
|---|
| 54 | dnl value USE_HUMAN_READABLE_TOKENS, which is |
|---|
| 55 | dnl used in src/include/mpimem.h to define token |
|---|
| 56 | dnl separators used in src/util/mem/argstr.c |
|---|
| 57 | dnl PM_REQUIRES_PMI - if set, provides the name of the PMI |
|---|
| 58 | dnl interface implementation. If not set, |
|---|
| 59 | dnl the "simple" PMI implementation is used. |
|---|
| 60 | dnl A process manager that needs a particular |
|---|
| 61 | dnl process manager should check that this is |
|---|
| 62 | dnl not set to an incompatible value. |
|---|
| 63 | dnl MPID_NO_SPAWN - if yes, the device does not support the |
|---|
| 64 | dnl dynamic process routines (spawn, connect |
|---|
| 65 | dnl attach, join, plus port and publish |
|---|
| 66 | dnl routines). The major effect of this |
|---|
| 67 | dnl is to let the test codes know that |
|---|
| 68 | dnl spawn is not implemented. |
|---|
| 69 | dnl MPID_NO_RMA - if yes, the device does not support the |
|---|
| 70 | dnl MPI RMA routines (MPI_Win_create and |
|---|
| 71 | dnl MPI_Put etc.). The major effect of this |
|---|
| 72 | dnl is to let the test codes know that |
|---|
| 73 | dnl RMA is not implemented. |
|---|
| 74 | dnl |
|---|
| 75 | dnl Note that the meanings of these variables are defined so that an |
|---|
| 76 | dnl undefined value gives the default. This makes it easy to expand |
|---|
| 77 | dnl the set of such variables, since only modules that need the new |
|---|
| 78 | dnl variable will need to be changed. |
|---|
| 79 | dnl |
|---|
| 80 | dnl 2. Determine compiler characteristics |
|---|
| 81 | dnl Here is where features of the compilers are determined, including |
|---|
| 82 | dnl support for shared libraries and sizes of the basic datatype types. |
|---|
| 83 | dnl |
|---|
| 84 | dnl 3. Setup and configure the other modules |
|---|
| 85 | dnl Before each module configure is executed, the script setup_<module> |
|---|
| 86 | dnl is run if present. This is a bourne (sh) shell script and may |
|---|
| 87 | dnl access configure variables. It should not make any changes to the |
|---|
| 88 | dnl compiler name or flags (e.g., do not add -D_XOPEN_SOURCE to CFLAGS here, |
|---|
| 89 | dnl because that may invalidate the determination of the compiler |
|---|
| 90 | dnl characteristics in the prior step). |
|---|
| 91 | dnl |
|---|
| 92 | dnl 4. Determine MPI features |
|---|
| 93 | dnl |
|---|
| 94 | dnl |
|---|
| 95 | dnl Special environment variables |
|---|
| 96 | dnl To let other scripts and in particular the configure in test/mpi |
|---|
| 97 | dnl know that they are being invoked from within the MPICH2 configure, |
|---|
| 98 | dnl the following environment variables are set and exported: |
|---|
| 99 | dnl FROM_MPICH2 |
|---|
| 100 | dnl MPICH2_ENABLE_F77 |
|---|
| 101 | dnl MPICH2_ENABLE_F90 |
|---|
| 102 | dnl MPICH2_ENABLE_CXX |
|---|
| 103 | dnl |
|---|
| 104 | dnl The file name here refers to a file in the source being configured |
|---|
| 105 | dnl In later versions of autoconf, the binding of AC_INIT changed (!!!) |
|---|
| 106 | dnl The original version was AC_INIT(a source file) |
|---|
| 107 | dnl The later version is AC_INIT(package,version,[bug-report],[tarname]) |
|---|
| 108 | dnl Here we use the original version |
|---|
| 109 | dnl AC_INIT(src/include/mpiimpl.h) |
|---|
| 110 | dnl |
|---|
| 111 | dnl Note that no executable statements are allowed (and any are silently |
|---|
| 112 | dnl dropped) before AC_INIT. |
|---|
| 113 | dnl |
|---|
| 114 | dnl AC_INIT requires an explicit version number |
|---|
| 115 | dnl Args are package name, version, bug report, and tar file name |
|---|
| 116 | dnl All must be literals |
|---|
| 117 | dnl Note that AC_PACKAGE_STRING is not a command but must be defined(!) |
|---|
| 118 | dnl Unfortunately, setting the PACKAGE names is not compatible with |
|---|
| 119 | dnl AC_CONFIG_SUBDIRS, since the resulting values in the generated |
|---|
| 120 | dnl conf file will not be consistent. |
|---|
| 121 | dnl define([AC_PACKAGE_STRING],[MPICH2 1.0.6]) |
|---|
| 122 | dnl AC_INIT(mpich2,1.0.6,mpich2-maint@mcs.anl.gov,mpich2-1.0.6) |
|---|
| 123 | dnl Use the oldstyle AC_INIT instead |
|---|
| 124 | |
|---|
| 125 | AC_INIT(src/include/mpichconf.h.in) |
|---|
| 126 | |
|---|
| 127 | CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '` |
|---|
| 128 | AC_SUBST(CONFIGURE_ARGS_CLEAN) |
|---|
| 129 | |
|---|
| 130 | # Try to find the release date |
|---|
| 131 | if test -s "$srcdir/maint/ReleaseDate" ; then |
|---|
| 132 | RELEASE_DATE="`cat $srcdir/maint/ReleaseDate`" |
|---|
| 133 | else |
|---|
| 134 | RELEASE_DATE="Unknown, built on `date`" |
|---|
| 135 | fi |
|---|
| 136 | AC_SUBST(RELEASE_DATE) |
|---|
| 137 | |
|---|
| 138 | # Try to find the version |
|---|
| 139 | if test -s "$srcdir/maint/Version" ; then |
|---|
| 140 | VERSION="`cat $srcdir/maint/Version`" |
|---|
| 141 | else |
|---|
| 142 | AC_MSG_ERROR([Version information not found. Configuration aborted.]) |
|---|
| 143 | fi |
|---|
| 144 | |
|---|
| 145 | # Produce a numeric version assuming the following format: |
|---|
| 146 | # Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER] |
|---|
| 147 | # Example: 1.0.7rc1 has |
|---|
| 148 | # MAJ = 1 |
|---|
| 149 | # MIN = 0 |
|---|
| 150 | # REV = 7 |
|---|
| 151 | # EXT = rc |
|---|
| 152 | # EXT_NUMBER = 1 |
|---|
| 153 | # |
|---|
| 154 | # Converting to numeric version will convert EXT to a format number: |
|---|
| 155 | # ALPHA (a) = 0 |
|---|
| 156 | # BETA (b) = 1 |
|---|
| 157 | # RC (rc) = 2 |
|---|
| 158 | # PATCH (p) = 3 |
|---|
| 159 | # Regular releases are treated as patch 0 |
|---|
| 160 | # |
|---|
| 161 | # Numeric version will have 1 digit for MAJ, 2 digits for MIN, |
|---|
| 162 | # 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER. |
|---|
| 163 | changequote(<<,>>) |
|---|
| 164 | V1=`expr $VERSION : '\([0-9]*\)\.[0-9]*[\.]*[0-9]*[a-zA-Z]*[0-9]*'` |
|---|
| 165 | V2=`expr $VERSION : '[0-9]*\.\([0-9]*\)[\.]*[0-9]*[a-zA-Z]*[0-9]*'` |
|---|
| 166 | V3=`expr $VERSION : '[0-9]*\.[0-9]*[\.]*\([0-9]*\)[a-zA-Z]*[0-9]*'` |
|---|
| 167 | V4=`expr $VERSION : '[0-9]*\.[0-9]*[\.]*[0-9]*\([a-zA-Z]*\)[0-9]*'` |
|---|
| 168 | V5=`expr $VERSION : '[0-9]*\.[0-9]*[\.]*[0-9]*[a-zA-Z]*\([0-9]*\)'` |
|---|
| 169 | changequote([,]) |
|---|
| 170 | |
|---|
| 171 | if test "$V2" -le 9 ; then V2=0$V2 ; fi |
|---|
| 172 | if test "$V3" = "" ; then V3=0; fi |
|---|
| 173 | if test "$V3" -le 9 ; then V3=0$V3 ; fi |
|---|
| 174 | if test "$V4" = "a" ; then |
|---|
| 175 | V4=0 |
|---|
| 176 | elif test "$V4" = "b" ; then |
|---|
| 177 | V4=1 |
|---|
| 178 | elif test "$V4" = "rc" ; then |
|---|
| 179 | V4=2 |
|---|
| 180 | elif test "$V4" = "" ; then |
|---|
| 181 | V4=3 |
|---|
| 182 | V5=0 |
|---|
| 183 | elif test "$V4" = "p" ; then |
|---|
| 184 | V4=3 |
|---|
| 185 | fi |
|---|
| 186 | if test "$V5" -le 9 ; then V5=0$V5 ; fi |
|---|
| 187 | |
|---|
| 188 | NUMVERSION=$V1$V2$V3$V4$V5 |
|---|
| 189 | AC_SUBST(NUMVERSION) |
|---|
| 190 | AC_SUBST(VERSION) |
|---|
| 191 | |
|---|
| 192 | # |
|---|
| 193 | # ABIVERSION is incremented when there are changes in the ABI. This is |
|---|
| 194 | # used to let a shared library describe how compatible it is with executables |
|---|
| 195 | # that were linked against it. In our use, the version number is x:y, where |
|---|
| 196 | # x changes when the ABI changes |
|---|
| 197 | # y changes when major behavior of the routines, without changing the ABI; |
|---|
| 198 | # reset y to one when x changes. Some systems don't like a 0 subversion, |
|---|
| 199 | # so we always use one as the smallest version number. |
|---|
| 200 | # The ABIVERSION is not the same as the VERSION. It is used principly in the |
|---|
| 201 | # Makefile.sm to pass the ABIVERSION to the createshlib script. |
|---|
| 202 | # We use libtool-style version numbers (see --version-info in the |
|---|
| 203 | # libtool manual) |
|---|
| 204 | ABIVERSION="1:1" |
|---|
| 205 | AC_SUBST(ABIVERSION) |
|---|
| 206 | dnl |
|---|
| 207 | CONFIGURE_ARGUMENTS="$ac_configure_args" |
|---|
| 208 | AC_SUBST(CONFIGURE_ARGUMENTS) |
|---|
| 209 | if test -n "$ac_configure_args" ; then |
|---|
| 210 | echo "Configuring MPICH2 version $VERSION with $ac_configure_args" |
|---|
| 211 | else |
|---|
| 212 | echo "Configuring MPICH2 version $VERSION" |
|---|
| 213 | fi |
|---|
| 214 | # Add the information on the system: |
|---|
| 215 | echo "Running on system: `uname -a`" |
|---|
| 216 | dnl |
|---|
| 217 | dnl Definitions will be placed in this file rather than in the DEFS variable |
|---|
| 218 | AC_CONFIG_HEADER(src/include/mpichconf.h) |
|---|
| 219 | AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */ |
|---|
| 220 | /* |
|---|
| 221 | * (C) 2001 by Argonne National Laboratory. |
|---|
| 222 | * See COPYRIGHT in top-level directory. |
|---|
| 223 | */ |
|---|
| 224 | #ifndef MPICHCONF_H_INCLUDED |
|---|
| 225 | #define MPICHCONF_H_INCLUDED |
|---|
| 226 | ]) |
|---|
| 227 | AH_BOTTOM([#endif]) |
|---|
| 228 | |
|---|
| 229 | dnl |
|---|
| 230 | dnl Set the directory that contains support scripts such as install-sh and |
|---|
| 231 | dnl config.guess |
|---|
| 232 | AC_CONFIG_AUX_DIR(confdb) |
|---|
| 233 | dnl |
|---|
| 234 | dnl Use AC_ARG_ENABLE to look for --enable-feature and AC_ARG_WITH to look for |
|---|
| 235 | dnl --with-capability |
|---|
| 236 | dnl |
|---|
| 237 | dnl Enable better caching control |
|---|
| 238 | PAC_ARG_CACHING |
|---|
| 239 | dnl |
|---|
| 240 | AC_ARG_ENABLE(echo, |
|---|
| 241 | [--enable-echo - Turn on strong echoing. The default is enable=no.] ,set -x) |
|---|
| 242 | dnl |
|---|
| 243 | dnl |
|---|
| 244 | AC_ARG_ENABLE(coverage, |
|---|
| 245 | [--enable-coverage - Turn on coverage analysis using gcc and gcov],, |
|---|
| 246 | enable_coverage=no) |
|---|
| 247 | dnl |
|---|
| 248 | AC_ARG_ENABLE(dynamiclibs, |
|---|
| 249 | [--enable-dynamiclibs - Enable the use of dynamic libraries by the devices that support them],,enable_dynamiclibs=no) |
|---|
| 250 | dnl |
|---|
| 251 | AC_ARG_ENABLE(error-checking, |
|---|
| 252 | [--enable-error-checking=level - Control the amount of error checking. |
|---|
| 253 | level may be |
|---|
| 254 | no - no error checking |
|---|
| 255 | runtime - error checking controllable at runtime through environment |
|---|
| 256 | variables |
|---|
| 257 | all - error checking always enabled],,enable_error_checking=all) |
|---|
| 258 | dnl |
|---|
| 259 | AC_ARG_ENABLE(error-messages, |
|---|
| 260 | [--enable-error-messages=level - Control the amount of detail in error |
|---|
| 261 | messages. Level may be |
|---|
| 262 | all - Maximum amount of information |
|---|
| 263 | generic - Only generic messages (no information about the specific |
|---|
| 264 | instance) |
|---|
| 265 | class - One message per MPI error class |
|---|
| 266 | none - No messages],,enable_error_messages=all) |
|---|
| 267 | dnl |
|---|
| 268 | AC_ARG_ENABLE(timing, |
|---|
| 269 | [--enable-timing=level - Control the amount of timing information |
|---|
| 270 | collected by the MPICH implementation. level may be |
|---|
| 271 | none - Collect no data |
|---|
| 272 | all - Collect lots of data |
|---|
| 273 | runtime - Runtime control of data collected |
|---|
| 274 | The default is none.],,enable_timing=default) |
|---|
| 275 | dnl |
|---|
| 276 | AC_ARG_ENABLE(g, |
|---|
| 277 | [--enable-g=option - Control the level of debugging support in the MPICH |
|---|
| 278 | implementation. option is a list of comma separated names including |
|---|
| 279 | none - No debugging |
|---|
| 280 | handle - Trace handle operations |
|---|
| 281 | handlealloc - Trace hancle allocations |
|---|
| 282 | dbg - Add compiler flag, -g, to CFLAGS, CXXFLAGS FFLAGS and F90FLAGS. |
|---|
| 283 | debug - Synonym for dbg |
|---|
| 284 | log - Enable debug event logging |
|---|
| 285 | mem - Memory usage tracing |
|---|
| 286 | meminit - Preinitialize memory associated structures and unions to |
|---|
| 287 | eliminate access warnings from programs like valgrind |
|---|
| 288 | memarena - Check for overwrite errors in memory allocation arena |
|---|
| 289 | mutex - Enable error checking on pthread mutexes |
|---|
| 290 | mutexnesting - Check for non-nesting of mutexes |
|---|
| 291 | nesting - Check for proper nesting values |
|---|
| 292 | fine-grain-nesting - Perform a fine-grain nesting check on exit |
|---|
| 293 | |
|---|
| 294 | all - All of the above choices],,enable_g=none) |
|---|
| 295 | dnl |
|---|
| 296 | dnl We may want to force MPI_Aint to be the same size as MPI_Offset, |
|---|
| 297 | dnl particularly on 32 bit systems with large (64 bit) file systems. |
|---|
| 298 | AC_ARG_WITH(aint-size, |
|---|
| 299 | [--with-aint-size - Override the size of MPI_AINT],,with_aint_size=0) |
|---|
| 300 | dnl |
|---|
| 301 | dnl |
|---|
| 302 | dnl --enable-sharedlibs=kind is set with the PAC_ARG_SHAREDLIBS macro |
|---|
| 303 | dnl |
|---|
| 304 | dnl AC_ARG_ENABLE(internat, |
|---|
| 305 | dnl [--enable-internat - Enable internationalization of messages. |
|---|
| 306 | dnl Not yet supported]) |
|---|
| 307 | dnl |
|---|
| 308 | dnl --enable-fast |
|---|
| 309 | AC_ARG_ENABLE(fast, |
|---|
| 310 | [--enable-fast=option - Control the level of fast execution in the MPICH |
|---|
| 311 | implementation. option is a list of comma separated names including |
|---|
| 312 | O<n> - Appends default optimization flags, -O<n>, to all internal |
|---|
| 313 | compiler flags, i.e. MPICH2LIB_CFLAGS, MPICH2LIB_CXXFLAGS, |
|---|
| 314 | MPICH2LIB_FFLAGS, and MPICH2LIB_F90FLAGS. |
|---|
| 315 | defopt - Default compiler optimization -O2 for all language bindings, |
|---|
| 316 | i.e. --enable-fast=O2, when neither --enable-fast |
|---|
| 317 | nor --disable-fast is specified. |
|---|
| 318 | nochkmsg - No error checking, i.e. --disable-error-checking |
|---|
| 319 | notiming - No timing collection, i.e. --disable-timing. |
|---|
| 320 | ndebug - Appends -DNDEBUG to internal CFLAGS, i.e. MPICH2LIB_CFLAGS. |
|---|
| 321 | all|yes - "defopt", "nochkmsg", "notiming" and "ndebug" are enabled |
|---|
| 322 | when --enable-fast is specified without any option. |
|---|
| 323 | none - None of above options, i.e. --disable-fast. |
|---|
| 324 | ],,enable_fast=defopt) |
|---|
| 325 | |
|---|
| 326 | AC_ARG_ENABLE(check-compiler-flags, |
|---|
| 327 | [--enable-check-compiler-flags -- enable the checks for all compiler options, |
|---|
| 328 | xxxFLAGS, MPICH2_xxxFLAGS. Default is on.],,enable_check_compiler_flags=yes) |
|---|
| 329 | |
|---|
| 330 | dnl |
|---|
| 331 | dnl We enable f77 and f90 if we can find compilers for them. |
|---|
| 332 | dnl In addition, we check whether f77 and f90 can work together. |
|---|
| 333 | dnl |
|---|
| 334 | AC_ARG_ENABLE(f77, |
|---|
| 335 | [--enable-f77 - Enable Fortran 77 bindings],, |
|---|
| 336 | enable_f77=default; enable_f77_wasdefault=yes) |
|---|
| 337 | AC_ARG_ENABLE(f90, |
|---|
| 338 | [--enable-f90 - Enable Fortran 90 bindings],,enable_f90=default) |
|---|
| 339 | AC_ARG_ENABLE(cxx, |
|---|
| 340 | [--enable-cxx - Enable C++ bindings],,enable_cxx=default) |
|---|
| 341 | AC_ARG_ENABLE(romio, |
|---|
| 342 | [--enable-romio - Enable ROMIO MPI I/O implementation], |
|---|
| 343 | ,enable_romio=yes) |
|---|
| 344 | dnl |
|---|
| 345 | AC_ARG_ENABLE(debuginfo, |
|---|
| 346 | [--enable-debuginfo - Enable support for debuggers],,enable_debuginfo=no) |
|---|
| 347 | |
|---|
| 348 | AC_ARG_ENABLE(smpcoll, |
|---|
| 349 | [--enable-smpcoll - Enable support for SMP/multi-core aware collectives], |
|---|
| 350 | smpcoll=$enableval, |
|---|
| 351 | smpcoll=yes) |
|---|
| 352 | |
|---|
| 353 | if test $smpcoll = "yes" ; then |
|---|
| 354 | AC_DEFINE(USE_SMP_COLLECTIVES,1,[define to enable SMP/multi-core aware collectives]) |
|---|
| 355 | fi |
|---|
| 356 | |
|---|
| 357 | dnl Check for pipelined collectives |
|---|
| 358 | AC_ARG_ENABLE(pipecoll, |
|---|
| 359 | [--enable-pipecoll - Enable support for pipelined collectives], |
|---|
| 360 | pipecoll=$enableval, |
|---|
| 361 | pipecoll=yes) |
|---|
| 362 | |
|---|
| 363 | if test $pipecoll = "yes" ; then |
|---|
| 364 | AC_DEFINE(USE_PIPE_COLLECTIVES,1,[define to enable pipelined collectives]) |
|---|
| 365 | fi |
|---|
| 366 | |
|---|
| 367 | dnl |
|---|
| 368 | dnl The environment variable MPICH_DEBUGLIBNAME may be used to override the |
|---|
| 369 | dnl default name of the library that the debugger will load to access the |
|---|
| 370 | dnl MPICH2 internal data structures. |
|---|
| 371 | dnl |
|---|
| 372 | AC_ARG_ENABLE(nmpi-as-mpi, |
|---|
| 373 | [--enable-nmpi-as-mpi - Use MPI rather than PMPI routines for MPI routines, |
|---|
| 374 | such as the collectives, that may be implemented in terms of other MPI |
|---|
| 375 | routines],,enable_nmpi_as_mpi=no) |
|---|
| 376 | dnl |
|---|
| 377 | dnl With options |
|---|
| 378 | dnl "default" is a special device that allows MPICH to choose one based on |
|---|
| 379 | dnl the environment. |
|---|
| 380 | AC_ARG_WITH(device, |
|---|
| 381 | [--with-device=name - Specify the communication device for MPICH.],, |
|---|
| 382 | with_device=default) |
|---|
| 383 | dnl |
|---|
| 384 | AC_ARG_WITH(pmi, [--with-pmi=name - Specify the pmi interface for MPICH.],, |
|---|
| 385 | with_pmi=default) |
|---|
| 386 | dnl |
|---|
| 387 | AC_ARG_WITH(pm, [--with-pm=name - Specify the process manager for MPICH. |
|---|
| 388 | Multiple process managers may be specified as long as they all use |
|---|
| 389 | the same pmi interface by separating them with colons. The |
|---|
| 390 | mpiexec for the first named process manager will be installed. |
|---|
| 391 | Example: --with-pm=gforker:mpd:remshell builds the three process |
|---|
| 392 | managers gforker, mpd, and remshell; only the mpiexec from gforker |
|---|
| 393 | is installed into the bin directory.],, |
|---|
| 394 | with_pm=default) |
|---|
| 395 | dnl |
|---|
| 396 | AC_ARG_WITH(logging, |
|---|
| 397 | [--with-logging=name - Specify the logging library for MPICH.], |
|---|
| 398 | [if test -z "$withval" ; then with_logging=rlog ; fi], |
|---|
| 399 | with_logging=none) |
|---|
| 400 | dnl |
|---|
| 401 | dnl both --without-mpe and --disable-mpe are supported |
|---|
| 402 | dnl AC_ARG_ENABLE(mpe) is used only when --with(out)-mpe is not used. |
|---|
| 403 | AC_ARG_WITH(mpe, |
|---|
| 404 | [--with-mpe - Build the MPE (MPI Parallel Environment) routines],, |
|---|
| 405 | with_mpe=default) |
|---|
| 406 | if test "$with_mpe" = "default" ; then |
|---|
| 407 | AC_ARG_ENABLE(mpe, |
|---|
| 408 | [--enable-mpe - Build the MPE (MPI Parallel Environment) routines], |
|---|
| 409 | with_mpe=$enableval,with_mpe=default) |
|---|
| 410 | fi |
|---|
| 411 | dnl |
|---|
| 412 | AC_ARG_ENABLE(threads, |
|---|
| 413 | [--enable-threads=level - Control the level of thread support in the |
|---|
| 414 | MPICH implementation. The following levels are supported. |
|---|
| 415 | single - No threads (MPI_THREAD_SINGLE) |
|---|
| 416 | funneled - Only the main thread calls MPI (MPI_THREAD_FUNNELED) |
|---|
| 417 | serialized - User serializes calls to MPI (MPI_THREAD_SERIALIZED) |
|---|
| 418 | multiple(:impl) - Fully multi-threaded (MPI_THREAD_MULTIPLE) |
|---|
| 419 | The following implementations are supported. |
|---|
| 420 | global_mutex - a single global lock guards access to all MPI functions. |
|---|
| 421 | The default implementation is global_mutex. |
|---|
| 422 | For the ch3:sock channel, a separate build is no longer needed for thread-multiple. |
|---|
| 423 | It is compiled by default and is selectable at run time with MPI_Init_thread. |
|---|
| 424 | If MPI_Init_thread is not called, the default is funneled . |
|---|
| 425 | For other channels, the --enable-threads option is not supported currently, and |
|---|
| 426 | the default is funneled.],, |
|---|
| 427 | enable_threads=default) |
|---|
| 428 | dnl |
|---|
| 429 | AC_ARG_ENABLE(thread-cs, |
|---|
| 430 | [--enable-thread-cs=type - Choose the method used for critical sections and |
|---|
| 431 | other atomic updates when multiple threads are present. Values may be |
|---|
| 432 | global (default), brief-global, per-object, lock-free],, |
|---|
| 433 | enable_thread_cs=global) |
|---|
| 434 | AC_ARG_ENABLE(refcount, |
|---|
| 435 | [--enable-refcount=type - Choose the method for ensuring atomic updates to |
|---|
| 436 | the reference counts for MPI objects. Values may be lock, lock-free, none. |
|---|
| 437 | The default depends on the thread-cs choice; for global it is none (because |
|---|
| 438 | none is required), for brief-global and per-object it is lock, and for |
|---|
| 439 | lock-free it is lock-free],,enable_refcount=default) |
|---|
| 440 | AC_ARG_ENABLE(mutex-timing, [--enable-mutex-timing - calculate the |
|---|
| 441 | time spent waiting on mutexes. For best |
|---|
| 442 | results, use with |
|---|
| 443 | --enable-timer-type=linux86_cycle], |
|---|
| 444 | AC_DEFINE(MPIU_MUTEX_WAIT_TIME,1,[Define to enable timing mutexes]) |
|---|
| 445 | ) |
|---|
| 446 | AC_ARG_ENABLE(handle-allocation, |
|---|
| 447 | [--enable-handle-allocation=type - Choose the method used for |
|---|
| 448 | allocating MPI object handles. Values may be 'tls' for |
|---|
| 449 | thread-local storage or 'mutex' for simple locking. 'mutex' is |
|---|
| 450 | the default.], |
|---|
| 451 | , |
|---|
| 452 | enable_handle_allocation=default) |
|---|
| 453 | |
|---|
| 454 | dnl |
|---|
| 455 | dnl |
|---|
| 456 | AC_ARG_ENABLE(weak-symbols, |
|---|
| 457 | [--enable-weak-symbols - Use weak symbols to implement PMPI routines (default)],, |
|---|
| 458 | enable_weak_symbols=yes) |
|---|
| 459 | dnl |
|---|
| 460 | dnl |
|---|
| 461 | dnl |
|---|
| 462 | AC_ARG_WITH(cross, |
|---|
| 463 | [--with-cross=file - Specify the values of variables that configure cannot |
|---|
| 464 | determine in a cross-compilation environment],,with_cross=no) |
|---|
| 465 | dnl |
|---|
| 466 | AC_ARG_WITH(namepublisher, |
|---|
| 467 | [--with-namepublisher=name - Choose the system that will support |
|---|
| 468 | MPI_PUBLISH_NAME and MPI_LOOKUP_NAME. Options |
|---|
| 469 | include |
|---|
| 470 | no (no service available) |
|---|
| 471 | mpd |
|---|
| 472 | file[:directory] (optional directory) |
|---|
| 473 | ],, |
|---|
| 474 | with_namepublisher=default) |
|---|
| 475 | dnl |
|---|
| 476 | dnl AC_ARG_WITH(cxxlibname, |
|---|
| 477 | dnl [--with-cxxlibname=name - Specify name of library containing C++ interface |
|---|
| 478 | dnl routines],[MPICXXLIBNAME=$withval;set_MPICXXLIBNAME="yes"],MPICXXLIBNAME=) |
|---|
| 479 | |
|---|
| 480 | dnl flibname complicates the handling of MPIR_F_TRUE and MPIR_F_FALSE, |
|---|
| 481 | dnl particularly when using IBM/MS-style shared libraries. Withdraw this |
|---|
| 482 | dnl option and see if anyone misses it. |
|---|
| 483 | dnl |
|---|
| 484 | dnl AC_ARG_WITH(flibname, |
|---|
| 485 | dnl [--with-flibname=name - Specify name of library containing Fortran interface |
|---|
| 486 | dnl routines],[MPIFLIBNAME=$withval;set_MPIFLIBNAME="yes"],MPIFLIBNAME=) |
|---|
| 487 | AC_SUBST(MPIFLIBNAME) |
|---|
| 488 | AC_SUBST(PMPIFLIBNAME) |
|---|
| 489 | dnl |
|---|
| 490 | dnl The default is a special wrapper library |
|---|
| 491 | AC_ARG_WITH(fwrapname, |
|---|
| 492 | [--with-fwrapname=name - Specify name of library containing Fortran interface |
|---|
| 493 | routines],[FWRAPNAME=$withval;set_FWRAPNAME="yes"],FWRAPNAME=fmpich) |
|---|
| 494 | AC_SUBST(FWRAPNAME) |
|---|
| 495 | dnl |
|---|
| 496 | # |
|---|
| 497 | # Save a copy of CFLAGS, CXXFLAGS, FFLAGS, F90FLAGS, LDFLAGS as WRAPPER_* |
|---|
| 498 | # before any of these flags are being modified by configure tests. |
|---|
| 499 | # |
|---|
| 500 | # WRAPPER_xFLAGS are used by mpicc and friends. |
|---|
| 501 | # Don't modify WRAPPER_xFLAGS |
|---|
| 502 | WRAPPER_CFLAGS=$CFLAGS |
|---|
| 503 | WRAPPER_CXXFLAGS=$CXXFLAGS |
|---|
| 504 | WRAPPER_FFLAGS=$FFLAGS |
|---|
| 505 | WRAPPER_F90FLAGS=$F90FLAGS |
|---|
| 506 | WRAPPER_LDFLAGS=$LDFLAGS |
|---|
| 507 | export WRAPPER_CFLAGS |
|---|
| 508 | export WRAPPER_CXXFLAGS |
|---|
| 509 | export WRAPPER_FFLAGS |
|---|
| 510 | export WRAPPER_F90FLAGS |
|---|
| 511 | export WRAPPER_LDFLAGS |
|---|
| 512 | |
|---|
| 513 | # ----------------------------------------------------------------------------- |
|---|
| 514 | # First check that we have a clean build if we are doing a VPATH build |
|---|
| 515 | PAC_VPATH_CHECK(src/include/mpi.h src/env/mpicc src/env/mpicc.conf,lib) |
|---|
| 516 | |
|---|
| 517 | # ---------------------------------------------------------------------------- |
|---|
| 518 | # This test is complicated by the fact that top_srcdir is not set until |
|---|
| 519 | # the very end of configure. Instead, we get it ourselves |
|---|
| 520 | if test -z "$top_srcdir" ; then |
|---|
| 521 | use_top_srcdir=$srcdir |
|---|
| 522 | else |
|---|
| 523 | use_top_srcdir=$top_srcdir |
|---|
| 524 | fi |
|---|
| 525 | if test -z "$master_top_srcdir" ; then |
|---|
| 526 | # This needs to be an absolute pathname |
|---|
| 527 | case "$use_top_srcdir" in |
|---|
| 528 | /*) ;; |
|---|
| 529 | *) |
|---|
| 530 | use_top_srcdir=`(cd $use_top_srcdir && pwd)` |
|---|
| 531 | ;; |
|---|
| 532 | esac |
|---|
| 533 | master_top_srcdir=$use_top_srcdir |
|---|
| 534 | fi |
|---|
| 535 | # Get the directory that we're running in... |
|---|
| 536 | if test -z "$master_top_builddir" ; then |
|---|
| 537 | master_top_builddir="`pwd`" |
|---|
| 538 | fi |
|---|
| 539 | AC_SUBST(master_top_builddir) |
|---|
| 540 | AC_SUBST(master_top_srcdir) |
|---|
| 541 | export master_top_builddir |
|---|
| 542 | export master_top_srcdir |
|---|
| 543 | # ---------------------------------------------------------------------------- |
|---|
| 544 | # We create this file to allow other configures to find the "master" |
|---|
| 545 | # top builddir |
|---|
| 546 | rm -f .mpich2 |
|---|
| 547 | date > .mpich2 |
|---|
| 548 | # ---------------------------------------------------------------------------- |
|---|
| 549 | # with-device |
|---|
| 550 | if test "$with_device" = "default" ; then |
|---|
| 551 | # Pick the device. For now, always choose ch3 |
|---|
| 552 | with_device=ch3 |
|---|
| 553 | fi |
|---|
| 554 | # Extract the device name from any options |
|---|
| 555 | # Allow the device to specify a directory; if no directory, use the |
|---|
| 556 | # included directories |
|---|
| 557 | # |
|---|
| 558 | DEVICE=$with_device |
|---|
| 559 | AC_SUBST(DEVICE) |
|---|
| 560 | |
|---|
| 561 | device_name=`echo $with_device | sed -e 's/:.*$//'` |
|---|
| 562 | changequote(<<,>>) |
|---|
| 563 | device_args=`echo $with_device | sed -e 's/^[^:]*//' -e 's/^://'` |
|---|
| 564 | changequote([,]) |
|---|
| 565 | |
|---|
| 566 | devicedir=$use_top_srcdir/src/mpid/$device_name |
|---|
| 567 | devicereldir=src/mpid/$device_name |
|---|
| 568 | case "$device_name" in |
|---|
| 569 | /*) |
|---|
| 570 | devicedir=$DEVICE |
|---|
| 571 | # Get the name from the leaf |
|---|
| 572 | device_name=`echo $device_name ~ sed -e 's%.*/%%'` |
|---|
| 573 | # FIXME: should the devicereldir be different (perhaps not - |
|---|
| 574 | # this allows use to build within our tree, even when other data |
|---|
| 575 | # is outside of the tree) |
|---|
| 576 | ;; |
|---|
| 577 | *) |
|---|
| 578 | ;; |
|---|
| 579 | esac |
|---|
| 580 | export device_name |
|---|
| 581 | export device_args |
|---|
| 582 | export devicedir |
|---|
| 583 | # Make the device base name and args available to generated files |
|---|
| 584 | DEVICE_NAME=$device_name |
|---|
| 585 | AC_SUBST(DEVICE_NAME) |
|---|
| 586 | DEVICE_ARGS=$device_args |
|---|
| 587 | AC_SUBST(DEVICE_ARGS) |
|---|
| 588 | # |
|---|
| 589 | # Give the device an opportunity to include a header file in mpi.h. The |
|---|
| 590 | # default value of INCLUDE_MPIDDEFS_H is set prior to the inclusion of the |
|---|
| 591 | # device's mpich2prereq script. The device's script may override the value |
|---|
| 592 | # if needed. |
|---|
| 593 | INCLUDE_MPIDDEFS_H='/* ... no device specific definitions ... */' |
|---|
| 594 | AC_SUBST(INCLUDE_MPIDDEFS_H) |
|---|
| 595 | |
|---|
| 596 | # |
|---|
| 597 | # See if the device wants to say something about the compilers (for example, |
|---|
| 598 | # the globus device may need to do this) |
|---|
| 599 | if test -f $devicedir/mpich2prereq ; then |
|---|
| 600 | . $devicedir/mpich2prereq |
|---|
| 601 | fi |
|---|
| 602 | |
|---|
| 603 | # ---------------------------------------------------------------------------- |
|---|
| 604 | # Set default library names if names haven't already been provided |
|---|
| 605 | MPILIBNAME=${MPILIBNAME:-"mpich"} |
|---|
| 606 | PMPILIBNAME_set=no |
|---|
| 607 | if test -n "$PMPILIBNAME" ; then |
|---|
| 608 | PMPILIBNAME_set=yes |
|---|
| 609 | fi |
|---|
| 610 | PMPILIBNAME=${PMPILIBNAME:-"p$MPILIBNAME"} |
|---|
| 611 | # Note that the name for this library may be updated after we check for |
|---|
| 612 | # enable_shmem |
|---|
| 613 | # Fortran names are set later. |
|---|
| 614 | # We use a different library for the C++ wrappers to avoid problems when |
|---|
| 615 | # creating shared libraries |
|---|
| 616 | if test -z "$MPICXXLIBNAME" ; then MPICXXLIBNAME="${MPILIBNAME}cxx" ; fi |
|---|
| 617 | export MPIFLIBNAME |
|---|
| 618 | export PMPIFLIBNAME |
|---|
| 619 | export MPICXXLIBNAME |
|---|
| 620 | AC_SUBST(MPICXXLIBNAME) |
|---|
| 621 | |
|---|
| 622 | # We'll set FORTRAN_BINDING to 1 if we support Fortran |
|---|
| 623 | FORTRAN_BINDING=0 |
|---|
| 624 | |
|---|
| 625 | # Set up default compiler optimization |
|---|
| 626 | MPI_DEFAULT_COPTS="-O2" |
|---|
| 627 | MPI_DEFAULT_CXXOPTS="-O2" |
|---|
| 628 | MPI_DEFAULT_FOPTS="-O2" |
|---|
| 629 | MPI_DEFAULT_F90OPTS="-O2" |
|---|
| 630 | |
|---|
| 631 | # enable-fast |
|---|
| 632 | # strip off multiple options, separated by commas |
|---|
| 633 | save_IFS="$IFS" |
|---|
| 634 | IFS="," |
|---|
| 635 | for option in $enable_fast ; do |
|---|
| 636 | case "$option" in |
|---|
| 637 | defopt) |
|---|
| 638 | enable_default_optimize=yes |
|---|
| 639 | ;; |
|---|
| 640 | nochkmsg) |
|---|
| 641 | enable_fast_nochkmsg=yes |
|---|
| 642 | ;; |
|---|
| 643 | notiming) |
|---|
| 644 | enable_timing=no |
|---|
| 645 | ;; |
|---|
| 646 | ndebug) |
|---|
| 647 | enable_append_ndebug=yes |
|---|
| 648 | ;; |
|---|
| 649 | # |
|---|
| 650 | # [BRT] removed the reseting of enable_g so that --with-enable=dbg,meminit |
|---|
| 651 | # can be specified with -enable-fast. This change was largely made for the |
|---|
| 652 | # PETSc folks who want to use --enable-fast to eliminate parameter checking |
|---|
| 653 | # overhead, but also wish to use meminit to eliminate initialization |
|---|
| 654 | # warnings from valgrind. |
|---|
| 655 | # |
|---|
| 656 | all|yes) |
|---|
| 657 | enable_default_optimize=yes |
|---|
| 658 | enable_fast_nochkmsg=yes |
|---|
| 659 | # Disable timing/logging stuffs |
|---|
| 660 | enable_timing=no |
|---|
| 661 | enable_append_ndebug=yes |
|---|
| 662 | ;; |
|---|
| 663 | O*) |
|---|
| 664 | # Allows O<n> where <n> can be [0-9] or ' '. |
|---|
| 665 | opt_flags=`echo $option | sed -e 's%\(O[0-9] \)%\1%g'` |
|---|
| 666 | if test -n "$opt_flags" ; then |
|---|
| 667 | enable_default_optimize=yes |
|---|
| 668 | MPI_DEFAULT_COPTS="-$option" |
|---|
| 669 | MPI_DEFAULT_CXXOPTS="-$option" |
|---|
| 670 | MPI_DEFAULT_FOPTS="-$option" |
|---|
| 671 | MPI_DEFAULT_F90OPTS="-$option" |
|---|
| 672 | else |
|---|
| 673 | AC_MSG_WARN([Unknown value $option for --enable-fast]) |
|---|
| 674 | fi |
|---|
| 675 | ;; |
|---|
| 676 | none|no) |
|---|
| 677 | enable_default_optimize=no |
|---|
| 678 | enable_fast_nochkmsg=no |
|---|
| 679 | # Reset timing/logging stuffs to when --enable-timing isn't specified. |
|---|
| 680 | enable_timing=default |
|---|
| 681 | enable_append_ndebug=no |
|---|
| 682 | ;; |
|---|
| 683 | *) |
|---|
| 684 | AC_MSG_WARN([Unknown value $option for --enable-fast]) |
|---|
| 685 | ;; |
|---|
| 686 | esac |
|---|
| 687 | done |
|---|
| 688 | IFS="$save_IFS" |
|---|
| 689 | |
|---|
| 690 | # ---------------------------------------------------------------------------- |
|---|
| 691 | # Process any enable or with values |
|---|
| 692 | # We must do enable-fast first, because it changes the other enable values |
|---|
| 693 | if test "$enable_fast_nochkmsg" = "yes" ; then |
|---|
| 694 | enable_error_checking=no |
|---|
| 695 | # Export a variable that will allow the test suite to detect that |
|---|
| 696 | # MPICH has no error testing |
|---|
| 697 | MPICH_FAST=yes |
|---|
| 698 | export MPICH_FAST |
|---|
| 699 | fi |
|---|
| 700 | |
|---|
| 701 | # error-checking |
|---|
| 702 | case "$enable_error_checking" in |
|---|
| 703 | no) |
|---|
| 704 | # if error checking has been diabled, then automatically diable the error |
|---|
| 705 | # checking tests in the test suite |
|---|
| 706 | ac_configure_args="${ac_configure_args} --disable-checkerrors" |
|---|
| 707 | ;; |
|---|
| 708 | all|yes|runtime) |
|---|
| 709 | error_checking_kind=`echo $enable_error_checking | \ |
|---|
| 710 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
|---|
| 711 | error_checking_kind=MPID_ERROR_LEVEL_$error_checking_kind |
|---|
| 712 | AC_DEFINE_UNQUOTED(HAVE_ERROR_CHECKING,$error_checking_kind,[Define to enable error checking]) |
|---|
| 713 | ;; |
|---|
| 714 | *) |
|---|
| 715 | AC_MSG_WARN([Unknown value $enable_error_checking for enable-error-checking]) |
|---|
| 716 | ;; |
|---|
| 717 | esac |
|---|
| 718 | |
|---|
| 719 | # error-messages |
|---|
| 720 | case "$enable_error_messages" in |
|---|
| 721 | no|none) |
|---|
| 722 | error_message_kind="MPICH_ERROR_MSG_NONE" |
|---|
| 723 | ;; |
|---|
| 724 | all|yes) |
|---|
| 725 | error_message_kind="MPICH_ERROR_MSG_ALL" |
|---|
| 726 | ;; |
|---|
| 727 | generic) |
|---|
| 728 | error_message_kind="MPICH_ERROR_MSG_GENERIC" |
|---|
| 729 | ;; |
|---|
| 730 | class) |
|---|
| 731 | error_message_kind="MPICH_ERROR_MSG_CLASS" |
|---|
| 732 | ;; |
|---|
| 733 | *) |
|---|
| 734 | AC_MSG_WARN([Unknown value $enable_error_messages for enable-error-messages]) |
|---|
| 735 | ;; |
|---|
| 736 | esac |
|---|
| 737 | AC_DEFINE_UNQUOTED(MPICH_ERROR_MSG_LEVEL,$error_message_kind,[define to enable error messages]) |
|---|
| 738 | |
|---|
| 739 | # ---------------------------------------------------------------------------- |
|---|
| 740 | # |
|---|
| 741 | # enable-timing and with-logging |
|---|
| 742 | # |
|---|
| 743 | # Still to do: add subsets: e.g., class=pt2pt,class=coll. See mpich2 doc |
|---|
| 744 | # |
|---|
| 745 | # Logging and timing are intertwined. If you select logging, you |
|---|
| 746 | # may also need to select a timing level. If no timing is selected |
|---|
| 747 | # but logging with rlog is selected, make "all" the default timing level. |
|---|
| 748 | # |
|---|
| 749 | # FIXME: make timing and logging options work more cleanly together, |
|---|
| 750 | # particularly when other logging options are selected (e.g., logging is not |
|---|
| 751 | # rlog). |
|---|
| 752 | # ---------------------------------------------------------------------------- |
|---|
| 753 | collect_stats=false |
|---|
| 754 | logging_required=false |
|---|
| 755 | if test "$enable_timing" = "default" ; then |
|---|
| 756 | if test "$with_logging" = "rlog" ; then |
|---|
| 757 | enable_timing=all |
|---|
| 758 | fi |
|---|
| 759 | fi |
|---|
| 760 | timing_name=$enable_timing |
|---|
| 761 | case "$enable_timing" in |
|---|
| 762 | no) |
|---|
| 763 | timing_name=none |
|---|
| 764 | ;; |
|---|
| 765 | time) |
|---|
| 766 | collect_stats=true |
|---|
| 767 | ;; |
|---|
| 768 | log|log_detailed) |
|---|
| 769 | logging_required=true |
|---|
| 770 | ;; |
|---|
| 771 | yes) |
|---|
| 772 | timing_name=all |
|---|
| 773 | collect_stats=true |
|---|
| 774 | logging_required=true |
|---|
| 775 | ;; |
|---|
| 776 | all|runtime) |
|---|
| 777 | collect_stats=true |
|---|
| 778 | logging_required=true |
|---|
| 779 | ;; |
|---|
| 780 | none|default) |
|---|
| 781 | timing_name=none |
|---|
| 782 | ;; |
|---|
| 783 | *) |
|---|
| 784 | AC_MSG_WARN([Unknown value $enable_timing for enable-timing]) |
|---|
| 785 | enable_timing=no |
|---|
| 786 | timing_name=none |
|---|
| 787 | ;; |
|---|
| 788 | esac |
|---|
| 789 | # |
|---|
| 790 | # The default logging package is rlog; you can get it by |
|---|
| 791 | # specifying --with-logging or --with-logging=rlog |
|---|
| 792 | # |
|---|
| 793 | case $with_logging in |
|---|
| 794 | yes) |
|---|
| 795 | logging_name=rlog |
|---|
| 796 | ;; |
|---|
| 797 | no|none) |
|---|
| 798 | logging_name=none |
|---|
| 799 | ;; |
|---|
| 800 | default) |
|---|
| 801 | if test "$logging_required" = "true" ; then |
|---|
| 802 | logging_name=rlog |
|---|
| 803 | else |
|---|
| 804 | logging_name=none |
|---|
| 805 | fi |
|---|
| 806 | ;; |
|---|
| 807 | *) |
|---|
| 808 | logging_name=$with_logging |
|---|
| 809 | ;; |
|---|
| 810 | esac |
|---|
| 811 | # |
|---|
| 812 | # Include the selected logging subsystem |
|---|
| 813 | # |
|---|
| 814 | # Choices: |
|---|
| 815 | # 1) A subdir of src/util/logging |
|---|
| 816 | # This directory must contain a configure which will be executed |
|---|
| 817 | # to build the |
|---|
| 818 | # 2) An external directory |
|---|
| 819 | # This directory must contain |
|---|
| 820 | # a mpilogging.h file |
|---|
| 821 | # It may contain |
|---|
| 822 | # a setup_logging script |
|---|
| 823 | # a configure |
|---|
| 824 | # |
|---|
| 825 | # |
|---|
| 826 | logging_subsystems= |
|---|
| 827 | if test "$logging_name" != "none" ; then |
|---|
| 828 | # Check for an external name (directory containing a /) |
|---|
| 829 | hasSlash=`echo A$logging_name | sed -e 's%[[^/]]%%g'` |
|---|
| 830 | if test -n "$hasSlash" ; then |
|---|
| 831 | # Check that the external logging system is complete. |
|---|
| 832 | # Any failure will cause configure to abort |
|---|
| 833 | if test ! -d $logging_name ; then |
|---|
| 834 | AC_MSG_ERROR([External logging directory $logging_name not found. Configure aborted]) |
|---|
| 835 | logging_name=none |
|---|
| 836 | elif test ! -s $logging_name/mpilogging.h ; then |
|---|
| 837 | AC_MSG_ERROR([External logging header $logging_name/mpilogging.h not found. Configure aborted]) |
|---|
| 838 | logging_name=none |
|---|
| 839 | fi |
|---|
| 840 | |
|---|
| 841 | logdir=$logging_name |
|---|
| 842 | # Force the logdir to be absolute |
|---|
| 843 | logdir=`cd $logdir && pwd` |
|---|
| 844 | # Switch name to "external" because that is how the MPICH2 |
|---|
| 845 | # code will know it |
|---|
| 846 | logging_name=external |
|---|
| 847 | # Add the dir to the include paths |
|---|
| 848 | #CPPFLAGS="$CPPFLAGS -I$logdir" |
|---|
| 849 | MPICH2_INCLUDE_FLAGS="$MPICH2_INCLUDE_FLAGS -I$logdir" |
|---|
| 850 | EXTERNAL_SRC_DIRS="$EXTERNAL_SRC_DIRS $logdir" |
|---|
| 851 | # Add to the list of external modules to setup |
|---|
| 852 | if test -x $logdir/setup_logging ; then |
|---|
| 853 | EXTERNAL_SETUPS="$EXTERNAL_SETUPS $logdir/setup_logging" |
|---|
| 854 | fi |
|---|
| 855 | else |
|---|
| 856 | logdir=$srcdir/src/util/logging |
|---|
| 857 | logreldir=src/util/logging/$logging_name |
|---|
| 858 | logging_subsystems="$logging_subsystems $logreldir" |
|---|
| 859 | logging_subdirs=$logging_name |
|---|
| 860 | for dir in $logging_subdirs ; do |
|---|
| 861 | if test ! -d $logdir/$dir ; then |
|---|
| 862 | AC_MSG_ERROR([$logdir/$dir does not exist. Configure aborted]) |
|---|
| 863 | logging_name=none |
|---|
| 864 | fi |
|---|
| 865 | done |
|---|
| 866 | for dir in $logging_subsystems ; do |
|---|
| 867 | if test ! -x $srcdir/$dir/configure ; then |
|---|
| 868 | AC_MSG_ERROR([$logdir/$dir has no configure (required). Configure aborted]) |
|---|
| 869 | logging_name=none |
|---|
| 870 | fi |
|---|
| 871 | other_install_dirs="${other_install_dirs} $logreldir" |
|---|
| 872 | done |
|---|
| 873 | fi |
|---|
| 874 | fi |
|---|
| 875 | # |
|---|
| 876 | # FIXME: Logging doesn't necessarily require timing (e.g., simply logging the |
|---|
| 877 | # sequence of routines). |
|---|
| 878 | if test "$logging_name" != "none" ; then |
|---|
| 879 | if test "$enable_timing" != "no" ; then |
|---|
| 880 | if test "$enable_timing" = "default" -o "$enable_timing" = "none" ; then |
|---|
| 881 | enable_timing=log |
|---|
| 882 | timing_name=log |
|---|
| 883 | fi |
|---|
| 884 | logging_dir=logging |
|---|
| 885 | subsystems="$subsystems $logging_subsystems" |
|---|
| 886 | else |
|---|
| 887 | AC_MSG_WARN([Timing was disabled. Logging has been disabled as well.]) |
|---|
| 888 | with_logging=no |
|---|
| 889 | logging_name=none |
|---|
| 890 | logging_dir= |
|---|
| 891 | logging_subdirs= |
|---|
| 892 | fi |
|---|
| 893 | else |
|---|
| 894 | if test "$logging_required" = "true" ; then |
|---|
| 895 | AC_MSG_WARN([Timing was enabled with log option but no logging library is available. Timing has been disabled.]) |
|---|
| 896 | enable_timing=no |
|---|
| 897 | timing_name=none |
|---|
| 898 | fi |
|---|
| 899 | logging_dir= |
|---|
| 900 | logging_subdirs= |
|---|
| 901 | fi |
|---|
| 902 | if test "$timing_name" != "none" ; then |
|---|
| 903 | timing_kind=`echo $timing_name | \ |
|---|
| 904 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
|---|
| 905 | timing_kind=MPID_TIMING_KIND_$timing_kind |
|---|
| 906 | AC_DEFINE_UNQUOTED(HAVE_TIMING,$timing_kind,[define to enable timing collection]) |
|---|
| 907 | if test "$collect_stats" = "true" ; then |
|---|
| 908 | AC_DEFINE(COLLECT_STATS,1,[define to enable collection of statistics]) |
|---|
| 909 | fi |
|---|
| 910 | fi |
|---|
| 911 | # |
|---|
| 912 | AC_SUBST(logging_dir) |
|---|
| 913 | AC_SUBST(logging_name) |
|---|
| 914 | AC_SUBST(logging_subdirs) |
|---|
| 915 | use_logging_variable="MPID_LOGGING_`echo $logging_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`" |
|---|
| 916 | AC_DEFINE_UNQUOTED(USE_LOGGING,$use_logging_variable,[define to choose logging library]) |
|---|
| 917 | # ---------------------------------------------------------------------------- |
|---|
| 918 | # End of logging tests |
|---|
| 919 | # ---------------------------------------------------------------------------- |
|---|
| 920 | |
|---|
| 921 | # ---------------------------------------------------------------------------- |
|---|
| 922 | # Check to see if the device does not support spawn. |
|---|
| 923 | # FIXME: This should provide the option of not building the dynamic |
|---|
| 924 | # process routines. It could also allow us to specialize support |
|---|
| 925 | # for all processes are members of MPI_COMM_WORLD (only one comm_world). |
|---|
| 926 | # ---------------------------------------------------------------------------- |
|---|
| 927 | if test "$MPID_NO_SPAWN" = yes ; then |
|---|
| 928 | AC_MSG_WARN([The device $with_device does not support MPI dynamic process routines]) |
|---|
| 929 | fi |
|---|
| 930 | |
|---|
| 931 | |
|---|
| 932 | # ---------------------------------------------------------------------------- |
|---|
| 933 | # atomic operations |
|---|
| 934 | # ---------------------------------------------------------------------------- |
|---|
| 935 | # FIXME TODO eventually delete the src/mpid/common/locks directory |
|---|
| 936 | subsystems="$subsystems src/mpid/common/locks" |
|---|
| 937 | |
|---|
| 938 | opadir="${use_top_srcdir}/src/openpa" |
|---|
| 939 | if test -e "$opadir" ; then |
|---|
| 940 | EXTERNAL_SRC_DIRS="$EXTERNAL_SRC_DIRS src/openpa" |
|---|
| 941 | # this must go in CPPFLAGS intead of MPICH2_INCLUDE_FLAGS because we need it |
|---|
| 942 | # to be available to lower-level configure scripts |
|---|
| 943 | CPPFLAGS="$CPPFLAGS -I${use_top_srcdir}/src/openpa/src -I${master_top_builddir}/src/openpa/src" |
|---|
| 944 | # openpa needs to go at the front of the devsubsystems because it needs to |
|---|
| 945 | # be configured before the device itself (e.g. nemesis). |
|---|
| 946 | devsubsystems="src/openpa $devsubsystems" |
|---|
| 947 | other_install_dirs="$other_install_dirs src/openpa" |
|---|
| 948 | fi |
|---|
| 949 | |
|---|
| 950 | # ---------------------------------------------------------------------------- |
|---|
| 951 | # Threads |
|---|
| 952 | # ---------------------------------------------------------------------------- |
|---|
| 953 | # |
|---|
| 954 | # Threads must be supported by the device. First, set the default to |
|---|
| 955 | # be the highest supported by the device |
|---|
| 956 | if test "$enable_threads" = default ; then |
|---|
| 957 | if test -n "$MPID_MAX_THREAD_LEVEL" ; then |
|---|
| 958 | case $MPID_MAX_THREAD_LEVEL in |
|---|
| 959 | MPI_THREAD_SINGLE) enable_threads=single ;; |
|---|
| 960 | MPI_THREAD_FUNNELED) enable_threads=funneled ;; |
|---|
| 961 | MPI_THREAD_SERIALIZED) enable_threads=serialized ;; |
|---|
| 962 | MPI_THREAD_MULTIPLE) enable_threads=runtime ;; |
|---|
| 963 | *) AC_MSG_ERROR([Unrecognized thread level from device $MPID_MAX_THREAD_LEVEL]) |
|---|
| 964 | ;; |
|---|
| 965 | esac |
|---|
| 966 | else |
|---|
| 967 | enable_threads=single |
|---|
| 968 | fi |
|---|
| 969 | fi |
|---|
| 970 | |
|---|
| 971 | if test "$enable_threads" = "yes" ; then |
|---|
| 972 | enable_threads=multiple |
|---|
| 973 | elif test "$enable_threads" = "no" ; then |
|---|
| 974 | enable_threads=single |
|---|
| 975 | elif test "$enable_threads" = "default"; then |
|---|
| 976 | if test "$with_device" = "default" -o "$with_device" = "ch3:sock" ; then |
|---|
| 977 | enable_threads=runtime |
|---|
| 978 | fi |
|---|
| 979 | fi |
|---|
| 980 | # Runtime is an alias for multiple with an additional value |
|---|
| 981 | if test "$enable_threads" = "runtime" ; then |
|---|
| 982 | AC_DEFINE(HAVE_RUNTIME_THREADCHECK,1,[Define if MPI supports MPI_THREAD_MULTIPLE with a runtime check for thread level]) |
|---|
| 983 | enable_threads=multiple |
|---|
| 984 | # FIXME: This doesn't support runtime:thread-impl (as in multiple:thread-impl) |
|---|
| 985 | fi |
|---|
| 986 | |
|---|
| 987 | MPICH_THREAD_LEVEL=MPI_THREAD_FUNNELED |
|---|
| 988 | case "$enable_threads" in |
|---|
| 989 | single) |
|---|
| 990 | thread_pkg_required=no |
|---|
| 991 | thread_impl=none |
|---|
| 992 | MPICH_THREAD_LEVEL=MPI_THREAD_SINGLE |
|---|
| 993 | ;; |
|---|
| 994 | funneled) |
|---|
| 995 | thread_pkg_required=no |
|---|
| 996 | thread_impl=none |
|---|
| 997 | MPICH_THREAD_LEVEL=MPI_THREAD_FUNNELED |
|---|
| 998 | ;; |
|---|
| 999 | serialized) |
|---|
| 1000 | # FIXME: Why does serialized require a thread package? |
|---|
| 1001 | thread_pkg_required=yes |
|---|
| 1002 | thread_impl=none |
|---|
| 1003 | MPICH_THREAD_LEVEL=MPI_THREAD_SERIALIZED |
|---|
| 1004 | ;; |
|---|
| 1005 | multiple) |
|---|
| 1006 | thread_pkg_required=yes |
|---|
| 1007 | thread_impl=global_mutex |
|---|
| 1008 | MPICH_THREAD_LEVEL=MPI_THREAD_MULTIPLE |
|---|
| 1009 | ;; |
|---|
| 1010 | multiple:*) |
|---|
| 1011 | thread_pkg_required=yes |
|---|
| 1012 | thread_impl="`echo $enable_threads | sed -e 's/.*://'`" |
|---|
| 1013 | MPICH_THREAD_LEVEL=MPI_THREAD_MULTIPLE |
|---|
| 1014 | case "$thread_impl" in |
|---|
| 1015 | global_mutex) |
|---|
| 1016 | ;; |
|---|
| 1017 | # global_monitor) |
|---|
| 1018 | # ;; |
|---|
| 1019 | *) |
|---|
| 1020 | AC_MSG_ERROR(["$thread_impl" is not a valid multi-thread implementation for MPICH2]) |
|---|
| 1021 | ;; |
|---|
| 1022 | esac |
|---|
| 1023 | ;; |
|---|
| 1024 | *) |
|---|
| 1025 | AC_MSG_ERROR(["$enable_threads" is not a valid value for --enable-threads]) |
|---|
| 1026 | ;; |
|---|
| 1027 | esac |
|---|
| 1028 | # Check that the requested thread level is available. |
|---|
| 1029 | threadLevelOK=yes |
|---|
| 1030 | if test -z "$MPID_MAX_THREAD_LEVEL" ; then |
|---|
| 1031 | if test "$MPICH_THREAD_LEVEL" = "MPI_THREAD_MULTIPLE" -o "$MPICH_THREAD_LEVEL" = "MPI_THREAD_SERIALIZED" ; then |
|---|
| 1032 | threadLevelOK=no |
|---|
| 1033 | fi |
|---|
| 1034 | else |
|---|
| 1035 | # Check that MPID_MAX_THREAD_LEVEL is at least as large as the |
|---|
| 1036 | # selected MPICH_THREAD_LEVEL |
|---|
| 1037 | case $MPICH_THREAD_LEVEL in |
|---|
| 1038 | MPI_THREAD_MULTIPLE) |
|---|
| 1039 | if test "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_MULTIPLE" ; then |
|---|
| 1040 | threadLevelOK=no |
|---|
| 1041 | fi |
|---|
| 1042 | ;; |
|---|
| 1043 | MPI_THREAD_SERIALIZED) |
|---|
| 1044 | if test "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_MULTIPLE" -a \ |
|---|
| 1045 | "$MPID_MAX_THREAD_LEVEL" != "MPI_THREAD_SERIALIZED" ; then |
|---|
| 1046 | threadLevelOK=no |
|---|
| 1047 | fi |
|---|
| 1048 | ;; |
|---|
| 1049 | MPI_THREAD_FUNNELED) |
|---|
| 1050 | if test "$MPID_MAX_THREAD_LEVEL" = "MPI_THREAD_SINGLE" ; then |
|---|
| 1051 | threadLevelOK=no |
|---|
| 1052 | fi |
|---|
| 1053 | ;; |
|---|
| 1054 | MPI_THREAD_SINGLE) |
|---|
| 1055 | ;; |
|---|
| 1056 | esac |
|---|
| 1057 | fi |
|---|
| 1058 | if test "$threadLevelOK" != yes ; then |
|---|
| 1059 | AC_MSG_ERROR([The device $with_device does not support $MPICH_THREAD_LEVEL]) |
|---|
| 1060 | fi |
|---|
| 1061 | |
|---|
| 1062 | export MPICH_THREAD_LEVEL |
|---|
| 1063 | AC_DEFINE_UNQUOTED(MPICH_THREAD_LEVEL,$MPICH_THREAD_LEVEL,[Level of thread support selected at compile time]) |
|---|
| 1064 | |
|---|
| 1065 | MPICH_THREAD_IMPL="MPICH_THREAD_IMPL_`echo $thread_impl | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`" |
|---|
| 1066 | export MPICH_THREAD_IMPL |
|---|
| 1067 | AC_DEFINE_UNQUOTED(USE_THREAD_IMPL,$MPICH_THREAD_IMPL,[Multi-threaded implementation selected at compile time]) |
|---|
| 1068 | |
|---|
| 1069 | if test "$thread_pkg_required" = "no" ; then |
|---|
| 1070 | MPE_THREAD_DEFAULT=${MPE_THREAD_DEFAULT:-none} |
|---|
| 1071 | fi |
|---|
| 1072 | export MPE_THREAD_DEFAULT |
|---|
| 1073 | |
|---|
| 1074 | # Check for value thread_cs choice; set the refcount default if necessary |
|---|
| 1075 | thread_granularity=0 |
|---|
| 1076 | thread_refcount=0 |
|---|
| 1077 | if test "$enable_threads" = "multiple" ; then |
|---|
| 1078 | case $enable_thread_cs in |
|---|
| 1079 | global) |
|---|
| 1080 | thread_granularity=MPIU_THREAD_GRANULARITY_GLOBAL |
|---|
| 1081 | if test "$enable_refcount" = "default" ; then enable_refcount=none ; fi |
|---|
| 1082 | ;; |
|---|
| 1083 | brief-global|brief_global) |
|---|
| 1084 | thread_granularity=MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL |
|---|
| 1085 | if test "$enable_refcount" = "default" ; then enable_refcount=lock ; fi |
|---|
| 1086 | ;; |
|---|
| 1087 | per-object|per_object) |
|---|
| 1088 | thread_granularity=MPIU_THREAD_GRANULARITY_PER_OBJECT |
|---|
| 1089 | if test "$enable_refcount" = "default" ; then enable_refcount=lock ; fi |
|---|
| 1090 | ;; |
|---|
| 1091 | lock-free|lock_free|lockfree) |
|---|
| 1092 | thread_granularity=MPIU_THREAD_GRANULARITY_LOCK_FREE |
|---|
| 1093 | if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi |
|---|
| 1094 | ;; |
|---|
| 1095 | *) |
|---|
| 1096 | AC_MSG_ERROR([Unrecognized value $enable_thread_cs for --enable-thread-cs]) |
|---|
| 1097 | ;; |
|---|
| 1098 | esac |
|---|
| 1099 | |
|---|
| 1100 | case $enable_refcount in |
|---|
| 1101 | lock) |
|---|
| 1102 | thread_refcount=MPIU_REFCOUNT_LOCK |
|---|
| 1103 | ;; |
|---|
| 1104 | lock-free|lock_free|lockfree) |
|---|
| 1105 | thread_refcount=MPIU_REFCOUNT_LOCKFREE |
|---|
| 1106 | ;; |
|---|
| 1107 | none) |
|---|
| 1108 | thread_refcount=MPIU_REFCOUNT_NONE |
|---|
| 1109 | ;; |
|---|
| 1110 | *) |
|---|
| 1111 | AC_MSG_ERROR([Unrecognized value $enable_refcount for --enable-refcount]) |
|---|
| 1112 | ;; |
|---|
| 1113 | esac |
|---|
| 1114 | fi |
|---|
| 1115 | AC_DEFINE_UNQUOTED([MPIU_THREAD_GRANULARITY],$thread_granularity,[Method used to implement atomic updates and access]) |
|---|
| 1116 | |
|---|
| 1117 | case $enable_handle_allocation in |
|---|
| 1118 | mutex|default) |
|---|
| 1119 | handle_allocation_method=MPIU_HANDLE_ALLOCATION_MUTEX |
|---|
| 1120 | ;; |
|---|
| 1121 | tls) |
|---|
| 1122 | handle_allocation_method=MPIU_HANDLE_ALLOCATION_THREAD_LOCAL |
|---|
| 1123 | ;; |
|---|
| 1124 | *) |
|---|
| 1125 | AC_MSG_ERROR([Unrecognized value $enable_handle_allocation for --enable-handle-allocation]) |
|---|
| 1126 | ;; |
|---|
| 1127 | esac |
|---|
| 1128 | AC_DEFINE_UNQUOTED([MPIU_HANDLE_ALLOCATION_METHOD],$handle_allocation_method,[Method used to allocate MPI object handles]) |
|---|
| 1129 | |
|---|
| 1130 | |
|---|
| 1131 | AC_DEFINE_UNQUOTED([MPIU_THREAD_REFCOUNT],$thread_refcount,[Method used to implement refcount updates]) |
|---|
| 1132 | |
|---|
| 1133 | # enable-g |
|---|
| 1134 | # strip off multiple options, separated by commas |
|---|
| 1135 | save_IFS="$IFS" |
|---|
| 1136 | IFS="," |
|---|
| 1137 | for option in $enable_g ; do |
|---|
| 1138 | case "$option" in |
|---|
| 1139 | debug|dbg) |
|---|
| 1140 | enable_append_g=yes |
|---|
| 1141 | ;; |
|---|
| 1142 | no|none) |
|---|
| 1143 | ;; |
|---|
| 1144 | handlealloc) |
|---|
| 1145 | perform_handlealloc=yes |
|---|
| 1146 | ;; |
|---|
| 1147 | handle) |
|---|
| 1148 | AC_DEFINE(MPICH_DEBUG_HANDLES,1,[Define to enable handle checking]) |
|---|
| 1149 | ;; |
|---|
| 1150 | meminit) |
|---|
| 1151 | perform_meminit=yes |
|---|
| 1152 | ;; |
|---|
| 1153 | memarena) |
|---|
| 1154 | perform_memarena=yes |
|---|
| 1155 | perform_memtracing=yes |
|---|
| 1156 | ;; |
|---|
| 1157 | nesting) |
|---|
| 1158 | perform_nesttesting=yes |
|---|
| 1159 | ;; |
|---|
| 1160 | fine-grain-nesting|fg-nesting) |
|---|
| 1161 | perform_fg_nesttesting=yes |
|---|
| 1162 | ;; |
|---|
| 1163 | mem) |
|---|
| 1164 | perform_memtracing=yes |
|---|
| 1165 | ;; |
|---|
| 1166 | log) |
|---|
| 1167 | perform_dbglog=yes |
|---|
| 1168 | ;; |
|---|
| 1169 | mutex) |
|---|
| 1170 | perform_dbgmutex=yes |
|---|
| 1171 | ;; |
|---|
| 1172 | mutexnesting) |
|---|
| 1173 | perform_mutexnesting=yes |
|---|
| 1174 | ;; |
|---|
| 1175 | all|yes) |
|---|
| 1176 | perform_memtracing=yes |
|---|
| 1177 | perform_nesttesting=yes |
|---|
| 1178 | perform_dbglog=yes |
|---|
| 1179 | enable_append_g=yes |
|---|
| 1180 | perform_meminit=yes |
|---|
| 1181 | perform_dbgmutex=yes |
|---|
| 1182 | perform_mutexnesting=yes |
|---|
| 1183 | perform_handlealloc=yes |
|---|
| 1184 | ;; |
|---|
| 1185 | *) |
|---|
| 1186 | AC_MSG_WARN([Unknown value $enable_g for enable-g]) |
|---|
| 1187 | ;; |
|---|
| 1188 | esac |
|---|
| 1189 | done |
|---|
| 1190 | IFS="$save_IFS" |
|---|
| 1191 | |
|---|
| 1192 | # MPICH2_EXTRA_xFLAGS contains MPICH2LIB_xFLAGS and |
|---|
| 1193 | # all the extra compiler flags added by MPICH2. |
|---|
| 1194 | # Initial all MPICH2_EXTRA_xFLAGS to empty string. |
|---|
| 1195 | MPICH2_EXTRA_CFLAGS="" |
|---|
| 1196 | MPICH2_EXTRA_CXXFLAGS="" |
|---|
| 1197 | MPICH2_EXTRA_FFLAGS="" |
|---|
| 1198 | MPICH2_EXTRA_F90FLAGS="" |
|---|
| 1199 | |
|---|
| 1200 | if test "$enable_append_g" = "yes" ; then |
|---|
| 1201 | CFLAGS="$CFLAGS -g" |
|---|
| 1202 | CXXFLAGS="$CXXFLAGS -g" |
|---|
| 1203 | FFLAGS="$FFLAGS -g" |
|---|
| 1204 | F90FLAGS="$F90FLAGS -g" |
|---|
| 1205 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS -g" |
|---|
| 1206 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS -g" |
|---|
| 1207 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS -g" |
|---|
| 1208 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS -g" |
|---|
| 1209 | fi |
|---|
| 1210 | if test "$enable_append_ndebug" = "yes" ; then |
|---|
| 1211 | CFLAGS="$CFLAGS -DNDEBUG" |
|---|
| 1212 | CXXFLAGS="$CXXFLAGS -DNDEBUG" |
|---|
| 1213 | FFLAGS="$FFLAGS -DNDEBUG" |
|---|
| 1214 | F90FLAGS="$F90FLAGS -DNDEBUG" |
|---|
| 1215 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS -DNDEBUG" |
|---|
| 1216 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS -DNDEBUG" |
|---|
| 1217 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS -DNDEBUG" |
|---|
| 1218 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS -DNDEBUG" |
|---|
| 1219 | fi |
|---|
| 1220 | if test -n "$perform_meminit" ; then |
|---|
| 1221 | AC_DEFINE(MPICH_DEBUG_MEMINIT,1,[Define to enable preinitialization of memory used by structures and unions]) |
|---|
| 1222 | fi |
|---|
| 1223 | if test "$perform_handlealloc" = yes ; then |
|---|
| 1224 | AC_DEFINE(MPICH_DEBUG_HANDLEALLOC,1,[Define to enable checking of handles still allocated at MPI_Finalize]) |
|---|
| 1225 | fi |
|---|
| 1226 | |
|---|
| 1227 | if test -n "$perform_memtracing" ; then |
|---|
| 1228 | enable_g_mem=yes |
|---|
| 1229 | AC_DEFINE(USE_MEMORY_TRACING,1,[Define to enable memory tracing]) |
|---|
| 1230 | if test -n "$perform_memarena" ; then |
|---|
| 1231 | AC_DEFINE(MPICH_DEBUG_MEMARENA,1,[Define if each function exit should confirm memory arena correctness]) |
|---|
| 1232 | fi |
|---|
| 1233 | fi |
|---|
| 1234 | if test -n "$perform_nesttesting" ; then |
|---|
| 1235 | AC_DEFINE(MPICH_DEBUG_NESTING,1,[Define to check nesting level on exit]) |
|---|
| 1236 | fi |
|---|
| 1237 | if test -n "$perform_mutexnesting" ; then |
|---|
| 1238 | AC_DEFINE(MPICH_DEBUG_MUTEXNESTING,1,[Define to check nesting in mutexes]) |
|---|
| 1239 | fi |
|---|
| 1240 | if test -n "$perform_fg_nesttesting" ; then |
|---|
| 1241 | AC_DEFINE(MPICH_DEBUG_FINE_GRAIN_NESTING,1,[Define to perform a fine-grain nesting level check on exit]) |
|---|
| 1242 | fi |
|---|
| 1243 | if test -n "$perform_dbglog" ; then |
|---|
| 1244 | if test "$with_logging" != "none" ; then |
|---|
| 1245 | AC_MSG_WARN([--with-logging overrides --enable-g=log]) |
|---|
| 1246 | else |
|---|
| 1247 | AC_DEFINE(USE_DBG_LOGGING,1,[Define to enable logging macros]) |
|---|
| 1248 | fi |
|---|
| 1249 | fi |
|---|
| 1250 | |
|---|
| 1251 | if test -n "$perform_dbgmutex" ; then |
|---|
| 1252 | AC_DEFINE(MPICH_DEBUG_MUTEX,1,[Define to enable mutex debugging]) |
|---|
| 1253 | fi |
|---|
| 1254 | |
|---|
| 1255 | pac_cross_compiling=no |
|---|
| 1256 | if test "$with_cross" != "no" ; then |
|---|
| 1257 | if test -s "$with_cross" ; then |
|---|
| 1258 | AC_MSG_RESULT([Reading values from cross-compilation file $with_cross]) |
|---|
| 1259 | . $with_cross |
|---|
| 1260 | # Autoconf 2.52 no longer sets cross_compiling except with the |
|---|
| 1261 | # awkward "targethost" options. |
|---|
| 1262 | pac_cross_compiling=yes |
|---|
| 1263 | cross_compiling=yes |
|---|
| 1264 | ac_cv_prog_cc_cross=yes |
|---|
| 1265 | ac_cv_prog_f77_cross=yes |
|---|
| 1266 | ac_cv_prog_f90_cross=yes |
|---|
| 1267 | ac_cv_prog_cxx_cross=yes |
|---|
| 1268 | export cross_compiling |
|---|
| 1269 | # Export all cross variables. Any subsidiary configure should also |
|---|
| 1270 | # export CROSS_xxx |
|---|
| 1271 | rm -f confcross |
|---|
| 1272 | (set) 2>&1 | grep CROSS_ | \ |
|---|
| 1273 | sed -e 's/^/export /g' -e 's/=.*//g' > confcross |
|---|
| 1274 | . confcross |
|---|
| 1275 | rm -f confcross |
|---|
| 1276 | fi |
|---|
| 1277 | fi |
|---|
| 1278 | |
|---|
| 1279 | if test "$enable_nmpi_as_mpi" = yes ; then |
|---|
| 1280 | AC_DEFINE(USE_MPI_FOR_NMPI,1,[Define if the NMPI names should use MPI instead of PMPI]) |
|---|
| 1281 | fi |
|---|
| 1282 | |
|---|
| 1283 | # This goes here because we need the top_srcdir |
|---|
| 1284 | FROM_MPICH2=yes |
|---|
| 1285 | export FROM_MPICH2 |
|---|
| 1286 | if test "$enable_romio" = "yes" ; then |
|---|
| 1287 | if test -d $use_top_srcdir/src/mpi/romio ; then |
|---|
| 1288 | subsystems="$subsystems src/mpi/romio" |
|---|
| 1289 | AC_DEFINE(HAVE_ROMIO,1,[Define if ROMIO is enabled]) |
|---|
| 1290 | # Set environment variables that the romio configure expects |
|---|
| 1291 | romio_dir=romio |
|---|
| 1292 | AC_SUBST(romio_dir) |
|---|
| 1293 | export use_top_srcdir |
|---|
| 1294 | top_build_dir=`pwd` |
|---|
| 1295 | export top_build_dir |
|---|
| 1296 | # if there is no $top_build_dir/lib, romio puts lib in wrong place |
|---|
| 1297 | # This test used -e under Linux, but not all test programs understand |
|---|
| 1298 | # -e |
|---|
| 1299 | if test ! -d lib ; then mkdir lib ; fi |
|---|
| 1300 | # tell mpi.h to include mpio.h |
|---|
| 1301 | PAC_HAVE_ROMIO |
|---|
| 1302 | else |
|---|
| 1303 | AC_MSG_WARN([ROMIO src directory is not available]) |
|---|
| 1304 | fi |
|---|
| 1305 | fi |
|---|
| 1306 | # |
|---|
| 1307 | # FIXME: If an external device, don't necessarily complain (e.g., |
|---|
| 1308 | # if the device is already built) |
|---|
| 1309 | if test ! -d $devicedir ; then |
|---|
| 1310 | dnl WAIT UNTIL WE INCLUDE A DEVICE |
|---|
| 1311 | dnl AC_MSG_ERROR([Device $device_name is unknown)] |
|---|
| 1312 | AC_MSG_WARN([Device $device_name is unknown]) |
|---|
| 1313 | elif test ! -x $devicedir/configure ; then |
|---|
| 1314 | if test -s $devicedir/configure ; then |
|---|
| 1315 | AC_MSG_WARN([The configure in $devicedir exists but is not executable]) |
|---|
| 1316 | else |
|---|
| 1317 | AC_MSG_WARN([Device $device_name has no configure]) |
|---|
| 1318 | fi |
|---|
| 1319 | device_name="" |
|---|
| 1320 | else |
|---|
| 1321 | # Add the device to the configure list |
|---|
| 1322 | devsubsystems="$devsubsystems $devicereldir" |
|---|
| 1323 | # Make device_name available to subdirs |
|---|
| 1324 | fi |
|---|
| 1325 | # |
|---|
| 1326 | # Allow the device to request that the install step invoke the install |
|---|
| 1327 | # target in the device's Makefile. |
|---|
| 1328 | if test -n "$device_name" -a "$INSTALL_FROM_DEVICE" = yes ; then |
|---|
| 1329 | other_install_dirs="${other_install_dirs} $devicereldir" |
|---|
| 1330 | fi |
|---|
| 1331 | AC_SUBST(device_name) |
|---|
| 1332 | # |
|---|
| 1333 | # with-pm |
|---|
| 1334 | if test "$MPID_NO_PM" = yes ; then |
|---|
| 1335 | if test "$with_pm" != "default" -a "$with_pm" != no ; then |
|---|
| 1336 | AC_MSG_ERROR([The PM chosen ($with_pm) is is not valid for the selected device ($with_device)]) |
|---|
| 1337 | fi |
|---|
| 1338 | # This is used to change with_pm=default to with_pm=no in the case |
|---|
| 1339 | # where the device does not want a PM |
|---|
| 1340 | with_pm=no |
|---|
| 1341 | fi |
|---|
| 1342 | if test -z "$with_pm" ; then |
|---|
| 1343 | with_pm="no" |
|---|
| 1344 | fi |
|---|
| 1345 | if test "$with_pmi" = "uni" -a "$with_pm" = "default" ; then |
|---|
| 1346 | with_pm="no" |
|---|
| 1347 | fi |
|---|
| 1348 | if test "$with_pm" = "default" -o "$with_pm" = "yes" ; then |
|---|
| 1349 | with_pm=mpd,hydra,gforker |
|---|
| 1350 | fi |
|---|
| 1351 | |
|---|
| 1352 | # We allow multiple pm names, separated by : or , |
|---|
| 1353 | # If multiple PMs are provided, we set the value MANY_PM to yes |
|---|
| 1354 | MANY_PM=no |
|---|
| 1355 | AC_SUBST(MANY_PM) |
|---|
| 1356 | if test "$with_pm" != "no" ; then |
|---|
| 1357 | pm_names="`echo $with_pm | sed -e 's/:/ /g' -e 's/,/ /g'`" |
|---|
| 1358 | else |
|---|
| 1359 | pm_names="" |
|---|
| 1360 | fi |
|---|
| 1361 | # |
|---|
| 1362 | hasError=no |
|---|
| 1363 | # We need to be careful about PM's that have either conflicting |
|---|
| 1364 | # requirements (e.g., different PMI implementations) or different |
|---|
| 1365 | # optional features (e.g., MPID_PM_NAMESERVER). |
|---|
| 1366 | # In addition, we need to interleave the setup of the PMI and PM |
|---|
| 1367 | # modules. The order is as follows: |
|---|
| 1368 | # |
|---|
| 1369 | # For each PM, execute the mpich2prereq script for that pm (if present). |
|---|
| 1370 | # This script provides information about the PM, including which PMI |
|---|
| 1371 | # implementations are supported. |
|---|
| 1372 | # |
|---|
| 1373 | # Then, for the selected PMI, the setup script (if any) is run. This is |
|---|
| 1374 | # necessary because the setup of the PM may require information discovered |
|---|
| 1375 | # or provided duing the PMI setup step (e.g., smpd requires this) |
|---|
| 1376 | # |
|---|
| 1377 | # Finally, for each PM, the setup script is executed. |
|---|
| 1378 | # |
|---|
| 1379 | # Step 1: invoke the mpich2prereq for each PM |
|---|
| 1380 | for pm_name in $pm_names ; do |
|---|
| 1381 | if test -z "$first_pm_name" ; then |
|---|
| 1382 | first_pm_name=$pm_name |
|---|
| 1383 | else |
|---|
| 1384 | # Only add to other_pm_names if the directory exists, |
|---|
| 1385 | # since the Makefile in src/pm/Makefile will try to cd to |
|---|
| 1386 | # that directory |
|---|
| 1387 | if test -d $use_top_srcdir/src/pm/$pm_name ; then |
|---|
| 1388 | other_pm_names="$other_pm_names $pm_name" |
|---|
| 1389 | fi |
|---|
| 1390 | fi |
|---|
| 1391 | if test ! -d $use_top_srcdir/src/pm/$pm_name ; then |
|---|
| 1392 | AC_MSG_WARN([$use_top_srcdir/src/pm/$pm_name does not exist. PM is unknown]) |
|---|
| 1393 | hasError=yes |
|---|
| 1394 | elif test ! -x $use_top_srcdir/src/pm/$pm_name/configure ; then |
|---|
| 1395 | if test -s $use_top_srcdir/src/pm/$pm_name/configure ; then |
|---|
| 1396 | AC_MSG_WARN([The configure in $use_top_srcdir/src/pm/$pm_name exists but is not executable]) |
|---|
| 1397 | else |
|---|
| 1398 | AC_MSG_WARN([pm $pm_name has no configure]) |
|---|
| 1399 | fi |
|---|
| 1400 | pm_name="" |
|---|
| 1401 | hasError=yes |
|---|
| 1402 | else |
|---|
| 1403 | nameserver=$MPID_PM_NAMESERVER |
|---|
| 1404 | if test -f $use_top_srcdir/src/pm/$pm_name/mpich2prereq ; then |
|---|
| 1405 | echo sourcing $use_top_srcdir/src/pm/$pm_name/mpich2prereq |
|---|
| 1406 | . $use_top_srcdir/src/pm/$pm_name/mpich2prereq |
|---|
| 1407 | fi |
|---|
| 1408 | # Check for a change; if found, we'll take the default |
|---|
| 1409 | if test "$MPID_PM_NAMESERVER" != "$nameserver" ; then |
|---|
| 1410 | if test "$first_pm_name" != "$pm_name" ; then |
|---|
| 1411 | # Reject suggestion (use the default, common mode) |
|---|
| 1412 | MPID_PM_NAMESERVER="" |
|---|
| 1413 | fi |
|---|
| 1414 | fi |
|---|
| 1415 | fi |
|---|
| 1416 | done |
|---|
| 1417 | if test "$hasError" != no ; then |
|---|
| 1418 | AC_MSG_ERROR([Aborting configure because an error was seen in the selection of process managers]) |
|---|
| 1419 | fi |
|---|
| 1420 | # |
|---|
| 1421 | # pm_name is the *primary* pm |
|---|
| 1422 | pm_name=$first_pm_name |
|---|
| 1423 | AC_SUBST(pm_name) |
|---|
| 1424 | AC_SUBST(other_pm_names) |
|---|
| 1425 | |
|---|
| 1426 | # Some versions of PM and PMI require a special definition (currently, only |
|---|
| 1427 | # smpd requires this) |
|---|
| 1428 | if test "$PMI_REQUIRES_READABLE_TOKENS" = "yes" ; then |
|---|
| 1429 | AC_DEFINE(USE_HUMAN_READABLE_TOKENS,1,[Define to use ='s and spaces in the string utilities.]) |
|---|
| 1430 | fi |
|---|
| 1431 | |
|---|
| 1432 | if test -n "$first_pm_name" ; then |
|---|
| 1433 | other_install_dirs="${other_install_dirs} src/pm/$first_pm_name" |
|---|
| 1434 | fi |
|---|
| 1435 | # Step 2: |
|---|
| 1436 | # Once we've selected the process manager (or managers), we can |
|---|
| 1437 | # check that we have a compatible PMI implemenatation. |
|---|
| 1438 | # with-pmi |
|---|
| 1439 | if test "$MPID_NO_PMI" = yes ; then |
|---|
| 1440 | if test "$with_pmi" != "default" -a "$with_pmi" != no ; then |
|---|
| 1441 | AC_MSG_ERROR([The PMI chosen ($with_pmi) is is not valid for the selected device ($with_device)]) |
|---|
| 1442 | fi |
|---|
| 1443 | # This is used to change with_pmi=default to with_pmi=no in the case |
|---|
| 1444 | # where the device does not want a PMI |
|---|
| 1445 | with_pmi=no |
|---|
| 1446 | elif test "$with_pmi" != "no" ; then |
|---|
| 1447 | if test "$with_pmi" = "default" -o "$with_pmi" = "yes" ; then |
|---|
| 1448 | if test -n "$PM_REQUIRES_PMI" ; then |
|---|
| 1449 | with_pmi=$PM_REQUIRES_PMI |
|---|
| 1450 | else |
|---|
| 1451 | with_pmi=simple |
|---|
| 1452 | fi |
|---|
| 1453 | elif test -n "$PM_REQUIRES_PMI" ; then |
|---|
| 1454 | # Test for compatibility between pm and pmi choices |
|---|
| 1455 | if test "$PM_REQUIRES_PMI" != "$with_pmi" ; then |
|---|
| 1456 | AC_MSG_ERROR([The PM chosen ($with_pm) requires the PMI implementation $PM_REQUIRES_PMI but $with_pmi was selected as the PMI implementation.]) |
|---|
| 1457 | fi |
|---|
| 1458 | fi |
|---|
| 1459 | pmi_name=$with_pmi |
|---|
| 1460 | |
|---|
| 1461 | if test ! -d $use_top_srcdir/src/pmi/$pmi_name ; then |
|---|
| 1462 | AC_MSG_WARN([$use_top_srcdir/src/pmi/$pmi_name does not exist. PMI is unknown]) |
|---|
| 1463 | elif test ! -x $use_top_srcdir/src/pmi/$pmi_name/configure ; then |
|---|
| 1464 | AC_MSG_WARN([pmi $pmi_name has no configure or Makefile]) |
|---|
| 1465 | pmi_name="" |
|---|
| 1466 | else |
|---|
| 1467 | subsystems="$subsystems src/pmi/$pmi_name" |
|---|
| 1468 | fi |
|---|
| 1469 | else |
|---|
| 1470 | AC_MSG_ERROR([A PMI implementation must be selected or the default used.]) |
|---|
| 1471 | fi |
|---|
| 1472 | AC_SUBST(pmi_name) |
|---|
| 1473 | |
|---|
| 1474 | # Step 3: complete pm setup. |
|---|
| 1475 | # Note that checks for errors have already been performed, so this |
|---|
| 1476 | # loop does not need to perform any extra error checks. |
|---|
| 1477 | # Note that this uses this_pm_name because pm_name must be the *first* |
|---|
| 1478 | # of the PM names |
|---|
| 1479 | for this_pm_name in $pm_names ; do |
|---|
| 1480 | subsystems="$subsystems src/pm/$this_pm_name" |
|---|
| 1481 | if test -f $use_top_srcdir/src/pm/$this_pm_name/setup_pm ; then |
|---|
| 1482 | echo sourcing $use_top_srcdir/src/pm/$this_pm_name/setup_pm |
|---|
| 1483 | . $use_top_srcdir/src/pm/$this_pm_name/setup_pm |
|---|
| 1484 | fi |
|---|
| 1485 | done |
|---|
| 1486 | |
|---|
| 1487 | # ---------------------------------------------------------------------------- |
|---|
| 1488 | if test $with_mpe != no ; then |
|---|
| 1489 | if test ! -d $use_top_srcdir/src/mpe2 ; then |
|---|
| 1490 | if test $with_mpe = yes ; then |
|---|
| 1491 | # No warning message on the default |
|---|
| 1492 | AC_MSG_WARN([No MPE directory available]) |
|---|
| 1493 | fi |
|---|
| 1494 | elif test ! -x $use_top_srcdir/src/mpe2/configure ; then |
|---|
| 1495 | if test $with_mpe = yes ; then |
|---|
| 1496 | # No warning message on the default |
|---|
| 1497 | AC_MSG_WARN([No configure available for MPE]) |
|---|
| 1498 | fi |
|---|
| 1499 | else |
|---|
| 1500 | subsystems="$subsystems src/mpe2" |
|---|
| 1501 | other_install_dirs="$other_install_dirs src/mpe2" |
|---|
| 1502 | mpe_dir=mpe2 |
|---|
| 1503 | # Make sure that MPE knows that we're building from MPICH |
|---|
| 1504 | # (similar to ROMIO) |
|---|
| 1505 | FROM_MPICH2=yes |
|---|
| 1506 | export FROM_MPICH2 |
|---|
| 1507 | # Temporarily replace the default NONE value for exec_prefix |
|---|
| 1508 | # and prefix with the actual, default values. |
|---|
| 1509 | savePrefix=$prefix |
|---|
| 1510 | saveExecprefix=$exec_prefix |
|---|
| 1511 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
|---|
| 1512 | test "x$exec_prefix" = xNONE && exec_prefix=$prefix |
|---|
| 1513 | eval actualbindir=$bindir |
|---|
| 1514 | # MPI_CC and MPIF77 must use the local (build) bin dir, not |
|---|
| 1515 | # the installation bin dir |
|---|
| 1516 | #MPI_CC=$actualbindir/mpicc |
|---|
| 1517 | #MPI_F77=$actualbindir/mpif77 |
|---|
| 1518 | #eval actuallibdir=$libdir |
|---|
| 1519 | #MPI_LIBS="-L$actuallibdir -lmpich -lpmpich" |
|---|
| 1520 | buildbindir=`pwd`/bin |
|---|
| 1521 | MPI_CC=$buildbindir/mpicc |
|---|
| 1522 | MPI_F77=$buildbindir/mpif77 |
|---|
| 1523 | prefix=$savePrefix |
|---|
| 1524 | exec_prefix=$saveExecprefix |
|---|
| 1525 | # NOTE: You must append LIBS to MPI_LIBS before invoking the mpe |
|---|
| 1526 | # configure |
|---|
| 1527 | export MPI_CC |
|---|
| 1528 | export MPI_F77 |
|---|
| 1529 | #export MPI_LIBS |
|---|
| 1530 | export use_top_srcdir |
|---|
| 1531 | top_build_dir=`pwd` |
|---|
| 1532 | export top_build_dir |
|---|
| 1533 | fi |
|---|
| 1534 | fi |
|---|
| 1535 | AC_SUBST(mpe_dir) |
|---|
| 1536 | AC_SUBST(other_install_dirs) |
|---|
| 1537 | |
|---|
| 1538 | dnl |
|---|
| 1539 | dnl The recommended order for items in a configure.in file is |
|---|
| 1540 | dnl check for programs |
|---|
| 1541 | dnl check for libraries |
|---|
| 1542 | dnl check for header files |
|---|
| 1543 | dnl check for typedefs |
|---|
| 1544 | dnl check for structures |
|---|
| 1545 | dnl check for compiler characteristics |
|---|
| 1546 | dnl check for library functions |
|---|
| 1547 | dnl check for system services |
|---|
| 1548 | dnl |
|---|
| 1549 | dnl We actually check for compilers first, then roughly follow this order, |
|---|
| 1550 | dnl though logical subsystems (like Fortran support) my use this order |
|---|
| 1551 | dnl within their part of the configure. |
|---|
| 1552 | dnl |
|---|
| 1553 | # |
|---|
| 1554 | # |
|---|
| 1555 | # Find a C compiler (choose gcc first). |
|---|
| 1556 | # We also need to do this before the F77 and F90 test to ensure that we |
|---|
| 1557 | # find the C preprocessor reliably. |
|---|
| 1558 | saveCFLAGS=$CFLAGS |
|---|
| 1559 | AC_PROG_CC |
|---|
| 1560 | AC_PROG_CPP |
|---|
| 1561 | # Bug in autoconf. Restore cross settings |
|---|
| 1562 | if test "$pac_cross_compiling" = "yes" -a "$ac_cv_prog_cc_cross" = "no" ; then |
|---|
| 1563 | AC_MSG_RESULT([Resetting cross compilation to yes]) |
|---|
| 1564 | cross_compiling=yes |
|---|
| 1565 | ac_cv_prog_cc_cross=yes |
|---|
| 1566 | ac_cv_prog_f77_cross=yes |
|---|
| 1567 | ac_cv_prog_f90_cross=yes |
|---|
| 1568 | ac_cv_prog_cxx_cross=yes |
|---|
| 1569 | fi |
|---|
| 1570 | # Misfeature in autoconf. When using gcc, PROG_CC insists on setting |
|---|
| 1571 | # CFLAGS to -g -O2 if CFLAGS is not set. This may be appropriate for |
|---|
| 1572 | # many tools built with configure and gcc, but not always. In particular, |
|---|
| 1573 | # there seems to be no way to get gcc to use no extra flags if that is desired. |
|---|
| 1574 | if test -z "$saveCFLAGS" -a -n "$CFLAGS" ; then |
|---|
| 1575 | # restore CFLAGS |
|---|
| 1576 | # Note: This may not be correct if PROG_CC decided to add other |
|---|
| 1577 | # flags to CFLAGS to enforce some behavior (such as ANSI/ISO C), |
|---|
| 1578 | # But we haven't seen that in practice. It would be better |
|---|
| 1579 | # if the CFLAGS were decomposed into flags-that-change-the-language |
|---|
| 1580 | # that the compiler accepts from optimizations |
|---|
| 1581 | CFLAGS=$saveCFLAGS |
|---|
| 1582 | fi |
|---|
| 1583 | |
|---|
| 1584 | # Check whether shared libraries are enabled. We need to know this |
|---|
| 1585 | # before we start chosing the Fortran, Fortran 90, and C++ compilers |
|---|
| 1586 | ENABLE_SHLIB=$enable_sharedlibs |
|---|
| 1587 | if test -z "$ENABLE_SHLIB" -o "$ENABLE_SHLIB" = "no" ; then |
|---|
| 1588 | ENABLE_SHLIB=none |
|---|
| 1589 | # Also turn off the libtool tests |
|---|
| 1590 | enable_shared=no |
|---|
| 1591 | fi |
|---|
| 1592 | # We need the script that is used to create shared libraries if either |
|---|
| 1593 | # we are creating shared libraries for MPICH2 or we are creating the |
|---|
| 1594 | # dynamically loadable library for the debugger interface |
|---|
| 1595 | CREATESHLIB=false |
|---|
| 1596 | if test "$ENABLE_SHLIB" != "none" -o "$enable_debuginfo" != "no" ; then |
|---|
| 1597 | CREATESHLIB=`pwd`/src/util/createshlib |
|---|
| 1598 | fi |
|---|
| 1599 | AC_SUBST(CREATESHLIB) |
|---|
| 1600 | # --------------------------------------------------------------------------- |
|---|
| 1601 | # Basic properties of the C compiler; some are needed for the language |
|---|
| 1602 | # bindings tests. |
|---|
| 1603 | # Set CFLAGS for enable strict if necessary. Do this *first* because |
|---|
| 1604 | # it may influence the output of the other tests |
|---|
| 1605 | AC_ARG_ENABLE(strict,[--enable-strict - Turn on strict debugging with gcc],,enable_strict=no) |
|---|
| 1606 | PAC_CC_STRICT($enable_strict) |
|---|
| 1607 | if test -n "$pac_cc_strict_flags" ; then |
|---|
| 1608 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS $pac_cc_strict_flags" |
|---|
| 1609 | fi |
|---|
| 1610 | # Check for whether the compiler defines a symbol that contains the |
|---|
| 1611 | # function name. The MPICH2 code, for greater portability, defines |
|---|
| 1612 | # its own symbols, FCNAME (a string) and FUNCNAME (a token that is not a |
|---|
| 1613 | # string). Code should use these symbols where possible. However, |
|---|
| 1614 | # some debugging macros may want to use a compiler-provided symbol |
|---|
| 1615 | # for the function name, and this check makes it possible to |
|---|
| 1616 | # define such macros in a way that is always correct. |
|---|
| 1617 | PAC_CC_FUNCTION_NAME_SYMBOL |
|---|
| 1618 | |
|---|
| 1619 | # Check if $MPI_DEFAULT_COPTS is valid with $CC |
|---|
| 1620 | if test "$enable_default_optimize" = "yes" \ |
|---|
| 1621 | -a -n "$MPI_DEFAULT_COPTS" ; then |
|---|
| 1622 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 1623 | PAC_C_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_COPTS], [ |
|---|
| 1624 | CFLAGS="$CFLAGS $MPI_DEFAULT_COPTS" |
|---|
| 1625 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS $MPI_DEFAULT_COPTS" |
|---|
| 1626 | ] ) |
|---|
| 1627 | else |
|---|
| 1628 | CFLAGS="$CFLAGS $MPI_DEFAULT_COPTS" |
|---|
| 1629 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS $MPI_DEFAULT_COPTS" |
|---|
| 1630 | fi |
|---|
| 1631 | fi |
|---|
| 1632 | # Up till here, MPICH2_EXTRA_CFLAGS contains only flags added by MPICH2. |
|---|
| 1633 | # Check with "grep -n MPICH2_EXTRA_CFLAGS configure.in" |
|---|
| 1634 | # Remove duplicated flags from MPICH2_EXTRA_CFLAGS. |
|---|
| 1635 | PAC_MAKE_UNIQ_STRING([MPICH2_EXTRA_CFLAGS]) |
|---|
| 1636 | # Check if $MPICH2LIB_CFLAGS is valid with $CC |
|---|
| 1637 | if test -n "$MPICH2LIB_CFLAGS" ; then |
|---|
| 1638 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 1639 | PAC_C_CHECK_COMPILER_OPTION( [$MPICH2LIB_CFLAGS], [ |
|---|
| 1640 | CFLAGS="$CFLAGS $MPICH2LIB_CFLAGS" |
|---|
| 1641 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS $MPICH2LIB_CFLAGS" |
|---|
| 1642 | ] ) |
|---|
| 1643 | else |
|---|
| 1644 | CFLAGS="$CFLAGS $MPICH2LIB_CFLAGS" |
|---|
| 1645 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS $MPICH2LIB_CFLAGS" |
|---|
| 1646 | fi |
|---|
| 1647 | fi |
|---|
| 1648 | |
|---|
| 1649 | # Check for support for weak symbols. If not found, set NO_WEAK_SYM |
|---|
| 1650 | # to the Make target name understood by simplemake. |
|---|
| 1651 | # Set NEEDSPLIB to yes if link commands need both -l$MPILIBNAME |
|---|
| 1652 | # and -lp$MPILIBNAME. |
|---|
| 1653 | NEEDSPLIB=yes |
|---|
| 1654 | NO_WEAK_SYM_TARGET=build_proflib |
|---|
| 1655 | if test $enable_weak_symbols = yes ; then |
|---|
| 1656 | # Turn off weak symbols if they aren't available |
|---|
| 1657 | PAC_PROG_C_WEAK_SYMBOLS(,enable_weak_symbols=no) |
|---|
| 1658 | fi |
|---|
| 1659 | if test $enable_weak_symbols = "yes" ; then |
|---|
| 1660 | AC_DEFINE(USE_WEAK_SYMBOLS,1,[Define if weak symbols should be used]) |
|---|
| 1661 | NEEDSPLIB=no |
|---|
| 1662 | # Check for the ability to support multiple weak symbols |
|---|
| 1663 | if test "$pac_cv_prog_c_weak_symbols" = "pragma weak" ; then |
|---|
| 1664 | PAC_PROG_C_MULTIPLE_WEAK_SYMBOLS(AC_DEFINE(HAVE_MULTIPLE_PRAGMA_WEAK,1,[Define if multiple weak symbols may be defined])) |
|---|
| 1665 | fi |
|---|
| 1666 | else |
|---|
| 1667 | NO_WEAK_SYM=build_proflib |
|---|
| 1668 | PROFILE_DEF_MPI="-DMPICH_MPI_FROM_PMPI" |
|---|
| 1669 | fi |
|---|
| 1670 | export NEEDSPLIB |
|---|
| 1671 | export NO_WEAK_SYM |
|---|
| 1672 | export NO_WEAK_SYM_TARGET |
|---|
| 1673 | export PROFILE_DEF_MPI |
|---|
| 1674 | AC_SUBST(NEEDSPLIB) |
|---|
| 1675 | AC_SUBST(NO_WEAK_SYM) |
|---|
| 1676 | AC_SUBST(NO_WEAK_SYM_TARGET) |
|---|
| 1677 | AC_SUBST(PROFILE_DEF_MPI) |
|---|
| 1678 | |
|---|
| 1679 | # --------------------------------------------------------------------------- |
|---|
| 1680 | # Support for the language bindings: Fortran 77, Fortran 90, and C++ |
|---|
| 1681 | # |
|---|
| 1682 | # First, we handle the case of no explicit enable/disable option. In that |
|---|
| 1683 | # case, we look for a usable compiler. We cannot use the ac macros for this |
|---|
| 1684 | # because they abort the configure step if they fail to find a compiler |
|---|
| 1685 | # (earlier versions of autoconf did not have this behavior!). |
|---|
| 1686 | # |
|---|
| 1687 | # Second, we perform the langugage-specific tests, if necessary. This may |
|---|
| 1688 | # be relatively simple (C++) or complex (Fortran 77, including formation of |
|---|
| 1689 | # the encoded MPI handles). |
|---|
| 1690 | # |
|---|
| 1691 | # Note that the bindings support needs to know some of the properties of |
|---|
| 1692 | # the C compiler, so those tests (particularly for weak symbols) |
|---|
| 1693 | # must come first. |
|---|
| 1694 | # ---------------------------------------------------------------------------- |
|---|
| 1695 | |
|---|
| 1696 | # |
|---|
| 1697 | # First, determine whether we are/can support the language bindings |
|---|
| 1698 | # |
|---|
| 1699 | # Handle the case that the user set FC but not F77 before we run the |
|---|
| 1700 | # PROG_F77 command |
|---|
| 1701 | if test -n "$F77" -a -n "$FC" -a "$F77" != "$FC" ; then |
|---|
| 1702 | AC_MSG_ERROR([The values of the environment variables F77 (=$F77) and FC (=$FC) are not the same. Unset one or both and rerun configure]) |
|---|
| 1703 | fi |
|---|
| 1704 | if test -z "$F77" -a -n "$FC" ; then F77="$FC" ; fi |
|---|
| 1705 | if test -z "$FC" -a -n "$F77" ; then FC="$F77" ; fi |
|---|
| 1706 | # ---------------------------------------------------------------------------- |
|---|
| 1707 | # Handle default choices for the Fortran compilers |
|---|
| 1708 | if test "$enable_f77" = "default" ; then |
|---|
| 1709 | enable_f77=no |
|---|
| 1710 | # Check for a Fortran compiler |
|---|
| 1711 | # Warning: the PROG_F77 command aborts if it fails to |
|---|
| 1712 | # find a compiler. We should first try to find a compiler, then |
|---|
| 1713 | # check to see if it works (which the PROG_F77 command does as well) |
|---|
| 1714 | # It also prefers g77 to f77, and doesn't know about other compilers |
|---|
| 1715 | # Also handle the bug that autoconf sets FFLAGS for you |
|---|
| 1716 | saveFFLAGS=$FFLAGS |
|---|
| 1717 | AC_PROG_F77 |
|---|
| 1718 | FFLAGS=$saveFFLAGS |
|---|
| 1719 | if test -n "$F77" ; then |
|---|
| 1720 | enable_f77_wasdefault=yes |
|---|
| 1721 | enable_f77=yes |
|---|
| 1722 | fi |
|---|
| 1723 | elif test "$enable_f77" = "yes" ; then |
|---|
| 1724 | saveFFLAGS=$FFLAGS |
|---|
| 1725 | AC_PROG_F77 |
|---|
| 1726 | FFLAGS=$saveFFLAGS |
|---|
| 1727 | fi |
|---|
| 1728 | |
|---|
| 1729 | if test "$enable_f77" = yes ; then |
|---|
| 1730 | # Check if $MPI_DEFAULT_FOPTS is valid with $F77 |
|---|
| 1731 | if test "$enable_default_optimize" = "yes" \ |
|---|
| 1732 | -a -n "$MPI_DEFAULT_FOPTS" ; then |
|---|
| 1733 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 1734 | PAC_F77_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_FOPTS], [ |
|---|
| 1735 | FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS" |
|---|
| 1736 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS $MPI_DEFAULT_FOPTS" |
|---|
| 1737 | ] ) |
|---|
| 1738 | else |
|---|
| 1739 | FFLAGS="$FFLAGS $MPI_DEFAULT_FOPTS" |
|---|
| 1740 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS $MPI_DEFAULT_FOPTS" |
|---|
| 1741 | fi |
|---|
| 1742 | fi |
|---|
| 1743 | # Up till here, MPICH2_EXTRA_FFLAGS contains only flags added by MPICH2. |
|---|
| 1744 | # Check with "grep -n MPICH2_EXTRA_FFLAGS configure.in" |
|---|
| 1745 | # Remove duplicated flags from MPICH2_EXTRA_FFLAGS. |
|---|
| 1746 | PAC_MAKE_UNIQ_STRING([MPICH2_EXTRA_FFLAGS]) |
|---|
| 1747 | # Check if $MPICH2LIB_FFLAGS is valid with $F77 |
|---|
| 1748 | if test -n "$MPICH2LIB_FFLAGS" ; then |
|---|
| 1749 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 1750 | PAC_F77_CHECK_COMPILER_OPTION( [$MPICH2LIB_FFLAGS], [ |
|---|
| 1751 | FFLAGS="$FFLAGS $MPICH2LIB_FFLAGS" |
|---|
| 1752 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS $MPICH2LIB_FFLAGS" |
|---|
| 1753 | ] ) |
|---|
| 1754 | else |
|---|
| 1755 | FFLAGS="$FFLAGS $MPICH2LIB_FFLAGS" |
|---|
| 1756 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS $MPICH2LIB_FFLAGS" |
|---|
| 1757 | fi |
|---|
| 1758 | fi |
|---|
| 1759 | fi |
|---|
| 1760 | |
|---|
| 1761 | # |
|---|
| 1762 | # We need to know the name mangling for Fortran before testing for F90 |
|---|
| 1763 | # compatibility (we need this because of the way we decide to generate |
|---|
| 1764 | # the Fortran 77 bindings) |
|---|
| 1765 | if test "$enable_f77" = yes ; then |
|---|
| 1766 | FLIBS_save="$FLIBS" |
|---|
| 1767 | FLIBS="" |
|---|
| 1768 | AC_F77_LIBRARY_LDFLAGS |
|---|
| 1769 | # The autoconf macro for finding FLIBS sometimes makes mistakes |
|---|
| 1770 | # (particularly with the Fujitsu frt compiler). This next step |
|---|
| 1771 | # first sees if the FLIBS is valid with the Fortran compiler |
|---|
| 1772 | PAC_PROG_F77_FLIBS_VALID |
|---|
| 1773 | # Now see if FLIBS works with the C compiler |
|---|
| 1774 | PAC_PROG_F77_CHECK_FLIBS |
|---|
| 1775 | |
|---|
| 1776 | PAC_PROG_F77_LINKER_WITH_C |
|---|
| 1777 | PAC_PROG_F77_OBJ_LINKS_WITH_C |
|---|
| 1778 | # For name mangle, we need the library flags |
|---|
| 1779 | PAC_PROG_F77_NAME_MANGLE |
|---|
| 1780 | # Check whether additional libraries are needed when linking with C |
|---|
| 1781 | PAC_PROG_F77_AND_C_STDIO_LIBS |
|---|
| 1782 | AC_SUBST(F77_OTHER_LIBS) |
|---|
| 1783 | |
|---|
| 1784 | # Warn about mixed name mangling, since many of the tests will fail |
|---|
| 1785 | if test "$pac_cv_prog_f77_name_mangle" = "mixed" ; then |
|---|
| 1786 | AC_MSG_WARN([The compiler $F77 uses mixed case names. Fortran is monocase |
|---|
| 1787 | and many Fortran programs may use either upper or lower case names for MPI |
|---|
| 1788 | calls. Consider specifying a particular parameter to your Fortran compiler |
|---|
| 1789 | to select either upper or lower case names. For the Absoft compiler, |
|---|
| 1790 | -f selects lower case and -N109 selects upper case (if you use -f, also use |
|---|
| 1791 | -B108 to enable the iargc and getarg routines, which are needed for some |
|---|
| 1792 | tests and by many user programs). Specify new command |
|---|
| 1793 | line options by setting the environment variable FFLAGS to include |
|---|
| 1794 | the options (e.g., setenv FFLAGS "-f -B108"). In addition, make sure that your |
|---|
| 1795 | Fortran 90 compiler uses a compatible naming choice. For the |
|---|
| 1796 | Absoft Fortran 90, -YALL_NAMES=LCS selects lower case names and -B108 |
|---|
| 1797 | adds underscores to names, as required for iargc and getarg. Pass this |
|---|
| 1798 | information to configure with the F90FLAGS environment variable.]) |
|---|
| 1799 | # If Fortran implicitly enabled, disable it now. Otherwise, |
|---|
| 1800 | # abort the configure since warning messages are often lost in |
|---|
| 1801 | # the output. |
|---|
| 1802 | if test "$enable_f77_wasdefault" = yes ; then |
|---|
| 1803 | AC_MSG_WARN([Turning off Fortran support because of mixed case names]) |
|---|
| 1804 | enable_f77=no |
|---|
| 1805 | enable_f90=no |
|---|
| 1806 | else |
|---|
| 1807 | AC_MSG_ERROR([Aborting configure because of mixed case names in Fortran. Either select --disable-f77 or set FFLAGS to force the compiler to select monocase names]) |
|---|
| 1808 | fi |
|---|
| 1809 | fi |
|---|
| 1810 | |
|---|
| 1811 | # The MPI standard requires that MPI_Init in any language initialize |
|---|
| 1812 | # MPI in all languages. This can be a problem when objects produced |
|---|
| 1813 | # by the Fortran compiler require symbols from the Fortran runtime |
|---|
| 1814 | # (making linking C-only programs unnecessarily difficult). What we test |
|---|
| 1815 | # here is whether the much more restricted needs of the Fortran |
|---|
| 1816 | # initialize can be met with no special use of the Fortran runtime |
|---|
| 1817 | pac_f_init_works_with_c=unknown |
|---|
| 1818 | AC_MSG_CHECKING([whether Fortran init will work with C]) |
|---|
| 1819 | rm -f conftest* |
|---|
| 1820 | cat > conftestc.c <<EOF |
|---|
| 1821 | #include <stdio.h> |
|---|
| 1822 | #include "confdefs.h" |
|---|
| 1823 | #ifdef F77_NAME_UPPER |
|---|
| 1824 | #define minit_ MINIT |
|---|
| 1825 | #elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) |
|---|
| 1826 | #define minit_ minit |
|---|
| 1827 | #endif |
|---|
| 1828 | int main( int argc, char *argv ) |
|---|
| 1829 | { |
|---|
| 1830 | minit_(); |
|---|
| 1831 | return 0; |
|---|
| 1832 | } |
|---|
| 1833 | char *v1 = 0; |
|---|
| 1834 | char *vc2 = 0; |
|---|
| 1835 | int v2 = 0; |
|---|
| 1836 | minitc_( char *dv1, int d, char *dv2, int d2, int dv3 ) |
|---|
| 1837 | { |
|---|
| 1838 | v1 = dv1; |
|---|
| 1839 | v2 = dv3; |
|---|
| 1840 | vc2 = dv2; |
|---|
| 1841 | *vc2 = ' '; |
|---|
| 1842 | } |
|---|
| 1843 | EOF |
|---|
| 1844 | cat > conftestf.f <<EOF |
|---|
| 1845 | subroutine minit() |
|---|
| 1846 | common /m1/ vc, vc2 |
|---|
| 1847 | character *1 vc(1,1), vc2(1) |
|---|
| 1848 | common /m2/ vd |
|---|
| 1849 | integer vd |
|---|
| 1850 | save /m1/, /m2/ |
|---|
| 1851 | call minitc( vc, vc2, vd ) |
|---|
| 1852 | end |
|---|
| 1853 | EOF |
|---|
| 1854 | myfcompile='${F77-f77} -c $FFLAGS conftestf.f 1>&AC_FD_CC' |
|---|
| 1855 | myccompile='${CC-cc} -c $CFLAGS conftestc.c 1>&AC_FD_CC' |
|---|
| 1856 | if AC_TRY_EVAL(myfcompile) && test -s conftestf.o ; then |
|---|
| 1857 | : |
|---|
| 1858 | else |
|---|
| 1859 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 1860 | cat conftestf.f >&AC_FD_CC |
|---|
| 1861 | fi |
|---|
| 1862 | if AC_TRY_EVAL(myccompile) && test -s conftestc.o ; then |
|---|
| 1863 | : |
|---|
| 1864 | else |
|---|
| 1865 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 1866 | cat conftestc.c >&AC_FD_CC |
|---|
| 1867 | fi |
|---|
| 1868 | # Now try the link step |
|---|
| 1869 | myclink='${CC-cc} $CFLAGS -o conftest conftestc.o conftestf.o $LDFLAGS >conftest.out 2>&1' |
|---|
| 1870 | if AC_TRY_EVAL(myclink) && test -x conftest${ac_exeext} ; then |
|---|
| 1871 | pac_f_init_works_with_c=yes |
|---|
| 1872 | else |
|---|
| 1873 | pac_f_init_works_with_c=no |
|---|
| 1874 | fi |
|---|
| 1875 | AC_MSG_RESULT($pac_f_init_works_with_c) |
|---|
| 1876 | if test "$pac_f_init_works_with_c" = "yes" ; then |
|---|
| 1877 | AC_DEFINE(HAVE_MPI_F_INIT_WORKS_WITH_C,1,[Define if the Fortran init code for MPI works from C programs without special libraries]) |
|---|
| 1878 | fi |
|---|
| 1879 | fi |
|---|
| 1880 | |
|---|
| 1881 | # F90 requires F77 as well. If the user disabled f77, do not run the |
|---|
| 1882 | # next test; instead, drop into the warning message |
|---|
| 1883 | # Set a default value for f90 works with f77. This value is |
|---|
| 1884 | # set to no *only* if f90 was selected but was not compatible with f77 |
|---|
| 1885 | f90_with_f77=yes |
|---|
| 1886 | if test "$enable_f90" = "default" -a "$enable_f77" = yes ; then |
|---|
| 1887 | enable_f90=no |
|---|
| 1888 | # Check for a Fortran compiler. Work around bug in autoconf that |
|---|
| 1889 | # adds -g to F90FLAGS |
|---|
| 1890 | saveF90FLAGS="$F90FLAGS" |
|---|
| 1891 | PAC_PROG_F90 |
|---|
| 1892 | F90FLAGS=$saveF90FLAGS |
|---|
| 1893 | if test -n "$F90" ; then |
|---|
| 1894 | if test -z "$F77" ; then |
|---|
| 1895 | saveFFLAGS=$FFLAGS |
|---|
| 1896 | AC_PROG_F77 |
|---|
| 1897 | FFLAGS=$saveFFLAGS |
|---|
| 1898 | fi |
|---|
| 1899 | # |
|---|
| 1900 | # If we allow multiple weak symbols, we should test a name |
|---|
| 1901 | # that does not contain an underscore. The Fortran binding uses |
|---|
| 1902 | # this rule for enabling multiple weak symbols: |
|---|
| 1903 | # if defined(USE_WEAK_SYMBOLS) && !defined(USE_ONLY_MPI_NAMES) && |
|---|
| 1904 | # defined(HAVE_MULTIPLE_PRAGMA_WEAK) && |
|---|
| 1905 | # defined(F77_NAME_LOWER_2USCORE) |
|---|
| 1906 | # |
|---|
| 1907 | testRoutine="t1_2" |
|---|
| 1908 | if test "$pac_cv_prog_c_multiple_weak_symbols" = "yes" -a \ |
|---|
| 1909 | "$enable_weak_symbols" = "yes" -a \ |
|---|
| 1910 | "$pac_cv_prog_f77_name_mangle" = "lower doubleunderscore" ; then |
|---|
| 1911 | testRoutine="t12" |
|---|
| 1912 | fi |
|---|
| 1913 | PAC_F90_AND_F77_COMPATIBLE(f90_with_f77=yes,f90_with_f77=no,$testRoutine) |
|---|
| 1914 | if test "$f90_with_f77" != yes ; then |
|---|
| 1915 | enable_f90=no |
|---|
| 1916 | AC_MSG_WARN([The selected Fortran 90 compiler $F90 does not work with the selected Fortran 77 compiler $F77. Use the environment variables F90 and F77 respectively to select compatible Fortran compilers. The check here tests to see if a main program compiled with the Fortran 90 compiler can link with a subroutine compiled with the Fortran 77 compiler.]) |
|---|
| 1917 | elif test "$f90_with_f77" = "yes" ; then |
|---|
| 1918 | # If we got here, there is a Fortran 90 compiler that we can use |
|---|
| 1919 | enable_f90=yes |
|---|
| 1920 | fi |
|---|
| 1921 | elif test "$pac_cv_prog_f90_works" = no; then |
|---|
| 1922 | AC_MSG_WARN([Use --disable-f90 to keep configure from searching for a Fortran 90 compiler]) |
|---|
| 1923 | fi |
|---|
| 1924 | fi |
|---|
| 1925 | if test "$enable_f90" = "yes" -a "$enable_f77" != "yes" ; then |
|---|
| 1926 | # Fortran 90 support requires compatible Fortran 77 support |
|---|
| 1927 | AC_MSG_WARN([Fortran 90 support requires compatible Fortran 77 support. To force the use of the Fortran 90 compiler for Fortran 77, set the environment variable F77 to the name of the Fortran 90 compiler.]) |
|---|
| 1928 | # We should probably do the compatibility test as well |
|---|
| 1929 | enable_f77=yes |
|---|
| 1930 | fi |
|---|
| 1931 | |
|---|
| 1932 | # ---------------------------------------------------------------------------- |
|---|
| 1933 | # Now test for Fortran compiler characteristics |
|---|
| 1934 | # ---------------------------------------------------------------------------- |
|---|
| 1935 | if test "$enable_f77" = "yes" ; then |
|---|
| 1936 | AC_LANG_FORTRAN77 |
|---|
| 1937 | PAC_PROG_F77_EXCLAIM_COMMENTS(has_exclaim="yes",has_exclaim="no") |
|---|
| 1938 | dnl The following can be used to check whether len=* or (*) form |
|---|
| 1939 | dnl should be used for character declarations |
|---|
| 1940 | dnl PAC_PROG_F77_NEW_CHAR_DECL(CHARDECL="(LEN=*)",CHARDECL="*(*)") |
|---|
| 1941 | dnl AC_SUBST(CHARDECL) |
|---|
| 1942 | PAC_PROG_F77_HAS_INCDIR(src) |
|---|
| 1943 | if test -n "$F77_INCDIR" ; then |
|---|
| 1944 | # For building the Fortran files, add the directory where we are building |
|---|
| 1945 | # the object to the include list. This is needed for g77, which makes |
|---|
| 1946 | # includes relative to the source directory of the file, not the |
|---|
| 1947 | # directory that the command is executed in |
|---|
| 1948 | FINCLUDES="$F77_INCDIR`pwd`/src" |
|---|
| 1949 | fi |
|---|
| 1950 | AC_SUBST(FINCLUDES) |
|---|
| 1951 | # |
|---|
| 1952 | PAC_PROG_F77_LIBRARY_DIR_FLAG |
|---|
| 1953 | |
|---|
| 1954 | AC_SUBST(MPIFPMPI) |
|---|
| 1955 | if test "$MPI_WITH_PMPI" = "no" ; then |
|---|
| 1956 | # If the PMPI routines are not in the same library with the MPI |
|---|
| 1957 | # routines, we may need to remove the pmpi declarations |
|---|
| 1958 | PAC_PROG_F77_ALLOWS_UNUSED_EXTERNALS([MPIFPMPI=",PMPI_WTIME,PMPI_WTICK"],[ |
|---|
| 1959 | MPIFPMPI=""; |
|---|
| 1960 | AC_MSG_WARN([Removed PMPI_WTIME and PMPI_WTICK from mpif.h])]) |
|---|
| 1961 | else |
|---|
| 1962 | MPIFPMPI=",PMPI_WTIME,PMPI_WTICK" |
|---|
| 1963 | fi |
|---|
| 1964 | |
|---|
| 1965 | # Once we have name mangle, we can try to limit the number of needed libs |
|---|
| 1966 | PAC_PROG_F77_IN_C_LIBS |
|---|
| 1967 | AC_SUBST(F77_IN_C_LIBS) |
|---|
| 1968 | |
|---|
| 1969 | # ------------------------------------------------ |
|---|
| 1970 | # Shared library support |
|---|
| 1971 | # ------------------------------------------------ |
|---|
| 1972 | # Note that USE_GCC_G77_DECLS is not used anywhere within the code, so |
|---|
| 1973 | # this check has been commented out. |
|---|
| 1974 | dnl # If both C and Fortran are gnu, define the following to simplify |
|---|
| 1975 | dnl # shared library support. |
|---|
| 1976 | dnl AC_MSG_CHECKING([whether using gcc and g77 together]) |
|---|
| 1977 | dnl if test "$ac_cv_prog_gcc" = "yes" -a "$ac_cv_prog_g77" = "yes" ; then |
|---|
| 1978 | dnl # FIXME: Who uses this definition? |
|---|
| 1979 | dnl AC_DEFINE(USE_GCC_G77_DECLS,1,[Define if using gcc and g77 together]) |
|---|
| 1980 | dnl AC_MSG_RESULT(yes) |
|---|
| 1981 | dnl else |
|---|
| 1982 | dnl AC_MSG_RESULT(no) |
|---|
| 1983 | dnl fi |
|---|
| 1984 | AC_SUBST(FC_SHL) |
|---|
| 1985 | AC_SUBST(FC_LINKPATH_SHL) |
|---|
| 1986 | case "$ENABLE_SHLIB" in |
|---|
| 1987 | gcc-osx|osx-gcc) |
|---|
| 1988 | FC_SHL="$F77 -fPIC" |
|---|
| 1989 | FC_LINKPATH_SHL="" |
|---|
| 1990 | ;; |
|---|
| 1991 | gcc) |
|---|
| 1992 | # Assume that the compiler is g77 if gcc style shared libraries chosen |
|---|
| 1993 | # (unfortunately, the name may be g77 or f77) |
|---|
| 1994 | # To make this a little more robust, only add the -shared |
|---|
| 1995 | # if the compiler allows it (e.g., building with gcc but |
|---|
| 1996 | # a different Fortran compiler. Another option is to |
|---|
| 1997 | # *require* g77. |
|---|
| 1998 | AC_MSG_CHECKING([whether $F77 allows -shared -fpic]) |
|---|
| 1999 | rm -f conftest.f |
|---|
| 2000 | cat > conftest.f <<EOF |
|---|
| 2001 | program main |
|---|
| 2002 | end |
|---|
| 2003 | EOF |
|---|
| 2004 | if $F77 -shared -fpic -o conftest conftest.f >/dev/null 2>&1 ; then |
|---|
| 2005 | FC_SHL="$F77 -shared -fpic" |
|---|
| 2006 | AC_MSG_RESULT(yes) |
|---|
| 2007 | else |
|---|
| 2008 | AC_MSG_RESULT(no) |
|---|
| 2009 | AC_MSG_CHECKING([whether $F77 allows -fpic]) |
|---|
| 2010 | if $F77 -fpic -o conftest conftest.f >/dev/null 2>&1 ; then |
|---|
| 2011 | FC_SHL="$F77 -fpic" |
|---|
| 2012 | AC_MSG_RESULT(yes) |
|---|
| 2013 | else |
|---|
| 2014 | FC_SHL=false |
|---|
| 2015 | AC_MSG_RESULT(no) |
|---|
| 2016 | AC_MSG_WARN([Cannot build shared libraries for Fortran with this compiler]) |
|---|
| 2017 | fi |
|---|
| 2018 | fi |
|---|
| 2019 | # This is needed for Mac OSX 10.5 |
|---|
| 2020 | rm -rf conftest.dSYM |
|---|
| 2021 | rm -f conftest* |
|---|
| 2022 | |
|---|
| 2023 | FC_LINKPATH_SHL="-Wl,-rpath -Wl," |
|---|
| 2024 | ;; |
|---|
| 2025 | cygwin|cygwin-gcc) |
|---|
| 2026 | FC_SHL="$F77 -shared" |
|---|
| 2027 | FC_LINKPATH_SHL="" |
|---|
| 2028 | ;; |
|---|
| 2029 | |
|---|
| 2030 | solaris|solaris-cc) |
|---|
| 2031 | FC_SHL="$F77 -xcode=pic32" |
|---|
| 2032 | FC_LINKPATH_SHL=-R |
|---|
| 2033 | ;; |
|---|
| 2034 | |
|---|
| 2035 | # Do we need a solaris-64 with -xcode=pic64? |
|---|
| 2036 | |
|---|
| 2037 | libtool) |
|---|
| 2038 | FC_SHL='${LIBTOOL} --mode=compile ${F77}' |
|---|
| 2039 | FC_LINKPATH_SHL="-rpath " |
|---|
| 2040 | ;; |
|---|
| 2041 | |
|---|
| 2042 | *) |
|---|
| 2043 | FC_SHL=false |
|---|
| 2044 | ;; |
|---|
| 2045 | esac |
|---|
| 2046 | # ------------------------------------------------ |
|---|
| 2047 | |
|---|
| 2048 | # |
|---|
| 2049 | # Most systems allow the Fortran compiler to process .F and .F90 files |
|---|
| 2050 | # using the C preprocessor. However, some systems either do not |
|---|
| 2051 | # allow this or have serious bugs (OSF Fortran compilers have a bug |
|---|
| 2052 | # that generates an error message from cpp). The following test |
|---|
| 2053 | # checks to see if .F works, and if not, whether "cpp -P -C" can be used |
|---|
| 2054 | # This is needed for Mac OSX 10.5 |
|---|
| 2055 | rm -rf conftest.dSYM |
|---|
| 2056 | rm -f conftest* |
|---|
| 2057 | AC_MSG_CHECKING([whether Fortran compiler processes .F files with C preprocessor]) |
|---|
| 2058 | cat >conftest.F <<EOF |
|---|
| 2059 | program main |
|---|
| 2060 | #define SIZE 10 |
|---|
| 2061 | integer a(SIZE) |
|---|
| 2062 | end |
|---|
| 2063 | EOF |
|---|
| 2064 | pac_cv_fort_accepts_F=no |
|---|
| 2065 | pac_Fcompile='${F77} -c $FFLAGS $CPPFLAGS conftest.F 1>&AC_FD_CC' |
|---|
| 2066 | |
|---|
| 2067 | if AC_TRY_EVAL(pac_Fcompile) && test -s conftest.o ; then |
|---|
| 2068 | pac_cv_fort_accepts_F=yes |
|---|
| 2069 | else |
|---|
| 2070 | # Can we use cpp? |
|---|
| 2071 | pac_Fcpp='${CPP} -C -P $CPPFLAGS conftest.F >conftest.f 2>&AC_FD_CC' |
|---|
| 2072 | if AC_TRY_EVAL(pac_Fcpp) && test -s conftest.f ; then |
|---|
| 2073 | pac_fFcompile='${F77} -c $FFLAGS $CPPFLAGS conftest.f 1>&AC_FD_CC' |
|---|
| 2074 | if AC_TRY_EVAL(pac_fFcompile) && test -s conftest.o ; then |
|---|
| 2075 | pac_cv_fort_accepts_F="no, use cpp" |
|---|
| 2076 | fi |
|---|
| 2077 | fi |
|---|
| 2078 | fi |
|---|
| 2079 | rm -f conftest.* |
|---|
| 2080 | AC_MSG_RESULT($pac_cv_fort_accepts_F) |
|---|
| 2081 | case "$pac_cv_fort_accepts_F" in |
|---|
| 2082 | yes) |
|---|
| 2083 | F77CPP="" |
|---|
| 2084 | ;; |
|---|
| 2085 | "no, use cpp") |
|---|
| 2086 | F77CPP="$CPP -C -P" |
|---|
| 2087 | ;; |
|---|
| 2088 | no) |
|---|
| 2089 | F77CPP="false" |
|---|
| 2090 | ;; |
|---|
| 2091 | esac |
|---|
| 2092 | AC_SUBST(F77CPP) |
|---|
| 2093 | |
|---|
| 2094 | bindings="$bindings f77" |
|---|
| 2095 | bindings_dirs="$bindings_dirs src/binding/f77" |
|---|
| 2096 | AC_DEFINE(HAVE_FORTRAN_BINDING,1,[Define if Fortran is supported]) |
|---|
| 2097 | # Also define the name FORTRAN_BINDING for use in #if @FORTRAN_BINDING@.. |
|---|
| 2098 | FORTRAN_BINDING=1 |
|---|
| 2099 | fi |
|---|
| 2100 | |
|---|
| 2101 | dnl By modifying mpif.h to use ! for comments, it can work with many f90 |
|---|
| 2102 | dnl compilers without creating a separate version. |
|---|
| 2103 | dnl Note that this is run AFTER the AC_OUTPUT actions |
|---|
| 2104 | AC_OUTPUT_COMMANDS([if test "$enable_f77" = yes ; then |
|---|
| 2105 | if test "$bashWorks" = yes ; then cp -f src/env/mpif77.bash src/env/mpif77 ; fi |
|---|
| 2106 | chmod a+x src/env/mpif77 |
|---|
| 2107 | if test "$has_exclaim" = "yes" ; then |
|---|
| 2108 | sed -e 's/^C/\!/g' src/binding/f77/mpif.h > src/include/mpif.h |
|---|
| 2109 | cp src/include/mpif.h src/binding/f77/mpif.h |
|---|
| 2110 | else |
|---|
| 2111 | cp src/binding/f77/mpif.h src/include |
|---|
| 2112 | fi |
|---|
| 2113 | if test "$has_fort_real8" = "yes" ; then |
|---|
| 2114 | sed -e 's/DOUBLE PRECISION/REAL*8/g' src/include/mpif.h > src/include/mpif.h.new |
|---|
| 2115 | mv src/include/mpif.h.new src/include/mpif.h |
|---|
| 2116 | cp src/include/mpif.h src/binding/f77/mpif.h |
|---|
| 2117 | fi |
|---|
| 2118 | # Save a copy of the original mpi_base.f90 file |
|---|
| 2119 | if test "$enable_f90" = "yes" ; then |
|---|
| 2120 | if test ! -f "$master_top_srcdir/src/binding/f90/mpi_base.f90.orig" ; then |
|---|
| 2121 | cp $master_top_srcdir/src/binding/f90/mpi_base.f90 $master_top_srcdir/src/binding/f90/mpi_base.f90.orig |
|---|
| 2122 | fi |
|---|
| 2123 | if test "$has_fort90_real8" = "yes" ; then |
|---|
| 2124 | sed -e 's/DOUBLE PRECISION/REAL*8/g' $master_top_srcdir/src/binding/f90/mpi_base.f90 > $master_top_srcdir/src/binding/f90/mpi_base.f90.new |
|---|
| 2125 | mv -f $master_top_srcdir/src/binding/f90/mpi_base.f90.new $master_top_srcdir/src/binding/f90/mpi_base.f90 |
|---|
| 2126 | else |
|---|
| 2127 | cp -f $master_top_srcdir/src/binding/f90/mpi_base.f90.orig $master_top_srcdir/src/binding/f90/mpi_base.f90 |
|---|
| 2128 | fi |
|---|
| 2129 | fi |
|---|
| 2130 | |
|---|
| 2131 | if test ! -d bin ; then mkdir bin ; fi |
|---|
| 2132 | sed -e 's%includedir=.*%includedir='$includebuild_dir% \ |
|---|
| 2133 | -e 's%libdir=.*%libdir='$libbuild_dir% \ |
|---|
| 2134 | -e 's%^opalibdir=.*%opalibdir='$opalibbuild_dir% \ |
|---|
| 2135 | src/env/mpif77 > bin/mpif77 ; |
|---|
| 2136 | chmod a+x bin/mpif77 |
|---|
| 2137 | else |
|---|
| 2138 | rm -f src/env/mpif77 src/env/mpif77.conf |
|---|
| 2139 | fi], |
|---|
| 2140 | master_top_srcdir=$master_top_srcdir |
|---|
| 2141 | enable_f77=$enable_f77 |
|---|
| 2142 | enable_f90=$enable_f90 |
|---|
| 2143 | has_exclaim=$has_exclaim |
|---|
| 2144 | has_fort_real8=$pac_cv_fort_real8 |
|---|
| 2145 | has_fort90_real8=$pac_cv_fort90_real8 |
|---|
| 2146 | includebuild_dir=$includebuild_dir |
|---|
| 2147 | libbuild_dir=$libbuild_dir |
|---|
| 2148 | bashWorks=$bashWorks) |
|---|
| 2149 | |
|---|
| 2150 | if test "$enable_f90" = "yes" ; then |
|---|
| 2151 | if test "$enable_f77" != "yes" ; then |
|---|
| 2152 | AC_MSG_WARN([Fortran 90 requires Fortran 77]) |
|---|
| 2153 | enable_f90=no |
|---|
| 2154 | else |
|---|
| 2155 | bindingsubsystems="$bindingsubsystems src/binding/f90" |
|---|
| 2156 | bindings="$bindings f90" |
|---|
| 2157 | bindings_dirs="$bindings_dirs src/binding/f90" |
|---|
| 2158 | fi |
|---|
| 2159 | fi |
|---|
| 2160 | |
|---|
| 2161 | # Set defaults for these values so that the Makefile in src/bindings/f90 |
|---|
| 2162 | # is valid even if f90 is not enabled (this is necessary for the |
|---|
| 2163 | # distclean target) |
|---|
| 2164 | MPIMODNAME=mpi |
|---|
| 2165 | MPICONSTMODNAME=mpi_constants |
|---|
| 2166 | MPISIZEOFMODNAME=mpi_sizeofs |
|---|
| 2167 | MPIBASEMODNAME=mpi_base |
|---|
| 2168 | if test "$enable_f90" = "yes" ; then |
|---|
| 2169 | # Determine characteristics of the Fortran 90 compiler |
|---|
| 2170 | # Find a Fortran 90 compiler. Sets F90 |
|---|
| 2171 | # Work around bug in autoconf that adds -g to F90FLAGS |
|---|
| 2172 | saveF90FLAGS="$F90FLAGS" |
|---|
| 2173 | PAC_PROG_F90 |
|---|
| 2174 | PAC_PROG_F90_WORKS |
|---|
| 2175 | F90FLAGS=$saveF90FLAGS |
|---|
| 2176 | if test "$pac_cv_prog_f90_works" = no ; then |
|---|
| 2177 | # Reject this compiler |
|---|
| 2178 | if test -n "$F90" ; then |
|---|
| 2179 | f90_rejected=yes |
|---|
| 2180 | oldF90="$F90" |
|---|
| 2181 | F90="" |
|---|
| 2182 | fi |
|---|
| 2183 | fi |
|---|
| 2184 | |
|---|
| 2185 | if test -z "$F90" ; then |
|---|
| 2186 | if test "$f90_rejected" = "yes" ; then |
|---|
| 2187 | AC_MSG_ERROR([Could not find a usable F90 compiler. The compiler $oldF90 may be incompatible with the Fortran 77 compiler $F77; check the output of configure and consult the installation manuals]) |
|---|
| 2188 | else |
|---|
| 2189 | AC_MSG_ERROR([Could not find a usable F90 compiler.]) |
|---|
| 2190 | fi |
|---|
| 2191 | fi |
|---|
| 2192 | |
|---|
| 2193 | # Find the extension that this compiler uses for modules. |
|---|
| 2194 | # Sets F90MODEXT (and adds it to the list substed) |
|---|
| 2195 | # Sets F90MODINCFLAG (and adds it to the list substed) |
|---|
| 2196 | PAC_F90_MODULE |
|---|
| 2197 | AC_SUBST(F90MODINCSPEC) |
|---|
| 2198 | if test "$pac_cv_f90_module_case" = "upper" ; then |
|---|
| 2199 | MPIMODNAME=MPI |
|---|
| 2200 | MPICONSTMODNAME=MPI_CONSTANTS |
|---|
| 2201 | MPISIZEOFMODNAME=MPI_SIZEOFS |
|---|
| 2202 | MPIBASEMODNAME=MPI_BASE |
|---|
| 2203 | else |
|---|
| 2204 | MPIMODNAME=mpi |
|---|
| 2205 | MPICONSTMODNAME=mpi_constants |
|---|
| 2206 | MPISIZEOFMODNAME=mpi_sizeofs |
|---|
| 2207 | MPIBASEMODNAME=mpi_base |
|---|
| 2208 | fi |
|---|
| 2209 | AC_SUBST(MPIMODNAME) |
|---|
| 2210 | AC_SUBST(MPICONSTMODNAME) |
|---|
| 2211 | AC_SUBST(MPISIZEOFMODNAME) |
|---|
| 2212 | AC_SUBST(MPIBASEMODNAME) |
|---|
| 2213 | if test -z "$modincdir" ; then |
|---|
| 2214 | # The default module include dir is the same as the include dir |
|---|
| 2215 | modincdir=$includedir |
|---|
| 2216 | fi |
|---|
| 2217 | AC_SUBST(modincdir) |
|---|
| 2218 | # |
|---|
| 2219 | # For now, assume that all f90 compilers accept -I for include directories |
|---|
| 2220 | F90INC=-I |
|---|
| 2221 | AC_SUBST(F90INC) |
|---|
| 2222 | F90INCFLAG=-I |
|---|
| 2223 | AC_SUBST(F90INCFLAG) |
|---|
| 2224 | |
|---|
| 2225 | # |
|---|
| 2226 | # Determine the extension for f90 files (it isn't always .f90) |
|---|
| 2227 | PAC_F90_EXT |
|---|
| 2228 | F90EXT=$pac_cv_f90_ext |
|---|
| 2229 | AC_SUBST(F90EXT) |
|---|
| 2230 | |
|---|
| 2231 | # Check if $MPI_DEFAULT_F90OPTS is valid with $F90 |
|---|
| 2232 | if test "$enable_default_optimize" = "yes" \ |
|---|
| 2233 | -a -n "$MPI_DEFAULT_F90OPTS" ; then |
|---|
| 2234 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 2235 | PAC_F90_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_F90OPTS], [ |
|---|
| 2236 | F90FLAGS="$F90FLAGS $MPI_DEFAULT_F90OPTS" |
|---|
| 2237 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS $MPI_DEFAULT_F90OPTS" |
|---|
| 2238 | ] ) |
|---|
| 2239 | else |
|---|
| 2240 | F90FLAGS="$F90FLAGS $MPI_DEFAULT_F90OPTS" |
|---|
| 2241 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS $MPI_DEFAULT_F90OPTS" |
|---|
| 2242 | fi |
|---|
| 2243 | fi |
|---|
| 2244 | # Up till here, MPICH2_EXTRA_F90FLAGS contains only flags added by MPICH2. |
|---|
| 2245 | # Check with "grep -n MPICH2_EXTRA_F90FLAGS configure.in" |
|---|
| 2246 | # Remove duplicated flags from MPICH2_EXTRA_F90FLAGS. |
|---|
| 2247 | PAC_MAKE_UNIQ_STRING([MPICH2_EXTRA_F90FLAGS]) |
|---|
| 2248 | # Check if $MPICH2LIB_F90FLAGS works with $F90 |
|---|
| 2249 | if test -n "$MPICH2LIB_F90FLAGS" ; then |
|---|
| 2250 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 2251 | PAC_F90_CHECK_COMPILER_OPTION( [$MPICH2LIB_F90FLAGS], [ |
|---|
| 2252 | F90FLAGS="$F90FLAGS $MPICH2LIB_F90FLAGS" |
|---|
| 2253 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS $MPICH2LIB_F90FLAGS" |
|---|
| 2254 | ] ) |
|---|
| 2255 | else |
|---|
| 2256 | F90FLAGS="$F90FLAGS $MPICH2LIB_F90FLAGS" |
|---|
| 2257 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS $MPICH2LIB_F90FLAGS" |
|---|
| 2258 | fi |
|---|
| 2259 | fi |
|---|
| 2260 | |
|---|
| 2261 | # |
|---|
| 2262 | # Most systems allow the Fortran compiler to process .F and .F90 files |
|---|
| 2263 | # using the C preprocessor. However, some systems either do not |
|---|
| 2264 | # allow this or have serious bugs (OSF Fortran compilers have a bug |
|---|
| 2265 | # that generates an error message from cpp). The following test |
|---|
| 2266 | # checks to see if .F works, and if not, whether "cpp -P -C" can be used |
|---|
| 2267 | # This is needed for Mac OSX 10.5 |
|---|
| 2268 | rm -rf conftest.dSYM |
|---|
| 2269 | rm -f conftest* |
|---|
| 2270 | AC_MSG_CHECKING([whether Fortran 90 compiler processes .F90 files with C preprocessor]) |
|---|
| 2271 | cat >conftest.F90 <<EOF |
|---|
| 2272 | program main |
|---|
| 2273 | #define ASIZE 10 |
|---|
| 2274 | integer a(ASIZE) |
|---|
| 2275 | end |
|---|
| 2276 | EOF |
|---|
| 2277 | pac_cv_f90_accepts_F90=no |
|---|
| 2278 | pac_F90compile='${F90} -c $F90FLAGS $CPPFLAGS conftest.F90 1>&AC_FD_CC' |
|---|
| 2279 | |
|---|
| 2280 | if AC_TRY_EVAL(pac_F90compile) && test -s conftest.o ; then |
|---|
| 2281 | pac_cv_f90_accepts_F90=yes |
|---|
| 2282 | else |
|---|
| 2283 | # Can we use cpp? |
|---|
| 2284 | pac_F90cpp='${CPP} -C -P $CPPFLAGS conftest.F90 >conftest.$pac_cv_f90_ext 2>&AC_FD_CC' |
|---|
| 2285 | if AC_TRY_EVAL(pac_F90cpp) && test -s conftest.$pac_cv_f90_ext ; then |
|---|
| 2286 | pac_fF90compile='${F90} -c $F90FLAGS $CPPFLAGS conftest.$pac_cv_f90_ext 1>&AC_FD_CC' |
|---|
| 2287 | if AC_TRY_EVAL(pac_fF90compile) && test -s conftest.o ; then |
|---|
| 2288 | pac_cv_f90_accepts_F90="no, use cpp" |
|---|
| 2289 | fi |
|---|
| 2290 | fi |
|---|
| 2291 | fi |
|---|
| 2292 | rm -f conftest.* |
|---|
| 2293 | AC_MSG_RESULT($pac_cv_f90_accepts_F90) |
|---|
| 2294 | case "$pac_cv_f90_accepts_F90" in |
|---|
| 2295 | yes) |
|---|
| 2296 | F90CPP="" |
|---|
| 2297 | ;; |
|---|
| 2298 | "no, use cpp") |
|---|
| 2299 | F90CPP="$CPP -C -P" |
|---|
| 2300 | ;; |
|---|
| 2301 | no) |
|---|
| 2302 | F90CPP="false" |
|---|
| 2303 | ;; |
|---|
| 2304 | esac |
|---|
| 2305 | AC_SUBST(F90CPP) |
|---|
| 2306 | |
|---|
| 2307 | # Check whether additional libraries are needed when linking with C |
|---|
| 2308 | PAC_PROG_F90_AND_C_STDIO_LIBS |
|---|
| 2309 | AC_SUBST(F90_OTHER_LIBS) |
|---|
| 2310 | |
|---|
| 2311 | # ------------------------------------------------ |
|---|
| 2312 | # ------------------------------------------------ |
|---|
| 2313 | # Here are the commands to substitute the compilers to be used to create |
|---|
| 2314 | # shared libraries. The choices for the first two come down from the |
|---|
| 2315 | # top-level configure. FC_SHL must be determined in this configure |
|---|
| 2316 | AC_SUBST(F90_SHL) |
|---|
| 2317 | AC_SUBST(F90_LINKPATH_SHL) |
|---|
| 2318 | |
|---|
| 2319 | # Try to get a version string for the F90 compiler. We may |
|---|
| 2320 | # need this to find likely command-line arguments for accessing |
|---|
| 2321 | # shared libraries |
|---|
| 2322 | AC_MSG_CHECKING([for f90 compiler vendor]) |
|---|
| 2323 | # This is complicated by some compilers (such as the Intel 8.1 ifort) |
|---|
| 2324 | # that return a non-zero status even when they accept the -V option |
|---|
| 2325 | # (a zero status is returned only if there is a file). |
|---|
| 2326 | pac_cv_f90_vendor="unknown" |
|---|
| 2327 | for arg in --version -V -v ; do |
|---|
| 2328 | rm -f conftest.txt |
|---|
| 2329 | $F90 $arg </dev/null >conftest.txt 2>&1 |
|---|
| 2330 | # Ignore the return code, because some compilers set the |
|---|
| 2331 | # return code to zero on invalid arguments and some to |
|---|
| 2332 | # non-zero on success (with no files to compile) |
|---|
| 2333 | if test -f conftest.txt ; then |
|---|
| 2334 | if grep 'Portland Group' conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2335 | pac_cv_f90_vendor=pgi |
|---|
| 2336 | elif grep 'Sun Workshop' conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2337 | pac_cv_f90_vendor=sun |
|---|
| 2338 | elif grep 'Absoft' conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2339 | pac_cv_f90_vendor=absoft |
|---|
| 2340 | elif grep 'G95' conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2341 | pac_cv_f90_vendor=gnu |
|---|
| 2342 | elif grep 'GNU Fortran' conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2343 | # This is gfortran |
|---|
| 2344 | pac_cv_f90_vendor=gnu |
|---|
| 2345 | elif grep Intel conftest.txt >/dev/null 2>&1 ; then |
|---|
| 2346 | pac_cv_f90_vendor=intel |
|---|
| 2347 | fi |
|---|
| 2348 | fi |
|---|
| 2349 | if test "$pac_cv_f90_vendor" != "unknown" ; then break ; fi |
|---|
| 2350 | done |
|---|
| 2351 | if test "$pac_cv_f90_vendor" = "unknown" ; then |
|---|
| 2352 | # Try to use the compiler name |
|---|
| 2353 | if test "$F90" = "ifort" -o "$F90" = "ifc" ; then |
|---|
| 2354 | pac_cv_f90_vendor=intel |
|---|
| 2355 | elif test "$F90" = "pgf90" ; then |
|---|
| 2356 | pac_cv_f90_vendor=pgi |
|---|
| 2357 | elif test "$F90" = "xlf90" -o "$F90" = "xlf90_r" ; then |
|---|
| 2358 | pac_cv_f90_vendor=ibm |
|---|
| 2359 | fi |
|---|
| 2360 | fi |
|---|
| 2361 | AC_MSG_RESULT($pac_cv_f90_vendor) |
|---|
| 2362 | rm -f conftest.txt |
|---|
| 2363 | # End of checking for F90 compiler vendor |
|---|
| 2364 | |
|---|
| 2365 | if test "$ENABLE_SHLIB" != none ; then |
|---|
| 2366 | AC_MSG_CHECKING([for how to build shared libraries for Fortran 90]) |
|---|
| 2367 | case "$ENABLE_SHLIB" in |
|---|
| 2368 | gcc-osx|osx-gcc) |
|---|
| 2369 | F90_SHL="$F90 -fPIC" |
|---|
| 2370 | F90_LINKPATH_SHL="" |
|---|
| 2371 | ;; |
|---|
| 2372 | gcc) |
|---|
| 2373 | if test "$pac_cv_f90_vendor" = gnu -o "$F90" = "g95" ; then |
|---|
| 2374 | # If we have the GNU Fortran 95 compiler (untested) |
|---|
| 2375 | F90_SHL="$F90 -shared -fpic" |
|---|
| 2376 | F90_LINKPATH_SHL="-Wl,-rpath -Wl," |
|---|
| 2377 | else |
|---|
| 2378 | case "$pac_cv_f90_vendor" in |
|---|
| 2379 | absoft) |
|---|
| 2380 | F90_SHL="$F90 -fpic" |
|---|
| 2381 | F90_LINKPATH_SHL="-X -rpath -X " |
|---|
| 2382 | ;; |
|---|
| 2383 | |
|---|
| 2384 | intel) |
|---|
| 2385 | # Intel implements the GNU options |
|---|
| 2386 | F90_SHL="$F90 -shared -fpic" |
|---|
| 2387 | F90_LINKPATH_SHL="-Wl,-rpath -Wl," |
|---|
| 2388 | ;; |
|---|
| 2389 | |
|---|
| 2390 | pgi) |
|---|
| 2391 | # Portland Group implements the GNU options |
|---|
| 2392 | F90_SHL="$F90 -shared -fpic" |
|---|
| 2393 | F90_LINKPATH_SHL="-Wl,-rpath -Wl," |
|---|
| 2394 | ;; |
|---|
| 2395 | |
|---|
| 2396 | *) |
|---|
| 2397 | # Unknown, ignore |
|---|
| 2398 | ;; |
|---|
| 2399 | esac |
|---|
| 2400 | fi |
|---|
| 2401 | ;; |
|---|
| 2402 | solaris|solaris-cc) |
|---|
| 2403 | # Assume the Solaris F90 compiler, in 32-bit mode |
|---|
| 2404 | F90_SHL="$F90 -xcode=pic32" |
|---|
| 2405 | F90_LINKPATH_SHL=-R |
|---|
| 2406 | ;; |
|---|
| 2407 | *) |
|---|
| 2408 | # Unknown, ignore |
|---|
| 2409 | ;; |
|---|
| 2410 | esac |
|---|
| 2411 | if test -n "$F90_SHL" ; then |
|---|
| 2412 | AC_MSG_RESULT([Compile with $F90_SHL and link using path argument $F90_LINKPATH_SHL]) |
|---|
| 2413 | else |
|---|
| 2414 | AC_MSG_WARN([Unable to determine how to link Fortran 90 compiler with shared libraries]) |
|---|
| 2415 | fi |
|---|
| 2416 | fi |
|---|
| 2417 | |
|---|
| 2418 | dnl Some systems don't require or accept linkpath arguments. |
|---|
| 2419 | dnl if test "$ENABLE_SHLIB" != "none" -a -z "$F90_LINKPATH_SHL" -a \ |
|---|
| 2420 | dnl -n "$C_LINKPATH_SHL" ; then |
|---|
| 2421 | dnl AC_MSG_WARN([Unable to determine how to pass the shared-library link patth to the Fortran 90 compiler $F90. Set the environment variable F90_LINKPATH_SHL and rerun configure (the corresponding value for the C compiler is $C_LINKPATH_SHL)]) |
|---|
| 2422 | dnl fi |
|---|
| 2423 | # ------------------------------------------------ |
|---|
| 2424 | fi |
|---|
| 2425 | |
|---|
| 2426 | AC_OUTPUT_COMMANDS([if test $enable_f90 = yes ; then |
|---|
| 2427 | if test "$bashWorks" = yes ; then cp -f src/env/mpif90.bash src/env/mpif90 ; fi |
|---|
| 2428 | chmod a+x src/env/mpif90 |
|---|
| 2429 | if test ! -d bin ; then mkdir bin ; fi |
|---|
| 2430 | sed -e 's%includedir=.*%includedir='$includebuild_dir% \ |
|---|
| 2431 | -e 's%modincdir=.*%modincdir='$modincbuild_dir% \ |
|---|
| 2432 | -e 's%libdir=.*%libdir='$libbuild_dir% \ |
|---|
| 2433 | -e 's%^opalibdir=.*%opalibdir='$opalibbuild_dir% \ |
|---|
| 2434 | src/env/mpif90 > bin/mpif90 ; |
|---|
| 2435 | chmod a+x bin/mpif90 |
|---|
| 2436 | else |
|---|
| 2437 | rm -f src/env/mpif90 src/env/mpif90.conf bin/mpif90 |
|---|
| 2438 | fi |
|---|
| 2439 | ], |
|---|
| 2440 | enable_f90=$enable_f90 |
|---|
| 2441 | modincbuild_dir=$modincbuild_dir |
|---|
| 2442 | includebuild_dir=$includebuild_dir |
|---|
| 2443 | libbuild_dir=$libbuild_dir |
|---|
| 2444 | bashWorks=$bashWorks) |
|---|
| 2445 | |
|---|
| 2446 | # ---------------------------------------------------------------------------- |
|---|
| 2447 | # By default, only build C++ if there is a C++ compiler (if we don't |
|---|
| 2448 | # test here, the configure can fail if there is no C++ compiler available) |
|---|
| 2449 | if test "$enable_cxx" = "default" ; then |
|---|
| 2450 | # This test uses the list from a recent PROG_CXX, but with the |
|---|
| 2451 | # addition of the Portland group, IBM, and Intel C++ compilers |
|---|
| 2452 | # (While the Intel icc compiler will compile C++ programs, it will |
|---|
| 2453 | # not *link* C++ object files unless there is at least one C++ source |
|---|
| 2454 | # file present on the command that performs the linking. icpc is the |
|---|
| 2455 | # Intel C++ compiler that both compiles and links C++ programs) |
|---|
| 2456 | AC_CHECK_PROGS(CXX,$CCC c++ g++ gcc CC cxx cc++ cl pgCC xlC icpc pathCC) |
|---|
| 2457 | if test -n "$CXX" ; then |
|---|
| 2458 | enable_cxx=yes |
|---|
| 2459 | fi |
|---|
| 2460 | fi |
|---|
| 2461 | |
|---|
| 2462 | if test "$enable_cxx" = "yes" ; then |
|---|
| 2463 | # Save the current CXXFLAGS (see below for the reason) |
|---|
| 2464 | saveCXXFLAGS=$CXXFLAGS |
|---|
| 2465 | # Misfeature in autoconf. While the macro name is PROG_CXX, it |
|---|
| 2466 | # looks at the CCC environment variable, not CXX, even though it |
|---|
| 2467 | # *sets* CXX!!!! |
|---|
| 2468 | if test -z "$CCC" -a -n "$CXX" ; then |
|---|
| 2469 | CCC="$CXX" |
|---|
| 2470 | fi |
|---|
| 2471 | AC_PROG_CXX |
|---|
| 2472 | # Misfeature in autoconf. When using gcc, PROG_CXX insists on setting |
|---|
| 2473 | # CXXFLAGS to -g -O2 if CXXFLAGS is not set. This may be appropriate for |
|---|
| 2474 | # many tools built with configure and gcc, but not always. In particular, |
|---|
| 2475 | # there seems to be no way to get gcc to use no extra flags if that is |
|---|
| 2476 | # desired. |
|---|
| 2477 | if test -z "$saveCXXFLAGS" -a -n "$CXXFLAGS" ; then |
|---|
| 2478 | # restore CXXFLAGS |
|---|
| 2479 | # Note: This may not be correct if PROG_CXX decided to add other |
|---|
| 2480 | # flags to CXXFLAGS to enforce some behavior (such as ANSI/ISO C++), |
|---|
| 2481 | # But we haven't seen that in practice. It would be better |
|---|
| 2482 | # if the CXXFLAGS were decomposed into flags-that-change-the-language |
|---|
| 2483 | # that the compiler accepts from optimizations |
|---|
| 2484 | CXXFLAGS=$saveCXXFLAGS |
|---|
| 2485 | fi |
|---|
| 2486 | # Another bug in autoconf. The checks for the C++ compiler do not |
|---|
| 2487 | # ensure that you can link a program that is built with the C++ |
|---|
| 2488 | # compiler. We've seen this error with gcc and icc, particularly |
|---|
| 2489 | # when those compilers accept C++ language elements but are unable |
|---|
| 2490 | # to link programs that are really C++. For that reason, |
|---|
| 2491 | # we've added a test to see if the C++ compiler can produce |
|---|
| 2492 | # an executable. |
|---|
| 2493 | AC_CACHE_CHECK([whether the C++ compiler $CXX can build an executable], |
|---|
| 2494 | pac_cv_cxx_builds_exe,[ |
|---|
| 2495 | AC_LANG_SAVE |
|---|
| 2496 | AC_LANG_CPLUSPLUS |
|---|
| 2497 | AC_TRY_LINK([ |
|---|
| 2498 | class mytest { |
|---|
| 2499 | int a; |
|---|
| 2500 | public: |
|---|
| 2501 | mytest(void) : a(1) {} |
|---|
| 2502 | ~mytest(void) {} |
|---|
| 2503 | };],[mytest a;], |
|---|
| 2504 | pac_cv_cxx_builds_exe=yes, ac_cv_builds_exe=no) |
|---|
| 2505 | AC_LANG_RESTORE |
|---|
| 2506 | ]) |
|---|
| 2507 | if test "$pac_cv_cxx_builds_exe" != yes ; then |
|---|
| 2508 | AC_MSG_ERROR([Aborting because C++ compiler does not work. If you do not need a C++ compiler, configure with --disable-cxx]) |
|---|
| 2509 | fi |
|---|
| 2510 | # Recent failures have come when a standard header is loaded |
|---|
| 2511 | # The Intel icpc 10.x compiler fails with <string> if gcc 4.2 is installed. |
|---|
| 2512 | AC_CACHE_CHECK([whether C++ compiler works with string],pac_cv_cxx_compiles_string,[ |
|---|
| 2513 | AC_LANG_SAVE |
|---|
| 2514 | AC_LANG_CPLUSPLUS |
|---|
| 2515 | AC_TRY_COMPILE([#include <string>],[return 0;],pac_cv_cxx_compiles_string=yes,pac_cv_cxx_compiles_string=no) |
|---|
| 2516 | AC_LANG_RESTORE |
|---|
| 2517 | ]) |
|---|
| 2518 | if test "$pac_cv_cxx_compiles_string" != yes ; then |
|---|
| 2519 | AC_MSG_WARN([The C++ compiler $CXX cannot compile a program containing the <string> header - this may indicate a problem with the C++ installation. Consider configuing with --disable-cxx]) |
|---|
| 2520 | fi |
|---|
| 2521 | |
|---|
| 2522 | AC_LANG_CPLUSPLUS |
|---|
| 2523 | AC_CXX_EXCEPTIONS |
|---|
| 2524 | AC_CXX_BOOL |
|---|
| 2525 | AC_CXX_NAMESPACES |
|---|
| 2526 | if test "$ac_cv_cxx_namespaces" != "yes" ; then |
|---|
| 2527 | AC_MSG_ERROR([Namespaces are required for the MPI C++ interface]) |
|---|
| 2528 | fi |
|---|
| 2529 | HAVE_CXX_EXCEPTIONS=0 |
|---|
| 2530 | AC_SUBST(HAVE_CXX_EXCEPTIONS) |
|---|
| 2531 | if test "$ac_cv_cxx_exceptions" = "yes" ; then |
|---|
| 2532 | HAVE_CXX_EXCEPTIONS=1 |
|---|
| 2533 | fi |
|---|
| 2534 | # iostream and math are needed for examples/cxx/cxxpi.cxx |
|---|
| 2535 | AC_CACHE_CHECK([whether <iostream> available],pac_cv_cxx_has_iostream,[ |
|---|
| 2536 | AC_TRY_COMPILE([ |
|---|
| 2537 | #include <iostream> |
|---|
| 2538 | ],[using namespace std;],pac_cv_cxx_has_iostream=yes,pac_cv_cxx_has_iostream=no)]) |
|---|
| 2539 | if test "$pac_cv_cxx_has_iostream" = yes ; then |
|---|
| 2540 | CXX_DEFS="$CXX_DEFS -DHAVE_CXX_IOSTREAM" |
|---|
| 2541 | fi |
|---|
| 2542 | AC_CXX_NAMESPACE_STD |
|---|
| 2543 | if test "$ac_cv_cxx_namespace_std" = "yes" ; then |
|---|
| 2544 | CXX_DEFS="$CXX_DEFS -DHAVE_NAMESPACE_STD" |
|---|
| 2545 | fi |
|---|
| 2546 | |
|---|
| 2547 | AC_CACHE_CHECK([whether <math> available],pac_cv_cxx_has_math,[ |
|---|
| 2548 | AC_TRY_COMPILE([ |
|---|
| 2549 | #include <math> |
|---|
| 2550 | ],[using namespace std;],pac_cv_cxx_has_math=yes,pac_cv_cxx_has_math=no)]) |
|---|
| 2551 | if test "$pac_cv_cxx_has_math" = yes ; then |
|---|
| 2552 | CXX_DEFS="$CXX_DEFS -DHAVE_CXX_MATH" |
|---|
| 2553 | fi |
|---|
| 2554 | AC_SUBST(CXX_DEFS) |
|---|
| 2555 | |
|---|
| 2556 | # Add support for shared libraries if possible |
|---|
| 2557 | AC_SUBST(CXX_SHL) |
|---|
| 2558 | AC_SUBST(CXX_LINKPATH_SHL) |
|---|
| 2559 | case "$ENABLE_SHLIB" in |
|---|
| 2560 | gcc-osx|osx-gcc) |
|---|
| 2561 | # Assume that the compiler is g++ if gcc style shared libraries chosen |
|---|
| 2562 | CXX_SHL="$CXX -fPIC" |
|---|
| 2563 | CXX_LINKPATH_SHL="" |
|---|
| 2564 | ;; |
|---|
| 2565 | gcc) |
|---|
| 2566 | # Assume that the compiler is g++ if gcc style shared libraries chosen |
|---|
| 2567 | CXX_SHL="$CXX -shared -fpic" |
|---|
| 2568 | CXX_LINKPATH_SHL="-Wl,-rpath -Wl," |
|---|
| 2569 | ;; |
|---|
| 2570 | cygwin|cygwin-gcc) |
|---|
| 2571 | CXX_SHL="$CXX -shared" |
|---|
| 2572 | CXX_LINKPATH_SHL="" |
|---|
| 2573 | ;; |
|---|
| 2574 | solaris|solaris-cc) |
|---|
| 2575 | CXX_SHL="$CXX -xcode=pic32" |
|---|
| 2576 | CXX_LINKPATH_SHL=-R |
|---|
| 2577 | ;; |
|---|
| 2578 | libtool) |
|---|
| 2579 | CXX_SHL='${LIBTOOL} --mode=compile ${CXX}' |
|---|
| 2580 | CXX_LINKPATH_SHL="-rpath " |
|---|
| 2581 | ;; |
|---|
| 2582 | *) |
|---|
| 2583 | CXX_SHL=false |
|---|
| 2584 | ;; |
|---|
| 2585 | esac |
|---|
| 2586 | # GNU changed the calling conventions between minor releases (!!!) |
|---|
| 2587 | # This is too hard to detect, but we should be able to detect |
|---|
| 2588 | # the version mismatch. By default, we set the GNU version to 0. |
|---|
| 2589 | # In a cross-compiling environment, these can be set with environment |
|---|
| 2590 | # variables, either directly or through the standard "CROSS" variable. |
|---|
| 2591 | if test -z "$GNUCXX_VERSION" ; then |
|---|
| 2592 | if test -n "$CROSS_GNUCXX_VERSION" ; then |
|---|
| 2593 | GNUCXX_VERSION=$CROSS_GNUCXX_VERSION |
|---|
| 2594 | else |
|---|
| 2595 | GNUCXX_VERSION=0 |
|---|
| 2596 | fi |
|---|
| 2597 | fi |
|---|
| 2598 | if test -z "$GNUCXX_MINORVERSION" ; then |
|---|
| 2599 | if test -n "$CROSS_GNUCXX_MINORVERSION" ; then |
|---|
| 2600 | GNUCXX_MINORVERSION=$CROSS_GNUCXX_MINORVERSION |
|---|
| 2601 | else |
|---|
| 2602 | GNUCXX_MINORVERSION=0 |
|---|
| 2603 | fi |
|---|
| 2604 | fi |
|---|
| 2605 | if test "$cross_compiling" = "no" -a "$ac_compiler_gnu" = "yes" -a \ |
|---|
| 2606 | "$GNUCXX_VERSION" = 0 -a "$GNUCXX_MINORVERSION" = 0 ; then |
|---|
| 2607 | ac_vals="" |
|---|
| 2608 | AC_MSG_CHECKING([for GNU g++ version]) |
|---|
| 2609 | AC_TRY_RUN([#include <stdio.h> |
|---|
| 2610 | int main() { |
|---|
| 2611 | int v = -1, m = -1; |
|---|
| 2612 | FILE *fp = fopen("conftest.out","w"); |
|---|
| 2613 | #ifdef __GNUC_MINOR__ |
|---|
| 2614 | m = __GNUC_MINOR__; |
|---|
| 2615 | #endif |
|---|
| 2616 | #ifdef __GNUC__ |
|---|
| 2617 | v = __GNUC__; |
|---|
| 2618 | #endif |
|---|
| 2619 | fprintf( fp, "v=%d, m=%d\n", v, m ); |
|---|
| 2620 | fclose( fp ); |
|---|
| 2621 | return 0; |
|---|
| 2622 | }],ac_vals=`cat conftest.out`) |
|---|
| 2623 | if test -n "$ac_vals" ; then |
|---|
| 2624 | v=`echo "$ac_vals" | sed -e 's/v=\(.*\),.*/\1/'` |
|---|
| 2625 | m=`echo "$ac_vals" | sed -e 's/.*m=\(.*\)/\1/'` |
|---|
| 2626 | AC_MSG_RESULT([$v . $m]) |
|---|
| 2627 | GNUCXX_VERSION=$v |
|---|
| 2628 | GNUCXX_MINORVERSION=$m |
|---|
| 2629 | else |
|---|
| 2630 | AC_MSG_RESULT([unknown]) |
|---|
| 2631 | fi |
|---|
| 2632 | fi |
|---|
| 2633 | AC_SUBST(GNUCXX_VERSION) |
|---|
| 2634 | AC_SUBST(GNUCXX_MINORVERSION) |
|---|
| 2635 | |
|---|
| 2636 | bindings="$bindings cxx" |
|---|
| 2637 | bindings_dirs="$bindings_dirs src/binding/cxx" |
|---|
| 2638 | AC_DEFINE(HAVE_CXX_BINDING,1,[Define if C++ is supported]) |
|---|
| 2639 | INCLUDE_MPICXX_H='#include "mpicxx.h"' |
|---|
| 2640 | AC_SUBST(INCLUDE_MPICXX_H) |
|---|
| 2641 | |
|---|
| 2642 | # In order to support the Fortran datatypes within C++, |
|---|
| 2643 | # |
|---|
| 2644 | # FORTRAN_BINDING always has a CPP-time value of either 0 or 1, |
|---|
| 2645 | # so that it may be used in #if statements without adding to |
|---|
| 2646 | # the CPP name space |
|---|
| 2647 | AC_SUBST(FORTRAN_BINDING) |
|---|
| 2648 | |
|---|
| 2649 | # Special C++ datatypes. Set to DATATYPE NULL first; we'll |
|---|
| 2650 | # replace the ones that we have later, after we have determined |
|---|
| 2651 | # the C datatypes |
|---|
| 2652 | MPIR_CXX_BOOL=0x0c000000 |
|---|
| 2653 | MPIR_CXX_COMPLEX=0x0c000000 |
|---|
| 2654 | MPIR_CXX_DOUBLE_COMPLEX=0x0c000000 |
|---|
| 2655 | MPIR_CXX_LONG_DOUBLE_COMPLEX=0x0c000000 |
|---|
| 2656 | AC_SUBST(MPIR_CXX_BOOL) |
|---|
| 2657 | AC_SUBST(MPIR_CXX_COMPLEX) |
|---|
| 2658 | AC_SUBST(MPIR_CXX_DOUBLE_COMPLEX) |
|---|
| 2659 | AC_SUBST(MPIR_CXX_LONG_DOUBLE_COMPLEX) |
|---|
| 2660 | |
|---|
| 2661 | fi |
|---|
| 2662 | |
|---|
| 2663 | if test "$enable_cxx" = yes; then |
|---|
| 2664 | # Check if $MPI_DEFAULT_CXXOPTS is valid with $CXX |
|---|
| 2665 | if test "$enable_default_optimize" = "yes" \ |
|---|
| 2666 | -a -n "$MPI_DEFAULT_CXXOPTS" ; then |
|---|
| 2667 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 2668 | PAC_CXX_CHECK_COMPILER_OPTION( [$MPI_DEFAULT_CXXOPTS], [ |
|---|
| 2669 | CXXFLAGS="$CXXFLAGS $MPI_DEFAULT_CXXOPTS" |
|---|
| 2670 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS $MPI_DEFAULT_CXXOPTS" |
|---|
| 2671 | ] ) |
|---|
| 2672 | else |
|---|
| 2673 | CXXFLAGS="$CXXFLAGS $MPI_DEFAULT_CXXOPTS" |
|---|
| 2674 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS $MPI_DEFAULT_CXXOPTS" |
|---|
| 2675 | fi |
|---|
| 2676 | fi |
|---|
| 2677 | # Up till here, MPICH2_EXTRA_CXXFLAGS contains only flags added by MPICH2. |
|---|
| 2678 | # Check with "grep -n MPICH2_EXTRA_CXXFLAGS configure.in" |
|---|
| 2679 | # Remove duplicated flags from MPICH2_EXTRA_CXXFLAGS. |
|---|
| 2680 | PAC_MAKE_UNIQ_STRING([MPICH2_EXTRA_CXXFLAGS]) |
|---|
| 2681 | # Check if $MPICH2LIB_CXXFLAGS is valid with $CXX |
|---|
| 2682 | if test -n "$MPICH2LIB_CXXFLAGS" ; then |
|---|
| 2683 | if test "$enable_check_compiler_flags" = "yes" ; then |
|---|
| 2684 | PAC_CXX_CHECK_COMPILER_OPTION( [$MPICH2LIB_CXXFLAGS], [ |
|---|
| 2685 | CXXFLAGS="$CXXFLAGS $MPICH2LIB_CXXFLAGS" |
|---|
| 2686 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS $MPICH2LIB_CXXFLAGS" |
|---|
| 2687 | ] ) |
|---|
| 2688 | else |
|---|
| 2689 | CXXFLAGS="$CXXFLAGS $MPICH2LIB_CXXFLAGS" |
|---|
| 2690 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS $MPICH2LIB_CXXFLAGS" |
|---|
| 2691 | fi |
|---|
| 2692 | fi |
|---|
| 2693 | fi |
|---|
| 2694 | |
|---|
| 2695 | export MPICH2_EXTRA_CFLAGS |
|---|
| 2696 | export MPICH2_EXTRA_CXXFLAGS |
|---|
| 2697 | export MPICH2_EXTRA_FFLAGS |
|---|
| 2698 | export MPICH2_EXTRA_F90FLAGS |
|---|
| 2699 | |
|---|
| 2700 | # Copy the mpicxx.h file to the main include directory |
|---|
| 2701 | # Move a working version of the mpicxx script to the bin directory |
|---|
| 2702 | # Create an alias mpic++ for mpicxx (BOOST, at least, makes invalid assumptions |
|---|
| 2703 | # about the name of the MPI C++ compilation script) |
|---|
| 2704 | AC_OUTPUT_COMMANDS([if test $enable_cxx = yes ; then |
|---|
| 2705 | if test "$bashWorks" = yes ; then cp -f src/env/mpicxx.bash src/env/mpicxx ; fi |
|---|
| 2706 | chmod a+x src/env/mpicxx |
|---|
| 2707 | cp src/binding/cxx/mpicxx.h src/include |
|---|
| 2708 | if test ! -d bin ; then mkdir bin ; fi |
|---|
| 2709 | sed -e 's%includedir=.*%includedir='$includebuild_dir% \ |
|---|
| 2710 | -e 's%libdir=.*%libdir='$libbuild_dir% \ |
|---|
| 2711 | -e 's%^opalibdir=.*%opalibdir='$opalibbuild_dir% \ |
|---|
| 2712 | src/env/mpicxx > bin/mpicxx ; |
|---|
| 2713 | chmod a+x bin/mpicxx |
|---|
| 2714 | ln -sf mpicxx bin/mpic++ |
|---|
| 2715 | else |
|---|
| 2716 | rm -f src/env/mpicxx src/env/mpicxx.conf |
|---|
| 2717 | fi |
|---|
| 2718 | ], |
|---|
| 2719 | enable_cxx=$enable_cxx |
|---|
| 2720 | includebuild_dir=$includebuild_dir |
|---|
| 2721 | libbuild_dir=$libbuild_dir |
|---|
| 2722 | bashWorks=$bashWorks) |
|---|
| 2723 | |
|---|
| 2724 | AC_SUBST(bindings) |
|---|
| 2725 | # Bindings dirs is used for the installation target |
|---|
| 2726 | AC_SUBST(bindings_dirs) |
|---|
| 2727 | # |
|---|
| 2728 | # A few final exports |
|---|
| 2729 | # Some users use FC, others F77 for the Fortran compiler. The following |
|---|
| 2730 | # tests makes us consistent |
|---|
| 2731 | if test -z "$FC" -a -n "$F77" ; then FC="$F77" ; export FC ; fi |
|---|
| 2732 | if test -z "$F77" -a -n "$FC" ; then F77="$FC" ; export F77 ; fi |
|---|
| 2733 | AC_SUBST(FC) |
|---|
| 2734 | # ---------------------------------------------------------------------------- |
|---|
| 2735 | # End of the bindings support |
|---|
| 2736 | # ---------------------------------------------------------------------------- |
|---|
| 2737 | |
|---|
| 2738 | AC_LANG_C |
|---|
| 2739 | # |
|---|
| 2740 | # ---------------------------------------------------------------------------- |
|---|
| 2741 | # Done with the basic argument processing and decisions about which |
|---|
| 2742 | # subsystems to build |
|---|
| 2743 | # ---------------------------------------------------------------------------- |
|---|
| 2744 | |
|---|
| 2745 | # Look for perl. Perl is used *only* in the tests of the commands such as |
|---|
| 2746 | # mpiexec, mpicc, etc, in test/commands, and in some of the utility |
|---|
| 2747 | # programs for processing log files . If perl is not found, |
|---|
| 2748 | # MPICH2 may still be built and used. |
|---|
| 2749 | # We need the full path to perl since we'll use it as the interpreter for |
|---|
| 2750 | # a shell script. |
|---|
| 2751 | AC_PATH_PROG(PERL,perl) |
|---|
| 2752 | # Look for ar. If we fail, abort |
|---|
| 2753 | AC_CHECK_PROGS(AR,ar) |
|---|
| 2754 | if test -z "$AR" ; then |
|---|
| 2755 | AC_MSG_ERROR([The program ar is required for building MPICH2. Make sure that your path includes ar]) |
|---|
| 2756 | fi |
|---|
| 2757 | # Note that we set RANLIB to true if we don't find it (some systems neither |
|---|
| 2758 | # need it nor provide it) |
|---|
| 2759 | AC_CHECK_PROGS(RANLIB,ranlib,true) |
|---|
| 2760 | |
|---|
| 2761 | # Check for etags. Note that different versions of etags take |
|---|
| 2762 | # different arguments for specifying the language to use in parsing a |
|---|
| 2763 | # file. Older versions only accept -l c or --language c as a way to |
|---|
| 2764 | # *change* the interpretation of the following files; newer versions |
|---|
| 2765 | # allow --langmap=c:+.i to add a file extension to those that are C |
|---|
| 2766 | # programs. New versions might want --language-force=c. |
|---|
| 2767 | AC_CHECK_PROGS(ETAGS,etags,true) |
|---|
| 2768 | if test -n "$ETAGS" -a "$ETAGS" != true ; then |
|---|
| 2769 | # Check for the --langmap argument |
|---|
| 2770 | AC_MSG_CHECKING([for etags argument to specify language]) |
|---|
| 2771 | cat >>conftest.c <<EOF |
|---|
| 2772 | int footest = 0; |
|---|
| 2773 | EOF |
|---|
| 2774 | if $ETAGS --langmap=c:+.i -o conftesttags conftest.c >/dev/null 2>&1 ; then |
|---|
| 2775 | ETAGSADD="--langmap=c:+.i" |
|---|
| 2776 | else |
|---|
| 2777 | if $ETAGS --language=c -o conftesttags conftest.c >/dev/null 2>&1 ; then |
|---|
| 2778 | ETAGSADD="--language=c" |
|---|
| 2779 | else |
|---|
| 2780 | if $ETAGS --language-force=c -o conftesttags conftest.c >/dev/null 2>&1 ; then |
|---|
| 2781 | ETAGSADD="--language-force=c" |
|---|
| 2782 | else |
|---|
| 2783 | ETAGS=true |
|---|
| 2784 | AC_MSG_WARN([Could not find working etags]) |
|---|
| 2785 | fi |
|---|
| 2786 | fi |
|---|
| 2787 | fi |
|---|
| 2788 | if test -n "$ETAGSADD" ; then |
|---|
| 2789 | AC_MSG_RESULT($ETAGSADD) |
|---|
| 2790 | fi |
|---|
| 2791 | # This is needed for Mac OSX 10.5 |
|---|
| 2792 | rm -rf conftest.dSYM |
|---|
| 2793 | rm -f conftest* |
|---|
| 2794 | fi |
|---|
| 2795 | AC_SUBST(ETAGS) |
|---|
| 2796 | AC_SUBST(ETAGSADD) |
|---|
| 2797 | export ETAGS |
|---|
| 2798 | export ETAGSADD |
|---|
| 2799 | |
|---|
| 2800 | # Check for the killall program; this can be used in some of the tests |
|---|
| 2801 | # in test/commands |
|---|
| 2802 | AC_CHECK_PROGS(KILLALL,killall,true) |
|---|
| 2803 | |
|---|
| 2804 | # Does xargs need the -r option to handle the case where the input |
|---|
| 2805 | # is empty (gnu utils do, Mac OSX does not accept -r) |
|---|
| 2806 | xargs_out=`echo "" | xargs ls | wc -l | sed -e 's/ //g'` |
|---|
| 2807 | if test "$xargs_out" != "0" ; then |
|---|
| 2808 | XARGS_NODATA_OPT=-r |
|---|
| 2809 | fi |
|---|
| 2810 | AC_SUBST(XARGS_NODATA_OPT) |
|---|
| 2811 | |
|---|
| 2812 | # Check for broken handling of common symbols. There are two fixes: |
|---|
| 2813 | # Force ranlib to handle correctly (ranlib -c on some BSD and MAC OS platforms) |
|---|
| 2814 | # or force gcc to not generate common symbols if using gcc (-fno-common). |
|---|
| 2815 | # This autoconf macro checks for this. |
|---|
| 2816 | |
|---|
| 2817 | # Note that if an option is added to CFLAGS, that option MUST NOT appear |
|---|
| 2818 | # in WRAPPER_CFLAGS (i.e., the options used in mpicc) |
|---|
| 2819 | |
|---|
| 2820 | # Also note that it should not be necessary to use this option - it |
|---|
| 2821 | # is almost always possible to avoid "common" symbols, and this approach |
|---|
| 2822 | # is gcc-specific (if it needs to choose -fno-common), which we want to avoid. |
|---|
| 2823 | dnl PAC_PROG_C_BROKEN_COMMON |
|---|
| 2824 | # |
|---|
| 2825 | AC_PROG_INSTALL |
|---|
| 2826 | PAC_PROG_CHECK_INSTALL_WORKS |
|---|
| 2827 | # |
|---|
| 2828 | # On Mac OS/X, install breaks libraries unless used with the -p switch |
|---|
| 2829 | PAC_PROG_INSTALL_BREAKS_LIBS |
|---|
| 2830 | # We also need mkdir -p. |
|---|
| 2831 | PAC_PROG_MKDIR_P |
|---|
| 2832 | PAC_PROG_MAKE |
|---|
| 2833 | |
|---|
| 2834 | # |
|---|
| 2835 | # Check for bash to allow more robust shell scripts |
|---|
| 2836 | AC_PATH_PROG(BASH_SHELL,bash) |
|---|
| 2837 | # |
|---|
| 2838 | # Confirm that bash has working arrays. We can use this to |
|---|
| 2839 | # build more robust versions of the scripts (particularly the |
|---|
| 2840 | # compliation scripts) by taking advantage of the array features in |
|---|
| 2841 | # bash. |
|---|
| 2842 | bashWorks=no |
|---|
| 2843 | if test -x "$BASH_SHELL" ; then |
|---|
| 2844 | changequote(%%,::)dnl |
|---|
| 2845 | cat >>conftest <<EOF |
|---|
| 2846 | #! $BASH_SHELL |
|---|
| 2847 | A[0]="b" |
|---|
| 2848 | A[1]="c" |
|---|
| 2849 | rc=1 |
|---|
| 2850 | if test \${A[1]} != "c" ; then rc=2 ; else rc=0 ; fi |
|---|
| 2851 | exit \$rc |
|---|
| 2852 | EOF |
|---|
| 2853 | changequote([,])dnl |
|---|
| 2854 | AC_MSG_CHECKING([whether $BASH_SHELL supports arrays]) |
|---|
| 2855 | chmod +x conftest |
|---|
| 2856 | if ./conftest 2>&1 >/dev/null ; then |
|---|
| 2857 | bashWorks=yes |
|---|
| 2858 | else |
|---|
| 2859 | bashWorks=no |
|---|
| 2860 | fi |
|---|
| 2861 | rm -f conftest* |
|---|
| 2862 | AC_MSG_RESULT($bashWorks) |
|---|
| 2863 | fi |
|---|
| 2864 | BUILD_BASH_SCRIPTS=no |
|---|
| 2865 | if test "$bashWorks" = yes ; then |
|---|
| 2866 | BUILD_BASH_SCRIPTS=yes |
|---|
| 2867 | fi |
|---|
| 2868 | AC_SUBST(BUILD_BASH_SCRIPTS) |
|---|
| 2869 | |
|---|
| 2870 | # ---------------------------------------------------------------------------- |
|---|
| 2871 | # Check for the routines and libraries needed for accessing dynamically |
|---|
| 2872 | # loaded libraries. |
|---|
| 2873 | # This is very approximate for now; it is enough to allow use to experiment |
|---|
| 2874 | # with this feature under Linux. |
|---|
| 2875 | # ---------------------------------------------------------------------------- |
|---|
| 2876 | BUILD_DLLS=no |
|---|
| 2877 | if test "$enable_dynamiclibs" = "yes" ; then |
|---|
| 2878 | AC_CHECK_HEADERS(dlfcn.h) |
|---|
| 2879 | AC_SEARCH_LIBS(dlopen,dl) |
|---|
| 2880 | AC_CHECK_FUNCS(dlopen dlsym) |
|---|
| 2881 | if test "$ac_cv_func_dlopen" = yes -a \ |
|---|
| 2882 | "$ac_cv_func_dlsym" = yes -a \ |
|---|
| 2883 | "$ac_cv_header_dlfcn_h" = yes ; then |
|---|
| 2884 | AC_DEFINE(USE_DYNAMIC_LIBRARIES,1,[Define if dynamic libraries are available and should be used]) |
|---|
| 2885 | if test "$enable_sharedlibs" = no -o "$enable_sharedlibs" = none -o \ |
|---|
| 2886 | -z "$enable_sharedlibs" ; then |
|---|
| 2887 | AC_MSG_ERROR([You must specify --enable-sharedlibs=type when building with dynamic libraries]) |
|---|
| 2888 | dnl # We still need to determine how to build shared libraries |
|---|
| 2889 | dnl AC_MSG_CHECKING([for how to build shared library for dynamically loaded libraries]) |
|---|
| 2890 | dnl PAC_CC_SHAREDLIBS(,CC_SHL,C_LINK_SHL) |
|---|
| 2891 | dnl PAC_CC_SHLIB_EXT |
|---|
| 2892 | dnl if test "$SHLIB_EXT" = "unknown" ; then |
|---|
| 2893 | dnl # Guess that the extension is .so |
|---|
| 2894 | dnl SHLIB_EXT=so |
|---|
| 2895 | dnl fi |
|---|
| 2896 | dnl if test "$CC_SHL" = true ; then |
|---|
| 2897 | dnl AC_MSG_RESULT([none found]) |
|---|
| 2898 | dnl AC_MSG_WARN([Dynamic library support requires shared libraries]) |
|---|
| 2899 | dnl else |
|---|
| 2900 | dnl AC_MSG_RESULT($CC_SHL) |
|---|
| 2901 | dnl BUILD_DLLS=yes |
|---|
| 2902 | dnl fi |
|---|
| 2903 | fi |
|---|
| 2904 | fi |
|---|
| 2905 | AC_SUBST(BUILD_DLLS) |
|---|
| 2906 | |
|---|
| 2907 | # Let the DLL code know where we plan to install the libraries. |
|---|
| 2908 | # This will make it easier for the user, who may not need |
|---|
| 2909 | # to set a search path for the library. |
|---|
| 2910 | savePrefix=$prefix |
|---|
| 2911 | saveExecprefix=$exec_prefix |
|---|
| 2912 | test "x$prefix" = xNONE && prefix=$ac_default_prefix |
|---|
| 2913 | test "x$exec_prefix" = xNONE && exec_prefix=$prefix |
|---|
| 2914 | eval MPICH2_LIBDIR=$libdir |
|---|
| 2915 | prefix=$savePrefix |
|---|
| 2916 | exec_prefix=$saveExecprefix |
|---|
| 2917 | MPICH2_LIBDIR='"'$MPICH2_LIBDIR'"' |
|---|
| 2918 | AC_DEFINE_UNQUOTED(MPICH2_LIBDIR,$MPICH2_LIBDIR,[Name of installation directory intended for MPICH2]) |
|---|
| 2919 | fi |
|---|
| 2920 | |
|---|
| 2921 | # ---------------------------------------------------------------------------- |
|---|
| 2922 | # Don't setup the shared libraries until we know which compiler we will be |
|---|
| 2923 | # using |
|---|
| 2924 | PAC_ARG_SHAREDLIBS |
|---|
| 2925 | # We allow aliases for enable_sharedlibs, but after ARG_SHAREDLIBS, |
|---|
| 2926 | # enable_sharedlibs contains the cannonical version |
|---|
| 2927 | ENABLE_SHLIB="$enable_sharedlibs" |
|---|
| 2928 | if test -z "$ENABLE_SHLIB" -o "$ENABLE_SHLIB" = "no" ; then |
|---|
| 2929 | ENABLE_SHLIB=none |
|---|
| 2930 | fi |
|---|
| 2931 | # Special restrictions for some shared libraries |
|---|
| 2932 | # It is difficult to import/export symbols from some shared libraries, so |
|---|
| 2933 | # in that case, we require PMPILIBNAME and MPILIBNAME be the same |
|---|
| 2934 | case $ENABLE_SHLIB in |
|---|
| 2935 | cygwin-gcc) |
|---|
| 2936 | if test "$PMPILIBNAME_set" = "no" ; then |
|---|
| 2937 | # Rename PMPILIBNAME |
|---|
| 2938 | PMPILIBNAME=$MPILIBNAME |
|---|
| 2939 | else |
|---|
| 2940 | if test "$PMPILIBNAME" != "$MPILIBNAME" ; then |
|---|
| 2941 | AC_MSG_ERROR([The PMPI and MPI libraries must have the same name when building shared libraries of type $ENABLE_SHLIB]) |
|---|
| 2942 | fi |
|---|
| 2943 | fi |
|---|
| 2944 | ;; |
|---|
| 2945 | esac |
|---|
| 2946 | AC_SUBST(ENABLE_SHLIB) |
|---|
| 2947 | AC_SUBST(C_LINKPATH_SHL) |
|---|
| 2948 | # Now that CC is defined, get these values |
|---|
| 2949 | # eval C_LINK_SHL=$C_LINK_SHL |
|---|
| 2950 | # eval CC_SHL=$CC_SHL |
|---|
| 2951 | # Ensure that all subdir configures get the shared library items |
|---|
| 2952 | export CC_SHL |
|---|
| 2953 | export C_LINK_SHL |
|---|
| 2954 | export C_LINKPATH_SHL |
|---|
| 2955 | export SHLIB_EXT |
|---|
| 2956 | export ENABLE_SHLIB |
|---|
| 2957 | export LIBTOOL |
|---|
| 2958 | |
|---|
| 2959 | # ---------------------------------------------------------------------------- |
|---|
| 2960 | # At this point, we've finally settled on the value of PMPILIBNAME. We |
|---|
| 2961 | # can now set NEEDSPLIB. |
|---|
| 2962 | if test "$NEEDSPLIB" = yes -a "$PMPILIBNAME" = "$MPILIBNAME" ; then |
|---|
| 2963 | NEEDSPLIB=no |
|---|
| 2964 | fi |
|---|
| 2965 | # Set the defaults for the Fortran libraries to be the same as the C libraries |
|---|
| 2966 | if test -z "$MPIFLIBNAME" ; then |
|---|
| 2967 | MPIFLIBNAME=$MPILIBNAME |
|---|
| 2968 | fi |
|---|
| 2969 | if test -z "$PMPIFLIBNAME" ; then |
|---|
| 2970 | PMPIFLIBNAME=$PMPILIBNAME |
|---|
| 2971 | fi |
|---|
| 2972 | |
|---|
| 2973 | # ---------------------------------------------------------------------------- |
|---|
| 2974 | # |
|---|
| 2975 | # Add the steps for debugger support |
|---|
| 2976 | BUILD_TVDLL=no |
|---|
| 2977 | if test "$enable_debuginfo" = "yes" ; then |
|---|
| 2978 | # We can build the Totalview interface DLL only if we know how to build |
|---|
| 2979 | # shared libraries. For now, require that enable_sharedlibs is not none |
|---|
| 2980 | # Also, we may want to put some of this into a configure in the debugger |
|---|
| 2981 | # directory |
|---|
| 2982 | if test "$ENABLE_SHLIB" != "none" ; then |
|---|
| 2983 | BUILD_TVDLL=yes |
|---|
| 2984 | CC_SHL_DBG="$CC_SHL" |
|---|
| 2985 | C_LINK_SHL_DBG="$C_LINK_SHL" |
|---|
| 2986 | DBG_SHLIB_TYPE=$ENABLE_SHLIB |
|---|
| 2987 | else |
|---|
| 2988 | # Try to determine how to build the tv shared library |
|---|
| 2989 | AC_MSG_RESULT([for how to build shared library for debugger interface]) |
|---|
| 2990 | PAC_CC_SHAREDLIBS(,CC_SHL_DBG,C_LINK_SHL_DBG,DBG_SHLIB_TYPE) |
|---|
| 2991 | PAC_CC_SHLIB_EXT |
|---|
| 2992 | if test "$SHLIB_EXT" = "unknown" ; then |
|---|
| 2993 | # Guess that the extension is .so |
|---|
| 2994 | SHLIB_EXT=so |
|---|
| 2995 | fi |
|---|
| 2996 | if test "$CC_SHL_DBG" = true ; then |
|---|
| 2997 | AC_MSG_RESULT([none found]) |
|---|
| 2998 | AC_MSG_WARN([Debugger support requires shared libraries]) |
|---|
| 2999 | else |
|---|
| 3000 | AC_MSG_RESULT([Use this to build the debugger shared library: $CC_SHL_DBG]) |
|---|
| 3001 | BUILD_TVDLL=yes |
|---|
| 3002 | fi |
|---|
| 3003 | fi |
|---|
| 3004 | AC_SUBST(DBG_SHLIB_TYPE) |
|---|
| 3005 | # One more nasty problem. Totalview relies on debugger symbols |
|---|
| 3006 | # being present in the executable. Some experimental versions of |
|---|
| 3007 | # gcc (3.2 20020329 for ia64) do *not* include the object symbols |
|---|
| 3008 | # when debugging. For HPUX, the necessary linking options are |
|---|
| 3009 | # +noobjdebug |
|---|
| 3010 | # for C, Fortran, and C++. We don't have a good test for this yet, |
|---|
| 3011 | # so we add a warning |
|---|
| 3012 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 3013 | AC_MSG_WARN([Some versions of gcc do not include debugging information |
|---|
| 3014 | within the executable. Totalview requires this information to detect |
|---|
| 3015 | an MPICH code. If you have trouble, try linking with the additional |
|---|
| 3016 | option |
|---|
| 3017 | +noobjdebug |
|---|
| 3018 | on all link lines (consider adding it to LDFLAGS)]) |
|---|
| 3019 | fi |
|---|
| 3020 | AC_SUBST(BUILD_TVDLL) |
|---|
| 3021 | AC_SUBST(CC_SHL_DBG) |
|---|
| 3022 | AC_SUBST(C_LINK_SHL_DBG) |
|---|
| 3023 | |
|---|
| 3024 | # The debugger library name cannot be set until we know the extension |
|---|
| 3025 | # of shared libraries - the name is so on most Unix system, dylib on OS X. |
|---|
| 3026 | debugger_dir=debugger |
|---|
| 3027 | AC_DEFINE(HAVE_DEBUGGER_SUPPORT,1,[Define if debugger support is included]) |
|---|
| 3028 | # The debugger support requires a shared library. This is handled |
|---|
| 3029 | # below, after we check for compiler support for shared libraries |
|---|
| 3030 | # Note: if libdir contains exec_prefix, handle the fact that the |
|---|
| 3031 | # default exec_prefix is NONE, which (much later in configure) |
|---|
| 3032 | # gets turned into the value of prefix |
|---|
| 3033 | ##ENVVAR: MPICH_DEBUGLIBNAME - Set this environment variable to |
|---|
| 3034 | ## override the default name of the debugger support library. |
|---|
| 3035 | ## The default name is libtvmpich2.$SHLIB_EXT (e.g., libtvmpich2.so for |
|---|
| 3036 | ## most Unix versions, libtvmpich2.dylib for Mac OSX). |
|---|
| 3037 | ##ENVVAR END: |
|---|
| 3038 | if test -z "$MPICH_DEBUGLIBNAME" ; then |
|---|
| 3039 | DEBUGLIBNAME=libtvmpich2.$SHLIB_EXT |
|---|
| 3040 | else |
|---|
| 3041 | DEBUGLIBNAME=$MPICH_DEBUGLIBNAME |
|---|
| 3042 | fi |
|---|
| 3043 | if test "x$exec_prefix" = xNONE ; then |
|---|
| 3044 | saveExecPrefix=$exec_prefix |
|---|
| 3045 | exec_prefix=$prefix |
|---|
| 3046 | eval dlldir=$libdir/$DEBUGLIBNAME |
|---|
| 3047 | exec_prefix=$saveExecPrefix |
|---|
| 3048 | else |
|---|
| 3049 | eval dlldir=$libdir/$DEBUGLIBNAME |
|---|
| 3050 | fi |
|---|
| 3051 | dlldir='"'$dlldir'"' |
|---|
| 3052 | AC_DEFINE_UNQUOTED(MPICH_INFODLL_LOC,$dlldir,[Define as the name of the debugger support library]) |
|---|
| 3053 | fi |
|---|
| 3054 | AC_SUBST(debugger_dir) |
|---|
| 3055 | |
|---|
| 3056 | # ---------------------------------------------------------------------------- |
|---|
| 3057 | |
|---|
| 3058 | nameserv_name="" |
|---|
| 3059 | AC_SUBST(nameserv_name) |
|---|
| 3060 | # |
|---|
| 3061 | # Get the default nameserver, if no nameserver was selected. A process |
|---|
| 3062 | # manager may advertise a nameserver name by setting the variable |
|---|
| 3063 | # MPID_PM_NAMESERVER. |
|---|
| 3064 | if test "$with_namepublisher" = "default" ; then |
|---|
| 3065 | if test -n "$MPID_PM_NAMESERVER" ; then |
|---|
| 3066 | with_namepublisher=$MPID_PM_NAMESERVER |
|---|
| 3067 | else |
|---|
| 3068 | # The default is to use a file to communicate published names |
|---|
| 3069 | with_namepublisher=file |
|---|
| 3070 | fi |
|---|
| 3071 | fi |
|---|
| 3072 | |
|---|
| 3073 | if test "$with_namepublisher" != no -a "$with_namepublisher" != "none" ; then |
|---|
| 3074 | case "$with_namepublisher" in |
|---|
| 3075 | none|no) ;; |
|---|
| 3076 | ldap*) |
|---|
| 3077 | subsystems="$subsystems src/nameserv/ldap" |
|---|
| 3078 | # The configure in the nameserv/ldap directory will look for |
|---|
| 3079 | # the ldap files. |
|---|
| 3080 | AC_DEFINE(USE_LDAP_FOR_NAMEPUB,1,[Define if ldap should be used for name publishing]) |
|---|
| 3081 | nameserv_name="ldap" |
|---|
| 3082 | ;; |
|---|
| 3083 | |
|---|
| 3084 | file*) |
|---|
| 3085 | # Note that we always build the Makefile for the file version because |
|---|
| 3086 | # this name publisher is really too simple to require a |
|---|
| 3087 | # separate configure, and we might as well include a basic |
|---|
| 3088 | # name publisher with any MPICH2 distribution |
|---|
| 3089 | # We DO need to extract the directory name that is used for writing |
|---|
| 3090 | # the files, with the User's home directory as the default |
|---|
| 3091 | nameserv_name="file" |
|---|
| 3092 | basedir=`echo $with_namepublisher | sed -e 's/file://'` |
|---|
| 3093 | if test "$basedir" = "$with_namepublisher" ; then |
|---|
| 3094 | # Reset since no directory was set. |
|---|
| 3095 | basedir='"."'; |
|---|
| 3096 | fi |
|---|
| 3097 | AC_DEFINE_UNQUOTED(FILE_NAMEPUB_BASEDIR,$basedir,[Directory to use in namepub]) |
|---|
| 3098 | AC_DEFINE(USE_FILE_FOR_NAMEPUB,1,[Define if file should be used for name publisher]) |
|---|
| 3099 | ;; |
|---|
| 3100 | |
|---|
| 3101 | mpd) |
|---|
| 3102 | nameserv_name="mpd" |
|---|
| 3103 | ;; |
|---|
| 3104 | |
|---|
| 3105 | *) |
|---|
| 3106 | # Check for a new namepublisher |
|---|
| 3107 | dir=$with_namepublisher |
|---|
| 3108 | # If we later need args, here is where we can strip them off of the |
|---|
| 3109 | # with argument |
|---|
| 3110 | if test -d "$use_top_srcdir/src/nameserv/$dir" ; then |
|---|
| 3111 | if test -x "$use_top_srcdir/src/nameserv/$dir/configure" ; then |
|---|
| 3112 | # Run the configure in this directory if necessary |
|---|
| 3113 | subsystems="$subsystems src/nameserv/$dir" |
|---|
| 3114 | fi |
|---|
| 3115 | nameserv_name=$dir |
|---|
| 3116 | else |
|---|
| 3117 | AC_MSG_WARN([Unknown name publisher $with_namepublisher]) |
|---|
| 3118 | fi |
|---|
| 3119 | ;; |
|---|
| 3120 | esac |
|---|
| 3121 | fi |
|---|
| 3122 | if test -n "$nameserv_name" ; then |
|---|
| 3123 | AC_DEFINE(HAVE_NAMEPUB_SERVICE,1,[Define if a name publishing service is available]) |
|---|
| 3124 | fi |
|---|
| 3125 | |
|---|
| 3126 | # In case the documentation targets are used, find doctext and attempt to |
|---|
| 3127 | # find the source for the doctext LaTeX style files. Use "false" if |
|---|
| 3128 | # doctext is not found |
|---|
| 3129 | AC_PATH_PROG(DOCTEXT,doctext,false) |
|---|
| 3130 | if test -n "$DOCTEXT" ; then |
|---|
| 3131 | if test -z "$DOCTEXTSYTLE" ; then |
|---|
| 3132 | AC_MSG_CHECKING([for location of doctext style files]) |
|---|
| 3133 | dpath=`doctext -debug_paths 2>&1 | grep 'default path' | \ |
|---|
| 3134 | sed -e 's%.*default path\(.*\),%\1:%g'` |
|---|
| 3135 | saveIFS="$IFS" |
|---|
| 3136 | IFS=": " |
|---|
| 3137 | for dir in $dpath ; do |
|---|
| 3138 | if test -s $dir/refman.sty ; then |
|---|
| 3139 | DOCTEXTSTYLE=$dir |
|---|
| 3140 | break |
|---|
| 3141 | fi |
|---|
| 3142 | done |
|---|
| 3143 | IFS="$saveIFS" |
|---|
| 3144 | if test -n "$DOCTEXTSTYLE" ; then |
|---|
| 3145 | AC_MSG_RESULT($DOCTEXTSTYLE) |
|---|
| 3146 | else |
|---|
| 3147 | AC_MSG_RESULT([unavailable]) |
|---|
| 3148 | fi |
|---|
| 3149 | fi |
|---|
| 3150 | fi |
|---|
| 3151 | export DOCTEXT |
|---|
| 3152 | export DOCTEXTSTYLE |
|---|
| 3153 | AC_SUBST(DOCTEXT) |
|---|
| 3154 | AC_SUBST(DOCTEXTSTYLE) |
|---|
| 3155 | |
|---|
| 3156 | # ---------------------------------------------------------------------------- |
|---|
| 3157 | # Check for C compiler characteristics |
|---|
| 3158 | AC_C_CONST |
|---|
| 3159 | PAC_C_VOLATILE |
|---|
| 3160 | PAC_C_RESTRICT |
|---|
| 3161 | |
|---|
| 3162 | saveCFLAGS=$CFLAGS |
|---|
| 3163 | CFLAGS="$CFLAGS $MPICH2_EXTRA_CFLAGS" |
|---|
| 3164 | AC_C_INLINE |
|---|
| 3165 | CFLAGS=$saveCFLAGS |
|---|
| 3166 | |
|---|
| 3167 | PAC_C_GNU_ATTRIBUTE |
|---|
| 3168 | # We need to check for the endianess in order to implement the |
|---|
| 3169 | # "external32" representations. This defines "WORDS_BIGENDIAN when |
|---|
| 3170 | # the system is bigendian. |
|---|
| 3171 | # As of autoconf 2.62, this macro takes an additional argument for systems |
|---|
| 3172 | # that can produce object files for either endianess. |
|---|
| 3173 | # With the as-always-incompatible-with-every-version autoconf, the |
|---|
| 3174 | # arguments for this macro *changed* in 2.62 to |
|---|
| 3175 | # (if-bigendian,if-littleendian,unknown,universal) |
|---|
| 3176 | # The fourth argument is new. |
|---|
| 3177 | # Also note that the definition emitted by autoheader requires that gcc |
|---|
| 3178 | # be used to compile the programs - other compilers may not define the |
|---|
| 3179 | # non-standard __BIG_ENDIAN__ or __LITTLE_ENDIAN__ CPP names on which |
|---|
| 3180 | # autoconf 2.62 now depends. |
|---|
| 3181 | byteOrdering=unknown |
|---|
| 3182 | AC_C_BIGENDIAN(byteOrdering=big,byteOrdering=little,,byteOrdering=universal) |
|---|
| 3183 | case $byteOrdering in |
|---|
| 3184 | big) |
|---|
| 3185 | # Nothing to do - the c_bigendian macro takes care of it |
|---|
| 3186 | : |
|---|
| 3187 | ;; |
|---|
| 3188 | little) |
|---|
| 3189 | AC_DEFINE(WORDS_LITTLEENDIAN,1,[Define if words are little endian]) |
|---|
| 3190 | ;; |
|---|
| 3191 | universal) |
|---|
| 3192 | AC_DEFINE(WORDS_UNIVERSAL_ENDIAN,1,[Define if configure will not tell us, for universal binaries]) |
|---|
| 3193 | ;; |
|---|
| 3194 | unknown) |
|---|
| 3195 | AC_MSG_ERROR([Unable to determine endianess]) |
|---|
| 3196 | ;; |
|---|
| 3197 | esac |
|---|
| 3198 | |
|---|
| 3199 | # We only need this test if we are using Fortran |
|---|
| 3200 | if test "$enable_f77" ; then |
|---|
| 3201 | PAC_PROG_C_UNALIGNED_DOUBLES(, |
|---|
| 3202 | [AC_MSG_WARN(Your C compiler $CC does not support unaligned accesses |
|---|
| 3203 | to doubles. This is required for interoperation with |
|---|
| 3204 | Fortran (the Fortran standard requires it). |
|---|
| 3205 | You may need to specify an additional argument to your C compiler to |
|---|
| 3206 | force it to allow unaligned accesses.)]) |
|---|
| 3207 | fi |
|---|
| 3208 | # Check for __func__ (defined in C99) or __FUNCTION__ (defined in older GCC) |
|---|
| 3209 | AC_CACHE_CHECK([whether $CC supports __func__],pac_cv_cc_has___func__, |
|---|
| 3210 | [AC_TRY_COMPILE([], |
|---|
| 3211 | [const char *cp = __func__; ],pac_cv_cc_has___func__=yes, |
|---|
| 3212 | pac_cv_cc_has___func__=no)]) |
|---|
| 3213 | if test "$pac_cv_cc_has___func__" != "yes" ; then |
|---|
| 3214 | AC_CACHE_CHECK([whether $CC supports __FUNCTION__],pac_cv_cc_has___FUNCTION__, |
|---|
| 3215 | [AC_TRY_COMPILE([], |
|---|
| 3216 | [const char *cp = __FUNCTION__;],pac_cv_cc_has___FUNCTION__=yes, |
|---|
| 3217 | pac_cv_cc_has___FUNCTION__=no)]) |
|---|
| 3218 | fi |
|---|
| 3219 | |
|---|
| 3220 | # ---------------------------------------------------------------------------- |
|---|
| 3221 | # Attempt to support dependency handling |
|---|
| 3222 | # ---------------------------------------------------------------------------- |
|---|
| 3223 | # Set a default for MAKE_DEPEND_C |
|---|
| 3224 | MAKE_DEPEND_C=true |
|---|
| 3225 | AC_SUBST(MAKE_DEPEND_C) |
|---|
| 3226 | AC_ARG_ENABLE(dependencies,[ |
|---|
| 3227 | --enable-dependencies - Generate dependencies for sourcefiles. This |
|---|
| 3228 | requires that the Makefile.in files are also created |
|---|
| 3229 | to support dependencies (see maint/updatefiles)],, |
|---|
| 3230 | enable_dependencies=default) |
|---|
| 3231 | # |
|---|
| 3232 | # |
|---|
| 3233 | if test -z "$enable_dependencies" ; then |
|---|
| 3234 | enable_dependencies=default |
|---|
| 3235 | fi |
|---|
| 3236 | if test "$enable_dependencies" = "default" ; then |
|---|
| 3237 | # Try to use gcc if available |
|---|
| 3238 | enable_dependencies=no |
|---|
| 3239 | if test "$ac_cv_prog_gcc" != "yes" ; then |
|---|
| 3240 | # See if gcc is available |
|---|
| 3241 | AC_CHECK_PROGS(GCC,gcc) |
|---|
| 3242 | if test -n "$GCC" ; then |
|---|
| 3243 | enable_dependencies=gcc |
|---|
| 3244 | else |
|---|
| 3245 | # Try for another form, based on the stock compiler on the |
|---|
| 3246 | # given system |
|---|
| 3247 | ostype=`uname -s` |
|---|
| 3248 | case "$ostype" in |
|---|
| 3249 | SunOS) |
|---|
| 3250 | enable_dependencies=solaris |
|---|
| 3251 | ;; |
|---|
| 3252 | *) |
|---|
| 3253 | # Unrecognized; ignore |
|---|
| 3254 | ;; |
|---|
| 3255 | esac |
|---|
| 3256 | fi |
|---|
| 3257 | else |
|---|
| 3258 | enable_dependencies=gcc |
|---|
| 3259 | fi |
|---|
| 3260 | # We use this to indicate that we use gcc for dependencies, |
|---|
| 3261 | # even if a different compiler (e.g., pgcc) is selected for |
|---|
| 3262 | # compiling the code. This will normally be adequate, even |
|---|
| 3263 | # if gcc points to different system header files, we're really |
|---|
| 3264 | # only interested in dependencies on the MPICH2 source files. |
|---|
| 3265 | if test "$enable_dependencies" = "gcc" ; then |
|---|
| 3266 | AC_MSG_RESULT([Using gcc to determine dependencies]) |
|---|
| 3267 | fi |
|---|
| 3268 | fi |
|---|
| 3269 | if test "$enable_dependencies" != "no" ; then |
|---|
| 3270 | case "$enable_dependencies" in |
|---|
| 3271 | gcc|yes) |
|---|
| 3272 | # Ensure that the profiling libraries get their targets into |
|---|
| 3273 | # the files. Use -MMD if you want the file in the build directory |
|---|
| 3274 | # instead of a subdirectory |
|---|
| 3275 | MAKE_DEPEND_C="gcc -MM" |
|---|
| 3276 | ;; |
|---|
| 3277 | solaris) |
|---|
| 3278 | # At least some Solaris SunPro compilers accept -xM1 -MT name, though |
|---|
| 3279 | # they ignore the -MT name argument. |
|---|
| 3280 | MAKE_DEPEND_C="cc -xM1" |
|---|
| 3281 | ;; |
|---|
| 3282 | *) |
|---|
| 3283 | AC_MSG_RESULT([Using $enable_dependencies for MAKE_DEPEND_C]) |
|---|
| 3284 | MAKE_DEPEND_C="$enable_dependencies" |
|---|
| 3285 | ;; |
|---|
| 3286 | esac |
|---|
| 3287 | fi |
|---|
| 3288 | export MAKE_DEPEND_C |
|---|
| 3289 | # ---------------------------------------------------------------------------- |
|---|
| 3290 | # Check on support for long double and long long types. Do this before the |
|---|
| 3291 | # structure alignment test because it will test for including those |
|---|
| 3292 | # types as well. In addition, allow the device to suppress support for these |
|---|
| 3293 | # optional C types by setting MPID_NO_LONG_DOUBLE and/or MPID_NO_LONG_LONG |
|---|
| 3294 | # to yes. |
|---|
| 3295 | if test "$MPID_NO_LONG_DOUBLE" != "yes" ; then |
|---|
| 3296 | AC_CACHE_CHECK([whether long double is supported], |
|---|
| 3297 | pac_cv_have_long_double,[ |
|---|
| 3298 | AC_TRY_COMPILE(,[long double a;], |
|---|
| 3299 | pac_cv_have_long_double=yes,pac_cv_have_long_double=no)]) |
|---|
| 3300 | if test "$pac_cv_have_long_double" = "yes" ; then |
|---|
| 3301 | AC_DEFINE(HAVE_LONG_DOUBLE,1,[Define if long double is supported]) |
|---|
| 3302 | fi |
|---|
| 3303 | fi |
|---|
| 3304 | if test "$MPID_NO_LONG_LONG" != "yes" ; then |
|---|
| 3305 | AC_CACHE_CHECK([whether long long is supported], |
|---|
| 3306 | pac_cv_have_long_long,[ |
|---|
| 3307 | AC_TRY_COMPILE(,[long long a;], |
|---|
| 3308 | pac_cv_have_long_long=yes,pac_cv_have_long_long=no)]) |
|---|
| 3309 | if test "$pac_cv_have_long_long" = "yes" ; then |
|---|
| 3310 | AC_DEFINE(HAVE_LONG_LONG_INT,1,[Define if long long is supported]) |
|---|
| 3311 | fi |
|---|
| 3312 | fi |
|---|
| 3313 | # ---------------------------------------------------------------------------- |
|---|
| 3314 | # Get default structure alignment for integers |
|---|
| 3315 | dnl PAC_C_MAX_INTEGER_ALIGN places the default alignment into |
|---|
| 3316 | dnl pac_cv_c_max_integer_align, with possible values including |
|---|
| 3317 | dnl packed (byte), largest, two, four, eight (or other failure message). |
|---|
| 3318 | PAC_C_MAX_INTEGER_ALIGN |
|---|
| 3319 | |
|---|
| 3320 | if test "$pac_cv_c_max_integer_align" = "packed" ; then |
|---|
| 3321 | pac_cv_c_struct_align_nr=1 |
|---|
| 3322 | elif test "$pac_cv_c_max_integer_align" = "two" ; then |
|---|
| 3323 | pac_cv_c_struct_align_nr=2 |
|---|
| 3324 | elif test "$pac_cv_c_max_integer_align" = "four" ; then |
|---|
| 3325 | pac_cv_c_struct_align_nr=4 |
|---|
| 3326 | elif test "$pac_cv_c_max_integer_align" = "eight" ; then |
|---|
| 3327 | pac_cv_c_struct_align_nr=8 |
|---|
| 3328 | elif test "$pac_cv_c_max_integer_align" = "largest" ; then |
|---|
| 3329 | AC_DEFINE(HAVE_LARGEST_STRUCT_ALIGNMENT,1,[Define when alignment of structures is based on largest component]) |
|---|
| 3330 | fi |
|---|
| 3331 | |
|---|
| 3332 | if test -n "$pac_cv_c_struct_align_nr" ; then |
|---|
| 3333 | AC_DEFINE_UNQUOTED(HAVE_MAX_INTEGER_ALIGNMENT,$pac_cv_c_struct_align_nr,[Controls byte alignment of integer structures (for MPI structs)]) |
|---|
| 3334 | AC_DEFINE_UNQUOTED(HAVE_MAX_STRUCT_ALIGNMENT,$pac_cv_c_struct_align_nr,[Controls byte alignment of structures (for aligning allocated structures)]) |
|---|
| 3335 | fi |
|---|
| 3336 | # Get default structure alignment for floating point types |
|---|
| 3337 | dnl PAC_C_MAX_FP_ALIGN places the default alignment into |
|---|
| 3338 | dnl pac_cv_c_max_fp_align, with possible values including |
|---|
| 3339 | dnl packed (byte), largest, two, four, eight (or other failure message). |
|---|
| 3340 | PAC_C_MAX_FP_ALIGN |
|---|
| 3341 | |
|---|
| 3342 | if test "$pac_cv_c_max_fp_align" = "packed" ; then |
|---|
| 3343 | pac_cv_c_fp_align_nr=1 |
|---|
| 3344 | elif test "$pac_cv_c_max_fp_align" = "two" ; then |
|---|
| 3345 | pac_cv_c_fp_align_nr=2 |
|---|
| 3346 | elif test "$pac_cv_c_max_fp_align" = "four" ; then |
|---|
| 3347 | pac_cv_c_fp_align_nr=4 |
|---|
| 3348 | elif test "$pac_cv_c_max_fp_align" = "eight" ; then |
|---|
| 3349 | pac_cv_c_fp_align_nr=8 |
|---|
| 3350 | elif test "$pac_cv_c_max_fp_align" = "sixteen" ; then |
|---|
| 3351 | pac_cv_c_fp_align_nr=16 |
|---|
| 3352 | elif test "$pac_cv_c_max_fp_align" = "largest" ; then |
|---|
| 3353 | AC_MSG_ERROR([Configure detected unsupported structure alignment rules. Please email mpich2-maint@mcs.anl.gov with complete configure output and information on architecture.]) |
|---|
| 3354 | fi |
|---|
| 3355 | |
|---|
| 3356 | if test -n "$pac_cv_c_fp_align_nr" ; then |
|---|
| 3357 | AC_DEFINE_UNQUOTED(HAVE_MAX_FP_ALIGNMENT,$pac_cv_c_fp_align_nr,[Controls byte alignment of structures with floats, doubles, and long doubles (for MPI structs)]) |
|---|
| 3358 | fi |
|---|
| 3359 | |
|---|
| 3360 | # Test for the alignment of structs containing only long doubles. |
|---|
| 3361 | if test "$pac_cv_have_long_double" = yes ; then |
|---|
| 3362 | # Check for alignment of just float and double (no long doubles) |
|---|
| 3363 | PAC_C_MAX_DOUBLE_FP_ALIGN |
|---|
| 3364 | PAC_C_MAX_LONGDOUBLE_FP_ALIGN |
|---|
| 3365 | # FIXME: If this alignment is not the same as that for all float types, |
|---|
| 3366 | # we need to do something else in the alignment rule code. |
|---|
| 3367 | if test "$pac_cv_c_max_fp_align" != "$pac_cv_c_max_longdouble_fp_align" -o \ |
|---|
| 3368 | "$pac_cv_c_max_fp_align" != "$pac_cv_c_max_double_fp_align" ; then |
|---|
| 3369 | AC_MSG_WARN([Structures containing long doubles may be aligned differently from structures with floats or longs. MPICH2 does not handle this case automatically and you should avoid assumed extents for structures containing float types.]) |
|---|
| 3370 | |
|---|
| 3371 | double_align=-1 |
|---|
| 3372 | case $pac_cv_c_max_double_fp_align in |
|---|
| 3373 | packed) double_align=1 ;; |
|---|
| 3374 | two) double_align=2 ;; |
|---|
| 3375 | four) double_align=4 ;; |
|---|
| 3376 | eight) double_align=8 ;; |
|---|
| 3377 | esac |
|---|
| 3378 | longdouble_align=-1 |
|---|
| 3379 | case $pac_cv_c_max_longdouble_fp_align in |
|---|
| 3380 | packed) longdouble_align=1 ;; |
|---|
| 3381 | two) longdouble_align=2 ;; |
|---|
| 3382 | four) longdouble_align=4 ;; |
|---|
| 3383 | eight) longdouble_align=8 ;; |
|---|
| 3384 | sixteen)longdouble_align=16 ;; |
|---|
| 3385 | esac |
|---|
| 3386 | |
|---|
| 3387 | AC_DEFINE_UNQUOTED(HAVE_MAX_DOUBLE_FP_ALIGNMENT,$double_align,[Controls byte alignment of structs with doubles]) |
|---|
| 3388 | AC_DEFINE_UNQUOTED(HAVE_MAX_LONG_DOUBLE_FP_ALIGNMENT,$longdouble_align,[Controls byte alignment of structs with long doubles]) |
|---|
| 3389 | fi |
|---|
| 3390 | fi |
|---|
| 3391 | |
|---|
| 3392 | # Test for weird struct alignment rules that vary padding based on |
|---|
| 3393 | # size of leading type only. |
|---|
| 3394 | PAC_C_DOUBLE_POS_ALIGN |
|---|
| 3395 | if test "$pac_cv_c_double_pos_align" = "yes" ; then |
|---|
| 3396 | AC_DEFINE_UNQUOTED(HAVE_DOUBLE_POS_ALIGNMENT,1,[Controls how alignment is applied based on position of doubles in the structure]) |
|---|
| 3397 | fi |
|---|
| 3398 | |
|---|
| 3399 | # Test for same weird issues with long long int. |
|---|
| 3400 | PAC_C_LLINT_POS_ALIGN |
|---|
| 3401 | if test "$pac_cv_c_llint_pos_align" = "yes" ; then |
|---|
| 3402 | AC_DEFINE_UNQUOTED(HAVE_LLINT_POS_ALIGNMENT,1,[Controls how alignment is applied based on position of long long ints in the structure]) |
|---|
| 3403 | fi |
|---|
| 3404 | |
|---|
| 3405 | # Test for double alignment not following all our other carefully constructed rules |
|---|
| 3406 | PAC_C_DOUBLE_ALIGNMENT_EXCEPTION |
|---|
| 3407 | if test "$pac_cv_c_double_alignment_exception" = "four" ; then |
|---|
| 3408 | AC_DEFINE_UNQUOTED(HAVE_DOUBLE_ALIGNMENT_EXCEPTION,4,[Controls how alignment of doubles is performed, separate from other FP values]) |
|---|
| 3409 | fi |
|---|
| 3410 | |
|---|
| 3411 | # Test whether pointers can be aligned on a int boundary or require |
|---|
| 3412 | # a pointer boundary. |
|---|
| 3413 | AC_MSG_CHECKING([for alignment restrictions on pointers]) |
|---|
| 3414 | AC_TRY_RUN( |
|---|
| 3415 | changequote(<<,>>) |
|---|
| 3416 | struct foo { int a; void *b; }; |
|---|
| 3417 | int main() { |
|---|
| 3418 | int buf[10]; |
|---|
| 3419 | struct foo *p1; |
|---|
| 3420 | p1=(struct foo*)&buf[0]; |
|---|
| 3421 | p1->b = (void *)0; |
|---|
| 3422 | p1=(struct foo*)&buf[1]; |
|---|
| 3423 | p1->b = (void *)0; |
|---|
| 3424 | return 0; |
|---|
| 3425 | changequote([,]) |
|---|
| 3426 | },pac_cv_pointers_have_int_alignment=yes,pac_cv_pointers_have_int_alignment=no,pac_cv_pointers_have_int_alignment=unknown) |
|---|
| 3427 | |
|---|
| 3428 | if test "$pac_cv_pointers_have_int_alignment" != "yes" ; then |
|---|
| 3429 | AC_DEFINE(NEEDS_POINTER_ALIGNMENT_ADJUST,1,[define if pointers must be aligned on pointer boundaries]) |
|---|
| 3430 | AC_MSG_RESULT([pointer]) |
|---|
| 3431 | else |
|---|
| 3432 | AC_MSG_RESULT([int or better]) |
|---|
| 3433 | fi |
|---|
| 3434 | |
|---|
| 3435 | # There are further alignment checks after we test for int64_t etc. below. |
|---|
| 3436 | |
|---|
| 3437 | # Get the size of the C types for encoding in the basic datatypes and for |
|---|
| 3438 | # the specific-sized integers |
|---|
| 3439 | AC_CHECK_SIZEOF(char,$CROSS_SIZEOF_CHAR) |
|---|
| 3440 | AC_CHECK_SIZEOF(unsigned char,$CROSS_SIZEOF_UCHAR) |
|---|
| 3441 | AC_CHECK_SIZEOF(short,$CROSS_SIZEOF_SHORT) |
|---|
| 3442 | AC_CHECK_SIZEOF(unsigned short,$CROSS_SIZEOF_USHORT) |
|---|
| 3443 | AC_CHECK_SIZEOF(int,$CROSS_SIZEOF_INT) |
|---|
| 3444 | AC_CHECK_SIZEOF(unsigned int,$CROSS_SIZEOF_UINT) |
|---|
| 3445 | AC_CHECK_SIZEOF(long,$CROSS_SIZEOF_LONG) |
|---|
| 3446 | AC_CHECK_SIZEOF(unsigned long,$CROSS_SIZEOF_ULONG) |
|---|
| 3447 | AC_CHECK_SIZEOF(long long,$CROSS_SIZEOF_LONG_LONG) |
|---|
| 3448 | AC_CHECK_SIZEOF(unsigned long long,$CROSS_SIZEOF_ULONG_LONG) |
|---|
| 3449 | AC_CHECK_SIZEOF(float,$CROSS_SIZEOF_FLOAT) |
|---|
| 3450 | AC_CHECK_SIZEOF(double,$CROSS_SIZEOF_DOUBLE) |
|---|
| 3451 | AC_CHECK_SIZEOF(long double,$CROSS_SIZEOF_LONG_DOUBLE) |
|---|
| 3452 | AC_CHECK_SIZEOF(wchar_t,$CROSS_SIZEOF_WCHAR_T) |
|---|
| 3453 | # wchar_t is sometimes defined in stddef.h. If we got a zero for its |
|---|
| 3454 | # size, and we have stddef.h, try again with an explicit test |
|---|
| 3455 | if test "$ac_cv_sizeof_wchar_t" = 0 ; then |
|---|
| 3456 | # See if we have stddef |
|---|
| 3457 | AC_CHECK_HEADERS(stddef.h) |
|---|
| 3458 | if test "$ac_cv_header_stddef_h" = yes ; then |
|---|
| 3459 | # Do not use cache check since we don't want to use |
|---|
| 3460 | # any cached value |
|---|
| 3461 | AC_MSG_CHECKING([for sizeof wchar_t]) |
|---|
| 3462 | rm -f conftestval |
|---|
| 3463 | AC_TRY_RUN([#include <stdio.h> |
|---|
| 3464 | #include <stddef.h> |
|---|
| 3465 | main() |
|---|
| 3466 | { |
|---|
| 3467 | wchar_t a; |
|---|
| 3468 | FILE *f=fopen("conftestval", "w"); |
|---|
| 3469 | if (!f) exit(1); |
|---|
| 3470 | fprintf(f, "%d\n", sizeof(a)); |
|---|
| 3471 | exit(0); |
|---|
| 3472 | }],ac_cv_sizeof_wchar_t=`cat conftestval`,ac_cv_sizeof_wchar_t=0,ac_cv_sizeof_wchar_t=$CROSS_SIZEOF_WCHAR_T) |
|---|
| 3473 | AC_MSG_RESULT($ac_cv_sizeof_wchar_t) |
|---|
| 3474 | rm -f conftestval |
|---|
| 3475 | fi |
|---|
| 3476 | fi |
|---|
| 3477 | AC_CHECK_SIZEOF(void *,$CROSS_SIZEOF_VOID_P) |
|---|
| 3478 | PAC_CHECK_SIZEOF_2TYPES(float int, float, int, $CROSS_SIZEOF_FLOAT_INT) |
|---|
| 3479 | PAC_CHECK_SIZEOF_2TYPES(double int, double, int, $CROSS_SIZEOF_DOUBLE_INT) |
|---|
| 3480 | PAC_CHECK_SIZEOF_2TYPES(long int, long, int, $CROSS_SIZEOF_LONG_INT) |
|---|
| 3481 | PAC_CHECK_SIZEOF_2TYPES(short int, short, int, $CROSS_SIZEOF_SHORT_INT) |
|---|
| 3482 | PAC_CHECK_SIZEOF_2TYPES(2 int, int, int, $CROSS_SIZEOF_2_INT) |
|---|
| 3483 | PAC_CHECK_SIZEOF_2TYPES(long double int, long double, int, $CROSS_SIZEOF_LONG_DOUBLE_INT) |
|---|
| 3484 | |
|---|
| 3485 | dnl # The following code is correct for the EXTENT, but not the size, |
|---|
| 3486 | dnl # of these types. |
|---|
| 3487 | dnl PAC_CHECK_SIZEOF_DERIVED(float int,[struct { float a; int b; }],$CROSS_EXTENTOF_FLOAT_INT) |
|---|
| 3488 | dnl PAC_CHECK_SIZEOF_DERIVED(double int,[struct { double a; int b; }],$CROSS_EXTENTOF_DOUBLE_INT) |
|---|
| 3489 | dnl PAC_CHECK_SIZEOF_DERIVED(long int,[struct { long a; int b; }],$CROSS_EXTENTOF_LONG_INT) |
|---|
| 3490 | dnl PAC_CHECK_SIZEOF_DERIVED(short int,[struct { short a; int b; }],$CROSS_EXTENTOF_SHORT_INT) |
|---|
| 3491 | dnl PAC_CHECK_SIZEOF_DERIVED(2 int,[struct { int a; int b; }],$CROSS_EXTENTOF_2_INT) |
|---|
| 3492 | dnl PAC_CHECK_SIZEOF_DERIVED(long double int,[struct { long double a; int b; }],$CROSS_EXTENTOF_LONG_DOUBLE_INT) |
|---|
| 3493 | |
|---|
| 3494 | # sys/bitypes.h defines the int16_t etc. on some systems (e.g., OSF1). |
|---|
| 3495 | # Include it when testing for these types |
|---|
| 3496 | AC_CHECK_HEADER(sys/bitypes.h,[use_bitypes="#include <sys/bitypes.h>" |
|---|
| 3497 | AC_DEFINE(HAVE_SYS_BITYPES_H,1,[Define if sys/bitypes.h exists])]) |
|---|
| 3498 | # A C99 compliant compiler should have inttypes.h for fixed-size int types |
|---|
| 3499 | AC_CHECK_HEADERS(inttypes.h stdint.h) |
|---|
| 3500 | |
|---|
| 3501 | # Check for types |
|---|
| 3502 | AC_TYPE_INT8_T |
|---|
| 3503 | AC_TYPE_INT16_T |
|---|
| 3504 | AC_TYPE_INT32_T |
|---|
| 3505 | AC_TYPE_INT64_T |
|---|
| 3506 | |
|---|
| 3507 | # Temporary backwards compatiblity for the pre autoconf 2.62 integer |
|---|
| 3508 | # type checking |
|---|
| 3509 | if test "$ac_cv_c_int8_t" != no ; then |
|---|
| 3510 | AC_DEFINE(HAVE_INT8_T,1,[Define if int8_t is supported by the C compiler]) |
|---|
| 3511 | fi |
|---|
| 3512 | if test "$ac_cv_c_int16_t" != no ; then |
|---|
| 3513 | AC_DEFINE(HAVE_INT16_T,1,[Define if int16_t is supported by the C compiler]) |
|---|
| 3514 | fi |
|---|
| 3515 | if test "$ac_cv_c_int32_t" != no ; then |
|---|
| 3516 | AC_DEFINE(HAVE_INT32_T,1,[Define if int32_t is supported by the C compiler]) |
|---|
| 3517 | fi |
|---|
| 3518 | if test "$ac_cv_c_int64_t" != no ; then |
|---|
| 3519 | AC_DEFINE(HAVE_INT64_T,1,[Define if int64_t is supported by the C compiler]) |
|---|
| 3520 | fi |
|---|
| 3521 | |
|---|
| 3522 | # The following make these definitions: |
|---|
| 3523 | # define _UINT<n>_T 1 |
|---|
| 3524 | # if uint<n>_t is available. E.g., define _UINT8_T as 1 if uint8_t is available |
|---|
| 3525 | # if not available, define uint<n>_t as the related C type, e.g., |
|---|
| 3526 | # define uint8_t unsigned char |
|---|
| 3527 | # |
|---|
| 3528 | AC_TYPE_UINT8_T |
|---|
| 3529 | AC_TYPE_UINT16_T |
|---|
| 3530 | AC_TYPE_UINT32_T |
|---|
| 3531 | AC_TYPE_UINT64_T |
|---|
| 3532 | |
|---|
| 3533 | # Temporary backwards compatiblity for the pre autoconf 2.62 integer |
|---|
| 3534 | # type checking |
|---|
| 3535 | if test "$ac_cv_c_uint8_t" != no ; then |
|---|
| 3536 | AC_DEFINE(HAVE_UINT8_T,1,[Define if uint8_t is supported by the C compiler]) |
|---|
| 3537 | fi |
|---|
| 3538 | if test "$ac_cv_c_uint16_t" != no ; then |
|---|
| 3539 | AC_DEFINE(HAVE_UINT16_T,1,[Define if uint16_t is supported by the C compiler]) |
|---|
| 3540 | fi |
|---|
| 3541 | if test "$ac_cv_c_uint32_t" != no ; then |
|---|
| 3542 | AC_DEFINE(HAVE_UINT32_T,1,[Define if uint32_t is supported by the C compiler]) |
|---|
| 3543 | fi |
|---|
| 3544 | if test "$ac_cv_c_uint64_t" != no ; then |
|---|
| 3545 | AC_DEFINE(HAVE_UINT64_T,1,[Define if uint64_t is supported by the C compiler]) |
|---|
| 3546 | fi |
|---|
| 3547 | |
|---|
| 3548 | # Generate a hex version of the size of each type |
|---|
| 3549 | for type in short int long long_long float double long_double wchar_t \ |
|---|
| 3550 | float_int double_int long_int short_int 2_int long_double_int ; do |
|---|
| 3551 | eval len=\$ac_cv_sizeof_$type |
|---|
| 3552 | if test -z "$len" ; then |
|---|
| 3553 | len=0 |
|---|
| 3554 | # Check for sizes from the CHECK_SIZEOF_DERIVED macro |
|---|
| 3555 | eval pclen=\$pac_cv_sizeof_$type |
|---|
| 3556 | if test -n "$pclen" ; then |
|---|
| 3557 | len=$pclen |
|---|
| 3558 | else |
|---|
| 3559 | # check for a non-optional type |
|---|
| 3560 | if test $type != long_long -a $type != long_double -a \ |
|---|
| 3561 | $type != long_double_int ; then |
|---|
| 3562 | AC_MSG_ERROR([Configure was unable to determine the size of $type ; if cross compiling, |
|---|
| 3563 | use the environment variables CROSS_SIZEOF_typename, e.g., CROSS_SIZEOF_SHORT, |
|---|
| 3564 | or use the --with-cross=file configure option to specify a file containing |
|---|
| 3565 | Bourne (sh) shell assignments to CROSS_SIZEOF_typename for all datatype |
|---|
| 3566 | types. The program maint/getcross.c can be compiled and run on the target |
|---|
| 3567 | system; this program outputs an appropriate file for the --with-cross option]) |
|---|
| 3568 | fi |
|---|
| 3569 | fi |
|---|
| 3570 | fi |
|---|
| 3571 | # |
|---|
| 3572 | # Take len and turn it into two hex digits (there are 8 bits available |
|---|
| 3573 | # in the built-in datatype handle for the length; see |
|---|
| 3574 | # src/mpid/common/datatype/mpid_datatype.h) |
|---|
| 3575 | if test "$len" -gt 255 ; then |
|---|
| 3576 | AC_MSG_ERROR([Type sizes greater than 255 bytes are not supported (type $type is $len bytes)]) |
|---|
| 3577 | fi |
|---|
| 3578 | tmplen=$len |
|---|
| 3579 | hexlen="" |
|---|
| 3580 | while test $tmplen -gt 0 ; do |
|---|
| 3581 | lowdigit=`expr $tmplen - 16 \* \( $tmplen / 16 \)` |
|---|
| 3582 | case $lowdigit in |
|---|
| 3583 | 10) char=a ;; |
|---|
| 3584 | 11) char=b ;; |
|---|
| 3585 | 12) char=c ;; |
|---|
| 3586 | 13) char=d ;; |
|---|
| 3587 | 14) char=e ;; |
|---|
| 3588 | 15) char=f ;; |
|---|
| 3589 | *) char=$lowdigit ;; |
|---|
| 3590 | esac |
|---|
| 3591 | hexlen="$char$hexlen" |
|---|
| 3592 | tmplen=`expr $tmplen / 16` |
|---|
| 3593 | done |
|---|
| 3594 | if test $len -lt 16 ; then |
|---|
| 3595 | hexlen="0$hexlen" |
|---|
| 3596 | fi |
|---|
| 3597 | if test $len = 0 ; then |
|---|
| 3598 | # This sometimes happens for wchar_t |
|---|
| 3599 | hexlen="00"; |
|---|
| 3600 | fi |
|---|
| 3601 | eval len_$type=$hexlen |
|---|
| 3602 | done |
|---|
| 3603 | # By definition, sizeof char is 1 |
|---|
| 3604 | MPI_CHAR="0x4c000101" |
|---|
| 3605 | MPI_UNSIGNED_CHAR="0x4c000102" |
|---|
| 3606 | MPI_SHORT="0x4c00${len_short}03" |
|---|
| 3607 | MPI_UNSIGNED_SHORT="0x4c00${len_short}04" |
|---|
| 3608 | MPI_INT="0x4c00${len_int}05" |
|---|
| 3609 | MPI_UNSIGNED_INT="0x4c00${len_int}06" |
|---|
| 3610 | MPI_LONG="0x4c00${len_long}07" |
|---|
| 3611 | MPI_UNSIGNED_LONG="0x4c00${len_long}08" |
|---|
| 3612 | if test "$len_long_long" != 0 -a "$MPID_NO_LONG_LONG" != yes ; then |
|---|
| 3613 | MPI_LONG_LONG="0x4c00${len_long_long}09" |
|---|
| 3614 | else |
|---|
| 3615 | MPI_LONG_LONG=MPI_DATATYPE_NULL; |
|---|
| 3616 | fi |
|---|
| 3617 | MPI_FLOAT="0x4c00${len_float}0a" |
|---|
| 3618 | MPI_DOUBLE="0x4c00${len_double}0b" |
|---|
| 3619 | if test "$len_long_double" != 0 -a "$MPID_NO_LONG_DOUBLE" != yes ; then |
|---|
| 3620 | MPI_LONG_DOUBLE="0x4c00${len_long_double}0c" |
|---|
| 3621 | else |
|---|
| 3622 | MPI_LONG_DOUBLE=MPI_DATATYPE_NULL |
|---|
| 3623 | fi |
|---|
| 3624 | # If you change MPI_BYTE, you must change it in src/binding/f77/buildiface |
|---|
| 3625 | MPI_BYTE="0x4c00010d" |
|---|
| 3626 | MPI_WCHAR="0x4c00${len_wchar_t}0e" |
|---|
| 3627 | MPI_PACKED="0x4c00010f" |
|---|
| 3628 | MPI_LB="0x4c000010" |
|---|
| 3629 | MPI_UB="0x4c000011" |
|---|
| 3630 | # |
|---|
| 3631 | # These should define the mixed types *only* for contiguous data. |
|---|
| 3632 | # For example, MPI_SHORT_INT may have a gap; it will need to be defined |
|---|
| 3633 | # as a derived type instead. For IA32, this only affects short_int. |
|---|
| 3634 | MPI_2INT="0x4c00${len_2_int}16" |
|---|
| 3635 | # |
|---|
| 3636 | # For now we aren't being too clever about figuring out which of these |
|---|
| 3637 | # are in fact contiguous, so these are all allocated as "real" types. |
|---|
| 3638 | # |
|---|
| 3639 | # These values correspond to direct types 0..5. |
|---|
| 3640 | # |
|---|
| 3641 | dnl MPI_FLOAT_INT="0x4c00${len_float_int}12" |
|---|
| 3642 | dnl MPI_DOUBLE_INT="0x4c00${len_double_int}13" |
|---|
| 3643 | dnl MPI_LONG_INT="0x4c00${len_long_int}14" |
|---|
| 3644 | dnl MPI_SHORT_INT="0x4c00${len_short_int}15" |
|---|
| 3645 | dnl MPI_LONG_DOUBLE_INT="0x4c00${len_long_double_int}17" |
|---|
| 3646 | MPI_FLOAT_INT="0x8c000000" |
|---|
| 3647 | MPI_DOUBLE_INT="0x8c000001" |
|---|
| 3648 | MPI_LONG_INT="0x8c000002" |
|---|
| 3649 | MPI_SHORT_INT="0x8c000003" |
|---|
| 3650 | if test "$MPID_NO_LONG_DOUBLE" != yes ; then |
|---|
| 3651 | MPI_LONG_DOUBLE_INT="0x8c000004" |
|---|
| 3652 | else |
|---|
| 3653 | MPI_LONG_DOUBLE_INT=MPI_DATATYPE_NULL |
|---|
| 3654 | fi |
|---|
| 3655 | |
|---|
| 3656 | # 2 additional predefined types named in MPI-2 |
|---|
| 3657 | MPI_SIGNED_CHAR="0x4c000118" |
|---|
| 3658 | if test "$len_long_long" != 0 -a "$MPID_NO_LONG_LONG" != yes ; then |
|---|
| 3659 | MPI_UNSIGNED_LONG_LONG="0x4c00${len_long_long}19" |
|---|
| 3660 | else |
|---|
| 3661 | MPI_UNSIGNED_LONG_LONG=MPI_DATATYPE_NULL |
|---|
| 3662 | fi |
|---|
| 3663 | |
|---|
| 3664 | AC_SUBST(MPI_CHAR) |
|---|
| 3665 | AC_SUBST(MPI_UNSIGNED_CHAR) |
|---|
| 3666 | AC_SUBST(MPI_SHORT) |
|---|
| 3667 | AC_SUBST(MPI_UNSIGNED_SHORT) |
|---|
| 3668 | AC_SUBST(MPI_INT) |
|---|
| 3669 | AC_SUBST(MPI_UNSIGNED_INT) |
|---|
| 3670 | AC_SUBST(MPI_LONG) |
|---|
| 3671 | AC_SUBST(MPI_UNSIGNED_LONG) |
|---|
| 3672 | AC_SUBST(MPI_LONG_LONG) |
|---|
| 3673 | AC_SUBST(MPI_FLOAT) |
|---|
| 3674 | AC_SUBST(MPI_DOUBLE) |
|---|
| 3675 | AC_SUBST(MPI_LONG_DOUBLE) |
|---|
| 3676 | AC_SUBST(MPI_BYTE) |
|---|
| 3677 | AC_SUBST(MPI_WCHAR) |
|---|
| 3678 | AC_SUBST(MPI_PACKED) |
|---|
| 3679 | AC_SUBST(MPI_LB) |
|---|
| 3680 | AC_SUBST(MPI_UB) |
|---|
| 3681 | AC_SUBST(MPI_FLOAT_INT) |
|---|
| 3682 | AC_SUBST(MPI_DOUBLE_INT) |
|---|
| 3683 | AC_SUBST(MPI_LONG_INT) |
|---|
| 3684 | AC_SUBST(MPI_SHORT_INT) |
|---|
| 3685 | AC_SUBST(MPI_2INT) |
|---|
| 3686 | AC_SUBST(MPI_LONG_DOUBLE_INT) |
|---|
| 3687 | AC_SUBST(MPI_SIGNED_CHAR) |
|---|
| 3688 | AC_SUBST(MPI_UNSIGNED_LONG_LONG) |
|---|
| 3689 | # |
|---|
| 3690 | # FIXME: Leftover from separate fortran system |
|---|
| 3691 | ## Export the basic C types so that the Fortran system can use them |
|---|
| 3692 | #export MPI_CHAR |
|---|
| 3693 | #export MPI_SHORT |
|---|
| 3694 | #export MPI_INT |
|---|
| 3695 | #export MPI_LONG |
|---|
| 3696 | #export MPI_LONG_LONG |
|---|
| 3697 | #export MPI_FLOAT |
|---|
| 3698 | #export MPI_DOUBLE |
|---|
| 3699 | #export MPI_LONG_DOUBLE |
|---|
| 3700 | # |
|---|
| 3701 | # Size-specific types. Initialize as NULL |
|---|
| 3702 | MPI_REAL4=MPI_DATATYPE_NULL |
|---|
| 3703 | MPI_REAL8=MPI_DATATYPE_NULL |
|---|
| 3704 | MPI_REAL16=MPI_DATATYPE_NULL |
|---|
| 3705 | MPI_COMPLEX8=MPI_DATATYPE_NULL |
|---|
| 3706 | MPI_COMPLEX16=MPI_DATATYPE_NULL |
|---|
| 3707 | MPI_COMPLEX32=MPI_DATATYPE_NULL |
|---|
| 3708 | MPI_INTEGER1=MPI_DATATYPE_NULL |
|---|
| 3709 | MPI_INTEGER2=MPI_DATATYPE_NULL |
|---|
| 3710 | MPI_INTEGER4=MPI_DATATYPE_NULL |
|---|
| 3711 | MPI_INTEGER8=MPI_DATATYPE_NULL |
|---|
| 3712 | MPI_INTEGER16=MPI_DATATYPE_NULL |
|---|
| 3713 | AC_SUBST(MPI_REAL4) |
|---|
| 3714 | AC_SUBST(MPI_REAL8) |
|---|
| 3715 | AC_SUBST(MPI_REAL16) |
|---|
| 3716 | AC_SUBST(MPI_COMPLEX8) |
|---|
| 3717 | AC_SUBST(MPI_COMPLEX16) |
|---|
| 3718 | AC_SUBST(MPI_COMPLEX32) |
|---|
| 3719 | AC_SUBST(MPI_INTEGER1) |
|---|
| 3720 | AC_SUBST(MPI_INTEGER2) |
|---|
| 3721 | AC_SUBST(MPI_INTEGER4) |
|---|
| 3722 | AC_SUBST(MPI_INTEGER8) |
|---|
| 3723 | AC_SUBST(MPI_INTEGER16) |
|---|
| 3724 | export MPI_REAL4 |
|---|
| 3725 | export MPI_REAL8 |
|---|
| 3726 | export MPI_REAL16 |
|---|
| 3727 | export MPI_COMPLEX8 |
|---|
| 3728 | export MPI_COMPLEX16 |
|---|
| 3729 | export MPI_COMPLEX32 |
|---|
| 3730 | export MPI_INTEGER1 |
|---|
| 3731 | export MPI_INTEGER2 |
|---|
| 3732 | export MPI_INTEGER4 |
|---|
| 3733 | export MPI_INTEGER8 |
|---|
| 3734 | export MPI_INTEGER16 |
|---|
| 3735 | # |
|---|
| 3736 | # Try to find corresponding types for the size-specific types. |
|---|
| 3737 | # |
|---|
| 3738 | # Assume that the float/double/long double are simply spaced |
|---|
| 3739 | # Datatypes used up through 26 in Fortran |
|---|
| 3740 | # 27,28,29,2a,2b,2c |
|---|
| 3741 | if test "$ac_cv_sizeof_float" = "4" ; then |
|---|
| 3742 | MPI_REAL4="0x4c000427" |
|---|
| 3743 | MPI_COMPLEX8="0x4c000828" |
|---|
| 3744 | MPIR_REAL4_CTYPE=float |
|---|
| 3745 | fi |
|---|
| 3746 | if test "$ac_cv_sizeof_double" = "8" ; then |
|---|
| 3747 | MPI_REAL8="0x4c000829" |
|---|
| 3748 | MPI_COMPLEX16="0x4c00102a" |
|---|
| 3749 | MPIR_REAL8_CTYPE=double |
|---|
| 3750 | fi |
|---|
| 3751 | if test "$ac_cv_sizeof_long_double" = "16" -a "$MPID_NO_LONG_DOUBLE" != yes ; then |
|---|
| 3752 | MPI_REAL16="0x4c00102b" |
|---|
| 3753 | MPI_COMPLEX32="0x4c00202c" |
|---|
| 3754 | MPIR_REAL16_CTYPE="long double" |
|---|
| 3755 | fi |
|---|
| 3756 | if test -n "$MPIR_REAL4_CTYPE" ; then |
|---|
| 3757 | AC_DEFINE_UNQUOTED(MPIR_REAL4_CTYPE,$MPIR_REAL4_CTYPE,[C type to use for MPI_REAL4]) |
|---|
| 3758 | fi |
|---|
| 3759 | if test -n "$MPIR_REAL8_CTYPE" ; then |
|---|
| 3760 | AC_DEFINE_UNQUOTED(MPIR_REAL8_CTYPE,$MPIR_REAL8_CTYPE,[C type to use for MPI_REAL8]) |
|---|
| 3761 | fi |
|---|
| 3762 | if test -n "$MPIR_REAL16_CTYPE" ; then |
|---|
| 3763 | AC_DEFINE_UNQUOTED(MPIR_REAL16_CTYPE,$MPIR_REAL16_CTYPE,[C type to use for MPI_REAL16]) |
|---|
| 3764 | fi |
|---|
| 3765 | # For complex 8/16/32, we assume that these are 2 consequetive real4/8/16 |
|---|
| 3766 | # |
|---|
| 3767 | # Search for the integer types |
|---|
| 3768 | for type in char short int long long_long ; do |
|---|
| 3769 | # ctype is a valid C type which we can use to declare a C version of |
|---|
| 3770 | # this item |
|---|
| 3771 | ctype=`echo $type | sed 's/_/ /'` |
|---|
| 3772 | eval len=\$ac_cv_sizeof_$type |
|---|
| 3773 | if test -n "$len" ; then |
|---|
| 3774 | case $len in |
|---|
| 3775 | 1) if test "$MPI_INTEGER1" = "MPI_DATATYPE_NULL" ; then |
|---|
| 3776 | MPI_INTEGER1="0x4c00012d" |
|---|
| 3777 | MPIR_INTEGER1_CTYPE="$ctype" |
|---|
| 3778 | fi |
|---|
| 3779 | ;; |
|---|
| 3780 | 2) if test "$MPI_INTEGER2" = "MPI_DATATYPE_NULL" ; then |
|---|
| 3781 | MPI_INTEGER2="0x4c00022f" |
|---|
| 3782 | MPIR_INTEGER2_CTYPE="$ctype" |
|---|
| 3783 | fi |
|---|
| 3784 | ;; |
|---|
| 3785 | 4) if test "$MPI_INTEGER4" = "MPI_DATATYPE_NULL" ; then |
|---|
| 3786 | MPI_INTEGER4="0x4c000430" |
|---|
| 3787 | MPIR_INTEGER4_CTYPE="$ctype" |
|---|
| 3788 | fi |
|---|
| 3789 | ;; |
|---|
| 3790 | 8) if test "$MPI_INTEGER8" = "MPI_DATATYPE_NULL" ; then |
|---|
| 3791 | MPI_INTEGER8="0x4c000831" |
|---|
| 3792 | MPIR_INTEGER8_CTYPE="$ctype" |
|---|
| 3793 | fi |
|---|
| 3794 | ;; |
|---|
| 3795 | 16) if test "$MPI_INTEGER16" = "MPI_DATATYPE_NULL" ; then |
|---|
| 3796 | MPI_INTEGER16="0x4c001032" |
|---|
| 3797 | MPIR_INTEGER16_CTYPE="$ctype" |
|---|
| 3798 | fi |
|---|
| 3799 | ;; |
|---|
| 3800 | *) |
|---|
| 3801 | ;; |
|---|
| 3802 | esac |
|---|
| 3803 | fi |
|---|
| 3804 | done |
|---|
| 3805 | # |
|---|
| 3806 | # Add the definitions of these types |
|---|
| 3807 | if test -n "$MPIR_INTEGER1_CTYPE" ; then |
|---|
| 3808 | AC_DEFINE_UNQUOTED(MPIR_INTEGER1_CTYPE,$MPIR_INTEGER1_CTYPE,[C type to use for MPI_INTEGER1]) |
|---|
| 3809 | fi |
|---|
| 3810 | if test -n "$MPIR_INTEGER2_CTYPE" ; then |
|---|
| 3811 | AC_DEFINE_UNQUOTED(MPIR_INTEGER2_CTYPE,$MPIR_INTEGER2_CTYPE,[C type to use for MPI_INTEGER2]) |
|---|
| 3812 | fi |
|---|
| 3813 | if test -n "$MPIR_INTEGER4_CTYPE" ; then |
|---|
| 3814 | AC_DEFINE_UNQUOTED(MPIR_INTEGER4_CTYPE,$MPIR_INTEGER4_CTYPE,[C type to use for MPI_INTEGER4]) |
|---|
| 3815 | fi |
|---|
| 3816 | if test -n "$MPIR_INTEGER8_CTYPE" ; then |
|---|
| 3817 | AC_DEFINE_UNQUOTED(MPIR_INTEGER8_CTYPE,$MPIR_INTEGER8_CTYPE,[C type to use for MPI_INTEGER8]) |
|---|
| 3818 | fi |
|---|
| 3819 | if test -n "$MPIR_INTEGER16_CTYPE" ; then |
|---|
| 3820 | AC_DEFINE_UNQUOTED(MPIR_INTEGER16_CTYPE,$MPIR_INTEGER16_CTYPE,[C type to use for MPI_INTEGER16]) |
|---|
| 3821 | fi |
|---|
| 3822 | |
|---|
| 3823 | # ---------------------------------------------------------------------------- |
|---|
| 3824 | # We can now create the Fortran versions of the datatype values, along with |
|---|
| 3825 | # some of the other datatype-dependent sizes |
|---|
| 3826 | |
|---|
| 3827 | # There are two parts to handling the datatypes: |
|---|
| 3828 | # Convert the C datatype values to their Fortran equivalent. This |
|---|
| 3829 | # involves converting the hex values for the C version into decimal |
|---|
| 3830 | # since standard Fortran does not have hex constants |
|---|
| 3831 | # |
|---|
| 3832 | # Determine the existence of the Fortran 'sized' types and set those |
|---|
| 3833 | # values. |
|---|
| 3834 | # |
|---|
| 3835 | # In addition, we need to look at a few additional constants that depend |
|---|
| 3836 | # on how the compiler sizes some datatypes. These are: |
|---|
| 3837 | # STATIS_SIZE, ADDRESS_KIND, and OFFSET_KIND |
|---|
| 3838 | # |
|---|
| 3839 | # ---------------------------------------------------------------------------- |
|---|
| 3840 | if test "$enable_f77" = yes ; then |
|---|
| 3841 | # Up to size checking code in master configure.in (where it tries to |
|---|
| 3842 | # find the matching C sizes) as part of defining mpi_integer8 etc. |
|---|
| 3843 | # The results are available in pac_cv_sizeof_f77_<type> |
|---|
| 3844 | # Size is 0 if unknown or unavailable (or cross-compiling) |
|---|
| 3845 | # Due to limitations in autoconf, we cannot put these into a loop. |
|---|
| 3846 | # We also check integer to find the type of MPI_Fint |
|---|
| 3847 | # |
|---|
| 3848 | # Cross-compilation results can be included with the --with-cross=file |
|---|
| 3849 | # option. |
|---|
| 3850 | CROSS_F77_SIZEOF_INTEGER=${CROSS_F77_SIZEOF_INTEGER:-0} |
|---|
| 3851 | CROSS_F77_SIZEOF_REAL=${CROSS_F77_SIZEOF_REAL:-0} |
|---|
| 3852 | CROSS_F77_SIZEOF_DOUBLE_PRECISION=${CROSS_F77_SIZEOF_DOUBLE_PRECISION:-0} |
|---|
| 3853 | PAC_PROG_F77_CHECK_SIZEOF_EXT(integer,$CROSS_F77_SIZEOF_INTEGER) |
|---|
| 3854 | PAC_PROG_F77_CHECK_SIZEOF_EXT(real,$CROSS_F77_SIZEOF_REAL) |
|---|
| 3855 | PAC_PROG_F77_CHECK_SIZEOF_EXT(double precision,$CROSS_F77_SIZEOF_DOUBLE_PRECISION) |
|---|
| 3856 | AC_LANG_FORTRAN77 |
|---|
| 3857 | # If we have sizes for real and double, we do not need to call |
|---|
| 3858 | # mpir_get_fsize at run time. |
|---|
| 3859 | # For the size-defined types (e.g., integer*2), we assume that if the |
|---|
| 3860 | # compiler allows it, it has the stated size. |
|---|
| 3861 | AC_CACHE_CHECK([whether integer*1 is supported],pac_cv_fort_integer1,[ |
|---|
| 3862 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ integer*1 i])], |
|---|
| 3863 | pac_cv_fort_integer1=yes, |
|---|
| 3864 | pac_cv_fort_integer1=no)]) |
|---|
| 3865 | AC_CACHE_CHECK([whether integer*2 is supported],pac_cv_fort_integer2,[ |
|---|
| 3866 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ integer*2 i])], |
|---|
| 3867 | pac_cv_fort_integer2=yes, |
|---|
| 3868 | pac_cv_fort_integer2=no)]) |
|---|
| 3869 | AC_CACHE_CHECK([whether integer*4 is supported],pac_cv_fort_integer4,[ |
|---|
| 3870 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ integer*4 i])], |
|---|
| 3871 | pac_cv_fort_integer4=yes, |
|---|
| 3872 | pac_cv_fort_integer4=no)]) |
|---|
| 3873 | AC_CACHE_CHECK([whether integer*8 is supported],pac_cv_fort_integer8,[ |
|---|
| 3874 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ integer*8 i])], |
|---|
| 3875 | pac_cv_fort_integer8=yes, |
|---|
| 3876 | pac_cv_fort_integer8=no)]) |
|---|
| 3877 | AC_CACHE_CHECK([whether integer*16 is supported],pac_cv_fort_integer16,[ |
|---|
| 3878 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ integer*16 i])], |
|---|
| 3879 | pac_cv_fort_integer16=yes, |
|---|
| 3880 | pac_cv_fort_integer16=no)]) |
|---|
| 3881 | AC_CACHE_CHECK([whether real*4 is supported],pac_cv_fort_real4,[ |
|---|
| 3882 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ real*4 a])], |
|---|
| 3883 | pac_cv_fort_real4=yes, |
|---|
| 3884 | pac_cv_fort_real4=no)]) |
|---|
| 3885 | AC_CACHE_CHECK([whether real*8 is supported],pac_cv_fort_real8,[ |
|---|
| 3886 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ real*8 a])], |
|---|
| 3887 | pac_cv_fort_real8=yes, |
|---|
| 3888 | pac_cv_fort_real8=no)]) |
|---|
| 3889 | AC_CACHE_CHECK([whether real*16 is supported],pac_cv_fort_real16,[ |
|---|
| 3890 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ real*16 a])], |
|---|
| 3891 | pac_cv_fort_real16=yes, |
|---|
| 3892 | pac_cv_fort_real16=no)]) |
|---|
| 3893 | |
|---|
| 3894 | # Create the default datatype names for the standard MPI Fortran types |
|---|
| 3895 | MPI_CHARACTER=0x4c00011a |
|---|
| 3896 | AC_SUBST(MPI_CHARACTER) |
|---|
| 3897 | |
|---|
| 3898 | if test -z "$pac_cv_f77_sizeof_integer" ; then |
|---|
| 3899 | AC_MSG_ERROR([Unable to configure with Fortran support because configure could not determine the size of a Fortran INTEGER. Consider setting CROSS_F77_SIZEOF_INTEGER to the length in bytes of a Fortran INTEGER]) |
|---|
| 3900 | fi |
|---|
| 3901 | len_integer=$pac_cv_f77_sizeof_integer |
|---|
| 3902 | # Convert to two digit hex |
|---|
| 3903 | len=$len_integer |
|---|
| 3904 | # |
|---|
| 3905 | # Take len and turn it into two hex digits (there are 8 bits available |
|---|
| 3906 | # in the built-in datatype handle for the length; see |
|---|
| 3907 | # src/mpid/common/datatype/mpid_datatype.h). This code is taken |
|---|
| 3908 | # from the code in mpich2/configure.in |
|---|
| 3909 | if test "$len" -gt 255 ; then |
|---|
| 3910 | AC_MSG_ERROR([Type sizes greater than 255 bytes are not supported (type INTEGER is $len bytes)]) |
|---|
| 3911 | fi |
|---|
| 3912 | tmplen=$len |
|---|
| 3913 | hexlen="" |
|---|
| 3914 | while test $tmplen -gt 0 ; do |
|---|
| 3915 | lowdigit=`expr $tmplen - 16 \* \( $tmplen / 16 \)` |
|---|
| 3916 | case $lowdigit in |
|---|
| 3917 | 10) char=a ;; |
|---|
| 3918 | 11) char=b ;; |
|---|
| 3919 | 12) char=c ;; |
|---|
| 3920 | 13) char=d ;; |
|---|
| 3921 | 14) char=e ;; |
|---|
| 3922 | 15) char=f ;; |
|---|
| 3923 | *) char=$lowdigit ;; |
|---|
| 3924 | esac |
|---|
| 3925 | hexlen="$char$hexlen" |
|---|
| 3926 | tmplen=`expr $tmplen / 16` |
|---|
| 3927 | done |
|---|
| 3928 | if test $len -lt 16 ; then |
|---|
| 3929 | hexlen="0$hexlen" |
|---|
| 3930 | fi |
|---|
| 3931 | len_integer=$hexlen |
|---|
| 3932 | if test "$len_integer" = 0 ; then |
|---|
| 3933 | # We have a problem |
|---|
| 3934 | AC_MSG_WARN([Unable to determine size of an INTEGER type; using 4]) |
|---|
| 3935 | # We make the length 4 |
|---|
| 3936 | len_integer="04" |
|---|
| 3937 | fi |
|---|
| 3938 | MPI_INTEGER=0x4c00${len_integer}1b |
|---|
| 3939 | MPI_REAL=0x4c00${len_integer}1c |
|---|
| 3940 | MPI_LOGICAL=0x4c00${len_integer}1d |
|---|
| 3941 | AC_SUBST(MPI_INTEGER) |
|---|
| 3942 | AC_SUBST(MPI_REAL) |
|---|
| 3943 | AC_SUBST(MPI_LOGICAL) |
|---|
| 3944 | |
|---|
| 3945 | if test -z "$pac_cv_f77_sizeof_double_precision" ; then |
|---|
| 3946 | AC_MSG_ERROR([Unable to configure with Fortran support because configure could not determine the size of a Fortran DOUBLE PRECISION. Consider setting CROSS_F77_SIZEOF_DOUBLE_PRECISION to the length in bytes of a Fortran DOUBLE PRECISION]) |
|---|
| 3947 | fi |
|---|
| 3948 | len_double=$pac_cv_f77_sizeof_double_precision |
|---|
| 3949 | # Convert to two digit hex |
|---|
| 3950 | len=$len_double |
|---|
| 3951 | # |
|---|
| 3952 | # Take len and turn it into two hex digits (there are 8 bits available |
|---|
| 3953 | # in the built-in datatype handle for the length; see |
|---|
| 3954 | # src/mpid/common/datatype/mpid_datatype.h). This code is taken |
|---|
| 3955 | # from the code in mpich2/configure.in |
|---|
| 3956 | if test "$len" -gt 255 ; then |
|---|
| 3957 | AC_MSG_ERROR([Type sizes greater than 255 bytes are not supported (type DOUBLE is $len bytes)]) |
|---|
| 3958 | fi |
|---|
| 3959 | tmplen=$len |
|---|
| 3960 | hexlen="" |
|---|
| 3961 | while test $tmplen -gt 0 ; do |
|---|
| 3962 | lowdigit=`expr $tmplen - 16 \* \( $tmplen / 16 \)` |
|---|
| 3963 | case $lowdigit in |
|---|
| 3964 | 10) char=a ;; |
|---|
| 3965 | 11) char=b ;; |
|---|
| 3966 | 12) char=c ;; |
|---|
| 3967 | 13) char=d ;; |
|---|
| 3968 | 14) char=e ;; |
|---|
| 3969 | 15) char=f ;; |
|---|
| 3970 | *) char=$lowdigit ;; |
|---|
| 3971 | esac |
|---|
| 3972 | hexlen="$char$hexlen" |
|---|
| 3973 | tmplen=`expr $tmplen / 16` |
|---|
| 3974 | done |
|---|
| 3975 | if test $len -lt 16 ; then |
|---|
| 3976 | hexlen="0$hexlen" |
|---|
| 3977 | fi |
|---|
| 3978 | len_double=$hexlen |
|---|
| 3979 | if test "$len_double" = 0 ; then |
|---|
| 3980 | # We have a problem |
|---|
| 3981 | AC_MSG_WARN([Unable to determine size of a DOUBLE PRECISION type; using 8]) |
|---|
| 3982 | # We make the length 8 |
|---|
| 3983 | len_double="08" |
|---|
| 3984 | fi |
|---|
| 3985 | MPI_COMPLEX=0x4c00${len_double}1e |
|---|
| 3986 | MPI_DOUBLE_PRECISION=0x4c00${len_double}1f |
|---|
| 3987 | MPI_2INTEGER=0x4c00${len_double}20 |
|---|
| 3988 | MPI_2REAL=0x4c00${len_double}21 |
|---|
| 3989 | AC_SUBST(MPI_COMPLEX) |
|---|
| 3990 | AC_SUBST(MPI_DOUBLE_PRECISION) |
|---|
| 3991 | AC_SUBST(MPI_2INTEGER) |
|---|
| 3992 | AC_SUBST(MPI_2REAL) |
|---|
| 3993 | |
|---|
| 3994 | len_doublecplx=`expr $pac_cv_f77_sizeof_double_precision \* 2` |
|---|
| 3995 | if test "$len_doublecplx" = 0 ; then |
|---|
| 3996 | # We have a problem |
|---|
| 3997 | AC_MSG_WARN([Unable to determine size of a DOUBLE PRECISION type; using 8]) |
|---|
| 3998 | # We make the length 8*2 (in hex) |
|---|
| 3999 | len_doublecplx="16" |
|---|
| 4000 | fi |
|---|
| 4001 | len=$len_doublecplx |
|---|
| 4002 | # |
|---|
| 4003 | # Take len and turn it into two hex digits (there are 8 bits available |
|---|
| 4004 | # in the built-in datatype handle for the length; see |
|---|
| 4005 | # src/mpid/common/datatype/mpid_datatype.h). This code is taken |
|---|
| 4006 | # from the code in mpich2/configure.in |
|---|
| 4007 | if test "$len" -gt 255 ; then |
|---|
| 4008 | AC_MSG_ERROR([Type sizes greater than 255 bytes are not supported (type DOUBLE COMPLEX is $len bytes)]) |
|---|
| 4009 | fi |
|---|
| 4010 | tmplen=$len |
|---|
| 4011 | hexlen="" |
|---|
| 4012 | while test $tmplen -gt 0 ; do |
|---|
| 4013 | lowdigit=`expr $tmplen - 16 \* \( $tmplen / 16 \)` |
|---|
| 4014 | case $lowdigit in |
|---|
| 4015 | 10) char=a ;; |
|---|
| 4016 | 11) char=b ;; |
|---|
| 4017 | 12) char=c ;; |
|---|
| 4018 | 13) char=d ;; |
|---|
| 4019 | 14) char=e ;; |
|---|
| 4020 | 15) char=f ;; |
|---|
| 4021 | *) char=$lowdigit ;; |
|---|
| 4022 | esac |
|---|
| 4023 | hexlen="$char$hexlen" |
|---|
| 4024 | tmplen=`expr $tmplen / 16` |
|---|
| 4025 | done |
|---|
| 4026 | if test $len -lt 16 ; then |
|---|
| 4027 | hexlen="0$hexlen" |
|---|
| 4028 | fi |
|---|
| 4029 | len_doublecplx=$hexlen |
|---|
| 4030 | |
|---|
| 4031 | MPI_DOUBLE_COMPLEX=0x4c00${len_doublecplx}22 |
|---|
| 4032 | MPI_2DOUBLE_PRECISION=0x4c00${len_doublecplx}23 |
|---|
| 4033 | MPI_2COMPLEX=0x4c00${len_doublecplx}24 |
|---|
| 4034 | AC_SUBST(MPI_DOUBLE_COMPLEX) |
|---|
| 4035 | AC_SUBST(MPI_2DOUBLE_PRECISION) |
|---|
| 4036 | AC_SUBST(MPI_2COMPLEX) |
|---|
| 4037 | |
|---|
| 4038 | # |
|---|
| 4039 | # Temporary for the vast majority of systems that use 4 byte reals and |
|---|
| 4040 | # 8 byte doubles |
|---|
| 4041 | # Lengths at this point are in hex, hence "10" = 10 base 16 = 16 base 10. |
|---|
| 4042 | if test "$len_double" = "08" ; then |
|---|
| 4043 | F77_COMPLEX8=$MPI_COMPLEX |
|---|
| 4044 | fi |
|---|
| 4045 | if test "$len_doublecplx" = "10" ; then |
|---|
| 4046 | F77_COMPLEX16=$MPI_DOUBLE_COMPLEX |
|---|
| 4047 | fi |
|---|
| 4048 | if test "$len_long_double" = "10" -a "$MPID_NO_LONG_DOUBLE" != "yes" ; then |
|---|
| 4049 | F77_COMPLEX32="0x4c002025" |
|---|
| 4050 | else |
|---|
| 4051 | F77_COMPLEX32="MPI_DATATYPE_NULL" |
|---|
| 4052 | fi |
|---|
| 4053 | |
|---|
| 4054 | len_2dc=`expr $pac_cv_f77_sizeof_double_precision \* 4` |
|---|
| 4055 | firstdigit=0 |
|---|
| 4056 | seconddigit=0 |
|---|
| 4057 | while test $len_2dc -ge 16 ; do |
|---|
| 4058 | firstdigit=`expr $firstdigit + 1` |
|---|
| 4059 | len_2dc=`expr $len_2dc - 16` |
|---|
| 4060 | done |
|---|
| 4061 | case $len_2dc in |
|---|
| 4062 | 10) seconddigit=a ;; |
|---|
| 4063 | 11) seconddigit=b ;; |
|---|
| 4064 | 12) seconddigit=c ;; |
|---|
| 4065 | 13) seconddigit=d ;; |
|---|
| 4066 | 14) seconddigit=e ;; |
|---|
| 4067 | 15) seconddigit=f ;; |
|---|
| 4068 | *) seconddigit=$len_2dc ;; |
|---|
| 4069 | esac |
|---|
| 4070 | len_2dc="$firstdigit$seconddigit" |
|---|
| 4071 | #echo "2double complex = $len_2dc" |
|---|
| 4072 | MPI_2DOUBLE_COMPLEX=0x4c00${len_2dc}25 |
|---|
| 4073 | AC_SUBST(MPI_2DOUBLE_COMPLEX) |
|---|
| 4074 | MPI_F77_PACKED=$MPI_PACKED |
|---|
| 4075 | MPI_F77_UB=$MPI_UB |
|---|
| 4076 | MPI_F77_LB=$MPI_LB |
|---|
| 4077 | MPI_F77_BYTE=$MPI_BYTE |
|---|
| 4078 | AC_SUBST(MPI_F77_PACKED) |
|---|
| 4079 | AC_SUBST(MPI_F77_UB) |
|---|
| 4080 | AC_SUBST(MPI_F77_LB) |
|---|
| 4081 | AC_SUBST(MPI_F77_BYTE) |
|---|
| 4082 | # |
|---|
| 4083 | # We must convert all hex values to decimal (!) |
|---|
| 4084 | # It would be nice to use expr to extract the next character rather than |
|---|
| 4085 | # the heavier-weight sed, but expr under Tru64 Unix discards leading zeros, |
|---|
| 4086 | # even when used only with the match (:) command. Rather than have |
|---|
| 4087 | # configure figure out if expr works, we just use sed. Sigh. |
|---|
| 4088 | for var in CHARACTER INTEGER REAL LOGICAL DOUBLE_PRECISION COMPLEX \ |
|---|
| 4089 | DOUBLE_COMPLEX 2INTEGER 2REAL 2COMPLEX 2DOUBLE_PRECISION \ |
|---|
| 4090 | 2DOUBLE_COMPLEX F77_PACKED F77_UB F77_LB F77_BYTE; do |
|---|
| 4091 | fullvar="MPI_$var" |
|---|
| 4092 | eval fullvarvalue=\$$fullvar |
|---|
| 4093 | #echo "$fullvar = $fullvarvalue" |
|---|
| 4094 | value=0 |
|---|
| 4095 | fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'` |
|---|
| 4096 | for pos in 3 4 5 6 7 8 9 10 ; do |
|---|
| 4097 | # This works, even for Tru64, because only a single character |
|---|
| 4098 | # is extracted |
|---|
| 4099 | char=`expr $fullvarvalue : '\(.\)'` |
|---|
| 4100 | # FIXME: Tru64 Unix eliminates leading zeros (!) |
|---|
| 4101 | # How do we fix something that broken? |
|---|
| 4102 | fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'` |
|---|
| 4103 | case $char in |
|---|
| 4104 | a) char=10 ;; |
|---|
| 4105 | b) char=11 ;; |
|---|
| 4106 | c) char=12 ;; |
|---|
| 4107 | d) char=13 ;; |
|---|
| 4108 | e) char=14 ;; |
|---|
| 4109 | f) char=15 ;; |
|---|
| 4110 | esac |
|---|
| 4111 | value=`expr $value \* 16 + $char` |
|---|
| 4112 | done |
|---|
| 4113 | #echo "$fullvar = $value" |
|---|
| 4114 | eval $fullvar=$value |
|---|
| 4115 | done |
|---|
| 4116 | AC_LANG_C |
|---|
| 4117 | |
|---|
| 4118 | # Now, handle the sized types |
|---|
| 4119 | # |
|---|
| 4120 | # Preload the C mpi types |
|---|
| 4121 | # THESE MUST MATCH THE DEFINITIONS IN MPI.H and MPIF.H |
|---|
| 4122 | # We use these to match the optional Fortran types |
|---|
| 4123 | char_mpi=${MPI_CHAR:-0} |
|---|
| 4124 | short_mpi=${MPI_SHORT:-0} |
|---|
| 4125 | int_mpi=${MPI_INT:-0} |
|---|
| 4126 | long_mpi=${MPI_LONG:-0} |
|---|
| 4127 | long_long_mpi=${MPI_LONG_LONG:-0} |
|---|
| 4128 | float_mpi=${MPI_FLOAT:-0} |
|---|
| 4129 | double_mpi=${MPI_DOUBLE:-0} |
|---|
| 4130 | long_double_mpi=${MPI_LONG_DOUBLE:-0} |
|---|
| 4131 | |
|---|
| 4132 | # |
|---|
| 4133 | # The following code was correct for MPI-1, which allowed these datatypes |
|---|
| 4134 | # to be an alias for another MPI type. MPI-2 requires these to |
|---|
| 4135 | # be distinct types, so these are enumerated |
|---|
| 4136 | if test "$use_alias_types" = yes ; then |
|---|
| 4137 | for len in 1 2 4 8 16 ; do |
|---|
| 4138 | eval F77_INTEGER$len=0 |
|---|
| 4139 | #eval testval=\$"pac_cv_f77_sizeof_integer_$len" |
|---|
| 4140 | eval testval=\$"pac_cv_fort_integer$len" |
|---|
| 4141 | if test "$testval" = no ; then continue ; fi |
|---|
| 4142 | testval=$len |
|---|
| 4143 | noval="yes" |
|---|
| 4144 | AC_MSG_CHECKING([for C type matching Fortran integer*$len]) |
|---|
| 4145 | for c_type in char short int long "long_long" ; do |
|---|
| 4146 | eval ctypelen=\$"ac_cv_sizeof_$c_type" |
|---|
| 4147 | if test "$testval" = "$ctypelen" -a "$ctypelen" -gt 0 ; then |
|---|
| 4148 | AC_MSG_RESULT($c_type) |
|---|
| 4149 | eval F77_INTEGER$len=\$"${c_type}_mpi" |
|---|
| 4150 | noval="no" |
|---|
| 4151 | break |
|---|
| 4152 | fi |
|---|
| 4153 | done |
|---|
| 4154 | if test "$noval" = "yes" ; then |
|---|
| 4155 | AC_MSG_RESULT([unavailable]) |
|---|
| 4156 | fi |
|---|
| 4157 | done |
|---|
| 4158 | |
|---|
| 4159 | # Complex is set separately above |
|---|
| 4160 | for len in 4 8 16 ; do |
|---|
| 4161 | len2=`expr $len + $len` |
|---|
| 4162 | eval F77_REAL$len=0 |
|---|
| 4163 | #eval F77_COMPLEX$len2=0 |
|---|
| 4164 | #eval testval=\$"pac_cv_f77_sizeof_real_$len" |
|---|
| 4165 | eval testval=\$"pac_cv_fort_real$len" |
|---|
| 4166 | if test "$testval" = no ; then continue ; fi |
|---|
| 4167 | testval=$len |
|---|
| 4168 | noval="yes" |
|---|
| 4169 | AC_MSG_CHECKING([for C type matching Fortran real*$len]) |
|---|
| 4170 | for c_type in float double "long_double" ; do |
|---|
| 4171 | eval ctypelen=\$"ac_cv_sizeof_$c_type" |
|---|
| 4172 | if test "$testval" = "$ctypelen" -a "$ctypelen" -gt 0 ; then |
|---|
| 4173 | AC_MSG_RESULT($c_type) |
|---|
| 4174 | eval F77_REAL$len=\$"${c_type}_mpi" |
|---|
| 4175 | #eval F77_COMPLEX$len2=\$"${c_type}_cplx_mpi" |
|---|
| 4176 | noval="no" |
|---|
| 4177 | break |
|---|
| 4178 | fi |
|---|
| 4179 | done |
|---|
| 4180 | if test "$noval" = "yes" ; then |
|---|
| 4181 | AC_MSG_RESULT([unavailable]) |
|---|
| 4182 | fi |
|---|
| 4183 | done |
|---|
| 4184 | else |
|---|
| 4185 | # Simply determine which types exist. These may have been set by the |
|---|
| 4186 | # toplevel configure |
|---|
| 4187 | for var in INTEGER1 INTEGER2 INTEGER4 INTEGER8 INTEGER16 \ |
|---|
| 4188 | REAL4 REAL8 REAL16 COMPLEX8 COMPLEX16 COMPLEX32 ; do |
|---|
| 4189 | eval varname=MPI_$var |
|---|
| 4190 | eval varvalue=\$$varname |
|---|
| 4191 | #echo "$varname = $varvalue" |
|---|
| 4192 | if test "$varvalue" = MPI_DATATYPE_NULL ; then |
|---|
| 4193 | eval F77_$var=0 |
|---|
| 4194 | else |
|---|
| 4195 | eval F77_$var=\$$varname |
|---|
| 4196 | fi |
|---|
| 4197 | done |
|---|
| 4198 | fi |
|---|
| 4199 | # We must convert all hex values to decimal (!) |
|---|
| 4200 | for var in INTEGER1 INTEGER2 INTEGER4 INTEGER8 INTEGER16 \ |
|---|
| 4201 | REAL4 REAL8 REAL16 COMPLEX8 COMPLEX16 COMPLEX32 ; do |
|---|
| 4202 | fullvar="F77_$var" |
|---|
| 4203 | eval fullvarvalue=\$$fullvar |
|---|
| 4204 | if test "$fullvarvalue" = 0 -o -z "$fullvarvalue" ; then |
|---|
| 4205 | eval $fullvar=MPI_DATATYPE_NULL |
|---|
| 4206 | continue |
|---|
| 4207 | fi |
|---|
| 4208 | #echo "$fullvar = $fullvarvalue" |
|---|
| 4209 | value=0 |
|---|
| 4210 | # See the comments above on why expr with : cannot be used here |
|---|
| 4211 | fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'` |
|---|
| 4212 | for pos in 3 4 5 6 7 8 9 10 ; do |
|---|
| 4213 | #char=`expr substr $fullvarvalue $pos 1` |
|---|
| 4214 | char=`expr $fullvarvalue : '\(.\)'` |
|---|
| 4215 | # We don't test for success of expr here because some expr's are |
|---|
| 4216 | # buggy and set the status to one on expressions like |
|---|
| 4217 | # expr 00ccc : '\(.\)' |
|---|
| 4218 | # while both |
|---|
| 4219 | # expr 00ccc : '\(..\)' |
|---|
| 4220 | # and |
|---|
| 4221 | # expr 100cc : '\(.\)' |
|---|
| 4222 | # return a zero status. So the status is set even on success, |
|---|
| 4223 | # if the result is a single character that is a zero (!) |
|---|
| 4224 | #rc=$? |
|---|
| 4225 | #if test "$rc" != 0 ; then |
|---|
| 4226 | dnl # AC_MSG_WARN([Failure (status $rc) in extracting first char from $fullvarvalue]) |
|---|
| 4227 | # break |
|---|
| 4228 | #fi |
|---|
| 4229 | fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'` |
|---|
| 4230 | case $char in |
|---|
| 4231 | a) char=10 ;; |
|---|
| 4232 | b) char=11 ;; |
|---|
| 4233 | c) char=12 ;; |
|---|
| 4234 | d) char=13 ;; |
|---|
| 4235 | e) char=14 ;; |
|---|
| 4236 | f) char=15 ;; |
|---|
| 4237 | esac |
|---|
| 4238 | value=`expr $value \* 16 + $char` |
|---|
| 4239 | if test $? != 0 ; then |
|---|
| 4240 | AC_MSG_WARN([Failure to evaluate $value \* 16 + $char]) |
|---|
| 4241 | fi |
|---|
| 4242 | done |
|---|
| 4243 | #echo "$fullvar = $value" |
|---|
| 4244 | eval $fullvar=$value |
|---|
| 4245 | done |
|---|
| 4246 | AC_SUBST(F77_INTEGER1) |
|---|
| 4247 | AC_SUBST(F77_INTEGER2) |
|---|
| 4248 | AC_SUBST(F77_INTEGER4) |
|---|
| 4249 | AC_SUBST(F77_INTEGER8) |
|---|
| 4250 | AC_SUBST(F77_INTEGER16) |
|---|
| 4251 | AC_SUBST(F77_REAL4) |
|---|
| 4252 | AC_SUBST(F77_REAL8) |
|---|
| 4253 | AC_SUBST(F77_REAL16) |
|---|
| 4254 | AC_SUBST(F77_COMPLEX8) |
|---|
| 4255 | AC_SUBST(F77_COMPLEX16) |
|---|
| 4256 | AC_SUBST(F77_COMPLEX32) |
|---|
| 4257 | |
|---|
| 4258 | noval="yes" |
|---|
| 4259 | AC_MSG_CHECKING([for C type matching Fortran integer]) |
|---|
| 4260 | for c_type in char short int long "long_long" ; do |
|---|
| 4261 | eval ctypelen=\$"ac_cv_sizeof_$c_type" |
|---|
| 4262 | if test "$pac_cv_f77_sizeof_integer" = "$ctypelen" -a \ |
|---|
| 4263 | "$ctypelen" -gt 0 ; then |
|---|
| 4264 | c_type=`echo $c_type | sed -e 's/_/ /g'` |
|---|
| 4265 | AC_MSG_RESULT($c_type) |
|---|
| 4266 | MPI_FINT=$c_type |
|---|
| 4267 | noval="no" |
|---|
| 4268 | break |
|---|
| 4269 | fi |
|---|
| 4270 | done |
|---|
| 4271 | if test "$noval" = "yes" ; then |
|---|
| 4272 | # Set a default |
|---|
| 4273 | MPI_FINT="int" |
|---|
| 4274 | AC_MSG_RESULT([unavailable]) |
|---|
| 4275 | fi |
|---|
| 4276 | # We also need to check the size of MPI_Aint vs MPI_Fint, and |
|---|
| 4277 | # define AINT_LARGER_THAN_FINT if aint is larger (this |
|---|
| 4278 | # affects code in MPI_Address) |
|---|
| 4279 | if test "$ac_cv_sizeof_void_p" != "0" -a \ |
|---|
| 4280 | "$ac_cv_sizeof_void_p" -gt "$pac_cv_f77_sizeof_integer" ; then |
|---|
| 4281 | AC_DEFINE(HAVE_AINT_LARGER_THAN_FINT,1,[Define if addresses are larger than Fortran integers]) |
|---|
| 4282 | fi |
|---|
| 4283 | # Include a defined value for Fint is int |
|---|
| 4284 | if test "$MPI_FINT" = "int" ; then |
|---|
| 4285 | AC_DEFINE(HAVE_FINT_IS_INT,1,[Define if Fortran integer are the same size as C ints]) |
|---|
| 4286 | elif test "$SIZEOF_F77_INTEGER" != "$ac_cv_sizeof_int" ; then |
|---|
| 4287 | # Make this fatal because we do not want to build a broken fortran |
|---|
| 4288 | # interface |
|---|
| 4289 | AC_MSG_ERROR([Fortran integers and C ints are not the same size. The current Fortran binding does not support this case. Either force the Fortran compiler to use integers of $ac_cv_sizeof_int bytes, or use --disable-f77 on the configure line for MPICH2.]) |
|---|
| 4290 | fi |
|---|
| 4291 | |
|---|
| 4292 | # |
|---|
| 4293 | # Set size of MPI_Status. We may need sizeof_int here as well |
|---|
| 4294 | # |
|---|
| 4295 | |
|---|
| 4296 | # |
|---|
| 4297 | # The size of MPI_Status is needed for the Fortran interface. |
|---|
| 4298 | # This is not quite right unless the device setup script, executed above, |
|---|
| 4299 | # sets the EXTRA_STATUS_DECL that will be used in defining a status. |
|---|
| 4300 | # The default size assumes that there are 5 ints |
|---|
| 4301 | default_status_size=`expr 5 \* $ac_cv_sizeof_int` |
|---|
| 4302 | AC_CACHE_CHECK([for size of MPI_Status],pac_cv_sizeof_mpi_status,[ |
|---|
| 4303 | AC_TRY_RUN([ |
|---|
| 4304 | #include "confdefs.h" |
|---|
| 4305 | #include <stdio.h> |
|---|
| 4306 | #ifdef HAVE_STDLIB_H |
|---|
| 4307 | #include <stdlib.h> |
|---|
| 4308 | #endif |
|---|
| 4309 | typedef struct { |
|---|
| 4310 | int count; |
|---|
| 4311 | int cancelled; |
|---|
| 4312 | int MPI_SOURCE; |
|---|
| 4313 | int MPI_TAG; |
|---|
| 4314 | int MPI_ERROR; |
|---|
| 4315 | $EXTRA_STATUS_DECL |
|---|
| 4316 | } MPI_Status; |
|---|
| 4317 | int main( int argc, char **argv ){ |
|---|
| 4318 | FILE *f=fopen("conftestval", "w"); |
|---|
| 4319 | if (!f) exit(1); |
|---|
| 4320 | fprintf(f, "%d\n", sizeof(MPI_Status)); |
|---|
| 4321 | exit(0); |
|---|
| 4322 | } |
|---|
| 4323 | ],pac_cv_sizeof_mpi_status=`cat conftestval`,pac_cv_sizeof_mpi_status=$default_status_size,pac_cv_sizeof_mpi_status=$default_status_size) |
|---|
| 4324 | ]) |
|---|
| 4325 | SIZEOF_MPI_STATUS=$pac_cv_sizeof_mpi_status |
|---|
| 4326 | export SIZEOF_MPI_STATUS |
|---|
| 4327 | AC_SUBST(SIZEOF_MPI_STATUS) |
|---|
| 4328 | |
|---|
| 4329 | if test -z "$MPI_STATUS_SIZE" ; then |
|---|
| 4330 | if test -n "$SIZEOF_MPI_STATUS" ; then |
|---|
| 4331 | # compute from the C sizeof |
|---|
| 4332 | MPI_STATUS_SIZE=`expr $SIZEOF_MPI_STATUS / $ac_cv_sizeof_int` |
|---|
| 4333 | if test "$MPI_STATUS_SIZE" = "0" ; then |
|---|
| 4334 | AC_MSG_WARN([Could not compute the size of MPI_Status]) |
|---|
| 4335 | MPI_STATUS_SIZE=5 |
|---|
| 4336 | fi |
|---|
| 4337 | else |
|---|
| 4338 | AC_MSG_WARN([MPI_STATUS_SIZE was not defined!]) |
|---|
| 4339 | # The default size is 5. See mpi.h.in |
|---|
| 4340 | MPI_STATUS_SIZE=5 |
|---|
| 4341 | fi |
|---|
| 4342 | fi |
|---|
| 4343 | AC_SUBST(MPI_STATUS_SIZE) |
|---|
| 4344 | |
|---|
| 4345 | # |
|---|
| 4346 | # We must convert all hex values to decimal (!). |
|---|
| 4347 | # This is for the C types so they are also available in Fortran |
|---|
| 4348 | for var in CHAR SIGNED_CHAR UNSIGNED_CHAR WCHAR SHORT \ |
|---|
| 4349 | UNSIGNED_SHORT INT UNSIGNED_INT LONG UNSIGNED_LONG \ |
|---|
| 4350 | FLOAT DOUBLE LONG_DOUBLE LONG_LONG_INT \ |
|---|
| 4351 | UNSIGNED_LONG_LONG LONG_LONG FLOAT_INT DOUBLE_INT \ |
|---|
| 4352 | LONG_INT SHORT_INT "2INT" LONG_DOUBLE_INT ; do |
|---|
| 4353 | fullvar="MPI_$var" |
|---|
| 4354 | fullf77var="MPI_F77_$var" |
|---|
| 4355 | eval fullvarvalue=\$$fullvar |
|---|
| 4356 | #echo "$fullvar = $fullvarvalue" |
|---|
| 4357 | if test "x$fullvarvalue" = "x" -o \ |
|---|
| 4358 | "x$fullvarvalue" = "xMPI_DATATYPE_NULL" ; then |
|---|
| 4359 | eval $fullf77var="MPI_DATATYPE_NULL" |
|---|
| 4360 | continue |
|---|
| 4361 | fi |
|---|
| 4362 | value=0 |
|---|
| 4363 | fullvarvalue=`echo $fullvarvalue | sed -e 's/..\(.*\)/\1/'` |
|---|
| 4364 | offset=0 |
|---|
| 4365 | for pos in 3 4 5 6 7 8 9 10 ; do |
|---|
| 4366 | # This works, even for Tru64, because only a single character |
|---|
| 4367 | # is extracted |
|---|
| 4368 | char=`expr $fullvarvalue : '\(.\)'` |
|---|
| 4369 | # FIXME: Tru64 Unix eliminates leading zeros (!) |
|---|
| 4370 | # How do we fix something that broken? |
|---|
| 4371 | fullvarvalue=`echo $fullvarvalue | sed -e 's/.\(.*\)/\1/'` |
|---|
| 4372 | case $char in |
|---|
| 4373 | a) char=10 ;; |
|---|
| 4374 | b) char=11 ;; |
|---|
| 4375 | c) char=12 ;; |
|---|
| 4376 | d) char=13 ;; |
|---|
| 4377 | e) char=14 ;; |
|---|
| 4378 | f) char=15 ;; |
|---|
| 4379 | esac |
|---|
| 4380 | # For Fortran, if the value is too big for an unsigned int, |
|---|
| 4381 | # we need to make it a signed (negative) int. Currently, the |
|---|
| 4382 | # types in this class are the minloc/maxloc types. |
|---|
| 4383 | if test $pos = 3 -a $char -ge 8 ; then |
|---|
| 4384 | #echo "for $var in position $pos found a value >= 8" |
|---|
| 4385 | char=`expr $char - 8` |
|---|
| 4386 | offset=-2147483648 |
|---|
| 4387 | fi |
|---|
| 4388 | value=`expr $value \* 16 + $char` |
|---|
| 4389 | done |
|---|
| 4390 | if test "$offset" != 0 ; then |
|---|
| 4391 | #echo "$fullf77var: $value, $offset" |
|---|
| 4392 | value=`expr $value + $offset` |
|---|
| 4393 | fi |
|---|
| 4394 | #echo "$fullf77var = $value" |
|---|
| 4395 | eval $fullf77var=$value |
|---|
| 4396 | done |
|---|
| 4397 | AC_SUBST(MPI_F77_CHAR) |
|---|
| 4398 | AC_SUBST(MPI_F77_SIGNED_CHAR) |
|---|
| 4399 | AC_SUBST(MPI_F77_UNSIGNED_CHAR) |
|---|
| 4400 | AC_SUBST(MPI_F77_WCHAR) |
|---|
| 4401 | AC_SUBST(MPI_F77_SHORT) |
|---|
| 4402 | AC_SUBST(MPI_F77_UNSIGNED_SHORT) |
|---|
| 4403 | MPI_F77_UNSIGNED=$MPI_F77_UNSIGNED_INT |
|---|
| 4404 | AC_SUBST(MPI_F77_UNSIGNED) |
|---|
| 4405 | AC_SUBST(MPI_F77_INT) |
|---|
| 4406 | AC_SUBST(MPI_F77_LONG) |
|---|
| 4407 | AC_SUBST(MPI_F77_UNSIGNED_LONG) |
|---|
| 4408 | AC_SUBST(MPI_F77_FLOAT) |
|---|
| 4409 | AC_SUBST(MPI_F77_DOUBLE) |
|---|
| 4410 | AC_SUBST(MPI_F77_LONG_DOUBLE) |
|---|
| 4411 | AC_SUBST(MPI_F77_UNSIGNED_LONG_LONG) |
|---|
| 4412 | MPI_F77_LONG_LONG_INT=$MPI_F77_LONG_LONG |
|---|
| 4413 | AC_SUBST(MPI_F77_LONG_LONG_INT) |
|---|
| 4414 | AC_SUBST(MPI_F77_LONG_LONG) |
|---|
| 4415 | AC_SUBST(MPI_F77_FLOAT_INT) |
|---|
| 4416 | AC_SUBST(MPI_F77_DOUBLE_INT) |
|---|
| 4417 | AC_SUBST(MPI_F77_LONG_INT) |
|---|
| 4418 | AC_SUBST(MPI_F77_SHORT_INT) |
|---|
| 4419 | AC_SUBST(MPI_F77_2INT) |
|---|
| 4420 | AC_SUBST(MPI_F77_LONG_DOUBLE_INT) |
|---|
| 4421 | # Try and compute the values of .true. and .false. in Fortran |
|---|
| 4422 | # This code has been removed because the Fortran binding code does |
|---|
| 4423 | # not yet support it. |
|---|
| 4424 | dnl AC_ARG_ENABLE(runtimevalues, |
|---|
| 4425 | dnl [--enable-runtimevalues - Determine various parameters of the Fortran |
|---|
| 4426 | dnl environment at run time, such as the values for |
|---|
| 4427 | dnl .TRUE. and .FALSE. . This allows a single MPICH |
|---|
| 4428 | dnl library to be used with multiple Fortran compilers], |
|---|
| 4429 | dnl use_runtimevalues=$enableval,use_runtimevalues=false) |
|---|
| 4430 | dnl if test "$use_runtimevalues" = "yes" ; then |
|---|
| 4431 | dnl AC_DEFINE(F77_RUNTIME_VALUES,1,[Define if Fortran environment should be determined at runtime]) |
|---|
| 4432 | dnl fi |
|---|
| 4433 | |
|---|
| 4434 | if test "$cross_compiling" = "no" ; then |
|---|
| 4435 | AC_MSG_CHECKING([for values of Fortran logicals]) |
|---|
| 4436 | # Use a Fortran main program. This simplifies some steps, |
|---|
| 4437 | # since getting all of the Fortran libraries (including shared |
|---|
| 4438 | # libraries that are not in the default library search path) can |
|---|
| 4439 | # be tricky. Specifically, The PROG_F77_RUN_PROC_FROM_C failed with |
|---|
| 4440 | # some installations of the Portland group compiler. |
|---|
| 4441 | AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[ |
|---|
| 4442 | # Compile a C routine to print the values of true and false |
|---|
| 4443 | cat >conftestc.c <<EOF |
|---|
| 4444 | #include <stdio.h> |
|---|
| 4445 | #include "confdefs.h" |
|---|
| 4446 | #ifdef HAVE_STDLIB_H |
|---|
| 4447 | #include <stdlib.h> |
|---|
| 4448 | #endif |
|---|
| 4449 | #ifdef F77_NAME_UPPER |
|---|
| 4450 | #define ftest_ FTEST |
|---|
| 4451 | #elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED) |
|---|
| 4452 | #define ftest_ ftest |
|---|
| 4453 | #endif |
|---|
| 4454 | void ftest_( $MPI_FINT *, $MPI_FINT *); |
|---|
| 4455 | void ftest_( $MPI_FINT *itrue, $MPI_FINT *ifalse ) |
|---|
| 4456 | { |
|---|
| 4457 | FILE *f = fopen("conftestval","w"); |
|---|
| 4458 | if (!f) exit(1); |
|---|
| 4459 | fprintf( f, "%d %d\n", *itrue, *ifalse ); |
|---|
| 4460 | fclose(f); |
|---|
| 4461 | } |
|---|
| 4462 | EOF |
|---|
| 4463 | # Create the Fortran program |
|---|
| 4464 | cat >conftest.f <<EOF |
|---|
| 4465 | program main |
|---|
| 4466 | logical itrue, ifalse |
|---|
| 4467 | itrue = .TRUE. |
|---|
| 4468 | ifalse = .FALSE. |
|---|
| 4469 | call ftest( itrue, ifalse ) |
|---|
| 4470 | end |
|---|
| 4471 | EOF |
|---|
| 4472 | # Compile the two files |
|---|
| 4473 | pac_tmp_compile='$CC -c $CFLAGS $CPPFLAGS conftestc.c >&AC_FD_CC' |
|---|
| 4474 | if AC_TRY_EVAL(pac_tmp_compile) && test -s conftestc.o ; then |
|---|
| 4475 | AC_LANG_SAVE |
|---|
| 4476 | AC_LANG_FORTRAN77 |
|---|
| 4477 | saveLIBS=$LIBS |
|---|
| 4478 | LIBS="conftestc.o $LIBS" |
|---|
| 4479 | if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext ; then |
|---|
| 4480 | if ./conftest$ac_exeext ; then |
|---|
| 4481 | # success |
|---|
| 4482 | pac_cv_prog_f77_true_false_value=`cat conftestval` |
|---|
| 4483 | else |
|---|
| 4484 | # failure |
|---|
| 4485 | AC_MSG_WARN([Unable to run the program to determine the values of logicals]) |
|---|
| 4486 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 4487 | cat conftest.f >&AC_FD_CC |
|---|
| 4488 | fi |
|---|
| 4489 | else |
|---|
| 4490 | # failure |
|---|
| 4491 | AC_MSG_WARN([Unable to build program to determine values of logicals]) |
|---|
| 4492 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 4493 | cat conftest.f >&AC_FD_CC |
|---|
| 4494 | fi |
|---|
| 4495 | LIBS=$saveLIBS |
|---|
| 4496 | AC_LANG_RESTORE |
|---|
| 4497 | else |
|---|
| 4498 | AC_MSG_WARN([Unable to compile the C routine for finding the values of logicals]) |
|---|
| 4499 | echo "configure: failed program was:" >&AC_FD_CC |
|---|
| 4500 | cat conftestc.c >&AC_FD_CC |
|---|
| 4501 | fi |
|---|
| 4502 | ]) |
|---|
| 4503 | true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`" |
|---|
| 4504 | false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.* *//g'`" |
|---|
| 4505 | if test -n "$true_val" -a -n "$false_val" ; then |
|---|
| 4506 | AC_MSG_RESULT([True is $true_val and False is $false_val]) |
|---|
| 4507 | else |
|---|
| 4508 | AC_MSG_RESULT([could not determine]) |
|---|
| 4509 | fi |
|---|
| 4510 | else |
|---|
| 4511 | # Cross-compiling. Allow the user to set the values |
|---|
| 4512 | if test -n "$CROSS_F77_TRUE_VALUE" -a -n "$CROSS_F77_FALSE_VALUE" ; then |
|---|
| 4513 | true_val=$CROSS_F77_TRUE_VALUE |
|---|
| 4514 | false_val=$CROSS_F77_FALSE_VALUE |
|---|
| 4515 | fi |
|---|
| 4516 | fi |
|---|
| 4517 | if test -n "$true_val" -a -n "$false_val" ; then |
|---|
| 4518 | AC_DEFINE(F77_TRUE_VALUE_SET,1,[Define if we know the value of Fortran true and false]) |
|---|
| 4519 | AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran]) |
|---|
| 4520 | AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran]) |
|---|
| 4521 | fi |
|---|
| 4522 | # |
|---|
| 4523 | # We'd also like to check other values for .TRUE. and .FALSE. to see |
|---|
| 4524 | # if the compiler allows (or uses) more than one value (some DEC compilers, |
|---|
| 4525 | # for example, used the high (sign) bit to indicate true and false; the |
|---|
| 4526 | # rest of the bits were ignored. For now, we'll assume that there are |
|---|
| 4527 | # unique true and false values. |
|---|
| 4528 | |
|---|
| 4529 | # Get the ADDRESS_KIND and OFFSET_KIND if possible |
|---|
| 4530 | # |
|---|
| 4531 | # For Fortran 90, we'll also need MPI_ADDRESS_KIND and MPI_OFFSET_KIND |
|---|
| 4532 | # Since our compiler might BE a Fortran 90 compiler, try and determine the |
|---|
| 4533 | # values. |
|---|
| 4534 | if test -z "$F90" ; then |
|---|
| 4535 | AC_CACHE_CHECK([whether Fortran compiler is a Fortran 90 compiler], |
|---|
| 4536 | pac_cv_prog_f77_is_f90,[ |
|---|
| 4537 | pac_cv_prog_f77_is_f90=no |
|---|
| 4538 | cat >>conftest.f90 <<EOF |
|---|
| 4539 | program main |
|---|
| 4540 | integer, dimension(10) :: n |
|---|
| 4541 | integer k |
|---|
| 4542 | print *, range(k) |
|---|
| 4543 | end |
|---|
| 4544 | EOF |
|---|
| 4545 | if $F77 -o conftest $FFLAGS conftest.f90 >/dev/null 2>&1 ; then |
|---|
| 4546 | if test -x conftest ; then |
|---|
| 4547 | pac_cv_prog_f77_is_f90=yes |
|---|
| 4548 | fi |
|---|
| 4549 | fi |
|---|
| 4550 | ]) |
|---|
| 4551 | if test "$pac_cv_prog_f77_is_f90" = yes ; then |
|---|
| 4552 | F90=$F77 |
|---|
| 4553 | if test -z "$F90FLAGS" ; then |
|---|
| 4554 | F90FLAGS="$FFLAGS" |
|---|
| 4555 | fi |
|---|
| 4556 | fi |
|---|
| 4557 | fi |
|---|
| 4558 | if test -n "$F90" ; then |
|---|
| 4559 | PAC_LANG_PUSH_COMPILERS |
|---|
| 4560 | PAC_LANG_FORTRAN90 |
|---|
| 4561 | # Offset kind should be for 8 bytes if possible (Romio prefers that) |
|---|
| 4562 | # address should be sizeof void * |
|---|
| 4563 | # FIXME: make offset kind match the length of MPI_Offset. |
|---|
| 4564 | testsize=$ac_cv_sizeof_void_p |
|---|
| 4565 | if test "$testsize" = 0 ; then |
|---|
| 4566 | # Set a default |
|---|
| 4567 | testsize=4 |
|---|
| 4568 | fi |
|---|
| 4569 | dnl Using the {} around testsize helps the comments work correctly |
|---|
| 4570 | PAC_PROG_F90_INT_KIND(ADDRESS_KIND,${testsize},$CROSS_F90_ADDRESS_KIND) |
|---|
| 4571 | if test "$ac_cv_sizeof_void_p" = 8 ; then |
|---|
| 4572 | OFFSET_KIND=$ADDRESS_KIND |
|---|
| 4573 | else |
|---|
| 4574 | PAC_PROG_F90_INT_KIND(OFFSET_KIND,8,$CROSS_F90_OFFSET_KIND) |
|---|
| 4575 | fi |
|---|
| 4576 | # |
|---|
| 4577 | # Some compilers won't allow a -1 kind (e.g., absoft). In this case, |
|---|
| 4578 | # use a fallback (sizeof(int) kind) |
|---|
| 4579 | if test "$ADDRESS_KIND" = "-1" -o "$OFFSET_KIND" = "-1" ; then |
|---|
| 4580 | PAC_PROG_F90_INT_KIND(simpleintkind,${pac_cv_f77_sizeof_integer}) |
|---|
| 4581 | if test "$simpleintkind" = "-1" ; then |
|---|
| 4582 | # Wild guess; probably means that Fortran 90 is not available |
|---|
| 4583 | AC_MSG_WARN([Unable to determine Fortran 90 KIND values for either address-sized integers or offset-sized integers. Using 4 in that case.]) |
|---|
| 4584 | simpleintkind=4 |
|---|
| 4585 | fi |
|---|
| 4586 | if test "$ADDRESS_KIND" = "-1" ; then |
|---|
| 4587 | ADDRESS_KIND=$simpleintkind |
|---|
| 4588 | fi |
|---|
| 4589 | if test "$OFFSET_KIND" = "-1" ; then |
|---|
| 4590 | OFFSET_KIND=$simpleintkind |
|---|
| 4591 | fi |
|---|
| 4592 | fi |
|---|
| 4593 | AC_CACHE_CHECK([whether real*8 is supported in Fortran 90],pac_cv_fort90_real8,[ |
|---|
| 4594 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ real*8 a])], |
|---|
| 4595 | pac_cv_fort90_real8=yes, |
|---|
| 4596 | pac_cv_fort90_real8=no)]) |
|---|
| 4597 | PAC_LANG_POP_COMPILERS |
|---|
| 4598 | fi |
|---|
| 4599 | # Make sure that address kind and offset kind have values. |
|---|
| 4600 | if test -z "$ADDRESS_KIND" ; then |
|---|
| 4601 | ADDRESS_KIND=0 |
|---|
| 4602 | fi |
|---|
| 4603 | if test -z "$OFFSET_KIND" ; then |
|---|
| 4604 | OFFSET_KIND=0 |
|---|
| 4605 | fi |
|---|
| 4606 | # Note, however, that zero value are (in all practical case) invalid |
|---|
| 4607 | # for Fortran 90, and indicate a failure. Test and fail if Fortran 90 |
|---|
| 4608 | # enabled. |
|---|
| 4609 | if test "$enable_f90" = "yes" ; then |
|---|
| 4610 | if test "$ADDRESS_KIND" -le 0 -o "$OFFSET_KIND" -le 0 ; then |
|---|
| 4611 | AC_MSG_ERROR([Unable to determine Fortran integer kinds for MPI types. If you do not need Fortran 90, add --disable-f90 to the configure options. If you need Fortran 90, please send the output of configure and the file config.log to mpich2-maint@mcs.anl.gov .]) |
|---|
| 4612 | # If the above is converted to a warning, you need to change |
|---|
| 4613 | # enable_f90 and remote f90 from the bindings |
|---|
| 4614 | enable_f90=no |
|---|
| 4615 | fi |
|---|
| 4616 | fi |
|---|
| 4617 | AC_SUBST(ADDRESS_KIND) |
|---|
| 4618 | AC_SUBST(OFFSET_KIND) |
|---|
| 4619 | |
|---|
| 4620 | # Some compilers may require special directives to handle the common |
|---|
| 4621 | # block in a library. In particular, directives are needed for Microsoft |
|---|
| 4622 | # Windows to support dynamic library import. The following six |
|---|
| 4623 | # directives may be needed: |
|---|
| 4624 | # CMS\$ATTRIBUTES DLLIMPORT::/MPIPRIV1/ |
|---|
| 4625 | # CMS\$ATTRIBUTES DLLIMPORT::/MPIPRIV2/ |
|---|
| 4626 | # CMS\$ATTRIBUTES DLLIMPORT::/MPIPRIVC/ |
|---|
| 4627 | # CDEC\$ATTRIBUTES DLLIMPORT::/MPIPRIV1/ |
|---|
| 4628 | # CDEC\$ATTRIBUTES DLLIMPORT::/MPIPRIV2/ |
|---|
| 4629 | # CDEC\$ATTRIBUTES DLLIMPORT::/MPIPRIVC/ |
|---|
| 4630 | # CMS is for the Microsoft compiler, |
|---|
| 4631 | # CDEC is (we believe) for the DEC Fortran compiler. |
|---|
| 4632 | # We need to make this a configure-time variable because some compilers |
|---|
| 4633 | # (in particular, a version of the Intel Fortran compiler for Linux) |
|---|
| 4634 | # will read directives for other compilers and then flag as fatal |
|---|
| 4635 | # errors directives that it does not support but does recognize. |
|---|
| 4636 | |
|---|
| 4637 | DLLIMPORT="" |
|---|
| 4638 | AC_SUBST(DLLIMPORT) |
|---|
| 4639 | |
|---|
| 4640 | # FIXME: |
|---|
| 4641 | # We also need to include |
|---|
| 4642 | # SIZEOF_F90_MPI_OFFSET |
|---|
| 4643 | # SIZEOF_F90_MPI_AINT |
|---|
| 4644 | # |
|---|
| 4645 | # If other "kinds" are supported, MPI_SIZEOF needs to identify |
|---|
| 4646 | # those as well. This is very difficult to do in a general way. |
|---|
| 4647 | |
|---|
| 4648 | # To start with, we use the sizes determined for the Fortran 77 values. |
|---|
| 4649 | # These must be the same as for the Fortran 90 values. |
|---|
| 4650 | CROSS_F90_SIZEOF_INTEGER=${CROSS_F90_SIZEOF_INTEGER:-0} |
|---|
| 4651 | CROSS_F90_SIZEOF_REAL=${CROSS_F90_SIZEOF_REAL:-0} |
|---|
| 4652 | CROSS_F90_SIZEOF_DOUBLE_PRECISION=${CROSS_F90_SIZEOF_DOUBLE_PRECISION:-0} |
|---|
| 4653 | SIZEOF_F90_INTEGER=$CROSS_F90_SIZEOF_INTEGER |
|---|
| 4654 | SIZEOF_F90_REAL=$CROSS_F90_SIZEOF_REAL |
|---|
| 4655 | SIZEOF_F90_CHARACTER=1 |
|---|
| 4656 | SIZEOF_F90_DOUBLE_PRECISION=$CROSS_F90_SIZEOF_DOUBLE_PRECISION |
|---|
| 4657 | if test "$pac_cv_f77_sizeof_integer" -gt 0 -a \ |
|---|
| 4658 | "$SIZEOF_F90_INTEGER" = "0" ; then |
|---|
| 4659 | SIZEOF_F90_INTEGER=$pac_cv_f77_sizeof_integer |
|---|
| 4660 | fi |
|---|
| 4661 | if test "$pac_cv_f77_sizeof_real" -gt 0 -a "$SIZEOF_F90_REAL" = "0" ; then |
|---|
| 4662 | SIZEOF_F90_REAL=$pac_cv_f77_sizeof_real |
|---|
| 4663 | fi |
|---|
| 4664 | if test "$pac_cv_f77_sizeof_double_precision" -gt 0 -a \ |
|---|
| 4665 | "$SIZEOF_F90_DOUBLE_PRECISION" = "0" ; then |
|---|
| 4666 | SIZEOF_F90_DOUBLE_PRECISION=$pac_cv_f77_sizeof_double_precision |
|---|
| 4667 | fi |
|---|
| 4668 | AC_SUBST(SIZEOF_F90_INTEGER) |
|---|
| 4669 | AC_SUBST(SIZEOF_F90_REAL) |
|---|
| 4670 | AC_SUBST(SIZEOF_F90_DOUBLE_PRECISION) |
|---|
| 4671 | AC_SUBST(SIZEOF_F90_CHARACTER) |
|---|
| 4672 | |
|---|
| 4673 | # REQD is short for "real equal double precision" and is set to the |
|---|
| 4674 | # Fortran 90 comment character if true. This is necessary to |
|---|
| 4675 | # allow the mpi_sizeofs module to be built, since if this part of the |
|---|
| 4676 | # Fortran standard is violated by the compiler (unfortunately common, |
|---|
| 4677 | # as some applications are written to require this non-standard |
|---|
| 4678 | # version), the double precision versions of the MPI_SIZEOF routine |
|---|
| 4679 | # must be commented out of the module (!). |
|---|
| 4680 | REQD= |
|---|
| 4681 | if test "$SIZEOF_F90_REAL" = "$SIZEOF_F90_DOUBLE_PRECISION" ; then |
|---|
| 4682 | REQD="!" |
|---|
| 4683 | fi |
|---|
| 4684 | AC_SUBST(REQD) |
|---|
| 4685 | # Is integer*1 supported, and is it a different size than integer? |
|---|
| 4686 | REQI1="!" |
|---|
| 4687 | if test "$pac_cv_fort_integer1" = yes -a "$SIZEOF_F90_INTEGER" != 1 ; then |
|---|
| 4688 | REQI1= |
|---|
| 4689 | fi |
|---|
| 4690 | AC_SUBST(REQI1) |
|---|
| 4691 | # Is integer*2 supported, and is it a different size than integer? |
|---|
| 4692 | REQI2="!" |
|---|
| 4693 | if test "$pac_cv_fort_integer2" = yes -a "$SIZEOF_F90_INTEGER" != 2 ; then |
|---|
| 4694 | REQI2= |
|---|
| 4695 | fi |
|---|
| 4696 | AC_SUBST(REQI2) |
|---|
| 4697 | # Is integer*8 supported, and is it a different size than integer? |
|---|
| 4698 | REQI8="!" |
|---|
| 4699 | if test "$pac_cv_fort_integer8" = yes -a "$SIZEOF_F90_INTEGER" != 8 ; then |
|---|
| 4700 | REQI8= |
|---|
| 4701 | fi |
|---|
| 4702 | AC_SUBST(REQI8) |
|---|
| 4703 | # |
|---|
| 4704 | |
|---|
| 4705 | AC_LANG_C |
|---|
| 4706 | fi |
|---|
| 4707 | # ---------------------------------------------------------------------------- |
|---|
| 4708 | # C++ types |
|---|
| 4709 | if test "$enable_cxx" = "yes" ; then |
|---|
| 4710 | AC_LANG_CPLUSPLUS |
|---|
| 4711 | AC_CHECK_SIZEOF(bool) |
|---|
| 4712 | AC_CHECK_HEADER(complex) |
|---|
| 4713 | if test "$ac_cv_header_complex" = "yes" ; then |
|---|
| 4714 | # The C++ complex types are all templated. We finagle this by |
|---|
| 4715 | # defining a standin name |
|---|
| 4716 | AC_CHECK_SIZEOF(Complex,0,[#include <stdio.h> |
|---|
| 4717 | #include <complex> |
|---|
| 4718 | using namespace std; |
|---|
| 4719 | #define Complex complex<float> |
|---|
| 4720 | ]) |
|---|
| 4721 | AC_CHECK_SIZEOF(DoubleComplex,0,[#include <stdio.h> |
|---|
| 4722 | #include <complex> |
|---|
| 4723 | using namespace std; |
|---|
| 4724 | #define DoubleComplex complex<double> |
|---|
| 4725 | ]) |
|---|
| 4726 | if test "$MPID_NO_LONG_DOUBLE" != yes ; then |
|---|
| 4727 | AC_CHECK_SIZEOF(LongDoubleComplex,0,[#include <stdio.h> |
|---|
| 4728 | #include <complex> |
|---|
| 4729 | using namespace std; |
|---|
| 4730 | #define LongDoubleComplex complex<long double> |
|---|
| 4731 | ]) |
|---|
| 4732 | fi |
|---|
| 4733 | |
|---|
| 4734 | # Datatypes are given by |
|---|
| 4735 | # 0x4c00 <length in bytes> (1 byte) <unique num> (1 byte) |
|---|
| 4736 | # where the unique nums are |
|---|
| 4737 | # 33,34,35,36 |
|---|
| 4738 | case "$ac_cv_sizeof_bool" in |
|---|
| 4739 | 1) MPIR_CXX_BOOL=0x4c000133 ;; |
|---|
| 4740 | 2) MPIR_CXX_BOOL=0x4c000233 ;; |
|---|
| 4741 | 4) MPIR_CXX_BOOL=0x4c000433 ;; |
|---|
| 4742 | 8) MPIR_CXX_BOOL=0x4c000833 ;; |
|---|
| 4743 | *) ;; |
|---|
| 4744 | esac |
|---|
| 4745 | case "$ac_cv_sizeof_Complex" in |
|---|
| 4746 | 8) MPIR_CXX_COMPLEX=0x4c000834 ;; |
|---|
| 4747 | 16) MPIR_CXX_COMPLEX=0x4c001034 ;; |
|---|
| 4748 | *) ;; |
|---|
| 4749 | esac |
|---|
| 4750 | case "$ac_cv_sizeof_DoubleComplex" in |
|---|
| 4751 | 8) MPIR_CXX_DOUBLE_COMPLEX=0x4c000835 ;; |
|---|
| 4752 | 16) MPIR_CXX_DOUBLE_COMPLEX=0x4c001035 ;; |
|---|
| 4753 | 32) MPIR_CXX_DOUBLE_COMPLEX=0x4c002035 ;; |
|---|
| 4754 | *) ;; |
|---|
| 4755 | esac |
|---|
| 4756 | case "$ac_cv_sizeof_LongDoubleComplex" in |
|---|
| 4757 | 8) MPIR_CXX_LONG_DOUBLE_COMPLEX=0x4c000836 ;; |
|---|
| 4758 | 16) MPIR_CXX_LONG_DOUBLE_COMPLEX=0x4c001036 ;; |
|---|
| 4759 | 24) MPIR_CXX_LONG_DOUBLE_COMPLEX=0x4c001836 ;; |
|---|
| 4760 | 32) MPIR_CXX_LONG_DOUBLE_COMPLEX=0x4c002036 ;; |
|---|
| 4761 | *) ;; |
|---|
| 4762 | esac |
|---|
| 4763 | fi |
|---|
| 4764 | AC_LANG_C |
|---|
| 4765 | |
|---|
| 4766 | # Make these available to the collective operations and other code |
|---|
| 4767 | AC_DEFINE_UNQUOTED(MPIR_CXX_COMPLEX_VALUE,$MPIR_CXX_COMPLEX,[Define as the MPI Datatype handle for MPI::COMPLEX]) |
|---|
| 4768 | AC_DEFINE_UNQUOTED(MPIR_CXX_DOUBLE_COMPLEX_VALUE,$MPIR_CXX_DOUBLE_COMPLEX,[Define as the MPI Datatype handle for MPI::DOUBLE_COMPLEX]) |
|---|
| 4769 | AC_DEFINE_UNQUOTED(MPIR_CXX_LONG_DOUBLE_COMPLEX_VALUE,$MPIR_CXX_LONG_DOUBLE_COMPLEX,[Define as the MPI Datatype handle for MPI::LONG_DOUBLE_COMPLEX]) |
|---|
| 4770 | |
|---|
| 4771 | # If either complex or double complex have length 0, then mark |
|---|
| 4772 | # c++ complex as unavailable |
|---|
| 4773 | if test "$ac_cv_sizeof_Complex" != 0 -a \ |
|---|
| 4774 | "$ac_cv_sizeof_DoubleComplex" != 0 ; then |
|---|
| 4775 | AC_DEFINE(HAVE_CXX_COMPLEX,1,[Define is C++ supports complex types]) |
|---|
| 4776 | fi |
|---|
| 4777 | fi |
|---|
| 4778 | |
|---|
| 4779 | # ---------------------------------------------------------------------------- |
|---|
| 4780 | |
|---|
| 4781 | # Is char * the byte address? |
|---|
| 4782 | AC_CACHE_CHECK([if char * pointers use byte addresses], |
|---|
| 4783 | pac_cv_c_char_p_is_byte,[ |
|---|
| 4784 | AC_TRY_RUN([ |
|---|
| 4785 | int main(int argc, char **argv ){ |
|---|
| 4786 | char *a, buf; |
|---|
| 4787 | a = &buf; |
|---|
| 4788 | if ((long)(a-(char*)0) == (long)(a)) return 0; return 1; |
|---|
| 4789 | }],pac_cv_c_char_p_is_byte=yes,pac_cv_char_p_is_byte=no, |
|---|
| 4790 | pac_cv_char_p_is_byte=unknown)]) |
|---|
| 4791 | if test "$pac_cv_char_p_is_byte" = "yes" ; then |
|---|
| 4792 | AC_DEFINE(CHAR_PTR_IS_BYTE,1,[define if char * is byte pointer]) |
|---|
| 4793 | fi |
|---|
| 4794 | # ---------------------------------------------------------------------------- |
|---|
| 4795 | # |
|---|
| 4796 | # Check for the alignment rules moves with types int64_t etc. These |
|---|
| 4797 | # are used in the datatype code to perform pack and unpack operations. |
|---|
| 4798 | # These only determine if different alignments *work*, not whether they |
|---|
| 4799 | # work efficiently. The datatype pack code (should) allow the developer |
|---|
| 4800 | # to include stricter alignment rules than are needed for correctness to |
|---|
| 4801 | # get better performance. |
|---|
| 4802 | if test "$ac_cv_c_int64_t" != "no" -o -n "$INT64_T" ; then |
|---|
| 4803 | default_int64_t_alignment=${CROSS_INT64_T_ALIGNMENT:-"unknown"} |
|---|
| 4804 | if test -z "$INT64_T" ; then |
|---|
| 4805 | if test "$ac_cv_c_int64_t" = yes ; then |
|---|
| 4806 | INT64_T="int64_t" |
|---|
| 4807 | else |
|---|
| 4808 | INT64_T="$ac_cv_int64_t" |
|---|
| 4809 | fi |
|---|
| 4810 | fi |
|---|
| 4811 | # We use the type that we're going use for int64. |
|---|
| 4812 | AC_CACHE_CHECK([for alignment restrictions on $MYINT64_T],pac_cv_int64_t_alignment,[ |
|---|
| 4813 | AC_TRY_RUN([ |
|---|
| 4814 | #include <sys/types.h> |
|---|
| 4815 | #include <stdlib.h> |
|---|
| 4816 | int main(int argc, char **argv ) |
|---|
| 4817 | { |
|---|
| 4818 | $INT64_T *p1, v; |
|---|
| 4819 | char *buf_p = (char *)malloc( 64 ), *bp; |
|---|
| 4820 | bp = buf_p; |
|---|
| 4821 | /* Make bp aligned on 4, not 8 bytes */ |
|---|
| 4822 | if (!( (long)bp & 0x7 ) ) bp += 4; |
|---|
| 4823 | p1 = ($INT64_T *)bp; |
|---|
| 4824 | v = -1; |
|---|
| 4825 | *p1 = v; |
|---|
| 4826 | if (!( (long)bp & 0x3 ) ) bp += 2; |
|---|
| 4827 | p1 = ($INT64_T *)bp; |
|---|
| 4828 | *p1 = 1; |
|---|
| 4829 | if (!( (long)bp & 0x1 ) ) bp += 1; |
|---|
| 4830 | p1 = ($INT64_T *)bp; |
|---|
| 4831 | *p1 = 1; |
|---|
| 4832 | return 0; |
|---|
| 4833 | } |
|---|
| 4834 | ],pac_cv_int64_t_alignment=no,pac_cv_int64_t_alignment=yes,pac_cv_int64_t_alignment=$default_int64_t_alignment) |
|---|
| 4835 | ]) |
|---|
| 4836 | if test "$pac_cv_int64_t_alignment" = "no" ; then |
|---|
| 4837 | AC_DEFINE(HAVE_ANY_INT64_T_ALIGNMENT,1,[Define if int64_t works with any alignment]) |
|---|
| 4838 | fi |
|---|
| 4839 | fi |
|---|
| 4840 | |
|---|
| 4841 | if test "$ac_cv_int32_t" != "no" ; then |
|---|
| 4842 | default_int32_t_alignment=${CROSS_INT32_T_ALIGNMENT:-"unknown"} |
|---|
| 4843 | if test -z "$INT32_T" ; then |
|---|
| 4844 | if test "$ac_cv_c_int32_t" = yes ; then |
|---|
| 4845 | INT32_T="int32_t" |
|---|
| 4846 | else |
|---|
| 4847 | INT32_T="$ac_cv_int32_t" |
|---|
| 4848 | fi |
|---|
| 4849 | fi |
|---|
| 4850 | |
|---|
| 4851 | AC_CACHE_CHECK([for alignment restrictions on int32_t],pac_cv_int32_t_alignment,[ |
|---|
| 4852 | AC_TRY_RUN([ |
|---|
| 4853 | #include <sys/types.h> |
|---|
| 4854 | #include <stdlib.h> |
|---|
| 4855 | int main(int argc, char **argv ) |
|---|
| 4856 | { |
|---|
| 4857 | $INT32_T *p1, v; |
|---|
| 4858 | char *buf_p = (char *)malloc( 64 ), *bp; |
|---|
| 4859 | bp = buf_p; |
|---|
| 4860 | /* Make bp aligned on 4, not 8 bytes */ |
|---|
| 4861 | if (!( (long)bp & 0x7 ) ) bp += 4; |
|---|
| 4862 | p1 = ($INT32_T *)bp; |
|---|
| 4863 | v = -1; |
|---|
| 4864 | *p1 = v; |
|---|
| 4865 | if (!( (long)bp & 0x3 ) ) bp += 2; |
|---|
| 4866 | p1 = ($INT32_T *)bp; |
|---|
| 4867 | *p1 = 1; |
|---|
| 4868 | if (!( (long)bp & 0x1 ) ) bp += 1; |
|---|
| 4869 | p1 = ($INT32_T *)bp; |
|---|
| 4870 | *p1 = 1; |
|---|
| 4871 | return 0; |
|---|
| 4872 | } |
|---|
| 4873 | ],pac_cv_int32_t_alignment=no,pac_cv_int32_t_alignment=yes,pac_cv_int32_t_alignment=$default_int32_t_alignment) |
|---|
| 4874 | ]) |
|---|
| 4875 | if test "$pac_cv_int32_t_alignment" = "no" ; then |
|---|
| 4876 | AC_DEFINE(HAVE_ANY_INT32_T_ALIGNMENT,1,[Define if int32_t works with any alignment]) |
|---|
| 4877 | fi |
|---|
| 4878 | fi |
|---|
| 4879 | |
|---|
| 4880 | # Get the size for the bsendoverhead |
|---|
| 4881 | AC_CHECK_SIZEOF(MPIR_Bsend_data_t,128,[ |
|---|
| 4882 | #define MPI_Datatype int |
|---|
| 4883 | #include "${master_top_srcdir}/src/include/mpibsend.h"] |
|---|
| 4884 | ) |
|---|
| 4885 | BSEND_OVERHEAD=$ac_cv_sizeof_MPIR_Bsend_data_t |
|---|
| 4886 | export BSEND_OVERHEAD |
|---|
| 4887 | AC_SUBST(BSEND_OVERHEAD) |
|---|
| 4888 | |
|---|
| 4889 | # Check for special compile characteristics |
|---|
| 4890 | # If we are either gcc or icc, see if we can use __asm__ |
|---|
| 4891 | # We test on prog_gcc to allow gcc by any name; if we are using |
|---|
| 4892 | # icc, the value of CC must be icc for this test to pass |
|---|
| 4893 | if test "$ac_cv_prog_gcc" = "yes" -o "$ac_cv_prog_CC" = "icc" ; then |
|---|
| 4894 | AC_MSG_CHECKING([for gcc __asm__ and pentium cmpxchgl instruction]) |
|---|
| 4895 | AC_TRY_RUN([ |
|---|
| 4896 | int main(int argc, char *argv[]) |
|---|
| 4897 | { |
|---|
| 4898 | long int compval = 10; |
|---|
| 4899 | volatile long int *p = &compval; |
|---|
| 4900 | long int oldval = 10; |
|---|
| 4901 | long int newval = 20; |
|---|
| 4902 | char ret; |
|---|
| 4903 | long int readval; |
|---|
| 4904 | __asm__ __volatile__ ("lock; cmpxchgl %3, %1; sete %0" |
|---|
| 4905 | : "=q" (ret), "=m" (*p), "=a" (readval) |
|---|
| 4906 | : "r" (newval), "m" (*p), "a" (oldval) : "memory"); |
|---|
| 4907 | return (compval == 20) ? 0 : -1; |
|---|
| 4908 | } |
|---|
| 4909 | ], AC_MSG_RESULT(yes) |
|---|
| 4910 | AC_DEFINE(HAVE_GCC_AND_PENTIUM_ASM, 1,[Define if using gcc on a system with an Intel Pentium class chip]) |
|---|
| 4911 | lac_cv_use_atomic_updates="yes", |
|---|
| 4912 | AC_MSG_RESULT(no), AC_MSG_RESULT(not checking when cross compiling)) |
|---|
| 4913 | fi |
|---|
| 4914 | if test "$lac_cv_use_atomic_updates" = "yes" ; then |
|---|
| 4915 | AC_DEFINE(USE_ATOMIC_UPDATES,, [Define if assembly language atomic update macros should be used (if available)]) |
|---|
| 4916 | fi |
|---|
| 4917 | |
|---|
| 4918 | # check for x86_64 |
|---|
| 4919 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 4920 | AC_MSG_CHECKING([for gcc __asm__ and AMD x86_64 cmpxchgq instruction]) |
|---|
| 4921 | AC_TRY_RUN([ |
|---|
| 4922 | int main(int argc, char *argv[]) |
|---|
| 4923 | { |
|---|
| 4924 | long int compval = 10; |
|---|
| 4925 | volatile long int *p = &compval; |
|---|
| 4926 | long int oldval = 10; |
|---|
| 4927 | long int newval = 20; |
|---|
| 4928 | char ret; |
|---|
| 4929 | long int readval; |
|---|
| 4930 | __asm__ __volatile__ ("lock; cmpxchgq %3, %1; sete %0" |
|---|
| 4931 | : "=q" (ret), "=m" (*p), "=a" (readval) |
|---|
| 4932 | : "r" (newval), "m" (*p), "a" (oldval) : "memory"); |
|---|
| 4933 | return (compval == 20) ? 0 : -1; |
|---|
| 4934 | } |
|---|
| 4935 | ], AC_MSG_RESULT(yes) |
|---|
| 4936 | AC_DEFINE(HAVE_GCC_AND_X86_64_ASM, 1,[Define if using gcc on a system with an AMD x86_64 class chip]), |
|---|
| 4937 | AC_MSG_RESULT(no), AC_MSG_RESULT(not checking when cross compiling)) |
|---|
| 4938 | fi |
|---|
| 4939 | dnl |
|---|
| 4940 | dnl check for asm() format |
|---|
| 4941 | dnl |
|---|
| 4942 | dnl AC_MSG_CHECKING([for asm() and pentium cmpxchgl instruction]) |
|---|
| 4943 | dnl AC_TRY_RUN([ |
|---|
| 4944 | dnl int main(int argc, char *argv[]) |
|---|
| 4945 | dnl { |
|---|
| 4946 | dnl long int compval = 10; |
|---|
| 4947 | dnl volatile long int *p = &compval; |
|---|
| 4948 | dnl long int oldval = 10; |
|---|
| 4949 | dnl long int newval = 20; |
|---|
| 4950 | dnl char ret; |
|---|
| 4951 | dnl long int readval; |
|---|
| 4952 | dnl asm("lock; cmpxchgl %3, %1; sete %0" |
|---|
| 4953 | dnl : "=q" (ret), "=m" (*p), "=a" (readval) |
|---|
| 4954 | dnl : "r" (newval), "m" (*p), "a" (oldval) : "memory"); |
|---|
| 4955 | dnl return (compval == 20) ? 0 : -1; |
|---|
| 4956 | dnl } |
|---|
| 4957 | dnl ], AC_MSG_RESULT(yes) |
|---|
| 4958 | dnl AC_DEFINE(HAVE_PENTIUM_ASM, 1,[Define if using asm() on a system with an Intel Pentium class chip]), |
|---|
| 4959 | dnl AC_MSG_RESULT(no), AC_MSG_RESULT(not checking when cross compiling)) |
|---|
| 4960 | dnl |
|---|
| 4961 | dnl |
|---|
| 4962 | dnl check for IA64 |
|---|
| 4963 | dnl |
|---|
| 4964 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 4965 | AC_MSG_CHECKING([for gcc __asm__ and IA64 xchg4 instruction]) |
|---|
| 4966 | AC_TRY_RUN([ |
|---|
| 4967 | unsigned long _InterlockedExchange(volatile void *ptr, unsigned long x) |
|---|
| 4968 | { |
|---|
| 4969 | unsigned long result; |
|---|
| 4970 | __asm__ __volatile ("xchg4 %0=[%1],%2" : "=r" (result) |
|---|
| 4971 | : "r" (ptr), "r" (x) : "memory"); |
|---|
| 4972 | return result; |
|---|
| 4973 | } |
|---|
| 4974 | int main(int argc, char *argv[]) |
|---|
| 4975 | { |
|---|
| 4976 | long val = 1; |
|---|
| 4977 | volatile long *p = &val; |
|---|
| 4978 | long oldval = _InterlockedExchange(p, (unsigned long)2); |
|---|
| 4979 | return (oldval == 1 && val == 2) ? 0 : -1; |
|---|
| 4980 | } |
|---|
| 4981 | ], AC_MSG_RESULT(yes) |
|---|
| 4982 | AC_DEFINE(HAVE_GCC_AND_IA64_ASM, 1,[Define if using gcc on a system with an IA64 class chip]), |
|---|
| 4983 | AC_MSG_RESULT(no), AC_MSG_RESULT(not checking when cross compiling)) |
|---|
| 4984 | fi |
|---|
| 4985 | # ----------------------------------------------------------------------------- |
|---|
| 4986 | # Check for support of enable-coverage. Put this near the end of the tests |
|---|
| 4987 | # because the coverage options may affect the other tests. |
|---|
| 4988 | if test "$enable_coverage" = "yes" ; then |
|---|
| 4989 | if test "$ac_cv_prog_gcc" = "yes" ; then |
|---|
| 4990 | CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 4991 | MPICH2_EXTRA_CFLAGS="$MPICH2_EXTRA_CFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 4992 | else |
|---|
| 4993 | AC_MSG_WARN([--enable-coverage only supported for GCC]) |
|---|
| 4994 | fi |
|---|
| 4995 | if test "$enable_cxx" = "yes" ; then |
|---|
| 4996 | if test "$ac_cv_cxx_compiler_gnu" = "yes" ; then |
|---|
| 4997 | CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 4998 | MPICH2_EXTRA_CXXFLAGS="$MPICH2_EXTRA_CXXFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 4999 | else |
|---|
| 5000 | AC_MSG_WARN([--enable-coverage only supported for GCC]) |
|---|
| 5001 | fi |
|---|
| 5002 | fi |
|---|
| 5003 | # Add similar options for g77 so that the Fortran tests will also |
|---|
| 5004 | # |
|---|
| 5005 | if test "$enable_f77" = yes ; then |
|---|
| 5006 | if test "$ac_cv_f77_compiler_gnu" = "yes" ; then |
|---|
| 5007 | FFLAGS="$FFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 5008 | MPICH2_EXTRA_FFLAGS="$MPICH2_EXTRA_FFLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 5009 | else |
|---|
| 5010 | AC_MSG_WARN([--enable-coverage only supported for G77/GFORTRAN]) |
|---|
| 5011 | fi |
|---|
| 5012 | fi |
|---|
| 5013 | if test "$enable_f90" = yes ; then |
|---|
| 5014 | if test "$ac_cv_f90_compiler_gnu" = "yes" ; then |
|---|
| 5015 | F90FLAGS="$F90FLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 5016 | MPICH2_EXTRA_F90FLAGS="$MPICH2_EXTRA_F90FLAGS -fprofile-arcs -ftest-coverage" |
|---|
| 5017 | else |
|---|
| 5018 | AC_MSG_WARN([--enable-coverage only supported for GFORTRAN]) |
|---|
| 5019 | fi |
|---|
| 5020 | fi |
|---|
| 5021 | # On some platforms (e.g., Mac Darwin), we must also *link* |
|---|
| 5022 | # with the -fprofile-args -ftest-coverage option. |
|---|
| 5023 | # We cannot use TRY_LINK because that uses both the compilation and |
|---|
| 5024 | # the linking flags. |
|---|
| 5025 | # This is needed for Mac OSX 10.5 |
|---|
| 5026 | rm -rf conftest.dSYM |
|---|
| 5027 | rm -f conftest* |
|---|
| 5028 | cat >>conftest.c <<EOF |
|---|
| 5029 | int main( int argc, char **argv ) { return 1; } |
|---|
| 5030 | EOF |
|---|
| 5031 | # |
|---|
| 5032 | compile_only='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext' |
|---|
| 5033 | link_only='$CC -o conftest$ac_exeext $LDFLAGS conftest.$ac_objext $LIBS' |
|---|
| 5034 | # |
|---|
| 5035 | AC_MSG_CHECKING([whether compilation with coverage analysis enabled works]) |
|---|
| 5036 | if AC_TRY_EVAL(compile_only) ; then |
|---|
| 5037 | AC_MSG_RESULT(yes) |
|---|
| 5038 | AC_MSG_CHECKING([if extra options needed to link when coverage analysis enabled]) |
|---|
| 5039 | if AC_TRY_EVAL(link_only) ; then |
|---|
| 5040 | AC_MSG_RESULT(no) |
|---|
| 5041 | else |
|---|
| 5042 | LDFLAGSsave="$LDFLAGS" |
|---|
| 5043 | LDFLAGS="$LDFLAGS -ftest-coverage -fprofile-arcs" |
|---|
| 5044 | if AC_TRY_EVAL(link_only) ; then |
|---|
| 5045 | AC_MSG_RESULT([need -ftest-coverage -fprofile-arcs]) |
|---|
| 5046 | else |
|---|
| 5047 | AC_MSG_RESULT([Unable to determine]) |
|---|
| 5048 | AC_MSG_ERROR([Cannot link programs when coverage analysis enabled]) |
|---|
| 5049 | fi |
|---|
| 5050 | fi |
|---|
| 5051 | else |
|---|
| 5052 | AC_MSG_RESULT(no) |
|---|
| 5053 | AC_MSG_ERROR([Unable to compile programs when coverage analysis enabled]) |
|---|
| 5054 | fi |
|---|
| 5055 | # This is needed for Mac OSX 10.5 |
|---|
| 5056 | rm -rf conftest.dSYM |
|---|
| 5057 | rm -f conftest* |
|---|
| 5058 | |
|---|
| 5059 | # Test for the routines that we need to use to ensure that the |
|---|
| 5060 | # data files are (usually) written out |
|---|
| 5061 | # FIXME: Some versions of Linux provide usleep, but it rounds times |
|---|
| 5062 | # up to the next second (!) |
|---|
| 5063 | AC_CHECK_FUNCS(usleep) |
|---|
| 5064 | AC_DEFINE(USE_COVERAGE,1,[Define if performing coverage tests]) |
|---|
| 5065 | fi |
|---|
| 5066 | # ----------------------------------------------------------------------------- |
|---|
| 5067 | # Look for Standard headers |
|---|
| 5068 | AC_HEADER_STDC |
|---|
| 5069 | # Check for a specific header |
|---|
| 5070 | # Grrr. OS/X fails the test for sys/uio.h because uio *requires* sys/types.h |
|---|
| 5071 | # to compile. Thus, we'll make that a separate test |
|---|
| 5072 | # stddef.h is sometimes needed for types like wchar_t |
|---|
| 5073 | AC_CHECK_HEADERS(stdlib.h stdarg.h sys/types.h string.h inttypes.h limits.h stddef.h errno.h sys/socket.h sys/time.h unistd.h endian.h assert.h sys/param.h) |
|---|
| 5074 | AC_CACHE_CHECK([for sys/uio.h],ac_cv_header_sys_uio_h,[ |
|---|
| 5075 | AC_TRY_COMPILE([ |
|---|
| 5076 | #include <sys/types.h> |
|---|
| 5077 | #include <sys/uio.h> |
|---|
| 5078 | ],[int a;],ac_cv_header_sys_uio_h=yes,ac_cv_header_sys_uio_h=no)]) |
|---|
| 5079 | if test "$ac_cv_header_sys_uio_h" = yes ; then |
|---|
| 5080 | AC_DEFINE(HAVE_SYS_UIO_H,1,[Define if you have the <sys/uio.h> header file.]) |
|---|
| 5081 | fi |
|---|
| 5082 | |
|---|
| 5083 | # Check for special types |
|---|
| 5084 | AC_TYPE_SIZE_T |
|---|
| 5085 | |
|---|
| 5086 | # These are used to support timeouts |
|---|
| 5087 | |
|---|