build: Require xorg macros 1.16
[platform/upstream/libxkbcommon.git] / configure.ac
1 dnl  Copyright © 2008 Dan Nicholson
2 dnl
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.
12 dnl
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.
20 dnl
21 dnl Process this file with autoconf to create configure.
22
23 # Initialize Autoconf
24 AC_PREREQ([2.62])
25 AC_INIT([libxkbcommon], [0.2.0],
26     [https://bugs.freedesktop.org/enter_bug.cgi?product=libxkbcommon])
27 AC_CONFIG_SRCDIR([Makefile.am])
28 AC_CONFIG_HEADERS([src/config.h])
29 AC_CONFIG_MACRO_DIR([m4])
30
31 # Initialize Automake
32 AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects color-tests parallel-tests])
33 AM_MAINTAINER_MODE([enable])
34
35 # Get _GNU_SOURCE and friends
36 AC_USE_SYSTEM_EXTENSIONS
37
38 # Initialize libtool
39 LT_INIT
40
41 # Require xorg-macros minimum of 1.8 for AM_SILENT_RULES
42 m4_ifndef([XORG_MACROS_VERSION],
43           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
44 XORG_MACROS_VERSION(1.16)
45 XORG_DEFAULT_OPTIONS
46 XORG_MEMORY_CHECK_FLAGS
47 XORG_ENABLE_DOCS
48 XORG_WITH_DOXYGEN
49
50 # Check for compiler features
51 AC_C_INLINE
52 AC_C_TYPEOF
53
54 # Check for programs
55 AC_PROG_MKDIR_P
56 PKG_PROG_PKG_CONFIG
57 AC_PROG_LEX
58 AC_PROG_YACC
59 AC_PATH_PROG([YACC_INST], $YACC)
60 if test ! -f "src/xkbcomp/parser.c"; then
61    if test -z "$YACC_INST"; then
62       AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
63    fi
64 fi
65
66 # Checks for library functions.
67 AC_CHECK_FUNCS([strcasecmp strncasecmp])
68 if test "x$ac_cv_func_strcasecmp" = xno || \
69    test "x$ac_cv_func_strncasecmp" = xno; then
70     AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
71 fi
72
73 AC_CHECK_FUNCS([eaccess euidaccess])
74
75 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden])
76
77 # Define a configuration option for the XKB config root
78 xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
79 if test "x$xkb_base" = x; then
80     xkb_base=$datadir/X11/xkb
81 fi
82 AC_ARG_WITH([xkb_config_root],
83     [AS_HELP_STRING([--with-xkb-config-root=<path>],
84         [Set default XKB config root (default: xkeyboard-config install path)])],
85     [XKBCONFIGROOT="$withval"],
86     [XKBCONFIGROOT="$xkb_base"])
87 AC_SUBST([XKBCONFIGROOT])
88
89 AC_ARG_WITH([default_rules],
90     [AS_HELP_STRING([--with-default-rules=<path>],
91         [Default XKB ruleset (default: evdev)])],
92     [DEFAULT_XKB_RULES="$withval"],
93     [DEFAULT_XKB_RULES="evdev"])
94 AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
95                    [Default XKB ruleset])
96
97 AC_ARG_WITH([default_model],
98     [AS_HELP_STRING([--with-default-model=<path>],
99         [Default XKB model (default: pc105)])],
100     [DEFAULT_XKB_MODEL="$withval"],
101     [DEFAULT_XKB_MODEL="pc105"])
102 AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
103                    [Default XKB model])
104
105 AC_ARG_WITH([default_layout],
106     [AS_HELP_STRING([--with-default-layout=<path>],
107         [Default XKB layout (default: us)])],
108     [DEFAULT_XKB_LAYOUT="$withval"],
109     [DEFAULT_XKB_LAYOUT="us"])
110 AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
111                    [Default XKB layout])
112
113 AC_CONFIG_FILES([
114     Makefile
115     xkbcommon-uninstalled.pc
116     xkbcommon.pc
117     doc/Doxyfile
118 ])
119 AC_OUTPUT