diff options
author | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2017-07-27 16:49:38 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2017-07-27 16:49:38 (GMT) |
commit | 5bc595f6a686c43ce3d910b7e0da61c331363598 (patch) | |
tree | f9c4c2e5da438e4d999b8c2e3b9b13e733e9344c | |
parent | 749d0d83415ace804dc686157c6e4242c716808d (diff) | |
download | hdf5-5bc595f6a686c43ce3d910b7e0da61c331363598.zip hdf5-5bc595f6a686c43ce3d910b7e0da61c331363598.tar.gz hdf5-5bc595f6a686c43ce3d910b7e0da61c331363598.tar.bz2 |
libtool does not pass the correct argument linking (-WL,-WL,,) for the
NAG Fortran compiler on Linux (other OSs have not been tested).
Therefore, detect if we are using the NAG Fortran compiler, and replace
the wl="-Wl," for Fortran to wl="-Wl,-WL,," in the libtool file. (HDFFV-10037)
Removed FCFLAGS when building the examples since they should already be included the h5fc wrapper. NAG complains about doubly declared options.
-rw-r--r-- | configure.ac | 43 | ||||
-rw-r--r-- | fortran/examples/Makefile.am | 4 | ||||
-rw-r--r-- | fortran/src/h5fc.in | 2 |
3 files changed, 34 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac index 72909d9..f0be94d 100644 --- a/configure.ac +++ b/configure.ac @@ -2909,6 +2909,37 @@ else STATIC_SHARED="none" fi +if test "X$HDF_FORTRAN" = "Xyes"; then + ## libtool does not pass the correct argument linker (wl=) for the Intel Fortran compiler + ## on OS X, which is needed when building shared libraries on OS X. This script + ## replaces the 3rd occurrence, which is for Fortran, of wl="" with wl="-Wl," (HDFFV-2772) + case "`uname`" in + Darwin*) + cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool + ;; + esac + + ### libtool does not pass the correct argument linking (-WL,-WL,,) for the NAG Fortran compiler + ### on Linux (other OSs have not been tested). + ### Therefore, detect if we are using the NAG Fortran compiler, and replace the wl="-Wl," for Fortran to + ### wl="-Wl,-WL,," in the libtool file. (HDFFV-10037) + case "`uname`" in + Linux*) + + fortran_linux_linker_option="-Wl," + + if (grep -i 'NAG_Fortran' libtool > /dev/null); then + cat libtool | awk '/NAG_Fortran/{flag=1}flag&&/wl=/{$NF="wl=\"-Wl,Wl,,\"";flag=0}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool + fortran_linux_linker_option="-Wl,-Wl,," + fi + + ## Set the correct linker option for use in h5fc.in markup + AC_SUBST([fortran_linux_linker_option]) + ;; + esac + +fi + ## ---------------------------------------------------------------------- ## Set a macro if shared library is enabled. ## @@ -2998,18 +3029,6 @@ AC_OUTPUT chmod 755 tools/misc/h5cc -if test "X$HDF_FORTRAN" = "Xyes"; then - chmod 755 fortran/src/h5fc - ## libtool does not pass the correct argument linker (wl=) for the Intel Fortran compiler - ## on OS X, which is needed when building shared libraries on OS X. This script - ## replaces the 3rd occurrence, which is for Fortran, of wl="" with wl="-Wl," (HDFFV-2772) - case "`uname`" in - Darwin*) - cat libtool | awk '/wl=\"/{c++;if(c==3){sub("wl=\"\"","wl=\"-Wl,\"");c=0}}1' > libtool.tmp && mv -f libtool.tmp libtool && chmod 755 libtool - ;; - esac -fi - if test "X$HDF_CXX" = "Xyes"; then chmod 755 c++/src/h5c++ fi diff --git a/fortran/examples/Makefile.am b/fortran/examples/Makefile.am index 3428a9e..d78cbb3 100644 --- a/fortran/examples/Makefile.am +++ b/fortran/examples/Makefile.am @@ -68,10 +68,10 @@ h5_crtatt.chkexe_: h5_rdwt.chkexe_ # Additional dependencies for the examples are listed below if BUILD_PARALLEL_CONDITIONAL $(EXTRA_PROG): $(H5FC_PP) - $(H5FC_PP) $(H5CCFLAGS) $(FCFLAGS) -o $@ $(srcdir)/$@.f90; + $(H5FC_PP) $(H5CCFLAGS) -o $@ $(srcdir)/$@.f90; else $(EXTRA_PROG): $(H5FC) - $(H5FC) $(H5CCFLAGS) $(FCFLAGS) -o $@ $(srcdir)/$@.f90; + $(H5FC) $(H5CCFLAGS) -o $@ $(srcdir)/$@.f90; endif # Tell automake how to install examples diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index 47642c9..29ef83f 100644 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -307,7 +307,7 @@ if test "x$do_link" = "xyes"; then link_args="$link_args -L${libdir}" case "$host_os" in - linux*) flag="-Wl,-rpath -Wl," ;; + linux*) flag="@fortran_linux_linker_option@-rpath -Wl," ;; hpux*) flag="-Wl,+b -Wl," ;; freebsd*|solaris*) flag="-R" ;; rs6000*|aix*) flag="-L" ;; |