2 # Kmscon - build configuration script
3 # Copyright (c) 2012 David Herrmann <dh.herrmann@googlemail.com>
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)
15 AM_INIT_AUTOMAKE([foreign 1.11 subdir-objects dist-bzip2 no-dist-gzip tar-pax -Wall -Werror])
16 AM_SILENT_RULES([yes])
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.
26 AC_USE_SYSTEM_EXTENSIONS
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
46 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login],
47 [have_systemd=yes], [have_systemd=no])
49 PKG_CHECK_MODULES([UDEV], [libudev],
50 [have_udev=yes], [have_udev=no])
52 PKG_CHECK_MODULES([DBUS], [dbus-1],
53 [have_dbus=yes], [have_dbus=no])
55 PKG_CHECK_MODULES([DRM], [libdrm],
56 [have_drm=yes], [have_drm=no])
58 PKG_CHECK_MODULES([GBM], [gbm],
59 [have_gbm=yes], [have_gbm=no])
61 PKG_CHECK_MODULES([EGL], [egl],
62 [have_egl=yes], [have_egl=no])
64 PKG_CHECK_MODULES([GLES2], [glesv2],
65 [have_gles2=yes], [have_gles2=no])
67 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
68 [have_xkbcommon=yes], [have_xkbcommon=no])
70 PKG_CHECK_MODULES([FREETYPE2], [freetype2 fontconfig],
71 [have_freetype2=yes], [have_freetype2=no])
73 PKG_CHECK_MODULES([PANGO], [pango pangoft2],
74 [have_pango=yes], [have_pango=no])
78 # Parse all command line arguments and save the values so we can check them
79 # later when configuring kmscon.
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])])
88 AC_MSG_CHECKING([whether to use udev for device hotplug support])
90 [AS_HELP_STRING([--enable-udev],
91 [enable device hotplug support with udev])])
94 AC_MSG_CHECKING([whether to use dbus for IPC])
96 [AS_HELP_STRING([--enable-dbus],
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])])
106 AC_MSG_CHECKING([whether to use uterm drm video backend])
108 [AS_HELP_STRING([--enable-drm],
109 [enable uterm drm video backend])])
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])])
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])])
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)])])
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])])
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])])
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])])
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])])
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])])
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])])
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])])
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.
179 if test x$enable_debug = xyes ; then
183 optimizations_enabled=no
184 if test ! x$enable_optimizations = xno ; then
185 optimizations_enabled=yes
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])
196 AC_DEFINE([NDEBUG], [1], [No Debug])
199 AM_CONDITIONAL([DEBUG], [test x$debug_enabled = xyes])
200 AM_CONDITIONAL([OPTIMIZATIONS], [test x$optimizations_enabled = xyes])
204 # This checks for all dependencies that are not optional.
207 # We currently have no mandatory dependencies!
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
217 if test ! x$enable_systemd = xno ; then
218 if test x$have_systemd = xyes ; then
220 elif test x$enable_systemd = xyes ; then
221 AC_ERROR([systemd libraries not found for multi-seat support])
225 if test x$systemd_enabled = xyes ; then
226 AC_DEFINE([UTERM_HAVE_SYSTEMD], [1],
227 [Use systemd for multi-seat support])
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
241 if test ! x$enable_udev = xno ; then
242 if test x$have_udev = xyes ; then
244 elif test x$enable_udev = xyes ; then
245 AC_ERROR([udev libraries not found for device hotplug support])
249 if test x$udev_enabled = xyes ; then
250 AC_DEFINE([UTERM_HAVE_UDEV], [1],
251 [Use udev for device hotplug support])
259 # For IPC mechanisms we use DBus. Especially multi-seat enabled multi-session
260 # capable applications need DBus to manage application and terminal switching.
264 if test ! x$enable_dbus = xno ; then
265 if test x$have_dbus = xyes ; then
267 elif test x$enable_dbus = xyes; then
268 AC_ERROR([dbus libraries not found])
272 if test x$dbus_enabled = xyes; then
273 AC_DEFINE([EV_HAVE_DBUS], [1],
280 AM_CONDITIONAL([EV_HAVE_DBUS], [test x$dbus_enabled = xyes])
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
290 if test ! x$enable_fbdev = xno ; then
294 if test x$fbdev_enabled = xyes ; then
295 AC_DEFINE([UTERM_HAVE_FBDEV], [1],
296 [Use uterm fbdev video backend])
299 AM_CONDITIONAL([UTERM_HAVE_FBDEV], [test x$fbdev_enabled = xyes])
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
311 if test ! x$enable_drm = xno ; then
312 if test x$have_drm = xyes ; then
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
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])
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])
334 if test x$dumb_enabled = xyes ; then
335 AC_DEFINE([UTERM_HAVE_DUMB], [1],
336 [Use uterm dumb drm video backend])
338 if test x$drm_enabled = xyes ; then
339 AC_DEFINE([UTERM_HAVE_DRM], [1],
340 [Use uterm DRM video backend])
356 if test x$gles2_enabled = xyes ; then
357 AC_DEFINE([KMSCON_HAVE_GLES2], [1],
358 [Use OpenGLESv2 as drawing backend])
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])
368 if test x$have_gbm = xyes ; then
369 save_CFLAGS="$CFLAGS"
375 [AC_DEFINE([HAVE_GBM_BO_GET_STRIDE],
377 [Define to 1 if your libgbm provides gbm_bo_get_stride])])
378 CFLAGS="$save_CFLAGS"
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.
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])
397 if test x$xkbcommon_enabled = xyes ; then
398 AC_DEFINE([UTERM_HAVE_XKBCOMMON], [1],
399 [Use xkbcommon as input keyboard handling backend])
405 AM_CONDITIONAL([UTERM_HAVE_XKBCOMMON], [test x$xkbcommon_enabled = xyes])
409 # This checks for the unifont, 8x16, freetype2 and pango font backends and
410 # enables them if requested and available.
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.
419 if test x$enable_unifont = xyes ; then
423 if test x$unifont_enabled = xyes ; then
424 AC_DEFINE([KMSCON_HAVE_UNIFONT], [1],
425 [Use static unifont backend])
428 AM_CONDITIONAL([KMSCON_HAVE_UNIFONT], [test x$unifont_enabled = xyes])
431 if test ! x$enable_f8x16 = xno ; then
435 if test x$f8x16_enabled = xyes ; then
436 AC_DEFINE([KMSCON_HAVE_8X16], [1],
437 [Use static 8x16 font backend])
440 AM_CONDITIONAL([KMSCON_HAVE_8X16], [test x$f8x16_enabled = xyes])
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])
451 if test x$freetype2_enabled = xyes ; then
452 AC_DEFINE([KMSCON_HAVE_FREETYPE2], [1],
453 [Use freetype2 as font backend])
459 AM_CONDITIONAL([KMSCON_HAVE_FREETYPE2], [test x$freetype2_enabled = xyes])
462 if test ! x$enable_pango = xno ; then
463 if test x$have_pango = xyes ; then
465 elif test x$enable_pango = xyes ; then
466 AC_ERROR([pango not found for pango font backend])
470 if test x$pango_enabled = xyes ; then
471 AC_DEFINE([KMSCON_HAVE_PANGO], [1],
472 [Use pango as font backend])
478 AM_CONDITIONAL([KMSCON_HAVE_PANGO], [test x$pango_enabled = xyes])
481 # BBlit Rendering backend
485 if test ! x$enable_bblit = xno ; then
489 if test x$bblit_enabled = xyes ; then
490 AC_DEFINE([KMSCON_HAVE_BBLIT], [1],
491 [Use bblit rendering backend])
494 AM_CONDITIONAL([KMSCON_HAVE_BBLIT], [test x$bblit_enabled = xyes])
497 # BBulk Rendering backend
501 if test ! x$enable_bbulk = xno ; then
505 if test x$bbulk_enabled = xyes ; then
506 AC_DEFINE([KMSCON_HAVE_BBULK], [1],
507 [Use bbulk rendering backend])
510 AM_CONDITIONAL([KMSCON_HAVE_BBULK], [test x$bbulk_enabled = xyes])
513 # OpenGL Texture rendering backend
514 # This is not really an option but automatically enabled if OpenGLES2 support
519 if test x$gles2_enabled = xyes ; then
525 # After everything is configured, we correctly substitute the values for the
529 AC_SUBST(SYSTEMD_CFLAGS)
530 AC_SUBST(SYSTEMD_LIBS)
531 AC_SUBST(DBUS_CFLAGS)
539 AC_SUBST(GLES2_CFLAGS)
541 AC_SUBST(UDEV_CFLAGS)
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)
550 AC_CONFIG_FILES([Makefile libeloop.pc libuterm.pc])
551 AC_OUTPUT([src/genshader.c])
554 # Configuration output
555 # Show configuration to the user so they can check whether everything was
556 # configured as expected.
559 AC_MSG_NOTICE([Build configuration:
561 debug: $debug_enabled
562 optimizations: $optimizations_enabled
564 systemd: $systemd_enabled
567 xkbcommon: $xkbcommon_enabled
569 libuterm video backends:
570 fbdev: $fbdev_enabled
571 dumb drm: $dumb_enabled
573 OpenGLES2: $gles2_enabled
576 unifont: $unifont_enabled
578 freetype2: $freetype2_enabled
579 pango: $pango_enabled
582 bblit: $bblit_enabled
583 bbulk: $bbulk_enabled
584 gltex: $gltex_enabled
586 Run "make" to start compilation process])