1 dnl Copyright © 2008 Dan Nicholson
3 dnl Permission to use, copy, modify, distribute, and sell this software and its
4 dnl documentation for any purpose is hereby granted without fee, provided that
5 dnl the above copyright notice appear in all copies and that both that
6 dnl copyright notice and this permission notice appear in supporting
7 dnl documentation, and that the name of Keith Packard not be used in
8 dnl advertising or publicity pertaining to distribution of the software without
9 dnl specific, written prior permission. Keith Packard makes no
10 dnl representations about the suitability of this software for any purpose. It
11 dnl is provided "as is" without express or implied warranty.
13 dnl DAN NICHOLSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
14 dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
15 dnl EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
16 dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
17 dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 dnl PERFORMANCE OF THIS SOFTWARE.
21 dnl Process this file with autoconf to create configure.
25 AC_INIT([libxkbcommon], [0.4.0],
26 [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon],
27 [libxkbcommon], [http://xkbcommon.org])
28 AC_CONFIG_SRCDIR([Makefile.am])
29 AC_CONFIG_HEADERS([src/config.h])
30 AC_CONFIG_MACRO_DIR([m4])
31 AC_CONFIG_AUX_DIR([build-aux])
34 AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip subdir-objects color-tests parallel-tests check-news])
35 AM_MAINTAINER_MODE([enable])
37 # Get _GNU_SOURCE and friends
38 AC_USE_SYSTEM_EXTENSIONS
43 # Add xorg-macros stuff
44 m4_ifndef([XORG_MACROS_VERSION],
45 [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
46 XORG_MACROS_VERSION(1.16)
48 XORG_MEMORY_CHECK_FLAGS
52 # Needed in older Automakes for subdir-objects
55 # Check for compiler features
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.
65 AS_IF([test ! -f "src/xkbcomp/parser.c" -a "x$ac_cv_prog_YACC" = x], [
66 AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
69 # Checks for library functions.
70 AC_CHECK_FUNCS([strcasecmp strncasecmp])
71 AS_IF([test "x$ac_cv_func_strcasecmp" = xno -o \
72 "x$ac_cv_func_strncasecmp" = xno], [
73 AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
76 AC_CHECK_FUNCS([eaccess euidaccess mmap])
78 AC_CHECK_FUNCS([secure_getenv __secure_getenv])
79 AS_IF([test "x$ac_cv_func_secure_getenv" = xno -a \
80 "x$ac_cv_func___secure_getenv" = xno], [
81 AC_MSG_WARN([C library does not support secure_getenv, using getenv instead])
84 # Some tests use Linux-specific headers
85 AC_CHECK_HEADER([linux/input.h])
86 AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes])
88 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden])
90 XORG_CHECK_LINKER_FLAGS([-Wl,--no-undefined], [have_no_undefined=yes])
91 AM_CONDITIONAL([HAVE_NO_UNDEFINED], [test "x$have_no_undefined" = xyes])
93 # Define a configuration option for the XKB config root
94 xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
95 AS_IF([test "x$xkb_base" = x], [
96 xkb_base="$datadir/X11/xkb"
98 AC_ARG_WITH([xkb_config_root],
99 [AS_HELP_STRING([--with-xkb-config-root=<path>],
100 [Set default XKB config root (default: xkeyboard-config install path)])],
101 [XKBCONFIGROOT="$withval"],
102 [XKBCONFIGROOT="$xkb_base"])
103 AC_SUBST([XKBCONFIGROOT])
105 AC_ARG_WITH([default_rules],
106 [AS_HELP_STRING([--with-default-rules=<path>],
107 [Default XKB ruleset (default: evdev)])],
108 [DEFAULT_XKB_RULES="$withval"],
109 [DEFAULT_XKB_RULES="evdev"])
110 AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
111 [Default XKB ruleset])
113 AC_ARG_WITH([default_model],
114 [AS_HELP_STRING([--with-default-model=<path>],
115 [Default XKB model (default: pc105)])],
116 [DEFAULT_XKB_MODEL="$withval"],
117 [DEFAULT_XKB_MODEL="pc105"])
118 AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
121 AC_ARG_WITH([default_layout],
122 [AS_HELP_STRING([--with-default-layout=<path>],
123 [Default XKB layout (default: us)])],
124 [DEFAULT_XKB_LAYOUT="$withval"],
125 [DEFAULT_XKB_LAYOUT="us"])
126 AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
127 [Default XKB layout])
129 AC_ARG_WITH([default_variant],
130 [AS_HELP_STRING([--with-default-variant=<path>],
131 [Default XKB variant (default: (none))])],
132 [DEFAULT_XKB_VARIANT="$withval"],
133 [DEFAULT_XKB_VARAINT=])
134 AS_IF([test "x$DEFAULT_XKB_VARIANT" != x], [
135 AC_DEFINE_UNQUOTED([DEFAULT_XKB_VARIANT], ["$DEFAULT_XKB_VARIANT"],
136 [Default XKB variant])
139 AC_ARG_WITH([default_options],
140 [AS_HELP_STRING([--with-default-options=<path>],
141 [Default XKB options (default: (none))])],
142 [DEFAULT_XKB_OPTIONS="$withval"],
143 [DEFAULT_XKB_OPTIONS=])
144 AS_IF([test "x$DEFAULT_XKB_OPTIONS" != x], [
145 AC_DEFINE_UNQUOTED([DEFAULT_XKB_OPTIONS], ["$DEFAULT_XKB_OPTIONS"],
146 [Default XKB options])
150 [AS_HELP_STRING([--disable-x11],
151 [Disable support for creating keymaps with the X11 protocol (default: enabled)])],
152 [], [enable_x11=yes])
153 AS_IF([test "x$enable_x11" = xyes], [
154 PKG_CHECK_MODULES([XCB_XKB], [xcb xcb-xkb >= 1.10], [],
155 [AC_MSG_ERROR([xkbcommon-x11 requires xcb-xkb >= 1.10 which was not found. \
156 You can disable X11 support with --disable-x11.])])
158 AM_CONDITIONAL([ENABLE_X11], [test "x$enable_x11" = xyes])
162 xkbcommon-uninstalled.pc
165 xkbcommon-x11-uninstalled.pc
171 $PACKAGE_NAME $VERSION
174 libxkbcommon-x11: ${enable_x11}
175 documentation: ${build_docs}
177 default XKB rules: ${DEFAULT_XKB_RULES}
178 default XKB model: ${DEFAULT_XKB_MODEL}
179 default XKB layout: ${DEFAULT_XKB_LAYOUT}
180 default XKB variant: ${DEFAULT_XKB_VARIANT}
181 default XKB options: ${DEFAULT_XKB_OPTIONS}
184 includedir: ${includedir}
186 XKB config root: ${XKBCONFIGROOT}