5 # Copyright (c) 2007-2013 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2013 Red Hat, Inc.
8 # This library is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation; either
11 # version 2.1 of the License, or (at your option) any later version.
13 # This library is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this library; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
24 # If ibus_released is 0, append datestamp to the version number.
25 m4_define([ibus_released], [1])
27 m4_define([ibus_major_version], [1])
28 m4_define([ibus_minor_version], [5])
29 m4_define([ibus_micro_version], [3])
30 m4_define([ibus_abi_current], [5])
31 m4_define([ibus_abi_revision],
32 [m4_eval(100 * ibus_minor_version + ibus_micro_version)])
33 m4_define([ibus_abi_age], [0])
34 m4_define([ibus_maybe_datestamp],
35 m4_esyscmd([test x]ibus_released[ != x1 && date +.%Y%m%d | tr -d '\n\r']))
36 m4_define([ibus_version],
37 ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
38 m4_define([ibus_api_version], [ibus_major_version.0])
41 AC_INIT([ibus], [ibus_version],
42 [http://code.google.com/p/ibus/issues/entry],
45 AC_CONFIG_HEADERS([config.h])
46 AC_CONFIG_MACRO_DIR([m4])
48 m4_define([ibus_abi_current_minus_age],
49 [m4_eval(ibus_abi_current - ibus_abi_age)])
50 m4_define([ibus_binary_version],
51 [ibus_major_version.ibus_abi_current_minus_age.ibus_abi_age.ibus_abi_revision])
53 # Required versions of other packages.
54 m4_define([glib_required_version], [2.32.0])
56 # VALA_TARGET_GLIB_VERSION is used by valac --ccode --target-glib .
57 # VALA_TARGET_GLIB_VERSION and glib_required_version will be different
59 VALA_TARGET_GLIB_VERSION=2.32
60 AC_SUBST(VALA_TARGET_GLIB_VERSION)
63 AM_INIT_AUTOMAKE([1.11.1 parallel-tests])
64 AM_MAINTAINER_MODE([enable])
67 # Support silent build rules. Disable
68 # by either passing --disable-silent-rules to configure or passing V=1
70 AM_SILENT_RULES([yes])
72 # Define sustituted variables:
73 IBUS_MAJOR_VERSION=ibus_major_version
74 IBUS_MINOR_VERSION=ibus_minor_version
75 IBUS_MICRO_VERSION=ibus_micro_version
76 IBUS_ABI_CURRENT=ibus_abi_current
77 IBUS_ABI_REVISION=ibus_abi_revision
78 IBUS_ABI_AGE=ibus_abi_age
79 IBUS_VERSION=ibus_version
80 IBUS_API_VERSION=ibus_api_version
81 IBUS_BINARY_VERSION=ibus_binary_version
82 AC_SUBST(IBUS_MAJOR_VERSION)
83 AC_SUBST(IBUS_MINOR_VERSION)
84 AC_SUBST(IBUS_MICRO_VERSION)
85 AC_SUBST(IBUS_ABI_CURRENT)
86 AC_SUBST(IBUS_ABI_REVISION)
87 AC_SUBST(IBUS_ABI_AGE)
88 AC_SUBST(IBUS_API_VERSION)
89 AC_SUBST(IBUS_VERSION)
90 AC_SUBST(IBUS_BINARY_VERSION)
94 # If LT_VERSION_INFO="lt_current:lt_revision:lt_age", libibus is
95 # libibus-ibus_api_version.so.(lt_current - lt_age).lt_age.lt_revision
96 # If the abi is changed, but it is compatible with last version,
97 # ibus_abi_current++, ibus_abi_age++;
98 # If the abi is not compatible with last version,
99 # ibus_abi_current++, ibus_abi_age = 0;
100 m4_define([lt_current], [ibus_abi_current])
101 m4_define([lt_revision], [ibus_abi_revision])
102 m4_define([lt_age], [ibus_abi_age])
103 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
104 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
105 AC_SUBST(LT_VERSION_INFO)
106 AC_SUBST(LT_CURRENT_MINUS_AGE)
108 # Define GETTEXT_* variables.
109 GETTEXT_PACKAGE=ibus10
110 AC_SUBST(GETTEXT_PACKAGE)
111 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
112 [The prefix for out gettext translation domains.])
113 GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
114 GLIB_LOCALE_DIR=$localedir
115 AC_SUBST(GLIB_LOCALE_DIR)
118 m4_define(ibus_datedisplay,
119 m4_esyscmd(date '+%a %b %d %Y' | tr -d '\n\r'))
120 DATE_DISPLAY="ibus_datedisplay"
121 AC_SUBST(DATE_DISPLAY)
124 # Check for programs.
128 AM_PROG_VALAC([0.14])
135 # Define PACKAGE_VERSION_* variables.
140 IT_PROG_INTLTOOL([0.35.0])
143 AC_CHECK_FUNCS(daemon)
148 PKG_CHECK_MODULES(GLIB2, [
149 glib-2.0 >= glib_required_version
151 PKG_CHECK_MODULES(GOBJECT2, [
152 gobject-2.0 >= glib_required_version
154 PKG_CHECK_MODULES(GIO2, [
155 gio-2.0 >= glib_required_version
157 PKG_CHECK_MODULES(GTHREAD2, [
158 gthread-2.0 >= glib_required_version
161 # --disable-tests option.
163 AS_HELP_STRING([--disable-tests],
165 [enable_tests=$enableval],
168 AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" = x"yes"])
169 if test x"$enable_tests" != x"yes"; then
170 enable_tests="no (disabled, use --enable-tests to enable)"
173 # --disable-gtk2 option.
175 AS_HELP_STRING([--disable-gtk2],
176 [Do not build gtk2 im module]),
177 [enable_gtk2=$enableval],
180 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
182 # --disable-gtk3 option.
184 AS_HELP_STRING([--disable-gtk3],
185 [Do not build gtk3 im module]),
186 [enable_gtk3=$enableval],
189 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
191 # --disable-xim option.
193 AS_HELP_STRING([--disable-xim],
194 [Do not build xim server]),
195 [enable_xim=$enableval],
198 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
200 # --enable-wayland option.
201 AC_ARG_ENABLE(wayland,
202 AS_HELP_STRING([--enable-wayland],
203 [Build wayland support]),
204 [enable_wayland=$enableval],
207 AM_CONDITIONAL([ENABLE_WAYLAND], [test x"$enable_wayland" = x"yes"])
209 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
211 PKG_CHECK_MODULES(GTK2, [
216 if test x"$enable_gtk2" = x"yes"; then
218 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
219 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
221 PKG_CHECK_MODULES(GDK2, [
225 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
228 if test x"$enable_gtk3" = x"yes"; then
229 # check for gtk3, gdk3
230 PKG_CHECK_MODULES(GTK3, [
234 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
235 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
237 PKG_CHECK_MODULES(GDK3, [
241 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
244 if test x"$enable_xim" = x"yes"; then
246 PKG_CHECK_MODULES(X11, [
249 AC_CHECK_HEADERS([X11/XKBlib.h])
251 enable_xim="no (disabled, use --enable-xim to enable)"
254 if test x"$enable_wayland" = x"yes"; then
256 PKG_CHECK_MODULES(WAYLAND, [
257 wayland-client >= 1.2.0
261 enable_wayland="no (disabled, use --enable-wayland to enable)"
264 # GObject introspection
265 GOBJECT_INTROSPECTION_CHECK([0.6.8])
267 IBUS_GIR_SCANNERFLAGS=
268 if test x"$found_introspection" = x"yes" ; then
269 IBUS_GIR_SCANNERFLAGS="--warn-all --identifier-prefix=IBus --symbol-prefix=ibus"
270 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
271 [gir_symbol_prefix=yes],
272 [gir_symbol_prefix=no])
273 if test x"$gir_symbol_prefix" = x"no" ; then
274 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
277 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
280 VAPIGEN_CHECK([0.16])
284 if test x"$enable_gtk_doc" = x"no"; then
285 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
289 PKG_CHECK_MODULES(DBUS, [
293 # --enable-gconf option.
295 AS_HELP_STRING([--enable-gconf],
297 [enable_gconf=$enableval],
300 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
302 if test x"$enable_gconf" = x"yes"; then
304 PKG_CHECK_MODULES(GCONF,
308 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
309 if test x"$GCONFTOOL" = xno; then
310 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
314 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
316 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
317 enable_gconf="no (disabled, use --enable-gconf to enable)"
320 # --enable-memconf option.
321 AC_ARG_ENABLE(memconf,
322 AS_HELP_STRING([--enable-memconf],
323 [Enable configure base on memory]),
324 [enable_memconf=$enableval],
327 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
330 AS_HELP_STRING([--disable-dconf],
331 [Disable configure base on dconf]),
332 [enable_dconf=$enableval],
335 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
337 if test x"$enable_dconf" = x"yes"; then
339 PKG_CHECK_MODULES(DCONF,
342 PKG_CHECK_EXISTS([dconf >= 0.13.4],
343 [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
345 # check glib-compile-schemas
347 AC_PATH_PROG([GSETTINGS_SCHEMA_CONVERT], [gsettings-schema-convert])
348 AS_IF([test x"$ac_cv_path_GSETTINGS_SCHEMA_CONVERT" = x""],
349 [AC_MSG_ERROR([gsettings-schema-convert from GConf2 is required for dconf support])])
350 enable_dconf="yes (enabled, use --disable-dconf to disable)"
354 AC_PATH_PROG(ENV_IBUS_TEST, env)
355 AC_SUBST(ENV_IBUS_TEST)
357 AC_ARG_ENABLE(python-library,
358 AS_HELP_STRING([--enable-python-library],
359 [Use ibus python library]),
360 [enable_python_library=$enableval],
361 [enable_python_library=no]
365 AS_HELP_STRING([--disable-setup],
366 [Do not use setup ui.]),
367 [enable_setup=$enableval],
371 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
372 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
373 AM_CONDITIONAL([ENABLE_DAEMON], [true])
375 AM_PATH_PYTHON([2.5])
377 PYGOBJECT_REQUIRED=3.0.0
379 PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
380 [enable_pygobject=yes], [enable_pygobject=no])
382 if test "x$enable_pygobject" = "xyes"; then
383 PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
385 pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
386 AC_SUBST(pyoverridesdir)
389 AM_CONDITIONAL(ENABLE_PYGOBJECT, test x"$enable_pygobject" = "xyes")
391 if test x"$enable_python_library" = x"yes"; then
393 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
394 if test x"$PYTHON_CONFIG" = x""; then
395 AC_PATH_PROG(PYTHON_CONFIG, python-config)
397 if test x"$PYTHON_CONFIG" != x""; then
398 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
399 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
401 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
402 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
404 PYTHON_INCLUDES="$PYTHON_CFLAGS"
405 AC_SUBST(PYTHON_CFLAGS)
406 AC_SUBST(PYTHON_INCLUDES)
407 AC_SUBST(PYTHON_LIBS)
409 enable_python_library="no (disabled, use --enable-python-library to enable)"
412 # Define gtk2 immodule dir.
413 AC_ARG_WITH(gtk2-im-module-dir,
414 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
415 [Select gtk2 immodule dir]),
416 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
418 AC_SUBST(GTK2_IM_MODULEDIR)
420 # Define gtk3 immodule dir.
421 AC_ARG_WITH(gtk3-im-module-dir,
422 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
423 [Select gtk3 immodule dir]),
424 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
426 AC_SUBST(GTK3_IM_MODULEDIR)
428 if test x"$enable_python" = x"yes"; then
429 # Check for dbus-python.
430 AC_ARG_ENABLE(dbus-python-check,
431 AS_HELP_STRING([--disable-dbus-python-check],
432 [Do not check dbus-python]),
433 [enable_dbus_python_check=$enableval],
434 [enable_dbus_python_check=yes]
436 PKG_CHECK_MODULES(DBUS_PYTHON,
437 [dbus-python >= 0.83.0],
438 [IBUS_HAS_DBUS_PYTHON=yes],
439 [IBUS_HAS_DBUS_PYTHON=no]
441 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
442 if test x"$enable_dbus_python_check" != x"no"; then
443 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
445 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
450 # Option for always disable snooper applications.
451 AC_ARG_ENABLE(key-snooper,
452 AS_HELP_STRING([--disable-key-snooper],
453 [Always disable key snooper in gtk im module]),
454 [enable_key_snooper=$enableval],
455 [enable_key_snooper=yes]
457 if test x"$enable_key_snooper" = x"yes"; then
458 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
460 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
461 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
464 # Option for no snooper applications.
465 AC_ARG_WITH(no-snooper-apps,
466 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
467 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
468 NO_SNOOPER_APPS=$with_no_snooper_apps,
469 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
471 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
472 [Does not enbale keyboard snooper in those applications])
474 # GNOME 3 uses the theme's icon.
475 AC_ARG_WITH(panel-icon-keyboard,
476 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
477 [Set the default panel icon (default: "ibus-keyboard")]),
478 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
479 x"$with_panel_icon_keyboard" = x; then
480 with_panel_icon_keyboard="input-keyboard-symbolic"
482 if test x"$with_panel_icon_keyboard" = x"legacy"; then
483 with_panel_icon_keyboard="ibus-keyboard"
485 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
487 IBUS_ICON_KEYBOARD="ibus-keyboard"
489 AC_SUBST(IBUS_ICON_KEYBOARD)
491 # --disable-surrounding-text option.
492 AC_ARG_ENABLE(surrounding-text,
493 AS_HELP_STRING([--disable-surrounding-text],
494 [Enable surrounding-text support]),
495 [enable_surrounding_text=$enableval],
496 [enable_surrounding_text=yes]
498 if test x"$enable_surrounding_text" = x"yes"; then
499 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
501 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
506 AS_HELP_STRING([--disable-ui],
507 [Disable ibus default user interface]),
508 [enable_ui=$enableval],
511 AM_CONDITIONAL([ENABLE_UI], [test x"$enable_ui" = x"yes"])
512 if test x"$enable_ui" = x"yes"; then
513 enable_ui="yes (enabled, use --disable-ui to disable)"
517 AC_ARG_ENABLE(engine,
518 AS_HELP_STRING([--disable-engine],
519 [Disable ibus simple engine]),
520 [enable_engine=$enableval],
523 AM_CONDITIONAL([ENABLE_ENGINE], [test x"$enable_engine" = x"yes"])
524 if test x"$enable_engine" = x"yes"; then
525 enable_engine="yes (enabled, use --disable-engine to disable)"
528 # --disable-libnotify
529 AC_ARG_ENABLE(libnotify,
530 AS_HELP_STRING([--disable-libnotify],
531 [Disable to link libnotify]),
532 [enable_libnotify=$enableval],
533 [enable_libnotify=yes]
535 AM_CONDITIONAL([ENABLE_LIBNOTIFY], [test x"$enable_libnotify" = x"yes"])
536 if test x"$enable_libnotify" = x"yes"; then
537 PKG_CHECK_MODULES(LIBNOTIFY, [
540 enable_libnotify="yes (enabled, use --disable-libnotify to disable)"
544 PKG_CHECK_MODULES(ISOCODES, [
547 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
548 AC_SUBST(ISOCODES_PREFIX)
551 AC_CONFIG_FILES([ po/Makefile.in
559 client/wayland/Makefile
569 data/keymaps/Makefile
572 docs/reference/Makefile
573 docs/reference/ibus/ibus-docs.sgml
574 docs/reference/ibus/Makefile
578 ibus/interface/Makefile
584 bindings/pygobject/Makefile
585 bindings/vala/Makefile
589 conf/memconf/Makefile
596 Version $IBUS_VERSION
597 Install prefix $prefix
598 Build shared libs $enable_shared
599 Build static libs $enable_static
601 Gtk2 immodule dir $GTK2_IM_MODULEDIR
602 Gtk3 immodule dir $GTK3_IM_MODULEDIR
603 Build gtk2 immodule $enable_gtk2
604 Build gtk3 immodule $enable_gtk3
605 Build XIM agent server $enable_xim
606 Build wayland support $enable_wayland
607 Build python library $enable_python_library
608 Build gconf modules $enable_gconf
609 Build memconf modules $enable_memconf
610 Build dconf modules $enable_dconf
611 Build introspection $found_introspection
612 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
613 Build vala binding $enable_vala
614 Build document $enable_gtk_doc
616 Build engine $enable_engine
617 Enable key snooper $enable_key_snooper
618 No snooper regexes "$NO_SNOOPER_APPS"
619 Panel icon "$IBUS_ICON_KEYBOARD"
620 Enable surrounding-text $enable_surrounding_text
621 Enable libnotify $enable_libnotify
622 Run test cases $enable_tests