diff options
author | Mike McGreevy <mamcgree@hdfgroup.org> | 2009-10-08 15:17:30 (GMT) |
---|---|---|
committer | Mike McGreevy <mamcgree@hdfgroup.org> | 2009-10-08 15:17:30 (GMT) |
commit | 7ec079a5152761d3e972b2f52c3542f5ec38f89e (patch) | |
tree | 4f9693427882de9fda9a36512637a7a569b57a89 /configure.in | |
parent | 047ac8f136c58c373dbb0bf04963382ed8930334 (diff) | |
download | hdf5-7ec079a5152761d3e972b2f52c3542f5ec38f89e.zip hdf5-7ec079a5152761d3e972b2f52c3542f5ec38f89e.tar.gz hdf5-7ec079a5152761d3e972b2f52c3542f5ec38f89e.tar.bz2 |
[svn-r17616] Purpose:
CFLAGS overhaul
Description:
Modified the way configure handles CFLAGS.
(note: all changes also apply to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS).
1. The configure process will now always preserve a user's CFLAGS
environment variable setup. Any additional flags necessary for compilation
added at configure time will be passed into the Makefiles as AM_CFLAGS,
which is an automake construct to be used in addition to CFLAGS.
This will allow a user to have the final say, as CFLAGS will always appear
later in the compile line than AM_CFLAGS. Additionally, setting CFLAGS
during make will no longer completely erase all flags set by configure,
since they're maintained in AM_CFLAGS.
2. Additionally, where possible, flags previously being assigned directly
into CFLAGS (and thus propagating into h5cc) have now been redirected into
H5_CFLAGS, so they're used ONLY for compiling hdf5, and not embedded into
the h5cc wrapper script as well.
*Note that H5_CFLAGS ultimately is assigned into AM_CFLAGS for use in the
Makefiles. Complete description of changes and build process will be
included in a Configure Document that Elena and I are working on.
3. Removed unsupported config files. This includes:
config/dec-osf*
config/hpux11.00
config/irix5.x
config/powerpc-ibm-aix4.x
config/rs6000-ibm-aix5.x
config/unicos*
4. Modified configure summary to display additional values. Specifically,
appropriate AM_* variables are being shown, as well as H5_FCFLAGS and
H5_CXXFLAGS, which were for some reason not already present.
Tested:
- H5committest
- Tested on all THG / NCSA machines, using several combinations of the more
prominent configure options (c++, fortran, szip, threadsafe, parallel,
et cetera). (Thanks to Quincey for rysnc testing setup!)
- With regards to new automated testing, anything *necessary* for
compilation will be caught by the daily tests as it stands now. (i.e.,
if LDFLAGS is not properly set when szip is used, linking will fail).
Additionally, with regards to which flags get into h5cc, if any
*necessary* flags have been improperly removed, then daily tests should
fail during make installcheck. Additional machine-specific desired
behaviors and/or checks may have to be set up separately within the
daily tests, so this is something to work on.
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 109 |
1 files changed, 82 insertions, 27 deletions
diff --git a/configure.in b/configure.in index 2f77de1..54c22ee 100644 --- a/configure.in +++ b/configure.in @@ -94,11 +94,31 @@ AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) +dnl AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5, +dnl and WILL be exported to h5cc (or h5fc, etc) if set by configure. +AC_SUBST([AM_CFLAGS]) +AC_SUBST([AM_FCFLAGS]) +AC_SUBST([AM_CXXFLAGS]) +AC_SUBST([AM_CPPFLAGS]) +AC_SUBST([AM_LDFLAGS]) + dnl Make sure flags are set to something (otherwise macros may set them later). +AM_CFLAGS="${AM_CFLAGS}" +AM_CXXFLAGS="${AM_CXXFLAGS}" +AM_FCFLAGS="${AM_FCFLAGS}" +AM_CPPFLAGS="${AM_CPPFLAGS}" +AM_LDFLAGS="${AM_LDFLAGS}" CFLAGS="${CFLAGS}" -CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" +CPPFLAGS="${CPPFLAGS}" +LDFLAGS="${LDFLAGS}" + +dnl Configure will need to alter LDFLAGS and CPPFLAGS in order for +dnl various checks to work correctly. Save the user's value here so it +dnl can be restored once all configure checks are complete. +saved_user_LDFLAGS="$LDFLAGS" +saved_user_CPPFLAGS="$CPPFLAGS" dnl Different compilers may need default libraries. They are specified in dnl the config/* files, so we put this statement here so that it'll be @@ -342,7 +362,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then dnl -------------------------------------------------------------------- dnl General Fortran flags dnl - FCFLAGS="${FCFLAGS} ${FFLAGS}" + AM_FCFLAGS="${AM_FCFLAGS} ${AM_FFLAGS}" dnl -------------------------------------------------------------------- dnl Fortran source extention @@ -374,8 +394,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then dnl -------------------------------------------------------------------- dnl See if the compiler will support the "-I." option dnl -dnl FCFLAGS_saved=$FCFLAGS -dnl FCFLAGS="${FCFLAGS} -I." +dnl AM_FCFLAGS_saved=$AM_FCFLAGS +dnl AM_FCFLAGS="${AM_FCFLAGS} -I." dnl AC_MSG_CHECKING(if compiler supports -I. option) dnl AC_TRY_FCOMPILE([ @@ -383,7 +403,7 @@ dnl program conftest dnl end dnl ], AC_MSG_RESULT(yes), dnl AC_MSG_RESULT(no) -dnl FCFLAGS="$FCFLAGS_saved") +dnl AM_FCFLAGS="$AM_FCFLAGS_saved") dnl -------------------------------------------------------------------- dnl See if the fortran compiler supports the intrinsic function "SIZEOF" @@ -471,7 +491,7 @@ int main(void) { return 0; } echo no ], [ echo yes - CXXFLAGS="${CXXFLAGS} -DOLD_HEADER_FILENAME" + AM_CXXFLAGS="${AM_CXXFLAGS} -DOLD_HEADER_FILENAME" ]) AC_MSG_CHECKING([if $CXX can handle namespaces]) @@ -489,7 +509,7 @@ int main(void) { echo yes ], [ echo no - CXXFLAGS="${CXXFLAGS} -DH5_NO_NAMESPACE" + AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_NAMESPACE" ]) AC_MSG_CHECKING([if $CXX supports std]) @@ -506,7 +526,7 @@ int main(void) { echo yes ], [ echo no - CXXFLAGS="${CXXFLAGS} -DH5_NO_STD" + AM_CXXFLAGS="${AM_CXXFLAGS} -DH5_NO_STD" ]) AC_MSG_CHECKING([if $CXX supports bool types]) @@ -519,7 +539,7 @@ int main(void) { echo yes ], [ echo no - CXXFLAGS="${CXXFLAGS} -DBOOL_NOTDEFINED" + AM_CXXFLAGS="${AM_CXXFLAGS} -DBOOL_NOTDEFINED" ]) AC_MSG_CHECKING([if $CXX has offsetof extension]) @@ -556,7 +576,7 @@ int main(void) { echo yes ], [ echo no - CXXFLAGS="${CXXFLAGS} -DNO_STATIC_CAST" + AM_CXXFLAGS="${AM_CXXFLAGS} -DNO_STATIC_CAST" ]) else echo "no" @@ -874,7 +894,7 @@ if test "X${HDF_FORTRAN}" = "Xyes"; then H5_FORTRAN_SHARED="no" else dnl echo 'adding fortran compiler flag needed for building shared libraries' - FCFLAGS="${FCFLAGS} -fPIC" + AM_FCFLAGS="${AM_FCFLAGS} -fPIC" fi fi if (${FC} +version 2>&1 | grep '^HP F90') > /dev/null; then @@ -1276,7 +1296,7 @@ case "$host_cpu-$host_vendor-$host_os" in AC_MSG_CHECKING([for large file support mode on Linux]) if test "X$LINUX_LFS" = "Xyes"; then AC_MSG_RESULT([enabled]) - CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $CPPFLAGS" + AM_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS" else AC_MSG_RESULT([disabled]) fi @@ -1284,16 +1304,20 @@ case "$host_cpu-$host_vendor-$host_os" in dnl Add POSIX support on Linux systems, so <features.h> defines dnl __USE_POSIX, which is required to get the prototype for fdopen dnl defined correctly in <stdio.h> - CPPFLAGS="-D_POSIX_SOURCE $CPPFLAGS" + AM_CPPFLAGS="-D_POSIX_SOURCE $AM_CPPFLAGS" dnl Also add BSD support on Linux systems, so <features.h> defines dnl __USE_BSD, which is required to get the prototype for strdup dnl defined correctly in <string.h> and snprintf & vsnprintf defined dnl correctly in <stdio.h> - CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" + AM_CPPFLAGS="-D_BSD_SOURCE $AM_CPPFLAGS" ;; esac +dnl Need to add AM_CPPFLAGS into CPPFLAGS to make them visible for configure checks. +dnl Note: CPPFLAGS will be restored by the end of configure. +CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" + AC_TRY_COMPILE([#include <sys/types.h>], [off64_t n = 0;], [AC_CHECK_FUNCS([lseek64 fseek64 ftruncate64])], @@ -1467,7 +1491,7 @@ case $withval in CPPFLAGS="$CPPFLAGS -I$dmalloc_inc" fi - AC_CHECK_HEADERS(dmalloc.h,, CPPFLAGS="$saved_CPPFLAGS") + AC_CHECK_HEADERS(dmalloc.h, AM_CPPFLAGS="$AM_CPPFLAGS -I$dmalloc_inc",CPPFLAGS="$saved_CPPFLAGS") if test -n "$dmalloc_lib"; then LDFLAGS="$LDFLAGS -L$dmalloc_lib" @@ -1475,6 +1499,10 @@ case $withval in AC_CHECK_LIB(dmalloc, dmalloc_shutdown,, LDFLAGS="$saved_LDFLAGS"; unset HAVE_DMALLOC) + if test -n "$HAVE_DMALLOC"; then + AM_LDFLAGS="$AM_LDFLAGS -L$dmalloc_lib" + fi + if test -z "$HAVE_DMALLOC" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR(couldn't find dmalloc library) fi @@ -1542,7 +1570,7 @@ case $withval in fi AC_CHECK_HEADERS([zlib.h], - [HAVE_ZLIB_H="yes"], + [HAVE_ZLIB_H="yes"; AM_CPPFLAGS="$AM_CPPFLAGS -I$zlib_inc"], [CPPFLAGS="$saved_CPPFLAGS"]) if test -n "$zlib_lib"; then @@ -1553,6 +1581,10 @@ case $withval in [LDFLAGS="$saved_LDFLAGS"; unset HAVE_ZLIB]) AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"]) + if test -n "$HAVE_ZLIB"; then + AM_LDFLAGS="$AM_LDFLAGS -L$zlib_lib" + fi + if test -z "$HAVE_ZLIB" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find zlib library]) fi @@ -1631,16 +1663,20 @@ case $withval in fi AC_CHECK_HEADERS([szlib.h], - [HAVE_SZLIB_H="yes"], + [HAVE_SZLIB_H="yes"; AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc"], [CPPFLAGS="$saved_CPPFLAGS"]) - + if test -n "$szlib_lib"; then LDFLAGS="$LDFLAGS -L$szlib_lib" fi AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [LDFLAGS="$saved_LDFLAGS"; unset HAVE_SZLIB]) - + + if test -n "$HAVE_SZLIB"; then + AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib" + fi + if test -z "$HAVE_SZLIB" -a -n "$HDF5_CONFIG_ABORT"; then AC_MSG_ERROR([couldn't find szlib library]) fi @@ -1757,7 +1793,8 @@ case "$withval" in if test -n "$pthread_inc"; then saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$pthread_inc" - AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; unset PTHREAD]) + AC_CHECK_HEADERS([pthread.h],AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc", [unset PTHREAD]) + CPPFLAGS="$saved_CPPFLAGS" else AC_CHECK_HEADERS([pthread.h],, [unset PTHREAD]) fi @@ -1767,6 +1804,11 @@ case "$withval" in LDFLAGS="$LDFLAGS -L$pthread_lib" AC_CHECK_LIB([pthread], [pthread_create],, [LDFLAGS="$saved_LDFLAGS"; unset PTHREAD]) + + if test -n "$PTHREAD"; then + AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" + fi + else AC_CHECK_LIB([pthread], [pthread_create],, [unset PTHREAD]) fi @@ -2072,7 +2114,7 @@ dnl LD_LIBRARY_PATH along with LDFLAGS or do it with the AC_TRY_RUN macro. dnl AC_MSG_CHECKING([how to print long long]) AC_CACHE_VAL([hdf5_cv_printf_ll], -LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`" +LD_LIBRARY_PATH="$LD_LIBRARY_PATH`echo $AM_LDFLAGS $LDFLAGS | sed -e 's/-L/:/g' -e 's/ //g'`" export LD_LIBRARY_PATH for hdf5_cv_printf_ll in l ll L q unknown; do @@ -2613,7 +2655,8 @@ if test -n "$PARALLEL"; then if test -n "$mpe_inc"; then saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$mpe_inc" - AC_CHECK_HEADERS([mpe.h],, [CPPFLAGS="$saved_CPPFLAGS"; unset MPE]) + AC_CHECK_HEADERS([mpe.h],AM_CPPFLAGS="$AM_CPPFLAGS -I$mpe_inc", [unset MPE]) + CPPFLAGS="$saved_CPPFLAGS" else AC_CHECK_HEADERS([mpe.h],, [unset MPE]) fi @@ -2625,6 +2668,11 @@ if test -n "$PARALLEL"; then [LDFLAGS="$saved_LDFLAGS"; unset MPE]) AC_CHECK_LIB([lmpe], [CLOG_Init],, [LDFLAGS="$saved_LDFLAGS"; unset MPE]) + + if test -n "$MPE"; then + AM_LDFLAGS="$AM_LDFLAGS -L$mpe_lib" + fi + else AC_CHECK_LIB([mpe], [MPE_Init_log],, [unset MPE]) AC_CHECK_LIB([lmpe], [CLOG_Init],, [unset MPE]) @@ -3704,8 +3752,8 @@ dnl libraries. dnl AC_SUBST([DYNAMIC_DIRS]) DYNAMIC_DIRS="" -if test -n "$LDFLAGS"; then - for d in $LDFLAGS ; do +if test -n "$AM_LDFLAGS $LDFLAGS"; then + for d in $AM_LDFLAGS $LDFLAGS ; do case "$d" in -L*) d="`echo $d | sed -e 's/-L//g'`" @@ -3722,9 +3770,9 @@ if test -n "$LDFLAGS"; then done fi -if test -n "$CPPFLAGS"; then +if test -n "$AM_CPPFLAGS"; then TEMP_CPPFLAGS="" - for d in $CPPFLAGS ; do + for d in $AM_CPPFLAGS ; do case "$d" in -I.*) dnl If the path isn't absolute, make it so by prepending @@ -3735,7 +3783,7 @@ if test -n "$CPPFLAGS"; then esac TEMP_CPPFLAGS="$d $TEMP_CPPFLAGS" done - CPPFLAGS=$TEMP_CPPFLAGS + AM_CPPFLAGS=$TEMP_CPPFLAGS fi dnl ---------------------------------------------------------------------- @@ -3938,6 +3986,13 @@ AC_RUN_IFELSE([ AC_MSG_RESULT([unknown, assuming yes]) ]) + +dnl ------------------------------------ +dnl Restore user's CPPFLAGS and LDFLAGS. +CPPFLAGS="$saved_user_CPPFLAGS" +LDFLAGS="$saved_user_LDFLAGS" + + dnl ---------------------------------------------------------------------- dnl Create automake conditionals to tell automake makefiles which directories dnl need to be compiled |