configure.in 8.48 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
8
AC_INIT([darshan-runtime], [2.2.3])
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 25 26 27 28
AC_ARG_WITH(zlib-for-mpi,,
    AC_MSG_ERROR(with-zlib-for-mpi argument is deprecated.  Please see Darshan documentation.)
)


29
dnl runtime libraries require zlib
30
CHECK_ZLIB
31

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

39 40 41 42 43 44 45
AC_ARG_ENABLE(ld-preload, 
[  --disable-ld-preload    Disables support for LD_PRELOAD library], 
[if test "x$enableval" = "xno" ; then
    DISABLE_LDPRELOAD="1"
fi]
,)

46 47 48 49 50 51 52 53 54
AC_ARG_ENABLE(st-dev-workaround, 
[  --enable-st-dev-workaround Gather device id from parent directory instead of file], 
[if test "x$enableval" = "xyes" ; then
    AC_DEFINE(__CP_ST_DEV_WORKAROUND, 1, Define if device id should be taken from parent directory rather than file)
    DISABLE_LDPRELOAD="1"
fi]
,)


55 56 57 58 59 60 61 62 63 64
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
        AC_DEFINE_UNQUOTED(__CP_MEM_ALIGNMENT, ${withval}, Memory alignment in bytes)
        GOT_ALIGNMENT=1
    fi
)

65 66 67 68 69 70 71 72 73 74 75
AC_ARG_WITH(log-path-by-env,
[  --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],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-log-path-by-env must be given at least one variable name)
    else
        AC_DEFINE_UNQUOTED(__CP_LOG_ENV, "${withval}", Comma separated list of env. variables to use for log path)
        __CP_LOG_ENV="${withval}"
        GOT_LOG_PATH=1
    fi
)

76
AC_ARG_WITH(log-hints,
77
[  --with-log-hints=<hint1=x,hint2=y>  Semicolon-separated list of MPI-IO hints for log file write],
78 79 80
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-log-hints must be given an argument)
    else
81
        AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "${withval}", Semicolon-separated list of MPI-IO hints for log file write)
82 83 84 85 86
        __CP_LOG_HINTS="${withval}"
        GOT_LOG_HINTS=1
    fi
)

87 88 89 90 91 92 93 94 95 96 97
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
        AC_DEFINE_UNQUOTED(__CP_LOG_PATH, "${withval}", Location to store log files at run time)
        __CP_LOG_PATH="${withval}"
        GOT_LOG_PATH=1
    fi
)

98
AC_ARG_WITH(jobid-env,
99 100 101
[  --with-jobid-env=<name> Name of environment variable that stores the jobid
    (specify "NONE" if no appropriate environment variable is available: 
    Darshan will use rank 0's pid instead)],
102 103 104 105 106 107 108 109
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-jobid-env must be given a name)
    else
        AC_DEFINE_UNQUOTED(CP_JOBID, "${withval}", Name of the environment variable that stores the jobid)
        CP_JOBID="${withval}"
        GOT_JOBID=1
    fi
)
110 111 112 113 114

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
115
    AC_MSG_ERROR(must provide --with-log-path=<path> _or_ --with-log-path-by-env=<variable list> argument to configure.)
116
fi
117 118 119
if test x$GOT_JOBID != x1; then
    AC_MSG_ERROR(must provide --with-jobid-env=<name> argument to configure.)
fi
120 121
#__CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true;cb_nodes=8"
__CP_LOG_HINTS_DEFAULT=""
122 123 124 125
if test x$GOT_LOG_HINTS != x1; then
dnl use default hints
    AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "$__CP_LOG_HINTS_DEFAULT", Comma-separated list of MPI-IO hints for log file write)
fi
126

127 128
# checks to see how we can print 64 bit values on this architecture
gt_INTTYPES_PRI
129 130 131 132

dnl Check byte ordering
AC_C_BIGENDIAN

133
dnl temporarily set large file flags just for this test; we don't want
134
dnl it to propagate to the makefile because of zlib bugs
135 136
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
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)
)
161
CFLAGS="$old_cflags"
162

163
AC_CHECK_HEADERS(mntent.h sys/mount.h)
164

165
# libc functions wrapped by darshan
166
CP_WRAPPERS="-Wl,-u,MPI_Wtime,-wrap,write,-wrap,open,-wrap,creat,-wrap,creat64,-wrap,open64,-wrap,close,-wrap,read,-wrap,lseek,-wrap,lseek64,-wrap,pread,-wrap,pwrite,-wrap,readv,-wrap,writev,-wrap,__xstat,-wrap,__lxstat,-wrap,__fxstat,-wrap,__xstat64,-wrap,__lxstat64,-wrap,__fxstat64,-wrap,mmap,-wrap,mmap64,-wrap,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create,-wrap,ncmpi_open,-wrap,ncmpi_close,-wrap,H5Fcreate,-wrap,H5Fopen,-wrap,H5Fclose"
167 168

# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
169

170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
# 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
eval darshan_bin_path=$bindir
prefix=$savePrefix
exec_prefix=$saveExecprefix

189 190 191 192 193 194 195 196 197 198 199 200 201 202
# 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)
)

203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
# 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"

221 222 223 224 225 226 227 228 229 230
# 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>])
231

232 233
DARSHAN_VERSION="AC_PACKAGE_VERSION"

234
AC_SUBST(darshan_lib_path)
235
AC_SUBST(darshan_bin_path)
236
AC_SUBST(LDFLAGS)
237 238
AC_SUBST(__CP_LOG_PATH)
AC_SUBST(CP_WRAPPERS)
239
AC_SUBST(DISABLE_LDPRELOAD)
240
AC_SUBST(DARSHAN_VERSION)
241 242
AC_OUTPUT(Makefile
darshan-mk-log-dirs.pl
243
darshan-gen-cc.pl
Philip Carns's avatar
Philip Carns committed
244
darshan-gen-cxx.pl
245
darshan-gen-fortran.pl
Philip Carns's avatar
Philip Carns committed
246
darshan-config
247
share/cray/darshan-module
248
)