]> Dogcows Code - chaz/openbox/blob - m4/x11.m4
Merge branch 'master' into chaz
[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_PRE_LIBS $X_LIBS -lX11"
17 LIBS="$LIBS $X_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_LIBS in
27 # the Makefiles
28 LIBS=$OLDLIBS
29 CPPFLAGS=$OLDCPPFLAGS
30 ])
31
32 # X11_EXT_XKB()
33 #
34 # Check for the presence of the "Xkb" X Window System extension.
35 # Defines "XKB" and sets the $(XKB) variable to "yes" if the extension is
36 # present.
37 AC_DEFUN([X11_EXT_XKB],
38 [
39 AC_REQUIRE([X11_DEVEL])
40
41 AC_ARG_ENABLE([xkb],
42 AC_HELP_STRING(
43 [--disable-xkb],
44 [build without support for xkb extension [default=enabled]]),
45 [USE=$enableval], [USE="yes"])
46
47 if test "$USE" = "yes"; then
48 # Store these
49 OLDLIBS=$LIBS
50 OLDCPPFLAGS=$CPPFLAGS
51
52 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
53 LIBS="$LIBS $X_LIBS"
54
55 AC_CHECK_LIB([X11], [XkbBell],
56 AC_MSG_CHECKING([for X11/XKBlib.h])
57 AC_TRY_LINK(
58 [
59 #include <X11/Xlib.h>
60 #include <X11/Xutil.h>
61 #include <X11/XKBlib.h>
62 ],
63 [
64 Display *d;
65 Window w;
66 XkbBell(d, w, 0, 0);
67 ],
68 [
69 AC_MSG_RESULT([yes])
70 XKB="yes"
71 AC_DEFINE([XKB], [1], [Found the XKB extension])
72
73 XKB_CFLAGS=""
74 XKB_LIBS=""
75 AC_SUBST(XKB_CFLAGS)
76 AC_SUBST(XKB_LIBS)
77 ],
78 [
79 AC_MSG_RESULT([no])
80 XKB="no"
81 ])
82 )
83
84 LIBS=$OLDLIBS
85 CPPFLAGS=$OLDCPPFLAGS
86 fi
87
88 AC_MSG_CHECKING([for the Xkb extension])
89 if test "$XKB" = "yes"; then
90 AC_MSG_RESULT([yes])
91 else
92 AC_MSG_RESULT([no])
93 fi
94 ])
95
96 # X11_EXT_XRANDR()
97 #
98 # Check for the presence of the "XRandR" X Window System extension.
99 # Defines "XRANDR" and sets the $(XRANDR) variable to "yes" if the extension is
100 # present.
101 AC_DEFUN([X11_EXT_XRANDR],
102 [
103 AC_REQUIRE([X11_DEVEL])
104
105 AC_ARG_ENABLE([xrandr],
106 AC_HELP_STRING(
107 [--disable-xrandr],
108 [build without support for xrandr extension [default=enabled]]),
109 [USE=$enableval], [USE="yes"])
110
111 if test "$USE" = "yes"; then
112 # Store these
113 OLDLIBS=$LIBS
114 OLDCPPFLAGS=$CPPFLAGS
115
116 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
117 LIBS="$LIBS $X_LIBS -lXext -lXrender -lXrandr"
118
119 AC_CHECK_LIB([Xrandr], [XRRSelectInput],
120 AC_MSG_CHECKING([for X11/extensions/Xrandr.h])
121 AC_TRY_LINK(
122 [
123 #include <X11/Xlib.h>
124 #include <X11/extensions/Xrandr.h>
125 ],
126 [
127 Display *d;
128 Drawable r;
129 int i;
130 XRRQueryExtension(d, &i, &i);
131 XRRGetScreenInfo(d, r);
132 ],
133 [
134 AC_MSG_RESULT([yes])
135 XRANDR="yes"
136 AC_DEFINE([XRANDR], [1], [Found the XRandR extension])
137
138 XRANDR_CFLAGS=""
139 XRANDR_LIBS="-lXext -lXrender -lXrandr"
140 AC_SUBST(XRANDR_CFLAGS)
141 AC_SUBST(XRANDR_LIBS)
142 ],
143 [
144 AC_MSG_RESULT([no])
145 XRANDR="no"
146 ])
147 )
148
149 LIBS=$OLDLIBS
150 CPPFLAGS=$OLDCPPFLAGS
151 fi
152
153 AC_MSG_CHECKING([for the XRandR extension])
154 if test "$XRANDR" = "yes"; then
155 AC_MSG_RESULT([yes])
156 else
157 AC_MSG_RESULT([no])
158 fi
159 ])
160
161 # X11_EXT_SHAPE()
162 #
163 # Check for the presence of the "Shape" X Window System extension.
164 # Defines "SHAPE", sets the $(SHAPE) variable to "yes", and sets the $(LIBS)
165 # appropriately if the extension is present.
166 AC_DEFUN([X11_EXT_SHAPE],
167 [
168 AC_REQUIRE([X11_DEVEL])
169
170 AC_ARG_ENABLE([xshape],
171 AC_HELP_STRING(
172 [--disable-xshape],
173 [build without support for xshape extension [default=enabled]]),
174 [USE=$enableval], [USE="yes"])
175
176 if test "$USE" = "yes"; then
177 # Store these
178 OLDLIBS=$LIBS
179 OLDCPPFLAGS=$CPPFLAGS
180
181 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
182 LIBS="$LIBS $X_LIBS"
183
184 AC_CHECK_LIB([Xext], [XShapeCombineShape],
185 AC_MSG_CHECKING([for X11/extensions/shape.h])
186 AC_TRY_LINK(
187 [
188 #include <X11/Xlib.h>
189 #include <X11/Xutil.h>
190 #include <X11/extensions/shape.h>
191 ],
192 [
193 long foo = ShapeSet;
194 ],
195 [
196 AC_MSG_RESULT([yes])
197 SHAPE="yes"
198 AC_DEFINE([SHAPE], [1], [Found the XShape extension])
199
200 XSHAPE_CFLAGS=""
201 XSHAPE_LIBS="-lXext"
202 AC_SUBST(XSHAPE_CFLAGS)
203 AC_SUBST(XSHAPE_LIBS)
204 ],
205 [
206 AC_MSG_RESULT([no])
207 SHAPE="no"
208 ])
209 )
210
211 LIBS=$OLDLIBS
212 CPPFLAGS=$OLDCPPFLAGS
213 fi
214
215 AC_MSG_CHECKING([for the Shape extension])
216 if test "$SHAPE" = "yes"; then
217 AC_MSG_RESULT([yes])
218 else
219 AC_MSG_RESULT([no])
220 fi
221 ])
222
223
224 # X11_EXT_XINERAMA()
225 #
226 # Check for the presence of the "Xinerama" X Window System extension.
227 # Defines "XINERAMA", sets the $(XINERAMA) variable to "yes", and sets the
228 # $(LIBS) appropriately if the extension is present.
229 AC_DEFUN([X11_EXT_XINERAMA],
230 [
231 AC_REQUIRE([X11_DEVEL])
232
233 AC_ARG_ENABLE([xinerama],
234 AC_HELP_STRING(
235 [--disable-xinerama],
236 [build without support for xinerama [default=enabled]]),
237 [USE=$enableval], [USE="yes"])
238
239 if test "$USE" = "yes"; then
240 # Store these
241 OLDLIBS=$LIBS
242 OLDCPPFLAGS=$CPPFLAGS
243
244 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
245 LIBS="$LIBS $X_LIBS -lXext"
246
247 AC_CHECK_LIB([Xinerama], [XineramaQueryExtension],
248 [
249 AC_MSG_CHECKING([for X11/extensions/Xinerama.h])
250 AC_TRY_LINK(
251 [
252 #include <X11/Xlib.h>
253 #include <X11/extensions/Xinerama.h>
254 ],
255 [
256 XineramaScreenInfo foo;
257 ],
258 [
259 AC_MSG_RESULT([yes])
260 XINERAMA="yes"
261 AC_DEFINE([XINERAMA], [1], [Enable support of the Xinerama extension])
262 XINERAMA_LIBS="-lXext -lXinerama"
263 AC_SUBST(XINERAMA_LIBS)
264 ],
265 [
266 AC_MSG_RESULT([no])
267 XINERAMA="no"
268 ])
269 ])
270
271 LIBS=$OLDLIBS
272 CPPFLAGS=$OLDCPPFLAGS
273 fi
274
275 AC_MSG_CHECKING([for the Xinerama extension])
276 if test "$XINERAMA" = "yes"; then
277 AC_MSG_RESULT([yes])
278 else
279 AC_MSG_RESULT([no])
280 fi
281 ])
282
283 # X11_EXT_SYNC()
284 #
285 # Check for the presence of the "Sync" X Window System extension.
286 # Defines "SYNC", sets the $(SYNC) variable to "yes", and sets the $(LIBS)
287 # appropriately if the extension is present.
288 AC_DEFUN([X11_EXT_SYNC],
289 [
290 AC_REQUIRE([X11_DEVEL])
291
292 AC_ARG_ENABLE([xsync],
293 AC_HELP_STRING(
294 [--disable-xsync],
295 [build without support for xsync extension [default=enabled]]),
296 [USE=$enableval], [USE="yes"])
297
298 if test "$USE" = "yes"; then
299 # Store these
300 OLDLIBS=$LIBS
301 OLDCPPFLAGS=$CPPFLAGS
302
303 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
304 LIBS="$LIBS $X_LIBS"
305
306 AC_CHECK_LIB([Xext], [XSyncInitialize],
307 AC_MSG_CHECKING([for X11/extensions/sync.h])
308 AC_TRY_LINK(
309 [
310 #include <X11/Xlib.h>
311 #include <X11/Xutil.h>
312 #include <X11/extensions/sync.h>
313 ],
314 [
315 XSyncValueType foo;
316 ],
317 [
318 AC_MSG_RESULT([yes])
319 SYNC="yes"
320 AC_DEFINE([SYNC], [1], [Found the XSync extension])
321
322 XSYNC_CFLAGS=""
323 XSYNC_LIBS="-lXext"
324 AC_SUBST(XSYNC_CFLAGS)
325 AC_SUBST(XSYNC_LIBS)
326 ],
327 [
328 AC_MSG_RESULT([no])
329 SYNC="no"
330 ])
331 )
332
333 LIBS=$OLDLIBS
334 CPPFLAGS=$OLDCPPFLAGS
335 fi
336
337 AC_MSG_CHECKING([for the Sync extension])
338 if test "$SYNC" = "yes"; then
339 AC_MSG_RESULT([yes])
340 else
341 AC_MSG_RESULT([no])
342 fi
343 ])
344
345 # X11_EXT_AUTH()
346 #
347 # Check for the presence of the "Xau" X Window System extension.
348 # Defines "AUTH, sets the $(AUTH) variable to "yes", and sets the $(LIBS)
349 # appropriately if the extension is present.
350 AC_DEFUN([X11_EXT_AUTH],
351 [
352 AC_REQUIRE([X11_DEVEL])
353
354 # Store these
355 OLDLIBS=$LIBS
356 OLDCPPFLAGS=$CPPFLAGS
357
358 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
359 LIBS="$LIBS $X_LIBS"
360
361 AC_CHECK_LIB([Xau], [XauReadAuth],
362 AC_MSG_CHECKING([for X11/Xauth.h])
363 AC_TRY_LINK(
364 [
365 #include <X11/Xlib.h>
366 #include <X11/Xutil.h>
367 #include <X11/Xauth.h>
368 ],
369 [
370 ],
371 [
372 AC_MSG_RESULT([yes])
373 AUTH="yes"
374 AC_DEFINE([AUTH], [1], [Found the Xauth extension])
375
376 XAUTH_CFLAGS=""
377 XAUTH_LIBS="-lXau"
378 AC_SUBST(XAUTH_CFLAGS)
379 AC_SUBST(XAUTH_LIBS)
380 ],
381 [
382 AC_MSG_RESULT([no])
383 AUTH="no"
384 ])
385 )
386
387 LIBS=$OLDLIBS
388 CPPFLAGS=$OLDCPPFLAGS
389
390 AC_MSG_CHECKING([for the Xauth extension])
391 if test "$AUTH" = "yes"; then
392 AC_MSG_RESULT([yes])
393 else
394 AC_MSG_RESULT([no])
395 fi
396 ])
397
398 # X11_SM()
399 #
400 # Check for the presence of SMlib for session management.
401 # Defines "USE_SM" if SMlib is present.
402 AC_DEFUN([X11_SM],
403 [
404 AC_REQUIRE([X11_DEVEL])
405
406 AC_ARG_ENABLE([session-management],
407 AC_HELP_STRING(
408 [--disable-session-management],
409 [build without support for session managers [default=enabled]]),
410 [SM=$enableval], [SM="yes"])
411
412 if test "$SM" = "yes"; then
413 # Store these
414 OLDLIBS=$LIBS
415 OLDCPPFLAGS=$CPPFLAGS
416
417 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
418 LIBS="$LIBS $X_LIBS"
419
420 SM="no"
421
422 AC_CHECK_LIB([SM], [SmcSaveYourselfDone], [
423 AC_CHECK_HEADERS([X11/SM/SMlib.h], [
424 SM_CFLAGS="$X_CFLAGS"
425 SM_LIBS="-lSM -lICE"
426 AC_DEFINE(USE_SM, 1, [Use session management])
427 AC_SUBST(SM_CFLAGS)
428 AC_SUBST(SM_LIBS)
429 SM="yes"
430 ])
431 ])
432
433 LIBS=$OLDLIBS
434 CPPFLAGS=$OLDCPPFLAGS
435 fi
436
437 AC_MSG_CHECKING([for session management support])
438 if test "$SM" = "yes"; then
439 AC_MSG_RESULT([yes])
440 else
441 AC_MSG_RESULT([no])
442 fi
443 ])
This page took 0.046632 seconds and 4 git commands to generate.