Skip to content

Commit af202c5

Browse files
committed
Patch hdf5.m4 so that -lhdf5 comes later
close #4347
1 parent eb5796f commit af202c5

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

m4/hdf5.m4

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,16 @@ AS_IF([test "x${with_hdf5}" != "xno"],
124124
[
125125
AS_IF([test -d "${HDF5_PREFIX}/lib"],
126126
[
127-
HDF5_LIBS="-L${HDF5_PREFIX}/lib -lhdf5"
127+
HDF5_LDFLAGS="-L${HDF5_PREFIX}/lib"
128+
HDF5_LIBS="-lhdf5"
128129
])
129130
130131
dnl If there is an "rpath" flag detected, append it to the various
131132
dnl LIBS vars. This avoids hard-coding -Wl,-rpath, in case that is
132133
dnl not the right approach for some compilers.
133134
AS_IF([test "x$RPATHFLAG" != "x" && test -d "${HDF5_PREFIX}/lib"],
134135
[
135-
HDF5_LIBS="${HDF5_LIBS} ${RPATHFLAG}${HDF5_PREFIX}/lib"
136+
HDF5_LDFLAGS="${HDF5_LDFLAGS} ${RPATHFLAG}${HDF5_PREFIX}/lib"
136137
])
137138
138139
AS_IF([test -d "${HDF5_PREFIX}/include"], [HDF5_CPPFLAGS="-I${HDF5_PREFIX}/include"])
@@ -144,7 +145,8 @@ AS_IF([test "x${with_hdf5}" != "xno"],
144145
145146
CFLAGS="${HDF5_CPPFLAGS} ${CFLAGS}"
146147
CPPFLAGS="${HDF5_CPPFLAGS} ${CPPFLAGS}"
147-
LDFLAGS="${HDF5_LIBS} ${LDFLAGS}"
148+
LDFLAGS="${HDF5_LDFLAGS} ${LDFLAGS}"
149+
LIBS="${HDF5_LIBS} ${LIBS}"
148150
AC_LANG_PUSH([C])
149151
AC_CHECK_HEADER([hdf5.h],[found_header=yes],[found_header=no])
150152
@@ -231,6 +233,7 @@ AS_IF([test "x${with_hdf5}" != "xno"],
231233
AC_DEFINE(HAVE_HDF5,1,[Define if HDF5 is available])
232234
AC_SUBST(HDF5_CFLAGS)
233235
AC_SUBST(HDF5_CPPFLAGS)
236+
AC_SUBST(HDF5_LDFLAGS)
234237
AC_SUBST(HDF5_LIBS)
235238
AC_SUBST(HDF5_PREFIX)
236239
])

0 commit comments

Comments
 (0)