]> Dogcows Code - chaz/openbox/blob - m4/x11.m4
update teh rc3 to reflect how the code works now
[chaz/openbox] / m4 / x11.m4
1 # X11_DEVEL()
2 #
3 # Check for the presence of the X Window System headers and libraries.
4 # Sets the CPPFLAGS and LIBS variables as appropriate.
5 AC_DEFUN([X11_DEVEL],
6 [
7 AC_PATH_X
8 AC_PATH_XTRA
9 test "$no_x" = "yes" && \
10 AC_MSG_ERROR([The X Window System could not be found.])
11
12 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
13 LIBS="$LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
14
15 # Check for required functions in -lX11
16 AC_CHECK_LIB(
17 [X11], [XOpenDisplay],
18 ,
19 AC_MSG_ERROR([Could not find XOpenDisplay in -lX11.])
20 )
21 ])
22
23
24 AC_DEFUN([XFT_ERROR],
25 [
26 if test "$XFT_MIN"; then
27 AC_MSG_ERROR([$PACKAGE requires the Xft font library >= $XFT_MIN.
28 See http://www.fontconfig.org/
29 ])
30 else
31 AC_MSG_ERROR([$PACKAGE requires the Xft font library.
32 See http://www.fontconfig.org/
33 ])
34 fi
35 ])
36
37 # XFT_DEVEL([required-version])
38 #
39 # Check for the XFT development package.
40 # You can use the optional argument to check for a library of at least the
41 # given version.
42 # It provides the $(PYTHON_CFLAGS) $(PYTHON_LIBS) output variables.
43 AC_DEFUN([XFT_DEVEL],
44 [
45 AC_REQUIRE([X11_DEVEL])
46
47 if test "$1"; then
48 XFT_MIN="$1"
49 XFT_MIN_MAJOR=${XFT_MIN%.*.*}
50 XFT_MIN_MINOR=${XFT_MIN%.*}
51 XFT_MIN_MINOR=${XFT_MIN_MINOR#*.}
52 XFT_MIN_REVISION=${XFT_MIN#*.*.}
53 XFT_MIN="$XFT_MIN_MAJOR.$XFT_MIN_MINOR.$XFT_MIN_REVISION"
54 else
55 XFT_MIN=""
56 fi
57
58 if test -z "$XFT_MIN"; then
59 AC_MSG_CHECKING([for Xft])
60 if ! pkg-config xft; then
61 AC_MSG_RESULT([no])
62 XFT_ERROR
63 fi
64 else
65 AC_MSG_CHECKING([for Xft version >= $XFT_MIN])
66 if ! pkg-config --atleast-version $XFT_MIN xft; then
67 AC_MSG_RESULT([no])
68 XFT_ERROR
69 fi
70 fi
71 AC_MSG_RESULT([yes])
72
73
74 # Store these
75 OLDLIBS=$LIBS
76 OLDCPPFLAGS=$CPPFLAGS
77
78 XFT_CFLAGS="`pkg-config --cflags xft`"
79 XFT_LIBS="`pkg-config --libs xft`"
80
81 # Set these for checking with the tests below. They'll be restored after
82 LIBS="$LIBS $XFT_LIBS"
83 CPPFLAGS="$XFT_CFLAGS $CPPFLAGS"
84
85 AC_CHECK_LIB([Xft], [XftGetVersion], # this was not defined in < 2.0
86 if test "$XFT_MIN"; then
87 AC_MSG_CHECKING([for X11/Xft/Xft.h for Xft >= $XFT_MIN])
88 AC_TRY_COMPILE(
89 [
90 #include <X11/Xlib.h>
91 #include <X11/Xft/Xft.h>
92 ],
93 [
94 #if !defined(XFT_MAJOR)
95 # error Xft.h is too old
96 #endif
97 #if XFT_MAJOR < $XFT_MIN_MAJOR
98 # error Xft.h is too old
99 #endif
100 #if XFT_MAJOR == $XFT_MIN_MAJOR
101 # if XFT_MINOR < $XFT_MIN_MINOR
102 # error Xft.h is too old
103 # endif
104 #endif
105 #if XFT_MAJOR == $XFT_MIN_MAJOR
106 # if XFT_MAJOR == $XFT_MIN_MINOR
107 # if XFT_REVISION < $XFT_MIN_REVISION
108 # error Xft.h is too old
109 # endif
110 # endif
111 #endif
112
113 int i = XFT_MAJOR;
114 XftFont foo;
115 ],
116 [
117 AC_MSG_RESULT([yes])
118 ],
119 [
120 AC_MSG_RESULT([no])
121 XFT_ERROR
122 ])
123 else
124 AC_MSG_CHECKING([for X11/Xft/Xft.h])
125 AC_TRY_COMPILE(
126 [
127 #include <X11/Xlib.h>
128 #include <X11/Xft/Xft.h>
129 ],
130 [
131 int i = XFT_MAJOR; /* make sure were using Xft 2, not 1 */
132 XftFont foo;
133 ],
134 [
135 AC_MSG_RESULT([yes])
136 ],
137 [
138 AC_MSG_RESULT([no])
139 XFT_ERROR
140 ])
141 fi
142
143 AC_MSG_CHECKING([if we can compile with Xft])
144 AC_TRY_LINK(
145 [
146 #include <X11/Xlib.h>
147 #include <X11/Xft/Xft.h>
148 ],
149 [
150 int i = XFT_MAJOR;
151 XftFont foo
152 ],
153 [
154 AC_MSG_RESULT([yes])
155 ],
156 [
157 AC_MSG_RESULT([no])
158 AC_MSG_ERROR([Unable to compile with the Xft font library.
159 ])
160 ])
161 )
162
163 # Restore the old values. Use XFT_CFLAGS and XFT_LIBS in the Makefile.am's
164 LIBS=$OLDLIBS
165 CPPFLAGS=$OLDCPPFLAGS
166
167 AC_SUBST([XFT_CFLAGS])
168 AC_SUBST([XFT_LIBS])
169 ])
170
171
172 # X11_EXT_XKB()
173 #
174 # Check for the presence of the "Xkb" X Window System extension.
175 # Defines "XKB" and sets the $(XKB) variable to "yes" if the extension is
176 # present.
177 AC_DEFUN([X11_EXT_XKB],
178 [
179 AC_REQUIRE([X11_DEVEL])
180
181 AC_CHECK_LIB([X11], [XkbBell],
182 AC_MSG_CHECKING([for X11/XKBlib.h])
183 AC_TRY_LINK(
184 [
185 #include <X11/Xlib.h>
186 #include <X11/Xutil.h>
187 #include <X11/XKBlib.h>
188 ],
189 [
190 Display *d;
191 Window w;
192 XkbBell(d, w, 0, 0);
193 ],
194 [
195 AC_MSG_RESULT([yes])
196 XKB="yes"
197 AC_DEFINE([XKB], [1], [Found the XKB extension])
198 ],
199 [
200 AC_MSG_RESULT([no])
201 XKB="no"
202 ])
203 )
204 AC_MSG_CHECKING([for the Xkb extension])
205 if test "$XKB" = "yes"; then
206 AC_MSG_RESULT([yes])
207 else
208 AC_MSG_RESULT([no])
209 fi
210 ])
211
212 # X11_EXT_SHAPE()
213 #
214 # Check for the presence of the "Shape" X Window System extension.
215 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
216 # appropriately if the extension is present.
217 AC_DEFUN([X11_EXT_SHAPE],
218 [
219 AC_REQUIRE([X11_DEVEL])
220
221 AC_CHECK_LIB([Xext], [XShapeCombineShape],
222 AC_MSG_CHECKING([for X11/extensions/shape.h])
223 AC_TRY_LINK(
224 [
225 #include <X11/Xlib.h>
226 #include <X11/Xutil.h>
227 #include <X11/extensions/shape.h>
228 ],
229 [
230 long foo = ShapeSet;
231 ],
232 [
233 AC_MSG_RESULT([yes])
234 SHAPE="yes"
235 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
236 LIBS="$LIBS -lXext"
237 ],
238 [
239 AC_MSG_RESULT([no])
240 SHAPE="no"
241 ])
242 )
243 AC_MSG_CHECKING([for the Shape extension])
244 if test "$SHAPE" = "yes"; then
245 AC_MSG_RESULT([yes])
246 else
247 AC_MSG_RESULT([no])
248 fi
249 ])
250
251
252 # X11_EXT_XINERAMA()
253 #
254 # Check for the presence of the "Xinerama" X Window System extension.
255 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
256 # $(LIBS) appropriately if the extension is present.
257 AC_DEFUN([X11_EXT_XINERAMA],
258 [
259 AC_REQUIRE([X11_DEVEL])
260
261 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
262 [
263 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
264 AC_TRY_LINK(
265 [
266 #include <X11/Xlib.h>
267 #include <X11/extensions/Xinerama.h>
268 ],
269 [
270 XineramaScreenInfo foo;
271 ],
272 [
273 AC_MSG_RESULT([yes])
274 XINERAMA="yes"
275 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
276 LIBS="$LIBS -lXinerama"
277 ],
278 [
279 AC_MSG_RESULT([no])
280 XINERAMA="no"
281 ])
282 ])
283 AC_MSG_CHECKING([for the Xinerama extension])
284 if test "$XINERAMA" = "yes"; then
285 AC_MSG_RESULT([yes])
286 else
287 AC_MSG_RESULT([no])
288 fi
289 ])
This page took 0.049634 seconds and 4 git commands to generate.