1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-11-03 20:54:07 +01:00

pkgconfig

This commit is contained in:
Anthony Scemama 2021-05-05 12:17:15 +02:00
parent f7dea1fd1c
commit f272d27863
3 changed files with 39 additions and 13 deletions

View File

@ -75,6 +75,7 @@ $(distdir): FORCE
cp $(srcdir)/tests/test.f90 $(distdir)/tests
cp $(srcdir)/tests/Makefile.in $(distdir)/tests
cp $(srcdir)/Makefile.in $(distdir)
cp $(srcdir)/trexio.pc.in $(distdir)
cp $(srcdir)/LICENSE $(distdir)

View File

@ -17,6 +17,7 @@ fi
AC_CONFIG_SRCDIR([src/Makefile.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([trexio.pc])
PKG_PROG_PKG_CONFIG()
# Checks for programs.
AC_PROG_CC
@ -70,6 +71,10 @@ if test "x${hdf5}" = xno; then
Configuring with the HDF5 library is
recommended to build efficient TREXIO.
------------------------------------------])
PKG_HDF5=""
PKG_HDF5_LIBS=""
PKG_HDF5_CFLAGS=""
elif test "x${hdf5}" = xyes; then
# Check if HDF5 is already configured (e.g. after calling `module load hdf5-<version>`)
@ -85,6 +90,13 @@ elif test "x${hdf5}" = xyes; then
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
FCFLAGS="${HDF5_CFLAGS} ${FCFLAGS}"
LIBS="${HDF5_LIBS} -lhdf5_hl ${LIBS}"
PKG_HDF5="hdf5"
PKG_HDF5_LIBS=""
PKG_HDF5_CFLAGS=""
else
PKG_HDF5=""
PKG_HDF5_LIBS="${HDF5_LIBS} -lhdf5_hl"
PKG_HDF5_CFLAGS="${HDF5_CFLAGS}"
fi
else
@ -107,7 +119,14 @@ else
AC_CHECK_HEADERS([hdf5.h])
AC_CHECK_LIB([hdf5], [H5open], [], [have_hdf5=no])
PKG_HDF5=""
PKG_HDF5_LIBS="-L${hdf5} -lhdf5_hl"
PKG_HDF5_CFLAGS="-I${hdf5}/include"
fi
AC_SUBST([PKG_HDF5])
AC_SUBST([PKG_HDF5_LIBS])
AC_SUBST([PKG_HDF5_CFLAGS])
# add -fPIC if not present in CFLAGS, necessary to compile TREXIO
# TODO: replace with AM_CFLAGS for appropriate targer once Automake is introduced

View File

@ -12,6 +12,8 @@ includedir = @includedir@
docdir = @docdir@
htmldir = @htmldir@
libdir = @libdir@
pkgconfigdir= $(libdir)/pkgconfig
# Supplementary
exec_prefix = @exec_prefix@
libexecdir = @libexecdir@
@ -99,16 +101,20 @@ cppcheck.out: $(HEADER_FILES) $(SOURCE_FILES)
# $(DESTDIR) is needed for future support of package managers
# install should avoid build target due to possible conflict when prefix overriden
install:
$(INSTALL) -d $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(INSTALL) -d $(DESTDIR)$(includedir)
$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
cp $(libtrexio) $(DESTDIR)$(libdir)
cp $(trexio_h) $(DESTDIR)$(includedir)
cp $(trexio_f) $(DESTDIR)$(includedir)
cp ../trexio.pc $(DESTDIR)$(pkgconfigdir)
uninstall:
-$(RM) -- $(DESTDIR)$(libdir)/$(libtrexio_so)
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_h_file)
-$(RM) -- $(DESTDIR)$(includedir)/$(trexio_f_file)
-$(RM) -- $(DESTDIR)$(pkgconfigdir)/trexio.pc
clean: