configure.ac 228 KB
Newer Older
1
AC_PREREQ(2.63)
2
3
4
5
6
7
8
9
10
11
12
# 
# (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 
13
dnl the other modules that can be used to construct MPICH, such as
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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,
Pavan Balaji's avatar
Pavan Balaji committed
28
dnl for example, --with-pm=hydra or --with-device=ch3:nemesis).
29
dnl For each module, source the file mpichprereq if present (in the
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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    MPID_MAX_PROCESSOR_NAME - The maximum number of character in a processor
dnl                            name.  If not set, 128 will be used.
51
52
dnl    MPID_MAX_ERROR_STRING - The maximum number of character in an error
dnl                            string.  If not set, 1024 will be used.
53
54
55
56
dnl    MPID_LIBTOOL_STATIC_FLAG - The static compilation flag to use
dnl                               for the example executables within
dnl                               mpich.  If not set, -static will be
dnl                               used.
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
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
101
dnl know that they are being invoked from within the MPICH configure,
102
dnl the following environment variables are set and exported:
103
104
105
106
dnl    FROM_MPICH
dnl    MPICH_ENABLE_F77
dnl    MPICH_ENABLE_FC
dnl    MPICH_ENABLE_CXX
107
108
109
dnl
dnl Note that no executable statements are allowed (and any are silently 
dnl dropped) before AC_INIT.
110

111
112
m4_include([maint/version.m4])
dnl 2nd arg is intentionally underquoted
113
114
AC_INIT([MPICH],
        MPICH_VERSION_m4,
Jeff Hammond's avatar
Jeff Hammond committed
115
        [discuss@mpich.org],
116
        [mpich],
117
        [http://www.mpich.org/])
118

119
120
121
122
123
124
125
if test "x$prefix" != "xNONE" && test -d "$prefix"; then 
    if test "x`(cd \"$prefix\"; echo \"$PWD\")`" = "x`(cd \"$srcdir\"; echo \"$PWD\")`" ||\
       test "x`(cd \"$prefix\"; echo \"$PWD\")`" = "x$PWD"  ; then
        AC_MSG_ERROR([The install directory (--prefix=) cannot be the same as the build or src directory.])
    fi
fi         

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

129
# these values come from the m4_include above
130
131
132
133
MPICH_VERSION=MPICH_VERSION_m4
AC_SUBST([MPICH_VERSION])
MPICH_RELEASE_DATE="MPICH_RELEASE_DATE_m4"
AC_SUBST([MPICH_RELEASE_DATE])
Pavan Balaji's avatar
Pavan Balaji committed
134
135
libmpi_so_version="libmpi_so_version_m4"
AC_SUBST([libmpi_so_version])
136
137


138
139
if test -z "$MPICH_VERSION" ; then
    AC_MSG_ERROR([MPICH_VERSION is empty, check maint/version.m4 for errors])
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
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,
158
# 2 digits for REV, 1 digit for EXT and 2 digits for EXT_NUMBER.
159
changequote(<<,>>)
160
161
162
163
164
V1=`expr $MPICH_VERSION : '\([0-9]*\)\.[0-9]*\.*[0-9]*[a-zA-Z]*[0-9]*'`
V2=`expr $MPICH_VERSION : '[0-9]*\.\([0-9]*\)\.*[0-9]*[a-zA-Z]*[0-9]*'`
V3=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*\([0-9]*\)[a-zA-Z]*[0-9]*'`
V4=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*\([a-zA-Z]*\)[0-9]*'`
V5=`expr $MPICH_VERSION : '[0-9]*\.[0-9]*\.*[0-9]*[a-zA-Z]*\([0-9]*\)'`
165
changequote([,])
166

167
if test "$V2" -le 9 ; then V2=0$V2 ; fi
168
if test "$V3" = "" ; then V3=0; fi
169
if test "$V3" -le 9 ; then V3=0$V3 ; fi
170
171
172
173
174
175
176
177
178
179
180
181
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
182
if test "$V5" -le 9 ; then V5=0$V5 ; fi
183

184
185
MPICH_NUMVERSION=`expr $V1$V2$V3$V4$V5 + 0`
AC_SUBST(MPICH_NUMVERSION)
186

187
# ABIVERSION is the name used by simplemake, so we reassign the
Pavan Balaji's avatar
Pavan Balaji committed
188
189
# libmpi_so_version number to it
ABIVERSION=${libmpi_so_version}
190
export ABIVERSION
Pavan Balaji's avatar
Pavan Balaji committed
191
export libmpi_so_version
192
AC_SUBST(ABIVERSION)
193

194
# Print out the configure options
195
196
197
CONFIGURE_ARGUMENTS="$ac_configure_args"
AC_SUBST(CONFIGURE_ARGUMENTS)
if test -n "$ac_configure_args" ; then
198
    echo "Configuring MPICH version $MPICH_VERSION with $ac_configure_args"
199
else 
200
    echo "Configuring MPICH version $MPICH_VERSION"
201
fi
202

203
204
# Add the information on the system:
echo "Running on system: `uname -a`"
205

206
207
208
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 ; -*- */
209
/*
210
211
212
213
214
215
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */
#ifndef MPICHCONF_H_INCLUDED
#define MPICHCONF_H_INCLUDED
])
216
217
218
219
220

# We use an #include strategy here because all of the alternative strategies for
# quashing these variables have various drawbacks.  The alternatives are listed
# here to avoid rediscovery of these problems by someone else in the future:
#
221
# 1) Strategy: Rewrite mpichconf.h.in with sed at autogen.sh time.
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#    Problem: Automatic remaking of config.status and friends will re-run
#             autoheader and blow away our sed changes without an opportunity to
#             patch the resulting file again.
# 2) Strategy: Add literal "#undef PACKAGE" lines to the AH_BOTTOM text.
#    Problem: These lines get rewritten by config.status to be "#define" lines,
#             so the intended quashing never actually occurs.
# 3) Strategy: Use AC_CONFIG_COMMANDS to run a sed rewrite command on
#              mpichconf.h at config.status time.
#    Problem: Causes mpichconf.h to always be rewritten, first by the normal
#             config.status commands and then by sed.  This can cause
#             unnecessary remaking of object files since nearly every C source
#             file includes this header (see the Autoconf Manual, "Automatic
#             Remaking")
#
# The only other plausible strategy would seem to be rewriting config.status
# itself via AC_CONFIG_COMMANDS_POST, but that seems error prone.  The best
# solution would be to stop all subconfigures from including config.h headers
# from other packages.  Then all of this nonsense can be eliminated.
# [goodell@ 2011-08-26]
AH_BOTTOM([
/* Include nopackage.h to undef autoconf-defined macros that cause conflicts in
 * subpackages.  This should not be necessary, but some packages are too
244
 * tightly intertwined right now (such as ROMIO and the MPICH core) */
245
246
247
248
#include "nopackage.h"

#endif /* !defined(MPICHCONF_H_INCLUDED) */
])
249
250
251
252

dnl Set the directory that contains support scripts such as install-sh and
dnl config.guess
AC_CONFIG_AUX_DIR(confdb)
253
254
dnl our macro dir is the same as our aux dir
AC_CONFIG_MACRO_DIR([confdb])
255

256
257
258
259
# Set the FROM_MPICH variable to tell subconfigures that they are
# built from within MPICH
FROM_MPICH=yes
export FROM_MPICH
260

261
262
263
# Save a copy of precious flags as USER_* before any of these flags
# are being modified by configure tests.
PAC_PREFIX_ALL_FLAGS(USER)
264
265

# WRAPPER_xFLAGS are used by mpicc and friends.
266
267
#
# WRAPPER_CFLAGS and other compile flags are used for compile options
268
# that are added by MPICH, but should be used by applications (such
269
270
# as include paths).
#
271
# All libraries that are detected by MPICH as needed for some of its
272
# functionality (such as -lpthread) should be added to LIBS so
273
# autoconf link tests can use them. Libraries that are built by MPICH
274
# at make time (and hence are not available for autoconf link tests to
275
# use), such as OPA and MPL, should be added to WRAPPER_LIBS for
276
277
278
# static builds. All libraries in LIBS are added to WRAPPER_LIBS
# (similarly LDFLAGS are added to WRAPPER_LDFLAGS) as well, at the end
# of configure.
279
PAC_PREFIX_ALL_FLAGS(WRAPPER)
280
281
282
283
284
285
286
WRAPPER_CFLAGS="$CFLAGS $MPICH_MPICC_FLAGS"
WRAPPER_CPPFLAGS="$CPPFLAGS $MPICH_MPICPP_FLAGS"
WRAPPER_CXXFLAGS="$CXXFLAGS $MPICH_MPICXX_FLAGS"
WRAPPER_FFLAGS="$FFLAGS $MPICH_MPIF77_FLAGS"
WRAPPER_FCFLAGS="$FCFLAGS $MPICH_MPIFC_FLAGS"
WRAPPER_LDFLAGS="$MPICH_LDFLAGS"
WRAPPER_LIBS="$MPICH_LIBS"
287
288
289
EXTERNAL_LIBS=""
export EXTERNAL_LIBS
AC_SUBST(EXTERNAL_LIBS)
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312

# Add MPICHLIB_* to the appropriate flags
AC_ARG_VAR(MPICHLIB_CFLAGS,
	[extra CFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_CPPFLAGS,
	[extra CPPFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_CXXFLAGS,
	[extra CXXFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_FFLAGS,
	[extra FFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_FCFLAGS,
	[extra FCFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_LDFLAGS,
	[extra LDFLAGS used in building MPICH libraries])
AC_ARG_VAR(MPICHLIB_LIBS,
	[extra LIBS used in building MPICH libraries])
CFLAGS="$CFLAGS $MPICHLIB_CFLAGS"
CPPFLAGS="$CPPFLAGS $MPICHLIB_CPPFLAGS"
CXXFLAGS="$CXXFLAGS $MPICHLIB_CXXFLAGS"
FFLAGS="$FFLAGS $MPICHLIB_FFLAGS"
FCFLAGS="$FCFLAGS $MPICHLIB_FCFLAGS"
LDFLAGS="$LDFLAGS $MPICHLIB_LDFLAGS"
LIBS="$LIBS $MPICHLIB_LIBS"
313

314
315
316
317
318
319
320
dnl include all subsystem m4 fragments now that the core autoconf functionality
dnl has been setup.  No fragment should do anything except define
dnl PAC_SUBCFG_{PREREQ,BODY} macros which will be expanded later as
dnl appropriate
# begin subsys includes
m4_include([subsys_include.m4])
# end subsys includes
321

322
323
dnl ----------------------------------------------------------------------------
dnl setup top-level argument handling
324
AC_ARG_ENABLE(echo, 
325
326
327
	AC_HELP_STRING([--enable-echo], [Turn on strong echoing. The default is enable=no.]),
	set -x)

328
AC_ARG_ENABLE(error-checking,
329
330
331
332
333
[  --enable-error-checking=level
      Control the amount of error checking.  
        no        - no error checking
        runtime   - error checking controllable at runtime through environment 
                    variables
334
335
        all       - error checking always enabled (default)
],,enable_error_checking=default)
336

337
AC_ARG_ENABLE(error-messages,
338
339
340
341
342
343
344
345
[  --enable-error-messages=level - Control the amount of detail in error messages.
        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)

346
AC_ARG_ENABLE(timing,
347
348
349
350
351
352
353
[  --enable-timing=level - Control the amount of timing information
                           collected by the MPICH implementation.
        none    - Collect no data (default)
        all     - Collect lots of data
        runtime - Runtime control of data collected
],,enable_timing=default)

354
AC_ARG_ENABLE(g,
355
[  --enable-g=option - Control the level of debugging support in the
356
357
                       MPICH implementation.  "option" is a list of comma
                       separated names including.  Default is "most".
358
359
360
361
        none     - No debugging
        handle   - Trace handle operations
        handlealloc - Trace handle allocations
        dbg      - Add compiler flag, -g, to all internal
362
363
                   compiler flags, i.e. MPICHLIB_CFLAGS, MPICHLIB_CXXFLAGS,
                   MPICHLIB_FFLAGS, and MPICHLIB_FCFLAGS.
364
365
366
367
368
369
370
371
        debug    - Synonym for dbg
        log      - Enable debug event logging
        mem      - Memory usage tracing
        meminit  - Preinitialize memory associated structures and unions to
                   eliminate access warnings from programs like valgrind
        memarena - Check for overwrite errors in memory allocation arena
        mutex    - Enable error checking on pthread mutexes
        mutexnesting - Check for non-nesting of mutexes
372
373
374
        most     - Most of the above options, excluding some with severe
                   performance impacts.  Recommended for typical development.
        yes      - synonym for "most" (*not* "all")
375
376
377
        all      - All of the above choices
],,enable_g=none)

378
AC_ARG_ENABLE([mpit_pvars],
379
380
[  --enable-mpit-pvars=list - Selectively enable MPI_T performance variables in
                      modules. list is a comma-separated module names,
381
                      including (Default is "none"):
382
383
384
        none     - No performance info recorded
        recvq    - All message queue-related
        nem      - All nemesis-related
385
        rma      - All rma-related
386
        all      - All variables above
387
],[],[enable_mpit_pvars=none])
388

389
390
391
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,
392
393
394
	AC_HELP_STRING([--with-aint-size], [Override the size of MPI_AINT (in bytes)]),,
	with_aint_size=0)

395
AC_ARG_ENABLE(fast,
396
397
398
399
[  --enable-fast=option - Control the level of fast execution in the
                         MPICH implementation.  option is a list of
                         comma separated names including
        O<n>     - Appends default optimization flags, -O<n>, to all internal
400
                   compiler flags, i.e. MPICHLIB_CFLAGS, MPICHLIB_CXXFLAGS,
Pavan Balaji's avatar
Pavan Balaji committed
401
                   MPICHLIB_FFLAGS, and MPICHLIB_FCFLAGS. (default is -O2)
402
        ndebug   - Appends -DNDEBUG to MPICHLIB_CFLAGS.
Pavan Balaji's avatar
Pavan Balaji committed
403
404
405
        all|yes  - "O2" and "ndebug" are enabled
        none     - None of above options, i.e. --disable-fast
],,enable_fast=O2)
406

Pavan Balaji's avatar
Pavan Balaji committed
407
408
409
AC_ARG_ENABLE(interlib-deps,
	[AC_HELP_STRING([--interlib-deps - Enable interlibrary dependencies])],,enable_interlib_deps=yes)

410
AC_ARG_ENABLE(check-compiler-flags,
411
	AC_HELP_STRING([--enable-check-compiler-flags], [enable the checks for all compiler
412
                       options, xxxFLAGS, MPICH_xxxFLAGS. Default is on.]),,
413
		       enable_check_compiler_flags=yes)
414

415
416
dnl We enable f77 and fc if we can find compilers for them.
dnl In addition, we check whether f77 and fc can work together.
417
418
AC_ARG_ENABLE(fortran,
[  --enable-fortran=option - Control the level of Fortran support in the MPICH implementation.
Pavan Balaji's avatar
Pavan Balaji committed
419
	yes|all   - Enable all available Fortran implementations (F77, F90+)
420
	f77       - Enable Fortran 77 support
Pavan Balaji's avatar
Pavan Balaji committed
421
	fc        - Enable Fortran 90 and 2008 support
422
	no|none   - No Fortran support
Pavan Balaji's avatar
Pavan Balaji committed
423
],,[enable_fortran=all])
424

425
426
AC_ARG_ENABLE(f77,
	AC_HELP_STRING([--enable-f77],
427
		[DEPRECATED: Use --enable-fortran or --disable-fortran instead]),,[enable_f77=yes])
428

429
430
AC_ARG_ENABLE(fc,
	AC_HELP_STRING([--enable-fc],
431
		[DEPRECATED: Use --enable-fortran or --disable-fortran instead]),,[enable_fc=yes])
432

433
AC_ARG_ENABLE(cxx,
434
	AC_HELP_STRING([--enable-cxx], [Enable C++ bindings]),,enable_cxx=yes)
435

436
AC_ARG_ENABLE(romio,
437
438
439
	AC_HELP_STRING([--enable-romio], [Enable ROMIO MPI I/O implementation]),,
	enable_romio=yes)

440
AC_ARG_ENABLE(debuginfo,
441
442
	AC_HELP_STRING([--enable-debuginfo], [Enable support for debuggers]),,
	enable_debuginfo=no)
443

444
445
446
447
448
449
450
451
452
453
454
455
456
457
458

## Enable creation of libtool-style versioning or no versioning
AC_ARG_ENABLE(versioning,
        [AC_HELP_STRING([--enable-versioning],[Enable library versioning])],,
        [enable_versioning=yes])

if test "$enable_versioning" = "yes" ; then
   ABIVERSIONFLAGS="-version-info \$(ABIVERSION)"
else
   ABIVERSIONFLAGS="-avoid-version"
fi
export ABIVERSIONFLAGS
AC_SUBST(ABIVERSIONFLAGS)


459
460
dnl The environment variable MPICH_DEBUGLIBNAME may be used to
dnl override the default name of the library that the debugger will
461
dnl load to access the MPICH internal data structures.
462

463
464
dnl "default" is a special device that allows MPICH to choose one
dnl based on the environment.
465
AC_ARG_WITH(device,
466
467
468
469
470
471
472
	AC_HELP_STRING([--with-device=name], [Specify the communication device for MPICH]),,
	with_device=default)

AC_ARG_WITH(pmi,
	AC_HELP_STRING([--with-pmi=name], [Specify the pmi interface for MPICH]),,
	with_pmi=default)

473
AC_ARG_WITH(pm, 
474
475
476
477
478
	AC_HELP_STRING([--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
Pavan Balaji's avatar
Pavan Balaji committed
479
480
                 will be installed.  Example: "--with-pm=hydra:gforker"
                 builds the two process managers hydra, and gforker;
481
482
483
                 only the mpiexec from hydra is installed into the bin
                 directory.]),,with_pm=default)

484
AC_ARG_WITH(logging,
485
486
487
	AC_HELP_STRING([--with-logging=name], [Specify the logging library for MPICH]),
	[if test -z "$withval" ; then with_logging=rlog ; fi],with_logging=none)

488
AC_ARG_ENABLE(threads,
489
490
491
492
493
494
[  --enable-threads=level - Control the level of thread support in the 
                           MPICH implementation.  The following levels
                           are supported.
        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)
495
496
        multiple        - Fully multi-threaded (MPI_THREAD_MULTIPLE)
        runtime         - Alias to "multiple"
497
498
499
500

        See also the --enable-thread-cs option for controlling the granularity of
        the concurrency inside of the library
],,enable_threads=default)
501

502
AC_ARG_ENABLE(thread-cs,
503
504
505
506
507
	AC_HELP_STRING([--enable-thread-cs=type],
			[Choose the method used for critical sections
                         and other atomic updates when multiple
                         threads are present.  Values may be global
                         (default), per-object, lock-free]),,enable_thread_cs=global)
508

509
AC_ARG_ENABLE(refcount,
510
511
512
513
514
515
516
517
518
519
520
521
	AC_HELP_STRING([--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 is required),
                         for per-object it is lock, and for lock-free
                         it is lock-free]),,enable_refcount=default)

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

523
AC_ARG_ENABLE(handle-allocation,
524
525
526
527
528
	AC_HELP_STRING([--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)
529

530
AC_ARG_ENABLE([predefined-refcount],
531
532
533
534
	AS_HELP_STRING([--enable-predefined-refcount],
                       [control whether predefined objects like
		       MPI_COMM_WORLD are reference counted (default
		       depends on --enable-thread-cs choice)]),[],
535
536
              [enable_predefined_refcount=default])

537
AC_ARG_ENABLE(weak-symbols,
538
539
540
541
	AC_HELP_STRING([--enable-weak-symbols],
			[Use weak symbols to implement PMPI routines (default)]),,
		enable_weak_symbols=yes)

542
543
544
AC_ARG_ENABLE([two-level-namespace],
              [AS_HELP_STRING([--enable-two-level-namespace],
                              [(Darwin only) Build shared libraries and programs
545
                               built with the mpicc/mpifort/etc. compiler
546
547
                               wrappers with '-Wl,-commons,use_dylibs' and
                               without '-Wl,-flat_namespace'.  This may make the
548
                               MPICH installation and MPI programs more
549
550
551
552
553
554
                               compatible with other libraries.  Only enable
                               this option if you really know what these linker
                               options imply.])],
              [],
              [enable_two_level_namespace=no])

Anthony Chan's avatar
Anthony Chan committed
555
AC_ARG_ENABLE(multi-aliases,
556
557
558
559
	AC_HELP_STRING([--enable-multi-aliases],
		[Multiple aliasing to support multiple fortran compilers (default)]),,
		enable_multi_aliases=yes)

560
561
562
563
564
565
566
567
568
569
570
571
AC_ARG_ENABLE([wrapper-rpath],
              [AC_HELP_STRING([--enable-wrapper-rpath],
                              [Determine whether the rpath is set when programs
                               are linked by mpicc compiler wrappers.  This only
                               applies when shared libraries are built.  The
                               default is yes; use --disable-wrapper-rpath to
                               turn this feature off.  In that case, shared
                               libraries will be found according to the rules
                               for your system (e.g., in LD_LIBRARY_PATH)])],
              [],[enable_wrapper_rpath=yes])
AC_SUBST([enable_wrapper_rpath])

572
573
574
575
576
577
578
579
580
581
AC_ARG_ENABLE([long-double],
              [AC_HELP_STRING([--disable-long-double],
                              [Pass --disable-long-double to prevent the MPI
                               library from supporting the C "long double" type,
                               even if the C compiler supports it.  "long
                               double" support is enabled by default, provided
                               the compiler supports it.])],
              [],
              [enable_long_double=yes])

582
AC_ARG_WITH(cross,
583
584
	AC_HELP_STRING([--with-cross=file],
		[Specify the values of variables that configure cannot
585
586
587
588
589
590
                 determine in a cross-compilation environment]),,
		 with_cross=$MPID_DEFAULT_CROSS_FILE)
if test -z "$with_cross" ; then with_cross=no ; fi
if test "$with_cross" != "no"; then
  AC_MSG_NOTICE([Using cross file: $with_cross])
fi
591

592
AC_ARG_WITH(namepublisher,
593
594
595
[  --with-namepublisher=name   Choose the system that will support 
                              MPI_PUBLISH_NAME and MPI_LOOKUP_NAME.  Options
                              include
596
                                   pmi (default)
597
			           file[:directory] (optional directory)
598
                                   no (no service available)],,with_namepublisher=default)
599
600
601
AC_ARG_WITH(name-publisher,
    [],
    with_namepublisher=$with_name_publisher,)
602

603
604
605
606
# Find a C compiler.
# We also need to do this before the F77 and FC test to ensure that we
# find the C preprocessor reliably.
PAC_PROG_CC
607
AM_PROG_CC_C_O dnl needed for automake "silent-rules"
608
609
610
611
612
613
614
615
616
617
618
619
620
PAC_PUSH_FLAG([CFLAGS])
AC_PROG_CPP
# Bug in autoconf.  Restore cross settings
if test "$pac_cross_compiling" = "yes" -a "$ac_cv_prog_cc_cross" = "no" ; then
    AC_MSG_RESULT([Resetting cross compilation to yes])
    cross_compiling=yes
    ac_cv_prog_cc_cross=yes
    ac_cv_prog_f77_cross=yes
    ac_cv_prog_fc_cross=yes
    ac_cv_prog_cxx_cross=yes
fi
PAC_POP_FLAG([CFLAGS])

621
dnl now that autoconf and core compilers are setup, init automake and libtool
622
623
624
625
626
dnl
dnl We would like to pass -Werror, but we are cheating in the "examples/"
dnl directory and overriding the user-flags like CFLAGS, which automake-1.12
dnl warns about.  Long-term we may need to use a hand-written Makefile.in or
dnl something else in this special dir.
627
AM_INIT_AUTOMAKE([-Wall -Wno-portability-recursive foreign 1.12.3 silent-rules subdir-objects])
628
AM_MAINTAINER_MODE([enable])
629

630
AM_PROG_AR
631

632
LT_INIT()
633
634
635
# Non-verbose make by default
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

636
637
638
639
640
641
# Disable rpath in the compiler wrappers if shared libraries are disabled, since
# rpath makes no sense in the context of static libraries.
if test "X$enable_shared" = "Xno" ; then
    enable_wrapper_rpath=no
fi

Pavan Balaji's avatar
Pavan Balaji committed
642
643
644
645
646
647
648
649
650
INTERLIB_DEPS=yes
# We conservatively disable interlibrary dependencies if the libtool
# support model is anything different from "pass_all"
if test "X$enable_shared" = "Xno" -o "$deplibs_check_method" != "pass_all" -o "$enable_interlib_deps" = "no" ; then
    INTERLIB_DEPS=no
fi
export INTERLIB_DEPS
AC_SUBST(INTERLIB_DEPS)

651
dnl AC_PROG_{CXX,F77,FC} must come early in configure.ac in order to avoid some
652
653
654
655
656
657
dnl esoteric autoconf macro expansion errors
dnl
dnl Also, DO NOT attempt to place shell conditionals (either manually or via
dnl AS_IF) around these macros in an effort to save configure time.  It will
dnl lead to weird AM_CONDITIONAL errors and potentially other problems.

658
# Before attempting to find valid compilers, set the corresponding precious
659
660
661
662
663
664
665
# shell variable to "no" for any languages that have been disabled by the user
# with "--disable-LANG".  Libtool understands this as a request to disable
# support for this language. This should save a bit of configure time and also
# prevent user complaints like ticket #1570.
AS_IF([test "x$enable_f77" = "xno"],[F77=no])
AS_IF([test "x$enable_fc"  = "xno"],[FC=no])
AS_IF([test "x$enable_cxx" = "xno"],[CXX=no])
666

667
668
669
670
671
672
673
674
# suppress default "-g -O2" from AC_PROG_CXX
: ${CXXFLAGS=""}
AC_PROG_CXX([PAC_CXX_SEARCH_LIST])

# suppress default "-g -O2" from AC_PROG_FC
: ${FCFLAGS=""}
AC_PROG_FC([PAC_FC_SEARCH_LIST])

675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
save_IFS="$IFS"
IFS=","
enable_f77=no
enable_fc=no
for option in $enable_fortran ; do
    case "$option" in
        yes|all)
		enable_f77=yes
		enable_fc=yes
		;;
        no|none)
		;;
        f77)
		enable_f77=yes
		;;
Pavan Balaji's avatar
Pavan Balaji committed
690
        fc)
691
692
693
694
695
696
697
698
699
700
701
702
		enable_fc=yes
		;;
        *)
		IFS="$save_IFS"
		AC_MSG_WARN([Unknown value $option for --enable-fortran])
		IFS=","
		;;
    esac
done
IFS="$save_IFS"

if test "$enable_f77" = "no" ; then
Pavan Balaji's avatar
Pavan Balaji committed
703
   if test "$enable_fc" = "yes" ; then
704
705
706
707
708
709
710
711
712
713
714
715
      AC_MSG_ERROR([Fortran 90 support requires enabling Fortran 77])
   fi
fi

if test ! -z "$FC" -a -z "$F77" ; then
   F77=$FC
   if test ! -z "$FCFLAGS" -a -z "$FFLAGS" ; then
      FFLAGS=$FCFLAGS
   fi
fi

AM_CONDITIONAL([INSTALL_MPIF77],[test "$F77" != "$FC" -a "$FFLAGS" != "$FCFLAGS"])
716

717
718
719
720
721
722
723
# This needs to come after we've potentially set F77=$FC. Otherwise, we could
# override the user's Fortran compiler selection when only specifying FC at configure
# time, as is allowed.
# suppress default "-g -O2" from AC_PROG_F77
: ${FFLAGS=""}
AC_PROG_F77([PAC_F77_SEARCH_LIST])

724
725
726
# compute canonical system types
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
727
# TARGET not needed, MPICH isn't a compiler
728
729
730
731
732
733
734
735

# Enable better caching control
PAC_ARG_CACHING

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

736
737
# -----------------------------------------------------------------------------
# First check that we have a clean build if we are doing a VPATH build
738
PAC_VPATH_CHECK(src/include/mpi.h src/env/mpicc,lib)
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765

# ----------------------------------------------------------------------------
# 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
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
796
# ----------------------------------------------------------------------------
dnl Export important "precious" variables so that any directories configured via
dnl PAC_CONFIG_SUBDIR will agree with the top-level configure about these
dnl critical variables (esp. compiler selection).  These exports should come
dnl before any subconfigures in this script.
dnl
dnl This list is arguably incomplete, and should possibly be automatically
dnl generated from "$ac_precious_vars" using code similar to the implementation
dnl of PAC_CONFIG_SUBDIR.
dnl
dnl To be clear, without these exports any variable values determined by this
dnl configure script will not be seen by child scripts.  Instead they will dnl
dnl receive the only the original inherited environment and configure args used
dnl when this configure script was invoked.
export AR
export AR_FLAGS
export CC
export CFLAGS
export CPPFLAGS
export CXX
export CXXFLAGS
export F77
export FC
export FCFLAGS
export FFLAGS
export LDFLAGS
export LIBS
export MPILIBNAME
export PMPILIBNAME
export RANLIB
797
export OPALIBNAME
798
export MPLLIBNAME
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
# ----------------------------------------------------------------------------
# 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

835
# See if the device wants to say something about the compilers
836
837
if test -f $devicedir/mpichprereq ; then
    . $devicedir/mpichprereq
838
839
fi

840
841
842
# expand all of the prereq macros in the correct order
m4_map([PAC_SUBCFG_DO_PREREQ], [PAC_SUBCFG_MODULE_LIST])

843
844
# ----------------------------------------------------------------------------
# Set default library names if names haven't already been provided
Pavan Balaji's avatar
Pavan Balaji committed
845
AC_ARG_VAR([MPILIBNAME],[can be used to override the name of the MPI library (default: "mpi")])
846
847
AC_ARG_VAR([PMPILIBNAME],[can be used to override the name of the MPI profiling library (default: "p$MPILIBNAME")])
AC_ARG_VAR([MPICXXLIBNAME],[can be used to override the name of the MPI C++ library (default: "${MPILIBNAME}cxx")])
848
AC_ARG_VAR([MPIFCLIBNAME],[can be used to override the name of the MPI fortran library (default: "${MPILIBNAME}fort")])
Pavan Balaji's avatar
Pavan Balaji committed
849
MPILIBNAME=${MPILIBNAME:-"mpi"}
850
851
852
853
854
855
856
857
858
859
860
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
Pavan Balaji's avatar
Pavan Balaji committed
861
if test -z "$MPIFCLIBNAME" ; then MPIFCLIBNAME="${MPILIBNAME}fort" ; fi
862
export MPICXXLIBNAME
Pavan Balaji's avatar
Pavan Balaji committed
863
export MPIFCLIBNAME
864
AC_SUBST(MPICXXLIBNAME)
Pavan Balaji's avatar
Pavan Balaji committed
865
AC_SUBST(MPIFCLIBNAME)
866
867
868
869

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

870
871
872
873
874
875
# enable-fast
# strip off multiple options, separated by commas
save_IFS="$IFS"
IFS=","
for option in $enable_fast ; do
    case "$option" in
Pavan Balaji's avatar
Pavan Balaji committed
876
877
        O*)
        enable_fast_opts=$option
