5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2010 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 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
16 # GNU 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 program; if not, write to the
20 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 # Boston, MA 02111-1307 USA
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], [2])
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])
58 AM_INIT_AUTOMAKE([1.10])
59 AM_MAINTAINER_MODE([enable])
62 # Support silent build rules. Disable
63 # by either passing --disable-silent-rules to configure or passing V=1
65 AM_SILENT_RULES([yes])
67 # Define sustituted variables:
68 IBUS_MAJOR_VERSION=ibus_major_version
69 IBUS_MINOR_VERSION=ibus_minor_version
70 IBUS_MICRO_VERSION=ibus_micro_version
71 IBUS_ABI_CURRENT=ibus_abi_current
72 IBUS_ABI_REVISION=ibus_abi_revision
73 IBUS_ABI_AGE=ibus_abi_age
74 IBUS_VERSION=ibus_version
75 IBUS_API_VERSION=ibus_api_version
76 IBUS_BINARY_VERSION=ibus_binary_version
77 AC_SUBST(IBUS_MAJOR_VERSION)
78 AC_SUBST(IBUS_MINOR_VERSION)
79 AC_SUBST(IBUS_MICRO_VERSION)
80 AC_SUBST(IBUS_ABI_CURRENT)
81 AC_SUBST(IBUS_ABI_REVISION)
82 AC_SUBST(IBUS_ABI_AGE)
83 AC_SUBST(IBUS_API_VERSION)
84 AC_SUBST(IBUS_VERSION)
85 AC_SUBST(IBUS_BINARY_VERSION)
89 # If LT_VERSION_INFO="lt_current:lt_revision:lt_age", libibus is
90 # libibus-ibus_api_version.so.(lt_current - lt_age).lt_age.lt_revision
91 # If the abi is changed, but it is compatible with last version,
92 # ibus_abi_current++, ibus_abi_age++;
93 # If the abi is not compatible with last version,
94 # ibus_abi_current++, ibus_abi_age = 0;
95 m4_define([lt_current], [ibus_abi_current])
96 m4_define([lt_revision], [ibus_abi_revision])
97 m4_define([lt_age], [ibus_abi_age])
98 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
99 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
100 AC_SUBST(LT_VERSION_INFO)
101 AC_SUBST(LT_CURRENT_MINUS_AGE)
103 # Define GETTEXT_* variables.
104 GETTEXT_PACKAGE=ibus10
105 AC_SUBST(GETTEXT_PACKAGE)
106 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
107 [The prefix for out gettext translation domains.])
108 GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
109 GLIB_LOCALE_DIR=$localedir
110 AC_SUBST(GLIB_LOCALE_DIR)
113 m4_define(ibus_datedisplay,
114 m4_esyscmd(date '+%a %b %d %Y' | tr -d '\n\r'))
115 DATE_DISPLAY="ibus_datedisplay"
116 AC_SUBST(DATE_DISPLAY)
119 # Check for programs.
123 AM_PROG_VALAC([0.14])
130 # Define PACKAGE_VERSION_* variables.
135 IT_PROG_INTLTOOL([0.35.0])
138 AC_CHECK_FUNCS(daemon)
143 PKG_CHECK_MODULES(GLIB2, [
144 glib-2.0 >= glib_required_version
146 PKG_CHECK_MODULES(GOBJECT2, [
147 gobject-2.0 >= glib_required_version
149 PKG_CHECK_MODULES(GIO2, [
150 gio-2.0 >= glib_required_version
152 PKG_CHECK_MODULES(GTHREAD2, [
153 gthread-2.0 >= glib_required_version
156 # --disable-tests option.
158 AS_HELP_STRING([--disable-tests],
160 [enable_tests=$enableval],
163 AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" = x"yes"])
164 if test x"$enable_tests" != x"yes"; then
165 enable_tests="no (disabled, use --enable-tests to enable)"
168 # --disable-gtk2 option.
170 AS_HELP_STRING([--disable-gtk2],
171 [Do not build gtk2 im module]),
172 [enable_gtk2=$enableval],
175 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
177 # --disable-gtk3 option.
179 AS_HELP_STRING([--disable-gtk3],
180 [Do not build gtk3 im module]),
181 [enable_gtk3=$enableval],
184 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
186 # --disable-xim option.
188 AS_HELP_STRING([--disable-xim],
189 [Do not build xim server]),
190 [enable_xim=$enableval],
193 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
195 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
197 PKG_CHECK_MODULES(GTK2, [
202 if test x"$enable_gtk2" = x"yes"; then
204 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
205 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
207 PKG_CHECK_MODULES(GDK2, [
211 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
214 if test x"$enable_gtk3" = x"yes"; then
215 # check for gtk3, gdk3
216 PKG_CHECK_MODULES(GTK3, [
220 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
221 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
223 PKG_CHECK_MODULES(GDK3, [
227 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
230 if test x"$enable_xim" = x"yes"; then
232 PKG_CHECK_MODULES(X11, [
235 AC_CHECK_HEADERS([X11/XKBlib.h])
237 enable_xim="no (disabled, use --enable-xim to enable)"
240 # GObject introspection
241 GOBJECT_INTROSPECTION_CHECK([0.6.8])
243 IBUS_GIR_SCANNERFLAGS=
244 if test x"$found_introspection" = x"yes" ; then
245 IBUS_GIR_SCANNERFLAGS="--warn-all --identifier-prefix=IBus --symbol-prefix=ibus"
246 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
247 [gir_symbol_prefix=yes],
248 [gir_symbol_prefix=no])
249 if test x"$gir_symbol_prefix" = x"no" ; then
250 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
253 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
256 VAPIGEN_CHECK([0.16])
260 if test x"$enable_gtk_doc" = x"no"; then
261 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
265 PKG_CHECK_MODULES(DBUS, [
269 # --enable-gconf option.
271 AS_HELP_STRING([--enable-gconf],
273 [enable_gconf=$enableval],
276 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
278 if test x"$enable_gconf" = x"yes"; then
280 PKG_CHECK_MODULES(GCONF,
284 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
285 if test x"$GCONFTOOL" = xno; then
286 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
290 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
292 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
293 enable_gconf="no (disabled, use --enable-gconf to enable)"
296 # --enable-memconf option.
297 AC_ARG_ENABLE(memconf,
298 AS_HELP_STRING([--enable-memconf],
299 [Enable configure base on memory]),
300 [enable_memconf=$enableval],
303 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
306 AS_HELP_STRING([--disable-dconf],
307 [Disable configure base on dconf]),
308 [enable_dconf=$enableval],
311 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
313 if test x"$enable_dconf" = x"yes"; then
315 PKG_CHECK_MODULES(DCONF,
318 PKG_CHECK_EXISTS([dconf >= 0.13.4],
319 [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
321 # check glib-compile-schemas
323 enable_dconf="yes (enabled, use --disable-dconf to disable)"
327 AC_PATH_PROG(ENV_IBUS_TEST, env)
328 AC_SUBST(ENV_IBUS_TEST)
330 AC_ARG_ENABLE(python-library,
331 AS_HELP_STRING([--enable-python-library],
332 [Use ibus python library]),
333 [enable_python_library=$enableval],
334 [enable_python_library=no]
338 AS_HELP_STRING([--disable-setup],
339 [Do not use setup ui.]),
340 [enable_setup=$enableval],
344 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
345 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
346 AM_CONDITIONAL([ENABLE_DAEMON], [true])
348 AM_PATH_PYTHON([2.5])
350 PYGOBJECT_REQUIRED=3.0.0
352 PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
353 [enable_pygobject=yes], [enable_pygobject=no])
355 if test "x$enable_pygobject" = "xyes"; then
356 PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
358 pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
359 AC_SUBST(pyoverridesdir)
362 AM_CONDITIONAL(ENABLE_PYGOBJECT, test x"$enable_pygobject" = "xyes")
364 if test x"$enable_python_library" = x"yes"; then
366 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
367 if test x"$PYTHON_CONFIG" = x""; then
368 AC_PATH_PROG(PYTHON_CONFIG, python-config)
370 if test x"$PYTHON_CONFIG" != x""; then
371 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
372 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
374 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
375 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
377 PYTHON_INCLUDES="$PYTHON_CFLAGS"
378 AC_SUBST(PYTHON_CFLAGS)
379 AC_SUBST(PYTHON_INCLUDES)
380 AC_SUBST(PYTHON_LIBS)
382 enable_python_library="no (disabled, use --enable-python-library to enable)"
385 # Define gtk2 immodule dir.
386 AC_ARG_WITH(gtk2-im-module-dir,
387 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
388 [Select gtk2 immodule dir]),
389 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
391 AC_SUBST(GTK2_IM_MODULEDIR)
393 # Define gtk3 immodule dir.
394 AC_ARG_WITH(gtk3-im-module-dir,
395 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
396 [Select gtk3 immodule dir]),
397 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
399 AC_SUBST(GTK3_IM_MODULEDIR)
401 if test x"$enable_python" = x"yes"; then
402 # Check for dbus-python.
403 AC_ARG_ENABLE(dbus-python-check,
404 AS_HELP_STRING([--disable-dbus-python-check],
405 [Do not check dbus-python]),
406 [enable_dbus_python_check=$enableval],
407 [enable_dbus_python_check=yes]
409 PKG_CHECK_MODULES(DBUS_PYTHON,
410 [dbus-python >= 0.83.0],
411 [IBUS_HAS_DBUS_PYTHON=yes],
412 [IBUS_HAS_DBUS_PYTHON=no]
414 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
415 if test x"$enable_dbus_python_check" != x"no"; then
416 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
418 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
423 # Option for always disable snooper applications.
424 AC_ARG_ENABLE(key-snooper,
425 AS_HELP_STRING([--disable-key-snooper],
426 [Always disable key snooper in gtk im module]),
427 [enable_key_snooper=$enableval],
428 [enable_key_snooper=yes]
430 if test x"$enable_key_snooper" = x"yes"; then
431 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
433 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
434 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
437 # Option for no snooper applications.
438 AC_ARG_WITH(no-snooper-apps,
439 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
440 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
441 NO_SNOOPER_APPS=$with_no_snooper_apps,
442 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
444 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
445 [Does not enbale keyboard snooper in those applications])
447 # GNOME 3 uses the theme's icon.
448 AC_ARG_WITH(panel-icon-keyboard,
449 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
450 [Set the default panel icon (default: "ibus-keyboard")]),
451 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
452 x"$with_panel_icon_keyboard" = x; then
453 with_panel_icon_keyboard="input-keyboard-symbolic"
455 if test x"$with_panel_icon_keyboard" = x"legacy"; then
456 with_panel_icon_keyboard="ibus-keyboard"
458 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
460 IBUS_ICON_KEYBOARD="ibus-keyboard"
462 AC_SUBST(IBUS_ICON_KEYBOARD)
464 # --disable-surrounding-text option.
465 AC_ARG_ENABLE(surrounding-text,
466 AS_HELP_STRING([--disable-surrounding-text],
467 [Enable surrounding-text support]),
468 [enable_surrounding_text=$enableval],
469 [enable_surrounding_text=yes]
471 if test x"$enable_surrounding_text" = x"yes"; then
472 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
474 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
479 AS_HELP_STRING([--disable-ui],
480 [Disable ibus default user interface]),
481 [enable_ui=$enableval],
484 AM_CONDITIONAL([ENABLE_UI], [test x"$enable_ui" = x"yes"])
485 if test x"$enable_ui" = x"yes"; then
486 enable_ui="yes (enabled, use --disable-ui to disable)"
490 AC_ARG_ENABLE(engine,
491 AS_HELP_STRING([--disable-engine],
492 [Disable ibus simple engine]),
493 [enable_engine=$enableval],
496 AM_CONDITIONAL([ENABLE_ENGINE], [test x"$enable_engine" = x"yes"])
497 if test x"$enable_engine" = x"yes"; then
498 enable_engine="yes (enabled, use --disable-engine to disable)"
502 PKG_CHECK_MODULES(ISOCODES, [
505 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
506 AC_SUBST(ISOCODES_PREFIX)
509 AC_CONFIG_FILES([ po/Makefile.in
526 data/keymaps/Makefile
529 docs/reference/Makefile
530 docs/reference/ibus/ibus-docs.sgml
531 docs/reference/ibus/Makefile
535 ibus/interface/Makefile
541 bindings/pygobject/Makefile
542 bindings/vala/Makefile
546 conf/memconf/Makefile
553 Version $IBUS_VERSION
554 Install prefix $prefix
555 Build shared libs $enable_shared
556 Build static libs $enable_static
558 Gtk2 immodule dir $GTK2_IM_MODULEDIR
559 Gtk3 immodule dir $GTK3_IM_MODULEDIR
560 Build gtk2 immodule $enable_gtk2
561 Build gtk3 immodule $enable_gtk3
562 Build XIM agent server $enable_xim
563 Build python library $enable_python_library
564 Build gconf modules $enable_gconf
565 Build memconf modules $enable_memconf
566 Build dconf modules $enable_dconf
567 Build introspection $found_introspection
568 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
569 Build vala binding $enable_vala
570 Build document $enable_gtk_doc
572 Build engine $enable_engine
573 Enable key snooper $enable_key_snooper
574 No snooper regexes "$NO_SNOOPER_APPS"
575 Panel icon "$IBUS_ICON_KEYBOARD"
576 Enable surrounding-text $enable_surrounding_text
577 Run test cases $enable_tests