summaryrefslogtreecommitdiffstats
path: root/tools/misc/h5cc.in
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-05-15 23:29:51 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-05-15 23:29:51 (GMT)
commitd792fc837dc2e4e65211b3a9b13ac30343263610 (patch)
treeedac9ba7d02cc21c520a0ad2ad819997083b8cfe /tools/misc/h5cc.in
parentf5500a0051eecfc0d7f118b6f122aa889a02d627 (diff)
downloadhdf5-d792fc837dc2e4e65211b3a9b13ac30343263610.zip
hdf5-d792fc837dc2e4e65211b3a9b13ac30343263610.tar.gz
hdf5-d792fc837dc2e4e65211b3a9b13ac30343263610.tar.bz2
[svn-r6883] Purpose:
Bug Fix Description: Lots of things. Mostly, multiple libraries declared on the command line bothered some compilers. Then the order of the libraries is important. Then if you are building static, you don't want an "-lhdf5" flag in your compile line. Solution: Various hacks to remove redundant libraries from the compile line and to keep the order of them and to replace -lhdf5 with the .a file when building static. Platforms tested: Modi4 (Fortran & Parallel) Verbena (Fortran & C++) Arabica (Fortran) Misc. update:
Diffstat (limited to 'tools/misc/h5cc.in')
-rwxr-xr-xtools/misc/h5cc.in45
1 files changed, 33 insertions, 12 deletions
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 383962d..cde9a33 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -155,7 +155,7 @@ for arg in $@ ; do
do_link="no"
;;
-l*)
- libraries="$libraries $arg"
+ libraries=" $libraries $arg "
allargs="$allargs $arg"
;;
-prefix=*)
@@ -202,6 +202,9 @@ for arg in $@ ; do
do_link="yes"
link_objs="$link_objs $arg"
fi
+ elif test "x$ext" = "x.a"; then
+ # This is an archive that we're linking in
+ libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
@@ -229,8 +232,12 @@ fi
if test "x$do_link" = "xyes"; then
shared_link=""
+ libraries=" $libraries $LIBS "
+ link_args="$link_args -L${libdir}"
if test "x$USE_SHARED_LIB" = "xyes"; then
+ libraries=" -lhdf5 $libraries "
+
case "$kind" in
gcc|linux*) flag="-Wl,-rpath -Wl," ;;
hpux*) flag="-Wl,+b -Wl," ;;
@@ -243,20 +250,34 @@ if test "x$do_link" = "xyes"; then
if test -n "$flag"; then
shared_link="${flag}${libdir}"
fi
-
- libraries=" -lhdf5 $libraries "
- link_args="$link_args -L${libdir}"
-
- for l in $libraries; do
- if ! echo $link_args | grep " $l " > /dev/null; then
- link_args="$link_args $l "
- fi
- done
else
- link_args="$link_args ${libdir}/libhdf5.a"
+ if echo "$libraries" | grep " -lhdf5 " > /dev/null; then
+ new_libraries=""
+ for lib in $libraries; do
+ case "$lib" in
+ -lhdf5)
+ new_libraries="$new_libraries ${libdir}/libhdf5.a"
+ ;;
+ *)
+ new_libraries="$new_libraries $lib"
+ ;;
+ esac
+ done
+ libraries="$new_libraries"
+ else
+ link_args="$link_args ${libdir}/libhdf5.a"
+ fi
fi
- link_args="$link_args $LIBS"
+ for lib in $libraries; do
+ if echo $link_args | grep " $lib " > /dev/null ||
+ echo $link_args | grep " $lib$" > /dev/null; then
+ :
+ else
+ link_args="$link_args $lib "
+ fi
+ done
+
$SHOW $CLINKER $LDFLAGS $clibpath $link_objs $link_args $shared_link
status=$?
fi