configure.in 239 KB
Newer Older
1
AC_PREREQ(2.63)
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# 
# (C) 2006 by Argonne National Laboratory.
#     See COPYRIGHT in top-level directory.
#
dnl Process this file with autoconf to produce a configure script.
dnl
dnl aclocal_cache.m4, included by sowing/confdb/aclocal.m4, fixes 
dnl bugs in autoconf caching.
dnl
dnl This is a large configure script and it is important to keep it
dnl clearly organized.  In addition, this script must coordinate with 
dnl the other modules that can be used to construct MPICH2, such as
dnl the communication device and the process manager.  Each of these
dnl may have special features or limitations that other modules or
dnl this configure may need to take into account.  To handle this, there
dnl are xx major steps in this configure script:
dnl
dnl 1. Identify major modules and source any prerequisite scripts
dnl 2. Determine compiler characteristics 
dnl 3. Setup and configure the other modules
dnl 4. Determine MPI features and characteristics (such as datatype values)
dnl
dnl Each of these is described in more detail below.
dnl
dnl 1. Identify the modules (most are specified by 
dnl --with-<modulename>=instance,
dnl for example, --with-pm=mpd or --with-device=ch3:nemesis).
dnl For each module, source the file mpich2prereq if present (in the
dnl module's top-level directory).  This
dnl must be a bourne (sh) shell script; it can access any of the variables
dnl in the configure script.  In addition, there are a few variables that
dnl are defined and provided to allow the modules to communicate their 
dnl needs or limitations to the other modules.  These are:
dnl    MPID_MAX_THREAD_LEVEL - thread level supported by device.
dnl                            if unset, is MPI_THREAD_FUNNELED
dnl    MPID_NO_LONG_LONG     - if yes, the device does not support the 
dnl                            long long integer type
dnl    MPID_NO_LONG_DOUBLE   - if yes, the device does not support the
dnl                            long double type
dnl    MPID_PM_NAMESERVER    - if set, provides the name of the nameserver
dnl                            that the process manager supports.
dnl                            This name server will be used if the
dnl                            default name server is selected.
dnl    MPID_NO_PM            - If yes, the device does not require any
dnl                            PM implementation.  
dnl    MPID_NO_PMI           - If yes, the device does not require any 
dnl                            PMI implementation.
dnl    EXTRA_STATUS_DECL     - Any extra declarations that the device
dnl                            needs added to the definition of MPI_Status.
dnl    MPID_MAX_PROCESSOR_NAME - The maximum number of character in a processor
dnl                            name.  If not set, 128 will be used.
dnl    PMI_REQUIRES_READABLE_TOKENS - if yes, define the C-preprocessor
dnl                            value USE_HUMAN_READABLE_TOKENS, which is
dnl                            used in src/include/mpimem.h to define token
dnl                            separators used in src/util/mem/argstr.c
dnl    PM_REQUIRES_PMI       - if set, provides the name of the PMI 
dnl                            interface implementation.  If not set,
dnl                            the "simple" PMI implementation is used.
dnl                            A process manager that needs a particular
dnl                            process manager should check that this is
dnl                            not set to an incompatible value.
dnl    MPID_NO_SPAWN         - if yes, the device does not support the
dnl                            dynamic process routines (spawn, connect
dnl                            attach, join, plus port and publish 
dnl                            routines).  The major effect of this
dnl                            is to let the test codes know that
dnl                            spawn is not implemented.
dnl    MPID_NO_RMA           - if yes, the device does not support the
dnl                            MPI RMA routines (MPI_Win_create and 
dnl                            MPI_Put etc.).  The major effect of this
dnl                            is to let the test codes know that 
dnl                            RMA is not implemented.
dnl
dnl Note that the meanings of these variables are defined so that an 
dnl undefined value gives the default.  This makes it easy to expand
dnl the set of such variables, since only modules that need the new
dnl variable will need to be changed.
dnl
dnl 2. Determine compiler characteristics
dnl Here is where features of the compilers are determined, including
dnl support for shared libraries and sizes of the basic datatype types.
dnl
dnl 3. Setup and configure the other modules
dnl Before each module configure is executed, the script setup_<module>
dnl is run if present.  This is a bourne (sh) shell script and may
dnl access configure variables.  It should not make any changes to the
dnl compiler name or flags (e.g., do not add -D_XOPEN_SOURCE to CFLAGS here,
dnl because that may invalidate the determination of the compiler 
dnl characteristics in the prior step).
dnl
dnl 4. Determine MPI features
dnl    
dnl
dnl Special environment variables
dnl To let other scripts and in particular the configure in test/mpi
dnl know that they are being invoked from within the MPICH2 configure,
dnl the following environment variables are set and exported:
dnl    FROM_MPICH2
dnl    MPICH2_ENABLE_F77
dnl    MPICH2_ENABLE_F90
dnl    MPICH2_ENABLE_CXX
dnl
dnl The file name here refers to a file in the source being configured
dnl In later versions of autoconf, the binding of AC_INIT changed (!!!)
dnl The original version was AC_INIT(a source file)
dnl The later version is AC_INIT(package,version,[bug-report],[tarname])
dnl Here we use the original version
dnl AC_INIT(src/include/mpiimpl.h)
dnl
dnl Note that no executable statements are allowed (and any are silently 
dnl dropped) before AC_INIT.
dnl
dnl AC_INIT requires an explicit version number
dnl Args are package name, version, bug report, and tar file name
dnl All must be literals
dnl Note that AC_PACKAGE_STRING is not a command but must be defined(!)
dnl Unfortunately, setting the PACKAGE names is not compatible with
dnl AC_CONFIG_SUBDIRS, since the resulting values in the generated
dnl conf file will not be consistent.
dnl define([AC_PACKAGE_STRING],[MPICH2 1.0.6])
dnl AC_INIT(mpich2,1.0.6,mpich2-maint@mcs.anl.gov,mpich2-1.0.6)
dnl Use the oldstyle AC_INIT instead
124

125
AC_INIT(src/include/mpichconf.h.in)
126

127
128
129
130
CONFIGURE_ARGS_CLEAN=`echo $* | tr '"' ' '`
AC_SUBST(CONFIGURE_ARGS_CLEAN)

# Try to find the release date
131
132
133
134
135
136
137
if test -s "$srcdir/maint/ReleaseDate" ; then
    RELEASE_DATE="`cat $srcdir/maint/ReleaseDate`"
else
    RELEASE_DATE="Unknown, built on `date`"
fi
AC_SUBST(RELEASE_DATE)

138
139
# Try to find the version
if test -s "$srcdir/maint/Version" ; then
140
    MPICH2_VERSION="`cat $srcdir/maint/Version | grep ^MPICH2_VERSION: | cut -f2 -d' '`"
141
    export MPICH2_VERSION
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
else
    AC_MSG_ERROR([Version information not found. Configuration aborted.])
fi

# Produce a numeric version assuming the following format:
# Version: [MAJ].[MIN].[REV][EXT][EXT_NUMBER]
# Example: 1.0.7rc1 has
#          MAJ = 1
#          MIN = 0
#          REV = 7
#          EXT = rc
#          EXT_NUMBER = 1
#
# Converting to numeric version will convert EXT to a format number:
#          ALPHA (a) = 0
#          BETA (b)  = 1
#          RC (rc)   = 2
#          PATCH (p) = 3
# Regular releases are treated as patch 0
#
# Numeric version will have 1 digit for MAJ, 2 digits for MIN,
163
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
164
changequote(<<,>>)
165
166
167
168
169
V1=`expr $MPICH2_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
V2=`expr $MPICH2_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
V3=`expr $MPICH2_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
V4=`expr $MPICH2_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
V5=`expr $MPICH2_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
170
changequote([,])
171

172
if test "$V2" -le 9 ; then V2=0$V2 ; fi
173
if test "$V3" = "" ; then V3=0; fi
174
if test "$V3" -le 9 ; then V3=0$V3 ; fi
175
176
177
178
179
180
181
182
183
184
185
186
if test "$V4" = "a" ; then
    V4=0
elif test "$V4" = "b" ; then
    V4=1
elif test "$V4" = "rc" ; then
    V4=2
elif test "$V4" = "" ; then
    V4=3
    V5=0
elif test "$V4" = "p" ; then
    V4=3
fi
187
if test "$V5" -le 9 ; then V5=0$V5 ; fi
188

189
190
191
MPICH2_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
AC_SUBST(MPICH2_NUMVERSION)
AC_SUBST(MPICH2_VERSION)
192

193

194
195
196
197
198
199
200
201
202
203
# ABIVERSION is incremented when there are changes in the ABI.  This is 
# used to let a shared library describe how compatible it is with executables
# that were linked against it.  In our use, the version number is x:y, where
#  x changes when the ABI changes
#  y changes when major behavior of the routines, without changing the ABI;
#    reset y to one when x changes.  Some systems don't like a 0 subversion,
#    so we always use one as the smallest version number.
# The ABIVERSION is not the same as the VERSION. It is used principly in the
# Makefile.sm to pass the ABIVERSION to the createshlib script.
# We use libtool-style version numbers (see --version-info in the 
204
205
# libtool manual)
ABIVERSION="`cat $srcdir/maint/Version | grep ^MPICH2_ABIVERSION: | cut -f2 -d' '`"
206
AC_SUBST(ABIVERSION)
207

208
# Print out the configure options
209
210
211
CONFIGURE_ARGUMENTS="$ac_configure_args"
AC_SUBST(CONFIGURE_ARGUMENTS)
if test -n "$ac_configure_args" ; then
212
    echo "Configuring MPICH2 version $MPICH2_VERSION with $ac_configure_args"
213
else 
214
    echo "Configuring MPICH2 version $MPICH2_VERSION"
215
fi
216

217
218
# Add the information on the system:
echo "Running on system: `uname -a`"
219

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
dnl Definitions will be placed in this file rather than in the DEFS variable
AC_CONFIG_HEADER(src/include/mpichconf.h)
AH_TOP([/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*  
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */
#ifndef MPICHCONF_H_INCLUDED
#define MPICHCONF_H_INCLUDED
])
AH_BOTTOM([#endif])

dnl Set the directory that contains support scripts such as install-sh and
dnl config.guess
AC_CONFIG_AUX_DIR(confdb)
235
236
237
238
239
240
241

# Set the FROM_MPICH2 variable to tell subconfigures that they are
# built from within MPICH2
FROM_MPICH2=yes
export FROM_MPICH2
AC_ARG_VAR(FROM_MPICH2, [internally set flag to tell subconfigures that they are built from within MPICH2])

242
243
244
245
246
247
248
249
250
251
252
# Save a copy of CFLAGS, CXXFLAGS, FFLAGS, F90FLAGS, LDFLAGS as USER_*
# before any of these flags are being modified by configure
# tests.
PAC_PREFIX_FLAGS(USER, CFLAGS)
PAC_PREFIX_FLAGS(USER, CXXFLAGS)
PAC_PREFIX_FLAGS(USER, FFLAGS)
PAC_PREFIX_FLAGS(USER, F90FLAGS)
PAC_PREFIX_FLAGS(USER, LDFLAGS)
PAC_PREFIX_FLAGS(USER, LIBS)

# WRAPPER_xFLAGS are used by mpicc and friends.
253
254
255
256
257
258
259
260
261
262
263
264
#
# WRAPPER_CFLAGS and other compile flags are used for compile options
# that are added by MPICH2, but should be used by applications (such
# as include paths).
#
# All libraries that are detected by MPICH2 as needed for some of its
# functionality (such as -lpthread) should be added to LIBS so
# autoconf link tests can use them. Libraries that are built by MPICH2
# at make time (and hence are not available for autoconf link tests to
# use), such as OPA and MPL, should be added to WRAPPER_LIBS. All
# libraries in LIBS are added to WRAPPER_LIBS as well, at the end of
# configure.
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
PAC_PREFIX_FLAGS(WRAPPER, CFLAGS)
PAC_PREFIX_FLAGS(WRAPPER, CXXFLAGS)
PAC_PREFIX_FLAGS(WRAPPER, FFLAGS)
PAC_PREFIX_FLAGS(WRAPPER, F90FLAGS)
PAC_PREFIX_FLAGS(WRAPPER, LDFLAGS)
PAC_PREFIX_FLAGS(WRAPPER, LIBS)
WRAPPER_CFLAGS="$CFLAGS $MPICH2_MPICC_FLAGS"
WRAPPER_CXXFLAGS="$CXXFLAGS $MPICH2_MPICXX_FLAGS"
WRAPPER_FFLAGS="$FFLAGS $MPICH2_MPIF77_FLAGS"
WRAPPER_F90FLAGS="$F90FLAGS $MPICH2_MPIF90_FLAGS"
WRAPPER_LDFLAGS="$CFLAGS $MPICH2_LDFLAGS"

# Add MPICH2LIB_* to the appropriate flags
AC_ARG_VAR(MPICH2LIB_CFLAGS, [extra CFLAGS used in building MPICH2 libraries])
AC_ARG_VAR(MPICH2LIB_CXXFLAGS, [extra CXXFLAGS used in building MPICH2 libraries])
AC_ARG_VAR(MPICH2LIB_FFLAGS, [extra FFLAGS used in building MPICH2 libraries])
AC_ARG_VAR(MPICH2LIB_F90FLAGS, [extra F90FLAGS used in building MPICH2 libraries])
AC_ARG_VAR(MPICH2LIB_LDFLAGS, [extra LDFLAGS used in building MPICH2 libraries])
CFLAGS="$CFLAGS $MPICH2LIB_CFLAGS"
CXXFLAGS="$CXXFLAGS $MPICH2LIB_CXXFLAGS"
FFLAGS="$FFLAGS $MPICH2LIB_FFLAGS"
F90FLAGS="$F90FLAGS $MPICH2LIB_F90FLAGS"
LDFLAGS="$LDFLAGS $MPICH2LIB_LDFLAGS"

289
# Enable better caching control
290
PAC_ARG_CACHING
291
292
293
294
295

# Set CFLAGS for enable strict if necessary.  Do this *first* because
# it may influence the output of the other tests
PAC_ARG_STRICT

296
297
298
299
300
301
302
303
304
AC_ARG_ENABLE(echo, 
[--enable-echo  - Turn on strong echoing. The default is enable=no.] ,set -x)
dnl
dnl
AC_ARG_ENABLE(coverage,
[--enable-coverage - Turn on coverage analysis using gcc and gcov],,
enable_coverage=no)
dnl
AC_ARG_ENABLE(dynamiclibs,
305
306
[--enable-dynamiclibs - Enable the use of dynamic libraries by the devices
                       that support them],,enable_dynamiclibs=no)
307
308
309
310
311
312
313
314
315
dnl
AC_ARG_ENABLE(error-checking,
[--enable-error-checking=level - Control the amount of error checking.  
    no        - no error checking
    runtime   - error checking controllable at runtime through environment 
                variables
    all       - error checking always enabled],,enable_error_checking=all)
dnl
AC_ARG_ENABLE(error-messages,
316
[--enable-error-messages=level - Control the amount of detail in error messages.
317
318
319
320
321
322
323
    all       - Maximum amount of information
    generic   - Only generic messages (no information about the specific
                instance)
    class     - One message per MPI error class
    none      - No messages],,enable_error_messages=all)
dnl
AC_ARG_ENABLE(timing,
324
325
326
[--enable-timing=level - Control the amount of timing information
                        collected by the MPICH implementation.
    none    - Collect no data (default)
327
    all     - Collect lots of data
328
329
    runtime - Runtime control of data collected]
  ,,enable_timing=default)
330
331
dnl
AC_ARG_ENABLE(g,
332
333
334
[--enable-g=option - Control the level of debugging support in the
                    MPICH implementation.  option is a list of comma
                    separated names including
335
336
    none     - No debugging
    handle   - Trace handle operations
337
    handlealloc - Trace hancle allocations
338
339
340
    dbg      - Add compiler flag, -g, to all internal
               compiler flags, i.e. MPICH2LIB_CFLAGS, MPICH2LIB_CXXFLAGS,
               MPICH2LIB_FFLAGS, and MPICH2LIB_F90FLAGS.
341
    debug    - Synonym for dbg
342
    log      - Enable debug event logging
343
    mem      - Memory usage tracing
344
345
    meminit  - Preinitialize memory associated structures and unions to
               eliminate access warnings from programs like valgrind
346
    memarena - Check for overwrite errors in memory allocation arena
347
    mutex    - Enable error checking on pthread mutexes
348
349
350
    mutexnesting - Check for non-nesting of mutexes
    nesting  - Check for proper nesting values
    fine-grain-nesting - Perform a fine-grain nesting check on exit
351
352
    all      - All of the above choices],,enable_g=none)
dnl
353
354
355
dnl We may want to force MPI_Aint to be the same size as MPI_Offset, 
dnl particularly on 32 bit systems with large (64 bit) file systems.
AC_ARG_WITH(aint-size,
356
[--with-aint-size - Override the size of MPI_AINT (in bytes)],,with_aint_size=0)
357
358
dnl
dnl
359
360
361
362
363
364
365
366
dnl --enable-sharedlibs=kind is set with the PAC_ARG_SHAREDLIBS macro 
dnl
dnl AC_ARG_ENABLE(internat,
dnl [--enable-internat - Enable internationalization of messages.
dnl  Not yet supported])
dnl
dnl --enable-fast
AC_ARG_ENABLE(fast,
367
368
369
370
371
372
[--enable-fast=option - Control the level of fast execution in the
                       MPICH implementation.  option is a list of
                       comma separated names including
    defopt   - Default compiler optimization -O2 for all language bindings,
               i.e. --enable-fast=O2, when neither --enable-fast
               nor --disable-fast is specified. (default)
373
374
375
    O<n>     - Appends default optimization flags, -O<n>, to all internal
               compiler flags, i.e. MPICH2LIB_CFLAGS, MPICH2LIB_CXXFLAGS,
               MPICH2LIB_FFLAGS, and MPICH2LIB_F90FLAGS.
376
    nochkmsg - No error checking, i.e. --disable-error-checking
377
    notiming - No timing collection, i.e. --disable-timing.
378
    ndebug   - Appends -DNDEBUG to MPICH2LIB_CFLAGS.
379
    all|yes  - "defopt", "nochkmsg", "notiming" and "ndebug" are enabled
380
               when --enable-fast is specified without any option.
381
382
383
    none     - None of above options, i.e. --disable-fast.  Note that 
    	       --enable-strict will add the -O2 option even if
	       --enable-fast=none is given.
384
],,enable_fast=defopt)
385

386
AC_ARG_ENABLE(check-compiler-flags,
387
388
389
390
[--enable-check-compiler-flags -- enable the checks for all compiler
                                 options, xxxFLAGS, MPICH2_xxxFLAGS.
                                 Default is on.]
    ,,enable_check_compiler_flags=yes)
391

392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
dnl
dnl We enable f77 and f90 if we can find compilers for them.
dnl In addition, we check whether f77 and f90 can work together.
dnl
AC_ARG_ENABLE(f77,
[--enable-f77 - Enable Fortran 77 bindings],,
enable_f77=default; enable_f77_wasdefault=yes)
AC_ARG_ENABLE(f90,
[--enable-f90 - Enable Fortran 90 bindings],,enable_f90=default)
AC_ARG_ENABLE(cxx,
[--enable-cxx - Enable C++ bindings],,enable_cxx=default)
AC_ARG_ENABLE(romio,
[--enable-romio - Enable ROMIO MPI I/O implementation],
,enable_romio=yes)
dnl
AC_ARG_ENABLE(debuginfo,
[--enable-debuginfo - Enable support for debuggers],,enable_debuginfo=no)
409
410
411
412
413
414
415
416
417
418

AC_ARG_ENABLE(smpcoll,
	[--enable-smpcoll - Enable support for SMP/multi-core aware collectives],
	smpcoll=$enableval,
	smpcoll=yes)

if test $smpcoll = "yes" ; then
   AC_DEFINE(USE_SMP_COLLECTIVES,1,[define to enable SMP/multi-core aware collectives])
fi

419
420
421
422
dnl The environment variable MPICH_DEBUGLIBNAME may be used to override the
dnl default name of the library that the debugger will load to access the
dnl MPICH2 internal data structures.
dnl
423
AC_ARG_ENABLE(nmpi-as-mpi,
424
425
426
427
428
[--enable-nmpi-as-mpi - Use MPI rather than PMPI routines for MPI
                       routines, such as the collectives, that may be
                       implemented in terms of other MPI routines]
  ,,enable_nmpi_as_mpi=no)

429
430
431
432
433
434
435
436
437
438
439
dnl
dnl With options
dnl "default" is a special device that allows MPICH to choose one based on 
dnl the environment.
AC_ARG_WITH(device,
[--with-device=name - Specify the communication device for MPICH.],,
with_device=default)
dnl
AC_ARG_WITH(pmi, [--with-pmi=name - Specify the pmi interface for MPICH.],,
with_pmi=default)
dnl
440
AC_ARG_WITH(pm, 
441
442
443
444
[--with-pm=name - Specify the process manager for MPICH.  "no" or "none" are
                  valid values.  Multiple process managers may be specified as
                  long as they all use the same pmi interface by separating them
                  with colons.  The mpiexec for the first named process manager
445
446
447
                  will be installed.  Example: "--with-pm=hydra:mpd:gforker"
                  builds the three process managers hydra, mpd and gforker;
                  only the mpiexec from hydra is installed into the bin
448
                  directory.]
449
    ,,with_pm=default)
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
dnl
AC_ARG_WITH(logging,
[--with-logging=name - Specify the logging library for MPICH.],
[if test -z "$withval" ; then with_logging=rlog ; fi],
with_logging=none)
dnl 
dnl both --without-mpe and --disable-mpe are supported
dnl AC_ARG_ENABLE(mpe) is used only when --with(out)-mpe is not used.
AC_ARG_WITH(mpe,
[--with-mpe - Build the MPE (MPI Parallel Environment) routines],,
with_mpe=default)
if test "$with_mpe" = "default" ; then
    AC_ARG_ENABLE(mpe,
    [--enable-mpe - Build the MPE (MPI Parallel Environment) routines],
    with_mpe=$enableval,with_mpe=default)
fi
dnl
AC_ARG_ENABLE(threads,
[--enable-threads=level - Control the level of thread support in the 
469
470
471
472
473
474
475
                         MPICH implementation.  The following levels
                         are supported.
    default         - Choose thread level at runtime based on parameters 
                      passed to MPI_Init_thread (default)
    single          - No threads (MPI_THREAD_SINGLE)
    funneled        - Only the main thread calls MPI (MPI_THREAD_FUNNELED)
    serialized      - User serializes calls to MPI (MPI_THREAD_SERIALIZED)
476
477
478
479
    multiple(:impl) - Fully multi-threaded (MPI_THREAD_MULTIPLE). DO NOT
                      select this option. The default option is more
                      efficient and also supports thread_multiple.

480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
      The following implementations are supported.
          global_mutex - a single global lock guards access to all 
	                 MPI functions.
      The default implementation is global_mutex.

    For the ch3:sock and ch3:nemesis channels, a separate build is no
    longer needed for thread-multiple.  It is compiled by default and
    is selectable at run time with MPI_Init_thread.  If
    MPI_Init_thread is not called, the default is funneled.  For
    other channels, the --enable-threads option is not supported
    currently, and the default is funneled.]
    ,
    , 
    enable_threads=default)

495
dnl
496
AC_ARG_ENABLE(thread-cs,
497
498
499
[--enable-thread-cs=type - Choose the method used for critical
                          sections and other atomic updates when
                          multiple threads are present.  Values may
500
                          be global (default), per-object, lock-free]
501
502
 , , enable_thread_cs=global)

503
AC_ARG_ENABLE(refcount,
504
505
506
507
508
[--enable-refcount=type - Choose the method for ensuring atomic
                         updates to the reference counts for MPI
                         objects.  Values may be lock, lock-free,
                         none.  The default depends on the thread-cs
                         choice; for global it is none (because none
509
510
                         is required), for per-object it is lock, and for
                         lock-free it is lock-free]
511
512
513
514
515
516
    ,,enable_refcount=default)

AC_ARG_ENABLE(mutex-timing, [--enable-mutex-timing - calculate the time spent waiting on mutexes.],
    AC_DEFINE(MPIU_MUTEX_WAIT_TIME,1,[Define to enable timing mutexes])
 )

517
AC_ARG_ENABLE(handle-allocation,
518
519
520
521
522
523
[--enable-handle-allocation=type - Choose the method used for
                                  allocating MPI object handles.
                                  Values may be 'tls' for thread-local
                                  storage or 'mutex' for simple
                                  locking.  'mutex' is the default.]
    ,, enable_handle_allocation=default)
524

525
526
527
528
529
530
531
532
533
534
dnl 
dnl
AC_ARG_ENABLE(weak-symbols,
[--enable-weak-symbols - Use weak symbols to implement PMPI routines (default)],,
enable_weak_symbols=yes)
dnl
dnl
dnl
AC_ARG_WITH(cross,
[--with-cross=file - Specify the values of variables that configure cannot
535
536
                    determine in a cross-compilation environment]
    ,,with_cross=no)
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
dnl
AC_ARG_WITH(namepublisher,
[--with-namepublisher=name - Choose the system that will support 
                             MPI_PUBLISH_NAME and MPI_LOOKUP_NAME.  Options
                             include
                               no (no service available)
                               mpd
			       file[:directory] (optional directory)
			       ],,
with_namepublisher=default)
dnl
dnl AC_ARG_WITH(cxxlibname,
dnl [--with-cxxlibname=name  - Specify name of library containing C++ interface
dnl routines],[MPICXXLIBNAME=$withval;set_MPICXXLIBNAME="yes"],MPICXXLIBNAME=)

dnl flibname complicates the handling of MPIR_F_TRUE and MPIR_F_FALSE, 
dnl particularly when using IBM/MS-style shared libraries.  Withdraw this
dnl option and see if anyone misses it.
dnl
dnl AC_ARG_WITH(flibname,
dnl [--with-flibname=name  - Specify name of library containing Fortran interface
dnl routines],[MPIFLIBNAME=$withval;set_MPIFLIBNAME="yes"],MPIFLIBNAME=)
AC_SUBST(MPIFLIBNAME)
AC_SUBST(PMPIFLIBNAME)
dnl
dnl The default is a special wrapper library
AC_ARG_WITH(fwrapname,
564
565
566
[--with-fwrapname=name - Specify name of library containing Fortran interface
                        routines]
    ,[FWRAPNAME=$withval;set_FWRAPNAME="yes"],FWRAPNAME=fmpich)
567
AC_SUBST(FWRAPNAME)
568

569

570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
# -----------------------------------------------------------------------------
# First check that we have a clean build if we are doing a VPATH build
PAC_VPATH_CHECK(src/include/mpi.h src/env/mpicc src/env/mpicc.conf,lib)

# ----------------------------------------------------------------------------
# This test is complicated by the fact that top_srcdir is not set until
# the very end of configure.  Instead, we get it ourselves
if test -z "$top_srcdir" ; then
   use_top_srcdir=$srcdir   
else
   use_top_srcdir=$top_srcdir
fi
if test -z "$master_top_srcdir" ; then 
    # This needs to be an absolute pathname
    case "$use_top_srcdir" in
    /*) ;;
    *)
        use_top_srcdir=`(cd $use_top_srcdir && pwd)`
	;;	
    esac
    master_top_srcdir=$use_top_srcdir
fi
# Get the directory that we're running in...
if test -z "$master_top_builddir" ; then
   master_top_builddir="`pwd`"
fi
AC_SUBST(master_top_builddir)
AC_SUBST(master_top_srcdir)
export master_top_builddir
export master_top_srcdir
# ----------------------------------------------------------------------------
# We create this file to allow other configures to find the "master" 
# top builddir
rm -f .mpich2
date > .mpich2
# ----------------------------------------------------------------------------
# with-device
if test "$with_device" = "default" ; then
    # Pick the device.  For now, always choose ch3
    with_device=ch3
fi
# Extract the device name from any options
# Allow the device to specify a directory; if no directory, use the
# included directories
# 
DEVICE=$with_device
AC_SUBST(DEVICE)

device_name=`echo $with_device | sed -e 's/:.*$//'`
changequote(<<,>>)
device_args=`echo $with_device | sed -e 's/^[^:]*//' -e 's/^://'`
changequote([,])

devicedir=$use_top_srcdir/src/mpid/$device_name
devicereldir=src/mpid/$device_name
case "$device_name" in
     /*) 
     devicedir=$DEVICE
     # Get the name from the leaf
     device_name=`echo $device_name ~ sed -e 's%.*/%%'`
     # FIXME: should the devicereldir be different (perhaps not -
     # this allows use to build within our tree, even when other data
     # is outside of the tree)
     ;;
     *) 
     ;;
esac
export device_name
export device_args
export devicedir
# Make the device base name and args available to generated files
DEVICE_NAME=$device_name
AC_SUBST(DEVICE_NAME)
DEVICE_ARGS=$device_args
AC_SUBST(DEVICE_ARGS)
#
# Give the device an opportunity to include a header file in mpi.h.  The
# default value of INCLUDE_MPIDDEFS_H is set prior to the inclusion of the
# device's mpich2prereq script.  The device's script may override the value
# if needed.
INCLUDE_MPIDDEFS_H='/* ... no device specific definitions ... */'
AC_SUBST(INCLUDE_MPIDDEFS_H)

#
# See if the device wants to say something about the compilers (for example,
# the globus device may need to do this)
if test -f $devicedir/mpich2prereq ; then
    . $devicedir/mpich2prereq
fi

# ----------------------------------------------------------------------------
# Set default library names if names haven't already been provided
MPILIBNAME=${MPILIBNAME:-"mpich"}
PMPILIBNAME_set=no
if test -n "$PMPILIBNAME" ; then 
   PMPILIBNAME_set=yes
fi
PMPILIBNAME=${PMPILIBNAME:-"p$MPILIBNAME"}
# Note that the name for this library may be updated after we check for 
# enable_shmem
# Fortran names are set later.
# We use a different library for the C++ wrappers to avoid problems when
# creating shared libraries
if test -z "$MPICXXLIBNAME" ; then MPICXXLIBNAME="${MPILIBNAME}cxx" ; fi
export MPIFLIBNAME
export PMPIFLIBNAME
export MPICXXLIBNAME
AC_SUBST(MPICXXLIBNAME)

# We'll set FORTRAN_BINDING to 1 if we support Fortran 
FORTRAN_BINDING=0

682
683
684
685
686
687
688
689
690
691
692
693
694
# Set up default compiler optimization
MPI_DEFAULT_COPTS="-O2"
MPI_DEFAULT_CXXOPTS="-O2"
MPI_DEFAULT_FOPTS="-O2"
MPI_DEFAULT_F90OPTS="-O2"

# enable-fast
# strip off multiple options, separated by commas
save_IFS="$IFS"
IFS=","
for option in $enable_fast ; do
    case "$option" in
        defopt)
695
        enable_default_optimize=yes
696
        ;;
697
698
699
700
701
        nochkmsg)
        enable_fast_nochkmsg=yes
        ;;
        notiming)
        enable_timing=no
702
703
704
705
        ;;
        ndebug)
        enable_append_ndebug=yes
        ;;
706
707
708
709
710
711
712
#
# [BRT] removed the reseting of enable_g so that --with-enable=dbg,meminit
# can be specified with -enable-fast.  This change was largely made for the
# PETSc folks who want to use --enable-fast to eliminate parameter checking
# overhead, but also wish to use meminit to eliminate initialization
# warnings from valgrind.
#
713
        all|yes)
714
715
716
717
        enable_default_optimize=yes
        enable_fast_nochkmsg=yes
        # Disable timing/logging stuffs
        enable_timing=no
718
719
720
        enable_append_ndebug=yes
        ;;
        O*)
721
        # Allows O<n> where <n> can be [0-9] or ' '.
722
723
        opt_flags=`echo $option | sed -e 's%\(O[0-9] \)%\1%g'`
        if test -n "$opt_flags" ; then
724
            enable_default_optimize=yes
725
726
727
728
729
730
731
732
            MPI_DEFAULT_COPTS="-$option"
            MPI_DEFAULT_CXXOPTS="-$option"
            MPI_DEFAULT_FOPTS="-$option"
            MPI_DEFAULT_F90OPTS="-$option"
        else
            AC_MSG_WARN([Unknown value $option for --enable-fast])
        fi
        ;;
733
        none|no)
734
735
736
737
        enable_default_optimize=no
        enable_fast_nochkmsg=no
        # Reset timing/logging stuffs to when --enable-timing isn't specified.
        enable_timing=default
738
739
740
741
742
743
744
745
746
        enable_append_ndebug=no
        ;;
        *)
        AC_MSG_WARN([Unknown value $option for --enable-fast])
        ;;
    esac
done
IFS="$save_IFS"

747
748
749
# ----------------------------------------------------------------------------
# Process any enable or with values
# We must do enable-fast first, because it changes the other enable values
750
if test "$enable_fast_nochkmsg" = "yes" ; then
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
    enable_error_checking=no
    # Export a variable that will allow the test suite to detect that
    # MPICH has no error testing
    MPICH_FAST=yes
    export MPICH_FAST
fi

# error-checking
case "$enable_error_checking" in 
    no)
    # if error checking has been diabled, then automatically diable the error
    # checking tests in the test suite
    ac_configure_args="${ac_configure_args} --disable-checkerrors"
    ;;
    all|yes|runtime)
    error_checking_kind=`echo $enable_error_checking | \
    tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
    error_checking_kind=MPID_ERROR_LEVEL_$error_checking_kind
    AC_DEFINE_UNQUOTED(HAVE_ERROR_CHECKING,$error_checking_kind,[Define to enable error checking])
    ;;
    *)
    AC_MSG_WARN([Unknown value $enable_error_checking for enable-error-checking])
    ;;
