Skip to content
Snippets Groups Projects
Commit 9709add8 authored by Jorrit Fahlke's avatar Jorrit Fahlke
Browse files

Document output of the macro.

put -L into LIBS.
Add to ALL_PKG_*

[[Imported from SVN: r5850]]
parent 8f2c6c3f
No related branches found
No related tags found
No related merge requests found
## -*- autoconf -*-
# $Id$
# searches for HDF5-stuff
# DUNE_PATH_HDF5()
#
# shell variables:
# with_hdf5
# no, yes, or "yes (parallel)"
# with_hdf5_libs
# empty or something apropriate for LIBS
# HDF5_CPPFLAGS
# HDF5_LDFLAGS
# HDF5_LIBS
# HDF5_PARALLEL
# 1 or undef
# HAVE_HDF5
# 0 ot 1
#
# substitutions:
# HDF5_CPPFLAGS
# HDF5_LDFLAGS
# HDF5_LIBS
#
# defines:
# HAVE_HDF5
#
# conditionals:
# HDF5
AC_DEFUN([DUNE_PATH_HDF5],[
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_PATH_XTRA])
......@@ -16,11 +42,9 @@ AC_DEFUN([DUNE_PATH_HDF5],[
[AC_HELP_STRING([--with-hdf5-libs=LIBS],[additional libraries needed to link hdf5 programs. Those might be needed if your hdf5 library is static. Possible values are: -lz or -lz -lsz.])],[])
# store values
ac_save_CFLAGS="$CFLAGS"
ac_save_CPPFLAGS="$CPPFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
ac_save_LIBS="$LIBS"
LIBS=""
# start building variables
......@@ -32,27 +56,40 @@ AC_DEFUN([DUNE_PATH_HDF5],[
else
AC_MSG_ERROR([HDF5-directory $with_hdf5 does not exist])
fi
LDFLAGS="$LDFLAGS -L$with_hdf5/lib"
HDF5_LDFLAGS="$LDFLAGS"
CPPFLAGS="$CPPFLAGS -I$with_hdf5/include"
_dune_hdf5_libpath="-L$with_hdf5/lib"
_dune_hdf5_incpath="-I$with_hdf5/include"
else
_dune_hdf5_libpath=""
_dune_hdf5_incpath=""
fi
CPPFLAGS="$CPPFLAGS $_dune_hdf5_incpath"
HDF5_CPPFLAGS=""
HDF5_LDFLAGS=""
HDF5_LIBS=""
HDF5_PARALLEL=0
# test if we are parallel
AC_CHECK_DECL(H5_HAVE_PARALLEL, [dnl
LIBS="$DUNEMPILIBS $LIBS"
LDFLAGS="$LDFLAGS $DUNEMPILDFLAGS"
CPPFLAGS="$CPPFLAGS $DUNEMPICPPFLAGS"
HDF5_CPPFLAGS="$HDF5_CPPFLAGS \${DUNEMPICPPFLAGS}"
LDFLAGS="$LDFLAGS $DUNEMPILDFLAGS"
HDF5_LDFLAGS="$HDF5_LDFLAGS \${DUNEMPILDFLAGS}"
LIBS="$DUNEMPILIBS $LIBS"
HDF5_LIBS="\${DUNEMPILIBS} $HDF5_LIBS"
HDF5_PARALLEL=1],[],[#include"H5pubconf.h"])
# test for an arbitrary header
AC_CHECK_HEADER([hdf5.h],
[HAVE_HDF5=1]
HDF5_CPPFLAGS="$CPPFLAGS",
[HAVE_HDF5=1],
[HAVE_HDF5=0])
# Just fotr the configure check, -L has to go into LIBS in the end
LDFLAGS="$LDFLAGS $_dune_hdf5_libpath"
# test for lib
if test x$HAVE_HDF5 = x1 ; then
AC_CHECK_LIB(hdf5, H5open,[HDF5_LIBS="-lhdf5 $with_hdf5_libs"],
AC_CHECK_LIB([hdf5], [H5open],
[HDF5_LIBS="$_dune_hdf5_libpath -lhdf5 $with_hdf5_libs $HDF5_LIBS"],
[HAVE_HDF5=0], ["$with_hdf5_libs"])
fi
......@@ -61,20 +98,33 @@ AC_DEFUN([DUNE_PATH_HDF5],[
# did we succeed?
if test x$HAVE_HDF5 = x1 ; then
AC_SUBST(HDF5_CPPFLAGS, $HDF5_CPPFLAGS)
AC_SUBST(HDF5_LDFLAGS, $HDF5_LDFLAGS)
AC_SUBST(HDF5_LIBS, $HDF5_LIBS)
AC_DEFINE(HAVE_HDF5, 1, [Define to 1 if hdf5 was found])
# proudly show in summary
with_hdf5="yes"
if test x"$HDF5_PARALLEL" = x1; then
with_hdf5="$with_hdf5 (parallel)"
fi
else
# clear variables
HDF5_CPPFLAGS=
HDF5_LDFLAGS=
HDF5_LIBS=
HDF5_PARALLEL=0
fi
AC_SUBST([HDF5_CPPFLAGS])
AC_SUBST([HDF5_LDFLAGS])
AC_SUBST([HDF5_LIBS])
# also tell automake
AM_CONDITIONAL(HDF5, test x$HAVE_HDF5 = x1)
# add to global list
DUNE_ADD_ALL_PKG([HDF5], [\${HDF5_CPPFLAGS}],
[\${HDF5_LDFLAGS}], [\${HDF5_LIBS}])
# reset values
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
LDFLAGS="$ac_save_LDFLAGS"
CPPFLAGS="$ac_save_CPPFLAGS"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment