All UNIX platforms we care about have openpty() in the libutil library. Use of pty.h must also be made conditional, excluding Win32. Signed-off-by: Daniel P. Berrangé <berrange@xxxxxxxxxx> --- configure.ac | 4 ++++ src/util/Makefile.inc.am | 1 + src/util/virfile.c | 14 +++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 002a3dcdb0..3e5032a8c4 100644 --- a/configure.ac +++ b/configure.ac @@ -383,10 +383,13 @@ dnl Availability of various common headers (non-fatal if missing). AC_CHECK_HEADERS([\ ifaddrs.h \ libtasn1.h \ + util.h \ + libutil.h \ linux/magic.h \ mntent.h \ net/ethernet.h \ netinet/tcp.h \ + pty.h \ pwd.h \ stdarg.h \ syslog.h \ @@ -430,6 +433,7 @@ dnl header could be found. AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"]) AC_CHECK_LIB([intl],[gettext],[]) +AC_CHECK_LIB([util],[openpty],[]) dnl diff --git a/src/util/Makefile.inc.am b/src/util/Makefile.inc.am index 03054e8862..c65fcb5f9b 100644 --- a/src/util/Makefile.inc.am +++ b/src/util/Makefile.inc.am @@ -283,6 +283,7 @@ libvirt_util_la_CFLAGS = \ $(NULL) libvirt_util_la_LIBADD = \ -lm \ + $(OPENPTY_LIBS) \ $(CAPNG_LIBS) \ $(YAJL_LIBS) \ $(LIBNL_LIBS) \ diff --git a/src/util/virfile.c b/src/util/virfile.c index a6d2d4a8e3..14bfd3beb6 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -27,7 +27,19 @@ #include <passfd.h> #include <fcntl.h> -#include <pty.h> +#include <termios.h> +#ifdef HAVE_PTY_H +/* Linux openpty */ +# include <pty.h> +#endif /* !HAVE_PTY_H */ +#ifdef HAVE_UTIL_H +/* macOS openpty */ +# include <util.h> +#endif /* !HAVE_LIBUTIL_H */ +#ifdef HAVE_LIBUTIL_H +/* FreeBSD openpty */ +# include <libutil.h> +#endif /* !HAVE_LIBUTIL_H */ #include <sys/stat.h> #include <sys/types.h> #include <sys/socket.h> -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list