提交 f650e867 编写于 作者: D Daniel P. Berrangé

util: add detection of openpty function

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: NPavel Hrdina <phrdina@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 913707bb
......@@ -2342,3 +2342,6 @@ exclude_file_name_regexp--sc_prohibit_strcmp = \
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$$
......@@ -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
......
......@@ -282,6 +282,7 @@ libvirt_util_la_CFLAGS = \
$(NULL)
libvirt_util_la_LIBADD = \
-lm \
$(OPENPTY_LIBS) \
$(CAPNG_LIBS) \
$(YAJL_LIBS) \
$(LIBNL_LIBS) \
......
......@@ -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>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册