From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGSl3-0001RE-Gg for qemu-devel@nongnu.org; Thu, 20 Feb 2014 07:29:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGSky-00037N-Mr for qemu-devel@nongnu.org; Thu, 20 Feb 2014 07:29:41 -0500 Received: from mail-ea0-x229.google.com ([2a00:1450:4013:c01::229]:46021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGSky-00036r-GT for qemu-devel@nongnu.org; Thu, 20 Feb 2014 07:29:36 -0500 Received: by mail-ea0-f169.google.com with SMTP id h10so877556eak.0 for ; Thu, 20 Feb 2014 04:29:35 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 20 Feb 2014 13:29:02 +0100 Message-Id: <1392899343-5226-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1392899343-5226-1-git-send-email-pbonzini@redhat.com> References: <1392899343-5226-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 11/12] configure: Disable libtool if -fPIE does not work with it (bug #1257099) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, famz@redhat.com, Don Slutz , aliguori@amazon.com From: Don Slutz Adjust TMPO and added TMPB, TMPL, and TMPA. libtool needs the names to be fixed (TMPB). Add new functions do_libtool and libtool_prog. Add check for broken gcc and libtool. Signed-off-by: Don Slutz Signed-off-by: Paolo Bonzini --- configure | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 66d7633..46b5b6d 100755 --- a/configure +++ b/configure @@ -12,7 +12,10 @@ else fi TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" -TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o" +TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}" +TMPO="${TMPDIR1}/${TMPB}.o" +TMPL="${TMPDIR1}/${TMPB}.lo" +TMPA="${TMPDIR1}/lib${TMPB}.la" TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" # NB: do not call "exit" in the trap handler; this is buggy with some shells; @@ -86,6 +89,38 @@ compile_prog() { do_cc $QEMU_CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags } +do_libtool() { + local mode=$1 + shift + # Run the compiler, capturing its output to the log. + echo $libtool $mode --tag=CC $cc "$@" >> config.log + $libtool $mode --tag=CC $cc "$@" >> config.log 2>&1 || return $? + # Test passed. If this is an --enable-werror build, rerun + # the test with -Werror and bail out if it fails. This + # makes warning-generating-errors in configure test code + # obvious to developers. + if test "$werror" != "yes"; then + return 0 + fi + # Don't bother rerunning the compile if we were already using -Werror + case "$*" in + *-Werror*) + return 0 + ;; + esac + echo $libtool $mode --tag=CC $cc -Werror "$@" >> config.log + $libtool $mode --tag=CC $cc -Werror "$@" >> config.log 2>&1 && return $? + error_exit "configure test passed without -Werror but failed with -Werror." \ + "This is probably a bug in the configure script. The failing command" \ + "will be at the bottom of config.log." \ + "You can run configure with --disable-werror to bypass this check." +} + +libtool_prog() { + do_libtool --mode=compile $QEMU_CFLAGS -c -fPIE -DPIE -o $TMPO $TMPC || return $? + do_libtool --mode=link $LDFLAGS -o $TMPA $TMPL -rpath /usr/local/lib +} + # symbolically link $1 to $2. Portable version of "ln -sf". symlink() { rm -rf "$2" @@ -1406,6 +1441,32 @@ EOF fi fi +# check for broken gcc and libtool in RHEL5 +if test -n "$libtool" -a "$pie" != "no" ; then + cat > $TMPC <