[libvirt] [PATCH 2/2] build: fix mingw build of gnulib openpty

Eric Blake eblake at redhat.com
Wed Nov 9 00:37:20 UTC 2011


Commit f7bd00c12 pulled in a gnulib module that fails to compile
on mingw.  Work around it while waiting for an upstream gnulib fix.

* gnulib/local/lib/pty.in.h (openpty): Provide forward
declarations of opaque structs not present on mingw.
* gnulib/local/lib/openpty.c (openpty): Provide stub for mingw.
---
 gnulib/local/lib/openpty.c.diff |   26 ++++++++++++++++++++++++++
 gnulib/local/lib/pty.in.h.diff  |   13 +++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
 create mode 100644 gnulib/local/lib/openpty.c.diff
 create mode 100644 gnulib/local/lib/pty.in.h.diff

diff --git a/gnulib/local/lib/openpty.c.diff b/gnulib/local/lib/openpty.c.diff
new file mode 100644
index 0000000..f17e566
--- /dev/null
+++ b/gnulib/local/lib/openpty.c.diff
@@ -0,0 +1,26 @@
+diff --git c/lib/openpty.c i/lib/openpty.c
+index c398db5..d61d5ba 100644
+--- c/lib/openpty.c
++++ i/lib/openpty.c
+@@ -32,6 +32,21 @@ rpl_openpty (int *amaster, int *aslave, char *name,
+                   (struct winsize *) winp);
+ }
+
++#elif (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__ /* mingw */
++
++# include <errno.h>
++
++int
++openpty (int *amaster _GL_UNUSED, int *aslave _GL_UNUSED,
++         char *name _GL_UNUSED,
++         struct termios const *termp _GL_UNUSED,
++         struct winsize const *winp _GL_UNUSED)
++{
++  /* Mingw lacks pseudo-terminals altogether.  */
++  errno = ENOSYS;
++  return -1;
++}
++
+ #else /* AIX 5.1, HP-UX 11, IRIX 6.5, Solaris 10, mingw */
+
+ # include <fcntl.h>
diff --git a/gnulib/local/lib/pty.in.h.diff b/gnulib/local/lib/pty.in.h.diff
new file mode 100644
index 0000000..9470700
--- /dev/null
+++ b/gnulib/local/lib/pty.in.h.diff
@@ -0,0 +1,13 @@
+diff --git c/lib/pty.in.h i/lib/pty.in.h
+index aff989c..00eecc6 100644
+--- c/lib/pty.in.h
++++ i/lib/pty.in.h
+@@ -92,6 +92,8 @@ _GL_WARN_ON_USE (forkpty, "forkpty is not declared consistently - "
+ /* Create pseudo tty master slave pair and set terminal attributes
+    according to TERMP and WINP.  Return handles for both ends in
+    *AMASTER and *ASLAVE, and return the name of the slave end in NAME.  */
++struct termios;
++struct winsize;
+ # if @REPLACE_OPENPTY@
+ #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+ #   undef openpty
-- 
1.7.4.4




More information about the libvir-list mailing list