Commit 5bc53c65 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

configure: check whether netCDF4/HDF5 is threadsafe

parent 271a915e
......@@ -2,6 +2,10 @@
* Version 1.6.8 released
2015-03-21 Uwe Schulzweida
* configure: check whether netCDF4/HDF5 is threadsafe
2015-03-21 Uwe Schulzweida
* expr: added support for logical operator <=>
......
......@@ -245,6 +245,7 @@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
......
......@@ -657,6 +657,7 @@ JASPER_LIBS
NETCDF_LIBS
NETCDF_INCLUDE
NETCDF_ROOT
ENABLE_NC4HDF5
ENABLE_NC4
ENABLE_NC2
ENABLE_NETCDF
......@@ -18913,6 +18914,7 @@ NETCDF_LIBS=''
ENABLE_NETCDF=no
ENABLE_NC2=no
ENABLE_NC4=no
ENABLE_NC4HDF5=no
 
# Check whether --with-netcdf was given.
if test "${with_netcdf+set}" = set; then :
......@@ -18996,7 +18998,68 @@ else
as_fn_error $? "Could not link to netcdf library" "$LINENO" 5
fi
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5TS_mutex_lock" >&5
$as_echo_n "checking for library containing H5TS_mutex_lock... " >&6; }
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char H5TS_mutex_lock ();
int
main ()
{
return H5TS_mutex_lock ();
;
return 0;
}
_ACEOF
for ac_lib in '' netcdf; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_H5TS_mutex_lock=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
break
fi
done
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
else
ac_cv_search_H5TS_mutex_lock=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_H5TS_mutex_lock" >&5
$as_echo "$ac_cv_search_H5TS_mutex_lock" >&6; }
ac_res=$ac_cv_search_H5TS_mutex_lock
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_NC4HDF5_THREADSAFE 1" >>confdefs.h
fi
NETCDF_LIBS=" -lnetcdf"
# Extract the first word of "nc-config", so it can be a program name with args.
set dummy nc-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
......@@ -19060,6 +19123,19 @@ $as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc4/hdf5 support" >&5
$as_echo_n "checking netcdf's nc4/hdf5 support... " >&6; }
if test "x$($NC_CONFIG --has-hdf5)" = "xyes"; then :
$as_echo "#define HAVE_NC4HDF5 1" >>confdefs.h
ENABLE_NC4HDF5=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
$as_echo Could not find nc-config! go on with default configuration
......@@ -19142,6 +19218,66 @@ else
as_fn_error $? "Could not link to netcdf library" "$LINENO" 5
fi
 
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5TS_mutex_lock" >&5
$as_echo_n "checking for library containing H5TS_mutex_lock... " >&6; }
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char H5TS_mutex_lock ();
int
main ()
{
return H5TS_mutex_lock ();
;
return 0;
}
_ACEOF
for ac_lib in '' netcdf; do
if test -z "$ac_lib"; then
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib -lhdf5_hl -lhdf5 $ac_func_search_save_LIBS"
fi
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_H5TS_mutex_lock=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
break
fi
done
if ${ac_cv_search_H5TS_mutex_lock+:} false; then :
else
ac_cv_search_H5TS_mutex_lock=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_H5TS_mutex_lock" >&5
$as_echo "$ac_cv_search_H5TS_mutex_lock" >&6; }
ac_res=$ac_cv_search_H5TS_mutex_lock
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_NC4HDF5_THREADSAFE 1" >>confdefs.h
fi
NETCDF_LIBS=" -L$NETCDF_ROOT/lib -lnetcdf"
NETCDF_INCLUDE=" -I$NETCDF_ROOT/include"
 
......@@ -19222,6 +19358,19 @@ $as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking netcdf's nc4/hdf5 support" >&5
$as_echo_n "checking netcdf's nc4/hdf5 support... " >&6; }
if test "x$($NC_CONFIG --has-hdf5)" = "xyes"; then :
$as_echo "#define HAVE_NC4HDF5 1" >>confdefs.h
ENABLE_NC4HDF5=yes
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Could not find nc-config! go on with default configuration" >&5
......@@ -19247,6 +19396,7 @@ fi
 
 
 