878
879
        ;;
        ndebug)
Pavan Balaji's avatar
Pavan Balaji committed
880
        enable_fast_ndebug=yes
881
        ;;
882
        all|yes)
Pavan Balaji's avatar
Pavan Balaji committed
883
884
        enable_fast_ndebug=yes
        enable_fast_opts=O2
885
        ;;
886
        none|no)
Pavan Balaji's avatar
Pavan Balaji committed
887
888
        enable_fast_ndebug=no
        enable_fast_opts=O0
889
890
        ;;
        *)
891
	IFS="$save_IFS"
892
        AC_MSG_WARN([Unknown value $option for --enable-fast])
893
	IFS=","
894
895
896
897
898
        ;;
    esac
done
IFS="$save_IFS"

Pavan Balaji's avatar
Pavan Balaji committed
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
if test -n "$enable_fast_opts" ; then
   # Allows O<n> where <n> can be [0-9] or ' '.
   opt_flags=`echo $enable_fast_opts | sed -e 's%\(O[0-9] \)%\1%g'`
   if test -n "$opt_flags" ; then
      MPI_DEFAULT_COPTS="-$enable_fast_opts"
      MPI_DEFAULT_CXXOPTS="-$enable_fast_opts"
      MPI_DEFAULT_FOPTS="-$enable_fast_opts"
      MPI_DEFAULT_FCOPTS="-$enable_fast_opts"
   else
      AC_MSG_WARN([Unknown value $enable_fast_opts for --enable-fast])
   fi
