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 # check glib-compile-schemas
333 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
336 AC_PATH_PROG(ENV_IBUS_TEST, env)
337 AC_SUBST(ENV_IBUS_TEST)
339 AC_ARG_ENABLE(python-library,
340 AS_HELP_STRING([--enable-python-library],
341 [Use ibus python library]),
342 [enable_python_library=$enableval],
343 [enable_python_library=no]
347 AS_HELP_STRING([--disable-setup],
348 [Do not use setup ui.]),
349 [enable_setup=$enableval],
353 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
354 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
355 AM_CONDITIONAL([ENABLE_DAEMON], [true])
357 AM_PATH_PYTHON([2.5])
359 if test x"$enable_python_library" = x"yes"; then
361 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
362 if test x"$PYTHON_CONFIG" = x""; then
363 AC_PATH_PROG(PYTHON_CONFIG, python-config)
365 if test x"$PYTHON_CONFIG" != x""; then
366 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
367 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
369 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
370 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
372 PYTHON_INCLUDES="$PYTHON_CFLAGS"
373 AC_SUBST(PYTHON_CFLAGS)
374 AC_SUBST(PYTHON_INCLUDES)
375 AC_SUBST(PYTHON_LIBS)
377 enable_python_library="no (disabled, use --enable-python-library to enable)"
380 # Define gtk2 immodule dir.
381 AC_ARG_WITH(gtk2-im-module-dir,
382 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
383 [Select gtk2 immodule dir]),
384 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
386 AC_SUBST(GTK2_IM_MODULEDIR)
388 # Define gtk3 immodule dir.
389 AC_ARG_WITH(gtk3-im-module-dir,
390 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
391 [Select gtk3 immodule dir]),
392 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
394 AC_SUBST(GTK3_IM_MODULEDIR)
396 if test x"$enable_python" = x"yes"; then
397 # Check for dbus-python.
398 AC_ARG_ENABLE(dbus-python-check,
399 AS_HELP_STRING([--disable-dbus-python-check],
400 [Do not check dbus-python]),
401 [enable_dbus_python_check=$enableval],
402 [enable_dbus_python_check=yes]
404 PKG_CHECK_MODULES(DBUS_PYTHON,
405 [dbus-python >= 0.83.0],
406 [IBUS_HAS_DBUS_PYTHON=yes],
407 [IBUS_HAS_DBUS_PYTHON=no]
409 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
410 if test x"$enable_dbus_python_check" != x"no"; then
411 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
413 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
418 # Option for always disable snooper applications.
419 AC_ARG_ENABLE(key-snooper,
420 AS_HELP_STRING([--disable-key-snooper],
421 [Always disable key snooper in gtk im module]),
422 [enable_key_snooper=$enableval],
423 [enable_key_snooper=yes]
425 if test x"$enable_key_snooper" = x"yes"; then
426 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
428 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
429 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
432 # Option for no snooper applications.
433 AC_ARG_WITH(no-snooper-apps,
434 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
435 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
436 NO_SNOOPER_APPS=$with_no_snooper_apps,
437 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
439 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
440 [Does not enbale keyboard snooper in those applications])
442 # GNOME 3 uses the theme's icon.
443 AC_ARG_WITH(panel-icon-keyboard,
444 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
445 [Set the default panel icon (default: "input-keyboard-symbolic")]),
446 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
447 x"$with_panel_icon_keyboard" = x; then
448 with_panel_icon_keyboard="input-keyboard-symbolic"
450 if test x"$with_panel_icon_keyboard" = x"legacy"; then
451 with_panel_icon_keyboard="ibus-keyboard"
453 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
455 IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
457 AC_SUBST(IBUS_ICON_KEYBOARD)
459 # --disable-surrounding-text option.
460 AC_ARG_ENABLE(surrounding-text,
461 AS_HELP_STRING([--disable-surrounding-text],
462 [Enable surrounding-text support]),
463 [enable_surrounding_text=$enableval],
464 [enable_surrounding_text=yes]
466 if test x"$enable_surrounding_text" = x"yes"; then
467 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
469 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
473 PKG_CHECK_MODULES(ISOCODES, [
476 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
477 AC_SUBST(ISOCODES_PREFIX)
480 AC_CONFIG_FILES([ po/Makefile.in
498 data/keymaps/Makefile
501 docs/reference/Makefile
502 docs/reference/ibus/ibus-docs.sgml
503 docs/reference/ibus/Makefile
507 ibus/interface/Makefile
510 ui/gtk3/gtkpanel.xml.in
514 bindings/vala/Makefile
517 conf/gconf/gconf.xml.in
519 conf/dconf/dconf.xml.in
520 conf/memconf/Makefile
521 conf/memconf/memconf.xml.in
528 Version $IBUS_VERSION
529 Install prefix $prefix
530 Build shared libs $enable_shared
531 Build static libs $enable_static
533 Gtk2 immodule dir $GTK2_IM_MODULEDIR
534 Gtk3 immodule dir $GTK3_IM_MODULEDIR
535 Build gtk2 immodule $enable_gtk2
536 Build gtk3 immodule $enable_gtk3
537 Build XIM agent server $enable_xim
538 Build python library $enable_python_library
539 Build gconf modules $enable_gconf
540 Build memconf modules $enable_memconf
541 Build dconf modules $enable_dconf
542 Build introspection $found_introspection
543 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
544 Build vala binding $enable_vala
545 Build document $enable_gtk_doc
546 Enable key snooper $enable_key_snooper
547 No snooper regexes "$NO_SNOOPER_APPS"
548 Panel icon "$IBUS_ICON_KEYBOARD"
549 Enable surrounding-text $enable_surrounding_text
550 Run test cases $enable_tests