1dnl  Copyright 2005 Red Hat, Inc.
2dnl 
3dnl  Permission to use, copy, modify, distribute, and sell this software and its
4dnl  documentation for any purpose is hereby granted without fee, provided that
5dnl  the above copyright notice appear in all copies and that both that
6dnl  copyright notice and this permission notice appear in supporting
7dnl  documentation, and that the name of Red Hat not be used in
8dnl  advertising or publicity pertaining to distribution of the software without
9dnl  specific, written prior permission.  Red Hat makes no
10dnl  representations about the suitability of this software for any purpose.  It
11dnl  is provided "as is" without express or implied warranty.
12dnl 
13dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19dnl  PERFORMANCE OF THIS SOFTWARE.
20dnl
21dnl Process this file with autoconf to create configure.
22
23AC_PREREQ([2.60])
24AC_INIT([luit], [1.1.1],
25	[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [luit])
26AM_INIT_AUTOMAKE([foreign dist-bzip2])
27AM_MAINTAINER_MODE
28
29# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
30m4_ifndef([XORG_MACROS_VERSION],
31          [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
32XORG_MACROS_VERSION(1.8)
33XORG_DEFAULT_OPTIONS
34
35AC_CONFIG_HEADERS([config.h])
36
37AC_CANONICAL_HOST
38
39
40AC_CHECK_HEADERS([pty.h stropts.h sys/param.h sys/select.h])
41AC_CHECK_FUNCS([select grantpt posix_openpt])
42
43AC_ARG_WITH(localealiasfile,
44        AS_HELP_STRING([--with-localealiasfile=<path>],
45                       [The locale alias file (default: ${datadir}/X11/locale/locale.alias)]),
46        [LOCALEALIASFILE="$withval"],
47        [LOCALEALIASFILE=${datadir}/X11/locale/locale.alias])
48AC_SUBST([LOCALEALIASFILE])
49
50# Checks for pkg-config packages
51PKG_CHECK_MODULES(LUIT, fontenc)
52
53# We don't link against libX11, just use its locale.alias data file
54PKG_CHECK_EXISTS(x11, [],
55	[AC_MSG_WARN([libX11 not found.  luit may not be able to find locale aliases without it.])])
56
57case $host_os in
58    # darwin has poll() but can't be used to poll character devices (atleast through SnowLeopard)
59    darwin*)
60        OS_CFLAGS=
61        ;;
62    linux*)
63        AC_CHECK_HEADERS([poll.h])
64        AC_CHECK_FUNCS([poll])
65        OS_CFLAGS="-D_XOPEN_SOURCE=500"
66        ;;
67    *)
68        AC_CHECK_HEADERS([poll.h])
69        AC_CHECK_FUNCS([poll])
70        OS_CFLAGS=
71        ;;
72esac
73AC_SUBST(OS_CFLAGS)
74
75AC_CHECK_HEADERS([pty.h stropts.h sys/ioctl.h sys/param.h sys/poll.h sys/select.h sys/time.h termios.h]) 
76AC_CHECK_FUNCS([grantpt putenv select strdup])
77
78if test "x$ac_cv_func_grantpt" != "xyes" ; then
79        AC_CHECK_LIB(util, openpty, [cf_have_openpty=yes],[cf_have_openpty=no])
80        if test "$cf_have_openpty" = yes ; then
81                LIBS="-lutil $LIBS"
82                AC_DEFINE(HAVE_OPENPTY, 1, [Have openpty in libutil])
83                AC_CHECK_HEADERS( \
84                        util.h \
85                        libutil.h \
86                        pty.h \
87                )
88        fi
89fi
90
91CF_FUNC_POLL
92CF_SIGWINCH
93
94AC_CONFIG_FILES([Makefile
95                 man/Makefile])
96
97AC_OUTPUT
98