configure.in 12.3 KB
Newer Older
1
dnl **************************************************************
2
dnl DARSHAN AUTOCONF SCRIPT
3
4
5
6
7
dnl
dnl Process this file with autoconf to produce a configure script.
dnl You may need to use autoheader as well if changing any DEFINEs

dnl sanity checks, output header, location of scripts used here
Shane Snyder's avatar
Shane Snyder committed
8
AC_INIT([darshan-runtime], [3.1.2])
9
10
11
AC_CONFIG_SRCDIR([darshan.h])
AC_CONFIG_AUX_DIR(../maint/config)
AC_CONFIG_HEADER(darshan-runtime-config.h)
12
13
14

AC_PROG_INSTALL

15
16
17
18
19
20
dnl Check to see if CC is an MPI compiler
dnl TODO: better error message here
AC_MSG_CHECKING(whether the mpicc compiler works)
AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
Philip Carns's avatar
Philip Carns committed
21
    AC_MSG_ERROR(CC doesn't appear to be a valid MPI compiler.  See INSTALL document or try adding CC=mpicc to your configure command line.)
22
23
)

24
dnl runtime libraries require zlib
25
CHECK_ZLIB
26

27
28
AC_ARG_ENABLE(ld-preload, 
[  --disable-ld-preload    Disables support for LD_PRELOAD library], 
29
[if test "x$enableval" = "xno" ; then
30
    DISABLE_LDPRELOAD="1"
31
32
33
fi]
,)

34
35
AC_ARG_ENABLE(cuserid, 
[  --disable-cuserid       Disables attempted use of cuserid() at run time], 
36
[if test "x$enableval" = "xno" ; then
37
    AC_DEFINE(__DARSHAN_DISABLE_CUSERID, 1, Define if cuserid() should be disabled)
38
39
40
fi]
,)

41
AC_ARG_ENABLE(group-readable-logs, 
42
43
[  --enable-group-readable-logs
                          Set log files to be group readable], 
44
[if test "x$enableval" = "xyes" ; then
45
    AC_DEFINE(__DARSHAN_GROUP_READABLE_LOGS, 1, Define if Darshan should set log files to be group readable)
46
47
48
fi]
,)

49
AC_ARG_ENABLE(HDF5_1.10,
Philip Carns's avatar
Philip Carns committed
50
[  --enable-HDF5_1.10      Enable explicit support for HDF5 1.10.x API],
51
[if test "x$enableval" = "xyes" ; then
Philip Carns's avatar
Philip Carns committed
52
    AC_DEFINE(__DARSHAN_ENABLE_HDF5110, 1, Explicitly enable HDF5_1.10.x support, will break 1.8.x compatibility on 32bit platforms)
53
54
55
fi]
,)

56
AC_ARG_ENABLE(
57
    [bgq-mod],
58
59
60
61
62
    [  --disable-bgq-mod       Disables compilation and use of BG/Q module (for BG/Q systems)],
    [],
    [enable_bgq_mod=check]
)

63
64
65
66
67
68
69
AC_ARG_ENABLE(
    [lustre-mod],
    [  --disable-lustre-mod    Disables compilation and use of the Lustre module],
    [],
    [enable_lustre_mod=check]
)

70
AC_ARG_ENABLE(mmap-logs,
Glenn K. Lockwood's avatar
Glenn K. Lockwood committed
71
[  --enable-mmap-logs      Enables ability to mmap I/O data to log file],
72
73
[if test "x$enableval" = "xyes" ; then
    AC_DEFINE(__DARSHAN_ENABLE_MMAP_LOGS, 1, Define if Darshan should mmap data structures to log file)
74
75
    ENABLE_MMAP_LOGS=1
    AC_CONFIG_FILES(share/darshan-mmap-epilog.sh)
76
77
78
fi]
,)

79
80
81
82
83
AC_ARG_WITH(mem-align,
[  --with-mem-align=<num>  Memory alignment in bytes],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-mem-align must be given a number in bytes)
    else
84
        AC_DEFINE_UNQUOTED(__DARSHAN_MEM_ALIGNMENT, ${withval}, Memory alignment in bytes)
