configure.in 8.01 KB
Newer Older
1
dnl **************************************************************
2
dnl DARSHAN AUTOCONF SCRIPT
3 4 5 6 7 8 9 10 11 12 13 14 15
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
AC_INIT(darshan.h)
AC_CONFIG_AUX_DIR(maint/config)
AC_CONFIG_HEADER(darshan-config.h)

AC_PROG_INSTALL

CHECK_ZLIB

16 17 18 19 20 21 22 23 24 25
AC_ARG_WITH(mpi,
[  --with-mpi=<dir>        Location of the MPI installation],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-mpi must be given a pathname)
    else
        MPICC="${withval}/bin/mpicc"
        HAVE_MPICC="yes"
    fi
)

26
if test x$HAVE_MPICC != xyes; then
27 28 29 30
    AC_CHECK_PROG(HAVE_MPICC, mpicc, yes, no)
    if test x$HAVE_MPICC = xyes; then
        MPICC=mpicc
    fi
31 32 33 34 35 36 37 38 39 40 41 42 43
fi
AC_SUBST(MPICC)

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
)

44 45 46 47 48
AC_ARG_WITH(zlib-for-mpi,
[  --with-zlib-for-mpi=<dir>  base dir for zlib to use on mpi processes],
    if test x$withval = xyes; then
        AC_MSG_ERROR(--with-zlib-for-mpi must be given a path argument)
    else
49
        __CP_ZLIB_LINK_FLAGS="-L${withval}/lib"
50 51 52 53
        __CP_ZLIB_INCLUDE_FLAGS="-I ${withval}/include"
    fi
)

54 55 56 57 58 59 60 61 62 63 64
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
)

65
AC_ARG_WITH(jobid-env,
66 67 68
[  --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)],
69 70 71 72 73 74 75 76
    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
)
77

78 79
if test x$HAVE_MPICC != "xyes"; then
    AC_MSG_ERROR(must provide --with-mpi=<path> argument to configure if mpicc is not in path.)
80 81 82 83 84 85 86
fi
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
    AC_MSG_ERROR(must provide --with-log-path=<path> argument to configure.)
fi
87 88 89
if test x$GOT_JOBID != x1; then
    AC_MSG_ERROR(must provide --with-jobid-env=<name> argument to configure.)
fi
90

91 92 93 94 95 96 97 98 99 100 101 102 103 104
AC_CHECK_PROG(HAVE_PDFLATEX, pdflatex, yes, no)

if test x$HAVE_PDFLATEX == xyes; then
    AC_MSG_CHECKING(for -halt-on-error argument to pdflatex)
    PDFLATEX_GREP=`pdflatex --help |grep halt-on-error`
    if test "x$PDFLATEX_GREP" != "x"; then
        AC_MSG_RESULT(yes)
        __CP_PDFLATEX_HALT_ON_ERROR="-halt-on-error"
    else
        __CP_PDFLATEX_HALT_ON_ERROR=""
        AC_MSG_RESULT(no)
    fi
fi

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
# =====================================================================
# all tests executed with CC=MPICC from this point on

saveCC="$CC"
CC="$MPICC"

# redo printf int64 test for mpi compiler
AC_MSG_CHECKING(if int64 can be printed as lld without cast)
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE(
    [
        #include <stdio.h>
        #include <sys/types.h>
    ],
    [ 
        int64_t test = 0;
        printf("%lld\n", test); 
    ],
        AC_MSG_RESULT(yes)
    ,
        AC_MSG_RESULT(no)
        AC_DEFINE(PRINTF_CAST_INT64_LLD, 1, Define if int64 should be cast to long long for printf)
)
CFLAGS="$old_cflags"


132 133 134 135 136 137 138
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)
    AC_MSG_ERROR($CC doesn't appear to be a valid MPI compiler)
)

139 140 141
dnl Check byte ordering
AC_C_BIGENDIAN

142
dnl temporarily set large file flags just for this test; we don't want
143
dnl it to propagate to the makefile because of zlib bugs
144 145
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
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)
)
170
CFLAGS="$old_cflags"
171

172
AC_CHECK_HEADERS(mntent.h sys/mount.h)
173

174
# libc functions wrapped by darshan
175
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"
176 177

# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
178

179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
# 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

198 199 200 201 202 203 204 205 206 207 208 209 210 211
# 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)
)

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250
AC_MSG_CHECKING(for generalized requests in MPI-IO)
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_TRY_COMPILE(
    [
        #include <mpi.h>
        #include <stdlib.h>
    ],
    [ 
	int ret = 0;
	MPI_Request req;
	ret = MPI_File_iread_at(MPI_FILE_NULL, 0, NULL, 0, MPI_BYTE, &req);
    ],
        AC_MSG_RESULT(yes)
        AC_DEFINE_UNQUOTED(__D_MPI_REQUEST, MPI_Request, Generalized request type for MPI-IO)
    ,
        AC_MSG_RESULT(no)
	AC_MSG_CHECKING(for MPIO_Request in MPI-IO)
	AC_TRY_COMPILE(
	    [
		#include <mpi.h>
        	#include <stdlib.h>
	    ],
	    [ 
		int ret = 0;
		MPIO_Request req;
		ret = MPI_File_iread_at(MPI_FILE_NULL, 0, NULL, 0, MPI_BYTE, &req);
	    ],
		AC_MSG_RESULT(yes)
		AC_DEFINE_UNQUOTED(__D_MPI_REQUEST, MPIO_Request, Generalized request type for MPI-IO)
	    ,
		AC_MSG_RESULT(no)
    		AC_MSG_ERROR(Unable to find valid request type for MPI-IO)

	)
)
CFLAGS="$old_cflags"


251
AC_SUBST(darshan_lib_path)
252
AC_SUBST(darshan_bin_path)
253
AC_SUBST(__CP_LOG_PATH)
254 255
AC_SUBST(__CP_ZLIB_LINK_FLAGS)
AC_SUBST(__CP_ZLIB_INCLUDE_FLAGS)
256
AC_SUBST(CP_WRAPPERS)
257
AC_SUBST(__CP_PDFLATEX_HALT_ON_ERROR)
258 259
AC_OUTPUT(Makefile
darshan-mk-log-dirs.pl
260
darshan-gen-cc.pl
Philip Carns's avatar
Philip Carns committed
261
darshan-gen-cxx.pl
262
darshan-gen-fortran.pl
263
util/bin/darshan-job-summary.pl
264
)
265 266 267 268

if test x$HAVE_PDFLATEX != xyes; then
    AC_MSG_WARN(Please install pdflatex if you wish to use the darshan-job-summary.pl utility)
fi