diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-04-24 21:26:32 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-04-24 21:26:32 (GMT) |
commit | 4dcf59ae4461eec74a180d77783d9064d2aa3a58 (patch) | |
tree | 3c720b6ce64b7e81e6e28f773755fe0fb97cfde9 | |
parent | 98b5a7f9c5a881c849cd536579bb121cf185e2db (diff) | |
download | hdf5-4dcf59ae4461eec74a180d77783d9064d2aa3a58.zip hdf5-4dcf59ae4461eec74a180d77783d9064d2aa3a58.tar.gz hdf5-4dcf59ae4461eec74a180d77783d9064d2aa3a58.tar.bz2 |
[svn-r376] ./acconfig.h
./configure.in
./config/BlankForm
./src/H5.c
Configure tries to figure out how to print `long long' types
and then defines PRINTF_LL_WIDTH to be `ll' or `q' or
something. It does this by running little sprintf() programs
with various formats until it gets one that works. If this
causes problems when cross compiling (like with parallel
machines) then you may add the following to the appropriate
config file:
hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} or
hdf5_cv_printf_ll=${hdf5_cv_printf_ll='q'} or
hdf5_cv_printf_ll=${hdf5_cv_printf_ll='l'}
./config/intel-osf1
./config/irix5.3
Updated these config files to match the others. This allows
the `--enable-production' configure flag to work properly.
-rw-r--r-- | acconfig.h | 3 | ||||
-rw-r--r-- | config/BlankForm | 5 | ||||
-rw-r--r-- | config/intel-osf1 | 81 | ||||
-rw-r--r-- | config/irix5.3 | 55 | ||||
-rwxr-xr-x | configure | 57 | ||||
-rw-r--r-- | configure.in | 22 | ||||
-rw-r--r-- | src/H5.c | 35 | ||||
-rw-r--r-- | src/H5config.h.in | 3 |
8 files changed, 185 insertions, 76 deletions
@@ -9,3 +9,6 @@ /* Define if it's safe to use `long long' for hsize_t and hssize_t */ #undef HAVE_LARGE_HSIZET + +/* The width parameter for printf formats for type `long long', us. `ll' */ +#undef PRINTF_LL_WIDTH diff --git a/config/BlankForm b/config/BlankForm index a844dea..5ff807b 100644 --- a/config/BlankForm +++ b/config/BlankForm @@ -41,3 +41,8 @@ PROFILE_CPPFLAGS= # Set this to `yes' or `no' depending on whether the target is big # endian or little endian. #ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} diff --git a/config/intel-osf1 b/config/intel-osf1 index 66c643c..840afd4 100644 --- a/config/intel-osf1 +++ b/config/intel-osf1 @@ -1,55 +1,52 @@ -# Site configuration -- do not distribute this file. +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. + + +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. +# Sometimes a particular compiler must be used. If that's the case +# then uncomment the following line. Otherwise the main configure +# script will try to detect the compiler automatically. CC=cicc AR=xar -RANLIB=true +RANLIB=: LIBS="-L./ -L../ -lnoop_stubs" RUNTEST="yod -sz 1" -export CC AR RANLIB LIBS RUNTEST - -# Based on the setting of environment variable `HDF5_MODE' we set the -# compiler flags unless they're already set. Its value can be one or -# more of the following words (be sure to use single quotes when -# setting its value or the dollar signs will be expanded as variables -# too soon): -# -# $warn -- Generates compiler warnings. You should always -# include this since it has no effect on the speed of -# the code produced. -# -# $debug -- Compiles in code to check for invariant conditions -# and turns on the `-g' flag for interactive -# debugging. It also turns off seek optimizations in -# the low-level file driver. This version of the -# library can be significantly slower than a production -# version. -# -# $production -- Compiles an optimized version of the library -# and disables code that checks for invariant -# conditions. -# -# $profile -- Compiles code with the `-pg' flag which -# produces a `gmon.out' file when the library -# runs. The gprof(1) command can read that file -# and produce detailed run-time statistics. -# +# What must *always* be present for things to compile correctly? +CFLAGS="$CFLAGS -DDOS386" +#CPPFLAGS="$CPPFLAGS -I." -# Unconditionally set the compiler to cicc since the following flags -# only apply to that compiler. +# What compiler flags should be used for code development? +DEBUG_CFLAGS=-g +DEBUG_CPPFLAGS= -warn="" +# What compiler flags should be used for building a production +# library? +PROD_CFLAGS=-O +PROD_CPPFLAGS= -profile="-pg" +# What compiler flags enable code profiling? +PROFILE_CFLAGS=-pg +PROFILE_CPPFLAGS= -debug="-g -DH5AC_DEBUG -DH5B_DEBUG -DH5F_DEBUG -DH5G_DEBUG -UH5O_DEBUG -DH5T_DEBUG -DH5F_OPT_SEEK=0" -production="-O -DNDEBUG" +#---------------------------------------------------------------------------- +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. -default_mode='-DDOS386 $debug $warn -DH5F_LOW_DFLT=H5F_LOW_SEC2' +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} -# Don't set CFLAGS if the user already did. -if test -z "$CFLAGS"; then - CFLAGS="`eval echo ${HDF5_MODE:-$default_mode}`" - export CFLAGS -fi +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} diff --git a/config/irix5.3 b/config/irix5.3 index e24bd25..acc375e 100644 --- a/config/irix5.3 +++ b/config/irix5.3 @@ -1,13 +1,50 @@ -#!/bin/sh -# Site configuration -- do not distribute this file. +# -*- shell-script -*- +# +# This file is part of the HDF5 build script. It is processed shortly +# after configure starts and defines, among other things, flags for +# the various compile modes. -CC="cc" -# -woff 799 about long long type non-standard +#---------------------------------------------------------------------------- +# Compiler flags. The CPPFLAGS values should not include package debug +# flags like `-DH5G_DEBUG' since these are added with the +# `--enable-debug' switch of configure. -RANLIB=: # SGI does not use ranlib +# Sometimes a particular compiler must be used. If that's the case +# then uncomment the following line. Otherwise the main configure +# script will try to detect the compiler automatically. +CC=cc +RANLIB=: + +# What must *always* be present for things to compile correctly? +CFLAGS="$CFLAGS -ansi -fullwarn -woff 799" +#CPPFLAGS="$CPPFLAGS -I." + +# What compiler flags should be used for code development? +DEBUG_CFLAGS=-g +DEBUG_CPPFLAGS= + +# What compiler flags should be used for building a production +# library? +PROD_CFLAGS=-O +PROD_CPPFLAGS= + +# What compiler flags enable code profiling? +PROFILE_CFLAGS=-pg +PROFILE_CPPFLAGS= + + +#---------------------------------------------------------------------------- +# Values for overriding configuration tests when cross compiling. +# This includes compiling on some machines where the serial front end +# compiles for a parallel back end. + +# Set this to `yes' or `no' depending on whether the target is big +# endian or little endian. +#ac_cv_c_bigendian=${ac_cv_c_bigendian='yes'} + +# Set this to the width required by printf() to print type `long +# long'. For instance, if the format would be `%lld' then set it to +# `ll' or if the format would be `%qd' set it to `q'. +#hdf5_cv_printf_ll=${hdf5_cv_printf_ll='ll'} -# Don't set CFLAGS if the user already did. -if test -z "$CFLAGS"; then - CFLAGS="-ansi -fullwarn -woff 799" -fi @@ -2082,8 +2082,49 @@ else fi rm -f conftest* +echo $ac_n "checking how to print long long""... $ac_c" 1>&6 +echo "configure:2087: checking how to print long long" >&5; +if eval "test \"`echo '$''{'hdf5_cv_printf_ll'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + for hdf5_cv_printf_ll in ll q l; do + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 2096 "configure" +#include "confdefs.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + main() {char *s=malloc(128); + long long x = (long long)1048576 * (long long)1048576; + sprintf(s,"%${hdf5_cv_printf_ll}d",x); + exit (strcmp(s,"1099511627776"));} +EOF +if { (eval echo configure:2107: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -fr conftest* +fi + + done +fi + +echo "$ac_t""$hdf5_cv_printf_ll" 1>&6 +cat >> confdefs.h <<EOF +#define PRINTF_LL_WIDTH "$hdf5_cv_printf_ll" +EOF + + + echo $ac_n "checking for debug flags""... $ac_c" 1>&6 -echo "configure:2087: checking for debug flags" >&5; +echo "configure:2128: checking for debug flags" >&5; # Check whether --enable-debug or --disable-debug was given. if test "${enable_debug+set}" = set; then enableval="$enable_debug" @@ -2121,7 +2162,7 @@ if test "${enable_parallel+set}" = set; then fi echo $ac_n "checking for parallel support""... $ac_c" 1>&6 -echo "configure:2125: checking for parallel support" >&5; +echo "configure:2166: checking for parallel support" >&5; @@ -2148,7 +2189,7 @@ EOF CFLAGS="$CFLAGS $MPI_LIB" RUNTEST="$RUNTEST" echo $ac_n "checking for main in -lmpi""... $ac_c" 1>&6 -echo "configure:2152: checking for main in -lmpi" >&5 +echo "configure:2193: checking for main in -lmpi" >&5 ac_lib_var=`echo mpi'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2156,14 +2197,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpi $LIBS" cat > conftest.$ac_ext <<EOF -#line 2160 "configure" +#line 2201 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2167: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2208: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2190,7 +2231,7 @@ else echo "$ac_t""no" 1>&6 fi echo $ac_n "checking for main in -lmpio""... $ac_c" 1>&6 -echo "configure:2194: checking for main in -lmpio" >&5 +echo "configure:2235: checking for main in -lmpio" >&5 ac_lib_var=`echo mpio'_'main | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2198,14 +2239,14 @@ else ac_save_LIBS="$LIBS" LIBS="-lmpio $LIBS" cat > conftest.$ac_ext <<EOF -#line 2202 "configure" +#line 2243 "configure" #include "confdefs.h" int main() { main() ; return 0; } EOF -if { (eval echo configure:2209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else diff --git a/configure.in b/configure.in index b4f36af..676fcdc 100644 --- a/configure.in +++ b/configure.in @@ -204,6 +204,28 @@ AC_TRY_COMPILE(,[int f(void){return __FUNCTION__;}], AC_MSG_RESULT(no)) dnl ---------------------------------------------------------------------- +dnl Try to figure out how to print `long long'. Some machines use `%lld' +dnl and others use `%qd'. There may be more! The final `l' is a +dnl default in case none of the others work. +dnl +AC_MSG_CHECKING(how to print long long); +AC_CACHE_VAL(hdf5_cv_printf_ll, + for hdf5_cv_printf_ll in ll q l; do + AC_TRY_RUN([ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + main() {char *s=malloc(128); + long long x = (long long)1048576 * (long long)1048576; + sprintf(s,"%${hdf5_cv_printf_ll}d",x); + exit (strcmp(s,"1099511627776"));}], + break) + done) +AC_MSG_RESULT($hdf5_cv_printf_ll) +AC_DEFINE_UNQUOTED(PRINTF_LL_WIDTH,"$hdf5_cv_printf_ll") + + +dnl ---------------------------------------------------------------------- dnl Turn on debugging by setting compiler flags dnl AC_MSG_CHECKING(for debug flags); @@ -462,7 +462,7 @@ HDfprintf (FILE *stream, const char *fmt, ...) int plussign; int ldspace; int prefix; - int modifier; + char modifier[8]; int conv; char *rest, template[128]; const char *s; @@ -479,7 +479,7 @@ HDfprintf (FILE *stream, const char *fmt, ...) plussign = 0; prefix = 0; ldspace = 0; - modifier = 0; + modifier[0] = '\0'; if ('%'==fmt[0] && '%'==fmt[1]) { putc ('%', stream); @@ -539,13 +539,14 @@ HDfprintf (FILE *stream, const char *fmt, ...) switch (*s) { case 'H': if (sizeof(hsize_t)==sizeof(long)) { - modifier = 'l'; + strcpy (modifier, "l"); } else if (sizeof(hsize_t)==sizeof(long long)) { - modifier = 'q'; + strcpy (modifier, PRINTF_LL_WIDTH); } break; default: - modifier = *s; + modifier[0] = *s; + modifier[1] = '\0'; break; } s++; @@ -565,7 +566,7 @@ HDfprintf (FILE *stream, const char *fmt, ...) sprintf (template+strlen (template), ".%d", prec); } if (modifier) { - sprintf (template+strlen (template), "%c", modifier); + sprintf (template+strlen (template), "%s", modifier); } sprintf (template+strlen (template), "%c", conv); @@ -574,16 +575,16 @@ HDfprintf (FILE *stream, const char *fmt, ...) switch (conv) { case 'd': case 'i': - if ('h'==modifier) { + if (!strcmp (modifier, "h")) { short x = va_arg (ap, short); n = fprintf (stream, template, x); - } else if (!modifier) { + } else if (!*modifier) { int x = va_arg (ap, int); n = fprintf (stream, template, x); - } else if ('l'==modifier) { + } else if (!strcmp (modifier, "l")) { long x = va_arg (ap, long); n = fprintf (stream, template, x); - } else if ('q'==modifier) { + } else { long long x = va_arg (ap, long long); n = fprintf (stream, template, x); } @@ -593,16 +594,16 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'u': case 'x': case 'X': - if ('h'==modifier) { + if (!strcmp (modifier, "h")) { unsigned short x = va_arg (ap, unsigned short); n = fprintf (stream, template, x); - } else if (!modifier) { + } else if (!*modifier) { unsigned int x = va_arg (ap, unsigned int); n = fprintf (stream, template, x); - } else if ('l'==modifier) { + } else if (!strcmp (modifier, "l")) { unsigned long x = va_arg (ap, unsigned long); n = fprintf (stream, template, x); - } else if ('q'==modifier) { + } else { unsigned long long x = va_arg (ap, unsigned long long); n = fprintf (stream, template, x); } @@ -613,13 +614,13 @@ HDfprintf (FILE *stream, const char *fmt, ...) case 'E': case 'g': case 'G': - if ('h'==modifier) { + if (!strcmp (modifier, "h")) { float x = va_arg (ap, float); n = fprintf (stream, template, x); - } else if (!modifier || 'l'==modifier) { + } else if (!*modifier || !strcmp (modifier, "l")) { double x = va_arg (ap, double); n = fprintf (stream, template, x); - } else if ('q'==modifier) { + } else { long double x = va_arg (ap, long double); n = fprintf (stream, template, x); } diff --git a/src/H5config.h.in b/src/H5config.h.in index 9bb277a..fbe2c73 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -31,6 +31,9 @@ /* Define if it's safe to use `long long' for hsize_t and hssize_t */ #undef HAVE_LARGE_HSIZET +/* The width parameter for printf formats for type `long long', us. `ll' */ +#undef PRINTF_LL_WIDTH + /* The number of bytes in a double. */ #undef SIZEOF_DOUBLE |