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