From db1a2ddef44cf1e908b44559e383553488e026f1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 11 May 2012 18:58:57 +0100 Subject: autoconf: New test for openpty et al. We may need to #include , 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 where appropriate. Signed-off-by: Ian Jackson Acked-by: Ian Campbell Changes since v7: * Actually include the call to AX_CHECK_PTYFUNCS in this patch, not the previous one, and regenerate configure accordingly. Changes since v6: * Put failure macro call in correct place so it might actually happen. * Try both with -lutil and without. * Patch now contains update for config.h.in. Committed-by: Ian Jackson --- tools/configure | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'tools/configure') diff --git a/tools/configure b/tools/configure index d8918fe6f2..be7feb68bd 100755 --- a/tools/configure +++ b/tools/configure @@ -598,6 +598,7 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS libiconv +PTYFUNCS_LIBS PTHREAD_LIBS PTHREAD_LDFLAGS PTHREAD_CFLAGS @@ -2308,6 +2309,8 @@ fi + + # Enable/disable options # Check whether --enable-githttp was given. @@ -6443,6 +6446,64 @@ $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 " >>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 + + for ax_cv_ptyfuncs_libs in -lutil "" NOT_FOUND; do + if test "x$ax_cv_ptyfuncs_libs" = "xNOT_FOUND"; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Unable to find library for openpty and login_tty +See \`config.log' for more details" "$LINENO" 5 ; } + fi + + 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 : + + break + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + LIBS="$saved_LIBS" + + done + +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 yajl_alloc in -lyajl" >&5 $as_echo_n "checking for yajl_alloc in -lyajl... " >&6; } if test "${ac_cv_lib_yajl_yajl_alloc+set}" = set; then : -- cgit v1.2.3