summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2014-03-21 15:19:07 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2014-03-21 15:19:07 (GMT)
commit7a4727d80c8b4f160105cb0dea174256fee9bd1e (patch)
tree83f5da3ce24bb34efe784e603d1b32a04603dd70 /configure.ac
parent6515a1f8acce70f1ad8c9b3073d9669cf139b7fe (diff)
downloadhdf5-7a4727d80c8b4f160105cb0dea174256fee9bd1e.zip
hdf5-7a4727d80c8b4f160105cb0dea174256fee9bd1e.tar.gz
hdf5-7a4727d80c8b4f160105cb0dea174256fee9bd1e.tar.bz2
[svn-r24857] --enable-threadsafe no longer requires --with-pthreads if Pthreads can
be found in the standard include and library paths. Tested on: 32-bit LE linux (jam) SunOS 5.11 (emu) 64-bit Darwin 12.5 (kite) 64-bit FreeBSD 8.2 (freedom) Testing focused on making sure that Pthreads could be found on different platforms and investigating the interaction of Fortran/C++/thread-safe options.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac162
1 files changed, 82 insertions, 80 deletions
diff --git a/configure.ac b/configure.ac
index 8121326..31381ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1932,85 +1932,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.
@@ -2035,10 +1963,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])
@@ -2047,7 +1973,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
## ----------------------------------------------------------------------