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([PANGO], [pango pangoft2],
80 [have_pango=yes], [have_pango=no])
82 PKG_CHECK_MODULES([FREETYPE2], [freetype2],
83 [have_freetype2=yes], [have_freetype2=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 uterm fbdev video backend])
104 AC_ARG_ENABLE([fbdev],
105 [AS_HELP_STRING([--enable-fbdev],
106 [enable uterm fbdev video backend])])
109 AC_MSG_CHECKING([whether to use uterm drm video backend])
111 [AS_HELP_STRING([--enable-drm],
112 [enable uterm drm video backend])])
115 AC_MSG_CHECKING([whether to provide OpenGLES2 support])
116 AC_ARG_ENABLE([gles2],
117 [AS_HELP_STRING([--enable-gles2],
118 [provide uterm OpenGLES2 support])])
121 AC_MSG_CHECKING([whether to use xkbcommon keyboard backend])
122 AC_ARG_ENABLE([xkbcommon],
123 [AS_HELP_STRING([--disable-xkbcommon],
124 [disable xkbcommon keyboard backend])])
127 AC_MSG_CHECKING([whether to build with debugging on])
128 AC_ARG_ENABLE([debug],
129 [AS_HELP_STRING([--enable-debug],
130 [whether to build with debugging on])])
135 # In debug mode we use -g -O0 for compilation and set several flags so verbose
136 # logging is possible.
140 if test x$enable_debug = xyes ; then
144 if test x$debug_enabled = xyes ; then
145 AC_DEFINE([KMSCON_ENABLE_DEBUG], [1],
146 [Enable debug for kmscon])
147 AC_DEFINE([LOG_ENABLE_DEBUG], [1],
148 [Enable debug for log subsystem])
149 AC_DEFINE([LLOG_ENABLE_DEBUG], [1],
150 [Enable debug for llog subsystem])
152 AC_DEFINE([NDEBUG], [1], [No Debug])
155 AM_CONDITIONAL([DEBUG], [test x$debug_enabled = xyes])
159 # This checks for all dependencies that are not optional.
162 # We currently have no mandatory dependencies!
166 # We can optionally use systemd for multi-seat support. If systemd is not
167 # available or the system was not started with systemd, we simply fall back to
172 if test ! x$enable_systemd = xno ; then
173 if test x$have_systemd = xyes ; then
175 elif test x$enable_systemd = xyes ; then
176 AC_ERROR([systemd libraries not found for multi-seat support])
180 if test x$systemd_enabled = xyes ; then
181 AC_DEFINE([UTERM_HAVE_SYSTEMD], [1],
182 [Use systemd for multi-seat support])
190 # For hotplugging support we need udev to notify us about system events. If udev
191 # is not available, we simply fall back to static mode. Periodic scanning is
196 if test ! x$enable_udev = xno ; then
197 if test x$have_udev = xyes ; then
199 elif test x$enable_udev = xyes ; then
200 AC_ERROR([udev libraries not found for device hotplug support])
204 if test x$udev_enabled = xyes ; then
205 AC_DEFINE([UTERM_HAVE_UDEV], [1],
206 [Use udev for device hotplug support])
214 # For IPC mechanisms we use DBus. Especially multi-seat enabled multi-session
215 # capable applications need DBus to manage application and terminal switching.
219 if test ! x$enable_dbus = xno ; then
220 if test x$have_dbus = xyes ; then
222 elif test x$enable_dbus = xyes; then
223 AC_ERROR([dbus libraries not found])
227 if test x$dbus_enabled = xyes; then
228 AC_DEFINE([EV_HAVE_DBUS], [1],
235 AM_CONDITIONAL([EV_HAVE_DBUS], [test x$dbus_enabled = xyes])
238 # Uterm fbdev backend
239 # This checks whether the fbdev backend was requested and enables it then. There
240 # are no special dependencies for it except the kernel headers.
241 # TODO: check for kernel headers here
245 if test ! x$enable_fbdev = xno ; then
249 if test x$fbdev_enabled = xyes ; then
250 AC_DEFINE([UTERM_HAVE_FBDEV], [1],
251 [Use uterm fbdev video backend])
254 AM_CONDITIONAL([UTERM_HAVE_FBDEV], [test x$fbdev_enabled = xyes])
258 # This checks whether libdrm is available and some combination of libgbm, egl
259 # and gl or glesv2. If it is not available, then the drm backend is simply not
266 if test ! x$enable_drm = xno ; then
267 if test x$have_drm = xyes ; then
271 if test ! x$enable_gles2 = xno ; then
272 if test x$have_drm = xyes -a x$have_gbm = xyes -a x$have_egl = xyes ; then
273 if test x$have_gles2 = xyes ; then
280 if test x$enable_drm = xyes -a x$dumb_enabled = xno ; then
281 AC_ERROR([drm library not found for uterm dumb drm backend])
284 if test x$enable_gles2 = xyes -a x$drm_enabled = xno ; then
285 AC_ERROR([drm, gbm, egl, gl or gles2 libraries not found for uterm drm backend])
289 if test x$dumb_enabled = xyes ; then
290 AC_DEFINE([UTERM_HAVE_DUMB], [1],
291 [Use uterm dumb drm video backend])
293 if test x$drm_enabled = xyes ; then
294 AC_DEFINE([UTERM_HAVE_DRM], [1],
295 [Use uterm DRM video backend])
311 if test x$gles2_enabled = xyes ; then
312 AC_DEFINE([KMSCON_HAVE_GLES2], [1],
313 [Use OpenGLESv2 as drawing backend])
319 AM_CONDITIONAL([UTERM_HAVE_DUMB], [test x$dumb_enabled = xyes])
320 AM_CONDITIONAL([UTERM_HAVE_DRM], [test x$drm_enabled = xyes])
321 AM_CONDITIONAL([KMSCON_HAVE_GLES2], [test x$gles2_enabled = xyes])
324 # xkbcommon keyboard backend
325 # This checks for the xkbcommon library for keyboard handling in uterm. If it is
326 # not available, we use a dumb-keyboard backend as fall-back.
330 if test ! x$enable_xkbcommon = xno ; then
331 if test x$have_xkbcommon = xyes ; then
332 xkbcommon_enabled=yes
333 elif test x$enable_xkbcommon = xyes ; then
334 AC_ERROR([xkbcommon not found for keyboard backend])
338 if test x$xkbcommon_enabled = xyes ; then
339 AC_DEFINE([UTERM_HAVE_XKBCOMMON], [1],
340 [Use xkbcommon as input keyboard handling backend])
346 AM_CONDITIONAL([UTERM_HAVE_XKBCOMMON], [test x$xkbcommon_enabled = xyes])
350 # After everything is configured, we correctly substitute the values for the
354 AC_SUBST(SYSTEMD_CFLAGS)
355 AC_SUBST(SYSTEMD_LIBS)
356 AC_SUBST(DBUS_CFLAGS)
364 AC_SUBST(GLES2_CFLAGS)
366 AC_SUBST(UDEV_CFLAGS)
368 AC_SUBST(XKBCOMMON_CFLAGS)
369 AC_SUBST(XKBCOMMON_LIBS)
370 AC_SUBST(FREETYPE2_CFLAGS)
371 AC_SUBST(FREETYPE2_LIBS)
372 AC_SUBST(PANGO_CFLAGS)
375 AC_CONFIG_FILES([Makefile docs/reference/Makefile docs/reference/version.xml])
376 AC_OUTPUT([src/genshader.c])
379 # Configuration output
380 # Show configuration to the user so they can check whether everything was
381 # configured as expected.
384 AC_MSG_NOTICE([Build configuration:
386 debug: $debug_enabled
388 systemd: $systemd_enabled
391 xkbcommon: $xkbcommon_enabled
393 libuterm video backends:
394 fbdev: $fbdev_enabled
395 dumb drm: $dumb_enabled
397 OpenGLES2: $gles2_enabled
399 Run "make" to start compilation process])