Re: [Qemu-devel] [PATCH v2] configure: make source tree build more robust
Il 28/04/2014 16:23, Michael S. Tsirkin ha scritto: 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. ( refers to qemu source tree): ln -s cd /configure A more practical way is when make runs configure automatically: 1. cd /; ./configure SRC_PATH=/ is written into config_host.mak 2. cd /; touch configure; make make now runs /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 --- changes from v1: simpler, more portable heuristic for detecting out of tree builds. configure | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 69b9f56..dd36e54 100755 --- a/configure +++ b/configure @@ -404,6 +404,14 @@ fi # make source path absolute 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() { cat > $TMPC < I'll take care of sending a pull request for this. Thanks! Paolo
Re: [Qemu-devel] [PATCH v2] configure: make source tree build more robust
On 28 April 2014 15:23, Michael S. Tsirkin wrote: > @@ -5179,7 +5187,7 @@ do > done > mkdir -p $DIRS > 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" > fi > done It seems a bit silly to do the "are we in the source directory?" check for every file rather than just once outside the loop, but that's a separate bug so we should address it in a separate patch (or ignore it ;-)) thanks -- PMM
Re: [Qemu-devel] [PATCH v2] configure: make source tree build more robust
Il 28/04/2014 16:23, Michael S. Tsirkin ha scritto: 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. ( refers to qemu source tree): ln -s cd /configure A more practical way is when make runs configure automatically: 1. cd /; ./configure SRC_PATH=/ is written into config_host.mak 2. cd /; touch configure; make make now runs /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 --- changes from v1: simpler, more portable heuristic for detecting out of tree builds. configure | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 69b9f56..dd36e54 100755 --- a/configure +++ b/configure @@ -404,6 +404,14 @@ fi # make source path absolute 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() { cat > $TMPC < Reviewed-by: Paolo Bonzini Paolo