diff --git a/.github/workflows/documentation-and-style.yml b/.github/workflows/documentation-and-style.yml index 3988db7675..c83de48159 100644 --- a/.github/workflows/documentation-and-style.yml +++ b/.github/workflows/documentation-and-style.yml @@ -18,11 +18,11 @@ jobs: continue-on-error: true - name: Install packages used when generating documentation - run: > - sudo apt-get install - python3-sphinx python3-lxml perl - texlive-binaries texlive-base bibtool tex-common texlive-bibtex-extra - graphviz + run: | + sudo apt-get update + sudo apt-get install python3-sphinx python3-lxml perl + sudo apt-get install texlive-binaries texlive-base bibtool tex-common texlive-bibtex-extra + sudo apt-get install graphviz - name: Build doxygen HTML run: | diff --git a/ac/configure.ac b/ac/configure.ac index 14249fc09a..b069fdd56f 100644 --- a/ac/configure.ac +++ b/ac/configure.ac @@ -82,12 +82,20 @@ AX_FC_CHECK_MODULE([mpi], # netCDF configuration -AC_PATH_PROG([NC_CONFIG], [nc-config]) -AS_IF([test -n "$NC_CONFIG"], - [CPPFLAGS="$CPPFLAGS -I$($NC_CONFIG --includedir)" - FCFLAGS="$FCFLAGS -I$($NC_CONFIG --includedir)" - LDFLAGS="$LDFLAGS -L$($NC_CONFIG --libdir)"], - [AC_MSG_ERROR([Could not find nc-config.])]) + +# NOTE: `nf-config --flibs` combines library paths (-L) and libraries (-l), +# even though these ought to be separated in the invocation of `ld`. +# +# We use `sed` to strip the -l and pass the -L to LDFLAGS, and rely on autoconf +# to configure the -l flags. +AC_PROG_SED + +AC_PATH_PROG([NF_CONFIG], [nf-config]) +AS_IF([test -n "$NF_CONFIG"], + [CPPFLAGS="$CPPFLAGS $($NF_CONFIG --fflags)" + FCFLAGS="$FCFLAGS $($NF_CONFIG --fflags)" + LDFLAGS="$LDFLAGS $($NF_CONFIG --flibs | $SED -e 's/-l[[^ ]]*//g')"], + [AC_MSG_ERROR([Could not find nf-config.])]) AX_FC_CHECK_MODULE([netcdf], [], [AC_MSG_ERROR([Could not find netcdf module.])]) diff --git a/ac/deps/configure.fms.ac b/ac/deps/configure.fms.ac index 714f20df6b..4ac86f6445 100644 --- a/ac/deps/configure.fms.ac +++ b/ac/deps/configure.fms.ac @@ -73,12 +73,20 @@ AC_DEFINE([use_libMPI]) # netCDF configuration -AC_PATH_PROG([NC_CONFIG], [nc-config]) -AS_IF([test -n "$NC_CONFIG"], - [CPPFLAGS="$CPPFLAGS -I$($NC_CONFIG --includedir)" - FCFLAGS="$FCFLAGS -I$($NC_CONFIG --includedir)" - LDFLAGS="$LDFLAGS -L$($NC_CONFIG --libdir)"], - [AC_MSG_ERROR([Could not find nc-config.])]) + +# NOTE: `nf-config --flibs` combines library paths (-L) and libraries (-l), +# even though these ought to be separated in the invocation of `ld`. +# +# We use `sed` to strip the -l and pass the -L to LDFLAGS, and rely on autoconf +# to configure the -l flags. +AC_PROG_SED + +AC_PATH_PROG([NF_CONFIG], [nf-config]) +AS_IF([test -n "$NF_CONFIG"], + [CPPFLAGS="$CPPFLAGS $($NF_CONFIG --fflags)" + FCFLAGS="$FCFLAGS $($NF_CONFIG --fflags)" + LDFLAGS="$LDFLAGS $($NF_CONFIG --flibs | $SED -e 's/-l[[^ ]]*//g')"], + [AC_MSG_ERROR([Could not find nf-config.])]) AX_FC_CHECK_MODULE([netcdf], [], [AC_MSG_ERROR([Could not find netcdf module.])])