From 29791cf160f67f4cccf293c57a5b9479407f7c1b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 11 Apr 2014 10:32:58 -0500 Subject: [svn-r25016] Purpose: Merged r24857 from the trunk. Changes to configure.ac so that --with-pthreads is not required when the --enable-threadsafe configure option is set as long as the Pthreads library is in a standard location. Tested on: 32-bit LE linux (jam) with --enable-threadsafe 64-bit LE linux (koala) with --enable-threadsafe 64-bit BE linux (ostrich) with --enable-threadsafe --- configure | 256 ++++++++++++++++++++++------------------------- configure.ac | 162 +++++++++++++++--------------- release_docs/RELEASE.txt | 3 + 3 files changed, 203 insertions(+), 218 deletions(-) diff --git a/configure b/configure index aec453a..8f7dc69 100755 --- a/configure +++ b/configure @@ -911,8 +911,8 @@ with_fnord with_dmalloc with_zlib with_szlib -with_pthread enable_threadsafe +with_pthread enable_debug enable_codestack enable_metadata_trace_file @@ -1597,7 +1597,7 @@ Optional Features: --disable-linux-lfs Disable support for large (64-bit) files on Linux. This option is deprecated in favor of --disable-largefile. - --enable-threadsafe Enable thread safe capability + --enable-threadsafe Enable thread-safe capability --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 @@ -1669,7 +1669,8 @@ Optional Packages: [default=yes] --with-szlib=DIR Use szlib library for external szlib I/O filter [default=no] - --with-pthread=DIR Use the Pthreads library [default=no] + --with-pthread=DIR Specify alternative path to Pthreads library when + thread-safe capability is built --with-mpe=DIR Use MPE instrumentation [default=no] --with-default-vfd=driver Specify default file driver [default=sec2] @@ -26366,25 +26367,79 @@ fi rm -f confcache ## ---------------------------------------------------------------------- -## Is the Pthreads library present? It has a header file `pthread.h' and -## a library `-lpthread' and their locations might be specified with the -## `--with-pthread' 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. +## Enable thread-safe version of library. It requires Pthreads support +## on POSIX systems. ## - HAVE_PTHREAD=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread safe support" >&5 +$as_echo_n "checking for thread safe support... " >&6; } +# Check whether --enable-threadsafe was given. +if test "${enable_threadsafe+set}" = set; then : + enableval=$enable_threadsafe; THREADSAFE=$enableval +fi + + +## The --enable-threadsafe flag is not compatible with --enable-cxx. +## If the user tried to specify both flags, throw an error, unless +## they also provided the --enable-unsupported flag. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_CXX}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then + as_fn_error $? "--enable-cxx and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 + fi +fi + +## --enable-threadsafe is also incompatible with --enable-fortran, unless +## --enable-unsupported has been specified on the configure line. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_FORTRAN}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then + as_fn_error $? "--enable-fortran and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 + fi +fi + +case "X-$THREADSAFE" in + X-|X-no) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + X-yes) + THREADSAFE=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5 +$as_echo "error" >&6; } + as_fn_error $? "\'$enableval\' is not a valid threadsafe type" "$LINENO" 5 + ;; +esac + +if test "X$THREADSAFE" = "Xyes"; then + +$as_echo "#define HAVE_THREADSAFE 1" >>confdefs.h + + + ## ---------------------------------------------------------------------- + ## Is the pthreads library present? It has a header file `pthread.h' and + ## a library `-lpthread' and their locations might be specified with the + ## `--with-pthread' 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. + ## + ## Thread-safety in HDF5 only uses Pthreads via configure, so the + ## default is "yes", though this only has an effect when + ## --enable-threadsafe is specified. + HAVE_PTHREAD=yes # Check whether --with-pthread was given. if test "${with_pthread+set}" = set; then : withval=$with_pthread; else - withval=no + withval=yes fi -case "$withval" in - yes) - for ac_header in pthread.h + case "$withval" in + yes) + for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : @@ -26398,8 +26453,8 @@ fi done - if test "x$HAVE_PTHREAD" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + if test "x$HAVE_PTHREAD" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26454,44 +26509,44 @@ else unset HAVE_PTHREAD fi - fi - ;; - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread" >&5 + fi + ;; + no) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread" >&5 $as_echo_n "checking for pthread... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: suppressed" >&5 $as_echo "suppressed" >&6; } - unset HAVE_PTHREAD - ;; - *) - case "$withval" in - *,*) - pthread_inc="`echo $withval | cut -f1 -d,`" - pthread_lib="`echo $withval | cut -f2 -d, -s`" + unset HAVE_PTHREAD ;; *) - if test -n "$withval"; then - pthread_inc="$withval/include" - pthread_lib="$withval/lib" - fi - ;; - esac + case "$withval" in + *,*) + pthread_inc="`echo $withval | cut -f1 -d,`" + pthread_lib="`echo $withval | cut -f2 -d, -s`" + ;; + *) + if test -n "$withval"; then + pthread_inc="$withval/include" + pthread_lib="$withval/lib" + fi + ;; + esac - ## Trying to include -I/usr/include and -L/usr/lib is redundant and - ## can mess some compilers up. - if test "X$pthread_inc" = "X/usr/include"; then - pthread_inc="" - fi - if test "X$pthread_lib" = "X/usr/lib"; then - pthread_lib="" - fi + ## Trying to include -I/usr/include and -L/usr/lib is redundant and + ## can mess some compilers up. + if test "X$pthread_inc" = "X/usr/include"; then + pthread_inc="" + fi + if test "X$pthread_lib" = "X/usr/lib"; then + pthread_lib="" + fi - if test -n "$pthread_inc"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_AM_CPPFLAGS="$AM_CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$pthread_inc" - AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc" - for ac_header in pthread.h + if test -n "$pthread_inc"; then + saved_CPPFLAGS="$CPPFLAGS" + saved_AM_CPPFLAGS="$AM_CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$pthread_inc" + AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc" + for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : @@ -26505,8 +26560,8 @@ fi done - else - for ac_header in pthread.h + else + for ac_header in pthread.h do : ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" if test "x$ac_cv_header_pthread_h" = xyes; then : @@ -26520,15 +26575,15 @@ fi done - fi + fi - if test "x$HAVE_PTHREAD" = "xyes"; then - if test -n "$pthread_lib"; then - saved_LDFLAGS="$LDFLAGS" - saved_AM_LDFLAGS="$AM_LDFLAGS" - LDFLAGS="$LDFLAGS -L$pthread_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + if test "x$HAVE_PTHREAD" = "xyes"; then + if test -n "$pthread_lib"; then + saved_LDFLAGS="$LDFLAGS" + saved_AM_LDFLAGS="$AM_LDFLAGS" + LDFLAGS="$LDFLAGS -L$pthread_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26583,8 +26638,8 @@ else LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 $as_echo_n "checking for pthread_self in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_self+:} false; then : $as_echo_n "(cached) " >&6 @@ -26639,85 +26694,10 @@ else unset HAVE_PTHREAD fi - fi - fi - ;; -esac - -## ---------------------------------------------------------------------- -## Enable thread-safe version of library. It requires Pthreads support. -## -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for thread safe support" >&5 -$as_echo_n "checking for thread safe support... " >&6; } -# Check whether --enable-threadsafe was given. -if test "${enable_threadsafe+set}" = set; then : - enableval=$enable_threadsafe; THREADSAFE=$enableval -fi - - -## The --enable-threadsafe flag is not compatible with --enable-cxx. -## If the user tried to specify both flags, throw an error, unless -## they also provided the --enable-unsupported flag. -if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${HDF_CXX}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then - as_fn_error $? "--enable-cxx and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 - fi -fi - -## --enable-threadsafe is also incompatible with --enable-fortran, unless -## --enable-unsupported has been specified on the configure line. -if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then - if test "X${HDF_FORTRAN}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then - as_fn_error $? "--enable-fortran and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error." "$LINENO" 5 - fi -fi - -case "X-$THREADSAFE" in - X-|X-no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - X-yes) - ## Check that we can link a simple Pthread program. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -pthread_self() - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; }; THREADSAFE=yes -else - as_fn_error $? "needed pthread library not available" "$LINENO" 5 -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: error" >&5 -$as_echo "error" >&6; } - as_fn_error $? "\'$enableval\' is not a valid threadsafe type" "$LINENO" 5 - ;; -esac - -if test "X$THREADSAFE" = "Xyes"; then - -$as_echo "#define HAVE_THREADSAFE 1" >>confdefs.h - + fi + fi + ;; + esac fi ## ---------------------------------------------------------------------- diff --git a/configure.ac b/configure.ac index 8c0dbac..45e7c1f 100644 --- a/configure.ac +++ b/configure.ac @@ -1950,85 +1950,13 @@ AM_CONDITIONAL([BUILD_SHARED_SZIP_CONDITIONAL], [test "X$USE_FILTER_SZIP" = "Xye AC_CACHE_SAVE ## ---------------------------------------------------------------------- -## Is the Pthreads library present? It has a header file `pthread.h' and -## a library `-lpthread' and their locations might be specified with the -## `--with-pthread' 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_PTHREAD]) HAVE_PTHREAD=yes -AC_ARG_WITH([pthread], - [AS_HELP_STRING([--with-pthread=DIR], - [Use the Pthreads library [default=no]])],, - [withval=no]) - -case "$withval" in - yes) - AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) - if test "x$HAVE_PTHREAD" = "xyes"; then - AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) - fi - ;; - no) - AC_MSG_CHECKING([for pthread]) - AC_MSG_RESULT([suppressed]) - unset HAVE_PTHREAD - ;; - *) - case "$withval" in - *,*) - pthread_inc="`echo $withval | cut -f1 -d,`" - pthread_lib="`echo $withval | cut -f2 -d, -s`" - ;; - *) - if test -n "$withval"; then - pthread_inc="$withval/include" - pthread_lib="$withval/lib" - fi - ;; - esac - - ## Trying to include -I/usr/include and -L/usr/lib is redundant and - ## can mess some compilers up. - if test "X$pthread_inc" = "X/usr/include"; then - pthread_inc="" - fi - if test "X$pthread_lib" = "X/usr/lib"; then - pthread_lib="" - fi - - if test -n "$pthread_inc"; then - saved_CPPFLAGS="$CPPFLAGS" - saved_AM_CPPFLAGS="$AM_CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$pthread_inc" - AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc" - AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset HAVE_PTHREAD]) - else - AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) - fi - - if test "x$HAVE_PTHREAD" = "xyes"; then - if test -n "$pthread_lib"; then - saved_LDFLAGS="$LDFLAGS" - saved_AM_LDFLAGS="$AM_LDFLAGS" - LDFLAGS="$LDFLAGS -L$pthread_lib" - AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" - AC_CHECK_LIB([pthread], [pthread_self],, - [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD]) - else - AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) - fi - fi - ;; -esac - -## ---------------------------------------------------------------------- -## Enable thread-safe version of library. It requires Pthreads support. +## Enable thread-safe version of library. It requires Pthreads support +## on POSIX systems. ## AC_MSG_CHECKING([for thread safe support]) AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe], - [Enable thread safe capability])], + [Enable thread-safe capability])], [THREADSAFE=$enableval]) ## The --enable-threadsafe flag is not compatible with --enable-cxx. @@ -2053,10 +1981,8 @@ case "X-$THREADSAFE" in AC_MSG_RESULT([no]) ;; X-yes) - ## Check that we can link a simple Pthread program. - AC_TRY_LINK(, [pthread_self()], - [AC_MSG_RESULT([yes]); THREADSAFE=yes], - [AC_MSG_ERROR([needed pthread library not available])]) + THREADSAFE=yes + AC_MSG_RESULT([yes]) ;; *) AC_MSG_RESULT([error]) @@ -2065,7 +1991,83 @@ case "X-$THREADSAFE" in esac if test "X$THREADSAFE" = "Xyes"; then - AC_DEFINE([HAVE_THREADSAFE], [1], [Define if we have thread safe support]) + AC_DEFINE([HAVE_THREADSAFE], [1], [Define if we have thread safe support]) + + ## ---------------------------------------------------------------------- + ## Is the pthreads library present? It has a header file `pthread.h' and + ## a library `-lpthread' and their locations might be specified with the + ## `--with-pthread' 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. + ## + ## Thread-safety in HDF5 only uses Pthreads via configure, so the + ## default is "yes", though this only has an effect when + ## --enable-threadsafe is specified. + AC_SUBST([HAVE_PTHREAD]) HAVE_PTHREAD=yes + AC_ARG_WITH([pthread], + [AS_HELP_STRING([--with-pthread=DIR], + [Specify alternative path to Pthreads library when thread-safe capability is built])],, + [withval=yes]) + + case "$withval" in + yes) + AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) + if test "x$HAVE_PTHREAD" = "xyes"; then + AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) + fi + ;; + no) + AC_MSG_CHECKING([for pthread]) + AC_MSG_RESULT([suppressed]) + unset HAVE_PTHREAD + ;; + *) + case "$withval" in + *,*) + pthread_inc="`echo $withval | cut -f1 -d,`" + pthread_lib="`echo $withval | cut -f2 -d, -s`" + ;; + *) + if test -n "$withval"; then + pthread_inc="$withval/include" + pthread_lib="$withval/lib" + fi + ;; + esac + + ## Trying to include -I/usr/include and -L/usr/lib is redundant and + ## can mess some compilers up. + if test "X$pthread_inc" = "X/usr/include"; then + pthread_inc="" + fi + if test "X$pthread_lib" = "X/usr/lib"; then + pthread_lib="" + fi + + if test -n "$pthread_inc"; then + saved_CPPFLAGS="$CPPFLAGS" + saved_AM_CPPFLAGS="$AM_CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$pthread_inc" + AM_CPPFLAGS="$AM_CPPFLAGS -I$pthread_inc" + AC_CHECK_HEADERS([pthread.h],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; unset HAVE_PTHREAD]) + else + AC_CHECK_HEADERS([pthread.h],, [unset HAVE_PTHREAD]) + fi + + if test "x$HAVE_PTHREAD" = "xyes"; then + if test -n "$pthread_lib"; then + saved_LDFLAGS="$LDFLAGS" + saved_AM_LDFLAGS="$AM_LDFLAGS" + LDFLAGS="$LDFLAGS -L$pthread_lib" + AM_LDFLAGS="$AM_LDFLAGS -L$pthread_lib" + AC_CHECK_LIB([pthread], [pthread_self],, + [LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_PTHREAD]) + else + AC_CHECK_LIB([pthread], [pthread_self],, [unset HAVE_PTHREAD]) + fi + fi + ;; + esac fi ## ---------------------------------------------------------------------- diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 036d877..88b3803 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -121,6 +121,9 @@ Bug Fixes since HDF5-1.8.12 - CMake: Remove use of XLATE_UTILITY program. (ADB - 2014/03/28 HDFFV-8640) - CMake: Added missing quotes in setting the CMAKE_EXE_LINKER_FLAGS for the MPI option. (ADB - 2014/02/27 HDFFV-8674) + - It is no longer necessary to specify --with-pthreads with + --enable-threadsafe if the Pthreads library is in a standard location. + Fixes HDFFV-8693. (DER - 2014/04/11) Library ------- -- cgit v0.12