Don't try to use grantpt() on OpenBSD. It causes crashes.

Problem reported by Jan Stary and Marcus Merighi, analysed by guenther@,
configure.ac patch by me.
This commit is contained in:
matthieu 2013-07-14 09:21:37 +00:00
parent 96d723029a
commit a5cf6f6f3e
6 changed files with 143 additions and 57 deletions

View File

@ -252,6 +252,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@

102
app/luit/aclocal.m4 vendored
View File

@ -20,6 +20,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
@ -46,8 +47,12 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
@ -60,7 +65,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])# PKG_PROG_PKG_CONFIG
@ -69,34 +73,32 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
#
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# PKG_CHECK_EXISTS manually
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# only at the first occurence in configure.ac, so if the first place
# it's called might be skipped (such as if it is within an "if", you
# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
pkg_cv_[]$1="$$1"
else
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
[pkg_failed=yes])
fi
else
pkg_failed=untried
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])# _PKG_CONFIG
@ -138,16 +140,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@ -155,28 +158,67 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT
])],
[AC_MSG_RESULT([no])
$4])
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])],
[$4])
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3])
$3
fi[]dnl
])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation

81
app/luit/configure vendored
View File

@ -658,6 +658,8 @@ build_vendor
build_cpu
build
INSTALL_CMD
PKG_CONFIG_LIBDIR
PKG_CONFIG_PATH
PKG_CONFIG
CHANGELOG_CMD
STRICT_CFLAGS
@ -767,6 +769,8 @@ LIBS
CPPFLAGS
CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
LUIT_CFLAGS
LUIT_LIBS'
@ -1420,6 +1424,10 @@ Some influential environment variables:
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
LUIT_CFLAGS C compiler flags for LUIT, overriding pkg-config
LUIT_LIBS linker flags for LUIT, overriding pkg-config
@ -4393,6 +4401,11 @@ fi
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
@ -4505,7 +4518,6 @@ $as_echo "yes" >&6; }
$as_echo "no" >&6; }
PKG_CONFIG=""
fi
fi
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
@ -10483,7 +10495,23 @@ fi
done
for ac_func in select grantpt posix_openpt
# grantpt support is broken on OpenBSD
case $host_os in
openbsd*)
for ac_func in select
do :
ac_fn_c_check_func "$LINENO" "select" "ac_cv_func_select"
if test "x$ac_cv_func_select" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SELECT 1
_ACEOF
fi
done
;;
*)
for ac_func in select grantpt posix_openpt
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -10495,6 +10523,8 @@ _ACEOF
fi
done
;;
esac
# Check whether --with-localealiasfile was given.
@ -10512,46 +10542,46 @@ pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LUIT" >&5
$as_echo_n "checking for LUIT... " >&6; }
if test -n "$PKG_CONFIG"; then
if test -n "$LUIT_CFLAGS"; then
pkg_cv_LUIT_CFLAGS="$LUIT_CFLAGS"
else
if test -n "$PKG_CONFIG" && \
if test -n "$LUIT_CFLAGS"; then
pkg_cv_LUIT_CFLAGS="$LUIT_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontenc\""; } >&5
($PKG_CONFIG --exists --print-errors "fontenc") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LUIT_CFLAGS=`$PKG_CONFIG --cflags "fontenc" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
else
pkg_failed=untried
fi
if test -n "$PKG_CONFIG"; then
if test -n "$LUIT_LIBS"; then
pkg_cv_LUIT_LIBS="$LUIT_LIBS"
else
if test -n "$PKG_CONFIG" && \
if test -n "$LUIT_LIBS"; then
pkg_cv_LUIT_LIBS="$LUIT_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fontenc\""; } >&5
($PKG_CONFIG --exists --print-errors "fontenc") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LUIT_LIBS=`$PKG_CONFIG --libs "fontenc" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
fi
else
pkg_failed=untried
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
@ -10559,9 +10589,9 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LUIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "fontenc"`
LUIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fontenc" 2>&1`
else
LUIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontenc"`
LUIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fontenc" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LUIT_PKG_ERRORS" >&5
@ -10575,9 +10605,10 @@ installed software in a non-standard prefix.
Alternatively, you may set the environment variables LUIT_CFLAGS
and LUIT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
" "$LINENO" 5
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
@ -10588,14 +10619,14 @@ Alternatively, you may set the environment variables LUIT_CFLAGS
and LUIT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LUIT_CFLAGS=$pkg_cv_LUIT_CFLAGS
LUIT_LIBS=$pkg_cv_LUIT_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
:
fi
# We don't link against libX11, just use its locale.alias data file
@ -10684,7 +10715,7 @@ fi
done
for ac_func in grantpt putenv select strdup
for ac_func in putenv select strdup
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -38,7 +38,15 @@ AC_CANONICAL_HOST
AC_CHECK_HEADERS([pty.h stropts.h sys/param.h sys/select.h])
AC_CHECK_FUNCS([select grantpt posix_openpt])
# grantpt support is broken on OpenBSD
case $host_os in
openbsd*)
AC_CHECK_FUNCS([select])
;;
*)
AC_CHECK_FUNCS([select grantpt posix_openpt])
;;
esac
AC_ARG_WITH(localealiasfile,
AS_HELP_STRING([--with-localealiasfile=<path>],
@ -73,7 +81,7 @@ esac
AC_SUBST(OS_CFLAGS)
AC_CHECK_HEADERS([pty.h stropts.h sys/ioctl.h sys/param.h sys/poll.h sys/select.h sys/time.h termios.h])
AC_CHECK_FUNCS([grantpt putenv select strdup])
AC_CHECK_FUNCS([putenv select strdup])
if test "x$ac_cv_func_grantpt" != "xyes" ; then
AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no])

View File

@ -197,6 +197,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@

View File

@ -336,6 +336,7 @@ allocatePty(int *pty_return, char **line_return)
int rc;
#ifdef HAVE_POSIX_OPENPT
#error bug
pty = posix_openpt(O_RDWR);
#else
pty = open("/dev/ptmx", O_RDWR);