Commit 6a5e71b5 authored by Philip Carns's avatar Philip Carns
Browse files

switch to compile-time test for how to print int64


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@388 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 1856df04
...@@ -1660,184 +1660,6 @@ $as_echo "$ac_res" >&6; } ...@@ -1660,184 +1660,6 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_header_compile } # ac_fn_c_check_header_compile
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
# INCLUDES, setting VAR accordingly. Returns whether the value could be
# computed
ac_fn_c_compute_int ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
if test "$cross_compiling" = yes; then
# Depending upon the size, compute the lo and hi bounds.
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=0 ac_mid=0
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid; break
else
as_fn_arith $ac_mid + 1 && ac_lo=$as_val
if test $ac_lo -le $ac_mid; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=-1 ac_mid=-1
while :; do
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) >= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_lo=$ac_mid; break
else
as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
if test $ac_mid -le $ac_hi; then
ac_lo= ac_hi=
break
fi
as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
else
ac_lo= ac_hi=
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Binary search between lo and hi bounds.
while test "x$ac_lo" != "x$ac_hi"; do
as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
int
main ()
{
static int test_array [1 - 2 * !(($2) <= $ac_mid)];
test_array [0] = 0
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_hi=$ac_mid
else
as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
done
case $ac_lo in #((
?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
'') ac_retval=1 ;;
esac
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$4
static long int longval () { return $2; }
static unsigned long int ulongval () { return $2; }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (($2) < 0)
{
long int i = longval ();
if (i != ($2))
return 1;
fprintf (f, "%ld", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ($2))
return 1;
fprintf (f, "%lu", i);
}
/* Do not output a trailing newline, as this causes \r\n confusion
on some platforms. */
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_run "$LINENO"; then :
echo >>conftest.val; read $3 <conftest.val; ac_retval=0
else
ac_retval=1
fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
conftest.$ac_objext conftest.beam conftest.$ac_ext
rm -f conftest.val
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
as_fn_set_status $ac_retval
} # ac_fn_c_compute_int
cat >config.log <<_ACEOF cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
...@@ -3677,6 +3499,211 @@ fi ...@@ -3677,6 +3499,211 @@ fi
# Check whether --with-mpi was given.
if test "${with_mpi+set}" = set; then :
withval=$with_mpi; if test x$withval = xyes; then
as_fn_error $? "--with-mpi must be given a pathname" "$LINENO" 5
else
MPICC="${withval}/bin/mpicc"
HAVE_MPICC="yes"
fi
fi
if test x$HAVE_MPICC != xyes; then
# Extract the first word of "mpicc", so it can be a program name with args.
set dummy mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_HAVE_MPICC+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -n "$HAVE_MPICC"; then
ac_cv_prog_HAVE_MPICC="$HAVE_MPICC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_HAVE_MPICC="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_HAVE_MPICC" && ac_cv_prog_HAVE_MPICC="no"
fi
fi
HAVE_MPICC=$ac_cv_prog_HAVE_MPICC
if test -n "$HAVE_MPICC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_MPICC" >&5
$as_echo "$HAVE_MPICC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test x$HAVE_MPICC = xyes; then
MPICC=mpicc
fi
fi
# Check whether --with-mem-align was given.
if test "${with_mem_align+set}" = set; then :
withval=$with_mem_align; if test x$withval = xyes; then
as_fn_error $? "--with-mem-align must be given a number in bytes" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define __CP_MEM_ALIGNMENT ${withval}
_ACEOF
GOT_ALIGNMENT=1
fi
fi
# Check whether --with-zlib-for-mpi was given.
if test "${with_zlib_for_mpi+set}" = set; then :
withval=$with_zlib_for_mpi; if test x$withval = xyes; then
as_fn_error $? "--with-zlib-for-mpi must be given a path argument" "$LINENO" 5
else
__CP_ZLIB_LINK_FLAGS="-L${withval}/lib"
__CP_ZLIB_INCLUDE_FLAGS="-I ${withval}/include"
fi
fi
# Check whether --with-log-path was given.
if test "${with_log_path+set}" = set; then :
withval=$with_log_path; if test x$withval = xyes; then
as_fn_error $? "--with-log-path must be given a pathname" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define __CP_LOG_PATH "${withval}"
_ACEOF
__CP_LOG_PATH="${withval}"
GOT_LOG_PATH=1
fi
fi
# Check whether --with-jobid-env was given.
if test "${with_jobid_env+set}" = set; then :
withval=$with_jobid_env; if test x$withval = xyes; then
as_fn_error $? "--with-jobid-env must be given a name" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define CP_JOBID "${withval}"
_ACEOF
CP_JOBID="${withval}"
GOT_JOBID=1
fi
fi
if test x$HAVE_MPICC != "xyes"; then
as_fn_error $? "must provide --with-mpi=<path> argument to configure if mpicc is not in path." "$LINENO" 5
fi
if test x$GOT_ALIGNMENT != x1; then
as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5
fi
if test x$GOT_LOG_PATH != x1; then
as_fn_error $? "must provide --with-log-path=<path> argument to configure." "$LINENO" 5
fi
if test x$GOT_JOBID != x1; then
as_fn_error $? "must provide --with-jobid-env=<name> argument to configure." "$LINENO" 5
fi
# =====================================================================
# all tests executed with CC=MPICC from this point on
saveCC="$CC"
CC="$MPICC"
# redo printf int64 test for mpi compiler
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if int64 can be printed as lld without cast" >&5
$as_echo_n "checking if int64 can be printed as lld without cast... " >&6; }
old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <sys/types.h>
int
main ()
{
int64_t test = 0;
printf("%lld\n", test);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
$as_echo "#define PRINTF_CAST_INT64_LLD 1" >>confdefs.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS="$old_cflags"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the mpicc compiler works" >&5
$as_echo_n "checking whether the mpicc compiler works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <mpi.h>
int
main ()
{
int ret = MPI_Init(0, (void*)0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "$CC doesn't appear to be a valid MPI compiler" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
$as_echo_n "checking whether byte ordering is bigendian... " >&6; } $as_echo_n "checking whether byte ordering is bigendian... " >&6; }
if test "${ac_cv_c_bigendian+set}" = set; then : if test "${ac_cv_c_bigendian+set}" = set; then :
...@@ -3902,170 +3929,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ...@@ -3902,170 +3929,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
esac esac
# Check whether --with-mpi was given.
if test "${with_mpi+set}" = set; then :
withval=$with_mpi; if test x$withval = xyes; then
as_fn_error $? "--with-mpi must be given a pathname" "$LINENO" 5
else
MPICC="${withval}/bin/mpicc"
HAVE_MPICC="yes"
fi
fi
if test x$HAVE_MPICC != xyes; then
# Extract the first word of "mpicc", so it can be a program name with args.
set dummy mpicc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_HAVE_MPICC+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -n "$HAVE_MPICC"; then
ac_cv_prog_HAVE_MPICC="$HAVE_MPICC" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_HAVE_MPICC="yes"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_prog_HAVE_MPICC" && ac_cv_prog_HAVE_MPICC="no"
fi
fi
HAVE_MPICC=$ac_cv_prog_HAVE_MPICC
if test -n "$HAVE_MPICC"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_MPICC" >&5
$as_echo "$HAVE_MPICC" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test x$HAVE_MPICC = xyes; then
MPICC=mpicc
fi
fi
# Check whether --with-mem-align was given.
if test "${with_mem_align+set}" = set; then :
withval=$with_mem_align; if test x$withval = xyes; then
as_fn_error $? "--with-mem-align must be given a number in bytes" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define __CP_MEM_ALIGNMENT ${withval}
_ACEOF
GOT_ALIGNMENT=1
fi
fi
# Check whether --with-zlib-for-mpi was given.
if test "${with_zlib_for_mpi+set}" = set; then :
withval=$with_zlib_for_mpi; if test x$withval = xyes; then
as_fn_error $? "--with-zlib-for-mpi must be given a path argument" "$LINENO" 5
else
__CP_ZLIB_LINK_FLAGS="-L${withval}/lib"
__CP_ZLIB_INCLUDE_FLAGS="-I ${withval}/include"
fi
fi
# Check whether --with-log-path was given.
if test "${with_log_path+set}" = set; then :
withval=$with_log_path; if test x$withval = xyes; then
as_fn_error $? "--with-log-path must be given a pathname" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define __CP_LOG_PATH "${withval}"
_ACEOF
__CP_LOG_PATH="${withval}"
GOT_LOG_PATH=1
fi
fi
# Check whether --with-jobid-env was given.
if test "${with_jobid_env+set}" = set; then :
withval=$with_jobid_env; if test x$withval = xyes; then
as_fn_error $? "--with-jobid-env must be given a name" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define CP_JOBID "${withval}"
_ACEOF
CP_JOBID="${withval}"
GOT_JOBID=1
fi
fi
saveCC="$CC"
CC="$MPICC"
if test x$HAVE_MPICC != "xyes"; then
as_fn_error $? "must provide --with-mpi=<path> argument to configure if mpicc is not in path." "$LINENO" 5
fi
if test x$GOT_ALIGNMENT != x1; then
as_fn_error $? "must provide --with-mem-align=<num> argument to configure." "$LINENO" 5
fi
if test x$GOT_LOG_PATH != x1; then
as_fn_error $? "must provide --with-log-path=<path> argument to configure." "$LINENO" 5
fi
if test x$GOT_JOBID != x1; then
as_fn_error $? "must provide --with-jobid-env=<name> argument to configure." "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the mpicc compiler works" >&5
$as_echo_n "checking whether the mpicc compiler works... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <mpi.h>
int
main ()
{
int ret = MPI_Init(0, (void*)0)
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "$CC doesn't appear to be a valid MPI compiler" "$LINENO" 5
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
old_cflags="$CFLAGS" old_cflags="$CFLAGS"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE" CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for off64_t" >&5
...@@ -4186,39 +4049,6 @@ rm -f core conftest.err conftest.$ac_objext \ ...@@ -4186,39 +4049,6 @@ rm -f core conftest.err conftest.$ac_objext \
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long int" >&5
$as_echo_n "checking size of long int... " >&6; }
if test "${ac_cv_sizeof_long_int+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long int))" "ac_cv_sizeof_long_int" "$ac_includes_default"; then :
else
if test "$ac_cv_type_long_int" = yes; then
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error 77 "cannot compute sizeof (long int)
See \`config.log' for more details" "$LINENO" 5 ; }
else
ac_cv_sizeof_long_int=0
fi
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_int" >&5
$as_echo "$ac_cv_sizeof_long_int" >&6; }
cat >>confdefs.h <<_ACEOF
#define SIZEOF_LONG_INT $ac_cv_sizeof_long_int
_ACEOF
ac_config_files="$ac_config_files Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl util/bin/darshan-job-summary.pl" ac_config_files="$ac_config_files Makefile darshan-mk-log-dirs.pl darshan-gen-cc.pl darshan-gen-cxx.pl darshan-gen-fortran.pl util/bin/darshan-job-summary.pl"
cat >confcache <<\_ACEOF cat >confcache <<\_ACEOF
......
...@@ -13,9 +13,6 @@ AC_PROG_INSTALL ...@@ -13,9 +13,6 @@ AC_PROG_INSTALL
CHECK_ZLIB CHECK_ZLIB
dnl Check byte ordering
AC_C_BIGENDIAN
AC_ARG_WITH(mpi, AC_ARG_WITH(mpi,
[ --with-mpi=<dir> Location of the MPI installation], [ --with-mpi=<dir> Location of the MPI installation],
if test x$withval = xyes; then if test x$withval = xyes; then
...@@ -78,9 +75,6 @@ AC_ARG_WITH(jobid-env, ...@@ -78,9 +75,6 @@ AC_ARG_WITH(jobid-env,
fi fi
) )