Commit 845dadcf authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

Update libtool patches.

parent 44c5a294
#!/bin/sh #!/bin/sh
autoreconf -fvi || exit $? autoreconf -fvi || exit $?
patch -p 1 --no-backup-if-mismatch --forward -r - -i patch/libtool_m4.patch -d . patch --forward --no-backup-if-mismatch -p1 -r - -i patch/libtool.m4.nag_wrapper.patch
# The program 'patch' exits with exitcode=1 if the patch has already been applied. # The program 'patch' exits with exitcode=1 if the patch has already been applied.
# Consider this a normal scenario: # Consider this a normal scenario:
exitcode=$?; if test $exitcode -ne 0 && test $exitcode -ne 1; then exit $exitcode; fi exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode
patch --forward --no-backup-if-mismatch -p1 -r - -i patch/libtool.m4.arg_spaces.patch
exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode
# Rebuild configure if you need to patch M4 macros:
autoconf -f || exit $? autoconf -f || exit $?
# Reset libtool.m4 timestamps to avoid confusing make
# Reset libtool.m4 timestamps to avoid confusing make:
touch -r m4/ltversion.m4 m4/libtool.m4 || exit $? touch -r m4/ltversion.m4 m4/libtool.m4 || exit $?
patch -p 1 --no-backup-if-mismatch --forward -r - -i patch/ltmain_sh.patch -d . patch --forward --no-backup-if-mismatch -p1 -r - -i patch/ltmain.sh.nag_pthread.patch
exitcode=$?; if test $exitcode -ne 0 && test $exitcode -ne 1; then exit $exitcode; fi exitcode=$?; test $exitcode -ne 0 && test $exitcode -ne 1 && exit $exitcode
# All went fine since we have not exited before:
exit 0
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index a3bc337..28d0091 100644
--- a/m4/libtool.m4 --- a/m4/libtool.m4
+++ b/m4/libtool.m4 +++ b/m4/libtool.m4
@@ -7532,10 +7532,11 @@ if AC_TRY_EVAL(ac_compile); then @@ -7532,10 +7532,11 @@ if AC_TRY_EVAL(ac_compile); then
......
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -8903,7 +8903,8 @@ func_mode_link ()
xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
# On Darwin other compilers
- case $CC in
+ func_cc_basename $CC
+ case $func_cc_basename_result in
nagfor*)
verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
;;
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -118,6 +118,12 @@ func_cc_basename ()
esac
done
func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+ # Set result to 'nagfor-wrapper' when NAG compiler is called via a wrapper (e.g. mpif90).
+ case $func_cc_basename_result in
+ nagfor*) ;;
+ *) $cc_temp -V 2>&1 | $GREP '^NAG Fortran Compiler Release' >/dev/null 2>&1 && func_cc_basename_result='nagfor-wrapper' ;;
+ esac
}
])# _LT_PREPARE_CC_BASENAME
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -7862,6 +7862,13 @@ func_mode_link ()
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+
+ # Additionally convert " -pthread" to " -Wl,-pthread" for nagfor
+ func_cc_basename $CC
+ case $func_cc_basename_result in
+ nagfor*) tmp_inherited_linker_flags=`$ECHO "$tmp_inherited_linker_flags" | $SED 's/ -pthread/ -Wl,-pthread/g'` ;;
+ esac
+
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;
@@ -9493,6 +9500,22 @@ EOF
;;
esac
+ # Time to revert the changes made for nagfor. This might be required if
+ # we need to make the output '*.la' file to be correctly interpreted for
+ # gcc (e.g. the output library that we are linking now with nagfor needs
+ # to be linked by gcc later). In this case, the libtool script of a
+ # package that will try to link our library will have to make similar
+ # non-standard nagfor-specific modifications of the '-pthread' flag.
+ # Thus, if we are creating a Fortran library for nagfor only, it is
+ # better not to revert the changes, otherwise, uncomment the following
+ # lines.
+
+ # func_cc_basename $CC
+ # case $func_cc_basename_result in
+ # nagfor*)
+ # new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% -Wl,-pthread% -pthread%g'` ;;
+ # esac
+
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
new_libs=
diff --git a/config/ltmain.sh b/config/ltmain.sh
index 0f0a2da..4126a5b 100644
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -7859,6 +7859,14 @@ func_mode_link ()
# Read the .la file
func_source "$lib"
+ # Change -pthread to -Wl,-pthread for nagfor
+ if test -n "$inherited_linker_flags"; then
+ func_cc_basename "$CC"
+ case $func_cc_basename_result in
+ nagfor*) inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/ -pthread/ -Wl,-pthread/g'` ;;
+ esac
+ fi
+
# Convert "-framework foo" to "foo.ltframework"
if test -n "$inherited_linker_flags"; then
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment