Create simple engine
[platform/upstream/ibus.git] / configure.ac
1 # vim:set et ts=4:
2 #
3 # ibus - The Input Bus
4 #
5 # Copyright (c) 2007-2010 Peng Huang <shawn.p.huang@gmail.com>
6 # Copyright (c) 2007-2010 Red Hat, Inc.
7 #
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.
12 #
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.
17 #
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
22
23
24 # If ibus_released is 0, append datestamp to the version number.
25 m4_define([ibus_released], [1])
26
27 m4_define([ibus_major_version], [1])
28 m4_define([ibus_minor_version], [4])
29 m4_define([ibus_micro_version], [1])
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])
38
39 AC_PREFEQ([2.62])
40 AC_INIT([ibus], [ibus_version],
41         [http://code.google.com/p/ibus/issues/entry],
42         [ibus])
43
44 AC_CONFIG_HEADERS([config.h])
45 AC_CONFIG_MACRO_DIR([m4])
46
47 m4_define([ibus_binary_version], [1.0.0])
48
49 # Required versions of other packages.
50 m4_define([glib_required_version], [2.26.0])
51
52
53 # Init automake.
54 AM_INIT_AUTOMAKE([1.10])
55 AM_MAINTAINER_MODE([enable])
56 AC_GNU_SOURCE
57
58 # Support silent build rules. Disable
59 # by either passing --disable-silent-rules to configure or passing V=1
60 # to make
61 AM_SILENT_RULES([yes])
62
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)
80
81 # libtool versioning
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)
90
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.])
96
97 # For dislpay date.
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)
102
103
104 # Check for programs.
105 AC_PROG_CC
106 AM_PROG_CC_C_O
107 AC_PROG_CC_STDC
108 AM_PROG_VALAC([0.14])
109 AC_PROG_INSTALL
110 AC_PROG_MAKE_SET
111
112 # i18n stuff
113 AM_GLIB_GNU_GETTEXT
114
115 # Define PACKAGE_VERSION_* variables.
116 AM_DISABLE_STATIC
117 AC_ISC_POSIX
118 AC_HEADER_STDC
119 AM_PROG_LIBTOOL
120 IT_PROG_INTLTOOL([0.35.0])
121
122 # Check functions.
123 AC_CHECK_FUNCS(daemon)
124
125 # Check packages.
126 # Check glib2.
127 AM_PATH_GLIB_2_0
128 PKG_CHECK_MODULES(GLIB2, [
129     glib-2.0 >= glib_required_version
130 ])
131 PKG_CHECK_MODULES(GOBJECT2, [
132     gobject-2.0 >= glib_required_version
133 ])
134 PKG_CHECK_MODULES(GIO2, [
135     gio-2.0 >= glib_required_version
136 ])
137 PKG_CHECK_MODULES(GTHREAD2, [
138     gthread-2.0 >= glib_required_version
139 ])
140
141 # --disable-gtk2 option.
142 AC_ARG_ENABLE(gtk2,
143     AS_HELP_STRING([--disable-gtk2],
144                    [Do not build gtk2 im module]),
145     [enable_gtk2=$enableval],
146     [enable_gtk2=yes]
147 )
148 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
149
150 # --disable-gtk3 option.
151 AC_ARG_ENABLE(gtk3,
152     AS_HELP_STRING([--disable-gtk3],
153                    [Do not build gtk3 im module]),
154     [enable_gtk3=$enableval],
155     [enable_gtk3=yes]
156 )
157 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
158
159 # --disable-xim option.
160 AC_ARG_ENABLE(xim,
161     AS_HELP_STRING([--disable-xim],
162                    [Do not build xim server]),
163     [enable_xim=$enableval],
164     [enable_xim=yes]
165 )
166 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
167
168 # --disable-vala option.
169 AC_ARG_ENABLE(vala,
170     AS_HELP_STRING([--disable-vala],
171                    [Do not build ibus vala binding]),
172     [enable_vala=$enableval],
173     [enable_vala=yes]
174 )
175 if test x"$enable_vala" = x"yes"; then
176     AC_PATH_PROG([VAPIGEN], [vapigen], [false])
177 fi
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)"
181 fi
182
183 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
184     # check for gtk2
185     PKG_CHECK_MODULES(GTK2, [
186         gtk+-2.0
187     ])
188 fi
189
190 if test x"$enable_gtk2" = x"yes"; then
191     # check for gdk2
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
194
195     PKG_CHECK_MODULES(GDK2, [
196         gdk-2.0
197     ])
198 else
199     enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
200 fi
201
202 if test x"$enable_gtk3" = x"yes"; then
203     # check for gtk3, gdk3
204     PKG_CHECK_MODULES(GTK3, [
205         gtk+-3.0
206     ])
207
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
210
211     PKG_CHECK_MODULES(GDK3, [
212         gdk-3.0
213     ])
214 else
215     enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
216 fi
217
218 if test x"$enable_xim" = x"yes"; then
219     # Check for x11
220     PKG_CHECK_MODULES(X11, [
221         x11
222     ])
223     AC_CHECK_HEADERS([X11/XKBlib.h])
224 else
225     enable_xim="no (disabled, use --enable-xim to enable)"
226 fi
227
228 # GObject introspection
229 GOBJECT_INTROSPECTION_CHECK([0.6.8])
230
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"
239     fi
240 fi
241 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
242
243 # Check for gtk-doc.
244 GTK_DOC_CHECK(1.9)
245 if test x"$enable_gtk_doc" = x"no"; then
246     enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
247 fi
248
249 # Check for dbus.
250 PKG_CHECK_MODULES(DBUS, [
251     dbus-1
252 ])
253
254 # --disable-gconf option.
255 AC_ARG_ENABLE(gconf,
256     AS_HELP_STRING([--disable-gconf],
257                    [Do not use GConf code]),
258     [enable_gconf=$enableval],
259     [enable_gconf=yes]
260 )
261 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
262
263 if test x"$enable_gconf" = x"yes"; then
264     # check gconf
265     PKG_CHECK_MODULES(GCONF,
266         [gconf-2.0 >= 2.12],
267     )
268
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])
272     fi
273
274     AM_GCONF_SOURCE_2
275     # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
276 else
277     AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
278     enable_gconf="no (disabled, use --enable-gconf to enable)"
279 fi
280
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],
286     [enable_memconf=no]
287 )
288 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
289
290 AC_ARG_ENABLE(dconf,
291     AS_HELP_STRING([--enable-dconf],
292                    [Enable configure base on dconf]),
293     [enable_dconf=$enableval],
294     [enable_dconf=no]
295 )
296
297 if test x"$enable_dconf" = x"yes"; then
298     # check dconf
299     PKG_CHECK_MODULES(DCONF,
300         [dconf >= 0.7.5], ,
301         enable_dconf=no
302     )
303     # check glib-compile-schemas
304     GLIB_GSETTINGS
305 fi
306 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
307
308 # Check env.
309 AC_PATH_PROG(ENV_IBUS_TEST, env)
310 AC_SUBST(ENV_IBUS_TEST)
311
312 AC_ARG_ENABLE(python,
313     AS_HELP_STRING([--disable-python],
314                    [Do not use Python code]),
315     [enable_python=$enableval],
316     [enable_python=yes]
317 )
318
319 AM_CONDITIONAL([ENABLE_PYTHON], [test x"$enable_python" = x"yes"])
320 AM_CONDITIONAL([ENABLE_DAEMON], [true])
321
322 if test x"$enable_python" = x"yes"; then
323     # Check python.
324     AM_PATH_PYTHON([2.5])
325     AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
326     if test x"$PYTHON_CONFIG" = x""; then
327         AC_PATH_PROG(PYTHON_CONFIG, python-config)
328     fi
329     if test x"$PYTHON_CONFIG" != x""; then
330         PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
331         PYTHON_LIBS=`$PYTHON_CONFIG --libs`
332     else
333         PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
334         PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
335     fi
336     PYTHON_INCLUDES="$PYTHON_CFLAGS"
337     AC_SUBST(PYTHON_CFLAGS)
338     AC_SUBST(PYTHON_INCLUDES)
339     AC_SUBST(PYTHON_LIBS)
340 else
341     enable_python="no (disabled, use --enable-python to enable)"
342 fi
343
344 # Define gtk2 immodule dir.
345 AC_ARG_WITH(gtk2-im-module-dir,
346     AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
347         [Select gtk2 immodule dir]),
348     GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
349 )
350 AC_SUBST(GTK2_IM_MODULEDIR)
351
352 # Define gtk3 immodule dir.
353 AC_ARG_WITH(gtk3-im-module-dir,
354     AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
355         [Select gtk3 immodule dir]),
356     GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
357 )
358 AC_SUBST(GTK3_IM_MODULEDIR)
359
360 if test x"$enable_python" = x"yes"; then
361     # Check for dbus-python.
362     AC_ARG_ENABLE(dbus-python-check,
363         AS_HELP_STRING([--disable-dbus-python-check],
364             [Do not check dbus-python]),
365         [enable_dbus_python_check=$enableval],
366         [enable_dbus_python_check=yes]
367     )
368     PKG_CHECK_MODULES(DBUS_PYTHON,
369         [dbus-python >= 0.83.0],
370         [IBUS_HAS_DBUS_PYTHON=yes],
371         [IBUS_HAS_DBUS_PYTHON=no]
372     )
373     if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
374         if test x"$enable_dbus_python_check" != x"no"; then
375             AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
376         else
377             AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
378         fi
379     fi
380 fi
381
382 # Option for always disable snooper applications.
383 AC_ARG_ENABLE(key-snooper,
384     AS_HELP_STRING([--disable-key-snooper],
385         [Always disable key snooper in gtk im module]),
386     [enable_key_snooper=$enableval],
387     [enable_key_snooper=yes]
388 )
389 if test x"$enable_key_snooper" = x"yes"; then
390     AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
391 else
392     AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
393     enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
394 fi
395
396 # Option for no snooper applications.
397 AC_ARG_WITH(no-snooper-apps,
398     AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
399         [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
400     NO_SNOOPER_APPS=$with_no_snooper_apps,
401     NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
402 )
403 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
404     [Does not enbale keyboard snooper in those applications])
405
406 # GNOME 3 uses the theme's icon.
407 AC_ARG_WITH(panel-icon-keyboard,
408     AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
409         [Set the default panel icon (default: "input-keyboard-symbolic")]),
410     [if test x"$with_panel_icon_keyboard" = x"yes" -o \
411              x"$with_panel_icon_keyboard" = x; then
412          with_panel_icon_keyboard="input-keyboard-symbolic"
413      fi
414      if test x"$with_panel_icon_keyboard" = x"legacy"; then
415          with_panel_icon_keyboard="ibus-keyboard"
416      fi
417      IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
418     ],
419     IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
420 )
421 AC_SUBST(IBUS_ICON_KEYBOARD)
422
423 # --enable-surrounding-text option.
424 AC_ARG_ENABLE(surrounding-text,
425     AS_HELP_STRING([--enable-surrounding-text],
426         [Enable surrounding-text support]),
427     [enable_surrounding_text=$enableval],
428     [enable_surrounding_text=no]
429 )
430 if test x"$enable_surrounding_text" = x"yes"; then
431     AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
432 else
433     enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
434 fi
435
436 # Check iso-codes.
437 PKG_CHECK_MODULES(ISOCODES, [
438     iso-codes
439 ])
440 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
441 AC_SUBST(ISOCODES_PREFIX)
442
443 # OUTPUT files
444 AC_CONFIG_FILES([ po/Makefile.in
445 Makefile
446 ibus-1.0.pc
447 ibus.spec
448 xinput-ibus
449 memconf/Makefile
450 memconf/memconf.xml.in
451 client/Makefile
452 client/gtk2/Makefile
453 client/gtk3/Makefile
454 client/x11/Makefile
455 src/Makefile
456 src/ibusversion.h
457 src/tests/Makefile
458 bus/Makefile
459 engine/Makefile
460 engine/simple.xml.in
461 util/Makefile
462 util/IMdkit/Makefile
463 data/Makefile
464 data/icons/Makefile
465 data/keymaps/Makefile
466 data/dconf/Makefile
467 docs/Makefile
468 docs/reference/Makefile
469 docs/reference/ibus/ibus-docs.sgml
470 docs/reference/ibus/Makefile
471 m4/Makefile
472 ibus/_config.py
473 ibus/Makefile
474 ibus/interface/Makefile
475 ui/Makefile
476 ui/gtk/Makefile
477 ui/gtk/ibus-ui-gtk
478 ui/gtk/gtkpanel.xml.in
479 ui/gtk3/Makefile
480 setup/Makefile
481 setup/ibus-setup
482 gconf/Makefile
483 gconf/gconf.xml.in
484 bindings/Makefile
485 bindings/vala/Makefile
486 dconf/Makefile
487 dconf/dconf.xml.in
488 ])
489
490 AC_OUTPUT
491 AC_MSG_RESULT([
492 Build options:
493   Version                   $IBUS_VERSION
494   Install prefix            $prefix
495   Build shared libs         $enable_shared
496   Build static libs         $enable_static
497   CFLAGS                    $CFLAGS
498   Gtk2 immodule dir         $GTK2_IM_MODULEDIR
499   Gtk3 immodule dir         $GTK3_IM_MODULEDIR
500   Build gtk2 immodule       $enable_gtk2
501   Build gtk3 immodule       $enable_gtk3
502   Build XIM agent server    $enable_xim
503   Build python modules      $enable_python
504   Build gconf modules       $enable_gconf
505   Build memconf modules     $enable_memconf
506   Build dconf modules       $enable_dconf
507   Build introspection       $found_introspection
508   IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
509   Build vala binding        $enable_vala
510   Build document            $enable_gtk_doc
511   Enable key snooper        $enable_key_snooper
512   No snooper regexes        "$NO_SNOOPER_APPS"
513   Panel icon                "$IBUS_ICON_KEYBOARD"
514   Enable surrounding-text   $enable_surrounding_text
515 ])
516