esac

# error-messages
case "$enable_error_messages" in 
    no|none)
        error_message_kind="MPICH_ERROR_MSG_NONE"
    ;;
    all|yes)
	error_message_kind="MPICH_ERROR_MSG_ALL"
    ;;
    generic)
	error_message_kind="MPICH_ERROR_MSG_GENERIC"
    ;;
    class)
	error_message_kind="MPICH_ERROR_MSG_CLASS"
    ;;
    *)
    AC_MSG_WARN([Unknown value $enable_error_messages for enable-error-messages])
    ;;
esac
AC_DEFINE_UNQUOTED(MPICH_ERROR_MSG_LEVEL,$error_message_kind,[define to enable error messages])

796
# ----------------------------------------------------------------------------
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
#
# enable-timing and with-logging
#
# Still to do: add subsets: e.g., class=pt2pt,class=coll.  See mpich2 doc
#
# Logging and timing are intertwined.  If you select logging, you
# may also need to select a timing level.  If no timing is selected 
# but logging with rlog is selected, make "all" the default timing level.
#
# FIXME: make timing and logging options work more cleanly together,
# particularly when other logging options are selected (e.g., logging is not
# rlog).
# ----------------------------------------------------------------------------
collect_stats=false
logging_required=false
if test "$enable_timing" = "default" ; then
    if test "$with_logging" = "rlog" ; then
        enable_timing=all
    fi
