Skip to content
Snippets Groups Projects
Commit 017951f3 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

configure: check for H5get_libversion()

parent f9f1f6df
No related branches found
No related tags found
No related merge requests found
......@@ -26855,8 +26855,7 @@ esac
 
 
# ----------------------------------------------------------------------
# Compile application with SZLIB library, needed for GRIB1 or for
# linking against hdf5/netcdf4
# Compile application with SZLIB library, needed for GRIB1
SZLIB_INCLUDE=''
SZLIB_LIBS=''
 
......@@ -27430,7 +27429,7 @@ for ac_lib in '' netcdf; do
ac_res="none required"
else
ac_res=-l$ac_lib
LIBS="-l$ac_lib -lhdf5_hl -lhdf5 $ac_func_search_save_LIBS"
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
......@@ -27461,6 +27460,67 @@ fi
 
fi
 
if test "x$ENABLE_NC4HDF5" = "xyes"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing H5get_libversion" >&5
$as_echo_n "checking for library containing H5get_libversion... " >&6; }
if ${ac_cv_search_H5get_libversion+:} 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 H5get_libversion ();
int
main ()
{
return H5get_libversion ();
;
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_H5get_libversion=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
if ${ac_cv_search_H5get_libversion+:} false; then :
break
fi
done
if ${ac_cv_search_H5get_libversion+:} false; then :
else
ac_cv_search_H5get_libversion=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_H5get_libversion" >&5
$as_echo "$ac_cv_search_H5get_libversion" >&6; }
ac_res=$ac_cv_search_H5get_libversion
if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
$as_echo "#define HAVE_H5GET_LIBVERSION 1" >>confdefs.h
fi
fi
 
 
 
......@@ -27,8 +27,7 @@ AS_CASE([$with_threads],
AC_SUBST([THREADS_INCLUDE])
AC_SUBST([THREADS_LIBS])
# ----------------------------------------------------------------------
# Compile application with SZLIB library, needed for GRIB1 or for
# linking against hdf5/netcdf4
# Compile application with SZLIB library, needed for GRIB1
SZLIB_INCLUDE=''
SZLIB_LIBS=''
AC_ARG_WITH([szlib],
......@@ -138,8 +137,11 @@ AC_ARG_WITH([netcdf],
AS_IF([test "x$ENABLE_NC4HDF5" = "xyes"],
[AC_SEARCH_LIBS([H5TS_mutex_lock], [netcdf],
[AC_DEFINE([HAVE_NC4HDF5_THREADSAFE],[1],[Define to 1 for NetCDF4/HDF5 threadsafe support])],,
[-lhdf5_hl -lhdf5])])
[AC_DEFINE([HAVE_NC4HDF5_THREADSAFE],[1],[Define to 1 for NetCDF4/HDF5 threadsafe support])],,)])
AS_IF([test "x$ENABLE_NC4HDF5" = "xyes"],
[AC_SEARCH_LIBS([H5get_libversion], [netcdf],
[AC_DEFINE([HAVE_H5GET_LIBVERSION],[1],[Define to 1 for H5get_libversion support])],,)])
AC_SUBST([ENABLE_NETCDF])
AC_SUBST([ENABLE_NC2])
......
......@@ -17,13 +17,13 @@
const char *cdfLibraryVersion(void)
{
#if defined (HAVE_LIBNETCDF)
return (nc_inq_libvers());
return nc_inq_libvers();
#else
return ("library undefined");
return "library undefined";
#endif
}
#if defined(HAVE_NC4HDF5)
#if defined(HAVE_H5GET_LIBVERSION)
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -35,7 +35,7 @@ extern "C" {
const char *hdfLibraryVersion(void)
{
#if defined(HAVE_NC4HDF5)
#if defined(HAVE_H5GET_LIBVERSION)
static char hdf_libvers[256];
unsigned majnum, minnum, relnum;
......@@ -43,9 +43,9 @@ const char *hdfLibraryVersion(void)
sprintf(hdf_libvers, "%u.%u.%u", majnum, minnum, relnum);
return (hdf_libvers);
return hdf_libvers;
#else
return ("library undefined");
return "library undefined";
#endif
}
......@@ -137,24 +137,23 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype)
}
#endif
return (ncid);
return ncid;
}
int cdfOpen(const char *filename, const char *mode)
{
int fileID = 0;
int filetype = FILETYPE_NC;
if ( CDF_Debug )
Message("Open %s with mode %c", filename, *mode);
fileID = cdfOpenFile(filename, mode, &filetype);
int fileID = cdfOpenFile(filename, mode, &filetype);
if ( CDF_Debug )
Message("File %s opened with id %d", filename, fileID);
return (fileID);
return fileID;
}
......@@ -185,7 +184,7 @@ int cdfOpen64(const char *filename, const char *mode)
fileID = CDI_ELIBNAVAIL;
}
return (fileID);
return fileID;
}
......@@ -213,7 +212,7 @@ int cdf4Open(const char *filename, const char *mode, int *filetype)
fileID = CDI_ELIBNAVAIL;
}
return (fileID);
return fileID;
}
......
......@@ -79,6 +79,9 @@
/* Define to 1 if you have the `grib_get_length' function. */
#undef HAVE_GRIB_GET_LENGTH
/* Define to 1 for H5get_libversion support */
#undef HAVE_H5GET_LIBVERSION
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment