[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] configure: make source tree build more robust
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH] configure: make source tree build more robust |
Date: |
Mon, 28 Apr 2014 17:38:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Eric Blake <address@hidden> writes:
> On 04/28/2014 06:21 AM, Michael S. Tsirkin wrote:
>> 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:
>
>> +# running configure in the source tree? create a temporary file
>> +# under pwd, check for it in source tree. Use .o suffix so that
>> +# make clean will blow it away if
>> +canary_path=`pwd`
>> +canary_fullpath=`mktemp "$canary_path/canary.XXXXXXXXXX.o"`
>
> mktemp is non-POSIX, and not necessarily portable. In particular, on
> FreeBSD, 'mktemp a.XXXX.b' generates the file 'a.XXXX.b', with no
> randomness introduced, which therefore makes it a predictable file name
> and defeats the purpose of using mktemp.
>
> Paolo's suggestion of using ./configure as the canary seems more reliable.
For what it's worth, recommended autoconf practice is to use a source
file that's probably unique to the package:
-- Macro: AC_CONFIG_SRCDIR (UNIQUE-FILE-IN-SOURCE-DIR)
UNIQUE-FILE-IN-SOURCE-DIR is some file that is in the package's
source directory; `configure' checks for this file's existence to
make sure that the directory that it is told contains the source
code in fact does. Occasionally people accidentally specify the
wrong directory with `--srcdir'; this is a safety check. *Note
configure Invocation::, for more information.
We got a bunch starting with qemu-; suggest to pick one you like.