Merge branch 'master' of git+ssh://anholt@git.freedesktop.org/git/xcb
[free-sw/xcb/libxcb] / configure.ac
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3
4 AC_PREREQ(2.57)
5 AC_INIT([libXCB],
6         0.9,
7         [xcb@lists.freedesktop.org])
8 AC_CONFIG_SRCDIR([xcb.pc.in])
9 AM_INIT_AUTOMAKE([foreign dist-bzip2])
10
11 dnl This ifdef has no useful effect prior to automake 1.9, but in 1.9
12 dnl it allows the user to not have check.m4 installed.
13 m4_ifdef([AM_PATH_CHECK],[
14 AM_PATH_CHECK(0.8.2, [HAVE_CHECK=true], [HAVE_CHECK=false])
15 ])
16 AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xtrue)
17
18 AC_CONFIG_HEADERS([src/config.h])
19
20 AC_PROG_LIBTOOL
21 AC_PROG_CC
22
23 AC_PATH_PROG(XSLTPROC, xsltproc, no)
24 if test "$XSLTPROC" = "no"; then
25    AC_MSG_ERROR([XCB requires xsltproc.])
26 fi
27
28 HTML_CHECK_RESULT=false
29 if test x"$HAVE_CHECK" = xtrue; then
30         if test x"$XSLTPROC" != xno; then
31                 HTML_CHECK_RESULT=true
32         fi
33 fi
34 AC_SUBST(HTML_CHECK_RESULT)
35
36 # Checks for pkg-config packages
37 PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 0.9)
38 PKG_CHECK_MODULES(XPROTO, xproto)
39 PKG_CHECK_MODULES(XAU, xau)
40
41 # Find the xcb-proto protocol descriptions
42 AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
43 XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
44 AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
45 AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
46
47 AC_HEADER_STDC
48 AC_SEARCH_LIBS(gethostbyname, nsl)
49 AC_SEARCH_LIBS(connect, socket)
50
51 xcbincludedir='${includedir}/X11/XCB'
52 AC_SUBST(xcbincludedir)
53
54 AC_ARG_WITH(opt,
55 AC_HELP_STRING([--with-opt],       [compile with reasonable optimizations])
56 AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
57 AC_HELP_STRING([--with-opt=small], [compile for smallest code])
58 AC_HELP_STRING([--with-opt=debug], [compile for debugging (default)]),
59 [
60         case "$withval" in
61         yes)
62                 optflags="-O3"
63                 ;;
64         small)
65                 optflags="-Os -fomit-frame-pointer -DNDEBUG"
66                 ;;
67         no|debug)
68                 optflags="-g"
69                 ;;
70         *)
71                 optflags="$withval"
72                 ;;
73         esac
74 ])
75 AC_CACHE_CHECK([what compiler optimizations to apply], [optflags], [optflags="-g"])
76 CDEBUGFLAGS="$optflags -Wall -pedantic -Wpointer-arith \
77         -Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
78 AC_SUBST(CDEBUGFLAGS)
79
80 AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
81 AC_CONFIG_FILES([xcb.pc])
82
83 AC_OUTPUT