[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
This commit is contained in:
Dana Robinson 2016-01-27 16:45:23 -05:00
parent 7afa7bb6af
commit 1454a45826
14 changed files with 845 additions and 370 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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=
# Symbols
SYMBOL_CFLAGS="-g"
SYMBOL_CPPFLAGS=
# Profile
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"
# Profile
PROFILE_CFLAGS="-Og -g -pg"
PROFILE_CPPFLAGS=
# Flags are set
cc_flags_set=yes
;;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -51,7 +51,7 @@ if test "X-" = "X-$FC"; then
FC=gfortran
FC_BASENAME=gfortran
;;
pgcc*)
pgcc*)
FC=pgf90
FC_BASENAME=pgf90
;;

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

125
src/H5.c
View File

@ -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 (!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;
} 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((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)))) {
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

View File

@ -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@