From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 23/31] autoconf: New test for openpty et al.
Date: Tue, 10 Apr 2012 20:07:57 +0100 [thread overview]
Message-ID: <1334084885-14474-24-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1334084885-14474-1-git-send-email-ian.jackson@eu.citrix.com>
We may need to #include <libutil.h>, and/or link with -lutil, to use
openpty, login_tty, and the like. Provide INCLUDE_LIBUTIL_H
(preprocessor constant, not always defined) and PTYFUNCS_LIBS
(makefile variable).
We link libxl against PTYFUNCS_LIBS (which comes from autoconf) rather
than UTIL_LIBS, and #include <libutil.h> where appropriate.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
config/Tools.mk.in | 2 +
tools/configure | 51 ++++++++++++++++++++++++++++++++++++++++
tools/configure.ac | 2 +
tools/libxl/Makefile | 2 +-
tools/libxl/libxl_bootloader.c | 4 +++
tools/m4/ptyfuncs.m4 | 24 ++++++++++++++++++
6 files changed, 84 insertions(+), 1 deletions(-)
create mode 100644 tools/m4/ptyfuncs.m4
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index 912d021..eb879dd 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -30,6 +30,8 @@ PTHREAD_CFLAGS := @PTHREAD_CFLAGS@
PTHREAD_LDFLAGS := @PTHREAD_LDFLAGS@
PTHREAD_LIBS := @PTHREAD_LIBS@
+PTYFUNCS_LIBS := @PTYFUNCS_LIBS@
+
# Download GIT repositories via HTTP or GIT's own protocol?
# GIT's protocol is faster and more robust, when it works at all (firewalls
# may block it). We make it the default, but if your GIT repository downloads
diff --git a/tools/configure b/tools/configure
index 86618f5..eeaf901 100755
--- a/tools/configure
+++ b/tools/configure
@@ -602,6 +602,7 @@ POW_LIB
LIBOBJS
ALLOCA
libiconv
+PTYFUNCS_LIBS
PTHREAD_LIBS
PTHREAD_LDFLAGS
PTHREAD_CFLAGS
@@ -3947,6 +3948,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
# Enable/disable options
# Check whether --enable-githttp was given.
@@ -7315,6 +7318,54 @@ $as_echo "$ax_cv_pthread_flags" >&6; }
+
+ ac_fn_c_check_header_mongrel "$LINENO" "libutil.h" "ac_cv_header_libutil_h" "$ac_includes_default"
+if test "x$ac_cv_header_libutil_h" = x""yes; then :
+
+
+$as_echo "#define INCLUDE_LIBUTIL_H <libutil.h>" >>confdefs.h
+
+
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for openpty et al" >&5
+$as_echo_n "checking for openpty et al... " >&6; }
+if test "${ax_cv_ptyfuncs_libs+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ ax_cv_ptyfuncs_libs=-lutil
+
+ saved_LIBS="$LIBS"
+
+ LIBS="$LIBS $ax_cv_ptyfuncs_libs"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifdef INCLUDE_LIBUTIL_H
+#include INCLUDE_LIBUTIL_H
+#endif
+int main(void) {
+ openpty(0,0,0,0,0);
+ login_tty(0);
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+ LIBS="$saved_LIBS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_ptyfuncs_libs" >&5
+$as_echo "$ax_cv_ptyfuncs_libs" >&6; }
+ PTYFUNCS_LIBS="$ax_cv_ptyfuncs_libs"
+
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5
$as_echo_n "checking for clock_gettime in -lrt... " >&6; }
if test "${ac_cv_lib_rt_clock_gettime+set}" = set; then :
diff --git a/tools/configure.ac b/tools/configure.ac
index 250dffd..b4f72e8 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -35,6 +35,7 @@ m4_include([m4/uuid.m4])
m4_include([m4/pkg.m4])
m4_include([m4/curses.m4])
m4_include([m4/pthread.m4])
+m4_include([m4/ptyfuncs.m4])
# Enable/disable options
AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -132,6 +133,7 @@ AC_SUBST(libext2fs)
AC_CHECK_LIB([gcrypt], [gcry_md_hash_buffer], [libgcrypt="y"], [libgcrypt="n"])
AC_SUBST(libgcrypt)
AX_CHECK_PTHREAD
+AX_CHECK_PTYFUNCS
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_LIB([yajl], [yajl_alloc], [],
[AC_MSG_ERROR([Could not find yajl])])
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index e5ea867..5ba144f 100644
--- a/tools/libxl/Makefile
+++ b/tools/libxl/Makefile
@@ -20,7 +20,7 @@ LIBUUID_LIBS += -luuid
endif
LIBXL_LIBS =
-LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(UTIL_LIBS) $(LIBUUID_LIBS)
+LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
CFLAGS += $(PTHREAD_CFLAGS)
LDFLAGS += $(PTHREAD_LDFLAGS)
diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c
index 2774062..b50944a 100644
--- a/tools/libxl/libxl_bootloader.c
+++ b/tools/libxl/libxl_bootloader.c
@@ -16,6 +16,10 @@
#include <termios.h>
+#ifdef INCLUDE_LIBUTIL_H
+#include INCLUDE_LIBUTIL_H
+#endif
+
#include "libxl_internal.h"
#define XENCONSOLED_BUF_SIZE 16
diff --git a/tools/m4/ptyfuncs.m4 b/tools/m4/ptyfuncs.m4
new file mode 100644
index 0000000..2846a6d
--- /dev/null
+++ b/tools/m4/ptyfuncs.m4
@@ -0,0 +1,24 @@
+AC_DEFUN([AX_CHECK_PTYFUNCS], [
+ AC_CHECK_HEADER([libutil.h],[
+ AC_DEFINE([INCLUDE_LIBUTIL_H],[<libutil.h>],[libutil header file name])
+ ])
+ AC_CACHE_CHECK([for openpty et al], [ax_cv_ptyfuncs_libs], [
+ ax_cv_ptyfuncs_libs=-lutil
+ AX_SAVEVAR_SAVE(LIBS)
+ LIBS="$LIBS $ax_cv_ptyfuncs_libs"
+ AC_LINK_IFELSE([
+#ifdef INCLUDE_LIBUTIL_H
+#include INCLUDE_LIBUTIL_H
+#endif
+int main(void) {
+ openpty(0,0,0,0,0);
+ login_tty(0);
+}
+])
+ AX_SAVEVAR_RESTORE(LIBS)],
+ [],[
+ AC_MSG_FAILURE([Unable to find -lutil for openpty and login_tty])
+ ])
+ PTYFUNCS_LIBS="$ax_cv_ptyfuncs_libs"
+ AC_SUBST(PTYFUNCS_LIBS)
+])
--
1.7.2.5
next prev parent reply other threads:[~2012-04-10 19:07 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-10 19:07 [PATCH v4 00/31] libxl child process handling Ian Jackson
2012-04-10 19:07 ` [PATCH 01/31] .gitignore: Add a missing file Ian Jackson
2012-04-11 8:44 ` Ian Campbell
2012-04-10 19:07 ` [PATCH 02/31] libxl: ao: allow immediate completion Ian Jackson
2012-04-10 19:07 ` [PATCH 03/31] libxl: fix hang due to libxl__initiate_device_remove Ian Jackson
2012-04-10 19:07 ` [PATCH 04/31] libxl: Fix eventloop_iteration over-locking Ian Jackson
2012-04-10 19:07 ` [PATCH 05/31] libxl: remove poller from list in libxl__poller_get Ian Jackson
2012-04-10 19:07 ` [PATCH 06/31] libxl: Fix leak of ctx->lock Ian Jackson
2012-04-10 19:07 ` [PATCH 07/31] tools: Correct PTHREAD options in config/StdGNU.mk Ian Jackson
2012-04-10 19:07 ` [PATCH 08/31] libxl: Use PTHREAD_CFLAGS, LDFLAGS, LIBS Ian Jackson
2012-04-10 19:07 ` [PATCH 09/31] tools: Use PTHREAD_CFLAGS, _LDFLAGS, _LIBS Ian Jackson
2012-04-10 19:07 ` [PATCH 10/31] libxl: Crash (more sensibly) on malloc failure Ian Jackson
2012-04-11 9:02 ` Ian Campbell
2012-04-11 10:24 ` Ian Jackson
2012-04-11 10:47 ` Ian Campbell
2012-04-11 11:04 ` Ian Jackson
2012-04-11 11:14 ` Ian Campbell
2012-04-11 11:21 ` Ian Jackson
2012-04-11 11:23 ` Ian Jackson
2012-04-11 11:33 ` Ian Campbell
2012-04-10 19:07 ` [PATCH 11/31] libxl: Make libxl__zalloc et al tolerate a NULL gc Ian Jackson
2012-04-10 19:07 ` [PATCH 12/31] libxl: Introduce some convenience macros Ian Jackson
2012-04-10 19:07 ` [PATCH 13/31] libxl: include <ctype.h> and introduce CTYPE helper macro Ian Jackson
2012-04-10 19:07 ` [PATCH 14/31] libxl: Provide libxl_string_list_length Ian Jackson
2012-04-10 19:07 ` [PATCH 15/31] libxl: include <_libxl_paths.h> in libxl_internal.h Ian Jackson
2012-04-10 19:07 ` [PATCH 16/31] libxl: abolish libxl_ctx_postfork Ian Jackson
2012-04-10 19:07 ` [PATCH 17/31] libxl: libxl_event.c:beforepoll_internal, REQUIRE_FDS Ian Jackson
2012-04-10 19:07 ` [PATCH 18/31] libxl: Protect fds with CLOEXEC even with forking threads Ian Jackson
2012-04-11 9:14 ` Ian Campbell
2012-04-11 10:38 ` Ian Jackson
2012-04-10 19:07 ` [PATCH 19/31] libxl: provide STATE_AO_GC Ian Jackson
2012-04-11 9:17 ` Ian Campbell
2012-04-10 19:07 ` [PATCH 20/31] libxl: handle POLLERR, POLLHUP, POLLNVAL properly Ian Jackson
2012-04-11 9:21 ` Ian Campbell
2012-04-11 10:50 ` Ian Jackson
2012-04-11 10:52 ` Ian Campbell
2012-04-10 19:07 ` [PATCH 21/31] libxl: support multiple libxl__ev_fds for the same fd Ian Jackson
2012-04-10 19:07 ` [PATCH 22/31] libxl: event API: new facilities for waiting for subprocesses Ian Jackson
2012-04-11 9:42 ` Ian Campbell
2012-04-10 19:07 ` Ian Jackson [this message]
2012-04-10 19:07 ` [PATCH 24/31] libxl: provide libxl__remove_file et al Ian Jackson
2012-04-11 9:54 ` Ian Campbell
2012-04-11 10:56 ` Ian Jackson
2012-04-11 11:03 ` Ian Campbell
2012-04-10 19:07 ` [PATCH 25/31] libxl: Introduce libxl__sendmsg_fds and libxl__recvmsg_fds Ian Jackson
2012-04-10 19:08 ` [PATCH 26/31] libxl: Clean up setdefault in do_domain_create Ian Jackson
2012-04-11 9:57 ` Ian Campbell
2012-04-10 19:08 ` [PATCH 27/31] libxl: provide libxl__datacopier_* Ian Jackson
2012-04-11 10:47 ` Ian Campbell
2012-04-11 11:11 ` Ian Jackson
2012-04-10 19:08 ` [PATCH 28/31] libxl: provide libxl__openpty_* Ian Jackson
2012-04-11 11:03 ` Ian Campbell
2012-04-11 11:19 ` Ian Jackson
2012-04-11 11:33 ` Ian Campbell
2012-04-10 19:08 ` [PATCH 29/31] libxl: ao: Convert libxl_run_bootloader Ian Jackson
2012-04-11 11:31 ` Ian Campbell
2012-04-11 11:39 ` Ian Jackson
2012-04-11 11:45 ` Ian Campbell
2012-04-10 19:08 ` [PATCH 30/31] libxl: make libxl_create_logfile const-correct Ian Jackson
2012-04-11 9:58 ` Ian Campbell
2012-04-10 19:08 ` [PATCH 31/31] libxl: log bootloader output Ian Jackson
2012-04-11 10:00 ` Ian Campbell
2012-04-11 9:04 ` [PATCH v4 00/31] libxl child process handling Ian Campbell
2012-04-11 10:35 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1334084885-14474-24-git-send-email-ian.jackson@eu.citrix.com \
--to=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).