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], [4])
29 m4_define([ibus_micro_version], [0])
30 m4_define([ibus_interface_age], [0])
31 m4_define([ibus_binary_age],
32 [m4_eval(100 * ibus_minor_version + ibus_micro_version)])
33 m4_define([ibus_maybe_datestamp],
34 m4_esyscmd([test x]ibus_released[ != x1 && date +.%Y%m%d | tr -d '\n\r']))
35 m4_define([ibus_version],
36 ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
37 m4_define([ibus_api_version], [1.0])
40 AC_INIT([ibus], [ibus_version],
41 [http://code.google.com/p/ibus/issues/entry],
44 AC_CONFIG_HEADERS([config.h])
45 AC_CONFIG_MACRO_DIR([m4])
47 m4_define([ibus_binary_version], [1.0.0])
49 # Required versions of other packages.
50 m4_define([glib_required_version], [2.26.0])
54 AM_INIT_AUTOMAKE([1.10])
55 AM_MAINTAINER_MODE([enable])
58 # Support silent build rules. Disable
59 # by either passing --disable-silent-rules to configure or passing V=1
61 AM_SILENT_RULES([yes])
63 # Define sustituted variables:
64 IBUS_MAJOR_VERSION=ibus_major_version
65 IBUS_MINOR_VERSION=ibus_minor_version
66 IBUS_MICRO_VERSION=ibus_micro_version
67 IBUS_INTERFACE_AGE=ibus_interface_age
68 IBUS_BINARY_AGE=ibus_binary_age
69 IBUS_VERSION=ibus_version
70 IBUS_API_VERSION=ibus_api_version
71 IBUS_BINARY_VERSION=ibus_binary_version
72 AC_SUBST(IBUS_MAJOR_VERSION)
73 AC_SUBST(IBUS_MINOR_VERSION)
74 AC_SUBST(IBUS_MICRO_VERSION)
75 AC_SUBST(IBUS_INTERFACE_AGE)
76 AC_SUBST(IBUS_BINARY_AGE)
77 AC_SUBST(IBUS_API_VERSION)
78 AC_SUBST(IBUS_VERSION)
79 AC_SUBST(IBUS_BINARY_VERSION)
82 m4_define([lt_current],
83 [m4_eval(100 * ibus_minor_version + ibus_micro_version - ibus_interface_age)])
84 m4_define([lt_revision], [ibus_interface_age])
85 m4_define([lt_age], [m4_eval(ibus_binary_age - ibus_interface_age)])
86 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
87 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
88 AC_SUBST(LT_VERSION_INFO)
89 AC_SUBST(LT_CURRENT_MINUS_AGE)
91 # Define GETTEXT_* variables.
92 GETTEXT_PACKAGE=ibus10
93 AC_SUBST(GETTEXT_PACKAGE)
94 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
95 [The prefix for out gettext translation domains.])
98 m4_define(ibus_datedisplay,
99 m4_esyscmd(date '+%a %b %d %Y' | tr -d '\n\r'))
100 DATE_DISPLAY="ibus_datedisplay"
101 AC_SUBST(DATE_DISPLAY)
104 # Check for programs.
114 # Define PACKAGE_VERSION_* variables.
119 IT_PROG_INTLTOOL([0.35.0])
122 AC_CHECK_FUNCS(daemon)
127 PKG_CHECK_MODULES(GLIB2, [
128 glib-2.0 >= glib_required_version
130 PKG_CHECK_MODULES(GOBJECT2, [
131 gobject-2.0 >= glib_required_version
133 PKG_CHECK_MODULES(GIO2, [
134 gio-2.0 >= glib_required_version
136 PKG_CHECK_MODULES(GTHREAD2, [
137 gthread-2.0 >= glib_required_version
140 # --disable-gtk2 option.
142 AS_HELP_STRING([--disable-gtk2],
143 [Do not build gtk2 im module]),
144 [enable_gtk2=$enableval],
147 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
149 # --disable-gtk3 option.
151 AS_HELP_STRING([--disable-gtk3],
152 [Build gtk3 im module]),
153 [enable_gtk3=$enableval],
156 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
158 # --disable-xim option.
160 AS_HELP_STRING([--disable-xim],
161 [Do not build xim server]),
162 [enable_xim=$enableval],
165 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
167 # --disable-vala option.
169 AS_HELP_STRING([--disable-vala],
170 [Do not build ibus vala binding]),
171 [enable_vala=$enableval],
174 if test x"$enable_vala" = x"yes"; then
175 AC_PATH_PROG([VAPIGEN], [vapigen], [false])
177 AM_CONDITIONAL([ENABLE_VALA], [test x"$enable_vala" = x"yes"])
178 if test x"$enable_vala" != x"yes"; then
179 enable_vala="no (disabled, use --enable-vala to enable)"
182 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
184 PKG_CHECK_MODULES(GTK2, [
189 if test x"$enable_gtk2" = x"yes"; then
191 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
192 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
194 PKG_CHECK_MODULES(GDK2, [
198 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
201 if test x"$enable_gtk3" = x"yes"; then
202 # check for gtk3, gdk3
203 PKG_CHECK_MODULES(GTK3, [
207 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
208 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
210 PKG_CHECK_MODULES(GDK3, [
214 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
217 if test x"$enable_xim" = x"yes"; then
219 PKG_CHECK_MODULES(X11, [
222 AC_CHECK_HEADERS([X11/XKBlib.h])
224 enable_xim="no (disabled, use --enable-xim to enable)"
227 # GObject introspection
228 GOBJECT_INTROSPECTION_CHECK([0.6.8])
230 IBUS_GIR_SCANNERFLAGS=
231 if test x"$found_introspection" = x"yes" ; then
232 IBUS_GIR_SCANNERFLAGS="--identifier-prefix=IBus --symbol-prefix=ibus"
233 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
234 [gir_symbol_prefix=yes],
235 [gir_symbol_prefix=no])
236 if test x"$gir_symbol_prefix" = x"no" ; then
237 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
240 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
244 if test x"$enable_gtk_doc" = x"no"; then
245 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
249 PKG_CHECK_MODULES(DBUS, [
253 # --disable-gconf option.
255 AS_HELP_STRING([--disable-gconf],
256 [Do not use GConf code]),
257 [enable_gconf=$enableval],
260 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
262 if test x"$enable_gconf" = x"yes"; then
264 PKG_CHECK_MODULES(GCONF,
268 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
269 if test x"$GCONFTOOL" = xno; then
270 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
274 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
276 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
277 enable_gconf="no (disabled, use --enable-gconf to enable)"
280 # --enable-memconf option.
281 AC_ARG_ENABLE(memconf,
282 AS_HELP_STRING([--enable-memconf],
283 [Enable configure base on memory]),
284 [enable_memconf=$enableval],
287 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
290 AS_HELP_STRING([--enable-dconf],
291 [Enable configure base on dconf]),
292 [enable_dconf=$enableval],
296 if test x"$enable_dconf" = x"yes"; then
298 PKG_CHECK_MODULES(DCONF,
302 # check glib-compile-schemas
305 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
308 AC_PATH_PROG(ENV_IBUS_TEST, env)
309 AC_SUBST(ENV_IBUS_TEST)
311 AC_ARG_ENABLE(python,
312 AS_HELP_STRING([--disable-python],
313 [Do not use Python code]),
314 [enable_python=$enableval],
318 AM_CONDITIONAL([ENABLE_PYTHON], [test x"$enable_python" = x"yes"])
319 AM_CONDITIONAL([ENABLE_DAEMON], [true])
321 if test x"$enable_python" = x"yes"; then
323 AM_PATH_PYTHON([2.5])
324 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
325 if test x"$PYTHON_CONFIG" = x""; then
326 AC_PATH_PROG(PYTHON_CONFIG, python-config)
328 if test x"$PYTHON_CONFIG" != x""; then
329 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
330 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
332 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
333 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
335 PYTHON_INCLUDES="$PYTHON_CFLAGS"
336 AC_SUBST(PYTHON_CFLAGS)
337 AC_SUBST(PYTHON_INCLUDES)
338 AC_SUBST(PYTHON_LIBS)
340 enable_python="no (disabled, use --enable-python to enable)"
343 # Define gtk2 immodule dir.
344 AC_ARG_WITH(gtk2-im-module-dir,
345 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
346 [Select gtk2 immodule dir]),
347 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
349 AC_SUBST(GTK2_IM_MODULEDIR)
351 # Define gtk3 immodule dir.
352 AC_ARG_WITH(gtk3-im-module-dir,
353 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
354 [Select gtk3 immodule dir]),
355 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
357 AC_SUBST(GTK3_IM_MODULEDIR)
359 if test x"$enable_python" = x"yes"; then
360 # Check for dbus-python.
361 AC_ARG_ENABLE(dbus-python-check,
362 AS_HELP_STRING([--disable-dbus-python-check],
363 [Do not check dbus-python]),
364 [enable_dbus_python_check=$enableval],
365 [enable_dbus_python_check=yes]
367 PKG_CHECK_MODULES(DBUS_PYTHON,
368 [dbus-python >= 0.83.0],
369 [IBUS_HAS_DBUS_PYTHON=yes],
370 [IBUS_HAS_DBUS_PYTHON=no]
372 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
373 if test x"$enable_dbus_python_check" != x"no"; then
374 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
376 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
381 # Option for always disable snooper applications.
382 AC_ARG_ENABLE(key-snooper,
383 AS_HELP_STRING([--disable-key-snooper],
384 [Always disable key snooper in gtk im module]),
385 [enable_key_snooper=$enableval],
386 [enable_key_snooper=yes]
388 if test x"$enable_key_snooper" = x"yes"; then
389 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
391 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
392 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
395 # Option for no snooper applications.
396 AC_ARG_WITH(no-snooper-apps,
397 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
398 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
399 NO_SNOOPER_APPS=$with_no_snooper_apps,
400 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
402 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
403 [Does not enbale keyboard snooper in those applications])
405 # GNOME 3 uses the theme's icon.
406 AC_ARG_WITH(panel-icon-keyboard,
407 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
408 [Set the default panel icon (default: "input-keyboard-symbolic")]),
409 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
410 x"$with_panel_icon_keyboard" = x; then
411 with_panel_icon_keyboard="input-keyboard-symbolic"
413 if test x"$with_panel_icon_keyboard" = x"legacy"; then
414 with_panel_icon_keyboard="ibus-keyboard"
416 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
418 IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
420 AC_SUBST(IBUS_ICON_KEYBOARD)
422 # --enable-surrounding-text option.
423 AC_ARG_ENABLE(surrounding-text,
424 AS_HELP_STRING([--enable-surrounding-text],
425 [Enable surrounding-text support]),
426 [enable_surrounding_text=$enableval],
427 [enable_surrounding_text=no]
429 if test x"$enable_surrounding_text" = x"yes"; then
430 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
432 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
436 PKG_CHECK_MODULES(ISOCODES, [
439 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
440 AC_SUBST(ISOCODES_PREFIX)
443 AC_CONFIG_FILES([ po/Makefile.in
449 memconf/memconf.xml.in
462 data/keymaps/Makefile
465 docs/reference/Makefile
466 docs/reference/ibus/ibus-docs.sgml
467 docs/reference/ibus/Makefile
471 ibus/interface/Makefile
475 ui/gtk/gtkpanel.xml.in
481 bindings/vala/Makefile
489 Version $IBUS_VERSION
490 Install prefix $prefix
491 Build shared libs $enable_shared
492 Build static libs $enable_static
494 Gtk2 immodule dir $GTK2_IM_MODULEDIR
495 Gtk3 immodule dir $GTK3_IM_MODULEDIR
496 Build gtk2 immodule $enable_gtk2
497 Build gtk3 immodule $enable_gtk3
498 Build XIM agent server $enable_xim
499 Build python modules $enable_python
500 Build gconf modules $enable_gconf
501 Build memconf modules $enable_memconf
502 Build dconf modules $enable_dconf
503 Build introspection $found_introspection
504 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
505 Build vala binding $enable_vala
506 Build document $enable_gtk_doc
507 Enable key snooper $enable_key_snooper
508 No snooper regexes "$NO_SNOOPER_APPS"
509 Panel icon "$IBUS_ICON_KEYBOARD"
510 Enable surrounding-text $enable_surrounding_text