]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Revert the revert, and use Sergey Poznyakoff's fix instead.
authorBruno Haible <bruno@clisp.org>
Wed, 9 Oct 2024 21:11:41 +0000 (23:11 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 9 Oct 2024 21:11:41 +0000 (23:11 +0200)
Sergey's fix is at
<https://debbugs.gnu.org/cgi/bugreport.cgi?msg=17;bug=73620> =
<https://lists.gnu.org/archive/html/bug-libtool/2024-10/msg00008.html>.

build-aux/ltmain.sh

index 12d92ace5702aa577bdc694eac19be96f24e7a58..0a2dc9bcf320dcad50548b3f846692fd7f8ee525 100644 (file)
@@ -6782,6 +6782,7 @@ func_mode_link ()
     finalize_command=$nonopt
 
     compile_rpath=
+    compile_rpath_tail=
     finalize_rpath=
     compile_shlibpath=
     finalize_shlibpath=
@@ -6822,10 +6823,12 @@ func_mode_link ()
     xrpath=
     perm_rpath=
     temp_rpath=
+    temp_rpath_tail=
     thread_safe=no
     vinfo=
     vinfo_number=no
     weak_libs=
+    rpath_arg=
     single_module=$wl-single_module
     func_infer_tag $base_compile
 
@@ -7744,8 +7747,20 @@ func_mode_link ()
 
       # Now actually substitute the argument into the commands.
       if test -n "$arg"; then
-       func_append compile_command " $arg"
-       func_append finalize_command " $arg"
+       if test -n "$rpath_arg"; then
+          func_append finalize_rpath " ${arg##*,}"
+         unset rpath_arg
+       else
+         case $arg in
+          -Wl,-rpath,*)
+           func_append finalize_rpath " ${arg##*,}";;
+          -Wl,-rpath)
+           rpath_arg=1;;
+          *)
+            func_append compile_command " $arg"
+           func_append finalize_command " $arg"
+         esac
+        fi
       fi
     done # argument parsing loop
 
@@ -8396,7 +8411,10 @@ func_mode_link ()
              # Make sure the rpath contains only unique directories.
              case $temp_rpath: in
              *"$absdir:"*) ;;
-             *) func_append temp_rpath "$absdir:" ;;
+              *) case $absdir in
+                 "$progdir/"*) func_append temp_rpath "$absdir:" ;;
+                 *)            func_append temp_rpath_tail "$absdir:" ;;
+                 esac
              esac
            fi
 
@@ -8406,9 +8424,12 @@ func_mode_link ()
            case " $sys_lib_dlsearch_path " in
            *" $absdir "*) ;;
            *)
-             case "$compile_rpath " in
+             case "$compile_rpath$compile_rpath_tail " in
              *" $absdir "*) ;;
-             *) func_append compile_rpath " $absdir" ;;
+             *) case $absdir in
+                 "$progdir/"*) func_append compile_rpath " $absdir" ;;
+                 *) func_append compile_rpath_tail " $absdir" ;;
+                esac
              esac
              ;;
            esac
@@ -8480,9 +8501,12 @@ func_mode_link ()
            case " $sys_lib_dlsearch_path " in
            *" $absdir "*) ;;
            *)
-             case "$compile_rpath " in
+             case "$compile_rpath$compile_rpath_tail " in
              *" $absdir "*) ;;
-             *) func_append compile_rpath " $absdir" ;;
+             *) case $absdir in
+                 "$progdir/"*) func_append compile_rpath " $absdir" ;;
+                 *) func_append compile_rpath_tail " $absdir" ;;
+                esac
              esac
              ;;
            esac
@@ -8843,6 +8867,10 @@ func_mode_link ()
          fi # link_all_deplibs != no
        fi # linkmode = lib
       done # for deplib in $libs
+
+      func_append temp_rpath "$temp_rpath_tail"
+      func_append compile_rpath "$compile_rpath_tail"
+
       if test link = "$pass"; then
        if test prog = "$linkmode"; then
          compile_deplibs="$new_inherited_linker_flags $compile_deplibs"