fi
timing_name=$enable_timing
case "$enable_timing" in
    no)
    timing_name=none
    ;;
    time)
    collect_stats=true
    ;;
    log|log_detailed)
    logging_required=true
    ;;
    yes)
    timing_name=all
    collect_stats=true
    logging_required=true
    ;;
    all|runtime)
    collect_stats=true
    logging_required=true
    ;;
    none|default)
    timing_name=none
    ;;
    *)
    AC_MSG_WARN([Unknown value $enable_timing for enable-timing])
    enable_timing=no
    timing_name=none
    ;; 
esac
#
# The default logging package is rlog; you can get it by 
# specifying --with-logging or --with-logging=rlog
#
case $with_logging in 
    yes)
    logging_name=rlog
    ;;
    no|none)
    logging_name=none
    ;;
    default)
    if test "$logging_required" = "true" ; then
        logging_name=rlog
    else
        logging_name=none
    fi
    ;;
    *)
    logging_name=$with_logging
    ;;
esac
# 
# Include the selected logging subsystem
#
# Choices:
# 1) A subdir of src/util/logging
#     This directory must contain a configure which will be executed
#     to build the 
# 2) An external directory
#     This directory must contain 
#          a mpilogging.h file
#     It may contain 
#          a setup_logging script
#          a configure
#     
#   
logging_subsystems=
if test "$logging_name" != "none" ; then
    # Check for an external name (directory containing a /)
    hasSlash=`echo A$logging_name | sed -e 's%[[^/]]%%g'`
    if test -n "$hasSlash" ; then
        # Check that the external logging system is complete.
	# Any failure will cause configure to abort
        if test ! -d $logging_name ; then
	    AC_MSG_ERROR([External logging directory $logging_name not found.  Configure aborted])
	    logging_name=none
        elif test ! -s $logging_name/mpilogging.h ; then
	    AC_MSG_ERROR([External logging header $logging_name/mpilogging.h not found.  Configure aborted])
	    logging_name=none
        fi

        logdir=$logging_name
	# Force the logdir to be absolute
	logdir=`cd $logdir && pwd`
	# Switch name to "external" because that is how the MPICH2
	# code will know it
	logging_name=external
	# Add the dir to the include paths
	#CPPFLAGS="$CPPFLAGS -I$logdir"
	MPICH2_INCLUDE_FLAGS="$MPICH2_INCLUDE_FLAGS -I$logdir"
	EXTERNAL_SRC_DIRS="$EXTERNAL_SRC_DIRS $logdir"
	# Add to the list of external modules to setup
	if test -x $logdir/setup_logging ; then
	     EXTERNAL_SETUPS="$EXTERNAL_SETUPS $logdir/setup_logging"
	fi
    else
        logdir=$srcdir/src/util/logging
