]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
libtool.m4: Cleanup sysroot trailing "/"
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Jan 2024 12:39:22 +0000 (12:39 +0000)
committerMike Frysinger <vapier@gentoo.org>
Wed, 17 Jan 2024 22:01:45 +0000 (17:01 -0500)
If $CC has --sysroot=/, it is a valid configuration however libtool will
then set lt_sysroot to "/".

This means references like $lt_sysroot$libdir become //usr/lib instead
of the more normally expected /usr/lib. This may or may not break something
but certainly is confusing to the user and gives confusing output. Making
"/" simply unset lt_sysroot is much cleaner.

Whilst here, trim any trailing '/' from sysroot paths to drop the duplication
and result in cleaner/consistent output.

* m4/libtool.m4: Cleanup sysroot trailing '/' handling.

m4/libtool.m4

index f2c244f0fc750f245880e11e0b82d96acad31a7e..20527f830aa18d00f8b07a70ae393b78fcd86ba5 100644 (file)
@@ -1255,7 +1255,9 @@ lt_sysroot=
 case $with_sysroot in #(
  yes)
    if test yes = "$GCC"; then
-     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+     # Trim trailing / since we'll always append absolute paths and we want
+     # to avoid //, if only for less confusing output for the user.
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null | $SED 's:/\+$::'`
    fi
    ;; #(
  /*)