diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2016-01-27 21:45:23 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2016-01-27 21:45:23 (GMT) |
commit | 1454a458262dd012c94f56ccc55ccbbe57b63399 (patch) | |
tree | 3924efe3b45657d02b8dcc394df30626591a6610 /configure.ac | |
parent | 7afa7bb6afd1cf4daee58010e4f9411262abeab9 (diff) | |
download | hdf5-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
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 799 |
1 files changed, 571 insertions, 228 deletions
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 |