docs: remove gtkdoc
[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], [3])
9 AC_SUBST(PACKAGE_URL, [https://github.com/dvdhrm/kmscon])
10 AC_CONFIG_SRCDIR([src/main.c])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AC_CONFIG_MACRO_DIR([m4])
13 AC_CONFIG_HEADER(config.h)
14
15 AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-bzip2 no-dist-gzip tar-pax -Wall -Werror])
16 AM_SILENT_RULES([yes])
17
18 #
19 # Don't add a default "-g -O2" if CFLAGS wasn't specified. For debugging it is
20 # often more convenient to have "-g -O0". You can still override it by
21 # explicitely setting it on the command line.
22 #
23
24 : ${CFLAGS=""}
25
26 AC_USE_SYSTEM_EXTENSIONS
27 AC_PROG_CC
28 AC_PROG_CC_C99
29 AM_PROG_CC_C_O
30 AM_PROG_AR
31
32 LT_PREREQ(2.2)
33 LT_INIT
34
35 #
36 # pkg-config dependencies
37 # This unconditionally checks for all dependencies even if they are disabled. We
38 # later look whether all required depedencies are met and finish the
39 # configuration. We group similar packages into one logical group here to avoid
40 # having variables for each single library.
41 # This, however, makes ./configure output very unintuitive error messages if a
42 # package is not found so we must make sure we print more verbose messages
43 # ourself.
44 #
45
46 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login],
47                   [have_systemd=yes], [have_systemd=no])
48
49 PKG_CHECK_MODULES([UDEV], [libudev],
50                   [have_udev=yes], [have_udev=no])
51
52 PKG_CHECK_MODULES([DBUS], [dbus-1],
53                   [have_dbus=yes], [have_dbus=no])
54
55 PKG_CHECK_MODULES([DRM], [libdrm],
56                   [have_drm=yes], [have_drm=no])
57
58 PKG_CHECK_MODULES([GBM], [gbm],
59                   [have_gbm=yes], [have_gbm=no])
60
61 PKG_CHECK_MODULES([EGL], [egl],
62                   [have_egl=yes], [have_egl=no])
63
64 PKG_CHECK_MODULES([GLES2], [glesv2],
65                   [have_gles2=yes], [have_gles2=no])
66
67 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
68                   [have_xkbcommon=yes], [have_xkbcommon=no])
69
70 PKG_CHECK_MODULES([FREETYPE2], [freetype2 fontconfig],
71                   [have_freetype2=yes], [have_freetype2=no])
72
73 PKG_CHECK_MODULES([PANGO], [pango pangoft2],
74                   [have_pango=yes], [have_pango=no])
75
76 #
77 # Parse arguments
78 # Parse all command line arguments and save the values so we can check them
79 # later when configuring kmscon.
80 #
81
82 AC_MSG_CHECKING([whether to use systemd for multi-seat support])
83 AC_ARG_ENABLE([systemd],
84               [AS_HELP_STRING([--enable-systemd],
85                               [enable multi-seat support with systemd])])
86 AC_MSG_RESULT([ok])
87
88 AC_MSG_CHECKING([whether to use udev for device hotplug support])
89 AC_ARG_ENABLE([udev],
90               [AS_HELP_STRING([--enable-udev],
91                               [enable device hotplug support with udev])])
92 AC_MSG_RESULT([ok])
93
94 AC_MSG_CHECKING([whether to use dbus for IPC])
95 AC_ARG_ENABLE([dbus],
96               [AS_HELP_STRING([--enable-dbus],
97                               [enable dbus IPC])])
98 AC_MSG_RESULT([ok])
99
100 AC_MSG_CHECKING([whether to use uterm fbdev video backend])
101 AC_ARG_ENABLE([fbdev],
102               [AS_HELP_STRING([--enable-fbdev],
103                               [enable uterm fbdev video backend])])
104 AC_MSG_RESULT([ok])
105
106 AC_MSG_CHECKING([whether to use uterm drm video backend])
107 AC_ARG_ENABLE([drm],
108               [AS_HELP_STRING([--enable-drm],
109                               [enable uterm drm video backend])])
110 AC_MSG_RESULT([ok])
111
112 AC_MSG_CHECKING([whether to provide OpenGLES2 support])
113 AC_ARG_ENABLE([gles2],
114               [AS_HELP_STRING([--enable-gles2],
115                               [provide uterm OpenGLES2 support])])
116 AC_MSG_RESULT([ok])
117
118 AC_MSG_CHECKING([whether to use xkbcommon keyboard backend])
119 AC_ARG_ENABLE([xkbcommon],
120               [AS_HELP_STRING([--disable-xkbcommon],
121                               [disable xkbcommon keyboard backend])])
122 AC_MSG_RESULT([ok])
123
124 AC_MSG_CHECKING([whether to use static unifont backend])
125 AC_ARG_ENABLE([unifont],
126               [AS_HELP_STRING([--enable-unifont],
127                               [enable static unifont font backend (GPL)])])
128 AC_MSG_RESULT([ok])
129
130 AC_MSG_CHECKING([whether to use static 8x16 font backend])
131 AC_ARG_ENABLE([f8x16],
132               [AS_HELP_STRING([--disable-f8x16],
133                               [disable static 8x16 font backend])])
134 AC_MSG_RESULT([ok])
135
136 AC_MSG_CHECKING([whether to use freetype2 font backend])
137 AC_ARG_ENABLE([freetype2],
138               [AS_HELP_STRING([--disable-freetype2],
139                               [disable freetype2 font backend])])
140 AC_MSG_RESULT([ok])
141
142 AC_MSG_CHECKING([whether to use pango font backend])
143 AC_ARG_ENABLE([pango],
144               [AS_HELP_STRING([--disable-pango],
145                               [disable pango font backend])])
146 AC_MSG_RESULT([ok])
147
148 AC_MSG_CHECKING([whether to use bblit rendering backend])
149 AC_ARG_ENABLE([bblit],
150               [AS_HELP_STRING([--disable-bblit],
151                               [disable bblit rendering backend])])
152 AC_MSG_RESULT([ok])
153
154 AC_MSG_CHECKING([whether to use bbulk rendering backend])
155 AC_ARG_ENABLE([bbulk],
156               [AS_HELP_STRING([--disable-bbulk],
157                               [disable bbulk rendering backend])])
158 AC_MSG_RESULT([ok])
159
160 AC_MSG_CHECKING([whether to build with debugging on])
161 AC_ARG_ENABLE([debug],
162               [AS_HELP_STRING([--enable-debug],
163                               [whether to build with debugging on])])
164 AC_MSG_RESULT([ok])
165
166 AC_MSG_CHECKING([whether to disable code optimizations])
167 AC_ARG_ENABLE([optimizations],
168               [AS_HELP_STRING([--disable-optimizations],
169                               [whether to disable code optimizations])])
170 AC_MSG_RESULT([ok])
171
172 #
173 # Debug mode and code optimizations
174 # In debug mode we compile with -g and enable several debug-messages and flags.
175 # With optimizations (default), we add -O2 to compile-flags.
176 #
177
178 debug_enabled=no
179 if test x$enable_debug = xyes ; then
180         debug_enabled=yes
181 fi
182
183 optimizations_enabled=no
184 if test ! x$enable_optimizations = xno ; then
185         optimizations_enabled=yes
186 fi
187
188 if test x$debug_enabled = xyes ; then
189         AC_DEFINE([KMSCON_ENABLE_DEBUG], [1],
190                   [Enable debug for kmscon])
191         AC_DEFINE([LOG_ENABLE_DEBUG], [1],
192                   [Enable debug for log subsystem])
193         AC_DEFINE([LLOG_ENABLE_DEBUG], [1],
194                   [Enable debug for llog subsystem])
195 else
196         AC_DEFINE([NDEBUG], [1], [No Debug])
197 fi
198
199 AM_CONDITIONAL([DEBUG], [test x$debug_enabled = xyes])
200 AM_CONDITIONAL([OPTIMIZATIONS], [test x$optimizations_enabled = xyes])
201
202 #
203 # Main dependencies
204 # This checks for all dependencies that are not optional.
205 #
206
207 # We currently have no mandatory dependencies!
208
209 #
210 # Systemd dependency
211 # We can optionally use systemd for multi-seat support. If systemd is not
212 # available or the system was not started with systemd, we simply fall back to
213 # single-seat mode.
214 #
215
216 systemd_enabled=no
217 if test ! x$enable_systemd = xno ; then
218         if test x$have_systemd = xyes ; then
219                 systemd_enabled=yes
220         elif test x$enable_systemd = xyes ; then
221                 AC_ERROR([systemd libraries not found for multi-seat support])
222         fi
223 fi
224
225 if test x$systemd_enabled = xyes ; then
226         AC_DEFINE([UTERM_HAVE_SYSTEMD], [1],
227                   [Use systemd for multi-seat support])
228 else
229         SYSTEMD_CFLAGS=""
230         SYSTEMD_LIBS=""
231 fi
232
233 #
234 # Udev dependency
235 # For hotplugging support we need udev to notify us about system events. If udev
236 # is not available, we simply fall back to static mode. Periodic scanning is
237 # also supported.
238 #
239
240 udev_enabled=no
241 if test ! x$enable_udev = xno ; then
242         if test x$have_udev = xyes ; then
243                 udev_enabled=yes
244         elif test x$enable_udev = xyes ; then
245                 AC_ERROR([udev libraries not found for device hotplug support])
246         fi
247 fi
248
249 if test x$udev_enabled = xyes ; then
250         AC_DEFINE([UTERM_HAVE_UDEV], [1],
251                   [Use udev for device hotplug support])
252 else
253         UDEV_CFLAGS=""
254         UDEV_LIBS=""
255 fi
256
257 #
258 # DBus dependency
259 # For IPC mechanisms we use DBus. Especially multi-seat enabled multi-session
260 # capable applications need DBus to manage application and terminal switching.
261 #
262
263 dbus_enabled=no
264 if test ! x$enable_dbus = xno ; then
265         if test x$have_dbus = xyes ; then
266                 dbus_enabled=yes
267         elif test x$enable_dbus = xyes; then
268                 AC_ERROR([dbus libraries not found])
269         fi
270 fi
271
272 if test x$dbus_enabled = xyes; then
273         AC_DEFINE([EV_HAVE_DBUS], [1],
274                   [Use dbus for IPC])
275 else
276         DBUS_CFLAGS=""
277         DBUS_LIBS=""
278 fi
279
280 AM_CONDITIONAL([EV_HAVE_DBUS], [test x$dbus_enabled = xyes])
281
282 #
283 # Uterm fbdev backend
284 # This checks whether the fbdev backend was requested and enables it then. There
285 # are no special dependencies for it except the kernel headers.
286 # TODO: check for kernel headers here
287 #
288
289 fbdev_enabled=no
290 if test ! x$enable_fbdev = xno ; then
291         fbdev_enabled=yes
292 fi
293
294 if test x$fbdev_enabled = xyes ; then
295         AC_DEFINE([UTERM_HAVE_FBDEV], [1],
296                   [Use uterm fbdev video backend])
297 fi
298
299 AM_CONDITIONAL([UTERM_HAVE_FBDEV], [test x$fbdev_enabled = xyes])
300
301 #
302 # Uterm drm backend
303 # This checks whether libdrm is available and some combination of libgbm, egl
304 # and gl or glesv2. If it is not available, then the drm backend is simply not
305 # built.
306 #
307
308 dumb_enabled=no
309 drm_enabled=no
310 gles2_enabled=no
311 if test ! x$enable_drm = xno ; then
312         if test x$have_drm = xyes ; then
313                 dumb_enabled=yes
314         fi
315
316         if test ! x$enable_gles2 = xno ; then
317                 if test x$have_drm = xyes -a x$have_gbm = xyes -a x$have_egl = xyes ; then
318                         if test x$have_gles2 = xyes ; then
319                                 drm_enabled=yes
320                                 gles2_enabled=yes
321                         fi
322                 fi
323         fi
324
325         if test x$enable_drm = xyes -a x$dumb_enabled = xno ; then
326                 AC_ERROR([drm library not found for uterm dumb drm backend])
327         fi
328
329         if test x$enable_gles2 = xyes -a x$drm_enabled = xno ; then
330                 AC_ERROR([drm, gbm, egl, gl or gles2 libraries not found for uterm drm backend])
331         fi
332 fi
333
334 if test x$dumb_enabled = xyes ; then
335         AC_DEFINE([UTERM_HAVE_DUMB], [1],
336                   [Use uterm dumb drm video backend])
337
338         if test x$drm_enabled = xyes ; then
339                 AC_DEFINE([UTERM_HAVE_DRM], [1],
340                           [Use uterm DRM video backend])
341         else
342                 GBM_CFLAGS=""
343                 GBM_LIBS=""
344                 EGL_CFLAGS=""
345                 EGL_LIBS=""
346         fi
347 else
348         DRM_CFLAGS=""
349         DRM_LIBS=""
350         GBM_CFLAGS=""
351         GBM_LIBS=""
352         EGL_CFLAGS=""
353         EGL_LIBS=""
354 fi
355
356 if test x$gles2_enabled = xyes ; then
357         AC_DEFINE([KMSCON_HAVE_GLES2], [1],
358                   [Use OpenGLESv2 as drawing backend])
359 else
360         GLES2_CFLAGS=""
361         GLES2_LIBS=""
362 fi
363
364 AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
365 AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
366 AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
367
368 if test x$have_gbm = xyes ; then
369         save_CFLAGS="$CFLAGS"
370         save_LIBS="$LIBS"
371         CFLAGS=$GBM_CFLAGS
372         LIBS=$GBM_LIBS
373         AC_CHECK_LIB([gbm],
374                      [gbm_bo_get_stride],
375                      [AC_DEFINE([HAVE_GBM_BO_GET_STRIDE],
376                                 [1],
377                                 [Define to 1 if your libgbm provides gbm_bo_get_stride])])
378         CFLAGS="$save_CFLAGS"
379         LIBS="$save_LIBS"
380 fi
381
382 #
383 # xkbcommon keyboard backend
384 # This checks for the xkbcommon library for keyboard handling in uterm. If it is
385 # not available, we use a dumb-keyboard backend as fall-back.
386 #
387
388 xkbcommon_enabled=no
389 if test ! x$enable_xkbcommon = xno ; then
390         if test x$have_xkbcommon = xyes ; then
391                 xkbcommon_enabled=yes
392         elif test x$enable_xkbcommon = xyes ; then
393                 AC_ERROR([xkbcommon not found for keyboard backend])
394         fi
395 fi
396
397 if test x$xkbcommon_enabled = xyes ; then
398         AC_DEFINE([UTERM_HAVE_XKBCOMMON], [1],
399                   [Use xkbcommon as input keyboard handling backend])
400 else
401         XKBCOMMON_CFLAGS=""
402         XKBCOMMON_LIBS=""
403 fi
404
405 AM_CONDITIONAL([UTERM_HAVE_XKBCOMMON], [test x$xkbcommon_enabled = xyes])
406
407 #
408 # Font backends
409 # This checks for the unifont, 8x16, freetype2 and pango font backends and
410 # enables them if requested and available.
411 #
412 # Please note that the Unifont-data is GPL'ed and we compile this statically
413 # into our application. I do not consider this a "derivative" but a lawyer may
414 # disagree. So please make sure you enable this only if you use the GPL as
415 # license for kmscon.
416 #
417
418 unifont_enabled=no
419 if test x$enable_unifont = xyes ; then
420         unifont_enabled=yes
421 fi
422
423 if test x$unifont_enabled = xyes ; then
424         AC_DEFINE([KMSCON_HAVE_UNIFONT], [1],
425                   [Use static unifont backend])
426 fi
427
428 AM_CONDITIONAL([KMSCON_HAVE_UNIFONT], [test x$unifont_enabled = xyes])
429
430 f8x16_enabled=no
431 if test ! x$enable_f8x16 = xno ; then
432         f8x16_enabled=yes
433 fi
434
435 if test x$f8x16_enabled = xyes ; then
436         AC_DEFINE([KMSCON_HAVE_8X16], [1],
437                   [Use static 8x16 font backend])
438 fi
439
440 AM_CONDITIONAL([KMSCON_HAVE_8X16], [test x$f8x16_enabled = xyes])
441
442 freetype2_enabled=no
443 if test ! x$enable_freetype2 = xno ; then
444         if test x$have_freetype2 = xyes ; then
445                 freetype2_enabled=yes
446         elif test x$enable_freetype2 = xyes ; then
447                 AC_ERROR([freetype2/fontconfig not found for freetype2 backend])
448         fi
449 fi
450
451 if test x$freetype2_enabled = xyes ; then
452         AC_DEFINE([KMSCON_HAVE_FREETYPE2], [1],
453                   [Use freetype2 as font backend])
454 else
455         FREETYPE2_CFLAGS=""
456         FREETYPE2_LIBS=""
457 fi
458
459 AM_CONDITIONAL([KMSCON_HAVE_FREETYPE2], [test x$freetype2_enabled = xyes])
460
461 pango_enabled=no
462 if test ! x$enable_pango = xno ; then
463         if test x$have_pango = xyes ; then
464                 pango_enabled=yes
465         elif test x$enable_pango = xyes ; then
466                 AC_ERROR([pango not found for pango font backend])
467         fi
468 fi
469
470 if test x$pango_enabled = xyes ; then
471         AC_DEFINE([KMSCON_HAVE_PANGO], [1],
472                   [Use pango as font backend])
473 else
474         PANGO_CFLAGS=""
475         PANGO_LIBS=""
476 fi
477
478 AM_CONDITIONAL([KMSCON_HAVE_PANGO], [test x$pango_enabled = xyes])
479
480 #
481 # BBlit Rendering backend
482 #
483
484 bblit_enabled=no
485 if test ! x$enable_bblit = xno ; then
486         bblit_enabled=yes
487 fi
488
489 if test x$bblit_enabled = xyes ; then
490         AC_DEFINE([KMSCON_HAVE_BBLIT], [1],
491                   [Use bblit rendering backend])
492 fi
493
494 AM_CONDITIONAL([KMSCON_HAVE_BBLIT], [test x$bblit_enabled = xyes])
495
496 #
497 # BBulk Rendering backend
498 #
499
500 bbulk_enabled=no
501 if test ! x$enable_bbulk = xno ; then
502         bbulk_enabled=yes
503 fi
504
505 if test x$bbulk_enabled = xyes ; then
506         AC_DEFINE([KMSCON_HAVE_BBULK], [1],
507                   [Use bbulk rendering backend])
508 fi
509
510 AM_CONDITIONAL([KMSCON_HAVE_BBULK], [test x$bbulk_enabled = xyes])
511
512 #
513 # OpenGL Texture rendering backend
514 # This is not really an option but automatically enabled if OpenGLES2 support
515 # was selected.
516 #
517
518 gltex_enabled=no
519 if test x$gles2_enabled = xyes ; then
520         gltex_enabled=yes
521 fi
522
523 #
524 # Makefile vars
525 # After everything is configured, we correctly substitute the values for the
526 # makefiles.
527 #
528
529 AC_SUBST(SYSTEMD_CFLAGS)
530 AC_SUBST(SYSTEMD_LIBS)
531 AC_SUBST(DBUS_CFLAGS)
532 AC_SUBST(DBUS_LIBS)
533 AC_SUBST(DRM_CFLAGS)
534 AC_SUBST(DRM_LIBS)
535 AC_SUBST(EGL_CFLAGS)
536 AC_SUBST(EGL_LIBS)
537 AC_SUBST(GBM_CFLAGS)
538 AC_SUBST(GBM_LIBS)
539 AC_SUBST(GLES2_CFLAGS)
540 AC_SUBST(GLES2_LIBS)
541 AC_SUBST(UDEV_CFLAGS)
542 AC_SUBST(UDEV_LIBS)
543 AC_SUBST(XKBCOMMON_CFLAGS)
544 AC_SUBST(XKBCOMMON_LIBS)
545 AC_SUBST(FREETYPE2_CFLAGS)
546 AC_SUBST(FREETYPE2_LIBS)
547 AC_SUBST(PANGO_CFLAGS)
548 AC_SUBST(PANGO_LIBS)
549
550 AC_CONFIG_FILES([Makefile])
551 AC_OUTPUT([src/genshader.c])
552
553 #
554 # Configuration output
555 # Show configuration to the user so they can check whether everything was
556 # configured as expected.
557 #
558
559 AC_MSG_NOTICE([Build configuration:
560
561                 debug: $debug_enabled
562         optimizations: $optimizations_enabled
563
564               systemd: $systemd_enabled
565                  udev: $udev_enabled
566                  dbus: $dbus_enabled
567             xkbcommon: $xkbcommon_enabled
568
569   libuterm video backends:
570                 fbdev: $fbdev_enabled
571              dumb drm: $dumb_enabled
572                   drm: $drm_enabled
573             OpenGLES2: $gles2_enabled
574
575   font backends:
576               unifont: $unifont_enabled
577                  8x16: $f8x16_enabled
578             freetype2: $freetype2_enabled
579                 pango: $pango_enabled
580
581   rendering backends:
582                 bblit: $bblit_enabled
583                 bbulk: $bbulk_enabled
584                 gltex: $gltex_enabled
585
586         Run "make" to start compilation process])