914
915
        logreldir=src/util/logging/$logging_name
        logging_subsystems="$logging_subsystems $logreldir"
916
917
918
919
920
921
922
923
924
925
926
927
        logging_subdirs=$logging_name
        for dir in $logging_subdirs ; do
            if test ! -d $logdir/$dir ; then
	        AC_MSG_ERROR([$logdir/$dir does not exist.  Configure aborted])
	        logging_name=none
            fi
        done
        for dir in $logging_subsystems ; do
            if test ! -x $srcdir/$dir/configure ; then
	        AC_MSG_ERROR([$logdir/$dir has no configure (required).  Configure aborted])
	        logging_name=none
            fi
928
            other_install_dirs="${other_install_dirs} $logreldir"
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
        done
    fi
fi
#
# FIXME: Logging doesn't necessarily require timing (e.g., simply logging the 
# sequence of routines).  
if test "$logging_name" != "none" ; then
    if test "$enable_timing" != "no" ; then
	if test "$enable_timing" = "default" -o "$enable_timing" = "none" ; then
	    enable_timing=log
	    timing_name=log
    	fi
	logging_dir=logging
	subsystems="$subsystems $logging_subsystems"
    else
	AC_MSG_WARN([Timing was disabled.  Logging has been disabled as well.])
	with_logging=no
	logging_name=none
        logging_dir=
        logging_subdirs=
    fi
