5 # Copyright (c) 2007-2013 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2013 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 GLIB_VERSION=`$PKG_CONFIG --modversion glib-2.0`
157 AC_SUBST(GLIB_VERSION)
159 # --disable-tests option.
161 AS_HELP_STRING([--disable-tests],
163 [enable_tests=$enableval],
166 AM_CONDITIONAL([ENABLE_TESTS], [test x"$enable_tests" = x"yes"])
167 if test x"$enable_tests" != x"yes"; then
168 enable_tests="no (disabled, use --enable-tests to enable)"
171 # --disable-gtk2 option.
173 AS_HELP_STRING([--disable-gtk2],
174 [Do not build gtk2 im module]),
175 [enable_gtk2=$enableval],
178 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
180 # --disable-gtk3 option.
182 AS_HELP_STRING([--disable-gtk3],
183 [Do not build gtk3 im module]),
184 [enable_gtk3=$enableval],
187 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
189 # --disable-xim option.
191 AS_HELP_STRING([--disable-xim],
192 [Do not build xim server]),
193 [enable_xim=$enableval],
196 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
198 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
200 PKG_CHECK_MODULES(GTK2, [
205 if test x"$enable_gtk2" = x"yes"; then
207 gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
208 GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
210 PKG_CHECK_MODULES(GDK2, [
214 enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
217 if test x"$enable_gtk3" = x"yes"; then
218 # check for gtk3, gdk3
219 PKG_CHECK_MODULES(GTK3, [
223 gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
224 GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
226 PKG_CHECK_MODULES(GDK3, [
230 enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
233 if test x"$enable_xim" = x"yes"; then
235 PKG_CHECK_MODULES(X11, [
238 AC_CHECK_HEADERS([X11/XKBlib.h])
240 enable_xim="no (disabled, use --enable-xim to enable)"
243 # GObject introspection
244 GOBJECT_INTROSPECTION_CHECK([0.6.8])
246 IBUS_GIR_SCANNERFLAGS=
247 if test x"$found_introspection" = x"yes" ; then
248 IBUS_GIR_SCANNERFLAGS="--warn-all --identifier-prefix=IBus --symbol-prefix=ibus"
249 PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
250 [gir_symbol_prefix=yes],
251 [gir_symbol_prefix=no])
252 if test x"$gir_symbol_prefix" = x"no" ; then
253 IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
256 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
259 VAPIGEN_CHECK([0.16])
263 if test x"$enable_gtk_doc" = x"no"; then
264 enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
268 PKG_CHECK_MODULES(DBUS, [
272 # --enable-gconf option.
274 AS_HELP_STRING([--enable-gconf],
276 [enable_gconf=$enableval],
279 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
281 if test x"$enable_gconf" = x"yes"; then
283 PKG_CHECK_MODULES(GCONF,
287 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
288 if test x"$GCONFTOOL" = xno; then
289 AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
293 # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
295 AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
296 enable_gconf="no (disabled, use --enable-gconf to enable)"
299 # --enable-memconf option.
300 AC_ARG_ENABLE(memconf,
301 AS_HELP_STRING([--enable-memconf],
302 [Enable configure base on memory]),
303 [enable_memconf=$enableval],
306 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
309 AS_HELP_STRING([--disable-dconf],
310 [Disable configure base on dconf]),
311 [enable_dconf=$enableval],
314 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
316 if test x"$enable_dconf" = x"yes"; then
318 PKG_CHECK_MODULES(DCONF,
321 PKG_CHECK_EXISTS([dconf >= 0.13.4],
322 [AC_DEFINE(DCONF_0_13_4, TRUE, [dconf is 0.13.4 or later])],
324 # check glib-compile-schemas
326 enable_dconf="yes (enabled, use --disable-dconf to disable)"
330 AC_PATH_PROG(ENV_IBUS_TEST, env)
331 AC_SUBST(ENV_IBUS_TEST)
333 AC_ARG_ENABLE(python-library,
334 AS_HELP_STRING([--enable-python-library],
335 [Use ibus python library]),
336 [enable_python_library=$enableval],
337 [enable_python_library=no]
341 AS_HELP_STRING([--disable-setup],
342 [Do not use setup ui.]),
343 [enable_setup=$enableval],
347 AM_CONDITIONAL([ENABLE_PYTHON_LIBRARY], [test x"$enable_python_library" = x"yes"])
348 AM_CONDITIONAL([ENABLE_SETUP], [test x"$enable_setup" = x"yes"])
349 AM_CONDITIONAL([ENABLE_DAEMON], [true])
351 AM_PATH_PYTHON([2.5])
353 PYGOBJECT_REQUIRED=3.0.0
355 PKG_CHECK_EXISTS([pygobject-3.0 >= $PYGOBJECT_REQUIRED],
356 [enable_pygobject=yes], [enable_pygobject=no])
358 if test "x$enable_pygobject" = "xyes"; then
359 PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED])
361 pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"`
362 AC_SUBST(pyoverridesdir)
365 AM_CONDITIONAL(ENABLE_PYGOBJECT, test x"$enable_pygobject" = "xyes")
367 if test x"$enable_python_library" = x"yes"; then
369 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
370 if test x"$PYTHON_CONFIG" = x""; then
371 AC_PATH_PROG(PYTHON_CONFIG, python-config)
373 if test x"$PYTHON_CONFIG" != x""; then
374 PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
375 PYTHON_LIBS=`$PYTHON_CONFIG --libs`
377 PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
378 PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
380 PYTHON_INCLUDES="$PYTHON_CFLAGS"
381 AC_SUBST(PYTHON_CFLAGS)
382 AC_SUBST(PYTHON_INCLUDES)
383 AC_SUBST(PYTHON_LIBS)
385 enable_python_library="no (disabled, use --enable-python-library to enable)"
388 # Define gtk2 immodule dir.
389 AC_ARG_WITH(gtk2-im-module-dir,
390 AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
391 [Select gtk2 immodule dir]),
392 GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
394 AC_SUBST(GTK2_IM_MODULEDIR)
396 # Define gtk3 immodule dir.
397 AC_ARG_WITH(gtk3-im-module-dir,
398 AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
399 [Select gtk3 immodule dir]),
400 GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
402 AC_SUBST(GTK3_IM_MODULEDIR)
404 if test x"$enable_python" = x"yes"; then
405 # Check for dbus-python.
406 AC_ARG_ENABLE(dbus-python-check,
407 AS_HELP_STRING([--disable-dbus-python-check],
408 [Do not check dbus-python]),
409 [enable_dbus_python_check=$enableval],
410 [enable_dbus_python_check=yes]
412 PKG_CHECK_MODULES(DBUS_PYTHON,
413 [dbus-python >= 0.83.0],
414 [IBUS_HAS_DBUS_PYTHON=yes],
415 [IBUS_HAS_DBUS_PYTHON=no]
417 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
418 if test x"$enable_dbus_python_check" != x"no"; then
419 AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
421 AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
426 # Option for always disable snooper applications.
427 AC_ARG_ENABLE(key-snooper,
428 AS_HELP_STRING([--disable-key-snooper],
429 [Always disable key snooper in gtk im module]),
430 [enable_key_snooper=$enableval],
431 [enable_key_snooper=yes]
433 if test x"$enable_key_snooper" = x"yes"; then
434 AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
436 AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
437 enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
440 # Option for no snooper applications.
441 AC_ARG_WITH(no-snooper-apps,
442 AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
443 [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
444 NO_SNOOPER_APPS=$with_no_snooper_apps,
445 NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
447 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
448 [Does not enbale keyboard snooper in those applications])
450 # GNOME 3 uses the theme's icon.
451 AC_ARG_WITH(panel-icon-keyboard,
452 AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
453 [Set the default panel icon (default: "ibus-keyboard")]),
454 [if test x"$with_panel_icon_keyboard" = x"yes" -o \
455 x"$with_panel_icon_keyboard" = x; then
456 with_panel_icon_keyboard="input-keyboard-symbolic"
458 if test x"$with_panel_icon_keyboard" = x"legacy"; then
459 with_panel_icon_keyboard="ibus-keyboard"
461 IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
463 IBUS_ICON_KEYBOARD="ibus-keyboard"
465 AC_SUBST(IBUS_ICON_KEYBOARD)
467 # --disable-surrounding-text option.
468 AC_ARG_ENABLE(surrounding-text,
469 AS_HELP_STRING([--disable-surrounding-text],
470 [Enable surrounding-text support]),
471 [enable_surrounding_text=$enableval],
472 [enable_surrounding_text=yes]
474 if test x"$enable_surrounding_text" = x"yes"; then
475 AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
477 enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
482 AS_HELP_STRING([--disable-ui],
483 [Disable ibus default user interface]),
484 [enable_ui=$enableval],
487 AM_CONDITIONAL([ENABLE_UI], [test x"$enable_ui" = x"yes"])
488 if test x"$enable_ui" = x"yes"; then
489 enable_ui="yes (enabled, use --disable-ui to disable)"
493 AC_ARG_ENABLE(engine,
494 AS_HELP_STRING([--disable-engine],
495 [Disable ibus simple engine]),
496 [enable_engine=$enableval],
499 AM_CONDITIONAL([ENABLE_ENGINE], [test x"$enable_engine" = x"yes"])
500 if test x"$enable_engine" = x"yes"; then
501 enable_engine="yes (enabled, use --disable-engine to disable)"
504 # --disable-libnotify
505 AC_ARG_ENABLE(libnotify,
506 AS_HELP_STRING([--disable-libnotify],
507 [Disable to link libnotify]),
508 [enable_libnotify=$enableval],
509 [enable_libnotify=yes]
511 AM_CONDITIONAL([ENABLE_LIBNOTIFY], [test x"$enable_libnotify" = x"yes"])
512 if test x"$enable_libnotify" = x"yes"; then
513 PKG_CHECK_MODULES(LIBNOTIFY, [
516 enable_libnotify="yes (enabled, use --disable-libnotify to disable)"
520 PKG_CHECK_MODULES(ISOCODES, [
523 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
524 AC_SUBST(ISOCODES_PREFIX)
527 AC_CONFIG_FILES([ po/Makefile.in
544 data/keymaps/Makefile
547 docs/reference/Makefile
548 docs/reference/ibus/ibus-docs.sgml
549 docs/reference/ibus/Makefile
553 ibus/interface/Makefile
559 bindings/pygobject/Makefile
560 bindings/vala/Makefile
564 conf/memconf/Makefile
571 Version $IBUS_VERSION
572 Install prefix $prefix
573 Build shared libs $enable_shared
574 Build static libs $enable_static
576 Gtk2 immodule dir $GTK2_IM_MODULEDIR
577 Gtk3 immodule dir $GTK3_IM_MODULEDIR
578 Build gtk2 immodule $enable_gtk2
579 Build gtk3 immodule $enable_gtk3
580 Build XIM agent server $enable_xim
581 Build python library $enable_python_library
582 Build gconf modules $enable_gconf
583 Build memconf modules $enable_memconf
584 Build dconf modules $enable_dconf
585 Build introspection $found_introspection
586 IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
587 Build vala binding $enable_vala
588 Build document $enable_gtk_doc
590 Build engine $enable_engine
591 Enable key snooper $enable_key_snooper
592 No snooper regexes "$NO_SNOOPER_APPS"
593 Panel icon "$IBUS_ICON_KEYBOARD"
594 Enable surrounding-text $enable_surrounding_text
595 Enable libnotify $enable_libnotify
596 Run test cases $enable_tests