Don't try to build linux-specific tests on non-linux
[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         [libxkbcommon], [http://xkbcommon.org])
28 AC_CONFIG_SRCDIR([Makefile.am])
29 AC_CONFIG_HEADERS([src/config.h])
30 AC_CONFIG_MACRO_DIR([m4])
31
32 # Initialize Automake
33 AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip subdir-objects color-tests parallel-tests])
34 AM_MAINTAINER_MODE([enable])
35
36 # Get _GNU_SOURCE and friends
37 AC_USE_SYSTEM_EXTENSIONS
38
39 # Initialize libtool
40 LT_INIT
41
42 # Add xorg-macros stuff
43 m4_ifndef([XORG_MACROS_VERSION],
44           [m4_fatal([must install xorg-macros 1.16 or later before running autoconf/autogen])])
45 XORG_MACROS_VERSION(1.16)
46 XORG_DEFAULT_OPTIONS
47 XORG_MEMORY_CHECK_FLAGS
48 XORG_ENABLE_DOCS
49 XORG_WITH_DOXYGEN
50
51 # Check for compiler features
52 AC_C_INLINE
53 AC_C_TYPEOF
54
55 # Check for programs
56 AC_PROG_MKDIR_P
57 PKG_PROG_PKG_CONFIG
58 AC_PROG_LEX
59 AC_PROG_YACC
60 AC_PATH_PROG([YACC_INST], $YACC)
61 if test ! -f "src/xkbcomp/parser.c"; then
62    if test -z "$YACC_INST"; then
63       AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
64    fi
65 fi
66
67 # Checks for library functions.
68 AC_CHECK_FUNCS([strcasecmp strncasecmp])
69 if test "x$ac_cv_func_strcasecmp" = xno || \
70    test "x$ac_cv_func_strncasecmp" = xno; then
71     AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
72 fi
73
74 AC_CHECK_FUNCS([eaccess euidaccess])
75
76 # Some tests use Linux-specific headers
77 AC_CHECK_HEADER([linux/input.h])
78 AM_CONDITIONAL(BUILD_LINUX_TESTS, [test "x$ac_cv_header_linux_input_h" = xyes])
79
80 XORG_TESTSET_CFLAG([BASE_CFLAGS], [-fvisibility=hidden])
81
82 # Define a configuration option for the XKB config root
83 xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
84 if test "x$xkb_base" = x; then
85     xkb_base=$datadir/X11/xkb
86 fi
87 AC_ARG_WITH([xkb_config_root],
88     [AS_HELP_STRING([--with-xkb-config-root=<path>],
89         [Set default XKB config root (default: xkeyboard-config install path)])],
90     [XKBCONFIGROOT="$withval"],
91     [XKBCONFIGROOT="$xkb_base"])
92 AC_SUBST([XKBCONFIGROOT])
93
94 AC_ARG_WITH([default_rules],
95     [AS_HELP_STRING([--with-default-rules=<path>],
96         [Default XKB ruleset (default: evdev)])],
97     [DEFAULT_XKB_RULES="$withval"],
98     [DEFAULT_XKB_RULES="evdev"])
99 AC_DEFINE_UNQUOTED([DEFAULT_XKB_RULES], ["$DEFAULT_XKB_RULES"],
100                    [Default XKB ruleset])
101
102 AC_ARG_WITH([default_model],
103     [AS_HELP_STRING([--with-default-model=<path>],
104         [Default XKB model (default: pc105)])],
105     [DEFAULT_XKB_MODEL="$withval"],
106     [DEFAULT_XKB_MODEL="pc105"])
107 AC_DEFINE_UNQUOTED([DEFAULT_XKB_MODEL], ["$DEFAULT_XKB_MODEL"],
108                    [Default XKB model])
109
110 AC_ARG_WITH([default_layout],
111     [AS_HELP_STRING([--with-default-layout=<path>],
112         [Default XKB layout (default: us)])],
113     [DEFAULT_XKB_LAYOUT="$withval"],
114     [DEFAULT_XKB_LAYOUT="us"])
115 AC_DEFINE_UNQUOTED([DEFAULT_XKB_LAYOUT], ["$DEFAULT_XKB_LAYOUT"],
116                    [Default XKB layout])
117
118 AC_CONFIG_FILES([
119     Makefile
120     xkbcommon-uninstalled.pc
121     xkbcommon.pc
122     doc/Doxyfile
123 ])
124 AC_OUTPUT