Skip to content

Commit

Permalink
Optionally use system provided netcdf
Browse files Browse the repository at this point in the history
Detect a system wide installed netcdf using pkgconfig and use it, in
case --enable-netcdf=system is specified.

Fixes libMesh#1542.
  • Loading branch information
StefanBruens committed Mar 7, 2022
1 parent 32b495d commit f40a5c0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion m4/libmesh_optional_packages.m4
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,15 @@ AM_CONDITIONAL(LIBMESH_ENABLE_HDF5, test x$enablehdf5 = xyes)
# --------------------------------------------------------------
CONFIGURE_NETCDF
AS_IF([test $enablenetcdf = yes],
[libmesh_contrib_INCLUDES="$NETCDF_INCLUDE $libmesh_contrib_INCLUDES"])
[
AS_IF([test x$netcdfversion = xsystem],
[
libmesh_optional_INCLUDES="$NETCDF_CFLAGS $libmesh_optional_INCLUDES"
libmesh_optional_LIBS="$NETCDF_LIBS $libmesh_optional_LIBS"
],
[
libmesh_contrib_INCLUDES="$NETCDF_INCLUDE $libmesh_contrib_INCLUDES"])
])
AM_CONDITIONAL(LIBMESH_ENABLE_NETCDF, test x$enablenetcdf = xyes)
AM_CONDITIONAL(LIBMESH_ENABLE_NETCDF_V4, test x$netcdfversion = x4)
Expand Down
4 changes: 4 additions & 0 deletions m4/netcdf.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ AC_DEFUN([CONFIGURE_NETCDF],
AS_HELP_STRING([--disable-netcdf],
[build without netCDF binary I/O]),
[AS_CASE("${enableval}",
[system], [enablenetcdf=yes
netcdfversion=system],
[yes|new|v4], [enablenetcdf=yes
netcdfversion=4],
[old|v3], [enablenetcdf=yes
Expand All @@ -27,6 +29,8 @@ AC_DEFUN([CONFIGURE_NETCDF],
])
AS_CASE("${netcdfversion}",
[system], [PKG_CHECK_MODULES([NETCDF], [netcdf >= 4.2])],
[3], [
dnl We shouldn't get here, see if test above.
AC_MSG_ERROR([>>> Error: netCDF3 is no longer distributed with libMesh <<<])
Expand Down

0 comments on commit f40a5c0

Please sign in to comment.