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], [0])
27 m4_define([ibus_major_version], [1])
28 m4_define([ibus_minor_version], [4])
29 m4_define([ibus_micro_version], [99])
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.26.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 # --disable-vala option.
197 AS_HELP_STRING([--disable-vala],
198 [Do not build ibus vala binding]),
199 [enable_vala=$enableval],
202 if test x"$enable_vala" = x"yes"; then
203 AC_PATH_PROG([VAPIGEN], [vapigen], [false])
205 AM_CONDITIONAL([ENABLE_VALA], [test x"$enable_vala" = x"yes"])
206 if test x"$enable_vala" != x"yes"; then
207 enable_vala="no (disabled, use --enable-vala to enable)"
210 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
212 PKG_CHECK_MODULES(GTK2, [
217 if test x"$enable_gtk2" = x"yes"; then
219 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
220 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
222 PKG_CHECK_MODULES(GDK2, [
226 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
229 if test x"$enable_gtk3" = x"yes"; then
230 # check for gtk3, gdk3
231 PKG_CHECK_MODULES(GTK3, [
235 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
236 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
238 PKG_CHECK_MODULES(GDK3, [
242 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
245 if test x"$enable_xim" = x"yes"; then
247 PKG_CHECK_MODULES(X11, [
250 AC_CHECK_HEADERS([X11/XKBlib.h])
252 enable_xim="no (disabled, use --enable-xim to enable)"
255 # GObject introspection
256 GOBJECT_INTROSPECTION_CHECK([0.6.8])
258 IBUS_GIR_SCANNERFLAGS=
259 if test x"$found_introspection" = x"yes" ; then
260 IBUS_GIR_SCANNERFLAGS="--identifier-prefix=IBus --symbol-prefix=ibus"
261 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
262 [gir_symbol_prefix=yes],
263 [gir_symbol_prefix=no])
264 if test x"$gir_symbol_prefix" = x"no" ; then
265 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
268 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
272 if test x"$enable_gtk_doc" = x"no"; then
273 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
277 PKG_CHECK_MODULES(DBUS, [
281 # --disable-gconf option.
283 AS_HELP_STRING([--disable-gconf],
284 [Do not use GConf code]),
285 [enable_gconf=$enableval],
288 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
290 if test x"$enable_gconf" = x"yes"; then
292 PKG_CHECK_MODULES(GCONF,
296 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
297 if test x"$GCONFTOOL" = xno; then
298 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
302 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
304 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
305 enable_gconf="no (disabled, use --enable-gconf to enable)"
308 # --enable-memconf option.
309 AC_ARG_ENABLE(memconf,
310 AS_HELP_STRING([--enable-memconf],
311 [Enable configure base on memory]),
312 [enable_memconf=$enableval],
315 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
318 AS_HELP_STRING([--enable-dconf],
319 [Enable configure base on dconf]),
320 [enable_dconf=$enableval],
324 if test x"$enable_dconf" = x"yes"; then
326 PKG_CHECK_MODULES(DCONF,
330 PKG_CHECK_EXISTS([dconf >= 0.13.4],
331 [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
333 # check glib-compile-schemas
336 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
339 AC_PATH_PROG(ENV_IBUS_TEST, env)
340 AC_SUBST(ENV_IBUS_TEST)
342 AC_ARG_ENABLE(python-library,
343 AS_HELP_STRING([--enable-python-library],
344 [Use ibus python library]),
345 [enable_python_library=$enableval],
346 [enable_python_library=no]
350 AS_HELP_STRING([--disable-setup],
351 [Do not use setup ui.]),
352 [enable_setup=$enableval],
356 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
357 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
358 AM_CONDITIONAL([ENABLE_DAEMON], [true])
360 AM_PATH_PYTHON([2.5])
362 PYGOBJECT_REQUIRED=3.0.0
364 PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
365 [enable_pygobject=yes],[enable_pygobject=no])
367 if test "x$enable_pygobject" = "xyes"; then
368 PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
370 pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
371 AC_SUBST(pyoverridesdir)
374 AM_CONDITIONAL(ENABLE_PYGOBJECT, test x"$enable_pygobject" = "xyes")
376 if test x"$enable_python_library" = x"yes"; then
378 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
379 if test x"$PYTHON_CONFIG" = x""; then
380 AC_PATH_PROG(PYTHON_CONFIG, python-config)
382 if test x"$PYTHON_CONFIG" != x""; then
383 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
384 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
386 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
387 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
389 PYTHON_INCLUDES="$PYTHON_CFLAGS"
390 AC_SUBST(PYTHON_CFLAGS)
391 AC_SUBST(PYTHON_INCLUDES)
392 AC_SUBST(PYTHON_LIBS)
394 enable_python_library="no (disabled, use --enable-python-library to enable)"
397 # Define gtk2 immodule dir.
398 AC_ARG_WITH(gtk2-im-module-dir,
399 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
400 [Select gtk2 immodule dir]),
401 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
403 AC_SUBST(GTK2_IM_MODULEDIR)
405 # Define gtk3 immodule dir.
406 AC_ARG_WITH(gtk3-im-module-dir,
407 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
408 [Select gtk3 immodule dir]),
409 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
411 AC_SUBST(GTK3_IM_MODULEDIR)
413 if test x"$enable_python" = x"yes"; then
414 # Check for dbus-python.
415 AC_ARG_ENABLE(dbus-python-check,
416 AS_HELP_STRING([--disable-dbus-python-check],
417 [Do not check dbus-python]),
418 [enable_dbus_python_check=$enableval],
419 [enable_dbus_python_check=yes]
421 PKG_CHECK_MODULES(DBUS_PYTHON,
422 [dbus-python >= 0.83.0],
423 [IBUS_HAS_DBUS_PYTHON=yes],
424 [IBUS_HAS_DBUS_PYTHON=no]
426 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
427 if test x"$enable_dbus_python_check" != x"no"; then
428 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
430 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
435 # Option for always disable snooper applications.
436 AC_ARG_ENABLE(key-snooper,
437 AS_HELP_STRING([--disable-key-snooper],
438 [Always disable key snooper in gtk im module]),
439 [enable_key_snooper=$enableval],
440 [enable_key_snooper=yes]
442 if test x"$enable_key_snooper" = x"yes"; then
443 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
445 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
446 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
449 # Option for no snooper applications.
450 AC_ARG_WITH(no-snooper-apps,
451 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
452 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
453 NO_SNOOPER_APPS=$with_no_snooper_apps,
454 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
456 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
457 [Does not enbale keyboard snooper in those applications])
459 # GNOME 3 uses the theme's icon.
460 AC_ARG_WITH(panel-icon-keyboard,
461 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
462 [Set the default panel icon (default: "ibus-keyboard")]),
463 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
464 x"$with_panel_icon_keyboard" = x; then
465 with_panel_icon_keyboard="input-keyboard-symbolic"
467 if test x"$with_panel_icon_keyboard" = x"legacy"; then
468 with_panel_icon_keyboard="ibus-keyboard"
470 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
472 IBUS_ICON_KEYBOARD="ibus-keyboard"
474 AC_SUBST(IBUS_ICON_KEYBOARD)
476 # --disable-surrounding-text option.
477 AC_ARG_ENABLE(surrounding-text,
478 AS_HELP_STRING([--disable-surrounding-text],
479 [Enable surrounding-text support]),
480 [enable_surrounding_text=$enableval],
481 [enable_surrounding_text=yes]
483 if test x"$enable_surrounding_text" = x"yes"; then
484 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
486 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
491 AS_HELP_STRING([--disable-ui],
492 [Disable ibus default user interface]),
493 [enable_ui=$enableval],
496 AM_CONDITIONAL([ENABLE_UI], [test x"$enable_ui" = x"yes"])
497 if test x"$enable_ui" = x"yes"; then
498 enable_ui="yes (enabled, use --disable-ui to disable)"
502 AC_ARG_ENABLE(engine,
503 AS_HELP_STRING([--disable-engine],
504 [Disable ibus simple engine]),
505 [enable_engine=$enableval],
508 AM_CONDITIONAL([ENABLE_ENGINE], [test x"$enable_engine" = x"yes"])
509 if test x"$enable_engine" = x"yes"; then
510 enable_engine="yes (enabled, use --disable-engine to disable)"
514 PKG_CHECK_MODULES(ISOCODES, [
517 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
518 AC_SUBST(ISOCODES_PREFIX)
521 AC_CONFIG_FILES([ po/Makefile.in
539 data/keymaps/Makefile
542 docs/reference/Makefile
543 docs/reference/ibus/ibus-docs.sgml
544 docs/reference/ibus/Makefile
548 ibus/interface/Makefile
551 ui/gtk3/gtkpanel.xml.in
555 bindings/pygobject/Makefile
556 bindings/vala/Makefile
559 conf/gconf/gconf.xml.in
561 conf/dconf/dconf.xml.in
562 conf/memconf/Makefile
563 conf/memconf/memconf.xml.in
570 Version $IBUS_VERSION
571 Install prefix $prefix
572 Build shared libs $enable_shared
573 Build static libs $enable_static
575 Gtk2 immodule dir $GTK2_IM_MODULEDIR
576 Gtk3 immodule dir $GTK3_IM_MODULEDIR
577 Build gtk2 immodule $enable_gtk2
578 Build gtk3 immodule $enable_gtk3
579 Build XIM agent server $enable_xim
580 Build python library $enable_python_library
581 Build gconf modules $enable_gconf
582 Build memconf modules $enable_memconf
583 Build dconf modules $enable_dconf
584 Build introspection $found_introspection
585 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
586 Build vala binding $enable_vala
587 Build document $enable_gtk_doc
589 Build engine $enable_engine
590 Enable key snooper $enable_key_snooper
591 No snooper regexes "$NO_SNOOPER_APPS"
592 Panel icon "$IBUS_ICON_KEYBOARD"
593 Enable surrounding-text $enable_surrounding_text
594 Run test cases $enable_tests