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.8.4],
26 [https://github.com/xkbcommon/libxkbcommon/issues],
27 [libxkbcommon], [https://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 AC_PATH_PROG([YACC_INST], [$YACC])
66 AS_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])
70 # Checks for library functions.
71 AC_CHECK_FUNCS([eaccess euidaccess mmap mkostemp posix_fallocate])
73 AC_CHECK_FUNCS([secure_getenv __secure_getenv])
74 AS_IF([test "x$ac_cv_func_secure_getenv" = xno -a \
75 "x$ac_cv_func___secure_getenv" = xno], [
76 AC_MSG_WARN([C library does not support secure_getenv, using getenv instead])
79 AX_GCC_BUILTIN(__builtin_expect)
81 # Some tests use Linux-specific headers
82 AC_CHECK_HEADER([linux/input.h])
83 AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes])
85 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden -fno-strict-aliasing -fsanitize-undefined-trap-on-error])
86 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wextra -Wno-unused-parameter -Wno-missing-field-initializers])
87 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdocumentation -Wno-documentation-deprecated-sync])
89 # OpenBSD does not have DT_NEEDED entries for libc by design
90 # so when these flags are passed to ld via libtool the checks will fail
95 XORG_CHECK_LINKER_FLAGS([-Wl,--no-undefined], [have_no_undefined=yes]) ;;
97 AM_CONDITIONAL([HAVE_NO_UNDEFINED], [test "x$have_no_undefined" = xyes])
99 XORG_CHECK_LINKER_FLAGS([-Wl,--version-script="$srcdir/xkbcommon.map"], [have_version_script=yes])
100 AM_CONDITIONAL([HAVE_VERSION_SCRIPT], [test "x$have_version_script" = xyes])
102 # Define a configuration option for the XKB config root
103 xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
104 AS_IF([test "x$xkb_base" = x], [
105 xkb_base="$datadir/X11/xkb"
107 AC_ARG_WITH([xkb_config_root],
108 [AS_HELP_STRING([--with-xkb-config-root=<path>],
109 [Set default XKB config root (default: xkeyboard-config install path)])],
110 [XKBCONFIGROOT="$withval"],
111 [XKBCONFIGROOT="$xkb_base"])
112 AC_SUBST([XKBCONFIGROOT])
114 # Define a configuration option for the X locale directory for compose
115 AC_ARG_WITH([x_locale_root],
116 [AS_HELP_STRING([--with-x-locale-root=<path>],
117 [Set X locale root (default: $datadir/X11/locale)])],
118 [XLOCALEDIR="$withval"],
119 [XLOCALEDIR="$datadir/X11/locale"])
120 AC_SUBST([XLOCALEDIR])
122 AC_ARG_WITH([default_rules],
123 [AS_HELP_STRING([--with-default-rules=<path>],
124 [Default XKB ruleset (default: evdev)])],
125 [DEFAULT_XKB_RULES="$withval"],
126 [DEFAULT_XKB_RULES="evdev"])
127 AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
128 [Default XKB ruleset])
130 AC_ARG_WITH([default_model],
131 [AS_HELP_STRING([--with-default-model=<path>],
132 [Default XKB model (default: pc105)])],
133 [DEFAULT_XKB_MODEL="$withval"],
134 [DEFAULT_XKB_MODEL="pc105"])
135 AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
138 AC_ARG_WITH([default_layout],
139 [AS_HELP_STRING([--with-default-layout=<path>],
140 [Default XKB layout (default: us)])],
141 [DEFAULT_XKB_LAYOUT="$withval"],
142 [DEFAULT_XKB_LAYOUT="us"])
143 AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
144 [Default XKB layout])
146 AC_ARG_WITH([default_variant],
147 [AS_HELP_STRING([--with-default-variant=<path>],
148 [Default XKB variant (default: (none))])],
149 [DEFAULT_XKB_VARIANT="$withval"],
150 [DEFAULT_XKB_VARIANT=])
151 AS_IF([test "x$DEFAULT_XKB_VARIANT" != x], [
152 AC_DEFINE_UNQUOTED([DEFAULT_XKB_VARIANT], ["$DEFAULT_XKB_VARIANT"],
153 [Default XKB variant])
156 AC_ARG_WITH([default_options],
157 [AS_HELP_STRING([--with-default-options=<path>],
158 [Default XKB options (default: (none))])],
159 [DEFAULT_XKB_OPTIONS="$withval"],
160 [DEFAULT_XKB_OPTIONS=])
161 AS_IF([test "x$DEFAULT_XKB_OPTIONS" != x], [
162 AC_DEFINE_UNQUOTED([DEFAULT_XKB_OPTIONS], ["$DEFAULT_XKB_OPTIONS"],
163 [Default XKB options])
167 [AS_HELP_STRING([--disable-x11],
168 [Disable support for creating keymaps with the X11 protocol (default: enabled)])],
169 [], [enable_x11=yes])
170 AS_IF([test "x$enable_x11" = xyes], [
171 PKG_CHECK_MODULES([XCB_XKB], [xcb xcb-xkb >= 1.10], [],
172 [AC_MSG_ERROR([xkbcommon-x11 requires xcb-xkb >= 1.10 which was not found. \
173 You can disable X11 support with --disable-x11.])])
175 AM_CONDITIONAL([ENABLE_X11], [test "x$enable_x11" = xyes])
177 WAYLAND_PKGS="wayland-client >= 1.2.0 wayland-protocols >= 1.12 wayland-scanner"
178 AC_ARG_ENABLE([wayland],
179 [AS_HELP_STRING([--disable-wayland],
180 [Disable support for Wayland utility programs (default: auto)])],
181 [], [enable_wayland=auto])
182 AS_IF([test "x$enable_wayland" = xauto], [
183 PKG_CHECK_EXISTS($WAYLAND_PKGS, [enable_wayland=yes], [enable_wayland=no])],
185 AS_IF([test "x$enable_wayland" = xyes], [
186 PKG_CHECK_MODULES([WAYLAND], $WAYLAND_PKGS, [],
187 [AC_MSG_ERROR([Wayland utilities require libwayland-client >= 1.2 which was not found. \
188 You can disable Wayland support with --disable-wayland.])])
189 AC_PATH_PROG([wayland_scanner], [wayland-scanner])
190 wayland_scanner=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
191 ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
192 AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
193 ], [enable_wayland=no])
194 AM_CONDITIONAL([ENABLE_WAYLAND], [test "x$enable_wayland" = xyes])
205 $PACKAGE_NAME $VERSION
208 libxkbcommon-x11: ${enable_x11}
209 Wayland utilities: ${enable_wayland}
210 documentation: ${build_docs}
212 default XKB rules: ${DEFAULT_XKB_RULES}
213 default XKB model: ${DEFAULT_XKB_MODEL}
214 default XKB layout: ${DEFAULT_XKB_LAYOUT}
215 default XKB variant: ${DEFAULT_XKB_VARIANT}
216 default XKB options: ${DEFAULT_XKB_OPTIONS}
219 includedir: ${includedir}
221 datarootdir: ${datarootdir}
222 XKB config root: ${XKBCONFIGROOT}
223 X11 locale root: ${XLOCALEDIR}