uterm: drm: reread dpms state on wakeup
[platform/upstream/kmscon.git] / configure.ac
1 #
2 # Kmscon - build configuration script
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
4 #
5
6 AC_PREREQ(2.68)
7
8 AC_INIT([kmscon], [6])
9 AC_SUBST(PACKAGE_URL, [https://github.com/dvdhrm/kmscon])
10 AC_CONFIG_SRCDIR([src/kmscon_main.c])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_HEADER(config.h)
14
15 AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-bzip2 no-dist-gzip tar-pax -Wall -Werror -Wno-portability])
16 AM_SILENT_RULES([yes])
17
18 #
19 # Don't add a default "-g -O2" if CFLAGS wasn't specified. For debugging it is
20 # often more convenient to have "-g -O0". You can still override it by
21 # explicitely setting it on the command line.
22 #
23
24 : ${CFLAGS=""}
25
26 AC_USE_SYSTEM_EXTENSIONS
27 AC_PROG_CC
28 AC_PROG_CC_C99
29 AM_PROG_CC_C_O
30 AC_PROG_SED
31 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
32
33 LT_PREREQ(2.2)
34 LT_INIT
35
36 #
37 # pkg-config dependencies
38 # This unconditionally checks for all dependencies even if they are disabled. We
39 # later look whether all required depedencies are met and finish the
40 # configuration. We group similar packages into one logical group here to avoid
41 # having variables for each single library.
42 # This, however, makes ./configure output very unintuitive error messages if a
43 # package is not found so we must make sure we print more verbose messages
44 # ourself.
45 #
46
47 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
48                   [have_xkbcommon=yes], [have_xkbcommon=no])
49 AC_SUBST(XKBCOMMON_CFLAGS)
50 AC_SUBST(XKBCOMMON_LIBS)
51
52 PKG_CHECK_MODULES([WAYLAND], [wayland-client wayland-server wayland-cursor],
53                   [have_wayland=yes], [have_wayland=no])
54 AC_SUBST(WAYLAND_CFLAGS)
55 AC_SUBST(WAYLAND_LIBS)
56
57 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-daemon libsystemd-login],
58                   [have_systemd=yes], [have_systemd=no])
59 AC_SUBST(SYSTEMD_CFLAGS)
60 AC_SUBST(SYSTEMD_LIBS)
61
62 PKG_CHECK_MODULES([UDEV], [libudev >= 172],
63                   [have_udev=yes], [have_udev=no])
64 AC_SUBST(UDEV_CFLAGS)
65 AC_SUBST(UDEV_LIBS)
66
67 PKG_CHECK_MODULES([DBUS], [dbus-1],
68                   [have_dbus=yes], [have_dbus=no])
69 AC_SUBST(DBUS_CFLAGS)
70 AC_SUBST(DBUS_LIBS)
71
72 PKG_CHECK_MODULES([DRM], [libdrm],
73                   [have_drm=yes], [have_drm=no])
74 AC_SUBST(DRM_CFLAGS)
75 AC_SUBST(DRM_LIBS)
76
77 PKG_CHECK_MODULES([GBM], [gbm],
78                   [have_gbm=yes], [have_gbm=no])
79 AC_SUBST(GBM_CFLAGS)
80 AC_SUBST(GBM_LIBS)
81
82 PKG_CHECK_MODULES([EGL], [egl],
83                   [have_egl=yes], [have_egl=no])
84 AC_SUBST(EGL_CFLAGS)
85 AC_SUBST(EGL_LIBS)
86
87 PKG_CHECK_MODULES([GLES2], [glesv2],
88                   [have_gles2=yes], [have_gles2=no])
89 AC_SUBST(GLES2_CFLAGS)
90 AC_SUBST(GLES2_LIBS)
91
92 PKG_CHECK_MODULES([FREETYPE2], [freetype2 fontconfig],
93                   [have_freetype2=yes], [have_freetype2=no])
94 AC_SUBST(FREETYPE2_CFLAGS)
95 AC_SUBST(FREETYPE2_LIBS)
96
97 PKG_CHECK_MODULES([PANGO], [pango pangoft2],
98                   [have_pango=yes], [have_pango=no])
99 AC_SUBST(PANGO_CFLAGS)
100 AC_SUBST(PANGO_LIBS)
101
102 PKG_CHECK_MODULES([FUSE], [fuse],
103                   [have_fuse=yes], [have_fuse=no])
104 AC_SUBST(FUSE_CFLAGS)
105 AC_SUBST(FUSE_LIBS)
106
107 #
108 # Parse arguments
109 # This parses all arguments that are given via "--enable-XY" or "--with-XY" and
110 # saves the results in local variables. This does not check dependencies or
111 # similar but does only parse the arguments.
112 #
113
114 # eloop
115 AC_MSG_CHECKING([whether user wants eloop])
116 AC_ARG_ENABLE([eloop],
117               [AS_HELP_STRING([--enable-eloop],
118                               [build eloop library])])
119 if test "x$enable_eloop" = "x" ; then
120         enable_eloop="no (default)"
121 fi
122 AC_MSG_RESULT([$enable_eloop])
123
124 # TSM
125 AC_MSG_CHECKING([whether user wants TSM])
126 AC_ARG_ENABLE([tsm],
127               [AS_HELP_STRING([--enable-tsm],
128                               [build tsm library])])
129 if test "x$enable_tsm" = "x" ; then
130         enable_tsm="no (default)"
131 fi
132 AC_MSG_RESULT([$enable_tsm])
133
134 # uterm
135 AC_MSG_CHECKING([whether user wants uterm])
136 AC_ARG_ENABLE([uterm],
137               [AS_HELP_STRING([--enable-uterm],
138                               [build uterm library])])
139 if test "x$enable_uterm" = "x" ; then
140         enable_uterm="no (default)"
141 fi
142 AC_MSG_RESULT([$enable_uterm])
143
144 # kmscon
145 AC_MSG_CHECKING([whether user wants kmscon])
146 AC_ARG_ENABLE([kmscon],
147               [AS_HELP_STRING([--disable-kmscon],
148                               [do not build kmscon])])
149 if test "x$enable_kmscon" = "x" ; then
150         enable_kmscon="yes (default)"
151 fi
152 AC_MSG_RESULT([$enable_kmscon])
153
154 # wlterm
155 AC_MSG_CHECKING([whether user wants wlterm])
156 AC_ARG_ENABLE([wlterm],
157               [AS_HELP_STRING([--enable-wlterm],
158                               [build wlterm])])
159 if test "x$enable_wlterm" = "x" ; then
160         enable_wlterm="no (default)"
161 fi
162 AC_MSG_RESULT([$enable_wlterm])
163
164 # debug
165 AC_MSG_CHECKING([whether to build with debugging on])
166 AC_ARG_ENABLE([debug],
167               [AS_HELP_STRING([--enable-debug],
168                               [whether to build with debugging on])])
169 if test "x$enable_debug" = "x" ; then
170         enable_debug="yes (default)"
171 fi
172 AC_MSG_RESULT([$enable_debug])
173
174 # optimizations
175 AC_MSG_CHECKING([whether to disable code optimizations])
176 AC_ARG_ENABLE([optimizations],
177               [AS_HELP_STRING([--disable-optimizations],
178                               [whether to disable code optimizations])])
179 if test "x$enable_optimizations" = "x" ; then
180         enable_optimizations="yes (default)"
181 fi
182 AC_MSG_RESULT([$enable_optimizations])
183
184 # multi-seat
185 AC_MSG_CHECKING([whether user wants systemd for multi-seat support])
186 AC_ARG_ENABLE([multi-seat],
187               [AS_HELP_STRING([--enable-multi-seat],
188                               [enable multi-seat support with systemd])])
189 if test "x$enable_multi_seat" = "x" ; then
190         enable_multi_seat="yes (default)"
191 fi
192 AC_MSG_RESULT([$enable_multi_seat])
193
194 # hotplug
195 AC_MSG_CHECKING([whether user wants udev for device hotplug support])
196 AC_ARG_ENABLE([hotplug],
197               [AS_HELP_STRING([--enable-hotplug],
198                               [enable device hotplug support with udev])])
199 if test "x$enable_hotplug" = "x" ; then
200         enable_hotplug="yes (default)"
201 fi
202 AC_MSG_RESULT([$enable_hotplug])
203
204 # eloop-dbus
205 AC_MSG_CHECKING([whether user wants eloop dbus support])
206 AC_ARG_ENABLE([eloop-dbus],
207               [AS_HELP_STRING([--enable-eloop-dbus],
208                               [enable eloop dbus support])])
209 if test "x$enable_eloop_dbus" = "x" ; then
210         enable_eloop_dbus="no (default)"
211 fi
212 AC_MSG_RESULT([$enable_eloop_dbus])
213
214 # video backends
215 AC_MSG_CHECKING([which video backends the user wants])
216 AC_ARG_WITH([video],
217             [AS_HELP_STRING([--with-video],
218               [specify list of optional video backends])])
219 enable_video_fbdev="no"
220 enable_video_dumb="no"
221 enable_video_drm="no"
222 if test "x$with_video" = "x" ; then
223         enable_video_fbdev="yes (default)"
224         enable_video_dumb="yes (default)"
225         enable_video_drm="yes (default)"
226         with_video="fbdev,dumb,drm (default)"
227 else
228         SAVEIFS="$IFS"
229         IFS=","
230         for i in $with_video ; do
231                 if test "x$i" = "xfbdev" ; then
232                         enable_video_fbdev="yes"
233                 elif test "x$i" = "xdumb" ; then
234                         enable_video_dumb="yes"
235                 elif test "x$i" = "xdrm" ; then
236                         enable_video_drm="yes"
237                 else
238                         IFS="$SAVEIFS"
239                         AC_ERROR([Invalid video backend $i])
240                 fi
241         done
242         IFS="$SAVEIFS"
243 fi
244 AC_MSG_RESULT([$with_video])
245
246 # renderers
247 AC_MSG_CHECKING([which render backends the user wants])
248 AC_ARG_WITH([renderers],
249             [AS_HELP_STRING([--with-renderers],
250               [specify list of optional render backends])])
251 enable_renderer_bbulk="no"
252 enable_renderer_gltex="no"
253 if test "x$with_renderers" = "x" ; then
254         enable_renderer_bbulk="yes (default)"
255         enable_renderer_gltex="yes (default)"
256         with_renderers="bbulk,gltex (default)"
257 else
258         SAVEIFS="$IFS"
259         IFS=","
260         for i in $with_renderers ; do
261                 if test "x$i" = "xbbulk" ; then
262                         enable_renderer_bbulk="yes"
263                 elif test "x$i" = "xgltex" ; then
264                         enable_renderer_gltex="yes"
265                 else
266                         IFS="$SAVEIFS"
267                         AC_ERROR([Unknown renderer $i])
268                 fi
269         done
270         IFS="$SAVEIFS"
271 fi
272 AC_MSG_RESULT([$with_renderers])
273
274 # font backends
275 AC_MSG_CHECKING([which font backends the user wants])
276 AC_ARG_WITH([fonts],
277             [AS_HELP_STRING([--with-fonts],
278               [specify list of optional font backends])])
279 enable_font_unifont="no"
280 enable_font_freetype2="no"
281 enable_font_pango="no"
282 if test "x$with_fonts" = "x" ; then
283         enable_font_unifont="no (default)"
284         enable_font_freetype2="no (default)"
285         enable_font_pango="yes (default)"
286         with_fonts="freetype2,pango (default)"
287 else
288         SAVEIFS="$IFS"
289         IFS=","
290         for i in $with_fonts ; do
291                 if test "x$i" = "xunifont" ; then
292                         enable_font_unifont="yes"
293                 elif test "x$i" = "xfreetype2" ; then
294                         enable_font_freetype2="yes"
295                 elif test "x$i" = "xpango" ; then
296                         enable_font_pango="yes"
297                 else
298                         IFS="$SAVEIFS"
299                         AC_ERROR([Unknown font backend $i])
300                 fi
301         done
302         IFS="$SAVEIFS"
303 fi
304 AC_MSG_RESULT([$with_fonts])
305
306 # kmscon sessions
307 AC_MSG_CHECKING([which sessions the user wants])
308 AC_ARG_WITH([sessions],
309             [AS_HELP_STRING([--with-sessions],
310               [specify list of optional sessions])])
311 enable_session_dummy="no"
312 enable_session_terminal="no"
313 enable_session_cdev="no"
314 if test "x$with_sessions" = "x" ; then
315         enable_session_dummy="yes (default)"
316         enable_session_terminal="yes (default)"
317         enable_session_cdev="yes (default)"
318         with_sessions="dummy,terminal,cdev (default)"
319 else
320         SAVEIFS="$IFS"
321         IFS=","
322         for i in $with_sessions ; do
323                 if test "x$i" = "xdummy" ; then
324                         enable_session_dummy="yes"
325                 elif test "x$i" = "xterminal" ; then
326                         enable_session_terminal="yes"
327                 elif test "x$i" = "xcdev" ; then
328                         enable_session_cdev="yes"
329                 else
330                         IFS="$SAVEIFS"
331                         AC_ERROR([Unknown session type $i])
332                 fi
333         done
334         IFS="$SAVEIFS"
335 fi
336 AC_MSG_RESULT([$with_sessions])
337
338 #
339 # Check what can be built
340 # This checks each configuration option and tests whether all dependencies are
341 # met. This is done from bottom up to ensure the right order.
342 #
343
344 # debug
345 debug_avail=no
346 debug_missing=""
347 if test ! "x$enable_debug" = "xno" ; then
348         debug_avail=yes
349 else
350         debug_missing="enable-debug"
351 fi
352
353 # optimizations
354 optimizations_avail=no
355 optimizations_missing=""
356 if test ! "x$enable_optimizations" = "xno" ; then
357         optimizations_avail=yes
358 else
359         optimizations_missing="enable-optimizations"
360 fi
361
362 # eloop-dbus
363 eloop_dbus_avail=no
364 eloop_dbus_missing=""
365 if test ! "x$enable_eloop_dbus" = "xno" ; then
366         eloop_dbus_avail=yes
367         if test "x$have_dbus" = "xno" ; then
368                 eloop_dbus_avail=no
369                 eloop_dbus_missing="libdbus"
370         fi
371
372         if test "x$eloop_dbus_avail" = "xno" ; then
373                 if test "x$enable_eloop_dbus" = "xyes" ; then
374                         AC_ERROR([missing for eloop-dbus: $eloop_dbus_missing])
375                 fi
376         fi
377 else
378         eloop_dbus_missing="enable-eloop-dbus"
379 fi
380
381 # eloop
382 eloop_avail=no
383 eloop_missing=""
384 if test ! "x$enable_eloop" = "xno" ; then
385         eloop_avail=yes
386 else
387         eloop_missing="enable-eloop"
388 fi
389
390 # TSM
391 tsm_avail=no
392 tsm_missing=""
393 if test ! "x$enable_tsm" = "xno" ; then
394         tsm_avail=yes
395         if test "x$have_xkbcommon" = "xno" ; then
396                 tsm_avail=no
397                 tsm_missing="libxkbcommon"
398         fi
399
400         if test "x$tsm_avail" = "xno" ; then
401                 if test "x$enable_tsm" = "xyes" ; then
402                         AC_ERROR([missing for TSM: $tsm_missing])
403                 fi
404         fi
405 else
406         tsm_missing="enable-tsm"
407 fi
408
409 # video fbdev
410 video_fbdev_avail=no
411 video_fbdev_missing=""
412 if test ! "x$enable_video_fbdev" = "xno" ; then
413         # TODO: check for kernel headers
414         video_fbdev_avail=yes
415 else
416         video_fbdev_missing="enable-video-fbdev"
417 fi
418
419 # video dumb
420 video_dumb_avail=no
421 video_dumb_missing=""
422 if test ! "x$enable_video_dumb" = "xno" ; then
423         video_dumb_avail=yes
424         if test "x$have_drm" = "xno" ; then
425                 video_dumb_avail=no
426                 video_dumb_missing="libdrm"
427         fi
428
429         if test "x$video_dumb_avail" = "xno" ; then
430                 if test "x$enable_video_dumb" = "xyes" ; then
431                         AC_ERROR([missing for dumb video backend: $video_dumb_missing])
432                 fi
433         fi
434 else
435         video_dumb_missing="enable-video-dumb"
436 fi
437
438 # video drm
439 video_drm_avail=no
440 video_drm_missing=""
441 if test ! "x$enable_video_drm" = "xno" ; then
442         video_drm_avail=yes
443         if test "x$have_drm" = "xno" ; then
444                 video_drm_avail=no
445                 video_drm_missing="libdrm,$video_drm_missing"
446         fi
447         if test "x$have_gbm" = "xno" ; then
448                 video_drm_avail=no
449                 video_drm_missing="libgbm,$video_drm_missing"
450         fi
451         if test "x$have_egl" = "xno" ; then
452                 video_drm_avail=no
453                 video_drm_missing="libegl,$video_drm_missing"
454         fi
455         if test "x$have_gles2" = "xno" ; then
456                 video_drm_avail=no
457                 video_drm_missing="libgles2,$video_drm_missing"
458         fi
459
460         if test "x$video_drm_avail" = "xno" ; then
461                 if test "x$enable_video_drm" = "xyes" ; then
462                         AC_ERROR([missing for drm video backend: $video_drm_missing])
463                 fi
464         fi
465 else
466         video_drm_missing="enable-video-drm"
467 fi
468
469 # uterm
470 uterm_avail=no
471 uterm_missing=""
472 if test ! "x$enable_uterm" = "xno" ; then
473         uterm_avail=yes
474 else
475         uterm_missing="enable-uterm"
476 fi
477
478 # multi-seat
479 multi_seat_avail=no
480 multi_seat_missing=""
481 if test ! "x$enable_multi_seat" = "xno" ; then
482         multi_seat_avail=yes
483         if test "x$have_systemd" = "xno" ; then
484                 multi_seat_avail=no
485                 multi_seat_missing="libsystemd"
486         fi
487
488         if test "x$multi_seat_avail" = "xno" ; then
489                 if test "x$enable_multi_seat" = "xyes" ; then
490                         AC_ERROR([missing for multi-seat support: $multi_seat_missing])
491                 fi
492         fi
493 else
494         multi_seat_missing="enable-multi-seat"
495 fi
496
497 # hotplug
498 hotplug_avail=no
499 hotplug_missing=""
500 if test ! "x$enable_hotplug" = "xno" ; then
501         hotplug_avail=yes
502         if test "x$have_udev" = "xno" ; then
503                 hotplug_avail=no
504                 hotplug_missing="libudev"
505         fi
506
507         if test "x$hotplug_avail" = "xno" ; then
508                 if test "x$enable_hotplug" = "xyes" ; then
509                         AC_ERROR([missing for hotplug-support: $hotplug_missing])
510                 fi
511         fi
512 else
513         hotplug_missing="enable-hotplug"
514 fi
515
516 # renderer bbulk
517 renderer_bbulk_avail=no
518 renderer_bbulk_missing=""
519 if test ! "x$enable_renderer_bbulk" = "xno" ; then
520         renderer_bbulk_avail=yes
521 else
522         renderer_bbulk_missing="enable-renderer-bbulk"
523 fi
524
525 # renderer gltex
526 renderer_gltex_avail=no
527 renderer_gltex_missing=""
528 if test ! "x$enable_renderer_gltex" = "xno" ; then
529         renderer_gltex_avail=yes
530         if test "x$have_gles2" = "xno" ; then
531                 renderer_gltex_avail=no
532                 renderer_gltex_missing="libgles2"
533         fi
534
535         if test "x$renderer_gltex_avail" = "xno" ; then
536                 if test "x$enable_renderer_gltex" = "xyes" ; then
537                         AC_ERROR([missing for renderer-gltex: $renderer_gltex_missing])
538                 fi
539         fi
540 else
541         renderer_gltex_missing="enable-renderer-gltex"
542 fi
543
544 # font unifont
545 font_unifont_avail=no
546 font_unifont_missing=""
547 if test ! "x$enable_font_unifont" = "xno" ; then
548         font_unifont_avail=yes
549 else
550         font_unifont_missing="enable-font-unifont"
551 fi
552
553 # font freetype2
554 font_freetype2_avail=no
555 font_freetype2_missing=""
556 if test ! "x$enable_font_freetype2" = "xno" ; then
557         font_freetype2_avail=yes
558         if test "x$have_freetype2" = "xno" ; then
559                 font_freetype2_avail=no
560                 font_freetype2_missing="libfontconfig,libfreetype2"
561         fi
562
563         if test "x$font_freetype2_avail" = "xno" ; then
564                 if test "x$enable_font_freetype2" = "xyes" ; then
565                         AC_ERROR([missing for font-freetype2: $font_freetype2_missing])
566                 fi
567         fi
568 else
569         font_freetype2_missing="enable-font-freetype2"
570 fi
571
572 # font pango
573 font_pango_avail=no
574 font_pango_missing=""
575 if test ! "x$enable_font_pango" = "xno" ; then
576         font_pango_avail=yes
577         if test "x$have_pango" = "xno" ; then
578                 font_pango_avail=no
579                 font_pango_missing="libpango"
580         fi
581
582         if test "x$font_pango_avail" = "xno" ; then
583                 if test "x$enable_font_pango" = "xyes" ; then
584                         AC_ERROR([missing for font-pango: $font_pango_missing])
585                 fi
586         fi
587 else
588         font_pango_missing="enable-font-pango"
589 fi
590
591 # session dummy
592 session_dummy_avail=no
593 session_dummy_missing=""
594 if test ! "x$enable_session_dummy" = "xno" ; then
595         session_dummy_avail=yes
596 else
597         session_dummy_missing="enable-session-dummy"
598 fi
599
600 # session terminal
601 session_terminal_avail=no
602 session_terminal_missing=""
603 if test ! "x$enable_session_terminal" = "xno" ; then
604         session_terminal_avail=yes
605         if test "x$tsm_avail" = "xno" ; then
606                 session_terminal_avail=no
607                 session_terminal_missing="$tsm_missing"
608         fi
609
610         if test "x$session_terminal_avail" = "xno" ; then
611                 if test "x$enable_session_terminal" = "xyes" ; then
612                         AC_ERROR([missing for session-terminal: $session_terminal_missing])
613                 fi
614         fi
615 else
616         session_terminal_missing="enable-session-terminal"
617 fi
618
619 # session cdev
620 session_cdev_avail=no
621 session_cdev_missing=""
622 if test ! "x$enable_session_cdev" = "xno" ; then
623         session_cdev_avail=yes
624         if test "x$have_fuse" = "xno" ; then
625                 session_cdev_avail=no
626                 session_cdev_missing="libfuse,$session_cdev_missing"
627         fi
628
629         if test "x$tsm_avail" = "xno" ; then
630                 session_cdev_avail=no
631                 session_cdev_missing="$tsm_missing,$session_cdev_missing"
632         fi
633
634         if test "x$session_cdev_avail" = "xno" ; then
635                 if test "x$enable_session_cdev" = "xyes" ; then
636                         AC_ERROR([missing for session-cdev: $session_cdev_missing])
637                 fi
638         fi
639 else
640         session_cdev_missing="enable-session-cdev"
641 fi
642
643 # kmscon
644 kmscon_avail=no
645 kmscon_missing=""
646 if test ! "x$enable_kmscon" = "xno" ; then
647         kmscon_avail=yes
648         if test "x$eloop_avail" = "xno" ; then
649                 kmscon_avail=no
650                 kmscon_missing="$eloop_missing,$kmscon_missing"
651         fi
652
653         if test "x$tsm_avail" = "xno" ; then
654                 kmscon_avail=no
655                 kmscon_missing="$tsm_missing,$kmscon_missing"
656         fi
657
658         if test "x$uterm_avail" = "xno" ; then
659                 kmscon_avail=no
660                 kmscon_missing="$uterm_missing,$kmscon_missing"
661         fi
662
663         if test "x$kmscon_avail" = "xno" ; then
664                 if test "x$enable_kmscon" = "xyes" ; then
665                         AC_ERROR([missing for kmscon: $kmscon_missing])
666                 fi
667         fi
668 else
669         kmscon_missing="enable-kmscon"
670 fi
671
672 # wlterm
673 wlterm_avail=no
674 wlterm_missing=""
675 if test ! "x$enable_wlterm" = "xno" ; then
676         wlterm_avail=yes
677         if test "x$tsm_avail" = "xno" ; then
678                 wlterm_avail=no
679                 wlterm_missing="$tsm_missing,$wlterm_missing"
680         fi
681
682         if test "x$eloop_avail" = "xno" ; then
683                 wlterm_avail=no
684                 wlterm_missing="$eloop_missing,$wlterm_missing"
685         fi
686
687         if test "x$have_wayland" = "xno" ; then
688                 wlterm_avail=no
689                 wlterm_missing="libwayland,$wlterm_missing"
690         fi
691
692         if test "x$wlterm_avail" = "xno" ; then
693                 if test "x$enable_wlterm" = "xyes" ; then
694                         AC_ERROR([missing for wlterm: $wlterm_missing])
695                 fi
696         fi
697 else
698         wlterm_missing="enable-wlterm"
699 fi
700
701 #
702 # Enable all required modules
703 # We now know which modules can be built by checking the *_avail variables set
704 # above. We now only have to disable all modules that are disabled by default
705 # and the user didn't force-enable them and no other module that is enabled
706 # needs them. This is done top-down of course.
707 #
708
709 # wlterm
710 wlterm_enabled=no
711 if test "x$wlterm_avail" = "xyes" ; then
712         if test "x${enable_wlterm% *}" = "xyes" ; then
713                 wlterm_enabled=yes
714                 enable_eloop=yes
715                 enable_tsm=yes
716         fi
717 fi
718
719 # kmscon
720 kmscon_enabled=no
721 if test "x$kmscon_avail" = "xyes" ; then
722         if test "x${enable_kmscon% *}" = "xyes" ; then
723                 kmscon_enabled=yes
724                 enable_eloop=yes
725                 enable_uterm=yes
726         fi
727 fi
728
729 # session cdev
730 session_cdev_enabled=no
731 if test "x$session_cdev_avail" = "xyes" ; then
732         if test "x${enable_session_cdev% *}" = "xyes" ; then
733                 session_cdev_enabled=yes
734         fi
735 fi
736
737 # session terminal
738 session_terminal_enabled=no
739 if test "x$session_terminal_avail" = "xyes" ; then
740         if test "x${enable_session_terminal% *}" = "xyes" ; then
741                 session_terminal_enabled=yes
742                 enable_tsm=yes
743         fi
744 fi
745
746 # session dummy
747 session_dummy_enabled=no
748 if test "x$session_dummy_avail" = "xyes" ; then
749         if test "x${enable_session_dummy% *}" = "xyes" ; then
750                 session_dummy_enabled=yes
751         fi
752 fi
753
754 # font pango
755 font_pango_enabled=no
756 if test "x$font_pango_avail" = "xyes" ; then
757         if test "x${enable_font_pango% *}" = "xyes" ; then
758                 font_pango_enabled=yes
759         fi
760 fi
761
762 # font freetype2
763 font_freetype2_enabled=no
764 if test "x$font_freetype2_avail" = "xyes" ; then
765         if test "x${enable_font_freetype2% *}" = "xyes" ; then
766                 font_freetype2_enabled=yes
767         fi
768 fi
769
770 # font unifont
771 font_unifont_enabled=no
772 if test "x$font_unifont_avail" = "xyes" ; then
773         if test "x${enable_font_unifont% *}" = "xyes" ; then
774                 font_unifont_enabled=yes
775         fi
776 fi
777
778 # renderer gltex
779 renderer_gltex_enabled=no
780 if test "x$renderer_gltex_avail" = "xyes" ; then
781         if test "x${enable_renderer_gltex% *}" = "xyes" ; then
782                 renderer_gltex_enabled=yes
783         fi
784 fi
785
786 # renderer bbulk
787 renderer_bbulk_enabled=no
788 if test "x$renderer_bbulk_avail" = "xyes" ; then
789         if test "x${enable_renderer_bbulk% *}" = "xyes" ; then
790                 renderer_bbulk_enabled=yes
791         fi
792 fi
793
794 # hotplug
795 hotplug_enabled=no
796 if test "x$hotplug_avail" = "xyes" ; then
797         if test "x${enable_hotplug% *}" = "xyes" ; then
798                 hotplug_enabled=yes
799         fi
800 fi
801
802 # multi-seat
803 multi_seat_enabled=no
804 if test "x$multi_seat_avail" = "xyes" ; then
805         if test "x${enable_multi_seat% *}" = "xyes" ; then
806                 multi_seat_enabled=yes
807         fi
808 fi
809
810 # uterm
811 uterm_enabled=no
812 if test "x$uterm_avail" = "xyes" ; then
813         if test "x${enable_uterm% *}" = "xyes" ; then
814                 uterm_enabled=yes
815         fi
816 fi
817
818 # video drm
819 video_drm_enabled=no
820 if test "x$video_drm_avail" = "xyes" ; then
821         if test "x${enable_video_drm% *}" = "xyes" ; then
822                 video_drm_enabled=yes
823         fi
824 fi
825
826 # video dumb
827 video_dumb_enabled=no
828 if test "x$video_dumb_avail" = "xyes" ; then
829         if test "x${enable_video_dumb% *}" = "xyes" ; then
830                 video_dumb_enabled=yes
831         fi
832 fi
833
834 # video fbdev
835 video_fbdev_enabled=no
836 if test "x$video_fbdev_avail" = "xyes" ; then
837         if test "x${enable_video_fbdev% *}" = "xyes" ; then
838                 video_fbdev_enabled=yes
839         fi
840 fi
841
842 # tsm
843 tsm_enabled=no
844 if test "x$tsm_avail" = "xyes" ; then
845         if test "x${enable_tsm% *}" = "xyes" ; then
846                 tsm_enabled=yes
847         fi
848 fi
849
850 # eloop
851 eloop_enabled=no
852 if test "x$eloop_avail" = "xyes" ; then
853         if test "x${enable_eloop% *}" = "xyes" ; then
854                 eloop_enabled=yes
855         fi
856 fi
857
858 # eloop-dbus
859 eloop_dbus_enabled=no
860 if test "x$eloop_dbus_avail" = "xyes" ; then
861         if test "x${enable_eloop_dbus% *}" = "xyes" ; then
862                 eloop_dbus_enabled=yes
863         fi
864 fi
865
866 # optimizations
867 optimizations_enabled=no
868 if test "x$optimizations_avail" = "xyes" ; then
869         if test "x${enable_optimizations% *}" = "xyes" ; then
870                 optimizations_enabled=yes
871         fi
872 fi
873
874 # debug
875 debug_enabled=no
876 if test "x$debug_avail" = "xyes" ; then
877         if test "x${enable_debug% *}" = "xyes" ; then
878                 debug_enabled=yes
879         fi
880 fi
881
882 #
883 # Module Configuration
884 # We have now done all dependency checking and default-value validation and we
885 # now know which modules are enabled via the *_enabled variables.
886 # Everything below is related to the configuration of each module and setting
887 # the correct flags for the build process.
888 #
889
890 # debug
891 if test "x$debug_enabled" = "xyes" ; then
892         AC_DEFINE([BUILD_ENABLE_DEBUG], [1], [Enable debug mode])
893 else
894         AC_DEFINE([NDEBUG], [1], [No Debug])
895 fi
896
897 AM_CONDITIONAL([BUILD_ENABLE_DEBUG],
898                [test "x$debug_enabled" = "xyes"])
899
900 # optimizations
901 AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
902                [test "x$optimizations_enabled" = "xyes"])
903
904 # eloop-dbus
905 AM_CONDITIONAL([BUILD_ENABLE_ELOOP_DBUS],
906                [test "x$eloop_dbus_enabled" = "xyes"])
907
908 # eloop
909 AM_CONDITIONAL([BUILD_ENABLE_ELOOP],
910                [test "x$eloop_enabled" = "xyes"])
911
912 # TSM
913 AM_CONDITIONAL([BUILD_ENABLE_TSM],
914                [test "x$tsm_enabled" = "xyes"])
915
916 # video fbdev
917 if test "x$video_fbdev_enabled" = "xyes" ; then
918         AC_DEFINE([BUILD_ENABLE_VIDEO_FBDEV], [1],
919                   [Build uterm fbdev video backend])
920 fi
921
922 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_FBDEV],
923                [test "x$video_fbdev_enabled" = "xyes"])
924
925 # video dumb
926 if test "x$video_dumb_enabled" = "xyes" ; then
927         AC_DEFINE([BUILD_ENABLE_VIDEO_DUMB], [1],
928                   [Build uterm dumb drm video backend])
929 fi
930
931 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_DUMB],
932                [test "x$video_dumb_enabled" = "xyes"])
933
934 # video drm
935 if test "x$video_drm_enabled" = "xyes" ; then
936         AC_DEFINE([BUILD_ENABLE_VIDEO_DRM], [1],
937                   [Build uterm drm video backend])
938 fi
939
940 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_DRM],
941                [test "x$video_drm_enabled" = "xyes"])
942
943 # uterm
944 AM_CONDITIONAL([BUILD_ENABLE_UTERM],
945                [test "x$uterm_enabled" = "xyes"])
946
947 # multi-seat
948 if test "x$multi_seat_enabled" = "xyes" ; then
949         AC_DEFINE([BUILD_ENABLE_MULTI_SEAT], [1],
950                   [Use systemd for multi-seat support])
951 fi
952
953 AM_CONDITIONAL([BUILD_ENABLE_MULTI_SEAT],
954                [test "x$multi_seat_enabled" = "xyes"])
955
956 # hotplug
957 if test "x$hotplug_enabled" = "xyes" ; then
958         AC_DEFINE([BUILD_ENABLE_HOTPLUG], [1],
959                   [Use udev for hotplug support])
960 fi
961
962 AM_CONDITIONAL([BUILD_ENABLE_HOTPLUG],
963                [test "x$hotplug_enabled" = "xyes"])
964
965 # renderer bbulk
966 if test "x$renderer_bbulk_enabled" = "xyes" ; then
967         AC_DEFINE([BUILD_ENABLE_RENDERER_BBULK], [1],
968                   [Build bbulk rendering backend])
969 fi
970
971 AM_CONDITIONAL([BUILD_ENABLE_RENDERER_BBULK],
972                [test "x$renderer_bbulk_enabled" = "xyes"])
973
974 # renderer gltex
975 if test "x$renderer_gltex_enabled" = "xyes" ; then
976         AC_DEFINE([BUILD_ENABLE_RENDERER_GLTEX], [1],
977                   [Build gltex rendering backend])
978 fi
979
980 AM_CONDITIONAL([BUILD_ENABLE_RENDERER_GLTEX],
981                [test "x$renderer_gltex_enabled" = "xyes"])
982
983 # font unifont
984 if test "x$font_unifont_enabled" = "xyes" ; then
985         AC_DEFINE([BUILD_ENABLE_FONT_UNIFONT], [1],
986                   [Build static unifont backend])
987 fi
988
989 AM_CONDITIONAL([BUILD_ENABLE_FONT_UNIFONT],
990                [test "x$font_unifont_enabled" = "xyes"])
991
992 # font freetype2
993 if test "x$font_freetype2_enabled" = "xyes" ; then
994         AC_DEFINE([BUILD_ENABLE_FONT_FREETYPE2], [1],
995                   [Build freetype2 font backend])
996 fi
997
998 AM_CONDITIONAL([BUILD_ENABLE_FONT_FREETYPE2],
999                [test "x$font_freetype2_enabled" = "xyes"])
1000
1001 # font pango
1002 if test "x$font_pango_enabled" = "xyes" ; then
1003         AC_DEFINE([BUILD_ENABLE_FONT_PANGO], [1],
1004                   [Build pango font backend])
1005 fi
1006
1007 AM_CONDITIONAL([BUILD_ENABLE_FONT_PANGO],
1008                [test "x$font_pango_enabled" = "xyes"])
1009
1010 # session dummy
1011 if test "x$session_dummy_enabled" = "xyes" ; then
1012         AC_DEFINE([BUILD_ENABLE_SESSION_DUMMY], [1],
1013                   [Build dummy session])
1014 fi
1015
1016 AM_CONDITIONAL([BUILD_ENABLE_SESSION_DUMMY],
1017                [test "x$session_dummy_enabled" = "xyes"])
1018
1019 # session terminal
1020 if test "x$session_terminal_enabled" = "xyes" ; then
1021         AC_DEFINE([BUILD_ENABLE_SESSION_TERMINAL], [1],
1022                   [Build terminal session])
1023 fi
1024
1025 AM_CONDITIONAL([BUILD_ENABLE_SESSION_TERMINAL],
1026                [test "x$session_terminal_enabled" = "xyes"])
1027
1028 # session cdev
1029 if test "x$session_cdev_enabled" = "xyes" ; then
1030         AC_DEFINE([BUILD_ENABLE_SESSION_CDEV], [1],
1031                   [Build cdev session])
1032 fi
1033
1034 AM_CONDITIONAL([BUILD_ENABLE_SESSION_CDEV],
1035                [test "x$session_cdev_enabled" = "xyes"])
1036
1037 # kmscon
1038 AM_CONDITIONAL([BUILD_ENABLE_KMSCON],
1039                [test "x$kmscon_enabled" = "xyes"])
1040
1041 # wlterm
1042 AM_CONDITIONAL([BUILD_ENABLE_WLTERM],
1043                [test "x$wlterm_enabled" = "xyes"])
1044
1045 #
1046 # Miscellaneous Checks
1047 # All checks below are independent of module checking or depend on the results
1048 # of it. They do not have any dependencies themself so they are not part of the
1049 # module infrastructure.
1050 #
1051
1052 # check for _Static_assert
1053 AC_MSG_CHECKING([whether _Static_assert() is supported])
1054 AC_LANG([C])
1055 have_static_assert=yes
1056 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[_Static_assert(1, "What?");]])],
1057                   [AC_DEFINE([BUILD_HAVE_STATIC_ASSERT],
1058                              [1],
1059                              [Define to 1 if _Static_assert() is supported])],
1060                   [have_static_assert=no])
1061 AC_MSG_RESULT([$have_static_assert])
1062
1063 # check for gbm_bo_get_pitch() function, otherwise gbm_bo_get_stride() is used
1064 if test x$have_gbm = xyes ; then
1065         save_CFLAGS="$CFLAGS"
1066         save_LIBS="$LIBS"
1067         save_LDFLAGS="$LDFLAGS"
1068         CFLAGS="$DRM_CFLAGS $GBM_CFLAGS"
1069         LIBS="$DRM_LIBS $GBM_LIBS"
1070         LDFLAGS=""
1071         AC_CHECK_LIB([gbm],
1072                      [gbm_bo_get_pitch],
1073                      [AC_DEFINE([BUILD_HAVE_GBM_BO_GET_PITCH],
1074                                 [1],
1075                                 [Define to 1 if your libgbm provides gbm_bo_get_pitch])])
1076         CFLAGS="$save_CFLAGS"
1077         LIBS="$save_LIBS"
1078         LDFLAGS="$save_LDFLAGS"
1079 fi
1080
1081 # check for xsltproc
1082 AC_PATH_PROG(XSLTPROC, xsltproc)
1083 AM_CONDITIONAL([BUILD_HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
1084
1085 # check for offline man-pages stylesheet
1086 AC_MSG_CHECKING([for docbook manpages stylesheet])
1087 BUILD_MANPAGES_STYLESHEET="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
1088 AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
1089                             AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$BUILD_MANPAGES_STYLESHEET" > /dev/null 2>&1`],
1090                                   [BUILD_HAVE_MANPAGES_STYLESHEET=yes]))
1091 if test "x$BUILD_HAVE_MANPAGES_STYLESHEET" = "xyes"; then
1092         AM_CONDITIONAL([BUILD_HAVE_MANPAGES_STYLESHEET], true)
1093         AC_SUBST(BUILD_MANPAGES_STYLESHEET)
1094         AC_MSG_RESULT([yes])
1095 else
1096         AM_CONDITIONAL([BUILD_HAVE_MANPAGES_STYLESHEET], false)
1097         AC_MSG_RESULT([no])
1098 fi
1099
1100 #
1101 # Makefile vars
1102 # After everything is configured, we correctly substitute the values for the
1103 # makefiles.
1104 #
1105
1106 AC_CONFIG_FILES([Makefile
1107                  docs/pc/libeloop.pc
1108                  docs/pc/libtsm.pc
1109                  docs/pc/libuterm.pc])
1110 AC_OUTPUT
1111
1112 #
1113 # Configuration output
1114 # Show configuration to the user so they can check whether everything was
1115 # configured as expected.
1116 #
1117
1118 AC_MSG_NOTICE([Build configuration:
1119
1120                prefix: $prefix
1121           exec-prefix: $exec_prefix
1122                libdir: $libdir
1123            includedir: $includedir
1124
1125   Applications and Libraries:
1126                kmscon: $kmscon_enabled ($kmscon_avail: $kmscon_missing)
1127                wlterm: $wlterm_enabled ($wlterm_avail: $wlterm_missing)
1128                 uterm: $uterm_enabled ($uterm_avail: $uterm_missing)
1129                   tsm: $tsm_enabled ($tsm_avail: $tsm_missing)
1130                 eloop: $eloop_enabled ($eloop_avail: $eloop_missing)
1131
1132   Miscellaneous Options:
1133                 debug: $debug_enabled ($debug_avail: $debug_missing)
1134         optimizations: $optimizations_enabled ($optimizations_avail: $optimizations_missing)
1135            multi-seat: $multi_seat_enabled ($multi_seat_avail: $multi_seat_missing)
1136               hotplug: $hotplug_enabled ($hotplug_avail: $hotplug_missing)
1137            eloop-dbus: $eloop_dbus_enabled ($eloop_dbus_avail: $eloop_dbus_missing)
1138
1139   Video Backends:
1140                 fbdev: $video_fbdev_enabled ($video_fbdev_avail: $video_fbdev_missing)
1141              dumb drm: $video_dumb_enabled ($video_dumb_avail: $video_dumb_missing)
1142                   drm: $video_drm_enabled ($video_drm_avail: $video_drm_missing)
1143
1144   Font Backends:
1145               unifont: $font_unifont_enabled ($font_unifont_avail: $font_unifont_missing)
1146             freetype2: $font_freetype2_enabled ($font_freetype2_avail: $font_freetype2_missing)
1147                 pango: $font_pango_enabled ($font_pango_avail: $font_pango_missing)
1148
1149   Renderers:
1150                 bbulk: $renderer_bbulk_enabled ($renderer_bbulk_avail: $renderer_bbulk_missing)
1151                 gltex: $renderer_gltex_enabled ($renderer_gltex_avail: $renderer_gltex_missing)
1152
1153   Session Types:
1154                 dummy: $session_dummy_enabled ($session_dummy_avail: $session_dummy_missing)
1155              terminal: $session_terminal_enabled ($session_terminal_avail: $session_terminal_missing)
1156                  cdev: $session_cdev_enabled ($session_cdev_avail: $session_cdev_missing)
1157
1158         Run "${MAKE-make}" to start compilation process])