fi

if test "$enable_fast_ndebug" = "yes" ; then
    CFLAGS="$CFLAGS -DNDEBUG -DNVALGRIND"
    CXXFLAGS="$CXXFLAGS -DNDEBUG -DNVALGRIND"
    # MPICH does NOT assume any preprocessing support from the Fortran compiler,
    # so no Fortran files contain any preprocessing statements.
    # Don't set FFLAGS or FCFLAGS with any -D.
918
919
920
fi

# error-checking
921
922
923
924
# Change default into the specific value of the default
if test "$enable_error_checking" = "default" ; then
   enable_error_checking=all
fi
925
926
# glue_romio.h needs the variable HAVE_ERROR_CHECKING to have the value 0 or 1
HAVE_ERROR_CHECKING=0
927
928
case "$enable_error_checking" in 
    no)
929
    # if error checking has been disabled, then automatically disable the error
930
931
932
933
934
935
936
937
    # 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])
938
    HAVE_ERROR_CHECKING=1
939
940
941
942
943
    ;;
    *)
    AC_MSG_WARN([Unknown value $enable_error_checking for enable-error-checking])
    ;;
esac
944
# permit @HAVE_ERROR_CHECKING@ substitution in glue_romio.h 
945
AC_SUBST([HAVE_ERROR_CHECKING])
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966

# 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])

967
# ----------------------------------------------------------------------------
968
969
970
#
# enable-timing and with-logging
#
971
# Still to do: add subsets: e.g., class=pt2pt,class=coll.  See mpich doc
972
973
974
975
976
977
978
979
980
#
# 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).
# ----------------------------------------------------------------------------
981
AM_CONDITIONAL([BUILD_LOGGING_RLOG],[test "X$with_logging" = "Xrlog"])
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
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)
For faster browsing, not all history is shown. View entire blame