All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: [PULL 4/6] configure / util: Auto-detect the availability of openpty()
Date: Mon,  6 Jul 2020 09:28:33 +0200	[thread overview]
Message-ID: <20200706072835.23582-5-thuth@redhat.com> (raw)
In-Reply-To: <20200706072835.23582-1-thuth@redhat.com>

Recent versions of Solaris (v11.4) now feature an openpty() function,
too, causing a build failure since we ship our own implementation of
openpty() for Solaris in util/qemu-openpty.c so far. Since there are
now both variants available in the wild, with and without this function
(and illumos is said to not have this function yet), let's introduce a
proper HAVE_OPENPTY define for this to fix the build failure.

Message-Id: <20200702143955.678-1-thuth@redhat.com>
Tested-by: Michele Denber <denber@mindspring.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 configure           | 9 ++++++++-
 util/qemu-openpty.c | 5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 8a65240d4a..f8dc64beab 100755
--- a/configure
+++ b/configure
@@ -5134,10 +5134,14 @@ extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
 int main(void) { return openpty(0, 0, 0, 0, 0); }
 EOF
 
-if ! compile_prog "" "" ; then
+have_openpty="no"
+if compile_prog "" "" ; then
+  have_openpty="yes"
+else
   if compile_prog "" "-lutil" ; then
     libs_softmmu="-lutil $libs_softmmu"
     libs_tools="-lutil $libs_tools"
+    have_openpty="yes"
   fi
 fi
 
@@ -7380,6 +7384,9 @@ fi
 if test "$have_broken_size_max" = "yes" ; then
     echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
 fi
+if test "$have_openpty" = "yes" ; then
+    echo "HAVE_OPENPTY=y" >> $config_host_mak
+fi
 
 # Work around a system header bug with some kernel/XFS header
 # versions where they both try to define 'struct fsxattr':
diff --git a/util/qemu-openpty.c b/util/qemu-openpty.c
index 2e8b43bdf5..4b8df96f38 100644
--- a/util/qemu-openpty.c
+++ b/util/qemu-openpty.c
@@ -52,7 +52,9 @@
 #endif
 
 #ifdef __sun__
-/* Once Solaris has openpty(), this is going to be removed. */
+
+#if !defined(HAVE_OPENPTY)
+/* Once illumos has openpty(), this is going to be removed. */
 static int openpty(int *amaster, int *aslave, char *name,
                    struct termios *termp, struct winsize *winp)
 {
@@ -93,6 +95,7 @@ err:
         close(mfd);
         return -1;
 }
+#endif
 
 static void cfmakeraw (struct termios *termios_p)
 {
-- 
2.18.1



  parent reply	other threads:[~2020-07-06  7:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06  7:28 [PULL 0/6] qtest and misc patches Thomas Huth
2020-07-06  7:28 ` [PULL 1/6] fuzz: fix broken qtest check at rcu_disable_atfork Thomas Huth
2020-07-06  7:28 ` [PULL 2/6] fuzz: do not use POSIX shm for coverage bitmap Thomas Huth
2020-07-06  7:28 ` [PULL 3/6] tests/qtest: Unify the test for the xenfv and xenpv machines Thomas Huth
2020-07-06  7:28 ` Thomas Huth [this message]
2020-07-06  7:28 ` [PULL 5/6] hw/m68k/mcf5206: Replace remaining hw_error()s by qemu_log_mask() Thomas Huth
2020-07-06  7:36   ` Thomas Huth
2020-07-06  7:28 ` [PULL 6/6] tests/acceptance: Add a test for the sun4u sparc64 machine Thomas Huth
2020-07-07 15:20 ` [PULL 0/6] qtest and misc patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200706072835.23582-5-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.