1d427d543d2bdde2a9f8b6810641083d2fa9f3b3
[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.60])
25 AC_INIT([libxkbcommon], [0.1.0],
26     [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg])
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
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.8)
45 XORG_DEFAULT_OPTIONS
46 XORG_CHECK_MALLOC_ZERO
47
48 # Check for compiler features
49 AC_C_INLINE
50
51 # Check for programs
52 AC_PROG_LEX
53 AC_PROG_YACC
54 AC_PATH_PROG([YACC_INST], $YACC)
55 if test ! -f "src/xkbcomp/parser.c"; then
56    if test -z "$YACC_INST"; then
57       AC_MSG_ERROR([yacc not found - unable to compile src/xkbcomp/parser.y])
58    fi
59 fi
60
61 # Checks for library functions.
62 AC_CHECK_FUNCS([strcasecmp strncasecmp])
63 if test "x$ac_cv_func_strcasecmp" = xno || \
64    test "x$ac_cv_func_strncasecmp" = xno; then
65     AC_MSG_ERROR([C library does not support strcasecmp/strncasecmp])
66 fi
67
68 AC_CHECK_FUNCS([eaccess euidaccess])
69
70 # Build native compiler needed for makekeys
71 AC_ARG_VAR([CC_FOR_BUILD], [Build native C compiler program])
72 if test "x$CC_FOR_BUILD" = x; then
73     if test "$cross_compiling" != no; then
74         AC_PATH_PROGS([CC_FOR_BUILD], [gcc cc], [cc])
75     else
76         CC_FOR_BUILD="$CC"
77     fi
78 fi
79
80 if test "x$GCC" = xyes ; then
81     CFLAGS="$CFLAGS -fvisibility=hidden"
82 fi
83
84 # Obtain protocols headers include directives
85 PKG_CHECK_MODULES([X11], [xproto kbproto >= 1.0.4])
86
87 # Obtain the path to the X Window System Core Protocol
88 AC_MSG_CHECKING([for X11 includedir])
89 AC_ARG_VAR([X11_INCLUDEDIR], [Path to X protocol keysym headers])
90 if test "x$X11_INCLUDEDIR" = x; then
91     X11_INCLUDEDIR="`$PKG_CONFIG --variable=includex11dir xproto`"
92 fi
93 if ! test -d "$X11_INCLUDEDIR"; then
94     AC_MSG_ERROR([invalid X11 include path $X11_INCLUDEDIR])
95 fi
96 AC_MSG_RESULT([$X11_INCLUDEDIR])
97
98 AC_MSG_CHECKING([keysym definition files])
99 FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
100 for i in $FILES; do
101     if test -f "$X11_INCLUDEDIR/$i"; then
102             KEYSYMDEFS="$KEYSYMDEFS $X11_INCLUDEDIR/$i"
103     else
104             AC_MSG_ERROR([cannot find $i in $X11_INCLUDEDIR])
105     fi
106 done
107 AC_MSG_RESULT([$KEYSYMDEFS])
108 AC_SUBST(KEYSYMDEFS)
109
110 # Define a configuration option for the XKB config root
111 xkb_base=`$PKG_CONFIG --variable=xkb_base xkeyboard-config`
112 if test "x$xkb_base" = x; then
113     xkb_base=$datadir/X11/xkb
114 fi
115 AC_ARG_WITH([xkb_config_root],
116     [AS_HELP_STRING([--with-xkb-config-root=<path>],
117         [Set default XKB config root (default: xkeyboard-config install path)])],
118     [XKBCONFIGROOT="$withval"],
119     [XKBCONFIGROOT="$xkb_base"])
120 AC_SUBST([XKBCONFIGROOT])
121
122
123 AC_CONFIG_FILES([
124     Makefile
125     makekeys/Makefile
126     xkbcommon-uninstalled.pc
127     xkbcommon.pc])
128 AC_OUTPUT