Skip to content

Commit 6db50dd

Browse files
committed
Add configure options: --with-hdf5 --with-hdf4 and --with-pnetcdf
1 parent 06ac972 commit 6db50dd

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

configure.ac

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,43 @@ enable_hdf5=no
210210
fi
211211
AC_MSG_RESULT([$enable_hdf5])
212212

213+
AC_PROG_EGREP
214+
215+
AC_ARG_WITH([hdf5],
216+
[AS_HELP_STRING([--with-hdf5=/path/to/hdf5], [Specify HDF5 installation path(s):
217+
--with-hdf5=INC,LIB for include directory and library directory separated by a comma
218+
--with-hdf5=DIR for directory containing include/ and lib/ subdirectories
219+
])], [
220+
case $withval in
221+
*,*)
222+
hdf5_inc="`echo $withval |cut -f1 -d,`"
223+
hdf5_lib="`echo $withval |cut -f2 -d, -s`"
224+
;;
225+
*)
226+
if test -n "$withval"; then
227+
hdf5_inc="$withval/include"
228+
hdf5_lib="$withval/lib"
229+
fi
230+
;;
231+
esac
232+
if test "x$hdf5_inc" != x ; then
233+
if test "x$CPPFLAGS" = x ; then
234+
CPPFLAGS="-I$hdf5_inc"
235+
elif ! echo "${CPPFLAGS}" | ${EGREP} -q -w -- "-I$hdf5_inc" ; then
236+
# append only if not already appear in CPPFLAGS
237+
CPPFLAGS="$CPPFLAGS -I$hdf5_inc"
238+
fi
239+
fi
240+
if test "x$hdf5_lib" != x ; then
241+
if test "x$LDFLAGS" = x ; then
242+
LDFLAGS="-L$hdf5_lib"
243+
elif ! echo "${LDFLAGS}" | ${EGREP} -q -w -- "-L$hdf5_lib" ; then
244+
# append only if not already appear in LDFLAGS
245+
LDFLAGS="$LDFLAGS -L$hdf5_lib"
246+
fi
247+
fi
248+
])
249+
213250
# Does the user require dynamic loading?
214251
# This is only for those hdf5 installs that support it.
215252
AC_MSG_CHECKING([do we require hdf5 dynamic-loading support])
@@ -228,6 +265,41 @@ if test "x$enable_hdf4" = xyes -a "x$enable_netcdf_4" = xno; then
228265
fi
229266
AC_MSG_RESULT($enable_hdf4)
230267

268+
AC_ARG_WITH([hdf4],
269+
[AS_HELP_STRING([--with-hdf4=/path/to/hdf4], [Specify HDF4 installation path(s):
270+
--with-hdf4=INC,LIB for include directory and library directory separated by a comma
271+
--with-hdf4=DIR for directory containing include/ and lib/ subdirectories
272+
])], [
273+
case $withval in
274+
*,*)
275+
hdf4_inc="`echo $withval |cut -f1 -d,`"
276+
hdf4_lib="`echo $withval |cut -f2 -d, -s`"
277+
;;
278+
*)
279+
if test -n "$withval"; then
280+
hdf4_inc="$withval/include"
281+
hdf4_lib="$withval/lib"
282+
fi
283+
;;
284+
esac
285+
if test "x$hdf4_inc" != x ; then
286+
if test "x$CPPFLAGS" = x ; then
287+
CPPFLAGS="-I$hdf4_inc"
288+
elif ! echo "${CPPFLAGS}" | ${EGREP} -q -w -- "-I$hdf4_inc" ; then
289+
# append only if not already appear in CPPFLAGS
290+
CPPFLAGS="$CPPFLAGS -I$hdf4_inc"
291+
fi
292+
fi
293+
if test "x$hdf4_lib" != x ; then
294+
if test "x$LDFLAGS" = x ; then
295+
LDFLAGS="-L$hdf4_lib"
296+
elif ! echo "${LDFLAGS}" | ${EGREP} -q -w -- "-L$hdf4_lib" ; then
297+
# append only if not already appear in LDFLAGS
298+
LDFLAGS="$LDFLAGS -L$hdf4_lib"
299+
fi
300+
fi
301+
])
302+
231303
# Does the user want to turn on extra HDF4 file tests?
232304
AC_MSG_CHECKING([whether to fetch some sample HDF4 files from Unidata ftp site to test HDF4 reading (requires wget)])
233305
AC_ARG_ENABLE([hdf4-file-tests], [AS_HELP_STRING([--enable-hdf4-file-tests],
@@ -1125,6 +1197,41 @@ AC_ARG_ENABLE([pnetcdf], [AS_HELP_STRING([--enable-pnetcdf],
11251197
test "x$enable_pnetcdf" = xyes || enable_pnetcdf=no
11261198
AC_MSG_RESULT($enable_pnetcdf)
11271199

1200+
AC_ARG_WITH([pnetcdf],
1201+
[AS_HELP_STRING([--with-pnetcdf=/path/to/pnetcdf], [Specify PnetCDF installation path(s):
1202+
--with-pnetcdf=INC,LIB for include directory and library directory separated by a comma
1203+
--with-pnetcdf=DIR for directory containing include/ and lib/ subdirectories
1204+
])], [
1205+
case $withval in
1206+
*,*)
1207+
pnetcdf_inc="`echo $withval |cut -f1 -d,`"
1208+
pnetcdf_lib="`echo $withval |cut -f2 -d, -s`"
1209+
;;
1210+
*)
1211+
if test -n "$withval"; then
1212+
pnetcdf_inc="$withval/include"
1213+
pnetcdf_lib="$withval/lib"
1214+
fi
1215+
;;
1216+
esac
1217+
if test "x$pnetcdf_inc" != x ; then
1218+
if test "x$CPPFLAGS" = x ; then
1219+
CPPFLAGS="-I$pnetcdf_inc"
1220+
elif ! echo "${CPPFLAGS}" | ${EGREP} -q -w -- "-I$pnetcdf_inc" ; then
1221+
# append only if not already appear in CPPFLAGS
1222+
CPPFLAGS="$CPPFLAGS -I$pnetcdf_inc"
1223+
fi
1224+
fi
1225+
if test "x$pnetcdf_lib" != x ; then
1226+
if test "x$LDFLAGS" = x ; then
1227+
LDFLAGS="-L$pnetcdf_lib"
1228+
elif ! echo "${LDFLAGS}" | ${EGREP} -q -w -- "-L$pnetcdf_lib" ; then
1229+
# append only if not already appear in LDFLAGS
1230+
LDFLAGS="$LDFLAGS -L$pnetcdf_lib"
1231+
fi
1232+
fi
1233+
])
1234+
11281235
# See if the PnetCDF lib is available and of the
11291236
# right version (1.6.0 or later)
11301237
if test "x$enable_pnetcdf" = xyes; then

0 commit comments

Comments
 (0)