2009-01-13 19:25:35 -07:00
|
|
|
dnl Copyright © 2008 Dan Nicholson
|
|
|
|
dnl
|
|
|
|
dnl Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
dnl documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
dnl the above copyright notice appear in all copies and that both that
|
|
|
|
dnl copyright notice and this permission notice appear in supporting
|
|
|
|
dnl documentation, and that the name of Keith Packard not be used in
|
|
|
|
dnl advertising or publicity pertaining to distribution of the software without
|
|
|
|
dnl specific, written prior permission. Keith Packard makes no
|
|
|
|
dnl representations about the suitability of this software for any purpose. It
|
|
|
|
dnl is provided "as is" without express or implied warranty.
|
|
|
|
dnl
|
|
|
|
dnl DAN NICHOLSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
|
|
dnl INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
|
|
dnl EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
|
|
dnl CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
dnl DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
|
|
dnl TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
dnl PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
dnl
|
|
|
|
dnl Process this file with autoconf to create configure.
|
|
|
|
|
2010-12-02 18:52:34 -07:00
|
|
|
# Initialize Autoconf
|
2012-09-22 06:02:54 -06:00
|
|
|
AC_PREREQ([2.62])
|
2014-08-19 11:11:35 -06:00
|
|
|
AC_INIT([libxkbcommon], [0.4.3],
|
2012-12-10 13:29:26 -07:00
|
|
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon],
|
|
|
|
[libxkbcommon], [http://xkbcommon.org])
|
2010-12-02 18:52:34 -07:00
|
|
|
AC_CONFIG_SRCDIR([Makefile.am])
|
2009-01-20 08:33:14 -07:00
|
|
|
AC_CONFIG_HEADERS([src/config.h])
|
2010-11-11 15:02:11 -07:00
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
2013-08-15 00:45:49 -06:00
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
2009-01-13 19:25:35 -07:00
|
|
|
|
2010-12-02 18:52:34 -07:00
|
|
|
# Initialize Automake
|
2013-11-22 12:02:03 -07:00
|
|
|
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip subdir-objects color-tests parallel-tests check-news])
|
2012-10-10 13:01:15 -06:00
|
|
|
AM_MAINTAINER_MODE([enable])
|
2010-12-02 18:52:34 -07:00
|
|
|
|
2012-04-03 07:29:57 -06:00
|
|
|
# Get _GNU_SOURCE and friends
|
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
|
2010-12-02 18:52:34 -07:00
|
|
|
# Initialize libtool
|
2012-04-10 13:04:05 -06:00
|
|
|
LT_INIT
|
2010-12-02 18:52:34 -07:00
|
|
|
|
2013-02-25 03:27:24 -07:00
|
|
|
# Add xorg-macros stuff
|
2010-12-07 12:32:57 -07:00
|
|
|
m4_ifndef([XORG_MACROS_VERSION],
|
2012-12-10 13:29:26 -07:00
|
|
|
[m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
|
2012-10-25 17:51:56 -06:00
|
|
|
XORG_MACROS_VERSION(1.16)
|
2010-12-07 12:32:57 -07:00
|
|
|
XORG_DEFAULT_OPTIONS
|
2012-09-21 10:57:37 -06:00
|
|
|
XORG_MEMORY_CHECK_FLAGS
|
2012-09-22 06:02:54 -06:00
|
|
|
XORG_ENABLE_DOCS
|
|
|
|
XORG_WITH_DOXYGEN
|
2010-12-07 12:32:57 -07:00
|
|
|
|
2013-10-13 13:19:38 -06:00
|
|
|
# Needed in older Automakes for subdir-objects
|
|
|
|
AM_PROG_CC_C_O
|
|
|
|
|
2012-05-18 17:35:15 -06:00
|
|
|
# Check for compiler features
|
|
|
|
AC_C_INLINE
|
|
|
|
|
2010-12-07 12:32:57 -07:00
|
|
|
# Check for programs
|
2012-09-22 06:02:54 -06:00
|
|
|
AC_PROG_MKDIR_P
|
2012-10-26 06:23:07 -06:00
|
|
|
PKG_PROG_PKG_CONFIG
|
Replace flex scanner with a hand-written one
The scanner is very similar in structure to the one in xkbcomp/rules.c.
It avoids copying and has nicer error reporting.
It uses gperf to generate a hashtable for the keywords, which gives a
nice speed boost (compared to the naive strcasecmp method at least). But
since there's hardly a reason to regenerate it every time and require
people to install gperf, the output (keywords.c) is added here as well.
Here are some stats from test/rulescomp:
Before:
compiled 1000 keymaps in 4.052939625s
==22063== total heap usage: 101,101 allocs, 101,101 frees, 11,840,834 bytes allocated
After:
compiled 1000 keymaps in 3.519665434s
==26505== total heap usage: 99,945 allocs, 99,945 frees, 7,033,608 bytes allocated
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-08-12 02:40:02 -06:00
|
|
|
|
2013-09-28 16:41:52 -06:00
|
|
|
# Note: we use some yacc extensions, which work with either GNU bison
|
|
|
|
# (preferred) or byacc. Other yacc's may or may not work.
|
2010-12-07 08:59:13 -07:00
|
|
|
AC_PROG_YACC
|
2014-02-10 11:50:58 -07:00
|
|
|
AC_PATH_PROG([YACC_INST], [$YACC])
|
|
|
|
AS_IF([test ! -f "src/xkbcomp/parser.c" -a "x$YACC_INST" = x], [
|
2014-02-03 17:48:41 -07:00
|
|
|
AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
|
|
|
|
])
|
2009-01-13 19:25:35 -07:00
|
|
|
|
2010-12-07 16:17:29 -07:00
|
|
|
# Checks for library functions.
|
2012-03-27 07:06:56 -06:00
|
|
|
AC_CHECK_FUNCS([strcasecmp strncasecmp])
|
2014-02-03 17:48:41 -07:00
|
|
|
AS_IF([test "x$ac_cv_func_strcasecmp" = xno -o \
|
|
|
|
"x$ac_cv_func_strncasecmp" = xno], [
|
2012-03-27 07:06:56 -06:00
|
|
|
AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
|
2014-02-03 17:48:41 -07:00
|
|
|
])
|
2010-12-07 16:17:29 -07:00
|
|
|
|
2013-03-14 06:33:40 -06:00
|
|
|
AC_CHECK_FUNCS([eaccess euidaccess mmap])
|
2012-05-15 06:23:41 -06:00
|
|
|
|
2014-02-03 17:53:05 -07:00
|
|
|
AC_CHECK_FUNCS([secure_getenv __secure_getenv])
|
|
|
|
AS_IF([test "x$ac_cv_func_secure_getenv" = xno -a \
|
|
|
|
"x$ac_cv_func___secure_getenv" = xno], [
|
|
|
|
AC_MSG_WARN([C library does not support secure_getenv, using getenv instead])
|
|
|
|
])
|
|
|
|
|
2014-02-08 03:29:51 -07:00
|
|
|
AX_GCC_BUILTIN(__builtin_expect)
|
|
|
|
|
2013-03-02 10:01:18 -07:00
|
|
|
# Some tests use Linux-specific headers
|
|
|
|
AC_CHECK_HEADER([linux/input.h])
|
|
|
|
AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes])
|
|
|
|
|
2012-10-26 06:43:15 -06:00
|
|
|
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden])
|
2014-02-07 15:08:06 -07:00
|
|
|
XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wextra -Wno-unused-parameter -Wno-missing-field-initializers])
|
2011-01-29 12:06:39 -07:00
|
|
|
|
2014-01-13 09:19:36 -07:00
|
|
|
XORG_CHECK_LINKER_FLAGS([-Wl,--no-undefined], [have_no_undefined=yes])
|
|
|
|
AM_CONDITIONAL([HAVE_NO_UNDEFINED], [test "x$have_no_undefined" = xyes])
|
|
|
|
|
2010-12-07 16:17:29 -07:00
|
|
|
# Define a configuration option for the XKB config root
|
2010-12-11 16:56:21 -07:00
|
|
|
xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
|
2014-02-03 17:48:41 -07:00
|
|
|
AS_IF([test "x$xkb_base" = x], [
|
|
|
|
xkb_base="$datadir/X11/xkb"
|
|
|
|
])
|
2009-03-27 07:55:32 -06:00
|
|
|
AC_ARG_WITH([xkb_config_root],
|
2012-05-07 10:30:47 -06:00
|
|
|
[AS_HELP_STRING([--with-xkb-config-root=<path>],
|
|
|
|
[Set default XKB config root (default: xkeyboard-config install path)])],
|
2009-03-27 07:55:32 -06:00
|
|
|
[XKBCONFIGROOT="$withval"],
|
2010-12-11 16:56:21 -07:00
|
|
|
[XKBCONFIGROOT="$xkb_base"])
|
2009-03-27 07:55:32 -06:00
|
|
|
AC_SUBST([XKBCONFIGROOT])
|
|
|
|
|
2012-08-02 18:51:10 -06:00
|
|
|
AC_ARG_WITH([default_rules],
|
|
|
|
[AS_HELP_STRING([--with-default-rules=<path>],
|
|
|
|
[Default XKB ruleset (default: evdev)])],
|
|
|
|
[DEFAULT_XKB_RULES="$withval"],
|
|
|
|
[DEFAULT_XKB_RULES="evdev"])
|
|
|
|
AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
|
|
|
|
[Default XKB ruleset])
|
|
|
|
|
|
|
|
AC_ARG_WITH([default_model],
|
|
|
|
[AS_HELP_STRING([--with-default-model=<path>],
|
|
|
|
[Default XKB model (default: pc105)])],
|
|
|
|
[DEFAULT_XKB_MODEL="$withval"],
|
|
|
|
[DEFAULT_XKB_MODEL="pc105"])
|
|
|
|
AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
|
|
|
|
[Default XKB model])
|
|
|
|
|
|
|
|
AC_ARG_WITH([default_layout],
|
|
|
|
[AS_HELP_STRING([--with-default-layout=<path>],
|
|
|
|
[Default XKB layout (default: us)])],
|
|
|
|
[DEFAULT_XKB_LAYOUT="$withval"],
|
|
|
|
[DEFAULT_XKB_LAYOUT="us"])
|
|
|
|
AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
|
|
|
|
[Default XKB layout])
|
2012-05-08 02:46:58 -06:00
|
|
|
|
2013-02-28 11:48:40 -07:00
|
|
|
AC_ARG_WITH([default_variant],
|
|
|
|
[AS_HELP_STRING([--with-default-variant=<path>],
|
|
|
|
[Default XKB variant (default: (none))])],
|
|
|
|
[DEFAULT_XKB_VARIANT="$withval"],
|
2014-09-01 14:09:29 -06:00
|
|
|
[DEFAULT_XKB_VARIANT=])
|
2014-02-03 17:48:41 -07:00
|
|
|
AS_IF([test "x$DEFAULT_XKB_VARIANT" != x], [
|
2013-02-28 11:48:40 -07:00
|
|
|
AC_DEFINE_UNQUOTED([DEFAULT_XKB_VARIANT], ["$DEFAULT_XKB_VARIANT"],
|
|
|
|
[Default XKB variant])
|
2014-02-03 17:48:41 -07:00
|
|
|
])
|
2013-02-28 11:48:40 -07:00
|
|
|
|
|
|
|
AC_ARG_WITH([default_options],
|
|
|
|
[AS_HELP_STRING([--with-default-options=<path>],
|
|
|
|
[Default XKB options (default: (none))])],
|
|
|
|
[DEFAULT_XKB_OPTIONS="$withval"],
|
|
|
|
[DEFAULT_XKB_OPTIONS=])
|
2014-02-03 17:48:41 -07:00
|
|
|
AS_IF([test "x$DEFAULT_XKB_OPTIONS" != x], [
|
2013-02-28 11:48:40 -07:00
|
|
|
AC_DEFINE_UNQUOTED([DEFAULT_XKB_OPTIONS], ["$DEFAULT_XKB_OPTIONS"],
|
|
|
|
[Default XKB options])
|
2014-02-03 17:48:41 -07:00
|
|
|
])
|
2013-02-28 11:48:40 -07:00
|
|
|
|
2013-07-20 14:21:44 -06:00
|
|
|
AC_ARG_ENABLE([x11],
|
|
|
|
[AS_HELP_STRING([--disable-x11],
|
|
|
|
[Disable support for creating keymaps with the X11 protocol (default: enabled)])],
|
2014-03-31 09:01:35 -06:00
|
|
|
[], [enable_x11=yes])
|
2014-02-03 17:48:41 -07:00
|
|
|
AS_IF([test "x$enable_x11" = xyes], [
|
2013-07-20 14:21:44 -06:00
|
|
|
PKG_CHECK_MODULES([XCB_XKB], [xcb xcb-xkb >= 1.10], [],
|
|
|
|
[AC_MSG_ERROR([xkbcommon-x11 requires xcb-xkb >= 1.10 which was not found. \
|
|
|
|
You can disable X11 support with --disable-x11.])])
|
2014-03-31 09:01:35 -06:00
|
|
|
], [enable_x11=no])
|
2014-02-03 17:48:41 -07:00
|
|
|
AM_CONDITIONAL([ENABLE_X11], [test "x$enable_x11" = xyes])
|
2013-07-20 14:21:44 -06:00
|
|
|
|
2012-05-08 02:46:58 -06:00
|
|
|
AC_CONFIG_FILES([
|
|
|
|
Makefile
|
2012-05-15 06:23:42 -06:00
|
|
|
xkbcommon-uninstalled.pc
|
2012-09-22 06:02:54 -06:00
|
|
|
xkbcommon.pc
|
2013-07-20 14:21:44 -06:00
|
|
|
xkbcommon-x11.pc
|
|
|
|
xkbcommon-x11-uninstalled.pc
|
2012-09-22 06:02:54 -06:00
|
|
|
doc/Doxyfile
|
|
|
|
])
|
2010-11-11 15:05:33 -07:00
|
|
|
AC_OUTPUT
|
2014-02-02 02:13:28 -07:00
|
|
|
|
|
|
|
AC_MSG_RESULT([
|
|
|
|
$PACKAGE_NAME $VERSION
|
|
|
|
|
|
|
|
libxkbcommon: yes
|
|
|
|
libxkbcommon-x11: ${enable_x11}
|
|
|
|
documentation: ${build_docs}
|
|
|
|
|
|
|
|
default XKB rules: ${DEFAULT_XKB_RULES}
|
|
|
|
default XKB model: ${DEFAULT_XKB_MODEL}
|
|
|
|
default XKB layout: ${DEFAULT_XKB_LAYOUT}
|
|
|
|
default XKB variant: ${DEFAULT_XKB_VARIANT}
|
|
|
|
default XKB options: ${DEFAULT_XKB_OPTIONS}
|
|
|
|
|
|
|
|
prefix: ${prefix}
|
|
|
|
includedir: ${includedir}
|
|
|
|
lib dir: ${libdir}
|
|
|
|
XKB config root: ${XKBCONFIGROOT}
|
|
|
|
])
|