config: remove AC_PROG_CC as it overrides AC_PROG_C_C99
[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])
33 AM_MAINTAINER_MODE
34
35 # Initialize libtool
36 AC_PROG_LIBTOOL
37
38 AC_PROG_YACC
39 AC_PROG_LEX
40
41 m4_ifndef([PKG_PROG_PKG_CONFIG],
42     [m4_fatal([Could not locate the pkg-config autoconf macros.
43     These are usually located in /usr/share/aclocal/pkg.m4. If your
44     macros are in a different location, try setting the environment
45     variable ACLOCAL="aclocal -I/other/macro/dir" before running
46     autoreconf/autogen.sh.])])
47 PKG_PROG_PKG_CONFIG
48
49 # Require xorg-macros minimum of 1.8 for AM_SILENT_RULES
50 m4_ifndef([XORG_MACROS_VERSION],
51           [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
52 XORG_MACROS_VERSION(1.8)
53 XORG_DEFAULT_OPTIONS
54 XORG_CHECK_MALLOC_ZERO
55
56 dnl Build native compiler needed for makekeys
57 AC_ARG_VAR([CC_FOR_BUILD], [Build native C compiler program])
58 if test "x$CC_FOR_BUILD" = x; then
59     if test "$cross_compiling" != no; then
60         AC_PATH_PROGS([CC_FOR_BUILD], [gcc cc], [cc])
61     else
62         CC_FOR_BUILD="$CC"
63     fi
64 fi
65
66 AC_CHECK_FUNCS([strcasecmp])
67
68 if  test "x$GCC" = xyes ; then
69   CFLAGS="$CFLAGS -fvisibility=hidden"
70 fi
71
72 PKG_CHECK_MODULES([X11], [xproto kbproto >= 1.0.5])
73
74 dnl Ensure we have keysym headers
75 AC_MSG_CHECKING([for X11 includedir])
76 x11includedir="`$PKG_CONFIG --variable=includedir xproto`/X11"
77 AC_MSG_RESULT([$x11includedir])
78
79 AC_MSG_CHECKING([for keysymdef.h])
80 KEYSYMDEF_H="$x11includedir/keysymdef.h"
81 test -f "$KEYSYMDEF_H" || AC_MSG_ERROR([can't locate keysymdef.h in $x11includedir])
82 AC_MSG_RESULT([$KEYSYMDEF_H])
83 AC_SUBST([KEYSYMDEF_H])
84
85 AC_MSG_CHECKING([for XF86keysym.h])
86 XF86KEYSYM_H="$x11includedir/XF86keysym.h"
87 test -f "$XF86KEYSYM_H" || AC_MSG_ERROR([can't locate XF86keysym.h in $x11includedir])
88 AC_MSG_RESULT([$XF86KEYSYM_H])
89 AC_SUBST([XF86KEYSYM_H])
90
91 AC_SUBST([KS_HEADERS], ['$(KEYSYMDEF_H) $(XF86KEYSYM_H)'])
92
93 AC_ARG_WITH([xkb_config_root],
94     [AS_HELP_STRING([--with-xkb-config-root=<paths>],
95         [Set default XKB config root (default: ${datadir}/X11/xkb)])],
96     [XKBCONFIGROOT="$withval"],
97     [XKBCONFIGROOT='${datadir}/X11/xkb'])
98 AC_SUBST([XKBCONFIGROOT])
99
100 AC_CONFIG_FILES([
101 Makefile
102 xkbcommon.pc
103 include/Makefile
104 src/Makefile
105 src/makekeys/Makefile
106 src/xkbcomp/Makefile
107 test/Makefile
108 ])
109 AC_OUTPUT