else
    if test "$logging_required" = "true" ; then
	AC_MSG_WARN([Timing was enabled with log option but no logging library is available.  Timing has been disabled.])
	enable_timing=no
	timing_name=none
    fi
    logging_dir=
    logging_subdirs=
fi
if test "$timing_name" != "none" ; then
    timing_kind=`echo $timing_name | \
       tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
    timing_kind=MPID_TIMING_KIND_$timing_kind
    AC_DEFINE_UNQUOTED(HAVE_TIMING,$timing_kind,[define to enable timing collection])
    if test "$collect_stats" = "true" ; then
        AC_DEFINE(COLLECT_STATS,1,[define to enable collection of statistics])
    fi
fi
#
AC_SUBST(logging_dir)
AC_SUBST(logging_name)
AC_SUBST(logging_subdirs)
use_logging_variable="MPID_LOGGING_`echo $logging_name | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`"
AC_DEFINE_UNQUOTED(USE_LOGGING,$use_logging_variable,[define to choose logging library])
# ----------------------------------------------------------------------------
# End of logging tests
# ----------------------------------------------------------------------------

# ----------------------------------------------------------------------------
# Check to see if the device does not support spawn.  
# FIXME: This should provide the option of not building the dynamic
# process routines.  It could also allow us to specialize support
# for all processes are members of MPI_COMM_WORLD (only one comm_world).
# ----------------------------------------------------------------------------
if test "$MPID_NO_SPAWN" = yes ; then
    AC_MSG_WARN([The device $with_device does not support MPI dynamic process routines])   
fi

988
989
# MPL
PAC_CONFIG_SUBDIR(src/mpl, $use_top_srcdir, $ac_configure_args,,AC_ERROR(MPL configure failed))
990
PAC_PREPEND_FLAG([-lmpl], [WRAPPER_LIBS])
991
992
PAC_APPEND_FLAG([-I${master_top_builddir}/src/mpl/include], [CPPFLAGS])
PAC_APPEND_FLAG([-I${use_top_srcdir}/src/mpl/include], [CPPFLAGS])
993
994
EXTERNAL_SRC_DIRS="$EXTERNAL_SRC_DIRS src/mpl"
other_install_dirs="$other_install_dirs src/mpl"
995

996
# Atomic locks
997
# FIXME TODO eventually delete the src/mpid/common/locks directory
998
subsystems="$subsystems src/mpid/common/locks"
999

1000
# OpenPA
For faster browsing, not all history is shown. View entire blame