configure: make source tree build more robust
When source directory can be arrived at by two paths, configure might misdetect an out of tree build. The simplest way to trigger the problem is running configure using a full path. E.g. (<firstpath> refers to qemu source tree): ln -s <firstpath> <secondpath> cd <firstpath> <secondpath>/configure A more practical way is when make runs configure automatically: 1. cd <firstpath>/; ./configure SRC_PATH=<firstpath>/ is written into config_host.mak 2. cd <secondpath>/; touch configure; make make now runs <firstpath>/configure, so configure assumes it's an out of tree build When this happens configure overwrites parts of the current tree with symlinks. Make the test more robust: look for configure in the current directory. If there - we know it's a source build! Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
62622c11f2
commit
cab00a5aa1
12
configure
vendored
12
configure
vendored
@ -403,6 +403,14 @@ fi
|
|||||||
# make source path absolute
|
# make source path absolute
|
||||||
source_path=`cd "$source_path"; pwd`
|
source_path=`cd "$source_path"; pwd`
|
||||||
|
|
||||||
|
# running configure in the source tree?
|
||||||
|
# we know that's the case if configure is there.
|
||||||
|
if test -f "./configure"; then
|
||||||
|
pwd_is_source_path="y"
|
||||||
|
else
|
||||||
|
pwd_is_source_path="n"
|
||||||
|
fi
|
||||||
|
|
||||||
check_define() {
|
check_define() {
|
||||||
cat > $TMPC <<EOF
|
cat > $TMPC <<EOF
|
||||||
#if !defined($1)
|
#if !defined($1)
|
||||||
@ -2940,7 +2948,7 @@ EOF
|
|||||||
fdt=yes
|
fdt=yes
|
||||||
dtc_internal="yes"
|
dtc_internal="yes"
|
||||||
mkdir -p dtc
|
mkdir -p dtc
|
||||||
if [ "$source_path" != `pwd` ] ; then
|
if [ "$pwd_is_source_path" != "y" ] ; then
|
||||||
symlink "$source_path/dtc/Makefile" "dtc/Makefile"
|
symlink "$source_path/dtc/Makefile" "dtc/Makefile"
|
||||||
symlink "$source_path/dtc/scripts" "dtc/scripts"
|
symlink "$source_path/dtc/scripts" "dtc/scripts"
|
||||||
fi
|
fi
|
||||||
@ -5176,7 +5184,7 @@ do
|
|||||||
done
|
done
|
||||||
mkdir -p $DIRS
|
mkdir -p $DIRS
|
||||||
for f in $FILES ; do
|
for f in $FILES ; do
|
||||||
if [ -e "$source_path/$f" ] && [ "$source_path" != `pwd` ]; then
|
if [ -e "$source_path/$f" ] && [ "$pwd_is_source_path" != "y" ]; then
|
||||||
symlink "$source_path/$f" "$f"
|
symlink "$source_path/$f" "$f"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user