ltmain.in: Fix reordering --as-needed
Libtool was reordering flags like, --as-needed, which broke its usage,
since the relevant libraries were no longer following the flag.
Reported: https://savannah.gnu.org/support/?111213
* build-aux/ltmain.in: Add check for --as-needed and --no-as-needed
flags.
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 1417745..294ed43 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5580,6 +5580,11 @@
arg=$func_stripname_result
;;
+ -Wl,--as-needed|-Wl,--no-as-needed)
+ deplibs="$deplibs $arg"
+ continue
+ ;;
+
-Wl,*)
func_stripname '-Wl,' '' "$arg"
args=$func_stripname_result
@@ -6008,6 +6013,15 @@
lib=
found=false
case $deplib in
+ -Wl,--as-needed|-Wl,--no-as-needed)
+ if test prog,link = "$linkmode,$pass"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ fi
+ continue
+ ;;
-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
|-threads|-fopenmp|-fopenmp=*|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
if test prog,link = "$linkmode,$pass"; then