Re: [PATCH] libtool.m4: Handle "/" as a sysroot more correctly

Mike Frysinger <[email protected]> Tue, 16 Jan 2024 21:14:50 -0500
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <Zac4GkFnseMo0b1x@vapier>
On 16 Jan 2024 21:47, Richard Purdie wrote:
> 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.

could the same argument be made if the returned value is "/opt/sysroot/"
and not just "/opt/sysroot" ?  not sure if gcc forces normalization on its
side.  but we could "simplify" this with:

# 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:/\+$::'`
-mike
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmWnOBoACgkQQWM7n+g3
9YEKpQ//UPryF5pjRUUW0MPtxGktGnS4X+qfEGfOOcEwYMmionATq6dc4rNev33K
xUuBgkDIkvaFYi1fQ6d9cdCoCTeo/uL5t7zDv2TmO2G7xUxSA2OBfWgTooVEyeSB
hHP5NU+uXupvCUG8XNi29EOpmTepieEMxAhKb/RnTJZfrwVnqQS6oU/nU37lWnWH
lGEKlVDWXGhmwWLP7d5DvXLG/B7/zDei1bfb1OonkAg0VWFlMrq7JMWijeZ+Utu/
BqyY9s8oiLaq6hifhBnRUniZcsO0mIsudeKbyGGn1ux17+KFIA1L7EuT7gxshpkz
i2HThWEnFTR/erQHyvBkjrj/EXYBG+NJOcvESTcr3/Q3XNnoy9aZUCHMSXgl0pt2
p919/Q4Jyoc2aqY5s0aK9b12FNNx2qIi7BK9N4EIIdpPLiYVaW0egqc98GRAag4f
E/IzjCIcqnvdIIeBJDf9306qzH+/nXNDwQl2IbGVEdjGr4RY9i39SYNFApn6pRXf
/3vfLt8Rdb36ICJR5OrDUwXimZIXvINAYD8Hk4JTaR7gclQltJ1ZpbV+R/hRVrQ6
J/tGo28fAQV1fon6hXNuTuzzlQ8B4c6XeWdfSZXieuiv6azAA/yno1qx+H+GMIac
GSIgO8mMhn4kfYJxewWjz7ih4RvBgTwIZMIPor1tnUUutK8xWgw=
=n+vC
-----END PGP SIGNATURE-----