dnl ************************************************************** dnl DARSHAN AUTOCONF SCRIPT 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-runtime], [2.2.8]) AC_CONFIG_SRCDIR([darshan.h]) AC_CONFIG_AUX_DIR(../maint/config) AC_CONFIG_HEADER(darshan-runtime-config.h) AC_PROG_INSTALL 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 ], [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. See INSTALL document or try adding CC=mpicc to your configure command line.) ) AC_ARG_WITH(zlib-for-mpi,, AC_MSG_ERROR(with-zlib-for-mpi argument is deprecated. Please see Darshan documentation.) ) dnl runtime libraries require zlib CHECK_ZLIB 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] ,) AC_ARG_ENABLE(ld-preload, [ --disable-ld-preload Disables support for LD_PRELOAD library], [if test "x$enableval" = "xno" ; then DISABLE_LDPRELOAD="1" fi] ,) AC_ARG_ENABLE(group-readable-logs, [ --enable-group-readable-logs Set log files to be group readable], [if test "x$enableval" = "xyes" ; then AC_DEFINE(__CP_GROUP_READABLE_LOGS, 1, Define if Darshan should set log files to be group readable) fi] ,) AC_ARG_ENABLE(stat-at-open, [ --enable-stat-at-open Perform stat() call at open time to gather extra statistics], [if test "x$enableval" = "xyes" ; then AC_DEFINE(__CP_STAT_AT_OPEN, 1, Define if Darshan should stat files at open time to collect extra statistics) fi] ,) AC_ARG_WITH(mem-align, [ --with-mem-align= 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 ) AC_ARG_WITH(log-path-by-env, [ --with-log-path-by-env= 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 ) AC_ARG_WITH(log-hints, [ --with-log-hints= Semicolon-separated list of MPI-IO hints for log file write], if test x$withval = xyes; then AC_MSG_ERROR(--with-log-hints must be given an argument) else AC_DEFINE_UNQUOTED(__CP_LOG_HINTS, "${withval}", Semicolon-separated list of MPI-IO hints for log file write) __CP_LOG_HINTS="${withval}" GOT_LOG_HINTS=1 fi ) AC_ARG_WITH(log-path, [ --with-log-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 ) AC_ARG_WITH(jobid-env, [ --with-jobid-env= 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)], 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 ) if test x$GOT_ALIGNMENT != x1; then AC_MSG_ERROR(must provide --with-mem-align= argument to configure.) fi if test x$GOT_LOG_PATH != x1; then AC_MSG_ERROR(must provide --with-log-path= _or_ --with-log-path-by-env= argument to configure.) fi if test x$GOT_JOBID != x1; then AC_MSG_ERROR(must provide --with-jobid-env= argument to configure.) fi __CP_LOG_HINTS_DEFAULT="romio_no_indep_rw=true;cb_nodes=4" 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 # checks to see how we can print 64 bit values on this architecture gt_INTTYPES_PRI 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 dnl Check byte ordering AC_C_BIGENDIAN 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 ], [ 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" 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 off64_t) AC_TRY_COMPILE( [ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include ], [ off64_t off; ], AC_MSG_RESULT(yes) AC_DEFINE(HAVE_OFF64_T, 1, Define if off64_t type is defined), AC_MSG_RESULT(no) ) CFLAGS="$old_cflags" AC_CHECK_HEADERS(mntent.h sys/mount.h) # libc functions wrapped by darshan CP_WRAPPERS="-Wl,-u,MPI_Init,-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,-wrap,aio_write,-wrap,aio_write64,-wrap,aio_read,-wrap,aio_read64,-wrap,lio_listio,-wrap,lio_listio64,-wrap,aio_return,-wrap,aio_return64" # ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock # 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 # 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_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) ) # 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 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 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) ) ) # 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 ], [ 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" # 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 ]) DARSHAN_VERSION="AC_PACKAGE_VERSION" AC_SUBST(darshan_lib_path) AC_SUBST(darshan_bin_path) AC_SUBST(LDFLAGS) AC_SUBST(__CP_LOG_PATH) AC_SUBST(CP_WRAPPERS) AC_SUBST(DISABLE_LDPRELOAD) AC_SUBST(DARSHAN_VERSION) AC_OUTPUT(Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl darshan-config share/cray/darshan-module )