From 515f45cca85826304a39fd9d514638e8c6a4c49b Mon Sep 17 00:00:00 2001
Message-Id: <515f45cca85826304a39fd9d514638e8c6a4c49b.1342518105.git.minovotn@redhat.com>
In-Reply-To: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com>
References: <27a73856ecc481c66c7afac8171f753887f32e31.1342518105.git.minovotn@redhat.com>
From: Luiz Capitulino <lcapitulino@redhat.com>
Date: Tue, 5 Jun 2012 14:58:48 +0200
Subject: [PATCH 38/41] configure: check if environ is declared

RH-Author: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: <1338908331-15633-34-git-send-email-lcapitulino@redhat.com>
Patchwork-id: 39930
O-Subject: [PATCH RHEL6.4 qemu-kvm 33/36] configure: check if environ is declared
Bugzilla: 827612
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

Some systems may declare environ automatically, others don't. Check for it.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
(cherry picked from commit 8ab1bf120d7fcf84f199679ad0d25acbc354c69c)

Conflicts:
	configure

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 configure | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 configure |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/configure b/configure
index 5a330ff..2422f2d 100755
--- a/configure
+++ b/configure
@@ -2134,6 +2134,21 @@ if test "$trace_backend" = "dtrace"; then
   fi
 fi
 
+########################################
+# check if environ is declared
+
+has_environ=no
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(void) {
+    environ = environ;
+    return 0;
+}
+EOF
+if compile_prog "" "" ; then
+    has_environ=yes
+fi
+
 ##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
@@ -2563,6 +2578,10 @@ if test "$zero_malloc" = "yes" ; then
   echo "CONFIG_ZERO_MALLOC=y" >> $config_host_mak
 fi
 
+if test "$has_environ" = "yes" ; then
+  echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
+fi
+
 # USB host support
 case "$usb" in
 linux)
-- 
1.7.10.4

