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