• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl  Copyright © 2008 Dan Nicholson
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 Keith Packard not be used in
8dnl  advertising or publicity pertaining to distribution of the software without
9dnl  specific, written prior permission.  Keith Packard 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  DAN NICHOLSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15dnl  EVENT SHALL KEITH PACKARD 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
23# Initialize Autoconf
24AC_PREREQ([2.62])
25AC_INIT([libxkbcommon], [0.5.0],
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon],
27        [libxkbcommon], [http://xkbcommon.org])
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_HEADERS([src/config.h])
30AC_CONFIG_MACRO_DIR([m4])
31AC_CONFIG_AUX_DIR([build-aux])
32
33# Initialize Automake
34AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip subdir-objects color-tests parallel-tests check-news])
35AM_MAINTAINER_MODE([enable])
36
37# Get _GNU_SOURCE and friends
38AC_USE_SYSTEM_EXTENSIONS
39
40# Initialize libtool
41LT_INIT
42
43# Add xorg-macros stuff
44m4_ifndef([XORG_MACROS_VERSION],
45          [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
46XORG_MACROS_VERSION(1.16)
47XORG_DEFAULT_OPTIONS
48XORG_MEMORY_CHECK_FLAGS
49XORG_ENABLE_DOCS
50XORG_WITH_DOXYGEN
51
52# Needed in older Automakes for subdir-objects
53AM_PROG_CC_C_O
54
55# Check for compiler features
56AC_C_INLINE
57
58# Check for programs
59AC_PROG_MKDIR_P
60PKG_PROG_PKG_CONFIG
61
62# Note: we use some yacc extensions, which work with either GNU bison
63# (preferred) or byacc. Other yacc's may or may not work.
64AC_PROG_YACC
65AC_PATH_PROG([YACC_INST], [$YACC])
66AS_IF([test ! -f "src/xkbcomp/parser.c" -a "x$YACC_INST" = x], [
67    AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
68])
69
70# Checks for library functions.
71AC_CHECK_FUNCS([strcasecmp strncasecmp])
72AS_IF([test "x$ac_cv_func_strcasecmp" = xno -o \
73            "x$ac_cv_func_strncasecmp" = xno], [
74    AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
75])
76
77AC_CHECK_FUNCS([eaccess euidaccess mmap])
78
79AC_CHECK_FUNCS([secure_getenv __secure_getenv])
80AS_IF([test "x$ac_cv_func_secure_getenv" = xno -a \
81            "x$ac_cv_func___secure_getenv" = xno], [
82    AC_MSG_WARN([C library does not support secure_getenv, using getenv instead])
83])
84
85AX_GCC_BUILTIN(__builtin_expect)
86
87# Some tests use Linux-specific headers
88AC_CHECK_HEADER([linux/input.h])
89AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes])
90
91XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden])
92XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wextra -Wno-unused-parameter -Wno-missing-field-initializers])
93XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdocumentation])
94
95# OpenBSD does not have DT_NEEDED entries for libc by design
96# so when these flags are passed to ld via libtool the checks will fail
97case "$host_os" in
98openbsd*)
99    ;;
100*)
101    XORG_CHECK_LINKER_FLAGS([-Wl,--no-undefined], [have_no_undefined=yes]) ;;
102esac
103
104AM_CONDITIONAL([HAVE_NO_UNDEFINED], [test "x$have_no_undefined" = xyes])
105
106AC_CHECK_LIB(rt, clock_gettime,
107    [AC_SUBST(RT_LIBS, "-lrt")],
108    [AC_SUBST(RT_LIBS, "")],
109    [-lrt])
110
111# Define a configuration option for the XKB config root
112xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
113AS_IF([test "x$xkb_base" = x], [
114    xkb_base="$datadir/X11/xkb"
115])
116AC_ARG_WITH([xkb_config_root],
117    [AS_HELP_STRING([--with-xkb-config-root=<path>],
118        [Set default XKB config root (default: xkeyboard-config install path)])],
119    [XKBCONFIGROOT="$withval"],
120    [XKBCONFIGROOT="$xkb_base"])
121AC_SUBST([XKBCONFIGROOT])
122
123# Define a configuration option for the X locale directory for compose
124AC_ARG_WITH([x_locale_root],
125    [AS_HELP_STRING([--with-x-locale-root=<path>],
126        [Set X locale root (default: $datadir/X11/locale)])],
127    [XLOCALEDIR="$withval"],
128    [XLOCALEDIR="$datadir/X11/locale"])
129AC_SUBST([XLOCALEDIR])
130
131AC_ARG_WITH([default_rules],
132    [AS_HELP_STRING([--with-default-rules=<path>],
133        [Default XKB ruleset (default: evdev)])],
134    [DEFAULT_XKB_RULES="$withval"],
135    [DEFAULT_XKB_RULES="evdev"])
136AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
137                   [Default XKB ruleset])
138
139AC_ARG_WITH([default_model],
140    [AS_HELP_STRING([--with-default-model=<path>],
141        [Default XKB model (default: pc105)])],
142    [DEFAULT_XKB_MODEL="$withval"],
143    [DEFAULT_XKB_MODEL="pc105"])
144AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
145                   [Default XKB model])
146
147AC_ARG_WITH([default_layout],
148    [AS_HELP_STRING([--with-default-layout=<path>],
149        [Default XKB layout (default: us)])],
150    [DEFAULT_XKB_LAYOUT="$withval"],
151    [DEFAULT_XKB_LAYOUT="us"])
152AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
153                   [Default XKB layout])
154
155AC_ARG_WITH([default_variant],
156    [AS_HELP_STRING([--with-default-variant=<path>],
157        [Default XKB variant (default: (none))])],
158    [DEFAULT_XKB_VARIANT="$withval"],
159    [DEFAULT_XKB_VARIANT=])
160AS_IF([test "x$DEFAULT_XKB_VARIANT" != x], [
161    AC_DEFINE_UNQUOTED([DEFAULT_XKB_VARIANT], ["$DEFAULT_XKB_VARIANT"],
162                       [Default XKB variant])
163])
164
165AC_ARG_WITH([default_options],
166    [AS_HELP_STRING([--with-default-options=<path>],
167        [Default XKB options (default: (none))])],
168    [DEFAULT_XKB_OPTIONS="$withval"],
169    [DEFAULT_XKB_OPTIONS=])
170AS_IF([test "x$DEFAULT_XKB_OPTIONS" != x], [
171    AC_DEFINE_UNQUOTED([DEFAULT_XKB_OPTIONS], ["$DEFAULT_XKB_OPTIONS"],
172                       [Default XKB options])
173])
174
175AC_ARG_ENABLE([x11],
176    [AS_HELP_STRING([--disable-x11],
177        [Disable support for creating keymaps with the X11 protocol (default: enabled)])],
178    [], [enable_x11=yes])
179AS_IF([test "x$enable_x11" = xyes], [
180    PKG_CHECK_MODULES([XCB_XKB], [xcb xcb-xkb >= 1.10], [],
181        [AC_MSG_ERROR([xkbcommon-x11 requires xcb-xkb >= 1.10 which was not found. \
182You can disable X11 support with --disable-x11.])])
183], [enable_x11=no])
184AM_CONDITIONAL([ENABLE_X11], [test "x$enable_x11" = xyes])
185
186AC_CONFIG_FILES([
187    Makefile
188    xkbcommon-uninstalled.pc
189    xkbcommon.pc
190    xkbcommon-x11.pc
191    xkbcommon-x11-uninstalled.pc
192    doc/Doxyfile
193])
194AC_OUTPUT
195
196AC_MSG_RESULT([
197        $PACKAGE_NAME $VERSION
198
199        libxkbcommon:            yes
200        libxkbcommon-x11:        ${enable_x11}
201        documentation:           ${build_docs}
202
203        default XKB rules:       ${DEFAULT_XKB_RULES}
204        default XKB model:       ${DEFAULT_XKB_MODEL}
205        default XKB layout:      ${DEFAULT_XKB_LAYOUT}
206        default XKB variant:     ${DEFAULT_XKB_VARIANT}
207        default XKB options:     ${DEFAULT_XKB_OPTIONS}
208
209        prefix:                  ${prefix}
210        includedir:              ${includedir}
211        lib dir:                 ${libdir}
212        XKB config root:         ${XKBCONFIGROOT}
213        X11 locale root:         ${XLOCALEDIR}
214])
215