85
86
87
88
        GOT_ALIGNMENT=1
    fi
)

89
AC_ARG_WITH(log-path-by-env,
90
91
92
[  --with-log-path-by-env=<env var list>
                          Comma separated list of environment variables to check for
                          log path location before --with-log-path path],
93
94
95
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-log-path-by-env must be given at least one variable name)
    else
96
97
        AC_DEFINE_UNQUOTED(__DARSHAN_LOG_ENV, "${withval}", Comma separated list of env. variables to use for log path)
        __DARSHAN_LOG_ENV="${withval}"
98
99
100
101
        GOT_LOG_PATH=1
    fi
)

102
AC_ARG_WITH(log-hints,
103
104
[  --with-log-hints=<hint1=x;hint2=y>
                          Semicolon-separated list of MPI-IO hints for log file write],
105
106
107
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-log-hints must be given an argument)
    else
108
109
        AC_DEFINE_UNQUOTED(__DARSHAN_LOG_HINTS, "${withval}", Semicolon-separated list of MPI-IO hints for log file write)
        __DARSHAN_LOG_HINTS="${withval}"
110
111
112
113
        GOT_LOG_HINTS=1
    fi
)

114
115
116
117
118
AC_ARG_WITH(log-path,
[  --with-log-path=<path>  Location to store log files at run time],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-log-path must be given a pathname)
    else
119
120
        AC_DEFINE_UNQUOTED(__DARSHAN_LOG_PATH, "${withval}", Location to store log files at run time)
        __DARSHAN_LOG_PATH="${withval}"
121
122
123
124
        GOT_LOG_PATH=1
    fi
)

125
AC_ARG_WITH(jobid-env,
126
[  --with-jobid-env=<name> Name of environment variable that stores the jobid
127
128
                          (specify "NONE" if no appropriate environment variable
                          is available: Darshan will use rank 0's pid instead)],
129
130
131
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-jobid-env must be given a name)
    else
132
133
        AC_DEFINE_UNQUOTED(__DARSHAN_JOBID, "${withval}", Name of the environment variable that stores the jobid)
        __DARSHAN_JOBID="${withval}"
134
135
136
        GOT_JOBID=1
    fi
)
137

138
139
140
141
142
143
144
145
146
AC_ARG_WITH(mod-mem,
[  --with-mod-mem=<num>    Maximum amount of memory (in MiB) for each Darshan module],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-mod-mem must be given a number)
    else
        AC_DEFINE_UNQUOTED(__DARSHAN_MOD_MEM_MAX, ${withval}, Maximum memory (in MiB) for each Darshan module)
    fi
)

147
# if bgq module not disabled, check to make sure BG/Q environment available
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
if test x$enable_bgq_mod != xno; then
    AC_MSG_CHECKING(for BG/Q environment)
    AC_TRY_COMPILE([
        #ifndef __bgq__
        #error __bgq__ not set
        #endif
        ], [],
        AC_MSG_RESULT(yes)
        DARSHAN_USE_BGQ=1,
        AC_MSG_RESULT(no)
        AS_IF([test "x$enable_bgq_mod" = xyes],
            AC_MSG_ERROR(BG/Q module enabled in non-BG/Q environment),
            []))
fi

163
164
165
166
167
168
169
170
171
# if lustre module not disabled, check for needed Lustre module header
if test x$enable_lustre_mod != xno; then
    AC_CHECK_HEADER([lustre/lustre_user.h],
        DARSHAN_USE_LUSTRE=1,
        AS_IF([test "x$enable_lustre_mod" = xyes],
            AC_MSG_ERROR(Cannot find required headers for the Lustre module),
            []))
fi

172
173
174
175
if test x$GOT_ALIGNMENT != x1; then
    AC_MSG_ERROR(must provide --with-mem-align=<num> argument to configure.)
fi
if test x$GOT_LOG_PATH != x1; then
176
    AC_MSG_ERROR(must provide --with-log-path=<path> _or_ --with-log-path-by-env=<variable list> argument to configure.)
177
fi
178
179
180
if test x$GOT_JOBID != x1; then
    AC_MSG_ERROR(must provide --with-jobid-env=<name> argument to configure.)
