build: link eloop statically
[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 # kmscon
130 AC_MSG_CHECKING([whether user wants kmscon])
131 AC_ARG_ENABLE([kmscon],
132               [AS_HELP_STRING([--disable-kmscon],
133                               [do not build kmscon])])
134 if test "x$enable_all" = "xyes" ; then
135         enable_kmscon="yes"
136 elif test "x$enable_kmscon" = "x" ; then
137         enable_kmscon="yes (default)"
138 fi
139 AC_MSG_RESULT([$enable_kmscon])
140
141 # debug
142 AC_MSG_CHECKING([whether to build with debugging on])
143 AC_ARG_ENABLE([debug],
144               [AS_HELP_STRING([--enable-debug],
145                               [whether to build with debugging on])])
146 if test "x$enable_all" = "xyes" ; then
147         enable_debug="yes"
148 elif test "x$enable_debug" = "x" ; then
149         enable_debug="yes (default)"
150 fi
151 AC_MSG_RESULT([$enable_debug])
152
153 # optimizations
154 AC_MSG_CHECKING([whether to disable code optimizations])
155 AC_ARG_ENABLE([optimizations],
156               [AS_HELP_STRING([--disable-optimizations],
157                               [whether to disable code optimizations])])
158 if test "x$enable_all" = "xyes" ; then
159         enable_optimizations="yes"
160 elif test "x$enable_optimizations" = "x" ; then
161         enable_optimizations="yes (default)"
162 fi
163 AC_MSG_RESULT([$enable_optimizations])
164
165 # multi-seat
166 AC_MSG_CHECKING([whether user wants systemd for multi-seat support])
167 AC_ARG_ENABLE([multi-seat],
168               [AS_HELP_STRING([--enable-multi-seat],
169                               [enable multi-seat support with systemd])])
170 if test "x$enable_all" = "xyes" ; then
171         enable_multi_seat="yes"
172 elif test "x$enable_multi_seat" = "x" ; then
173         enable_multi_seat="yes (default)"
174 fi
175 AC_MSG_RESULT([$enable_multi_seat])
176
177 # hotplug
178 AC_MSG_CHECKING([whether user wants udev for device hotplug support])
179 AC_ARG_ENABLE([hotplug],
180               [AS_HELP_STRING([--enable-hotplug],
181                               [enable device hotplug support with udev])])
182 if test "x$enable_all" = "xyes" ; then
183         enable_hotplug="yes"
184 elif test "x$enable_hotplug" = "x" ; then
185         enable_hotplug="yes (default)"
186 fi
187 AC_MSG_RESULT([$enable_hotplug])
188
189 # video backends
190 AC_MSG_CHECKING([which video backends the user wants])
191 AC_ARG_WITH([video],
192             [AS_HELP_STRING([--with-video],
193               [specify list of optional video backends])],
194             [],
195             [with_video="default"])
196 enable_video_fbdev="no"
197 enable_video_drm2d="no"
198 enable_video_drm3d="no"
199 if test "x$enable_all" = "xyes" ; then
200         enable_video_fbdev="yes"
201         enable_video_drm2d="yes"
202         enable_video_drm3d="yes"
203         with_video="fbdev,drm2d,drm3d (all)"
204 elif test "x$with_video" = "xdefault" ; then
205         enable_video_fbdev="yes (default)"
206         enable_video_drm2d="yes (default)"
207         enable_video_drm3d="yes (default)"
208         with_video="fbdev,drm2d,drm3d (default)"
209 elif test ! "x$with_video" = "x" ; then
210         SAVEIFS="$IFS"
211         IFS=","
212         for i in $with_video ; do
213                 if test "x$i" = "xfbdev" ; then
214                         enable_video_fbdev="yes"
215                 elif test "x$i" = "xdrm2d" ; then
216                         enable_video_drm2d="yes"
217                 elif test "x$i" = "xdrm3d" ; then
218                         enable_video_drm3d="yes"
219                 else
220                         IFS="$SAVEIFS"
221                         AC_ERROR([Invalid video backend $i])
222                 fi
223         done
224         IFS="$SAVEIFS"
225 fi
226 AC_MSG_RESULT([$with_video])
227
228 # renderers
229 AC_MSG_CHECKING([which render backends the user wants])
230 AC_ARG_WITH([renderers],
231             [AS_HELP_STRING([--with-renderers],
232               [specify list of optional render backends])],
233             [],
234             [with_renderers="default"])
235 enable_renderer_bbulk="no"
236 enable_renderer_gltex="no"
237 enable_renderer_pixman="no"
238 if test "x$enable_all" = "xyes" ; then
239         enable_renderer_bbulk="yes"
240         enable_renderer_gltex="yes"
241         enable_renderer_pixman="yes"
242         with_renderers="bbulk,gltex,pixman (all)"
243 elif test "x$with_renderers" = "xdefault" ; then
244         enable_renderer_bbulk="yes (default)"
245         enable_renderer_gltex="yes (default)"
246         enable_renderer_pixman="no (default)"
247         with_renderers="bbulk,gltex (default)"
248 elif test ! "x$with_renderers" = "x" ; then
249         SAVEIFS="$IFS"
250         IFS=","
251         for i in $with_renderers ; do
252                 if test "x$i" = "xbbulk" ; then
253                         enable_renderer_bbulk="yes"
254                 elif test "x$i" = "xgltex" ; then
255                         enable_renderer_gltex="yes"
256                 elif test "x$i" = "xpixman" ; then
257                         enable_renderer_pixman="yes"
258                 else
259                         IFS="$SAVEIFS"
260                         AC_ERROR([Unknown renderer $i])
261                 fi
262         done
263         IFS="$SAVEIFS"
264 fi
265 AC_MSG_RESULT([$with_renderers])
266
267 # font backends
268 AC_MSG_CHECKING([which font backends the user wants])
269 AC_ARG_WITH([fonts],
270             [AS_HELP_STRING([--with-fonts],
271               [specify list of optional font backends])],
272             [],
273             [with_fonts="default"])
274 enable_font_unifont="no"
275 enable_font_pango="no"
276 if test "x$enable_all" = "xyes" ; then
277         enable_font_unifont="yes"
278         enable_font_pango="yes"
279         with_fonts="unifont,pango (all)"
280 elif test "x$with_fonts" = "xdefault" ; then
281         enable_font_unifont="yes (default)"
282         enable_font_pango="yes (default)"
283         with_fonts="unifont,pango (default)"
284 elif test ! "x$with_fonts" = "x" ; then
285         SAVEIFS="$IFS"
286         IFS=","
287         for i in $with_fonts ; do
288                 if test "x$i" = "xunifont" ; then
289                         enable_font_unifont="yes"
290                 elif test "x$i" = "xpango" ; then
291                         enable_font_pango="yes"
292                 else
293                         IFS="$SAVEIFS"
294                         AC_ERROR([Unknown font backend $i])
295                 fi
296         done
297         IFS="$SAVEIFS"
298 fi
299 AC_MSG_RESULT([$with_fonts])
300
301 # kmscon sessions
302 AC_MSG_CHECKING([which sessions the user wants])
303 AC_ARG_WITH([sessions],
304             [AS_HELP_STRING([--with-sessions],
305               [specify list of optional sessions])],
306             [],
307             [with_sessions="default"])
308 enable_session_dummy="no"
309 enable_session_terminal="no"
310 if test "x$enable_all" = "xyes" ; then
311         enable_session_dummy="yes"
312         enable_session_terminal="yes"
313         with_sessions="dummy,terminal (all)"
314 elif test "x$with_sessions" = "xdefault" ; then
315         enable_session_dummy="yes (default)"
316         enable_session_terminal="yes (default)"
317         with_sessions="dummy,terminal (default)"
318 elif test ! "x$with_sessions" = "x" ; then
319         SAVEIFS="$IFS"
320         IFS=","
321         for i in $with_sessions ; do
322                 if test "x$i" = "xdummy" ; then
323                         enable_session_dummy="yes"
324                 elif test "x$i" = "xterminal" ; then
325                         enable_session_terminal="yes"
326                 else
327                         IFS="$SAVEIFS"
328                         AC_ERROR([Unknown session type $i])
329                 fi
330         done
331         IFS="$SAVEIFS"
332 fi
333 AC_MSG_RESULT([$with_sessions])
334
335 #
336 # Check what can be built
337 # This checks each configuration option and tests whether all dependencies are
338 # met. This is done from bottom up to ensure the right order.
339 #
340
341 # debug
342 debug_avail=no
343 debug_missing=""
344 if test ! "x$enable_debug" = "xno" ; then
345         debug_avail=yes
346 else
347         debug_missing="enable-debug"
348 fi
349
350 # optimizations
351 optimizations_avail=no
352 optimizations_missing=""
353 if test ! "x$enable_optimizations" = "xno" ; then
354         optimizations_avail=yes
355 else
356         optimizations_missing="enable-optimizations"
357 fi
358
359 # video fbdev
360 video_fbdev_avail=no
361 video_fbdev_missing=""
362 if test ! "x$enable_video_fbdev" = "xno" ; then
363         # TODO: check for kernel headers
364         video_fbdev_avail=yes
365 else
366         video_fbdev_missing="enable-video-fbdev"
367 fi
368
369 # video drm2d
370 video_drm2d_avail=no
371 video_drm2d_missing=""
372 if test ! "x$enable_video_drm2d" = "xno" ; then
373         video_drm2d_avail=yes
374         if test "x$have_drm3d" = "xno" ; then
375                 video_drm2d_avail=no
376                 video_drm2d_missing="libdrm3d"
377         fi
378
379         if test "x$video_drm2d_avail" = "xno" ; then
380                 if test "x$enable_video_drm2d" = "xyes" ; then
381                         AC_ERROR([missing for drm2d video backend: $video_drm2d_missing])
382                 fi
383         fi
384 else
385         video_drm2d_missing="enable-video-drm2d"
386 fi
387
388 # video drm3d
389 video_drm3d_avail=no
390 video_drm3d_missing=""
391 if test ! "x$enable_video_drm3d" = "xno" ; then
392         video_drm3d_avail=yes
393         if test "x$have_drm3d" = "xno" ; then
394                 video_drm3d_avail=no
395                 video_drm3d_missing="libdrm3d,$video_drm3d_missing"
396         fi
397         if test "x$have_gbm" = "xno" ; then
398                 video_drm3d_avail=no
399                 video_drm3d_missing="libgbm,$video_drm3d_missing"
400         fi
401         if test "x$have_egl" = "xno" ; then
402                 video_drm3d_avail=no
403                 video_drm3d_missing="libegl,$video_drm3d_missing"
404         fi
405         if test "x$have_gles2" = "xno" ; then
406                 video_drm3d_avail=no
407                 video_drm3d_missing="libgles2,$video_drm3d_missing"
408         fi
409
410         if test "x$video_drm3d_avail" = "xno" ; then
411                 if test "x$enable_video_drm3d" = "xyes" ; then
412                         AC_ERROR([missing for drm3d video backend: $video_drm3d_missing])
413                 fi
414         fi
415 else
416         video_drm3d_missing="enable-video-drm3d"
417 fi
418
419 # multi-seat
420 multi_seat_avail=no
421 multi_seat_missing=""
422 if test ! "x$enable_multi_seat" = "xno" ; then
423         multi_seat_avail=yes
424         if test "x$have_systemd" = "xno" ; then
425                 multi_seat_avail=no
426                 multi_seat_missing="libsystemd"
427         fi
428
429         if test "x$multi_seat_avail" = "xno" ; then
430                 if test "x$enable_multi_seat" = "xyes" ; then
431                         AC_ERROR([missing for multi-seat support: $multi_seat_missing])
432                 fi
433         fi
434 else
435         multi_seat_missing="enable-multi-seat"
436 fi
437
438 # hotplug
439 hotplug_avail=no
440 hotplug_missing=""
441 if test ! "x$enable_hotplug" = "xno" ; then
442         hotplug_avail=yes
443         if test "x$have_udev" = "xno" ; then
444                 hotplug_avail=no
445                 hotplug_missing="libudev"
446         fi
447
448         if test "x$hotplug_avail" = "xno" ; then
449                 if test "x$enable_hotplug" = "xyes" ; then
450                         AC_ERROR([missing for hotplug-support: $hotplug_missing])
451                 fi
452         fi
453 else
454         hotplug_missing="enable-hotplug"
455 fi
456
457 # renderer bbulk
458 renderer_bbulk_avail=no
459 renderer_bbulk_missing=""
460 if test ! "x$enable_renderer_bbulk" = "xno" ; then
461         renderer_bbulk_avail=yes
462 else
463         renderer_bbulk_missing="enable-renderer-bbulk"
464 fi
465
466 # renderer gltex
467 renderer_gltex_avail=no
468 renderer_gltex_missing=""
469 if test ! "x$enable_renderer_gltex" = "xno" ; then
470         renderer_gltex_avail=yes
471         if test "x$have_gles2" = "xno" ; then
472                 renderer_gltex_avail=no
473                 renderer_gltex_missing="libgles2"
474         fi
475
476         if test "x$renderer_gltex_avail" = "xno" ; then
477                 if test "x$enable_renderer_gltex" = "xyes" ; then
478                         AC_ERROR([missing for renderer-gltex: $renderer_gltex_missing])
479                 fi
480         fi
481 else
482         renderer_gltex_missing="enable-renderer-gltex"
483 fi
484
485 # renderer pixman
486 renderer_pixman_avail=no
487 renderer_pixman_missing=""
488 if test ! "x$enable_renderer_pixman" = "xno" ; then
489         renderer_pixman_avail=yes
490         if test "x$have_pixman" = "xno" ; then
491                 renderer_pixman_avail=no
492                 renderer_pixman_missing="pixman"
493         fi
494
495         if test "x$renderer_pixman_avail" = "xno" ; then
496                 if test "x$enable_renderer_pixman" = "xyes" ; then
497                         AC_ERROR([missing for renderer-pixman: $renderer_pixman_missing])
498                 fi
499         fi
500 else
501         renderer_pixman_missing="enable-renderer-pixman"
502 fi
503
504 # font unifont
505 font_unifont_avail=no
506 font_unifont_missing=""
507 if test ! "x$enable_font_unifont" = "xno" ; then
508         font_unifont_avail=yes
509 else
510         font_unifont_missing="enable-font-unifont"
511 fi
512
513 # font pango
514 font_pango_avail=no
515 font_pango_missing=""
516 if test ! "x$enable_font_pango" = "xno" ; then
517         font_pango_avail=yes
518         if test "x$have_pango" = "xno" ; then
519                 font_pango_avail=no
520                 font_pango_missing="libpango"
521         fi
522
523         if test "x$font_pango_avail" = "xno" ; then
524                 if test "x$enable_font_pango" = "xyes" ; then
525                         AC_ERROR([missing for font-pango: $font_pango_missing])
526                 fi
527         fi
528 else
529         font_pango_missing="enable-font-pango"
530 fi
531
532 # session dummy
533 session_dummy_avail=no
534 session_dummy_missing=""
535 if test ! "x$enable_session_dummy" = "xno" ; then
536         session_dummy_avail=yes
537 else
538         session_dummy_missing="enable-session-dummy"
539 fi
540
541 # session terminal
542 session_terminal_avail=no
543 session_terminal_missing=""
544 if test ! "x$enable_session_terminal" = "xno" ; then
545         session_terminal_avail=yes
546         if test "x$have_tsm" = "xno" ; then
547                 session_terminal_avail=no
548                 session_terminal_missing="libtsm"
549         fi
550
551         if test "x$session_terminal_avail" = "xno" ; then
552                 if test "x$enable_session_terminal" = "xyes" ; then
553                         AC_ERROR([missing for session-terminal: $session_terminal_missing])
554                 fi
555         fi
556 else
557         session_terminal_missing="enable-session-terminal"
558 fi
559
560 # kmscon
561 kmscon_avail=no
562 kmscon_missing=""
563 if test ! "x$enable_kmscon" = "xno" ; then
564         kmscon_avail=yes
565         if test "x$have_tsm" = "xno" ; then
566                 kmscon_avail=no
567                 kmscon_missing="libtsm,$kmscon_missing"
568         fi
569
570         if test "x$kmscon_avail" = "xno" ; then
571                 if test "x$enable_kmscon" = "xyes" ; then
572                         AC_ERROR([missing for kmscon: $kmscon_missing])
573                 fi
574         fi
575 else
576         kmscon_missing="enable-kmscon"
577 fi
578
579 #
580 # Enable all required modules
581 # We now know which modules can be built by checking the *_avail variables set
582 # above. We now only have to disable all modules that are disabled by default
583 # and the user didn't force-enable them and no other module that is enabled
584 # needs them. This is done top-down of course.
585 #
586
587 # kmscon
588 kmscon_enabled=no
589 if test "x$kmscon_avail" = "xyes" ; then
590         if test "x${enable_kmscon% *}" = "xyes" ; then
591                 kmscon_enabled=yes
592         fi
593 fi
594
595 # session terminal
596 session_terminal_enabled=no
597 if test "x$session_terminal_avail" = "xyes" ; then
598         if test "x${enable_session_terminal% *}" = "xyes" ; then
599                 session_terminal_enabled=yes
600         fi
601 fi
602
603 # session dummy
604 session_dummy_enabled=no
605 if test "x$session_dummy_avail" = "xyes" ; then
606         if test "x${enable_session_dummy% *}" = "xyes" ; then
607                 session_dummy_enabled=yes
608         fi
609 fi
610
611 # font pango
612 font_pango_enabled=no
613 if test "x$font_pango_avail" = "xyes" ; then
614         if test "x${enable_font_pango% *}" = "xyes" ; then
615                 font_pango_enabled=yes
616         fi
617 fi
618
619 # font unifont
620 font_unifont_enabled=no
621 if test "x$font_unifont_avail" = "xyes" ; then
622         if test "x${enable_font_unifont% *}" = "xyes" ; then
623                 font_unifont_enabled=yes
624         fi
625 fi
626
627 # renderer gltex
628 renderer_gltex_enabled=no
629 if test "x$renderer_gltex_avail" = "xyes" ; then
630         if test "x${enable_renderer_gltex% *}" = "xyes" ; then
631                 renderer_gltex_enabled=yes
632         fi
633 fi
634
635 # renderer pixman
636 renderer_pixman_enabled=no
637 if test "x$renderer_pixman_avail" = "xyes" ; then
638         if test "x${enable_renderer_pixman% *}" = "xyes" ; then
639                 renderer_pixman_enabled=yes
640         fi
641 fi
642
643 # renderer bbulk
644 renderer_bbulk_enabled=no
645 if test "x$renderer_bbulk_avail" = "xyes" ; then
646         if test "x${enable_renderer_bbulk% *}" = "xyes" ; then
647                 renderer_bbulk_enabled=yes
648         fi
649 fi
650
651 # hotplug
652 hotplug_enabled=no
653 if test "x$hotplug_avail" = "xyes" ; then
654         if test "x${enable_hotplug% *}" = "xyes" ; then
655                 hotplug_enabled=yes
656         fi
657 fi
658
659 # multi-seat
660 multi_seat_enabled=no
661 if test "x$multi_seat_avail" = "xyes" ; then
662         if test "x${enable_multi_seat% *}" = "xyes" ; then
663                 multi_seat_enabled=yes
664         fi
665 fi
666
667 # video drm3d
668 video_drm3d_enabled=no
669 if test "x$video_drm3d_avail" = "xyes" ; then
670         if test "x${enable_video_drm3d% *}" = "xyes" ; then
671                 video_drm3d_enabled=yes
672         fi
673 fi
674
675 # video drm2d
676 video_drm2d_enabled=no
677 if test "x$video_drm2d_avail" = "xyes" ; then
678         if test "x${enable_video_drm2d% *}" = "xyes" ; then
679                 video_drm2d_enabled=yes
680         fi
681 fi
682
683 # video fbdev
684 video_fbdev_enabled=no
685 if test "x$video_fbdev_avail" = "xyes" ; then
686         if test "x${enable_video_fbdev% *}" = "xyes" ; then
687                 video_fbdev_enabled=yes
688         fi
689 fi
690
691 # optimizations
692 optimizations_enabled=no
693 if test "x$optimizations_avail" = "xyes" ; then
694         if test "x${enable_optimizations% *}" = "xyes" ; then
695                 optimizations_enabled=yes
696         fi
697 fi
698
699 # debug
700 debug_enabled=no
701 if test "x$debug_avail" = "xyes" ; then
702         if test "x${enable_debug% *}" = "xyes" ; then
703                 debug_enabled=yes
704         fi
705 fi
706
707 #
708 # Module Configuration
709 # We have now done all dependency checking and default-value validation and we
710 # now know which modules are enabled via the *_enabled variables.
711 # Everything below is related to the configuration of each module and setting
712 # the correct flags for the build process.
713 #
714
715 # debug
716 if test "x$debug_enabled" = "xyes" ; then
717         AC_DEFINE([BUILD_ENABLE_DEBUG], [1], [Enable debug mode])
718 else
719         AC_DEFINE([NDEBUG], [1], [No Debug])
720 fi
721
722 AM_CONDITIONAL([BUILD_ENABLE_DEBUG],
723                [test "x$debug_enabled" = "xyes"])
724
725 # optimizations
726 AM_CONDITIONAL([BUILD_ENABLE_OPTIMIZATIONS],
727                [test "x$optimizations_enabled" = "xyes"])
728
729 # video fbdev
730 if test "x$video_fbdev_enabled" = "xyes" ; then
731         AC_DEFINE([BUILD_ENABLE_VIDEO_FBDEV], [1],
732                   [Build uterm fbdev video backend])
733 fi
734
735 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_FBDEV],
736                [test "x$video_fbdev_enabled" = "xyes"])
737
738 # video drm2d
739 if test "x$video_drm2d_enabled" = "xyes" ; then
740         AC_DEFINE([BUILD_ENABLE_VIDEO_DRM2D], [1],
741                   [Build uterm drm2d drm3d video backend])
742 fi
743
744 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_DRM2D],
745                [test "x$video_drm2d_enabled" = "xyes"])
746
747 # video drm3d
748 if test "x$video_drm3d_enabled" = "xyes" ; then
749         AC_DEFINE([BUILD_ENABLE_VIDEO_DRM3D], [1],
750                   [Build uterm drm3d video backend])
751 fi
752
753 AM_CONDITIONAL([BUILD_ENABLE_VIDEO_DRM3D],
754                [test "x$video_drm3d_enabled" = "xyes"])
755
756 # multi-seat
757 if test "x$multi_seat_enabled" = "xyes" ; then
758         AC_DEFINE([BUILD_ENABLE_MULTI_SEAT], [1],
759                   [Use systemd for multi-seat support])
760 fi
761
762 AM_CONDITIONAL([BUILD_ENABLE_MULTI_SEAT],
763                [test "x$multi_seat_enabled" = "xyes"])
764
765 # hotplug
766 if test "x$hotplug_enabled" = "xyes" ; then
767         AC_DEFINE([BUILD_ENABLE_HOTPLUG], [1],
768                   [Use udev for hotplug support])
769 fi
770
771 AM_CONDITIONAL([BUILD_ENABLE_HOTPLUG],
772                [test "x$hotplug_enabled" = "xyes"])
773
774 # renderer bbulk
775 if test "x$renderer_bbulk_enabled" = "xyes" ; then
776         AC_DEFINE([BUILD_ENABLE_RENDERER_BBULK], [1],
777                   [Build bbulk rendering backend])
778 fi
779
780 AM_CONDITIONAL([BUILD_ENABLE_RENDERER_BBULK],
781                [test "x$renderer_bbulk_enabled" = "xyes"])
782
783 # renderer gltex
784 if test "x$renderer_gltex_enabled" = "xyes" ; then
785         AC_DEFINE([BUILD_ENABLE_RENDERER_GLTEX], [1],
786                   [Build gltex rendering backend])
787 fi
788
789 AM_CONDITIONAL([BUILD_ENABLE_RENDERER_GLTEX],
790                [test "x$renderer_gltex_enabled" = "xyes"])
791
792 # renderer pixman
793 if test "x$renderer_pixman_enabled" = "xyes" ; then
794         AC_DEFINE([BUILD_ENABLE_RENDERER_PIXMAN], [1],
795                   [Build pixman rendering backend])
796 fi
797
798 AM_CONDITIONAL([BUILD_ENABLE_RENDERER_PIXMAN],
799                [test "x$renderer_pixman_enabled" = "xyes"])
800
801 # font unifont
802 if test "x$font_unifont_enabled" = "xyes" ; then
803         AC_DEFINE([BUILD_ENABLE_FONT_UNIFONT], [1],
804                   [Build static unifont backend])
805 fi
806
807 AM_CONDITIONAL([BUILD_ENABLE_FONT_UNIFONT],
808                [test "x$font_unifont_enabled" = "xyes"])
809
810 # font pango
811 if test "x$font_pango_enabled" = "xyes" ; then
812         AC_DEFINE([BUILD_ENABLE_FONT_PANGO], [1],
813                   [Build pango font backend])
814 fi
815
816 AM_CONDITIONAL([BUILD_ENABLE_FONT_PANGO],
817                [test "x$font_pango_enabled" = "xyes"])
818
819 # session dummy
820 if test "x$session_dummy_enabled" = "xyes" ; then
821         AC_DEFINE([BUILD_ENABLE_SESSION_DUMMY], [1],
822                   [Build dummy session])
823 fi
824
825 AM_CONDITIONAL([BUILD_ENABLE_SESSION_DUMMY],
826                [test "x$session_dummy_enabled" = "xyes"])
827
828 # session terminal
829 if test "x$session_terminal_enabled" = "xyes" ; then
830         AC_DEFINE([BUILD_ENABLE_SESSION_TERMINAL], [1],
831                   [Build terminal session])
832 fi
833
834 AM_CONDITIONAL([BUILD_ENABLE_SESSION_TERMINAL],
835                [test "x$session_terminal_enabled" = "xyes"])
836
837 # kmscon
838 AM_CONDITIONAL([BUILD_ENABLE_KMSCON],
839                [test "x$kmscon_enabled" = "xyes"])
840
841 #
842 # Miscellaneous Checks
843 # All checks below are independent of module checking or depend on the results
844 # of it. They do not have any dependencies themselves so they are not part of the
845 # module infrastructure.
846 #
847
848 # check for _Static_assert
849 AC_MSG_CHECKING([whether _Static_assert() is supported])
850 AC_LANG([C])
851 have_static_assert=yes
852 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[_Static_assert(1, "What?");]])],
853                   [AC_DEFINE([BUILD_HAVE_STATIC_ASSERT],
854                              [1],
855                              [Define to 1 if _Static_assert() is supported])],
856                   [have_static_assert=no])
857 AC_MSG_RESULT([$have_static_assert])
858
859 # check for gbm_bo_get_pitch() function, otherwise gbm_bo_get_stride() is used
860 if test x$have_gbm = xyes ; then
861         save_CFLAGS="$CFLAGS"
862         save_LIBS="$LIBS"
863         save_LDFLAGS="$LDFLAGS"
864         CFLAGS="$DRM_CFLAGS $GBM_CFLAGS"
865         LIBS="$DRM_LIBS $GBM_LIBS"
866         LDFLAGS=""
867         AC_CHECK_LIB([gbm],
868                      [gbm_bo_get_pitch],
869                      [AC_DEFINE([BUILD_HAVE_GBM_BO_GET_PITCH],
870                                 [1],
871                                 [Define to 1 if your libgbm provides gbm_bo_get_pitch])])
872         CFLAGS="$save_CFLAGS"
873         LIBS="$save_LIBS"
874         LDFLAGS="$save_LDFLAGS"
875 fi
876
877 # check for xsltproc
878 AC_PATH_PROG(XSLTPROC, xsltproc)
879 AM_CONDITIONAL([BUILD_HAVE_XSLTPROC], [test "x$XSLTPROC" != "x"])
880
881 # check for offline man-pages stylesheet
882 AC_MSG_CHECKING([for docbook manpages stylesheet])
883 BUILD_MANPAGES_STYLESHEET="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
884 AC_PATH_PROGS_FEATURE_CHECK([XSLTPROC_TMP], [xsltproc],
885                             AS_IF([`"$ac_path_XSLTPROC_TMP" --nonet "$BUILD_MANPAGES_STYLESHEET" > /dev/null 2>&1`],
886                                   [BUILD_HAVE_MANPAGES_STYLESHEET=yes]))
887 if test "x$BUILD_HAVE_MANPAGES_STYLESHEET" = "xyes"; then
888         AM_CONDITIONAL([BUILD_HAVE_MANPAGES_STYLESHEET], true)
889         AC_SUBST(BUILD_MANPAGES_STYLESHEET)
890         AC_MSG_RESULT([yes])
891 else
892         AM_CONDITIONAL([BUILD_HAVE_MANPAGES_STYLESHEET], false)
893         AC_MSG_RESULT([no])
894 fi
895
896 #
897 # Makefile vars
898 # After everything is configured, we correctly substitute the values for the
899 # makefiles.
900 #
901
902 AC_CONFIG_FILES([Makefile])
903 AC_OUTPUT
904
905 #
906 # Configuration output
907 # Show configuration to the user so they can check whether everything was
908 # configured as expected.
909 #
910
911 AC_MSG_NOTICE([Build configuration:
912
913                prefix: $prefix
914           exec-prefix: $exec_prefix
915                libdir: $libdir
916            includedir: $includedir
917
918   Applications and Libraries:
919                kmscon: $kmscon_enabled ($kmscon_avail: $kmscon_missing)
920
921   Miscellaneous Options:
922                 debug: $debug_enabled ($debug_avail: $debug_missing)
923         optimizations: $optimizations_enabled ($optimizations_avail: $optimizations_missing)
924            multi-seat: $multi_seat_enabled ($multi_seat_avail: $multi_seat_missing)
925               hotplug: $hotplug_enabled ($hotplug_avail: $hotplug_missing)
926
927   Video Backends:
928                 fbdev: $video_fbdev_enabled ($video_fbdev_avail: $video_fbdev_missing)
929                 drm2d: $video_drm2d_enabled ($video_drm2d_avail: $video_drm2d_missing)
930                 drm3d: $video_drm3d_enabled ($video_drm3d_avail: $video_drm3d_missing)
931
932   Font Backends:
933               unifont: $font_unifont_enabled ($font_unifont_avail: $font_unifont_missing)
934                 pango: $font_pango_enabled ($font_pango_avail: $font_pango_missing)
935
936   Renderers:
937                 bbulk: $renderer_bbulk_enabled ($renderer_bbulk_avail: $renderer_bbulk_missing)
938                 gltex: $renderer_gltex_enabled ($renderer_gltex_avail: $renderer_gltex_missing)
939                pixman: $renderer_pixman_enabled ($renderer_pixman_avail: $renderer_pixman_missing)
940
941   Session Types:
942                 dummy: $session_dummy_enabled ($session_dummy_avail: $session_dummy_missing)
943              terminal: $session_terminal_enabled ($session_terminal_avail: $session_terminal_missing)
944
945         Run "${MAKE-make}" to start compilation process])