summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2010-09-17 23:09:03 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2010-09-17 23:09:03 (GMT)
commit91565db20993a0bf73b3d32828bb87b8e7d6bf0c (patch)
tree647990cbf3089d4212e4e536fc567a3bed239356 /tools
parentca71aa92bdea9298ebc516ca984aa28aba0087e4 (diff)
downloadhdf5-91565db20993a0bf73b3d32828bb87b8e7d6bf0c.zip
hdf5-91565db20993a0bf73b3d32828bb87b8e7d6bf0c.tar.gz
hdf5-91565db20993a0bf73b3d32828bb87b8e7d6bf0c.tar.bz2
[svn-r19421] Reorganize compile scripts h5cc.in, h5fc.in and h5c++.in to put LDFLAGS in the correct place and to enable the script user to set and override CFLAGS, CPPFLAGS, CXXFLAGS, FFLAGS, LDFLAGS, and LIBS that take pprecedence over the library paths and compile flags from the hdf5 build.
Tested with h5committest on amani, heiwa, and jam.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/misc/h5cc.in69
1 files changed, 62 insertions, 7 deletions
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index c274f3f..2626357 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -34,6 +34,25 @@ HL="@HL@"
############################################################################
## ##
+## Things You Can Modify to Override HDF5 Library Build Components: ##
+## ##
+## (Advanced usage - know what you're doing - you're on your own here.) ##
+## The four variables below can be used to insert paths and flags in ##
+## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ##
+## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ##
+## $LIBS $clibpath $link_objs $link_args $shared_link ##
+## ##
+## These settings can be overriden by setting HDF5_CFLAGS, ##
+## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ##
+## ##
+############################################################################
+CFLAGSBASE=""
+CPPFLAGSBASE=""
+LDFLAGSBASE=""
+LIBSBASE=""
+
+############################################################################
+## ##
## You shouldn't have to modify anything below this line. ##
## ##
############################################################################
@@ -62,13 +81,25 @@ get_output_file="no"
SHOW="eval"
CCBASE="@CC@"
CLINKERBASE="@CC@"
-CFLAGS="@AM_CFLAGS@ @CFLAGS@"
-CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
-LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
-LIBS="@LIBS@"
+
+# 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 and $LIBS come just before clibpath and 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.
+H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@"
+H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@"
+H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
+H5BLD_LIBS="@LIBS@"
CC="${HDF5_CC:-$CCBASE}"
CLINKER="${HDF5_CLINKER:-$CLINKERBASE}"
+CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}"
+CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}"
+LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}"
+LIBS="${HDF5_LIBS:-$LIBSBASE}"
USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}"
@@ -80,6 +111,13 @@ usage() {
echo " -echo Show all the shell commands executed"
echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/"
echo " subdirectories [default: $prefix]"
+ # A wonderfully informative "usage" message.
+ echo "usage: $prog_name [OPTIONS] <compile line>"
+ echo " OPTIONS:"
+ echo " -help This help message."
+ echo " -echo Show all the shell commands executed"
+ echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/"
+ 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"
@@ -99,6 +137,19 @@ usage() {
echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library"
echo " [default: no]"
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"
+ echo " in the 'Things You Can Modify to Override...'" section of $prog_name
+ echo " "
+ echo " Variable Current value to be replaced"
+ echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\""
+ echo " HDF5_CFLAGS \"$CFLAGSBASE\""
+ echo " HDF5_LDFLAGS \"$LDFLAGSBASE\""
+ echo " HDF5_LIBS \"$LIBSBASE\""
+ echo " "
+ echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version"
+ echo " is located may link your program with that other hdf5 library version."
+ echo " "
exit $EXIT_FAILURE
}
@@ -251,7 +302,7 @@ if test "x$do_compile" = "xyes"; then
compile_args="-c $compile_args"
fi
- $SHOW $CC -I$includedir $CPPFLAGS $CFLAGS $compile_args
+ $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $compile_args
status=$?
if test "$status" != "0"; then
@@ -320,9 +371,13 @@ if test "x$do_link" = "xyes"; then
# The LIBS are just a bunch of -l* libraries necessary for the HDF5
# module. It's okay if they're included twice in the compile line.
- link_args="$link_args $LIBS"
+ link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS"
- $SHOW $CLINKER $CFLAGS $clibpath $link_objs $link_args $shared_link $LDFLAGS
+ # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts to override
+ # them. User's LDFLAGS and $LIBS come just before clibpath and 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.
+ $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $LIBS $clibpath $link_objs $link_args $shared_link
status=$?
fi