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
37 # Use weird syntax to make "gtkdocize" happy.
40 m4_ifdef([GTK_DOC_CHECK],[
41 GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
42 ], [AM_CONDITIONAL([ENABLE_GTK_DOC], false)])
45 # pkg-config dependencies
46 # This unconditionally checks for all dependencies even if they are disabled. We
47 # later look whether all required depedencies are met and finish the
48 # configuration. We group similar packages into one logical group here to avoid
49 # having variables for each single library.
50 # This, however, makes ./configure output very unintuitive error messages if a
51 # package is not found so we must make sure we print more verbose messages
55 PKG_CHECK_MODULES([SYSTEMD], [libsystemd-login],
56 [have_systemd=yes], [have_systemd=no])
58 PKG_CHECK_MODULES([UDEV], [libudev],
59 [have_udev=yes], [have_udev=no])
61 PKG_CHECK_MODULES([DBUS], [dbus-1],
62 [have_dbus=yes], [have_dbus=no])
64 PKG_CHECK_MODULES([DRM], [libdrm],
65 [have_drm=yes], [have_drm=no])
67 PKG_CHECK_MODULES([GBM], [gbm],
68 [have_gbm=yes], [have_gbm=no])
70 PKG_CHECK_MODULES([EGL], [egl],
71 [have_egl=yes], [have_egl=no])
73 PKG_CHECK_MODULES([GLES2], [glesv2],
74 [have_gles2=yes], [have_gles2=no])
76 PKG_CHECK_MODULES([XKBCOMMON], [xkbcommon],
77 [have_xkbcommon=yes], [have_xkbcommon=no])
79 PKG_CHECK_MODULES([FREETYPE2], [freetype2 fontconfig],
80 [have_freetype2=yes], [have_freetype2=no])
82 PKG_CHECK_MODULES([PANGO], [pango pangoft2],
83 [have_pango=yes], [have_pango=no])
87 # Parse all command line arguments and save the values so we can check them
88 # later when configuring kmscon.
91 AC_MSG_CHECKING([whether to use systemd for multi-seat support])
92 AC_ARG_ENABLE([systemd],
93 [AS_HELP_STRING([--enable-systemd],
94 [enable multi-seat support with systemd])])
97 AC_MSG_CHECKING([whether to use udev for device hotplug support])
99 [AS_HELP_STRING([--enable-udev],
100 [enable device hotplug support with udev])])
103 AC_MSG_CHECKING([whether to use dbus for IPC])
104 AC_ARG_ENABLE([dbus],
105 [AS_HELP_STRING([--enable-dbus],
109 AC_MSG_CHECKING([whether to use uterm fbdev video backend])
110 AC_ARG_ENABLE([fbdev],
111 [AS_HELP_STRING([--enable-fbdev],
112 [enable uterm fbdev video backend])])
115 AC_MSG_CHECKING([whether to use uterm drm video backend])
117 [AS_HELP_STRING([--enable-drm],
118 [enable uterm drm video backend])])
121 AC_MSG_CHECKING([whether to provide OpenGLES2 support])
122 AC_ARG_ENABLE([gles2],
123 [AS_HELP_STRING([--enable-gles2],
124 [provide uterm OpenGLES2 support])])
127 AC_MSG_CHECKING([whether to use xkbcommon keyboard backend])
128 AC_ARG_ENABLE([xkbcommon],
129 [AS_HELP_STRING([--disable-xkbcommon],
130 [disable xkbcommon keyboard backend])])
133 AC_MSG_CHECKING([whether to use static 8x16 font backend])
134 AC_ARG_ENABLE([f8x16],
135 [AS_HELP_STRING([--disable-f8x16],
136 [disable static 8x16 font backend])])
139 AC_MSG_CHECKING([whether to use freetype2 font backend])
140 AC_ARG_ENABLE([freetype2],
141 [AS_HELP_STRING([--disable-freetype2],
142 [disable freetype2 font backend])])
145 AC_MSG_CHECKING([whether to use pango font backend])
146 AC_ARG_ENABLE([pango],
147 [AS_HELP_STRING([--disable-pango],
148 [disable pango font backend])])
151 AC_MSG_CHECKING([whether to use bblit rendering backend])
152 AC_ARG_ENABLE([bblit],
153 [AS_HELP_STRING([--disable-bblit],
154 [disable bblit rendering backend])])
157 AC_MSG_CHECKING([whether to build with debugging on])
158 AC_ARG_ENABLE([debug],
159 [AS_HELP_STRING([--enable-debug],
160 [whether to build with debugging on])])
163 AC_MSG_CHECKING([whether to disable code optimizations])
164 AC_ARG_ENABLE([optimizations],
165 [AS_HELP_STRING([--disable-optimizations],
166 [whether to disable code optimizations])])
170 # Debug mode and code optimizations
171 # In debug mode we compile with -g and enable several debug-messages and flags.
172 # With optimizations (default), we add -O2 to compile-flags.
176 if test x$enable_debug = xyes ; then
180 optimizations_enabled=no
181 if test ! x$enable_optimizations = xno ; then
182 optimizations_enabled=yes
185 if test x$debug_enabled = xyes ; then
186 AC_DEFINE([KMSCON_ENABLE_DEBUG], [1],
187 [Enable debug for kmscon])
188 AC_DEFINE([LOG_ENABLE_DEBUG], [1],
189 [Enable debug for log subsystem])
190 AC_DEFINE([LLOG_ENABLE_DEBUG], [1],
191 [Enable debug for llog subsystem])
193 AC_DEFINE([NDEBUG], [1], [No Debug])
196 AM_CONDITIONAL([DEBUG], [test x$debug_enabled = xyes])
197 AM_CONDITIONAL([OPTIMIZATIONS], [test x$optimizations_enabled = xyes])
201 # This checks for all dependencies that are not optional.
204 # We currently have no mandatory dependencies!
208 # We can optionally use systemd for multi-seat support. If systemd is not
209 # available or the system was not started with systemd, we simply fall back to
214 if test ! x$enable_systemd = xno ; then
215 if test x$have_systemd = xyes ; then
217 elif test x$enable_systemd = xyes ; then
218 AC_ERROR([systemd libraries not found for multi-seat support])
222 if test x$systemd_enabled = xyes ; then
223 AC_DEFINE([UTERM_HAVE_SYSTEMD], [1],
224 [Use systemd for multi-seat support])
232 # For hotplugging support we need udev to notify us about system events. If udev
233 # is not available, we simply fall back to static mode. Periodic scanning is
238 if test ! x$enable_udev = xno ; then
239 if test x$have_udev = xyes ; then
241 elif test x$enable_udev = xyes ; then
242 AC_ERROR([udev libraries not found for device hotplug support])
246 if test x$udev_enabled = xyes ; then
247 AC_DEFINE([UTERM_HAVE_UDEV], [1],
248 [Use udev for device hotplug support])
256 # For IPC mechanisms we use DBus. Especially multi-seat enabled multi-session
257 # capable applications need DBus to manage application and terminal switching.
261 if test ! x$enable_dbus = xno ; then
262 if test x$have_dbus = xyes ; then
264 elif test x$enable_dbus = xyes; then
265 AC_ERROR([dbus libraries not found])
269 if test x$dbus_enabled = xyes; then
270 AC_DEFINE([EV_HAVE_DBUS], [1],
277 AM_CONDITIONAL([EV_HAVE_DBUS], [test x$dbus_enabled = xyes])
280 # Uterm fbdev backend
281 # This checks whether the fbdev backend was requested and enables it then. There
282 # are no special dependencies for it except the kernel headers.
283 # TODO: check for kernel headers here
287 if test ! x$enable_fbdev = xno ; then
291 if test x$fbdev_enabled = xyes ; then
292 AC_DEFINE([UTERM_HAVE_FBDEV], [1],
293 [Use uterm fbdev video backend])
296 AM_CONDITIONAL([UTERM_HAVE_FBDEV], [test x$fbdev_enabled = xyes])
300 # This checks whether libdrm is available and some combination of libgbm, egl
301 # and gl or glesv2. If it is not available, then the drm backend is simply not
308 if test ! x$enable_drm = xno ; then
309 if test x$have_drm = xyes ; then
313 if test ! x$enable_gles2 = xno ; then
314 if test x$have_drm = xyes -a x$have_gbm = xyes -a x$have_egl = xyes ; then
315 if test x$have_gles2 = xyes ; then
322 if test x$enable_drm = xyes -a x$dumb_enabled = xno ; then
323 AC_ERROR([drm library not found for uterm dumb drm backend])
326 if test x$enable_gles2 = xyes -a x$drm_enabled = xno ; then
327 AC_ERROR([drm, gbm, egl, gl or gles2 libraries not found for uterm drm backend])
331 if test x$dumb_enabled = xyes ; then
332 AC_DEFINE([UTERM_HAVE_DUMB], [1],
333 [Use uterm dumb drm video backend])
335 if test x$drm_enabled = xyes ; then
336 AC_DEFINE([UTERM_HAVE_DRM], [1],
337 [Use uterm DRM video backend])
353 if test x$gles2_enabled = xyes ; then
354 AC_DEFINE([KMSCON_HAVE_GLES2], [1],
355 [Use OpenGLESv2 as drawing backend])
361 AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
362 AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
363 AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
365 if test x$have_gbm = xyes ; then
366 save_CFLAGS="$CFLAGS"
372 [AC_DEFINE([HAVE_GBM_BO_GET_STRIDE],
374 [Define to 1 if your libgbm provides gbm_bo_get_stride])])
375 CFLAGS="$save_CFLAGS"
380 # xkbcommon keyboard backend
381 # This checks for the xkbcommon library for keyboard handling in uterm. If it is
382 # not available, we use a dumb-keyboard backend as fall-back.
386 if test ! x$enable_xkbcommon = xno ; then
387 if test x$have_xkbcommon = xyes ; then
388 xkbcommon_enabled=yes
389 elif test x$enable_xkbcommon = xyes ; then
390 AC_ERROR([xkbcommon not found for keyboard backend])
394 if test x$xkbcommon_enabled = xyes ; then
395 AC_DEFINE([UTERM_HAVE_XKBCOMMON], [1],
396 [Use xkbcommon as input keyboard handling backend])
402 AM_CONDITIONAL([UTERM_HAVE_XKBCOMMON], [test x$xkbcommon_enabled = xyes])
406 # This checks for the 8x16, freetype2 and pango font backends and enables them
407 # if requested and available.
411 if test ! x$enable_f8x16 = xno ; then
415 if test x$f8x16_enabled = xyes ; then
416 AC_DEFINE([KMSCON_HAVE_8X16], [1],
417 [Use static 8x16 font backend])
420 AM_CONDITIONAL([KMSCON_HAVE_8X16], [test x$f8x16_enabled = xyes])
423 if test ! x$enable_freetype2 = xno ; then
424 if test x$have_freetype2 = xyes ; then
425 freetype2_enabled=yes
426 elif test x$enable_freetype2 = xyes ; then
427 AC_ERROR([freetype2/fontconfig not found for freetype2 backend])
431 if test x$freetype2_enabled = xyes ; then
432 AC_DEFINE([KMSCON_HAVE_FREETYPE2], [1],
433 [Use freetype2 as font backend])
439 AM_CONDITIONAL([KMSCON_HAVE_FREETYPE2], [test x$freetype2_enabled = xyes])
442 if test ! x$enable_pango = xno ; then
443 if test x$have_pango = xyes ; then
445 elif test x$enable_pango = xyes ; then
446 AC_ERROR([pango not found for pango font backend])
450 if test x$pango_enabled = xyes ; then
451 AC_DEFINE([KMSCON_HAVE_PANGO], [1],
452 [Use pango as font backend])
458 AM_CONDITIONAL([KMSCON_HAVE_PANGO], [test x$pango_enabled = xyes])
461 # BBlit Rendering backend
465 if test ! x$enable_bblit = xno ; then
469 if test x$bblit_enabled = xyes ; then
470 AC_DEFINE([KMSCON_HAVE_BBLIT], [1],
471 [Use bblit rendering backend])
474 AM_CONDITIONAL([KMSCON_HAVE_BBLIT], [test x$bblit_enabled = xyes])
477 # OpenGL Texture rendering backend
478 # This is not really an option but automatically enabled if OpenGLES2 support
483 if test x$gles2_enabled = xyes ; then
489 # After everything is configured, we correctly substitute the values for the
493 AC_SUBST(SYSTEMD_CFLAGS)
494 AC_SUBST(SYSTEMD_LIBS)
495 AC_SUBST(DBUS_CFLAGS)
503 AC_SUBST(GLES2_CFLAGS)
505 AC_SUBST(UDEV_CFLAGS)
507 AC_SUBST(XKBCOMMON_CFLAGS)
508 AC_SUBST(XKBCOMMON_LIBS)
509 AC_SUBST(FREETYPE2_CFLAGS)
510 AC_SUBST(FREETYPE2_LIBS)
511 AC_SUBST(PANGO_CFLAGS)
514 AC_CONFIG_FILES([Makefile docs/reference/Makefile docs/reference/version.xml])
515 AC_OUTPUT([src/genshader.c])
518 # Configuration output
519 # Show configuration to the user so they can check whether everything was
520 # configured as expected.
523 AC_MSG_NOTICE([Build configuration:
525 debug: $debug_enabled
526 optimizations: $optimizations_enabled
528 systemd: $systemd_enabled
531 xkbcommon: $xkbcommon_enabled
533 libuterm video backends:
534 fbdev: $fbdev_enabled
535 dumb drm: $dumb_enabled
537 OpenGLES2: $gles2_enabled
541 freetype2: $freetype2_enabled
542 pango: $pango_enabled
545 bblit: $bblit_enabled
546 gltex: $gltex_enabled
548 Run "make" to start compilation process])