summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorH.Merijn Brand <perl5@tux.freedom.nl>2021-02-12 16:42:42 +0100
committerKarl Williamson <khw@cpan.org>2021-04-16 20:21:43 -0600
commitd3144c9253d3244cd259a0ae4c0fe81519bf5b53 (patch)
tree4df108dd317ce0a9ee8b82ca81d5c68bd9d0e32f /Configure
parent5e770dfc343d97d552b1ce772daa61ba0f714080 (diff)
downloadperl-d3144c9253d3244cd259a0ae4c0fe81519bf5b53.tar.gz
Prevent incpath to spill into libpth
• Use realpath if available • This might catch more duplicate paths • Only include real existing paths • Filter inc paths out of libpth Before: incpth: /usr/lib64/gcc/x86_64-suse-linux/7/include /usr/local/include /usr/lib64/gcc/x86_64-suse-linux/7/include-fixed /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/include /usr/include libpth: /usr/local/lib /usr/lib64/gcc/x86_64-suse-linux/7/include-fixed /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64 After: incpth: /usr/lib64/gcc/x86_64-suse-linux/7/include /usr/local/include /usr/lib64/gcc/x86_64-suse-linux/7/include-fixed /usr/x86_64-suse-linux/include /usr/include libpth: /usr/local/lib /usr/x86_64-suse-linux/lib /usr/lib /pro/local/lib /lib64 /usr/lib64 /lib /usr/local/lib64 If merged, I'll backport
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure20
1 files changed, 14 insertions, 6 deletions
diff --git a/Configure b/Configure
index 71092ea647..913e080883 100755
--- a/Configure
+++ b/Configure
@@ -4863,27 +4863,35 @@ esac
# Note that ccname for clang is also gcc.
case "$ccname" in
gcc)
+ realpath=`which realpath 2>/dev/null | sed 's/no realpath in.*//'`
$echo 'extern int foo;' > try.c
set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
shift
+ inclinpth=""
if $test $# -gt 0; then
- incpth="$incpth $*"
- incpth="`$echo $incpth|$sed 's/^ //'`"
for i in $*; do
- j="`$echo $i|$sed 's,/include$,/lib,'`"
+ case $realpath in
+ */realpath) i=`$realpath $i` ;;
+ esac
+ incpth="$incpth $i"
+ j="`$echo $i | $sed 's,/include[^/]*,/lib,'`"
if $test -d $j; then
- libpth="$libpth $j"
+ inclibpth="$inclibpth $j"
fi
done
- libpth="`$echo $libpth|$sed 's/^ //'`"
- for xxx in $libpth $loclibpth $plibpth $glibpth; do
+ incpth="`$echo $incpth | $sed 's/^ //'`"
+ for xxx in $inclibpth $loclibpth $plibpth $glibpth; do
if $test -d $xxx; then
+ case $realpath in
+ */realpath) xxx=`$realpath $xxx` ;;
+ esac
case " $libpth " in
*" $xxx "*) ;;
*) libpth="$libpth $xxx";;
esac
fi
done
+ libpth="`$echo $libpth | $sed 's/^ //'`"
fi
$rm -f try.c
case "$usrinc" in