summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2013-09-25 22:04:18 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2013-09-25 22:04:18 (GMT)
commit497234f8e36c0d4597b5ed77b4a2fa1a5621b02b (patch)
treebb7fd14176a3a71889db1da15bc9258e871d1bbe /tools
parent26039efe65cb8e9666e9ca2ad116cd3a2accf957 (diff)
downloadhdf5-497234f8e36c0d4597b5ed77b4a2fa1a5621b02b.zip
hdf5-497234f8e36c0d4597b5ed77b4a2fa1a5621b02b.tar.gz
hdf5-497234f8e36c0d4597b5ed77b4a2fa1a5621b02b.tar.bz2
[svn-r24201] Merged changes from trunk revisions 23431, 23527 and 24077.
Switched default to link to shared lib files when HDF5 is configure with --disable-static. This addressed HDFFV-8141, h5cc failed because it defaulted to link to lib*.a files which aren't built with --disable-static. -help message also updated. Tested in trunk. Merged code tested with h5committest.
Diffstat (limited to 'tools')
-rw-r--r--tools/misc/h5cc.in43
1 files changed, 29 insertions, 14 deletions
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 233c80a..da1a26d 100644
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -85,11 +85,12 @@ CLINKERBASE="@CC@"
# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user.
# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS.
-# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts to override
-# them. User's LDFLAGS come just before clibpath, user's LIBS come after
-# $link_objs and before the hdf5 libraries in $link_args, followed by any
-# external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS
-# or LIBS carried in from the hdf5 build.
+# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+# before the hdf5 libraries in $link_args, followed by any external library
+# 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.
H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@"
H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
@@ -102,7 +103,17 @@ CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}"
LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}"
LIBS="${HDF5_LIBS:-$LIBSBASE}"
-USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
+# If a static library is available, the default will be to use it. If the only
+# available library is shared, it will be used by default. The user can
+# override either default, although choosing an unavailable library will result
+# in link errors.
+STATIC_AVAILABLE="@enable_static@"
+if test "${STATIC_AVAILABLE}" = "yes"; then
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
+else
+ USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}"
+fi
+
usage() {
# A wonderfully informative "usage" message.
@@ -121,8 +132,10 @@ usage() {
echo " subdirectories [default: $prefix]"
echo " -show Show the commands without executing them"
echo " -showconfig Show the HDF5 library configuration summary"
- echo " -shlib Compile with shared HDF5 libraries"
- echo " -noshlib Compile with static HDF5 libraries [default]"
+ echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built"
+ echo " without static libraries]"
+ echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built"
+ echo " with static libraries]"
echo " "
echo " <compile line> - the normal compile line options for your compiler."
echo " $prog_name uses the same compiler you used to compile"
@@ -136,7 +149,8 @@ usage() {
echo " HDF5_CC - use a different C compiler"
echo " HDF5_CLINKER - use a different linker"
echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library"
- echo " [default: no]"
+ echo " [default: no except when built with only"
+ echo " shared libraries]"
echo " "
echo " You can also add or change paths and flags to the compile line using"
echo " the following environment varibles or by assigning them to their counterparts"
@@ -374,11 +388,12 @@ if test "x$do_link" = "xyes"; then
# module. It's okay if they're included twice in the compile line.
link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS"
- # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts to override
- # them. User's LDFLAGS come just before clibpath, user's LIBS come after
- # $link_objs and before the hdf5 libraries in $link_args, followed by any
- # external library paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS
- # or LIBS carried in from the hdf5 build.
+ # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's
+ # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and
+ # before the hdf5 libraries in $link_args, followed by any external library
+ # 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
status=$?
fi