1dnl AC_TYPE_SSIZE_T is defined from 2.59c
2AC_PREREQ(2.59c)
3AC_INIT([xcb-util],0.3.6,[xcb@lists.freedesktop.org])
4AC_CONFIG_SRCDIR([Makefile.am])
5AM_INIT_AUTOMAKE([foreign dist-bzip2])
6
7AC_CHECK_PROGS(M4, [m4 gm4], [no])
8if test $M4 != "no" ; then
9	AC_MSG_CHECKING([if $M4 supports -I])
10	if $M4 -I. /dev/null > /dev/null 2>&1 ; then
11		AC_MSG_RESULT([yes])
12	else
13		AC_MSG_RESULT([no])
14		# Try finding the gnu version
15		AC_CHECK_PROGS(GM4, gm4, [no])
16		if test $GM4 = "no" ; then
17			AC_PATH_PROGS(GNUM4, m4, [no], [/usr/gnu/bin])
18			M4="$GNUM4"
19		else
20			M4="$GM4"
21		fi
22	fi
23fi
24if test $M4 = "no"; then
25	AC_MSG_ERROR([Can't find usable m4, please install it and try again])
26fi
27AC_CHECK_PROGS(GPERF, gperf, [no])
28if test $GPERF = "no"; then
29	AC_MSG_ERROR([Can't find gperf, please install it and try again])
30fi
31AC_PROG_CC
32AC_PROG_LIBTOOL
33
34if  test "x$GCC" = xyes ; then
35    CWARNFLAGS="-Wall"
36else
37    AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
38    if test "x$SUNCC" = "xyes"; then
39	CWARNFLAGS="-v"
40    fi
41fi
42AC_SUBST(CWARNFLAGS)
43AC_CHECK_FUNCS_ONCE(vasprintf)
44
45dnl Checking whether ssize_t is defined (xcb-util-common.h)
46AC_TYPE_SSIZE_T
47
48xcbincludedir='${includedir}/xcb'
49AC_SUBST(xcbincludedir)
50
51pkgconfigdir='${libdir}/pkgconfig'
52AC_SUBST(pkgconfigdir)
53
54PKG_CHECK_MODULES(XCB, xcb >= 1.4)
55
56######
57# Check version of xcb-proto that xcb was compiled against
58######
59xcbproto_required=1.5
60
61# Moved from AX_COMPARE_VERSION to maintain proper output
62AC_PROG_AWK
63
64AC_MSG_CHECKING([whether libxcb was compiled against xcb-proto >= $xcbproto_required])
65xcbproto_version=`$PKG_CONFIG --variable=xcbproto_version xcb`
66AX_COMPARE_VERSION([$xcbproto_version],[ge],[$xcbproto_required], xcbproto_ok="yes", xcbproto_ok="no")
67AC_MSG_RESULT([$xcbproto_ok])
68
69if test $xcbproto_ok = no; then
70	AC_MSG_ERROR([libxcb was compiled against xcb-proto $xcbproto_version; it needs to be compiled against version $xcbproto_required or higher])
71fi
72
73
74PKG_CHECK_MODULES(XCB_SHM, xcb-shm)
75PKG_CHECK_MODULES(XCB_RENDER, xcb-render)
76PKG_CHECK_MODULES(XPROTO, xproto >= 7.0.8)
77
78XCB_AUX_CFLAGS='-I$(top_srcdir)/aux'
79XCB_AUX_LIBS='$(top_builddir)/aux/libxcb-aux.la'
80XCB_ATOM_CFLAGS='-I$(top_srcdir)/atom -I$(top_builddir)/atom'
81XCB_ATOM_LIBS='$(top_builddir)/atom/libxcb-atom.la'
82XCB_EVENT_CFLAGS='-I$(top_srcdir)/event'
83XCB_EVENT_LIBS='$(top_builddir)/event/libxcb-event.la'
84XCB_PROPERTY_CFLAGS='-I$(top_srcdir)/property'
85XCB_PROPERTY_LIBS='$(top_builddir)/property/libxcb-property.la'
86XCB_ICCCM_CFLAGS='-I$(top_srcdir)/icccm'
87XCB_ICCCM_LIBS='$(top_builddir)/icccm/libxcb-icccm.la'
88AC_SUBST(XCB_AUX_CFLAGS)
89AC_SUBST(XCB_AUX_LIBS)
90AC_SUBST(XCB_ATOM_CFLAGS)
91AC_SUBST(XCB_ATOM_LIBS)
92AC_SUBST(XCB_EVENT_CFLAGS)
93AC_SUBST(XCB_EVENT_LIBS)
94AC_SUBST(XCB_PROPERTY_CFLAGS)
95AC_SUBST(XCB_PROPERTY_LIBS)
96AC_SUBST(XCB_ICCCM_CFLAGS)
97AC_SUBST(XCB_ICCCM_LIBS)
98
99AC_OUTPUT([Makefile
100	aux/Makefile aux/xcb-aux.pc
101	reply/Makefile reply/xcb-reply.pc
102	image/Makefile image/xcb-image.pc
103	atom/Makefile atom/xcb-atom.pc
104	event/Makefile event/xcb-event.pc
105	keysyms/Makefile keysyms/xcb-keysyms.pc
106	property/Makefile property/xcb-property.pc
107	icccm/Makefile icccm/xcb-icccm.pc
108	renderutil/Makefile renderutil/xcb-renderutil.pc
109	xcb_util_intro
110	])
111