Bug in AX_LIB_HDF5

Harald Anlauf <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <trinity-a08e5e26-8b4d-4074-9963-53c68aa61a35-1675200745491@3c-app-gmx-bap11>
Hello,

when analyzing the output from `h5fc -show', which e.g. on my Linux
system is

  gfortran -I/usr/include -L/usr/lib64 -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5

one would like to put all options of type -Ldirectory into variable
HDF5_FLIBS (for the linking flags) instead of HDF5_FFLAGS (for the
compilation flags).

The attached trivial & obvious patch fixes this.

Feel free to use it.

Thanks,
Harald
0001-AX_LIB_HDF5-fix-derivation-of-compile-and-link-flags.patch (text/x-patch, 1.4 KB)
From 9bb09588d99d119ca0b9adbf7e69f370daf1b9f5 Mon Sep 17 00:00:00 2001
From: Harald Anlauf <[email protected]>
Date: Tue, 22 Feb 2022 16:25:27 +0100
Subject: [PATCH] AX_LIB_HDF5: fix derivation of compile and link flags for
 Fortran

When analyzing the output from `h5fc -show`, add options of type -Ldir to
HDF5_FLIBS, not to HDF5_FFLAGS.
---
 m4/ax_lib_hdf5.m4 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/m4/ax_lib_hdf5.m4 b/m4/ax_lib_hdf5.m4
index 074c2a8..6b913d7 100644
--- a/m4/ax_lib_hdf5.m4
+++ b/m4/ax_lib_hdf5.m4
@@ -88,7 +88,7 @@
 #   and this notice are preserved. This file is offered as-is, without any
 #   warranty.

-#serial 20
+#serial 21

 AC_DEFUN([AX_LIB_HDF5], [

@@ -280,8 +280,8 @@ HDF5 support is being disabled (equivalent to --with-hdf5=no).
                 -I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
                       || HDF5_FFLAGS="$HDF5_FFLAGS $arg"
                   ;;#(
-                -L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
-                      || HDF5_FFLAGS="$HDF5_FFLAGS $arg"
+                -L*) echo $HDF5_FLIBS | $GREP -e "$arg" >/dev/null \
+                      || HDF5_FLIBS="$HDF5_FLIBS $arg"
                      dnl HDF5 installs .mod files in with libraries,
                      dnl but some compilers need to find them with -I
                      echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \
--
2.35.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.