summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2017-05-23 22:16:46 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2017-05-23 22:16:46 (GMT)
commit9fc2b3ef8e7933da716e2d2f832e93d8fc8023c0 (patch)
tree8969f711af1d226e3217c0da61d5559ceb22c4c6
parent8861b5a4945b1a35103357b2d4097e1faef6b167 (diff)
parent57ab1e7d6945c45107ebdd945bb89951ec90b8f1 (diff)
downloadhdf5-9fc2b3ef8e7933da716e2d2f832e93d8fc8023c0.zip
hdf5-9fc2b3ef8e7933da716e2d2f832e93d8fc8023c0.tar.gz
hdf5-9fc2b3ef8e7933da716e2d2f832e93d8fc8023c0.tar.bz2
Merge pull request #532 in HDFFV/hdf5 from ~BRTNFLD/hdf5_msb:develop to develop
* commit '57ab1e7d6945c45107ebdd945bb89951ec90b8f1': add linking flag to cmake, does not fix the issue, still disabled shared with fortran add documention comments for shared Fortran Fix on OSX Fix for shared fortran libraries on mac (HDFFV-2772). Fix for shared fortran libraries on mac (HDFFV-2772). Fix for shared fortran libraries on mac (HDFFV-2772).
-rw-r--r--CMakeLists.txt5
-rw-r--r--configure.ac19
-rw-r--r--fortran/test/fortranlib_test.F906
-rw-r--r--fortran/test/fortranlib_test_1_8.F906
-rw-r--r--fortran/test/fortranlib_test_F03.F906
5 files changed, 27 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce91052..b84cc7c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -851,6 +851,11 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
option (SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF)
if (HDF5_BUILD_FORTRAN)
if (BUILD_SHARED_LIBS AND APPLE)
+ # Tell cmake to do the right thing with COMMON symbols, this fixes
+ # corrupt values with COMMON and EQUIVALENCE when building shared
+ # Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772).
+ # *** NOTE: Fix does not work with Cmake. ***
+ # set (HDF5_LINKER_FLAGS "-Wl,-commons,use_dylibs")
if (NOT ALLOW_UNSUPPORTED)
message (STATUS " **** Shared FORTRAN libraries are unsupported **** ")
set (SKIP_HDF5_FORTRAN_SHARED ON)
diff --git a/configure.ac b/configure.ac
index d0aeda9..9695fe3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -918,14 +918,13 @@ H5_FORTRAN_SHARED="no"
if test "X${HDF_FORTRAN}" = "Xyes" && test "X${enable_shared}" != "Xno"; then
AC_MSG_CHECKING([if shared Fortran libraries are supported])
H5_FORTRAN_SHARED="yes"
-
- ## Disable fortran shared libraries on Mac. (MAM - 03/30/11)
-
+ ## tell libtool to do the right thing with COMMON symbols, this fixes
+ ## corrupt values with COMMON and EQUIVALENCE when building shared
+ ## Fortran libraries on OSX with gnu and Intel compilers (HDFFV-2772).
case "`uname`" in
Darwin*)
- H5_FORTRAN_SHARED="no"
- CHECK_WARN="Shared Fortran libraries not currently supported on Mac."
- ;;
+ H5_LDFLAGS="$H5_LDFLAGS -Wl,-commons,use_dylibs"
+ ;;
esac
## Report results of check(s)
@@ -3484,6 +3483,14 @@ chmod 755 tools/src/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
diff --git a/fortran/test/fortranlib_test.F90 b/fortran/test/fortranlib_test.F90
index 94b084e..8d5b32b 100644
--- a/fortran/test/fortranlib_test.F90
+++ b/fortran/test/fortranlib_test.F90
@@ -50,11 +50,11 @@ PROGRAM fortranlibtest
IF(total_error .EQ. 0) THEN
WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO")
- WRITE(*, '(I1)', advance="NO") majnum
+ WRITE(*, '(I0)', advance="NO") majnum
WRITE(*, '(".")', advance="NO")
- WRITE(*, '(I1)', advance="NO") minnum
+ WRITE(*, '(I0)', advance="NO") minnum
WRITE(*, '(" release ")', advance="NO")
- WRITE(*, '(I3)') relnum
+ WRITE(*, '(I0)') relnum
ELSE
total_error = total_error + 1
ENDIF
diff --git a/fortran/test/fortranlib_test_1_8.F90 b/fortran/test/fortranlib_test_1_8.F90
index 850cab9..1306da5 100644
--- a/fortran/test/fortranlib_test_1_8.F90
+++ b/fortran/test/fortranlib_test_1_8.F90
@@ -46,11 +46,11 @@ PROGRAM fortranlibtest
CALL h5get_libversion_f(majnum, minnum, relnum, total_error)
IF(total_error .EQ. 0) THEN
WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO")
- WRITE(*, '(I1)', advance="NO") majnum
+ WRITE(*, '(I0)', advance="NO") majnum
WRITE(*, '(".")', advance="NO")
- WRITE(*, '(I1)', advance="NO") minnum
+ WRITE(*, '(I0)', advance="NO") minnum
WRITE(*, '(" release ")', advance="NO")
- WRITE(*, '(I3)') relnum
+ WRITE(*, '(I0)') relnum
ELSE
total_error = total_error + 1
ENDIF
diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90
index ae12dba..9a74120 100644
--- a/fortran/test/fortranlib_test_F03.F90
+++ b/fortran/test/fortranlib_test_F03.F90
@@ -47,11 +47,11 @@ PROGRAM fortranlibtest_F03
CALL h5get_libversion_f(majnum, minnum, relnum, total_error)
IF(total_error .EQ. 0) THEN
WRITE(*, '(" FORTRANLIB_TEST is linked with HDF5 Library version ")', advance="NO")
- WRITE(*, '(I1)', advance="NO") majnum
+ WRITE(*, '(I0)', advance="NO") majnum
WRITE(*, '(".")', advance="NO")
- WRITE(*, '(I1)', advance="NO") minnum
+ WRITE(*, '(I0)', advance="NO") minnum
WRITE(*, '(" release ")', advance="NO")
- WRITE(*, '(I3)') relnum
+ WRITE(*, '(I0)') relnum
ELSE
total_error = total_error + 1
ENDIF