Use pthread-stubs as needed, and list xdmcp in Requires.private when XCB is built...
[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.93,
7         [xcb@lists.freedesktop.org])
8 AC_CONFIG_SRCDIR([xcb.pc.in])
9 AM_INIT_AUTOMAKE([foreign dist-bzip2])
10
11 PKG_CHECK_MODULES(CHECK, [check >= 0.9.4], [HAVE_CHECK=true], [HAVE_CHECK=false])
12 AM_CONDITIONAL(HAVE_CHECK, test x$HAVE_CHECK = xtrue)
13
14 AC_CONFIG_HEADERS([src/config.h])
15
16 AC_PROG_LIBTOOL
17 AC_PROG_CC
18
19 AC_PATH_PROG(XSLTPROC, xsltproc, no)
20 if test "$XSLTPROC" = "no"; then
21    AC_MSG_ERROR([XCB requires xsltproc.])
22 fi
23
24 HTML_CHECK_RESULT=false
25 if test x"$HAVE_CHECK" = xtrue; then
26         if test x"$XSLTPROC" != xno; then
27                 HTML_CHECK_RESULT=true
28         fi
29 fi
30 AC_SUBST(HTML_CHECK_RESULT)
31
32 # Checks for pkg-config packages
33 PKG_CHECK_MODULES(XCBPROTO, xcb-proto >= 0.9.93)
34 NEEDED="xau pthread-stubs"
35 PKG_CHECK_MODULES(NEEDED, $NEEDED)
36
37 PKG_CHECK_MODULES(XDMCP, xdmcp,
38         AC_CHECK_LIB(Xdmcp, XdmcpWrap,
39                 [
40                 AC_DEFINE(HASXDMAUTH,1,[Has Wraphelp.c needed for XDM AUTH protocols])
41                 NEEDED="$NEEDED xdmcp"
42                 ],
43                 [
44                 XDMCP_CFLAGS=
45                 XDMCP_LIBS=
46                 ], [$XDMCP_LIBS]),
47         [AC_MSG_RESULT(no)])
48
49 AC_SUBST(NEEDED)
50
51 # Find the xcb-proto protocol descriptions
52 AC_MSG_CHECKING(XCBPROTO_XCBINCLUDEDIR)
53 XCBPROTO_XCBINCLUDEDIR=`$PKG_CONFIG --variable=xcbincludedir xcb-proto`
54 AC_MSG_RESULT($XCBPROTO_XCBINCLUDEDIR)
55 AC_SUBST(XCBPROTO_XCBINCLUDEDIR)
56
57 AC_HEADER_STDC
58 AC_SEARCH_LIBS(gethostbyname, nsl)
59 AC_SEARCH_LIBS(connect, socket)
60
61 xcbincludedir='${includedir}/xcb'
62 AC_SUBST(xcbincludedir)
63
64 AC_ARG_WITH(opt,
65 AC_HELP_STRING([--with-opt],       [compile with reasonable optimizations])
66 AC_HELP_STRING([--with-opt=FLAGS], [compile with specified FLAGS])
67 AC_HELP_STRING([--with-opt=small], [compile for smallest code])
68 AC_HELP_STRING([--without-opt],    [compile without optimization (default)]),
69 [
70         case "$withval" in
71         yes)
72                 COPTFLAGS="-O3"
73                 ;;
74         small)
75                 COPTFLAGS="-Os -fomit-frame-pointer -DNDEBUG"
76                 ;;
77         no)
78                 COPTFLAGS=""
79                 ;;
80         *)
81                 COPTFLAGS="$withval"
82                 ;;
83         esac
84 ])
85 AC_CACHE_CHECK([what compiler optimizations to apply], [COPTFLAGS], [COPTFLAGS=""])
86 AC_SUBST(COPTFLAGS)
87
88 AC_ARG_WITH(debug,
89 AC_HELP_STRING([--with-debug],       [compile with debugging (default)])
90 AC_HELP_STRING([--with-debug=FLAGS], [compile with specified debugging FLAGS])
91 AC_HELP_STRING([--without-debug],    [compile without debugging]),
92 [
93         case "$withval" in
94         yes)
95                 CDEBUGFLAGS="-g"
96                 ;;
97         no)
98                 CDEBUGFLAGS=""
99                 ;;
100         *)
101                 CDEBUGFLAGS="$withval"
102                 ;;
103         esac
104 ])
105 AC_CACHE_CHECK([what debugging options to apply], [CDEBUGFLAGS], [CDEBUGFLAGS="-g"])
106 AC_SUBST(CDEBUGFLAGS)
107
108 if  test "x$GCC" = xyes ; then
109     CWARNFLAGS="-Wall -pedantic -Wpointer-arith \
110                 -Wstrict-prototypes -Wmissing-declarations -Wnested-externs"
111 else
112     AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
113     if test "x$SUNCC" = "xyes"; then
114         CWARNFLAGS="-v"
115     fi
116 fi
117 AC_SUBST(CWARNFLAGS)
118
119 GCC_CHECK_VISIBILITY()
120
121 # htmldir is not defined prior to autoconf 2.59c, so on earlier versions
122 # set an equivalent value.
123 AC_PREREQ([2.59c], [], [AC_SUBST([htmldir], [m4_ifset([AC_PACKAGE_TARNAME],
124           ['${datadir}/doc/${PACKAGE_TARNAME}'],
125           ['${datadir}/doc/${PACKAGE}'])
126 ])])
127 AM_CHECK_DOXYGEN()
128
129 AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile doc/Makefile])
130 AC_CONFIG_FILES([xcb.pc xcb-xlib.pc xcb-composite.pc xcb-damage.pc xcb-dpms.pc xcb-glx.pc xcb-randr.pc xcb-record.pc xcb-render.pc xcb-res.pc xcb-screensaver.pc xcb-shape.pc xcb-shm.pc xcb-sync.pc xcb-xevie.pc xcb-xf86dri.pc xcb-xfixes.pc xcb-xinerama.pc xcb-xprint.pc xcb-xtest.pc xcb-xv.pc xcb-xvmc.pc])
131
132 AC_OUTPUT