Skip to content

Commit 9df8b20

Browse files
committed
configure / util: Auto-detect the availability of openpty()
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: <[email protected]> Tested-by: Michele Denber <[email protected]> Signed-off-by: Thomas Huth <[email protected]>
1 parent 51b3ca9 commit 9df8b20

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

configure

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5134,10 +5134,14 @@ extern int openpty(int *am, int *as, char *name, void *termp, void *winp);
51345134
int main(void) { return openpty(0, 0, 0, 0, 0); }
51355135
EOF
51365136

5137-
if ! compile_prog "" "" ; then
5137+
have_openpty="no"
5138+
if compile_prog "" "" ; then
5139+
have_openpty="yes"
5140+
else
51385141
if compile_prog "" "-lutil" ; then
51395142
libs_softmmu="-lutil $libs_softmmu"
51405143
libs_tools="-lutil $libs_tools"
5144+
have_openpty="yes"
51415145
fi
51425146
fi
51435147

@@ -7380,6 +7384,9 @@ fi
73807384
if test "$have_broken_size_max" = "yes" ; then
73817385
echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
73827386
fi
7387+
if test "$have_openpty" = "yes" ; then
7388+
echo "HAVE_OPENPTY=y" >> $config_host_mak
7389+
fi
73837390

73847391
# Work around a system header bug with some kernel/XFS header
73857392
# versions where they both try to define 'struct fsxattr':

util/qemu-openpty.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
#endif
5353

5454
#ifdef __sun__
55-
/* Once Solaris has openpty(), this is going to be removed. */
55+
56+
#if !defined(HAVE_OPENPTY)
57+
/* Once illumos has openpty(), this is going to be removed. */
5658
static int openpty(int *amaster, int *aslave, char *name,
5759
struct termios *termp, struct winsize *winp)
5860
{
@@ -93,6 +95,7 @@ static int openpty(int *amaster, int *aslave, char *name,
9395
close(mfd);
9496
return -1;
9597
}
98+
#endif
9699

97100
static void cfmakeraw (struct termios *termios_p)
98101
{

0 commit comments

Comments
 (0)