All UNIX platforms we care about have openpty() in the libutil
library. Use of pty.h must also be made conditional, excluding
Win32.
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
exclude_file_name_regexp--sc_prohibit_backslash_alignment = \
^build-aux/syntax-check\.mk$$
+
+exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
+ ^src/util/virfile\.c$$
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 \
AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" = "xyes"])
AC_CHECK_LIB([intl],[gettext],[])
+AC_CHECK_LIB([util],[openpty],[])
dnl
$(NULL)
libvirt_util_la_LIBADD = \
-lm \
+ $(OPENPTY_LIBS) \
$(CAPNG_LIBS) \
$(YAJL_LIBS) \
$(LIBNL_LIBS) \
#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>