summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-05-29 21:59:17 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-05-29 21:59:17 (GMT)
commite7f66d3b4e5d0b58c607f32b3ed380e402dbc07b (patch)
tree5a93a4965f3091bd107379f04bebe23adaa3b2f7
parent4eb8aa7d83874005717867ffc8374daa1ad0423b (diff)
downloadhdf5-e7f66d3b4e5d0b58c607f32b3ed380e402dbc07b.zip
hdf5-e7f66d3b4e5d0b58c607f32b3ed380e402dbc07b.tar.gz
hdf5-e7f66d3b4e5d0b58c607f32b3ed380e402dbc07b.tar.bz2
[svn-r6926] Purpose:
Bug Fix Description: The order the libraries are included in the compilation line is very important. Solution: Need to specify the libraries in the order that they are given. If we're building the application staticly, then use the static HDF5 library. Platforms tested: Modi4 Verbena Arabica Misc. update:
-rwxr-xr-xtools/misc/h5cc.in67
1 files changed, 33 insertions, 34 deletions
diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in
index 2f598fc..25f2dc1 100755
--- a/tools/misc/h5cc.in
+++ b/tools/misc/h5cc.in
@@ -41,7 +41,6 @@ prog_name="`basename $0`"
allargs=""
compile_args=""
libraries=""
-archives=""
link_args=""
link_objs=""
clibpath=""
@@ -205,7 +204,7 @@ for arg in $@ ; do
fi
elif test "x$ext" = "x.a"; then
# This is an archive that we're linking in
- archives=" $archives $arg "
+ libraries=" $libraries $arg "
else
compile_args="$compile_args $arg"
link_args="$link_args $arg"
@@ -233,41 +232,37 @@ fi
if test "x$do_link" = "xyes"; then
shared_link=""
- libraries=" $libraries $LIBS "
+ libraries=" $libraries -lhdf5 "
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," ;;
+ freebsd*|solaris*) flag="-R" ;;
+ rs6000*|aix*) flag="-L" ;;
+ irix*|sgi) flag="-rpath " ;;
+ *) flag="" ;;
+ esac
- case "$kind" in
- gcc|linux*) flag="-Wl,-rpath -Wl," ;;
- hpux*) flag="-Wl,+b -Wl," ;;
- freebsd*|solaris*) flag="-R" ;;
- rs6000*|aix*) flag="-L" ;;
- irix*|sgi) flag="-rpath " ;;
- *) flag="" ;;
- esac
+ if test -n "$flag"; then
+ shared_link="${flag}${libdir}"
+ fi
- if test -n "$flag"; then
- shared_link="${flag}${libdir}"
- fi
- else
- 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
+ if test "x$USE_SHARED_LIB" != "xyes"; then
+ # The "-lhdf5" flag is in here already...This is a static compile,
+ # though, so change it to the static version (.a) of the library.
+ 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"
fi
for lib in $libraries; do
@@ -279,7 +274,11 @@ if test "x$do_link" = "xyes"; then
fi
done
- $SHOW $CLINKER $CFLAGS $LDFLAGS $clibpath $link_objs $archives $link_args $shared_link
+ # 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"
+
+ $SHOW $CLINKER $CFLAGS $LDFLAGS $clibpath $link_objs $link_args $shared_link
status=$?
fi