configure: handle spaces correctly in $source_path

Add very few missing quotes where IFS/globs were applied to arbitrary
user input (commands, arguments, but not assignments or case $var in.
In fn_makelink $dn/$2/$f don't have IFS/globs).

While configure now handles it correctly, there are 2 issues:
- eval opt=\"$opt\"  coalesces IFS chars (--prefix="$HOME/x   y").
- Even with the eval removed, (gnu) make still fails to find it.

I made few quick experiments with quoting these values in config.mak,
but that had no impact, and make -d was not helpful. Was worth a try.

So no spaces in paths, but at least configure can handle the src path.
This commit is contained in:
Avi Halachmi (:avih) 2024-12-04 16:52:19 +02:00
parent 9289c6c5e0
commit c45559e124

8
configure vendored
View file

@ -438,7 +438,7 @@ fi
if test -z "$build_cross"; then if test -z "$build_cross"; then
CONFTEST=./conftest$EXESUF CONFTEST=./conftest$EXESUF
if ! $cc -o $CONFTEST $source_path/conftest.c ; then if ! $cc -o $CONFTEST "$source_path/conftest.c" ; then
echo "configure: error: '$cc' failed to compile conftest.c." echo "configure: error: '$cc' failed to compile conftest.c."
else else
cc_name="$($CONFTEST compiler)" cc_name="$($CONFTEST compiler)"
@ -553,7 +553,7 @@ fcho "Switches " "$tcc_switches"
fcho "Config " "${confvars# }" fcho "Config " "${confvars# }"
echo "Creating config.mak and config.h" echo "Creating config.mak and config.h"
version=`head $source_path/VERSION` version=$(head "$source_path/VERSION")
cat >config.mak <<EOF cat >config.mak <<EOF
# Automatically generated by configure - do not modify # Automatically generated by configure - do not modify
@ -726,13 +726,13 @@ fn_makelink()
;; ;;
esac esac
ln -sfn $tgt $2 || ( echo "ln failed. Using cp instead."; cp -f $1/$2 $2 ) ln -sfn "$tgt" $2 || ( echo "ln failed. Using cp instead."; cp -f "$1/$2" $2 )
} }
if test "$source_path_used" = "yes" ; then if test "$source_path_used" = "yes" ; then
FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile tests/pp/Makefile" FILES="Makefile lib/Makefile tests/Makefile tests/tests2/Makefile tests/pp/Makefile"
for f in $FILES ; do for f in $FILES ; do
fn_makelink $source_path $f fn_makelink "$source_path" $f
done done
fi fi