Skip to content
Snippets Groups Projects
Commit db9c22f9 authored by Sergey Kosukhin's avatar Sergey Kosukhin
Browse files

Keep and apply libtool patches like in YAXT.

* The Debian patch that prevents implicit overlinking is
partially disabled: the respective monkey patch for libtool.m4
will be implemented later.
parent 7174a39c
No related branches found
No related tags found
No related merge requests found
Showing
with 294 additions and 70 deletions
#!/bin/sh
for arg in "$@"; do
case ${arg} in
--help | -h)
cat <<EOF
Usage: $0 [OPTION]
Generate the configure script and other Autotools files.
Options:
-h, --help display this help and exit
-d, --download download the most recent versions
of \`config.guess' and \`config.sub'
EOF
exit 0
;;
--download | -d)
download=yes
;;
*)
echo "ERROR: unrecognized option '${arg}': try \`$0 --help' for more information" >&2
exit 2
;;
esac
done
script_dir=`echo "$0" | sed 's@[^/]*$@@'`
echo "Running autoreconf in $script_dir"
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
cd "$script_dir"
autoreconf -fvi || exit $?
# Patch libtool.m4:
for patch in \
contrib/000debian-no-overlink-patch/debian-no-overlink.patch \
; do
echo "applying $patch"
patch -p 1 --no-backup-if-mismatch --forward -r - -i $patch -d .
# The program 'patch' exits with exitcode=1 if the patch has already been applied.
# Consider this a normal scenario:
exitcode=$?; if test $exitcode -ne 0 && test $exitcode -ne 1; then exit $exitcode; fi
done
autoconf -f || exit $?
# Reset libtool.m4 timestamps to avoid confusing make:
touch -r m4/ltversion.m4 m4/libtool.m4 || exit $?
# Patch the rest of the files:
for patch in \
contrib/100nagfor-libtool-patch/nagfor-libtool-2.4.6.patch \
contrib/101aix-deplib-rpath-patch/aix-deplib-libtool.patch \
contrib/103ltmain-ld-groups-patch/ltmain-ld-groups-libtool-2.4.6.patch \
contrib/104ltmain-xlinker-patch/ltmain-xlinker-patch.patch \
contrib/105macos-nagfor-patch/macos-nagfor.patch \
contrib/106ltmain_nag_pthread-patch/ltmain_nag_pthread.patch \
contrib/107ltmain-early-xcompile-patch/ltmain-early-xcompile-libtool-2.4.6.patch \
contrib/108ltmain-parallel-printf-patch/ltmain-parallel-printf.patch \
; do
echo "applying $patch"
patch -p 1 --no-backup-if-mismatch --forward -r - -i $patch -d .
exitcode=$?; if test $exitcode -ne 0 && test $exitcode -ne 1; then exit $exitcode; fi
done
if test x"$download" = xyes; then
url_base='https://git.savannah.gnu.org/cgit/config.git/plain'
for file in config.guess config.sub; do
echo "downloading $file"
src="$url_base/$file"; dst="config/$file"
wget -o /dev/null -O "$dst" "$src" || {
echo "ERROR: failed to download from $src" >&2
exit 1; }
done
fi
./scripts/reconfigure
--- a/config/ltmain.sh 2012-06-12 00:20:43.000000000 +0200
+++ b/config/ltmain.sh 2014-08-19 16:34:48.161235251 +0200
@@ -3229,6 +3229,25 @@
test "$opt_mode" = install && func_mode_install ${1+"$@"}
+func_add2xrpath ()
+{
+ dir="$1"
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
@@ -5727,20 +5746,7 @@
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- =*)
- func_stripname '=' '' "$dir"
- dir=$lt_sysroot$func_stripname_result
- ;;
- *)
- func_fatal_error "only absolute run-paths are allowed"
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
- esac
+ func_add2xrpath "$dir"
continue
;;
@@ -5801,18 +5807,58 @@
;;
-Wl,*)
+ wlprefix=`expr x"$wl" : '.*' - 1`
+ wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'`
+ if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then
+ func_stripname "$wl"'-rpath,,' '' "$arg"
+ dir=$func_stripname_result
+ func_add2xrpath "$dir"
+ elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then
+ func_stripname "$wl" '' "$1"
+ dir=$func_stripname_result
+ if ! expr "x$1" : '^x'"$wl" >/dev/null \
+ || ! test -d "$dir" ; then
+ func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory'
+ fi
+ shift
+ func_add2xrpath "$dir"
+ continue
+ else
+ func_stripname "$wl" '' "$arg"
+ func_append new_inherited_linker_flags " -Wl,$func_stripname_result"
+ fi
+ continue
+ elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then
+ func_stripname '-Wl,-rpath,' '' "$arg"
+ dir=$func_stripname_result
+ func_add2xrpath "$dir"
+ continue
+ elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then
+ func_stripname '-Wl,' '' "$1"
+ dir=$func_stripname_result
+ if ! expr "x$1" : '^x-Wl,' >/dev/null \
+ || ! test -d "$dir" ; then
+ func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory'
+ fi
+ func_quote_for_eval "$1"
+ func_append libtool_args " $func_quote_for_eval_result"
+ shift
+ func_add2xrpath "$dir"
+ continue
+ fi
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
- save_ifs="$IFS"; IFS=','
+ save_ifs=$IFS; IFS=,
for flag in $args; do
- IFS="$save_ifs"
+ IFS=$save_ifs
func_quote_for_eval "$flag"
func_append arg " $wl$func_quote_for_eval_result"
func_append compiler_flags " $wl$func_quote_for_eval_result"
func_append linker_flags " $func_quote_for_eval_result"
done
- IFS="$save_ifs"
+ IFS=$save_ifs
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
@@ -9515,6 +9562,10 @@
*) func_append new_libs " $deplib" ;;
esac
;;
+ -Wl,*)
+ func_stripname -Wl, '' "$deplib"
+ func_append new_libs " $wl$func_stripname_result"
+ ;;
*) func_append new_libs " $deplib" ;;
esac
done
@@ -10247,6 +10298,10 @@
*) func_append new_libs " $deplib" ;;
esac
;;
+ -Wl,*)
+ func_stripname -Wl, '' "$deplib"
+ func_append new_libs " $wl$func_stripname_result"
+ ;;
*) func_append new_libs " $deplib" ;;
esac
done
--- a/config/ltmain.sh 2012-06-12 00:20:43.000000000 +0200
+++ b/config/ltmain.sh 2014-08-19 16:34:48.161235251 +0200
@@ -3229,6 +3229,25 @@
test "$opt_mode" = install && func_mode_install ${1+"$@"}
+func_add2xrpath ()
+{
+ dir="$1"
+ # We need an absolute path.
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ =*)
+ func_stripname '=' '' "$dir"
+ dir=$lt_sysroot$func_stripname_result
+ ;;
+ *)
+ func_fatal_error "only absolute run-paths are allowed"
+ ;;
+ esac
+ case "$xrpath " in
+ *" $dir "*) ;;
+ *) func_append xrpath " $dir" ;;
+ esac
+}
# func_generate_dlsyms outputname originator pic_p
# Extract symbols from dlprefiles and create ${outputname}S.o with
@@ -5727,20 +5746,7 @@
func_stripname '-R' '' "$arg"
dir=$func_stripname_result
# We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- =*)
- func_stripname '=' '' "$dir"
- dir=$lt_sysroot$func_stripname_result
- ;;
- *)
- func_fatal_error "only absolute run-paths are allowed"
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
- esac
+ func_add2xrpath "$dir"
continue
;;
@@ -5801,18 +5807,58 @@
;;
-Wl,*)
+ wlprefix=`expr x"$wl" : '.*' - 1`
+ wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'`
+ if test x"$wlprefix" = x"$wl" -a x"$wl" != x"-Wl,"; then
+ func_append compiler_flags " $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ if expr "x$arg" : '^x'"$wl"'-rpath,,' >/dev/null ; then
+ func_stripname "$wl"'-rpath,,' '' "$arg"
+ dir=$func_stripname_result
+ func_add2xrpath "$dir"
+ elif expr "x$arg" : '^x'"$wl"'-rpath$' >/dev/null ; then
+ func_stripname "$wl" '' "$1"
+ dir=$func_stripname_result
+ if ! expr "x$1" : '^x'"$wl" >/dev/null \
+ || ! test -d "$dir" ; then
+ func_fatal_error "$wl"'-rpath must be followed by '"$wl"'-escaped directory'
+ fi
+ shift
+ func_add2xrpath "$dir"
+ continue
+ else
+ func_append new_inherited_linker_flags " $arg"
+ fi
+ continue
+ elif expr "x$arg" : '^x-Wl,-rpath,' >/dev/null ; then
+ func_stripname '-Wl,-rpath,' '' "$arg"
+ dir=$func_stripname_result
+ func_add2xrpath "$dir"
+ continue
+ elif expr "x$arg" : '^x-Wl,-rpath$' >/dev/null ; then
+ func_stripname '-Wl,' '' "$1"
+ dir=$func_stripname_result
+ if ! expr "x$1" : '^x-Wl,' >/dev/null \
+ || ! test -d "$dir" ; then
+ func_fatal_error '-Wl,-rpath must be followed by -Wl-escaped directory'
+ fi
+ shift
+ func_add2xrpath "$dir"
+ continue
+ fi
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
arg=
- save_ifs="$IFS"; IFS=','
+ save_ifs=$IFS; IFS=,
for flag in $args; do
- IFS="$save_ifs"
+ IFS=$save_ifs
func_quote_for_eval "$flag"
func_append arg " $wl$func_quote_for_eval_result"
func_append compiler_flags " $wl$func_quote_for_eval_result"
func_append linker_flags " $func_quote_for_eval_result"
done
- IFS="$save_ifs"
+ IFS=$save_ifs
func_stripname ' ' '' "$arg"
arg=$func_stripname_result
;;
This patch changes NAG Fortran (nagfor) compilations of shared
libraries to correctly pass the -shared flag to the underlying
compiler.
--- a/m4/libtool.m4 2013-08-01 11:23:32.749610298 +0200
+++ b/m4/libtool.m4 2014-04-04 15:30:02.855209645 +0200
@@ -4817,6 +4817,8 @@
lf95*) # Lahey Fortran 8.1
_LT_TAGVAR(whole_archive_flag_spec, $1)=
tmp_sharedflag='--shared' ;;
+ nagfor*) # NAGFOR 5.3
+ tmp_sharedflag='-Wl,-shared' ;;
xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
tmp_sharedflag='-qmkshrobj'
tmp_addflag= ;;
--- a/config/ltmain.sh 2016-10-27 18:58:49.860787638 +0200
+++ b/config/ltmain.sh 2016-10-27 18:59:21.497411984 +0200
@@ -5806,6 +5806,11 @@
arg=$func_stripname_result
;;
+ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\))
+ func_append deplibs " $arg"
+ continue
+ ;;
+
-Wl,*)
wlprefix=`expr x"$wl" : '.*' - 1`
wlprefix=`expr x"$arg" : 'x\(.\{'"$wlprefix"'\}\)'`
@@ -6434,6 +6439,15 @@
alldeplibs=yes
continue
;;
+ -Wl,--start-group|-Wl,--end-group|-Wl,-\(|-Wl,-\))
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
esac # case $deplib
if test "$found" = yes || test -f "$lib"; then :
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment