qemu-ga build fix for OpenBSD
The following changes since commit aeb29b6459cb9496b38c820f3faff64cf2369d0d:
audio: Always call fini on exit (2012-05-24 19:35:27 +0400)
are available in the git repository at:
git://github.com/mdroth/qemu.git qga-pull-5-24-12
Luiz Capitulino (2):
configure: check if environ is declared
qemu-ga: Fix missing environ declaration
configure | 19 +++++++++++++++++++ qga/commands-posix.c | 6 +++++- 2 files changed, 24 insertions(+), 1 deletions(-)
PATCH 1/2 configure: check if environ is declared
From: Luiz Capitulino <[email protected]>
Some systems may declare environ automatically, others don't. Check for it.
--- configure | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
configure +19 -0
@@ -2831,6 +2831,21 @@ if compile_prog "" "" ; then linux_magic_h=yes 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
@@ -3342,6 +3357,10 @@ if test "$linux_magic_h" = "yes" ; then echo "CONFIG_LINUX_MAGIC_H=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)
Signature · 1 line
1.7.4.1
PATCH 2/2 qemu-ga: Fix missing environ declaration
In reply to Michael RothFrom: Luiz Capitulino <[email protected]>
Commit 3674838cd05268954bb6473239cd7f700a79bf0f uses the environ global variable, but is relying on environ to be declared somewhere else.
This worked for me because on F16 environ is declared in <unistd.h>, but that doesn't happen in OpenBSD for example, causing a build failure.
This commit fixes the build error by declaring environ if it hasn't being declared yet.
Also fixes a build warning due to a missing <sys/wait.h> include.
--- qga/commands-posix.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
qga/commands-posix.c +5 -1
@@ -14,12 +14,17 @@#include <glib.h> #include <sys/types.h> #include <sys/ioctl.h> +#include <sys/wait.h> #include "qga/guest-agent-core.h" #include "qga-qmp-commands.h" #include "qerror.h" #include "qemu-queue.h" #include "host-utils.h" +#ifndef CONFIG_HAS_ENVIRON +extern char **environ; +#endif +#if defined(__linux__)#include <mntent.h> #include <linux/fs.h>
@@ -27,7 +32,6 @@#include <arpa/inet.h> #include <sys/socket.h> #include <net/if.h> -#include <sys/wait.h> #if defined(__linux__) && defined(FIFREEZE )#define CONFIG_FSFREEZE
Signature · 1 line
1.7.4.1