Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally use system provided netcdf #3184

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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])],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to make a local copy of pkg.m4 before we try to use PKG_CHECK_MODULES? My system has it installed, but we don't want bootstrap to rely on anything more than our own contrib/autotools version.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is part of pkgconf, so it should be there already.

From several years of packaging experience, bundled copies only get out of sync with upstream and are a reoccurring PITA.

Copy link
Member

@roystgnr roystgnr Mar 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is part of pkgconf, so it should be there already.

Sadly I have committed the ought-is fallacy and been burned by it too many times to not check, and ... it's almost guaranteed to be available on Ubuntu (It's a dependency for ubuntu-desktop now, of all things? The default GUI now depends on autoconf macros??), but the next system I checked was an OSX laptop, where although everything I need to build (and even bootstrap) libMesh is there, pkg.m4 isn't.

bundled copies only get out of sync with upstream and are a reoccurring PITA.

I can't disagree with this. But adding dependencies willy-nilly has gotten me in trouble too. What does pkg.m4 itself depend on? If it's self-contained (and looks like it is, in a couple hundred lines?) I'd feel safer working with a copy of it than letting people without it break.


[3], [
dnl We shouldn't get here, see if test above.
AC_MSG_ERROR([>>> Error: netCDF3 is no longer distributed with libMesh <<<])
Expand Down