]> xenbits.xensource.com Git - libvirt.git/commitdiff
gnulib: add getopt module
authorFabian Freyer <fabian.freyer@physik.tu-berlin.de>
Thu, 9 Jun 2016 00:50:35 +0000 (00:50 +0000)
committerRoman Bogorodskiy <rb0427@att.com>
Sun, 10 Jul 2016 19:39:44 +0000 (15:39 -0400)
Unconditionally use gnulib's getopt module. This is needed by the bhyve driver
to provide a reentrant interface for getopt.

Several gnulib headers rely on features.h being included by ctype.h to provide
__GNUC_PREREQ, but on systems without glibc, this is not provided. In these
cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
in src/internal.h.
Therefore, define __GNUC_PREREQ as early as possible. config-post.h is probably
the first header that is included, before any other headers.

bootstrap.conf
config-post.h
m4/virt-driver-bhyve.m4
po/POTFILES.in

index 0db6b62d5f061b630e8491912a4e4000e1133b74..edea8c33b157dd9d73e59ac0bb94c794c6217688 100644 (file)
@@ -54,6 +54,7 @@ func
 getaddrinfo
 getcwd-lgpl
 gethostname
+getopt-posix
 getpass
 getpeername
 getsockname
index f43521bd34890bbdd579464c2c0a7dff1452bde8..dd691976b8bf5702cd2c87576c5c760e1b188756 100644 (file)
 # undef WITH_SECDRIVER_APPARMOR
 # undef WITH_CAPNG
 #endif /* LIBVIRT_NSS */
+
+/*
+ * Define __GNUC__ to a sane default if it isn't yet defined.
+ * This is done here so that it's included as early as possible; gnulib relies
+ * on this to be defined in features.h, which should be included from ctype.h.
+ * This doesn't happen on many non-glibc systems.
+ * When __GNUC__ is not defined, gnulib defines it to 0, which breaks things.
+ */
+#ifdef __GNUC__
+# ifndef __GNUC_PREREQ
+#  if defined __GNUC__ && defined __GNUC_MINOR__
+#   define __GNUC_PREREQ(maj, min)                                        \
+   ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
+#  else
+#   define __GNUC_PREREQ(maj, min) 0
+#  endif
+# endif
+#endif
index c65b15d72a0b09d4a7b288c3fcc90348365a2634..bbdd8b2f0fed6f3e9da86527dac63d5f59ba9b2c 100644 (file)
@@ -52,6 +52,9 @@ AC_DEFUN([LIBVIRT_DRIVER_CHECK_BHYVE],[
     AM_CONDITIONAL([WITH_BHYVE], [test "$with_bhyve" = "yes"])
 ])
 
+dnl Build with gnulib's getopt which contains a reentrant interface
+AC_DEFUN([gl_REPLACE_GETOPT_ALWAYS], [])
+
 AC_DEFUN([LIBVIRT_DRIVER_RESULT_BHYVE],[
     AC_MSG_NOTICE([    Bhyve: $with_bhyve])
 ])
index 053936697270b3b3ab963de759f8559bef8117da..ca07582e194d8b322230f63552e57817c2690002 100644 (file)
@@ -8,6 +8,7 @@ daemon/remote.c
 daemon/remote_dispatch.h
 daemon/stream.c
 gnulib/lib/gai_strerror.c
+gnulib/lib/getopt.c
 gnulib/lib/regcomp.c
 src/access/viraccessdriverpolkit.c
 src/access/viraccessmanager.c