# ----------------------------------------------------------------------
# Link application with JASPER library (needed for GRIB2 compression)
JASPER_LIBS=''
......
......@@ -156,6 +156,7 @@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
......
......@@ -141,6 +141,7 @@ NETCDF_LIBS=''
ENABLE_NETCDF=no
ENABLE_NC2=no
ENABLE_NC4=no
ENABLE_NC4HDF5=no
AC_ARG_WITH([netcdf],
[AS_HELP_STRING([--with-netcdf=<yes|no|directory> (default=no)],[location of netcdf library (lib and include subdirs)])],
[AS_CASE(["$with_netcdf"],
......@@ -152,7 +153,12 @@ AC_ARG_WITH([netcdf],
[AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])
ENABLE_NETCDF=yes],
[AC_MSG_ERROR([Could not link to netcdf library])])
AC_SEARCH_LIBS([H5TS_mutex_lock], [netcdf],
[AC_DEFINE([HAVE_NC4HDF5_THREADSAFE],[1],[Define to 1 for NETCDF4/HDF5 threadsafe support])])
NETCDF_LIBS=" -lnetcdf"
AC_CHECK_PROG(NC_CONFIG,nc-config,nc-config)
AS_IF([test "x$NC_CONFIG" != "x"],
[AC_MSG_CHECKING([netcdf's nc2 support])
......@@ -164,7 +170,12 @@ AC_ARG_WITH([netcdf],
AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
ENABLE_NC4=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([netcdf's nc4/hdf5 support])
AS_IF([test "x$($NC_CONFIG --has-hdf5)" = "xyes"],
[AC_DEFINE([HAVE_NC4HDF5],[1],[Define to 1 for NETCDF4/HDF5 support])
ENABLE_NC4HDF5=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])]) ],
[AS_ECHO([Could not find nc-config! go on with default configuration])])],
[*],[AS_IF([test -d "$with_netcdf"],
[NETCDF_ROOT=$with_netcdf
......@@ -176,6 +187,11 @@ AC_ARG_WITH([netcdf],
[AC_DEFINE([HAVE_LIBNETCDF],[1],[Define to 1 for NETCDF support])
ENABLE_NETCDF=yes],
[AC_MSG_ERROR([Could not link to netcdf library])])
AC_SEARCH_LIBS([H5TS_mutex_lock], [netcdf],
[AC_DEFINE([HAVE_NC4HDF5_THREADSAFE],[1],[Define to 1 for NETCDF4/HDF5 threadsafe support])],,
[-lhdf5_hl -lhdf5])
NETCDF_LIBS=" -L$NETCDF_ROOT/lib -lnetcdf"
NETCDF_INCLUDE=" -I$NETCDF_ROOT/include"
......@@ -195,7 +211,12 @@ AC_ARG_WITH([netcdf],
AS_IF([test "x$($NC_CONFIG --has-nc4)" = "xyes"],
[AC_DEFINE([HAVE_NETCDF4],[1],[Define to 1 for NETCDF4 support])
ENABLE_NC4=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])],
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])])
AC_MSG_CHECKING([netcdf's nc4/hdf5 support])
AS_IF([test "x$($NC_CONFIG --has-hdf5)" = "xyes"],
[AC_DEFINE([HAVE_NC4HDF5],[1],[Define to 1 for NETCDF4/HDF5 support])
ENABLE_NC4HDF5=yes
AC_MSG_RESULT([yes])],[AC_MSG_RESULT([no])]) ],
[AC_MSG_RESULT([Could not find nc-config! go on with default configuration])])],
[AC_MSG_NOTICE([$with_netcdf is not a directory! NETCDF suppressed])])])],
[AC_MSG_CHECKING([for NETCDF library])
......@@ -203,6 +224,7 @@ AC_ARG_WITH([netcdf],
AC_SUBST([ENABLE_NETCDF])
AC_SUBST([ENABLE_NC2])
AC_SUBST([ENABLE_NC4])
AC_SUBST([ENABLE_NC4HDF5])
AC_SUBST([NETCDF_ROOT])
AC_SUBST([NETCDF_INCLUDE])
AC_SUBST([NETCDF_LIBS])
......
......@@ -410,6 +410,7 @@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
......
......@@ -136,6 +136,12 @@
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define to 1 for NETCDF4/HDF5 support */
#undef HAVE_NC4HDF5
/* Define to 1 for NETCDF4/HDF5 threadsafe support */
#undef HAVE_NC4HDF5_THREADSAFE
/* Define to 1 for NETCDF2 support */
#undef HAVE_NETCDF2
......
......@@ -32,6 +32,12 @@ void printFeatures(void)
#endif
#if defined(HAVE_NETCDF4)
fprintf(stderr, " NC4");
#if defined(HAVE_NC4HDF5)
fprintf(stderr, "/HDF5");
#if defined(HAVE_NC4HDF5_THREADSAFE)
fprintf(stderr, "/threadsafe");
#endif
#endif
#endif
#if defined(HAVE_LIBNC_DAP)
fprintf(stderr, " OPeNDAP");
......
......@@ -368,6 +368,7 @@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
......
......@@ -155,6 +155,7 @@ ENABLE_GRIBAPI = @ENABLE_GRIBAPI@
ENABLE_IEG = @ENABLE_IEG@
ENABLE_NC2 = @ENABLE_NC2@
ENABLE_NC4 = @ENABLE_NC4@
ENABLE_NC4HDF5 = @ENABLE_NC4HDF5@
ENABLE_NETCDF = @ENABLE_NETCDF@
ENABLE_SERVICE = @ENABLE_SERVICE@
EXEEXT = @EXEEXT@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment