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_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.
108 AM_PROG_VALAC([0.14])
115 # Define PACKAGE_VERSION_* variables.
120 IT_PROG_INTLTOOL([0.35.0])
123 AC_CHECK_FUNCS(daemon)
128 PKG_CHECK_MODULES(GLIB2, [
129 glib-2.0 >= glib_required_version
131 PKG_CHECK_MODULES(GOBJECT2, [
132 gobject-2.0 >= glib_required_version
134 PKG_CHECK_MODULES(GIO2, [
135 gio-2.0 >= glib_required_version
137 PKG_CHECK_MODULES(GTHREAD2, [
138 gthread-2.0 >= glib_required_version
141 # --disable-gtk2 option.
143 AS_HELP_STRING([--disable-gtk2],
144 [Do not build gtk2 im module]),
145 [enable_gtk2=$enableval],
148 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
150 # --disable-gtk3 option.
152 AS_HELP_STRING([--disable-gtk3],
153 [Do not build gtk3 im module]),
154 [enable_gtk3=$enableval],
157 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
159 # --disable-xim option.
161 AS_HELP_STRING([--disable-xim],
162 [Do not build xim server]),
163 [enable_xim=$enableval],
166 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
168 # --disable-vala option.
170 AS_HELP_STRING([--disable-vala],
171 [Do not build ibus vala binding]),
172 [enable_vala=$enableval],
175 if test x"$enable_vala" = x"yes"; then
176 AC_PATH_PROG([VAPIGEN], [vapigen], [false])
178 AM_CONDITIONAL([ENABLE_VALA], [test x"$enable_vala" = x"yes"])
179 if test x"$enable_vala" != x"yes"; then
180 enable_vala="no (disabled, use --enable-vala to enable)"
183 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
185 PKG_CHECK_MODULES(GTK2, [
190 if test x"$enable_gtk2" = x"yes"; then
192 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
193 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
195 PKG_CHECK_MODULES(GDK2, [
199 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
202 if test x"$enable_gtk3" = x"yes"; then
203 # check for gtk3, gdk3
204 PKG_CHECK_MODULES(GTK3, [
208 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
209 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
211 PKG_CHECK_MODULES(GDK3, [
215 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
218 if test x"$enable_xim" = x"yes"; then
220 PKG_CHECK_MODULES(X11, [
223 AC_CHECK_HEADERS([X11/XKBlib.h])
225 enable_xim="no (disabled, use --enable-xim to enable)"
228 # GObject introspection
229 GOBJECT_INTROSPECTION_CHECK([0.6.8])
231 IBUS_GIR_SCANNERFLAGS=
232 if test x"$found_introspection" = x"yes" ; then
233 IBUS_GIR_SCANNERFLAGS="--identifier-prefix=IBus --symbol-prefix=ibus"
234 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
235 [gir_symbol_prefix=yes],
236 [gir_symbol_prefix=no])
237 if test x"$gir_symbol_prefix" = x"no" ; then
238 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
241 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
245 if test x"$enable_gtk_doc" = x"no"; then
246 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
250 PKG_CHECK_MODULES(DBUS, [
254 # --disable-gconf option.
256 AS_HELP_STRING([--disable-gconf],
257 [Do not use GConf code]),
258 [enable_gconf=$enableval],
261 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
263 if test x"$enable_gconf" = x"yes"; then
265 PKG_CHECK_MODULES(GCONF,
269 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
270 if test x"$GCONFTOOL" = xno; then
271 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
275 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
277 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
278 enable_gconf="no (disabled, use --enable-gconf to enable)"
281 # --enable-memconf option.
282 AC_ARG_ENABLE(memconf,
283 AS_HELP_STRING([--enable-memconf],
284 [Enable configure base on memory]),
285 [enable_memconf=$enableval],
288 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
291 AS_HELP_STRING([--enable-dconf],
292 [Enable configure base on dconf]),
293 [enable_dconf=$enableval],
297 if test x"$enable_dconf" = x"yes"; then
299 PKG_CHECK_MODULES(DCONF,
303 # check glib-compile-schemas
306 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
309 AC_PATH_PROG(ENV_IBUS_TEST, env)
310 AC_SUBST(ENV_IBUS_TEST)
312 AC_ARG_ENABLE(python-library,
313 AS_HELP_STRING([--enable-python-library],
314 [Use ibus python library]),
315 [enable_python_library=$enableval],
316 [enable_python_library=no]
320 AS_HELP_STRING([--disable-setup],
321 [Do not use setup ui.]),
322 [enable_setup=$enableval],
326 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
327 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
328 AM_CONDITIONAL([ENABLE_DAEMON], [true])
330 if test x"$enable_python_library" = x"yes"; then
332 AM_PATH_PYTHON([2.5])
333 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
334 if test x"$PYTHON_CONFIG" = x""; then
335 AC_PATH_PROG(PYTHON_CONFIG, python-config)
337 if test x"$PYTHON_CONFIG" != x""; then
338 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
339 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
341 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
342 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
344 PYTHON_INCLUDES="$PYTHON_CFLAGS"
345 AC_SUBST(PYTHON_CFLAGS)
346 AC_SUBST(PYTHON_INCLUDES)
347 AC_SUBST(PYTHON_LIBS)
349 enable_python_library="no (disabled, use --enable-python-library to enable)"
352 # Define gtk2 immodule dir.
353 AC_ARG_WITH(gtk2-im-module-dir,
354 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
355 [Select gtk2 immodule dir]),
356 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
358 AC_SUBST(GTK2_IM_MODULEDIR)
360 # Define gtk3 immodule dir.
361 AC_ARG_WITH(gtk3-im-module-dir,
362 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
363 [Select gtk3 immodule dir]),
364 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
366 AC_SUBST(GTK3_IM_MODULEDIR)
368 if test x"$enable_python" = x"yes"; then
369 # Check for dbus-python.
370 AC_ARG_ENABLE(dbus-python-check,
371 AS_HELP_STRING([--disable-dbus-python-check],
372 [Do not check dbus-python]),
373 [enable_dbus_python_check=$enableval],
374 [enable_dbus_python_check=yes]
376 PKG_CHECK_MODULES(DBUS_PYTHON,
377 [dbus-python >= 0.83.0],
378 [IBUS_HAS_DBUS_PYTHON=yes],
379 [IBUS_HAS_DBUS_PYTHON=no]
381 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
382 if test x"$enable_dbus_python_check" != x"no"; then
383 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
385 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
390 # Option for always disable snooper applications.
391 AC_ARG_ENABLE(key-snooper,
392 AS_HELP_STRING([--disable-key-snooper],
393 [Always disable key snooper in gtk im module]),
394 [enable_key_snooper=$enableval],
395 [enable_key_snooper=yes]
397 if test x"$enable_key_snooper" = x"yes"; then
398 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
400 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
401 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
404 # Option for no snooper applications.
405 AC_ARG_WITH(no-snooper-apps,
406 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
407 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
408 NO_SNOOPER_APPS=$with_no_snooper_apps,
409 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
411 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
412 [Does not enbale keyboard snooper in those applications])
414 # GNOME 3 uses the theme's icon.
415 AC_ARG_WITH(panel-icon-keyboard,
416 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
417 [Set the default panel icon (default: "input-keyboard-symbolic")]),
418 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
419 x"$with_panel_icon_keyboard" = x; then
420 with_panel_icon_keyboard="input-keyboard-symbolic"
422 if test x"$with_panel_icon_keyboard" = x"legacy"; then
423 with_panel_icon_keyboard="ibus-keyboard"
425 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
427 IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
429 AC_SUBST(IBUS_ICON_KEYBOARD)
431 # --enable-surrounding-text option.
432 AC_ARG_ENABLE(surrounding-text,
433 AS_HELP_STRING([--enable-surrounding-text],
434 [Enable surrounding-text support]),
435 [enable_surrounding_text=$enableval],
436 [enable_surrounding_text=no]
438 if test x"$enable_surrounding_text" = x"yes"; then
439 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
441 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
445 PKG_CHECK_MODULES(ISOCODES, [
448 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
449 AC_SUBST(ISOCODES_PREFIX)
452 AC_CONFIG_FILES([ po/Makefile.in
471 data/keymaps/Makefile
474 docs/reference/Makefile
475 docs/reference/ibus/ibus-docs.sgml
476 docs/reference/ibus/Makefile
480 ibus/interface/Makefile
484 ui/gtk2/gtkpanel.xml.in
486 ui/gtk3/gtkpanel.xml.in
490 bindings/vala/Makefile
493 conf/gconf/gconf.xml.in
495 conf/dconf/dconf.xml.in
496 conf/memconf/Makefile
497 conf/memconf/memconf.xml.in
504 Version $IBUS_VERSION
505 Install prefix $prefix
506 Build shared libs $enable_shared
507 Build static libs $enable_static
509 Gtk2 immodule dir $GTK2_IM_MODULEDIR
510 Gtk3 immodule dir $GTK3_IM_MODULEDIR
511 Build gtk2 immodule $enable_gtk2
512 Build gtk3 immodule $enable_gtk3
513 Build XIM agent server $enable_xim
514 Build python library $enable_python_library
515 Build gconf modules $enable_gconf
516 Build memconf modules $enable_memconf
517 Build dconf modules $enable_dconf
518 Build introspection $found_introspection
519 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
520 Build vala binding $enable_vala
521 Build document $enable_gtk_doc
522 Enable key snooper $enable_key_snooper
523 No snooper regexes "$NO_SNOOPER_APPS"
524 Panel icon "$IBUS_ICON_KEYBOARD"
525 Enable surrounding-text $enable_surrounding_text