All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] configure / util: Auto-detect the availability of openpty()
@ 2020-07-02 14:39 Thomas Huth
  2020-07-02 14:46 ` Daniel P. Berrangé
  2020-07-02 16:13 ` Michele Denber
  0 siblings, 2 replies; 24+ messages in thread
From: Thomas Huth @ 2020-07-02 14:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Tribble, Michele Denber

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,
let's introduce a proper HAVE_OPENPTY define for this to fix the build
failure.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 Note: Untested, since I do not have a VM with Solaris. Michele,
 Peter, I'd really appreciate a "Tested-by:" from you here. Thanks!

 configure           | 9 ++++++++-
 util/qemu-openpty.c | 4 +++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 4a22dcd563..0b5fd30fc4 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..14e5c8ae8f 100644
--- a/util/qemu-openpty.c
+++ b/util/qemu-openpty.c
@@ -52,7 +52,8 @@
 #endif
 
 #ifdef __sun__
-/* Once Solaris has openpty(), this is going to be removed. */
+
+#if !defined(HAVE_OPENPTY)
 static int openpty(int *amaster, int *aslave, char *name,
                    struct termios *termp, struct winsize *winp)
 {
@@ -93,6 +94,7 @@ err:
         close(mfd);
         return -1;
 }
+#endif
 
 static void cfmakeraw (struct termios *termios_p)
 {
-- 
2.18.1



^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-07-04 21:59 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02 14:39 [PATCH] configure / util: Auto-detect the availability of openpty() Thomas Huth
2020-07-02 14:46 ` Daniel P. Berrangé
2020-07-02 16:07   ` Michele Denber
2020-07-02 17:38   ` Thomas Huth
2020-07-02 16:13 ` Michele Denber
2020-07-02 17:34   ` Thomas Huth
2020-07-02 21:33     ` Michele Denber
2020-07-03  5:11       ` Thomas Huth
2020-07-03 16:25         ` Michele Denber
2020-07-03 16:34         ` Michele Denber
2020-07-03 16:50           ` Peter Maydell
2020-07-03 18:49             ` gmake in Solaris 11.4: _IOR missing Michele Denber
2020-07-03 21:35               ` gmake in Solaris 11.4: TFR missing Michele Denber
2020-07-03 21:55                 ` Philippe Mathieu-Daudé
2020-07-04  9:11                   ` Peter Maydell
2020-07-04 11:30                     ` Philippe Mathieu-Daudé
2020-07-04 13:52                       ` Peter Maydell
2020-07-04 15:27                   ` Michele Denber
2020-07-04 12:02                 ` Thomas Huth
2020-07-04 15:36                   ` Michele Denber
2020-07-04 15:57                     ` Philippe Mathieu-Daudé
2020-07-04 19:15                       ` Michele Denber
2020-07-04 21:58                         ` Peter Maydell
2020-07-04 19:48                       ` Michele Denber

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.