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