summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-01-27 21:45:23 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-01-27 21:45:23 (GMT)
commit1454a458262dd012c94f56ccc55ccbbe57b63399 (patch)
tree3924efe3b45657d02b8dcc394df30626591a6610
parent7afa7bb6afd1cf4daee58010e4f9411262abeab9 (diff)
downloadhdf5-1454a458262dd012c94f56ccc55ccbbe57b63399.zip
hdf5-1454a458262dd012c94f56ccc55ccbbe57b63399.tar.gz
hdf5-1454a458262dd012c94f56ccc55ccbbe57b63399.tar.bz2
[svn-r28996] Autotools configure updates to allow separation of build type, debug
symbols, asserts, profiling, and optimization. Also much refactoring, improved help, and --enable-<foo> options will now emit errors on nonsense (e.g.: --enable-foo="asdfasdf"). The libhdf5.settings.in file was also reformatted. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial and parallel autotools w/ various options
-rw-r--r--config/cce-fflags17
-rw-r--r--config/cce-flags18
-rw-r--r--config/gnu-fflags16
-rw-r--r--config/gnu-flags47
-rw-r--r--config/ibm-flags29
-rw-r--r--config/intel-fflags16
-rw-r--r--config/intel-flags20
-rw-r--r--config/linux-gnulibc12
-rw-r--r--config/pgi-fflags16
-rw-r--r--config/pgi-flags36
-rw-r--r--configure.ac799
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/H5.c133
-rw-r--r--src/libhdf5.settings.in70
14 files changed, 848 insertions, 373 deletions
diff --git a/config/cce-fflags b/config/cce-fflags
index 896e711..b96551d 100644
--- a/config/cce-fflags
+++ b/config/cce-fflags
@@ -53,14 +53,23 @@ if test "X-cce" = "X-$f9x_vendor"; then
# Production
# -Wl,-s to remove all symbols for smaller file
- PROD_FCFLAGS="-O3 -Wl,-s"
+ # Note that this will likely override the symbols flag
+ PROD_FCFLAGS="-Wl,-s"
# Debug
- DEBUG_FCFLAGS="-g -O0"
+ DEBUG_FCFLAGS=
- # Profile
+ # Symbols
+ SYMBOLS_FCFLAGS="-g"
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_FCFLAGS="-g -p"
+ PROFILE_FCFLAGS="-p"
+
+ # Optimization
+ HIGH_OPT_FCFLAGS="-O3"
+ DEBUG_OPT_FCFLAGS="-O0"
+ NO_OPT_FCFLAGS="-O0"
# Flags are set
f9x_flags_set=yes
diff --git a/config/cce-flags b/config/cce-flags
index a34fcbe..bdfb5f9 100644
--- a/config/cce-flags
+++ b/config/cce-flags
@@ -55,18 +55,28 @@ if test "X-cce" = "X-$cc_vendor"; then
# Production
# -Wl,-s to remove all symbols for smaller file
- PROD_CFLAGS="-O3 -Wl,-s"
+ PROD_CFLAGS="-Wl,-s"
PROD_CPPFLAGS=
# Debug
- DEBUG_CFLAGS="-g -O0"
+ # NDEBUG is handled explicitly in configure
+ DEBUG_CFLAGS=
DEBUG_CPPFLAGS=
- # Profile
+ # Symbols
+ SYMBOL_CFLAGS="-g"
+ SYMBOL_CPPFLAGS=
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_CFLAGS="-g -p"
+ PROFILE_CFLAGS="-p"
PROFILE_CPPFLAGS=
+ # Optimization
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS="-O0"
+ NO_OPT_CFLAGS="-O0"
+
# Flags are set
cc_flags_set=yes
diff --git a/config/gnu-fflags b/config/gnu-fflags
index 911a264..3a90c10 100644
--- a/config/gnu-fflags
+++ b/config/gnu-fflags
@@ -83,13 +83,21 @@ if test "X-gfortran" = "X-$f9x_vendor"; then
H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type"
# Production
- PROD_FCFLAGS="-O2 -s"
+ PROD_FCFLAGS="-s"
# Debug
- DEBUG_FCFLAGS="-g -fbounds-check"
+ DEBUG_FCFLAGS="-fbounds-check"
- # Profile
- PROFILE_FCFLAGS="-g -pg"
+ # Symbols
+ SYMBOLS_FCFLAGS="-g"
+
+ # Profiling
+ PROFILE_FCFLAGS="-pg"
+
+ # Optimization
+ HIGH_OPT_FCFLAGS="-O2"
+ DEBUG_OPT_FCFLAGS="-O0"
+ NO_OPT_FCFLAGS="-O0"
# Flags are set
f9x_flags_set=yes
diff --git a/config/gnu-flags b/config/gnu-flags
index e7f8f14..232bf05 100644
--- a/config/gnu-flags
+++ b/config/gnu-flags
@@ -97,39 +97,64 @@ case "$cc_vendor-$cc_version" in
H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline"
# Production
+ # NDEBUG is handled explicitly by the configure script
case "$cc_vendor-$cc_version" in
gcc-[34].*)
- PROD_CFLAGS="-O3"
+ PROD_CFLAGS=
;;
gcc-5.*)
- PROD_CFLAGS="-O3 -fstdarg-opt"
+ PROD_CFLAGS="-fstdarg-opt"
;;
*)
- PROD_CFLAGS="-O -finline-functions"
+ # gcc automatically inlines based on the optimization level
+ # this is just a failsafe
+ PROD_CFLAGS="-finline-functions"
;;
esac
- PROD_CPPFLAGS=
# Debug
+ # NDEBUG is handled explicitly by the configure script
+ # -g is hanled by the symbols flags
case "$cc_vendor-$cc_version" in
gcc-5.*)
- DEBUG_CFLAGS="-Og -g -ftrapv -fno-common"
+ DEBUG_CFLAGS="-ftrapv -fno-common"
;;
*)
- DEBUG_CFLAGS="-g"
+ DEBUG_CFLAGS=
;;
esac
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined"
+ #DEBUG_CFLAGS="-fsanitize=undefined"
DEBUG_CPPFLAGS=
- # Try out the new "stack protector" feature introduced in gcc 4.1
- # (We should also think about adding some of the other memory protection options)
- #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
+ # Symbols
+ SYMBOL_CFLAGS="-g"
+ SYMBOL_CPPFLAGS=
# Profile
- PROFILE_CFLAGS="-Og -g -pg"
+ PROFILE_CFLAGS="-pg"
PROFILE_CPPFLAGS=
+ # Optimization (only CFLAGS at this time)
+ case "$cc_vendor-$cc_version" in
+ gcc-[34].*)
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS=
+ ;;
+ gcc-5.*)
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS="-Og"
+ ;;
+ *)
+ HIGH_OPT_CFLAGS="-O"
+ DEBUG_OPT_CFLAGS=
+ ;;
+ esac
+ NO_OPT_CFLAGS="-O0"
+
+ # Try out the new "stack protector" feature introduced in gcc 4.1
+ # (We should also think about adding some of the other memory protection options)
+ #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all"
+
# Flags are set
cc_flags_set=yes
;;
diff --git a/config/ibm-flags b/config/ibm-flags
index 462372d..731968d 100644
--- a/config/ibm-flags
+++ b/config/ibm-flags
@@ -55,19 +55,38 @@ if test "XL" = "$cc_vendor"; then
# Turn off shared lib option. It causes some test suite to fail.
enable_shared="${enable_shared:-no}"
+
# Make sure this is applied to other API compile options such as C++.
AM_CFLAGS="$AM_CFLAGS"
+
# -qflag=w:w makes the lowest level of reported compile issues to be "warning"
# instead of "information". This suppresses a very large number of messages
# concerning the portability of __inline__.
H5_CFLAGS="-qlanglvl=stdc99 -qflag=w:w $H5_CFLAGS"
- DEBUG_CFLAGS="-g -qfullpath"
- DEBUG_CPPFLAGS=
- # -O causes test/dtypes to fail badly. Turn it off for now.
- PROD_CFLAGS=""
+
+ # Produciton
+ PROD_CFLAGS=
PROD_CPPFLAGS=
- PROFILE_CFLAGS="-g -qfullpath -pg"
+
+ # Debug
+ # NDEBUG is handled explicitly in configure
+ DEBUG_CFLAGS="-qfullpath"
+ DEBUG_CPPFLAGS=
+
+ # Symbols
+ SYMBOL_CFLAGS="-g"
+ SYMBOL_CPPFLAGS=
+
+ # Profiling
+ PROFILE_CFLAGS="-pg"
PROFILE_CPPFLAGS=
+
+ # Optimization
+ # -O causes test/dtypes to fail badly. Turn it off for now.
+ HIGH_OPT_CFLAGS=
+ DEBUG_OPT_CFLAGS=
+ NO_OPT_CFLAGS=
+
# Flags are set
cc_flags_set=yes
fi
diff --git a/config/intel-fflags b/config/intel-fflags
index 3e33fc9..1f7cf78 100644
--- a/config/intel-fflags
+++ b/config/intel-fflags
@@ -73,14 +73,22 @@ if test "X-ifort" = "X-$f9x_vendor"; then
H5_FCFLAGS="$H5_FCFLAGS"
# Production
- PROD_FCFLAGS="-O3"
+ PROD_FCFLAGS=
# Debug
- DEBUG_FCFLAGS="-g -check all"
+ DEBUG_FCFLAGS="-check all"
- # Profile
+ # Symbols
+ SYMBOLS_FCFLAGS="-g"
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_FCFLAGS="-g -p"
+ PROFILE_FCFLAGS="-p"
+
+ # Optimization
+ HIGH_OPT_FCFLAGS="-O3"
+ DEBUG_OPT_FCFLAGS=
+ NO_OPT_FCFLAGS=
# Flags are set
f9x_flags_set=yes
diff --git a/config/intel-flags b/config/intel-flags
index 3187daf..a3238fa 100644
--- a/config/intel-flags
+++ b/config/intel-flags
@@ -68,21 +68,31 @@ if test "X-icc" = "X-$cc_vendor"; then
# General
# Default to C99 standard.
- H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch}"
+ H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall"
# Production is set to default; see settings for specific version further down
- PROD_CFLAGS="-O"
+ PROD_CFLAGS=
PROD_CPPFLAGS=
# Debug
- DEBUG_CFLAGS="-Wcheck -Wall -g -O0"
+ # NDEBUG is handled explicitly in configure
+ DEBUG_CFLAGS=
DEBUG_CPPFLAGS=
- # Profile
+ # Symbols
+ SYMBOL_CFLAGS="-g"
+ SYMBOL_CPPFLAGS=
+
+ # Profiling
# Use this for profiling with gprof
- PROFILE_CFLAGS="-g -p"
+ PROFILE_CFLAGS="-p"
PROFILE_CPPFLAGS=
+ # Optimization
+ HIGH_OPT_CFLAGS="-O"
+ DEBUG_OPT_CFLAGS="-O0"
+ NO_OPT_CFLAGS="-O0"
+
# Flags are set
cc_flags_set=yes
diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1
index 405fa34..46771dc 100644
--- a/config/linux-gnulibc1
+++ b/config/linux-gnulibc1
@@ -51,7 +51,7 @@ if test "X-" = "X-$FC"; then
FC=gfortran
FC_BASENAME=gfortran
;;
- pgcc*)
+ pgcc*)
FC=pgf90
FC_BASENAME=pgf90
;;
diff --git a/config/pgi-fflags b/config/pgi-fflags
index 8e574e4..fbcba52 100644
--- a/config/pgi-fflags
+++ b/config/pgi-fflags
@@ -87,12 +87,20 @@ if test "X-pgf90" = "X-$f9x_vendor"; then
PROD_FCFLAGS="-fast -s -Mnoframe"
# Debug
- DEBUG_FCFLAGS="-g -Mbounds -Mchkptr -Mdclchk"
+ DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk"
- # Profile
- PROFILE_FCFLAGS="-g -Mprof=func,line"
+ # Symbols
+ SYMBOLS_FCFLAGS="-g"
+
+ # Profiling
+ PROFILE_FCFLAGS="-Mprof=func,line"
# Use this for profiling with gprof
- #PROFILE_FCFLAGS="-g -pg"
+ #PROFILE_FCFLAGS="-pg"
+
+ # Optimization
+ HIGH_OPT_FCFLAGS=
+ DEBUG_OPT_FCFLAGS=
+ NO_OPT_FCFLAGS=
# Flags are set
f9x_flags_set=yes
diff --git a/config/pgi-flags b/config/pgi-flags
index 29e6f05..674f60e 100644
--- a/config/pgi-flags
+++ b/config/pgi-flags
@@ -72,13 +72,11 @@ if test "X-pgcc" = "X-$cc_vendor"; then
# Production
case "$cc_vendor-$cc_version" in
- # Tweak down compiler optimizations for v10.6, it has a bug
pgcc-10.6*)
- PROD_CFLAGS="-O1 -s"
+ PROD_CFLAGS="-s"
;;
- # Tweak down compiler optimizations for v9.x
pgcc-9.*)
- PROD_CFLAGS="-O1 -s"
+ PROD_CFLAGS="-s"
;;
*)
PROD_CFLAGS="-fast -s"
@@ -87,15 +85,37 @@ if test "X-pgcc" = "X-$cc_vendor"; then
PROD_CPPFLAGS=
# Debug
- DEBUG_CFLAGS="-g -Mbounds"
+ # NDEBUG is handled explicitly by the configure script
+ DEBUG_CFLAGS="-Mbounds"
DEBUG_CPPFLAGS=
- # Profile
- PROFILE_CFLAGS="-g -Mprof=func,line"
+ # Symbols
+ SYMBOL_CFLAGS="-g"
+ SYMBOL_CPPFLAGS=
+
+ # Profiling
+ PROFILE_CFLAGS="-Mprof=func,line"
# Use this for profiling with gprof
- #PROFILE_CFLAGS="-g -pg"
+ #PROFILE_CFLAGS="-pg"
PROFILE_CPPFLAGS=
+ # Optimization
+ case "$cc_vendor-$cc_version" in
+ # Tweak down compiler optimizations for v10.6, it has a bug
+ pgcc-10.6*)
+ HIGH_OPT_CFLAGS="-O1"
+ ;;
+ # Tweak down compiler optimizations for v9.x
+ pgcc-9.*)
+ HIGH_OPT_CFLAGS="-O1"
+ ;;
+ *)
+ HIGH_OPT_CFLAGS=
+ ;;
+ esac
+ DEBUG_OPT_CFLAGS=
+ NO_OPT_CFLAGS=
+
# Flags are set
cc_flags_set=yes
diff --git a/configure.ac b/configure.ac
index ce303b9..2f81607 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,46 +151,64 @@ AC_MSG_CHECKING([shell variables initial values])
set >&AS_MESSAGE_LOG_FD
AC_MSG_RESULT([done])
-## Define all symbol variables used for configure summary.
-## EXTERNAL_FILTERS equals all external filters. Default none.
-## MPE: whether MPE option is enabled. Default no.
-## STATIC_EXEC: whether static-exec is enabled. Default no.
-## HDF_FORTRAN: whether Fortran is enabled. Default no.
-## FC: Fortran compiler.
-## HDF_CXX: whether C++ is enabled. Default no.
-## CXX: C++ compiler.
-## HDF5_HL: whether high-level library is enabled. Default is yes.
-## INSTRUMENT: whether INSTRUMENT is enabled. No default set here.
-## CODESTACK: whether CODESTACK is enabled. Default no.
-## HAVE_DMALLOC: whether system has dmalloc support. Default no.
-## HAVE_FLOAT128: whether system has Quad-Precision Math Library. Default no.
-## DIRECT_VFD: whether DIRECT_VFD is enabled. Default no.
-## THREADSAFE: whether THREADSAFE is enabled. Default no.
-## STATIC_SHARED: whether static and/or shared libraries are requested.
-## enable_shared: whether shared lib is enabled.
-## enable_static: whether static lib is enabled.
-## UNAME_INFO: System information.
+## ----------------------------------------------------------------------
+## Save system information for the library settings file.
+##
+AC_SUBST([UNAME_INFO])
+UNAME_INFO=`uname -a`
+
+## ----------------------------------------------------------------------
+## Determine build mode (debug, production, clean).
+## This has to be done early since the build mode is referred to
+## frequently.
+##
+AC_MSG_CHECKING([build mode])
+AC_ARG_ENABLE([build-mode],
+ [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)],
+ [Sets the build mode. Debug turns on symbols, API
+ tracing, asserts, and debug optimization,
+ as well as several other minor configure options
+ that aid in debugging.
+ Production turns high optimizations on.
+ Clean turns nothing on and disables optimization
+ (i.e.: a 'clean slate' configuration).
+ All these settings can be overridden by using
+ specific configure flags.
+ [default=debug]
+ ])],
+ [BUILD_MODE=$enableval])
-AC_SUBST([EXTERNAL_FILTERS])
-AC_SUBST([MPE]) MPE=no
-AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no
-AC_SUBST([HDF_FORTRAN]) HDF_FORTRAN=no
-AC_SUBST([FC]) HDF_FORTRAN=no
-AC_SUBST([HDF_CXX]) HDF_CXX=no
-AC_SUBST([CXX]) HDF_CXX=no
-AC_SUBST([HDF5_HL]) HDF5_HL=yes
-AC_SUBST([INSTRUMENT])
-AC_SUBST([CODESTACK]) CODESTACK=no
-AC_SUBST([HAVE_DMALLOC]) HAVE_DMALLOC=no
-AC_SUBST([DIRECT_VFD]) DIRECT_VFD=no
-AC_SUBST([THREADSAFE]) THREADSAFE=no
-AC_SUBST([STATIC_SHARED])
-AC_SUBST([enable_shared])
-AC_SUBST([enable_static])
-AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a`
-AC_SUBST([PAC_C_MAX_REAL_PRECISION])
-AC_SUBST([Fortran_COMPILER_ID])
-Fortran_COMPILER_ID=none
+## Set the default
+## Depends on branch, set via script at branch creation time
+if test "X-$BUILD_MODE" = X- ; then
+ BUILD_MODE=debug
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([BUILD_MODE])
+
+case "X-$BUILD_MODE" in
+ X-clean)
+ AC_MSG_RESULT([clean])
+ ;;
+ X-debug)
+ H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS"
+ H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS"
+ AC_MSG_RESULT([debug])
+ ;;
+ X-production)
+ H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS"
+ H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS"
+ AC_MSG_RESULT([production])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.])
+esac
## ----------------------------------------------------------------------
## Some platforms have broken basename, and/or xargs programs. Check
@@ -373,7 +391,9 @@ AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
+## ----------------------------------------------------------------------
## Check for non-standard extenstion __FLOAT128
+##
HAVE_FLOAT128=0
HAVE_QUADMATH=0
FLT128_DIG=0
@@ -384,6 +404,8 @@ AC_CHECK_SIZEOF([_Quad])
AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], [])
PAC_FC_LDBL_DIG
+AC_SUBST([PAC_C_MAX_REAL_PRECISION])
+
if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then
AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available])
PAC_C_MAX_REAL_PRECISION=$FLT128_DIG
@@ -392,9 +414,17 @@ else
fi
AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C])
AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION])
+
## ----------------------------------------------------------------------
## Check if they would like the Fortran interface compiled
##
+
+## This needs to be exposed for the library info file even if Fortran is disabled.
+AC_SUBST([HDF_FORTRAN])
+
+## Default is no Fortran
+HDF_FORTRAN=no
+
AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES=""
AC_MSG_CHECKING([if Fortran interface enabled])
AC_ARG_ENABLE([fortran],
@@ -417,7 +447,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
AC_CONFIG_HEADERS([fortran/src/H5config_f.inc],
[cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc])
- AC_SUBST([FC]) HDF_FORTRAN=yes
+ AC_SUBST([FC])
HDF5_INTERFACES="$HDF5_INTERFACES fortran"
@@ -520,6 +550,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
AC_SUBST([H5CONFIG_F_RKIND_SIZEOF])
AC_SUBST([H5CONFIG_F_NUM_IKIND])
AC_SUBST([H5CONFIG_F_IKIND])
+ AC_SUBST([Fortran_COMPILER_ID])
+ Fortran_COMPILER_ID=none
AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID])
## Setting definition if there is a 16 byte fortran integer
@@ -609,11 +641,17 @@ fi
## ----------------------------------------------------------------------
## Check if they would like the C++ interface compiled
##
+## This needs to be exposed for the library info file even if C++ is disabled.
+AC_SUBST([HDF_CXX])
+
+## Default is no C++
+HDF_CXX=no
+
## We need to check for a C++ compiler unconditionally, since
## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will
## miss even if c++ is not enabled.
- AC_PROG_CXX
- AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done
+AC_PROG_CXX
+AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done
AC_MSG_CHECKING([if c++ interface enabled])
@@ -626,19 +664,22 @@ if test "X$HDF_CXX" = "Xyes"; then
echo "yes"
HDF5_INTERFACES="$HDF5_INTERFACES c++"
+ ## Expose the compiler for *.in files
+ AC_SUBST([CXX])
+
## Change to the C++ language
AC_LANG_PUSH(C++)
- # Checking if C++ needs old style header files in includes
+ ## Checking if C++ needs old style header files in includes
PAC_PROG_CXX_HEADERS
- # Checking if C++ can handle namespaces
+ ## Checking if C++ can handle namespaces
PAC_PROG_CXX_NAMESPACE
- # Checking if C++ has offsetof extension
+ ## Checking if C++ has offsetof extension
PAC_PROG_CXX_OFFSETOF
- # if C++ can handle static cast
+ ## if C++ can handle static cast
PAC_PROG_CXX_STATIC_CAST
else
@@ -654,23 +695,41 @@ AC_LANG_POP(C++)
## Check if they would like the High Level library compiled
##
-AC_SUBST(HL) HL=""
-## name of fortran folder inside "hl", if FORTRAN compile is requested
-AC_SUBST(HL_FOR) HL_FOR=""
-AC_MSG_CHECKING([if high level library is enabled])
+## This needs to be exposed for the library info file even if the HL
+## library is disabled.
+AC_SUBST([HDF5_HL])
+
+## The high-level library is enabled unless the build mode is clean.
+if test "X-$BUILD_MODE" = "X-clean" ; then
+ HDF5_HL=no
+else
+ HDF5_HL=yes
+fi
+
+## high-level library directories (set when needed, blank until then)
+##
+## main high-level library
+AC_SUBST(HL)
+HL=""
+## Fortran high-level library
+AC_SUBST(HL_FOR)
+HL_FOR=""
+
+AC_MSG_CHECKING([if the high-level library is enabled])
AC_ARG_ENABLE([hl],
[AS_HELP_STRING([--enable-hl],
- [Enable the high level library [default=yes]])],
- [HDF5_HL=$enableval],
- [HDF5_HL=yes])
+ [Enable the high-level library.
+ [default=yes (unless build mode = clean)]
+ ])],
+ [HDF5_HL=$enableval])
-if test "X$HDF5_HL" = "Xyes"; then
- echo "yes"
+if test "X-$HDF5_HL" = "X-yes"; then
+ AC_MSG_RESULT([yes])
HL="hl"
AC_DEFINE([INCLUDE_HL], [1],
- [Define if HDF5's high-level library headers should be included in hdf5.h])
+ [Define if the high-level library headers should be included in hdf5.h])
else
- echo "no"
+ AC_MSG_RESULT([no])
fi
@@ -693,7 +752,8 @@ AC_PROG_INSTALL
## ----------------------------------------------------------------------
-## Set up ${TR} which is used to process DEBUG_PKG.
+## Set up ${TR} which is used to process the package list for extra
+## debugging output in the C library.
AC_PATH_PROG([TR], [tr])
@@ -829,6 +889,11 @@ LT_INIT([dlopen,win32-dll])
## This check needs to occur after libtool is initialized because
## we check a libtool cache value and may issue a warning based
## on its result.
+AC_SUBST([STATIC_EXEC])
+
+## Default is no
+STATIC_EXEC=no
+
AC_MSG_CHECKING([if we should install only statically linked executables])
AC_ARG_ENABLE([static_exec],
[AS_HELP_STRING([--enable-static-exec],
@@ -840,8 +905,8 @@ if test "X$STATIC_EXEC" = "Xyes"; then
echo "yes"
## Issue a warning if -static flag is not supported.
if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then
- echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries."
- LT_STATIC_EXEC=""
+ echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries."
+ LT_STATIC_EXEC=""
else
LT_STATIC_EXEC="-all-static"
fi
@@ -890,50 +955,6 @@ case "X-$RPATH" in
esac
## ----------------------------------------------------------------------
-## Production flags? Save the value in $CONFIG_MODE so we have it for
-## the record.
-##
-AC_MSG_CHECKING([for production mode])
-AC_ARG_ENABLE([production],
- [AS_HELP_STRING([--enable-production],
- [Determines how to run the compiler.])])
-
-case "X-$enable_production" in
- X-yes)
- enable_production="yes"
- AC_MSG_RESULT([production])
- CONFIG_MODE=production
- H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS"
- H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS"
- H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS"
- H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS"
- ;;
- X-|X-no)
- enable_production="no"
- AC_MSG_RESULT([development])
- CONFIG_MODE=development
- H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS"
- H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS"
- H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS"
- H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS"
- ;;
- X-pg|X-profile)
- enable_production="profile"
- AC_MSG_RESULT([profile])
- CONFIG_MODE=profile
- H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS"
- H5_CPPFLAGS="$H5_CPPFLAGS $PROFILE_CPPFLAGS"
- H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS"
- H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS"
- ;;
- *)
- enable_production="user-defined"
- AC_MSG_RESULT([user-defined])
- CONFIG_MODE="$enableval"
- ;;
-esac
-
-## ----------------------------------------------------------------------
## Check for system libraries. "dl" stands for dynamically loaded library
##
AC_CHECK_LIB([m], [ceil])
@@ -1182,6 +1203,11 @@ AC_ARG_WITH([fnord],
## command-line switch. The value is an include path and/or a library path.
## If the library path is specified then it must be preceded by a comma.
##
+AC_SUBST([HAVE_DMALLOC])
+
+## Default is not present
+HAVE_DMALLOC=no
+
AC_ARG_WITH([dmalloc],
[AS_HELP_STRING([--with-dmalloc=DIR],
[Use dmalloc memory debugging aid [default=no]])],,
@@ -1246,6 +1272,14 @@ case $withval in
esac
## ----------------------------------------------------------------------
+## Make the external filters list available to *.in files
+## At this point it's unset (no external filters by default) but it
+## will be filled in during the deflate (zlib) and szip processing
+## below.
+##
+AC_SUBST([EXTERNAL_FILTERS])
+
+## ----------------------------------------------------------------------
## Is the GNU zlib present? It has a header file `zlib.h' and a library
## `-lz' and their locations might be specified with the `--with-zlib'
## command-line switch. The value is an include path and/or a library path.
@@ -1335,7 +1369,7 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2"
if test "X$EXTERNAL_FILTERS" != "X"; then
EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
fi
- EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)"
+ EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)"
fi
@@ -1458,13 +1492,13 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
if test "X$EXTERNAL_FILTERS" != "X"; then
EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
fi
- EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
+ EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)"
fi
if test ${hdf5_cv_szlib_can_encode} = "no"; then
if test "X$EXTERNAL_FILTERS" != "X"; then
EXTERNAL_FILTERS="${EXTERNAL_FILTERS},"
fi
- EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
+ EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)"
fi
fi
@@ -1477,6 +1511,11 @@ AC_CACHE_SAVE
## Enable thread-safe version of library. It requires Pthreads support
## on POSIX systems.
##
+AC_SUBST([THREADSAFE])
+
+## Default is no thread-safety
+THREADSAFE=no
+
AC_MSG_CHECKING([for thread safe support])
AC_ARG_ENABLE([threadsafe],
[AS_HELP_STRING([--enable-threadsafe],
@@ -1484,7 +1523,7 @@ AC_ARG_ENABLE([threadsafe],
[default=no]])],
[THREADSAFE=$enableval])
-## NOTE: The high-level, C++, and Fortran interfaces are not compatible
+## The high-level, C++, and Fortran interfaces are not compatible
## with the thread-safety option because the lock is not hoisted
## into the higher-level API calls.
@@ -1837,56 +1876,277 @@ AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u])
AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"],
[Width for printf() for type `long long' or `__int64', use `ll'])
-
## ----------------------------------------------------------------------
-## Turn on debugging by setting compiler flags
-## This must come after the enable-production since it depends on production.
+## Deprecate old ways of determining debug/production build
+## These can probably be removed in the future (1.10.1?)
##
-AC_MSG_CHECKING([for debug flags])
AC_ARG_ENABLE([debug],
- [AS_HELP_STRING([--enable-debug=all],
- [Turn on debugging in all packages. One may
- also specify a comma-separated list of
- package names without the leading H5 or
- the word no. The default is most packages
- if production is disabled; no if it is enabled.
+ [AS_HELP_STRING([--enable-debug],
+ [DEPRECATED: use --enable-build-mode=debug])],
+ [DEPRECATED_DEBUG=$enableval])
+
+if test "X-$DEPRECATED_DEBUG" != "X-" ; then
+ AC_MSG_ERROR([--enable-debug is deprecated, use --enable-build-mode=debug instead.])
+fi
+
+AC_ARG_ENABLE([production],
+ [AS_HELP_STRING([--enable-production],
+ [DEPRECATED: use --enable-build-mode=production])],
+ [DEPRECATED_PRODUCTION=$enableval])
+
+if test "X-$DEPRECATED_PRODUCTION" != "X-" ; then
+ AC_MSG_ERROR([--enable-production is deprecated, use --enable-build-mode=production instead.])
+fi
+
+
+## ----------------------------------------------------------------------
+## Check if the compiler should include symbols
+##
+AC_MSG_CHECKING([enable debugging symbols])
+AC_ARG_ENABLE([symbols],
+ [AS_HELP_STRING([--enable-symbols=(yes|no|<custom>)],
+ [Add debug symbols to the library (e.g.: build with -g).
+ This is independent of the build mode and optimization
+ level. The custom string allows special settings like
+ -ggdb, etc. to be used.
+ [default=yes if debug build, otherwise no]
])],
- [DEBUG_PKG=$enableval])
+ [SYMBOLS=$enableval])
-## Default to no if producton is enabled
-if test "X-$DEBUG_PKG" = X- ; then
- if test "$enable_production" = yes ; then
- DEBUG_PKG=no
- else
- DEBUG_PKG=yes
- fi
+## Set default
+if test "X-$SYMBOLS" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ SYMBOLS=yes
+ else
+ SYMBOLS=no
+ fi
fi
-AC_SUBST([DEBUG_PKG])
-all_packages="AC,B,B2,D,F,I,HL,O,S,ST,T,Z"
-case "X-$DEBUG_PKG" in
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([SYMBOLS])
+
+case "X-$SYMBOLS" in
X-yes)
- DEBUG_PKG="D,F,I,O,S,T,Z"
-## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG"
- AC_MSG_RESULT([default ($DEBUG_PKG)])
+ H5_CFLAGS="$H5_CFLAGS $SYMBOLS_CFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS_CXXFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS_FCFLAGS"
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ AC_MSG_RESULT([no])
;;
- X-all)
- DEBUG_PKG=$all_packages
-## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG"
- AC_MSG_RESULT([all ($DEBUG_PKG)])
+ *)
+ H5_CFLAGS="$H5_CFLAGS $SYMBOLS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS"
+ H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS"
+ SYMBOLS="custom ($SYMBOLS)"
+ AC_MSG_RESULT([$SYMBOLS])
;;
- X-no|X-none)
+esac
+
+## ----------------------------------------------------------------------
+## Check if the assert macro should be enabled
+##
+AC_MSG_CHECKING([enable asserts])
+AC_ARG_ENABLE([asserts],
+ [AS_HELP_STRING([--enable-asserts],
+ [Determines whether NDEBUG is defined or not, which
+ controls assertions.
+ This is independent of the build mode and presence
+ of debugging symbols.
+ [default=yes if debug build, otherwise no]
+ ])],
+ [ASSERTS=$enableval])
+
+## Set default
+if test "X-$ASSERTS" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ ASSERTS=yes
+ else
+ ASSERTS=no
+ fi
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([ASSERTS])
+
+case "X-$ASSERTS" in
+ X-yes)
+ H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG"
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG"
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $ASSERTS])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
+## Check if the compiler should use profiling flags/settings
+##
+AC_MSG_CHECKING([profiling])
+AC_ARG_ENABLE([profiling],
+ [AS_HELP_STRING([--enable-profiling=(yes|no|<custom>)],
+ [Enable profiling flags (e.g.: -pg).
+ This can be set independently from the build mode.
+ The custom setting can be used to pass alternative
+ profiling flags (e.g.: -P for using Prof with gcc).
+ [default=no]
+ ])],
+ [PROFILING=$enableval])
+
+## Default is no profiling
+if test "X-$PROFILING" = X- ; then
+ PROFILING=no
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([PROFILING])
+
+case "X-$PROFILING" in
+ X-yes)
+ H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS"
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ H5_CFLAGS="$H5_CFLAGS $PROFILING"
+ H5_CXXFLAGS="$H5_CXXFLAGS $PROFILING"
+ H5_FCFLAGS="$H5_FCFLAGS $PROFILING"
+ PROFILING="custom ($PROFILING)"
+ AC_MSG_RESULT([$PROFILING])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
+## Check if the compiler should use a particular optimization setting
+##
+AC_MSG_CHECKING([optimization level])
+AC_ARG_ENABLE([optimization],
+ [AS_HELP_STRING([--enable-optimization=(high|debug|none|<custom>)],
+ [Enable optimization flags/settings (e.g.: -O3).
+ This can be set independently from the build mode.
+ Optimizations for a given compiler can be specified
+ at several levels: High, with aggressive optimizations
+ turned on; debug, with optimizations that are
+ unlikely to interfere with debugging or profiling;
+ and none, with no optimizations at all.
+ See the compiler-specific config/*-flags file for more
+ details.
+ Alternatively, optimization options can
+ be specified directly by specifying them as a
+ string value. These custom optimzation flags will
+ completely replace all other optimization flags.
+ [default depends on build mode: debug=debug,
+ production=high, clean=none]
+ ])],
+ [OPTIMIZATION=$enableval])
+
+## Set the default optimization level. This depends on the compiler mode.
+if test "X-$OPTIMIZATION" = X- ; then
+ case "X-$BUILD_MODE" in
+ X-debug)
+ OPTIMIZATION=debug
+ ;;
+ X-production)
+ OPTIMIZATION=high
+ ;;
+ X-clean)
+ OPTIMIZATION=none
+ ;;
+ esac
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([OPTIMIZATION])
+
+case "X-$OPTIMIZATION" in
+ X-high)
+ H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS"
+ AC_MSG_RESULT([high])
+ ;;
+ X-debug)
+ H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS"
+ AC_MSG_RESULT([debug])
+ ;;
+ X-none)
+ H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS"
+ H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS"
AC_MSG_RESULT([none])
- DEBUG_PKG=
-## H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG"
;;
*)
- AC_MSG_RESULT([$DEBUG_PKG])
+ H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION"
+ H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION"
+ OPTIMIZATION="custom ($OPTIMIZATION)"
+ AC_MSG_RESULT([$OPTIMIZATION])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
+## Enable/disable internal package-level debugging output
+##
+AC_MSG_CHECKING([for internal debug output])
+AC_ARG_ENABLE([internal-debug],
+ [AS_HELP_STRING([--enable-internal-debug=(yes|all|no|none|<pkg list>)],
+ [Enable extra debugging output on HDF5 library
+ errors. One may also specify a comma-separated
+ list of package names without the leading H5.
+ This is independent of the build mode
+ and is mainly of interest to HDF Group developers.
+ Yes/all and no/none are synonymous.
+ [default=all if debug build, otherwise none]
+ ])],
+ [INTERNAL_DEBUG_OUTPUT=$enableval])
+
+## Set default
+if test "X-$INTERNAL_DEBUG_OUTPUT" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ INTERNAL_DEBUG_OUTPUT=all
+ else
+ INTERNAL_DEBUG_OUTPUT=none
+ fi
+fi
+
+AC_SUBST([INTERNAL_DEBUG_OUTPUT])
+
+## These are all the packages that use H5*_DEBUG.
+## There is no harm in specifying a package not in this list;
+## you'll just get an unused H5<pkg>_DEBUG symbol.
+## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z"
+all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z"
+
+case "X-$INTERNAL_DEBUG_OUTPUT" in
+ X-yes|X-all)
+ INTERNAL_DEBUG_OUTPUT=$all_packages
+ DEBUG_PKG_LIST=$all_packages
+ ;;
+ X-no|X-none)
+ INTERNAL_DEBUG_OUTPUT=none
+ DEBUG_PKG_LIST=
+ ;;
+ *)
+ DEBUG_PKG_LIST=$INTERNAL_DEBUG_OUTPUT
;;
esac
+AC_MSG_RESULT([$INTERNAL_DEBUG_OUTPUT])
-if test -n "$DEBUG_PKG"; then
- for pkg in `echo $DEBUG_PKG | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do
+## Define H5*_DEBUG symbols that control package output
+## NOTE: No sanity checking done here!
+if test -n "$DEBUG_PKG_LIST"; then
+ for pkg in `echo $DEBUG_PKG_LIST | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do
H5_CPPFLAGS="$H5_CPPFLAGS -DH5${pkg}_DEBUG"
done
fi
@@ -1897,20 +2157,32 @@ fi
AC_MSG_CHECKING([whether function stack tracking is enabled])
AC_ARG_ENABLE([codestack],
[AS_HELP_STRING([--enable-codestack],
- [Enable the function stack tracing (for developer debugging).])],
+ [Enable the function stack tracing (for developer debugging).
+ [default=no]
+ ])],
[CODESTACK=$enableval])
+## Set the default level.
+if test "X-$CODESTACK" = X- ; then
+ CODESTACK=no
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([CODESTACK])
+
case "X-$CODESTACK" in
X-yes)
- CODESTACK=yes
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CODESTACK], [1],
[Define if the function stack tracing code is to be compiled in])
;;
- *)
- CODESTACK=no
+ X-no)
AC_MSG_RESULT([no])
;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $CODESTACK])
+ ;;
esac
## ----------------------------------------------------------------------
@@ -1919,87 +2191,69 @@ esac
AC_MSG_CHECKING([whether metadata trace file code is enabled])
AC_ARG_ENABLE([metadata-trace-file],
[AS_HELP_STRING([--enable-metadata-trace-file],
- [Enable metadata trace file collection.])],
+ [Enable metadata trace file collection.
+ [default=no]
+ ])],
[METADATATRACEFILE=$enableval])
+## Set the default level.
+if test "X-$METADATATRACEFILE" = X- ; then
+ METADATATRACEFILE=no
+fi
+
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([METADATATRACEFILE])
+
case "X-$METADATATRACEFILE" in
X-yes)
- METADATATRACEFILE=yes
AC_MSG_RESULT([yes])
AC_DEFINE([METADATA_TRACE_FILE], [1],
[Define if the metadata trace file code is to be compiled in])
;;
- *)
- METADATATRACEFILE=no
+ X-no)
AC_MSG_RESULT([no])
;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE])
+ ;;
esac
## ----------------------------------------------------------------------
## Enable tracing of the API
-## This must come after the enable-debug since it depends on debug.
##
-AC_SUBST([TRACE_API])
AC_MSG_CHECKING([for API tracing]);
AC_ARG_ENABLE([trace],
[AS_HELP_STRING([--enable-trace],
- [Enable API tracing capability. Default=no
- if debug is disabled.])],
- [TRACE=$enableval])
-
-## Default to no if debug is disabled
-if test "X-$TRACE" = X- ; then
- if test -z "$DEBUG_PKG" ; then
- TRACE=no
+ [Enable HDF5 API tracing capability.
+ [default=yes if debug build, otherwise no]
+ ])],
+ [TRACE_API=$enableval])
+
+## Set the default level.
+if test "X-$TRACE_API" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ TRACE_API=yes
else
- TRACE=yes
+ TRACE_API=no
fi
fi
-case "X-$TRACE" in
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([TRACE_API])
+
+case "X-$TRACE_API" in
X-yes)
AC_MSG_RESULT([yes])
- TRACE_API=yes
H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API"
;;
- X-no|*)
+ X-no)
AC_MSG_RESULT([no])
- TRACE_API=no
H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API"
;;
-esac
-
-## ----------------------------------------------------------------------
-## Enable instrumenting of the library's internal operations
-## This must come after the enable-debug since it depends on debug.
-##
-AC_SUBST([INSTRUMENT_LIBRARY])
-AC_MSG_CHECKING([for instrumented library]);
-AC_ARG_ENABLE([instrument],
- [AS_HELP_STRING([--enable-instrument],
- [Enable library instrumentation of optimization
- tracing. Default=no if debug is disabled.])],
- [INSTRUMENT=$enableval])
-
-## Default to no if debug is disabled
-if test "X-$INSTRUMENT" = X- ; then
- if test -z "$DEBUG_PKG" ; then
- INSTRUMENT=no
- else
- INSTRUMENT=yes
- fi
-fi
-
-case "X-$INSTRUMENT" in
- X-yes)
- AC_MSG_RESULT([yes])
- INSTRUMENT_LIBRARY=yes
- AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1],
- [Define if library will contain instrumentation to detect correct optimization operation])
- ;;
- X-no|*)
- AC_MSG_RESULT([no])
- INSTRUMENT_LIBRARY=no
+ *)
+ AC_MSG_ERROR([Unrecognized value: $TRACE_API])
;;
esac
@@ -2009,40 +2263,49 @@ esac
## more scrupulous with it's memory operations. Enabling this also
## disables the library's free space manager code.
##
-AC_SUBST([USINGMEMCHECKER])
AC_MSG_CHECKING([whether a memory checking tool will be used])
AC_ARG_ENABLE([using-memchecker],
[AS_HELP_STRING([--enable-using-memchecker],
[Enable this option if a memory allocation and/or
bounds checking tool will be used on the HDF5
library. Enabling this causes the library to be
- more picky about it's memory operations and also
+ more picky about its memory operations and also
disables the library's free space manager code.
This option is orthogonal to the
--enable-memory-alloc-sanity-check option.
- Default=no.])],
+ [default=no]
+ ])],
[USINGMEMCHECKER=$enableval])
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([USINGMEMCHECKER])
+
+## Set the default level.
+if test "X-$USINGMEMCHECKER" = X- ; then
+ USINGMEMCHECKER=no
+fi
+
case "X-$USINGMEMCHECKER" in
X-yes)
- USINGMEMCHECKER=yes
- AC_MSG_RESULT([yes])
AC_DEFINE([USING_MEMCHECKER], [1],
[Define if a memory checking tool will be used on the library,
to cause library to be very picky about memory operations and
also disable the internal free list manager code.])
+ AC_MSG_RESULT([yes])
;;
- *)
- USINGMEMCHECKER=no
+ X-no)
AC_MSG_RESULT([no])
;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $USINGMEMCHECKER])
+ ;;
esac
## ----------------------------------------------------------------------
## Check if they would like to enable the internal memory allocation sanity
## checking code.
##
-AC_SUBST([MEMORYALLOCSANITYCHECK])
AC_MSG_CHECKING([whether internal memory allocation sanity checking is used])
AC_ARG_ENABLE([memory-alloc-sanity-check],
[AS_HELP_STRING([--enable-memory-alloc-sanity-check],
@@ -2051,20 +2314,35 @@ AC_ARG_ENABLE([memory-alloc-sanity-check],
more memory use and somewhat slower allocation.
This option is orthogonal to the
--enable-using-memchecker option.
- Default=no.])],
+ [default=yes if debug build, otherwise no]
+ ])],
[MEMORYALLOCSANITYCHECK=$enableval])
+## Allow this variable to be substituted in
+## other files (src/libhdf5.settings.in, etc.)
+AC_SUBST([MEMORYALLOCSANITYCHECK])
+
+## Set default
+if test "X-$MEMORYALLOCSANITYCHECK" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ MEMORYALLOCSANITYCHECK=yes
+ else
+ MEMORYALLOCSANITYCHECK=no
+ fi
+fi
+
case "X-$MEMORYALLOCSANITYCHECK" in
X-yes)
- MEMORYALLOCSANITYCHECK=yes
- AC_MSG_RESULT([yes])
AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1],
[Define to enable internal memory allocation sanity checking.])
+ AC_MSG_RESULT([yes])
;;
- *)
- MEMORYALLOCSANITYCHECK=no
+ X-no)
AC_MSG_RESULT([no])
;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $MEMORYALLOCSANITYCHECK])
+ ;;
esac
## Checkpoint the cache
@@ -2135,8 +2413,12 @@ esac
## ----------------------------------------------------------------------
## Print some other parallel information and do some sanity checks.
+## Needs to be done outside of the PARALLEL block since the serial
+## build also needs to have values defined.
##
AC_SUBST([ADD_PARALLEL_FILES]) ADD_PARALLEL_FILES="no"
+AC_SUBST([MPE]) MPE=no
+AC_SUBST([INSTRUMENT_LIBRARY]) INSTRUMENT_LIBRARY=no
if test -n "$PARALLEL"; then
## The 'testpar' directory should participate in the build
@@ -2191,6 +2473,45 @@ if test -n "$PARALLEL"; then
)
fi
+ ## ----------------------------------------------------------------------
+ ## Enable instrumenting of the library's internal operations
+ ## in parallel builds.
+ ##
+
+ ## Set default
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ INSTRUMENT_LIBRARY=yes
+ else
+ INSTRUMENT_LIBRARY=no
+ fi
+
+ AC_MSG_CHECKING([for instrumented library]);
+ AC_ARG_ENABLE([instrument],
+ [AS_HELP_STRING([--enable-instrument],
+ [Enable library instrumentation of optimization
+ tracing (only used with parallel builds).
+ [default=yes if a parallel debug build, otherwise no]
+ ])],
+ [INSTRUMENT_LIBRARY=$enableval])
+
+ ## Allow this variable to be substituted in
+ ## other files (src/libhdf5.settings.in, etc.)
+ AC_SUBST([INSTRUMENT_LIBRARY])
+
+ case "X-$INSTRUMENT_LIBRARY" in
+ X-yes)
+ AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1],
+ [Define if parallel library will contain instrumentation to detect correct optimization operation])
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $INSTRUMENT_LIBRARY])
+ ;;
+ esac
+
## --------------------------------------------------------------------
## Do we want MPE instrumentation feature on?
##
@@ -2258,6 +2579,11 @@ fi
## ----------------------------------------------------------------------
## Check if Direct I/O driver is enabled by --enable-direct-vfd
##
+AC_SUBST([DIRECT_VFD])
+
+## Default is no direct VFD
+DIRECT_VFD=no
+
AC_CACHE_VAL([hdf5_cv_direct_io],
AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include <fcntl.h>]]))
AC_CACHE_VAL([hdf5_cv_posix_memalign],
@@ -2290,6 +2616,7 @@ else
AC_MSG_RESULT([no])
fi
+## Direct VFD files are not built if not required.
AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"])
## ----------------------------------------------------------------------
@@ -2684,7 +3011,7 @@ if test -n "$ORGANIZATION"; then
CONFIG_USER="$CONFIG_USER at $ORGANIZATION"
fi
-## Configuration mode (production, development, profile, etc) saved above.
+## Configuration mode (production, debug, etc.) saved above.
AC_SUBST([CONFIG_MODE])
## Byte sex from the AC_C_BIGENDIAN macro.
@@ -2800,13 +3127,22 @@ AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"])
## ----------------------------------------------------------------------
## Enable deprecated public API symbols
##
+
+## Enabled unless the build mode is clean.
+if test "X-$BUILD_MODE" = "X-clean" ; then
+ DEPREC_SYMBOLS=no
+else
+ DEPREC_SYMBOLS=yes
+fi
+
AC_SUBST([DEPRECATED_SYMBOLS])
AC_MSG_CHECKING([if deprecated public symbols are available]);
AC_ARG_ENABLE([deprecated-symbols],
[AS_HELP_STRING([--enable-deprecated-symbols],
- [Enable deprecated public API symbols [default=yes]])],
- [DEPREC_SYMBOLS=$enableval],
- [DEPREC_SYMBOLS=yes])
+ [Enable deprecated public API symbols.
+ [default=yes (unless build mode = clean)]
+ ])],
+ [DEPREC_SYMBOLS=$enableval])
case "X-$DEPREC_SYMBOLS" in
X-yes)
@@ -2865,29 +3201,31 @@ AC_SUBST([STRICT_FORMAT_CHECKS])
AC_MSG_CHECKING([whether to perform strict file format checks]);
AC_ARG_ENABLE([strict-format-checks],
[AS_HELP_STRING([--enable-strict-format-checks],
- [Enable strict file format checks, default=yes if
- debug flag is enabled, no otherwise])],
- [STRICT_CHECKS=$enableval])
-
-## Default to yes if debug is enabled
-if test "X-$STRICT_CHECKS" = X- ; then
- if test -z "$DEBUG_PKG" ; then
- STRICT_CHECKS=no
+ [Enable strict file format checks.
+ [default=yes if debug build, otherwise no]
+ ])],
+ [STRICT_FORMAT_CHECKS=$enableval])
+
+## Set the default level. This depends on the compiler mode.
+if test "X-$STRICT_FORMAT_CHECKS" = X- ; then
+ if test "X-$BUILD_MODE" = "X-debug" ; then
+ STRICT_FORMAT_CHECKS=yes
else
- STRICT_CHECKS=yes
+ STRICT_FORMAT_CHECKS=no
fi
fi
-case "X-$STRICT_CHECKS" in
+case "X-$STRICT_FORMAT_CHECKS" in
X-yes)
AC_MSG_RESULT([yes])
- STRICT_FORMAT_CHECKS=yes
AC_DEFINE([STRICT_FORMAT_CHECKS], [1],
[Define if strict file format checks are enabled])
;;
- X-no|*)
+ X-no)
AC_MSG_RESULT([no])
- STRICT_FORMAT_CHECKS=no
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $STRICT_FORMAT_CHECKS])
;;
esac
@@ -3039,6 +3377,11 @@ else
enable_static=no
fi
+## Expose things for *.in markup
+AC_SUBST([STATIC_SHARED])
+AC_SUBST([enable_shared])
+AC_SUBST([enable_static])
+
if test "X$enable_static" = "Xyes" && test "X$enable_shared" = "Xyes"; then
STATIC_SHARED="static, shared"
elif test "X$enable_static" = "Xyes"; then
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 8b90cd5..60f043f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -856,7 +856,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
)
-option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF)
+option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
if (HDF5_ENABLE_DEBUG_APIS)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES
COMPILE_DEFINITIONS
diff --git a/src/H5.c b/src/H5.c
index a522398..4de5731 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -552,30 +552,29 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5_debug_mask
+ * Function: H5_debug_mask
*
- * Purpose: Set runtime debugging flags according to the string S. The
- * string should contain file numbers and package names
- * separated by other characters. A file number applies to all
- * following package names up to the next file number. The
- * initial file number is `2' (the standard error stream). Each
- * package name can be preceded by a `+' or `-' to add or remove
- * the package from the debugging list (`+' is the default). The
- * special name `all' means all packages.
+ * Purpose: Set runtime debugging flags according to the string S. The
+ * string should contain file numbers and package names
+ * separated by other characters. A file number applies to all
+ * following package names up to the next file number. The
+ * initial file number is `2' (the standard error stream). Each
+ * package name can be preceded by a `+' or `-' to add or remove
+ * the package from the debugging list (`+' is the default). The
+ * special name `all' means all packages.
*
- * The name `trace' indicates that API tracing is to be turned
- * on or off.
+ * The name `trace' indicates that API tracing is to be turned
+ * on or off.
*
- * Return: void
+ * The name 'ttop' indicates that only top-level API calls
+ * should be shown. This also turns on tracing as if the
+ * 'trace' word was shown.
*
- * Programmer: Robb Matzke
+ * Return: void
+ *
+ * Programmer: Robb Matzke
* Wednesday, August 19, 1998
*
- * Modifications:
- * Robb Matzke, 2002-08-08
- * Accepts the `ttop' word. If enabled then show only the
- * top level API calls, otherwise show all API calls. Also
- * turns on tracing as if the `trace' word was present.
*-------------------------------------------------------------------------
*/
static void
@@ -587,55 +586,57 @@ H5_debug_mask(const char *s)
hbool_t clear;
while (s && *s) {
- if (HDisalpha(*s) || '-'==*s || '+'==*s) {
- /* Enable or Disable debugging? */
- if ('-'==*s) {
- clear = TRUE;
- s++;
- } else if ('+'==*s) {
- clear = FALSE;
- s++;
- } else {
- clear = FALSE;
- }
-
- /* Get the name */
- for (i=0; HDisalpha(*s); i++, s++)
- if (i<sizeof pkg_name)
+
+ if (HDisalpha(*s) || '-'==*s || '+'==*s) {
+
+ /* Enable or Disable debugging? */
+ if ('-'==*s) {
+ clear = TRUE;
+ s++;
+ } else if ('+'==*s) {
+ clear = FALSE;
+ s++;
+ } else {
+ clear = FALSE;
+ } /* end if */
+
+ /* Get the name */
+ for (i=0; HDisalpha(*s); i++, s++)
+ if (i<sizeof pkg_name)
pkg_name[i] = *s;
- pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
+ pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
- /* Trace, all, or one? */
- if (!HDstrcmp(pkg_name, "trace")) {
- H5_debug_g.trace = clear ? NULL : stream;
+ /* Trace, all, or one? */
+ if (!HDstrcmp(pkg_name, "trace")) {
+ H5_debug_g.trace = clear ? NULL : stream;
} else if (!HDstrcmp(pkg_name, "ttop")) {
H5_debug_g.trace = stream;
H5_debug_g.ttop = (hbool_t)!clear;
} else if (!HDstrcmp(pkg_name, "ttimes")) {
H5_debug_g.trace = stream;
H5_debug_g.ttimes = (hbool_t)!clear;
- } else if (!HDstrcmp(pkg_name, "all")) {
- for (i=0; i<(size_t)H5_NPKGS; i++)
- H5_debug_g.pkg[i].stream = clear ? NULL : stream;
- } else {
- for (i=0; i<(size_t)H5_NPKGS; i++) {
- if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
- H5_debug_g.pkg[i].stream = clear ? NULL : stream;
- break;
- }
- }
- if (i>=(size_t)H5_NPKGS)
- fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
- }
-
- } else if (HDisdigit(*s)) {
- int fd = (int)HDstrtol(s, &rest, 0);
- H5_debug_open_stream_t *open_stream;
-
- if((stream = HDfdopen(fd, "w")) != NULL) {
- (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
-
- if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
+ } else if (!HDstrcmp(pkg_name, "all")) {
+ for (i=0; i<(size_t)H5_NPKGS; i++)
+ H5_debug_g.pkg[i].stream = clear ? NULL : stream;
+ } else {
+ for (i=0; i<(size_t)H5_NPKGS; i++) {
+ if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
+ H5_debug_g.pkg[i].stream = clear ? NULL : stream;
+ break;
+ } /* end if */
+ } /* end for */
+ if (i>=(size_t)H5_NPKGS)
+ fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
+ } /* end if-else */
+
+ } else if (HDisdigit(*s)) {
+ int fd = (int)HDstrtol(s, &rest, 0);
+ H5_debug_open_stream_t *open_stream;
+
+ if((stream = HDfdopen(fd, "w")) != NULL) {
+ (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0);
+
+ if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) {
(void)HDfclose(stream);
return;
} /* end if */
@@ -644,11 +645,15 @@ H5_debug_mask(const char *s)
open_stream->next = H5_debug_g.open_stream;
H5_debug_g.open_stream = open_stream;
} /* end if */
- s = rest;
- } else {
- s++;
- }
- }
+
+ s = rest;
+ } else {
+ s++;
+ } /* end if-else */
+ } /* end while */
+
+ return;
+
} /* end H5_debug_mask() */
#ifdef H5_HAVE_PARALLEL
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index b0e5628..3bb2936 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -3,40 +3,47 @@
General Information:
-------------------
- HDF5 Version: @H5_VERSION@
- Configured on: @CONFIG_DATE@
- Configured by: @CONFIG_USER@
- Configure mode: @CONFIG_MODE@
- Host system: @host_cpu@-@host_vendor@-@host_os@
- Uname information: @UNAME_INFO@
- Byte sex: @BYTESEX@
- Libraries: @STATIC_SHARED@
- Installation point: @prefix@
+ HDF5 Version: @H5_VERSION@
+ Configured on: @CONFIG_DATE@
+ Configured by: @CONFIG_USER@
+ Host system: @host_cpu@-@host_vendor@-@host_os@
+ Uname information: @UNAME_INFO@
+ Byte sex: @BYTESEX@
+ Installation point: @prefix@
Compiling Options:
------------------
- Compilation Mode: @CONFIG_MODE@
- C Compiler: @CC_VERSION@
- CFLAGS: @CFLAGS@
- H5_CFLAGS: @H5_CFLAGS@
- AM_CFLAGS: @AM_CFLAGS@
- CPPFLAGS: @CPPFLAGS@
- H5_CPPFLAGS: @H5_CPPFLAGS@
- AM_CPPFLAGS: @AM_CPPFLAGS@
- Shared C Library: @enable_shared@
- Static C Library: @enable_static@
+ Build Mode: @BUILD_MODE@
+ Debugging Symbols: @SYMBOLS@
+ Asserts: @ASSERTS@
+ Profiling: @PROFILING@
+ Optimization Level: @OPTIMIZATION@
+
+Linking Options:
+----------------
+ Libraries: @STATIC_SHARED@
Statically Linked Executables: @LT_STATIC_EXEC@
LDFLAGS: @LDFLAGS@
H5_LDFLAGS: @H5_LDFLAGS@
AM_LDFLAGS: @AM_LDFLAGS@
- Extra libraries: @LIBS@
- Archiver: @AR@
- Ranlib: @RANLIB@
- Debugged Packages: @DEBUG_PKG@
- API Tracing: @TRACE_API@
+ Extra libraries: @LIBS@
+ Archiver: @AR@
+ Ranlib: @RANLIB@
Languages:
----------
+ C: yes
+ C Compiler: @CC_VERSION@
+ CPPFLAGS: @CPPFLAGS@
+ H5_CPPFLAGS: @H5_CPPFLAGS@
+ AM_CPPFLAGS: @AM_CPPFLAGS@
+ C Flags: @CFLAGS@
+ H5 C Flags: @H5_CFLAGS@
+ AM C Flags: @AM_CFLAGS@
+ Shared C Library: @enable_shared@
+ Static C Library: @enable_static@
+
+
Fortran: @HDF_FORTRAN@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@
@@ -56,16 +63,19 @@ Languages:
Features:
---------
Parallel HDF5: @PARALLEL@
- High Level library: @HDF5_HL@
+ High-level library: @HDF5_HL@
Threadsafety: @THREADSAFE@
- Default API Mapping: @DEFAULT_API_VERSION@
- With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@
+ Default API mapping: @DEFAULT_API_VERSION@
+ With deprecated public symbols: @DEPRECATED_SYMBOLS@
I/O filters (external): @EXTERNAL_FILTERS@
MPE: @MPE@
Direct VFD: @DIRECT_VFD@
dmalloc: @HAVE_DMALLOC@
+ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
+ API tracing: @TRACE_API@
Using memory checker: @USINGMEMCHECKER@
Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
- Function Stack Tracing: @CODESTACK@
- Strict File Format Checks: @STRICT_FORMAT_CHECKS@
- Optimization Instrumentation: @INSTRUMENT@
+ Metadata trace file: @METADATATRACEFILE@
+ Function stack tracing: @CODESTACK@
+ Strict file format checks: @STRICT_FORMAT_CHECKS@
+ Optimization instrumentation: @INSTRUMENT_LIBRARY@