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