fi
181
__DARSHAN_LOG_HINTS_DEFAULT="romio_no_indep_rw=true;cb_nodes=4"
182
183
if test x$GOT_LOG_HINTS != x1; then
dnl use default hints
184
    AC_DEFINE_UNQUOTED(__DARSHAN_LOG_HINTS, "$__DARSHAN_LOG_HINTS_DEFAULT", Comma-separated list of MPI-IO hints for log file write)
185
fi
186

187
188
# checks to see how we can print 64 bit values on this architecture
gt_INTTYPES_PRI
189
190
191
192
193
if test x$PRI_MACROS_BROKEN == xyes; then
    AC_MSG_ERROR(PRI_xx macros are broken)
else
    AC_CHECK_HEADERS(inttypes.h, , [AC_MSG_ERROR(Couldn't find inttypes.h)])
fi
194
195
196
197

dnl Check byte ordering
AC_C_BIGENDIAN

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
dnl temporarily set large file flags just for this test; we don't want
dnl it to propagate to the makefile because of zlib bugs
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
AC_MSG_CHECKING(for struct aiocb64)
AC_TRY_COMPILE(
    [
    #include <aio.h>
    ],
    [ struct aiocb64 aiocb; ],
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_AIOCB64, 1, Define if struct aiocb64 type is defined),
    AC_MSG_RESULT(no)
)
CFLAGS="$old_cflags"

214
dnl temporarily set large file flags just for this test; we don't want
215
dnl it to propagate to the makefile because of zlib bugs
216
217
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
AC_MSG_CHECKING(for off64_t)
AC_TRY_COMPILE(
    [
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <stdarg.h>
    #include <string.h>
    #include <time.h>
    #include <stdlib.h>
    #include <errno.h>
    #include <sys/uio.h>
    #include <pthread.h>
    #include <sys/mman.h>
    #include <search.h>
    #include <assert.h>
    ],
    [ off64_t off; ],
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_OFF64_T, 1, Define if off64_t type is defined),
    AC_MSG_RESULT(no)
)
242
CFLAGS="$old_cflags"
243

244
AC_CHECK_HEADERS(mntent.h sys/mount.h)
245

246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# We need to know the value of the $libdir and $bindir variables so that 
# we can reference the correct path in the darshan compiler wrappers.  
# Unfortunately, those two variables are not normally evaluated by autoconf.  
# They are evaluated at build time using Makefile variable substitutions.  
# 
# The following logic was copied from mpich2 1.3.1 to resolve the $libdir
# variable at configure time.
#
# Temporarily replace the default NONE value for exec_prefix
# and prefix with the actual, default values.
savePrefix=$prefix
saveExecprefix=$exec_prefix
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix=$prefix
eval darshan_lib_path=$libdir
261
eval darshan_share_path=$datarootdir
262
263
264
prefix=$savePrefix
exec_prefix=$saveExecprefix

265
266
267
268
269
270
271
272
273
274
275
276
277
278
# determine if the MPI library includes MPI-IO functions or not
AC_MSG_CHECKING(for MPI-IO support in MPI)
AC_TRY_LINK([#include <mpi.h>], [
    MPI_Comm comm;
    char* filename;
    int amode;
    MPI_Info info;
    MPI_File fh;
    MPI_File_open(comm, filename, amode, info, &fh);
],
    AC_MSG_RESULT(yes),
    AC_MSG_ERROR(Darshan requires a version of MPI with MPI-IO support)
)

279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
# At some point MPI-IO converted most API functions to be const correct.  We
# need to test for this to determine how to define MPI-IO wrappers in
# Darshan.  First we try compiling without cost qualifiers.
AC_MSG_CHECKING(for MPI-IO prototypes without const qualifier)
AC_TRY_COMPILE(
    [
    #include <mpi.h>
    int MPI_File_open(MPI_Comm comm, char *filename, int amode, 
        MPI_Info info, MPI_File *fh)
        {return 0;}
    ],
    [],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)

    # unable to compile without const qualifiers.  Let's try again with
    # const qualifiers.
    AC_MSG_CHECKING(for MPI-IO prototypes with const qualifier)
    AC_TRY_COMPILE(
        [
        #include <mpi.h>
        int MPI_File_open(MPI_Comm comm, const char *filename, int amode, 
            MPI_Info info, MPI_File *fh)
            {return 0;}
        ],
        [],
        AC_MSG_RESULT(yes)
        AC_DEFINE(HAVE_MPIIO_CONST, 1, Define if MPI-IO prototypes use const qualifier),
        ,
        AC_MSG_ERROR(Darshan is unable to find a compatible MPI_File_open prototype)
    )
)

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# determine if mpicc can create shared libraries that use MPI functions
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -shared -fpic -DPIC"
old_libs="$LIBS"
LIBS="$LIBS -ldl"
AC_MSG_CHECKING(for shared libraries in MPI)
AC_TRY_LINK([#include <mpi.h>], [
    int size;
    MPI_Comm_size(MPI_COMM_WORLD, &size);
],
    AC_MSG_RESULT(yes),
    AC_MSG_RESULT(no)
    AC_MSG_WARN(mpicc doesn't support shared objects; disabling LD_PRELOAD library)
    DISABLE_LDPRELOAD="1"
)
CFLAGS="$old_cflags"
LIBS="$old_libs"

330
331
332
333
334
335
336
337
338
339
# if this version of mpi defines an MPIO_Request type, then we assume that 
# we should use it in the nonblocking MPI-IO functions.  This is necessary 
# for MPI 1.x implementations that did not use generalized requests yet in 
# MPI-IO.  Later MPI implementations might typedef MPIO_Request to MPI_Request
# so there is no  harm in using the former if it is available there.
AC_CHECK_TYPE([MPIO_Request], 
		AC_DEFINE(__D_MPI_REQUEST, MPIO_Request, Generalized request type for MPI-IO)
	, 
		AC_DEFINE(__D_MPI_REQUEST, MPI_Request, Generalized request type for MPI-IO)
	,[#include <mpi.h>])
340

341
342
343
344
345
346
347
348
349
# attempt to detect library naming convention in mpi compiler script
AS_IF([$CC -show foo.c -o foo >& /dev/null],
	AC_MSG_CHECKING(for old (pre-3.1.1) style MPICH library naming convention)
	AS_IF([$CC -show foo.c -o foo |grep lmpich >& /dev/null], 
	    AC_MSG_RESULT(yes)
	    MPICH_LIB_OLD=1,
	    AC_MSG_RESULT(no)
	    MPICH_LIB_OLD=0),
	MPICH_LIB_OLD=0)
350

351
DARSHAN_VERSION="AC_PACKAGE_VERSION"
352
AC_SUBST(darshan_lib_path)
353
AC_SUBST(darshan_share_path)
354
AC_SUBST(LDFLAGS)
355
AC_SUBST(__DARSHAN_LOG_PATH)
356
AC_SUBST(DISABLE_LDPRELOAD)
357
AC_SUBST(ENABLE_MMAP_LOGS)
358
AC_SUBST(DARSHAN_VERSION)
359
AC_SUBST(MPICH_LIB_OLD)
360
AC_SUBST(DARSHAN_USE_BGQ)
361
AC_SUBST(DARSHAN_USE_LUSTRE)
362
363
AC_OUTPUT(Makefile
darshan-mk-log-dirs.pl
364
darshan-gen-cc.pl
Philip Carns's avatar
Philip Carns committed
365
darshan-gen-cxx.pl
366
darshan-gen-fortran.pl
Philip Carns's avatar
Philip Carns committed
367
darshan-config
368
share/craype-1.x/darshan-module
369
share/craype-2.x/darshan-module
370
lib/pkgconfig/darshan-runtime.pc
371
372
373
share/mpi-profile/darshan-cc.conf
share/mpi-profile/darshan-cxx.conf
share/mpi-profile/darshan-f.conf
374
375
376
share/mpi-profile/darshan-bg-cc.conf
share/mpi-profile/darshan-bg-cxx.conf
share/mpi-profile/darshan-bg-f.conf
377
share/ld-opts/darshan-base-ld-opts
378
)