From cb30d8f36cead7cec7fdcfb4fed5231caafe97da Mon Sep 17 00:00:00 2001 From: Gilles Filippini Date: Sat, 14 May 2022 03:32:24 +0800 Subject: [PATCH] Add option --with-flavor= to configure so that '_' is appended to each built library, .e.g. libhdf5_.so. This we can avoid library name collisions when installing both serial and $mpi flavors of the libraries: * serial is built with no flavor name * $mpi parallel versions use --with-flavor=$mpi =================================================================== Gbp-Pq: Name flavor-configure-option.patch --- c++/src/Makefile.am | 12 ++++++ c++/src/h5c++.in | 17 ++++---- config/commence.am | 9 +++-- configure.ac | 20 ++++++++++ fortran/src/Makefile.am | 24 ++++++++++-- fortran/src/h5fc.in | 15 +++---- hl/c++/src/Makefile.am | 12 ++++++ hl/fortran/src/Makefile.am | 21 ++++++++-- hl/src/Makefile.am | 20 ++++++++-- .../datasets/JavaDatasetExample.sh.in | 2 +- .../datatypes/JavaDatatypeExample.sh.in | 2 +- java/examples/groups/JavaGroupExample.sh.in | 2 +- java/examples/intro/JavaIntroExample.sh.in | 2 +- java/test/junit.sh.in | 2 +- src/Makefile.am | 39 +++++++++++++++---- src/libhdf5.settings.in | 1 + test/testlibinfo.sh.in | 6 +-- tools/src/misc/Makefile.am | 4 ++ tools/src/misc/h5cc.in | 13 ++++--- 19 files changed, 171 insertions(+), 52 deletions(-) diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 949325a..a63a4f0 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -73,4 +73,16 @@ mostlyclean-local: # Mark this directory as part of the C++ API CXX_API=yes +# Flavor-dev links +if FLAVOR +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5_cpp.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done +endif + include $(top_srcdir)/config/conclude.am diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index f068f51..b423456 100644 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -25,6 +25,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" libdir="@libdir@" +libdevdir="@libdir@/hdf5/@FLAVOR_NAME@" includedir="@includedir@" HL="@HL@" @@ -159,7 +160,7 @@ usage() { # libhdf5.settings file reside in the lib directory. showconfigure() { - cat ${libdir}/libhdf5.settings + cat ${libdir}/libhdf5@FLAVOR@.settings status=$? } @@ -317,7 +318,7 @@ if test "x$do_link" = "xyes"; then else libraries=" $libraries -lhdf5_cpp -lhdf5 " fi - link_args="$link_args -L${libdir}" + link_args="$link_args -L${libdevdir}" case "$kind" in gcc|linux*) @@ -336,7 +337,7 @@ if test "x$do_link" = "xyes"; then esac if test -n "$flag"; then - shared_link="${flag}${libdir}" + shared_link="${flag}${libdevdir}" fi if test "x$USE_SHARED_LIB" != "xyes"; then @@ -346,16 +347,16 @@ if test "x$do_link" = "xyes"; then for lib in $libraries; do case "$lib" in -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5.a" ;; -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_hl.a" ;; -lhdf5_cpp) - new_libraries="$new_libraries ${libdir}/libhdf5_cpp.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_cpp.a" ;; -lhdf5_hl_cpp) - new_libraries="$new_libraries ${libdir}/libhdf5_hl_cpp.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_hl_cpp.a" ;; *) new_libraries="$new_libraries $lib" @@ -385,7 +386,7 @@ if test "x$do_link" = "xyes"; then # from the hdf5 build. The order of the flags is intended to give precedence # to the user's flags. - $SHOW $CXXLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link + $SHOW $CXXLINKER -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CXXFLAGS $CXXFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link status=$? fi diff --git a/config/commence.am b/config/commence.am index 5fe21a6..433d7aa 100644 --- a/config/commence.am +++ b/config/commence.am @@ -30,15 +30,15 @@ CP=cp RUNEXEC=$(RUNSERIAL) # Libraries to link to while building -LIBHDF5=$(top_builddir)/src/libhdf5.la +LIBHDF5=$(top_builddir)/src/libhdf5@FLAVOR@.la LIBH5TEST=$(top_builddir)/test/libh5test.la -LIBH5F=$(top_builddir)/fortran/src/libhdf5_fortran.la +LIBH5F=$(top_builddir)/fortran/src/libhdf5@FLAVOR@_fortran.la LIBH5FTEST=$(top_builddir)/fortran/test/libh5test_fortran.la LIBH5CPP=$(top_builddir)/c++/src/libhdf5_cpp.la LIBH5JNI=$(top_builddir)/java/src/jni/libhdf5_java.la LIBH5TOOLS=$(top_builddir)/tools/lib/libh5tools.la -LIBH5_HL=$(top_builddir)/hl/src/libhdf5_hl.la -LIBH5F_HL=$(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la +LIBH5_HL=$(top_builddir)/hl/src/libhdf5@FLAVOR@_hl.la +LIBH5F_HL=$(top_builddir)/hl/fortran/src/libhdf5@FLAVOR@hl_fortran.la LIBH5CPP_HL=$(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la # Install directories that automake doesn't know about @@ -102,3 +102,4 @@ CHECK_CLEANFILES=*.chkexe *.chklog *.clog *.clog2 help: @$(top_srcdir)/bin/makehelp +abs2rel = $(shell perl -e 'use File::Spec; print File::Spec->abs2rel($(1), $(2)) . "\n";') diff --git a/configure.ac b/configure.ac index 3f06676..5f35e04 100644 --- a/configure.ac +++ b/configure.ac @@ -3424,6 +3424,26 @@ fi ## AM_CONDITIONAL([HAVE_SHARED_CONDITIONAL], [test "X$enable_shared" = "Xyes"]) +## ---------------------------------------------------------------------- +## Option to use a flavor name +## +AC_ARG_WITH([flavor], + [AS_HELP_STRING([--with-flavor=], + [append specified flavor name to the hdf5 libraries"'" names])], + [], + [with_flavor=""]) +if test -n "$with_flavor"; then + FLAVOR_NAME="$with_flavor" + FLAVOR="_$FLAVOR_NAME" + AM_CONDITIONAL([FLAVOR], [true]) +else + FLAVOR_NAME="(none)" + FLAVOR= + AM_CONDITIONAL([FLAVOR], [false]) +fi +AC_SUBST([FLAVOR_NAME]) +AC_SUBST([FLAVOR]) + AC_CONFIG_FILES([src/libhdf5.settings Makefile src/Makefile diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index 666f6cb..3433d6b 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -27,10 +27,10 @@ AM_FCFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/fortran/src AM_FCLIBS=$(LIBHDF5) # This is our main target, the fortran library -lib_LTLIBRARIES=libhdf5_fortran.la +lib_LTLIBRARIES=libhdf5@FLAVOR@_fortran.la # Add libtool numbers to the HDF5 Fortran library (from config/lt_vers.am) -libhdf5_fortran_la_LDFLAGS= -version-info $(LT_F_VERS_INTERFACE):$(LT_F_VERS_REVISION):$(LT_F_VERS_AGE) $(AM_LDFLAGS) +libhdf5@FLAVOR@_fortran_la_LDFLAGS= -version-info $(LT_F_VERS_INTERFACE):$(LT_F_VERS_REVISION):$(LT_F_VERS_AGE) $(AM_LDFLAGS) # Some Fortran compilers can't build shared libraries, so sometimes we # want to build a shared C library and a static Fortran library. If so, @@ -41,7 +41,7 @@ else endif # Source files for the library. -libhdf5_fortran_la_SOURCES=H5f90global.F90 \ +libhdf5@FLAVOR@_fortran_la_SOURCES=H5f90global.f90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ @@ -49,7 +49,7 @@ libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90 # HDF5 Fortran library depends on HDF5 Library. -libhdf5_fortran_la_LIBADD=$(LIBHDF5) +libhdf5@FLAVOR@_fortran_la_LIBADD=$(LIBHDF5) # h5fc is generated during configure. # Remove it only when distclean. @@ -93,7 +93,11 @@ install-exec-local: # Custom rule for installing h5fc, since it will be named h5pfc if hdf5 # is configured for parallel mode if BUILD_PARALLEL_CONDITIONAL +if FLAVOR + H5FC_NAME = h5pfc.@FLAVOR_NAME@ +else H5FC_NAME = h5pfc +endif else H5FC_NAME = h5fc endif @@ -164,4 +168,16 @@ HDF5.lo: $(srcdir)/HDF5.F90 H5f90global.lo H5_ff.lo H5Aff.lo \ H5Off.lo H5Pff.lo H5Rff.lo \ H5Sff.lo H5Tff.lo H5Zff.lo H5_gen.lo +# Flavor-dev links +if FLAVOR +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5@FLAVOR@_fortran.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done +endif + include $(top_srcdir)/config/conclude_fc.am diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index 29ef83f..e35e3ca 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -25,6 +25,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" libdir="@libdir@" +libdevdir="@libdir@/hdf5/@FLAVOR_NAME@" includedir="@includedir@" HL="@HL@" @@ -154,7 +155,7 @@ usage() { # libhdf5.settings file reside in the lib directory. showconfigure() { - cat ${libdir}/libhdf5.settings + cat ${libdir}/libhdf5@FLAVOR@.settings status=$? } @@ -304,7 +305,7 @@ if test "x$do_link" = "xyes"; then else libraries=" $libraries -lhdf5_fortran -lhdf5 " fi - link_args="$link_args -L${libdir}" + link_args="$link_args -L${libdevdir}" case "$host_os" in linux*) flag="@fortran_linux_linker_option@-rpath -Wl," ;; @@ -316,7 +317,7 @@ if test "x$do_link" = "xyes"; then esac if test -n "$flag"; then - shared_link="${flag}${libdir}" + shared_link="${flag}${libdevdir}" fi if test "x$USE_SHARED_LIB" != "xyes"; then @@ -326,16 +327,16 @@ if test "x$do_link" = "xyes"; then for lib in $libraries; do case "$lib" in -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5.a" ;; -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_hl.a" ;; -lhdf5_fortran) - new_libraries="$new_libraries ${libdir}/libhdf5_fortran.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_fortran.a" ;; -lhdf5hl_fortran) - new_libraries="$new_libraries ${libdir}/libhdf5hl_fortran.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5hl_fortran.a" ;; *) new_libraries="$new_libraries $lib" diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am index 363ba3b..61e70de 100644 --- a/hl/c++/src/Makefile.am +++ b/hl/c++/src/Makefile.am @@ -38,4 +38,16 @@ libhdf5_hl_cpp_la_LIBADD=$(LIBH5_HL) $(LIBH5CPP) # Public headers include_HEADERS=H5PacketTable.h +# Flavor-dev links +if FLAVOR +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5_hl_cpp.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done +endif + include $(top_srcdir)/config/conclude.am diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index a495e22..60da544 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -25,10 +25,10 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/hl/src -I$(top_builddir)/hl/src AM_FCFLAGS+=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/src # Our main target, the high-level fortran library -lib_LTLIBRARIES=libhdf5hl_fortran.la +lib_LTLIBRARIES=libhdf5@FLAVOR@hl_fortran.la # Add libtool numbers to the HDF5 HL Fortran library (from config/lt_vers.am) -libhdf5hl_fortran_la_LDFLAGS= -version-info $(LT_HL_F_VERS_INTERFACE):$(LT_HL_F_VERS_REVISION):$(LT_HL_F_VERS_AGE) $(AM_LDFLAGS) +libhdf5@FLAVOR@hl_fortran_la_LDFLAGS= -version-info $(LT_HL_F_VERS_INTERFACE):$(LT_HL_F_VERS_REVISION):$(LT_HL_F_VERS_AGE) $(AM_LDFLAGS) # Some Fortran compilers can't build shared libraries, so sometimes we # want to build a shared C library and a static Fortran library. If so, @@ -44,11 +44,11 @@ endif #endif # List sources to include in the HDF5 HL Fortran library. -libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ +libhdf5@FLAVOR@hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \ H5DSff.F90 H5LTff.F90 H5TBff.F90 H5IMff.F90 H5LTff_gen.F90 H5TBff_gen.F90 # HDF5 HL Fortran library depends on HDF5 Library. -libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) +libhdf5@FLAVOR@hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F) # Fortran module files can have different extensions and different names # (e.g., different capitalizations) on different platforms. Write rules @@ -98,4 +98,17 @@ H5IMff.lo: $(srcdir)/H5IMff.F90 H5TBff.lo: $(srcdir)/H5TBff.F90 H5LTff_gen.lo: H5LTff.lo H5LTff_gen.F90 H5TBff_gen.lo: H5TBff.lo H5LTff_gen.F90 H5TBff_gen.F90 + +# Flavor-dev links +if FLAVOR +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5@FLAVOR@hl_fortran.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done +endif + include $(top_srcdir)/config/conclude_fc.am diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index 4ef1f5f..eeef1f3 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -23,18 +23,30 @@ include $(top_srcdir)/config/lt_vers.am AM_CPPFLAGS+=-I$(top_srcdir)/src # This library is our main target. -lib_LTLIBRARIES=libhdf5_hl.la +lib_LTLIBRARIES=libhdf5@FLAVOR@_hl.la # Add libtool numbers to the HDF5 hl library (from config/lt_vers.am) -libhdf5_hl_la_LDFLAGS= -version-info $(LT_HL_VERS_INTERFACE):$(LT_HL_VERS_REVISION):$(LT_HL_VERS_AGE) $(AM_LDFLAGS) +libhdf5@FLAVOR@_hl_la_LDFLAGS= -version-info $(LT_HL_VERS_INTERFACE):$(LT_HL_VERS_REVISION):$(LT_HL_VERS_AGE) $(AM_LDFLAGS) # List sources to include in the HDF5 HL Library. -libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c +libhdf5@FLAVOR@_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c H5LD.c # HDF5 HL library depends on HDF5 Library. -libhdf5_hl_la_LIBADD=$(LIBHDF5) +libhdf5@FLAVOR@_hl_la_LIBADD=$(LIBHDF5) # Public header files (to be installed) include_HEADERS=hdf5_hl.h H5DOpublic.h H5IMpublic.h H5LTpublic.h H5TBpublic.h H5DSpublic.h H5PTpublic.h H5LDpublic.h +# Flavor-dev links +if FLAVOR +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5@FLAVOR@_hl.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done +endif + include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datasets/JavaDatasetExample.sh.in b/java/examples/datasets/JavaDatasetExample.sh.in index f5c63cd..7eff59f 100644 --- a/java/examples/datasets/JavaDatasetExample.sh.in +++ b/java/examples/datasets/JavaDatasetExample.sh.in @@ -52,7 +52,7 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$top_builddir/src/.libs/libhdf5.* +$top_builddir/src/.libs/libhdf5@FLAVOR@.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " diff --git a/java/examples/datatypes/JavaDatatypeExample.sh.in b/java/examples/datatypes/JavaDatatypeExample.sh.in index 447512a..892cb5b 100644 --- a/java/examples/datatypes/JavaDatatypeExample.sh.in +++ b/java/examples/datatypes/JavaDatatypeExample.sh.in @@ -49,7 +49,7 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$top_builddir/src/.libs/libhdf5.* +$top_builddir/src/.libs/libhdf5@FLAVOR@.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " diff --git a/java/examples/groups/JavaGroupExample.sh.in b/java/examples/groups/JavaGroupExample.sh.in index 9d4673f..c40410f 100644 --- a/java/examples/groups/JavaGroupExample.sh.in +++ b/java/examples/groups/JavaGroupExample.sh.in @@ -51,7 +51,7 @@ test -d $BLDITERDIR || mkdir -p $BLDITERDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$top_builddir/src/.libs/libhdf5.* +$top_builddir/src/.libs/libhdf5@FLAVOR@.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " diff --git a/java/examples/intro/JavaIntroExample.sh.in b/java/examples/intro/JavaIntroExample.sh.in index 1886485..7f1078e 100644 --- a/java/examples/intro/JavaIntroExample.sh.in +++ b/java/examples/intro/JavaIntroExample.sh.in @@ -49,7 +49,7 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$top_builddir/src/.libs/libhdf5.* +$top_builddir/src/.libs/libhdf5@FLAVOR@.* $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 02d0147..f818622 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -56,7 +56,7 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR # Comment '#' without space can be used. # -------------------------------------------------------------------- LIST_LIBRARY_FILES=" -$top_builddir/src/.libs/libhdf5.* +$top_builddir/src/.libs/libhdf5@FLAVOR@.* $top_builddir/java/src/jni/.libs/libhdf5_java.* " LIST_JAR_TESTFILES=" diff --git a/src/Makefile.am b/src/Makefile.am index a0defad..272f508 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,10 +27,10 @@ include $(top_srcdir)/config/lt_vers.am noinst_PROGRAMS = H5detect H5make_libsettings # Our main target, the HDF5 library -lib_LTLIBRARIES=libhdf5.la +lib_LTLIBRARIES=libhdf5@FLAVOR@.la # Add libtool numbers to the HDF5 library (from config/lt_vers.am) -libhdf5_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5@FLAVOR@_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) # H5Tinit.c and H5lib_settings.c are generated files and should be cleaned. MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c @@ -38,7 +38,7 @@ MOSTLYCLEANFILES=H5Tinit.c H5lib_settings.c DISTCLEANFILES=H5pubconf.h # library sources -libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ +libhdf5@FLAVOR@_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \ H5AC.c H5ACdbg.c H5AClog.c H5ACproxy_entry.c \ H5B.c H5Bcache.c H5Bdbg.c \ @@ -119,12 +119,12 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ # Only compile parallel sources if necessary if BUILD_PARALLEL_CONDITIONAL - libhdf5_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c + libhdf5@FLAVOR@_la_SOURCES += H5ACmpio.c H5Cmpio.c H5Dmpio.c H5Fmpi.c H5FDmpi.c H5FDmpio.c H5Smpio.c endif # Only compile the direct VFD if necessary if DIRECT_VFD_CONDITIONAL - libhdf5_la_SOURCES += H5FDdirect.c + libhdf5@FLAVOR@_la_SOURCES += H5FDdirect.c endif # Public headers @@ -143,7 +143,11 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers # install libhdf5.settings in lib directory settingsdir=$(libdir) -settings_DATA=libhdf5.settings +if FLAVOR +libhdf5@FLAVOR@.settings: libhdf5.settings + ln -s $< $@ +endif +settings_DATA=libhdf5@FLAVOR@.settings # Number format detection # The LD_LIBRARY_PATH setting is a kludge. @@ -185,6 +189,7 @@ $(top_srcdir)/src/H5version.h: $(top_srcdir)/src/H5vers.txt $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt perl $(top_srcdir)/bin/make_overflow $? + # Add TRACE macros to library source files. This is done via the trace script # in the hdf5/bin directory. If the file contains HDF5 API macros, a "clean" # version of the source file is saved with a tilde (~) after its name and @@ -192,7 +197,7 @@ $(top_srcdir)/src/H5overflow.h: $(top_srcdir)/src/H5overflow.txt # without HDF5 macros. .PHONY: trace -trace: $(libhdf5_la_SOURCES) +trace: $(libhdf5@FLAVOR@_la_SOURCES) @for dep in $? dummy; do \ if test $$dep != "dummy" -a -n "$(PERL)"; then \ case "$$dep" in \ @@ -203,4 +208,24 @@ trace: $(libhdf5_la_SOURCES) fi; \ done +# Flavor-dev links +if FLAVOR +install-exec-hook: relincludedir := $(call abs2rel,"$(includedir)","$(libdir)") +install-exec-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + for lib in libhdf5@FLAVOR@.*; do \ + link=$$(echo $$lib | sed 's/@FLAVOR@//') && \ + $(LN_S) ../../$$lib hdf5/@FLAVOR_NAME@/$$link || \ + exit 1; \ + done + $(LN_S) . $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@/lib + $(LN_S) ../../$(relincludedir) $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@/include + +install-data-hook: + mkdir -p $(DESTDIR)$(libdir)/hdf5/@FLAVOR_NAME@ + cd $(DESTDIR)$(libdir) && \ + $(LN_S) ../../libhdf5@FLAVOR@.settings hdf5/@FLAVOR_NAME@/libhdf5.settings +endif + include $(top_srcdir)/config/conclude.am diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 531cd00..06ab7ad 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -10,6 +10,7 @@ General Information: Uname information: @UNAME_INFO@ Byte sex: @BYTESEX@ Installation point: @prefix@ + Flavor name: @FLAVOR_NAME@ Compiling Options: ------------------ diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in index 1dd744b..2c14c8a 100644 --- a/test/testlibinfo.sh.in +++ b/test/testlibinfo.sh.in @@ -77,7 +77,7 @@ fi # built too. if [ -n $Shared_Lib ]; then h5libdir=../src/.libs - shlib=$(grep dlname ../src/libhdf5.la | sed -e "s/dlname='//" -e "s/'//") + shlib=$(grep dlname ../src/libhdf5@FLAVOR@.la | sed -e "s/dlname='//" -e "s/'//") else h5libdir=../src fi @@ -96,9 +96,9 @@ fi # Though rare, libhdf5.a may not have been built. if [ x-$Static_Lib = x-yes ]; then - CHECK_LIBINFO ${h5libdir}/libhdf5.a + CHECK_LIBINFO ${h5libdir}/libhdf5@FLAVOR@.a else - SKIP ${h5libdir}/libhdf5.a + SKIP ${h5libdir}/libhdf5@FLAVOR@.a fi # Check if executables has the lib information only if shared lib is not diff --git a/tools/src/misc/Makefile.am b/tools/src/misc/Makefile.am index 64c5ee5..3ad6f58 100644 --- a/tools/src/misc/Makefile.am +++ b/tools/src/misc/Makefile.am @@ -43,7 +43,11 @@ LDADD=$(LIBH5TOOLS) $(LIBHDF5) # h5cc needs custom install and uninstall rules, since it may be # named h5pcc if hdf5 is being built in parallel mode. if BUILD_PARALLEL_CONDITIONAL +if FLAVOR + H5CC_NAME=h5pcc.@FLAVOR_NAME@ +else H5CC_NAME=h5pcc +endif else H5CC_NAME=h5cc endif diff --git a/tools/src/misc/h5cc.in b/tools/src/misc/h5cc.in index 9c4e3ca..52631a3 100644 --- a/tools/src/misc/h5cc.in +++ b/tools/src/misc/h5cc.in @@ -27,6 +27,7 @@ prefix="@prefix@" exec_prefix="@exec_prefix@" libdir="@libdir@" +libdevdir="@libdir@/hdf5/@FLAVOR_NAME@" includedir="@includedir@" HL="@HL@" @@ -170,7 +171,7 @@ usage() { # libhdf5.settings file reside in the lib directory. showconfigure() { - cat ${libdir}/libhdf5.settings + cat ${libdir}/libhdf5@FLAVOR@.settings status=$? } @@ -331,7 +332,7 @@ if test "x$do_link" = "xyes"; then else libraries=" $libraries -lhdf5 " fi - link_args="$link_args -L${libdir}" + link_args="$link_args -L${libdevdir}" case "$kind" in gcc|linux*) @@ -350,7 +351,7 @@ if test "x$do_link" = "xyes"; then esac if test -n "$flag"; then - shared_link="${flag}${libdir}" + shared_link="${flag}${libdevdir}" fi if test "x$USE_SHARED_LIB" != "xyes"; then @@ -360,10 +361,10 @@ if test "x$do_link" = "xyes"; then for lib in $libraries; do case "$lib" in -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5.a" ;; -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" + new_libraries="$new_libraries ${libdevdir}/libhdf5_hl.a" ;; *) new_libraries="$new_libraries $lib" @@ -392,7 +393,7 @@ if test "x$do_link" = "xyes"; then # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in # from the hdf5 build. The order of the flags is intended to give precedence # to the user's flags. - $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link + $SHOW $CLINKER -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link status=$? fi