Generate vapi from gir instead of gi.
[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], [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])
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 AC_PROG_INSTALL
109 AC_PROG_MAKE_SET
110
111 # i18n stuff
112 AM_GLIB_GNU_GETTEXT
113
114 # Define PACKAGE_VERSION_* variables.
115 AM_DISABLE_STATIC
116 AC_ISC_POSIX
117 AC_HEADER_STDC
118 AM_PROG_LIBTOOL
119 IT_PROG_INTLTOOL([0.35.0])
120
121 # Check functions.
122 AC_CHECK_FUNCS(daemon)
123
124 # Check packages.
125 # Check glib2.
126 AM_PATH_GLIB_2_0
127 PKG_CHECK_MODULES(GLIB2, [
128     glib-2.0 >= glib_required_version
129 ])
130 PKG_CHECK_MODULES(GOBJECT2, [
131     gobject-2.0 >= glib_required_version
132 ])
133 PKG_CHECK_MODULES(GIO2, [
134     gio-2.0 >= glib_required_version
135 ])
136 PKG_CHECK_MODULES(GTHREAD2, [
137     gthread-2.0 >= glib_required_version
138 ])
139
140 # --disable-gtk2 option.
141 AC_ARG_ENABLE(gtk2,
142     AS_HELP_STRING([--disable-gtk2],
143                    [Do not build gtk2 im module]),
144     [enable_gtk2=$enableval],
145     [enable_gtk2=yes]
146 )
147 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
148
149 # --disable-gtk3 option.
150 AC_ARG_ENABLE(gtk3,
151     AS_HELP_STRING([--disable-gtk3],
152                    [Build gtk3 im module]),
153     [enable_gtk3=$enableval],
154     [enable_gtk3=yes]
155 )
156 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
157
158 # --disable-xim option.
159 AC_ARG_ENABLE(xim,
160     AS_HELP_STRING([--disable-xim],
161                    [Do not build xim server]),
162     [enable_xim=$enableval],
163     [enable_xim=yes]
164 )
165 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
166
167 # --disable-vala option.
168 AC_ARG_ENABLE(vala,
169     AS_HELP_STRING([--disable-vala],
170                    [Do not build ibus vala binding]),
171     [enable_vala=$enableval],
172     [enable_vala=yes]
173 )
174 if test x"$enable_vala" = x"yes"; then
175     AC_PATH_PROG([VAPIGEN], [vapigen], [false])
176 fi
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)"
180 fi
181
182 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
183     # check for gtk2
184     PKG_CHECK_MODULES(GTK2, [
185         gtk+-2.0
186     ])
187 fi
188
189 if test x"$enable_gtk2" = x"yes"; then
190     # check for gdk2
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
193
194     PKG_CHECK_MODULES(GDK2, [
195         gdk-2.0
196     ])
197 else
198     enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
199 fi
200
201 if test x"$enable_gtk3" = x"yes"; then
202     # check for gtk3, gdk3
203     PKG_CHECK_MODULES(GTK3, [
204         gtk+-3.0
205     ])
206
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
209
210     PKG_CHECK_MODULES(GDK3, [
211         gdk-3.0
212     ])
213 else
214     enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
215 fi
216
217 if test x"$enable_xim" = x"yes"; then
218     # Check for x11
219     PKG_CHECK_MODULES(X11, [
220         x11
221     ])
222     AC_CHECK_HEADERS([X11/XKBlib.h])
223 else
224     enable_xim="no (disabled, use --enable-xim to enable)"
225 fi
226
227 # GObject introspection
228 GOBJECT_INTROSPECTION_CHECK([0.6.8])
229
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"
238     fi
239 fi
240 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
241
242 # Check for gtk-doc.
243 GTK_DOC_CHECK(1.9)
244 if test x"$enable_gtk_doc" = x"no"; then
245     enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
246 fi
247
248 # Check for dbus.
249 PKG_CHECK_MODULES(DBUS, [
250     dbus-1
251 ])
252
253 # --disable-gconf option.
254 AC_ARG_ENABLE(gconf,
255     AS_HELP_STRING([--disable-gconf],
256                    [Do not use GConf code]),
257     [enable_gconf=$enableval],
258     [enable_gconf=yes]
259 )
260 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
261
262 if test x"$enable_gconf" = x"yes"; then
263     # check gconf
264     PKG_CHECK_MODULES(GCONF,
265         [gconf-2.0 >= 2.12],
266     )
267
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])
271     fi
272
273     AM_GCONF_SOURCE_2
274     # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
275 else
276     AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
277     enable_gconf="no (disabled, use --enable-gconf to enable)"
278 fi
279
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],
285     [enable_memconf=no]
286 )
287 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
288
289 AC_ARG_ENABLE(dconf,
290     AS_HELP_STRING([--enable-dconf],
291                    [Enable configure base on dconf]),
292     [enable_dconf=$enableval],
293     [enable_dconf=no]
294 )
295
296 if test x"$enable_dconf" = x"yes"; then
297     # check dconf
298     PKG_CHECK_MODULES(DCONF,
299         [dconf >= 0.7.5], ,
300         enable_dconf=no
301     )
302     # check glib-compile-schemas
303     GLIB_GSETTINGS
304 fi
305 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
306
307 # Check env.
308 AC_PATH_PROG(ENV_IBUS_TEST, env)
309 AC_SUBST(ENV_IBUS_TEST)
310
311 AC_ARG_ENABLE(python,
312     AS_HELP_STRING([--disable-python],
313                    [Do not use Python code]),
314     [enable_python=$enableval],
315     [enable_python=yes]
316 )
317
318 AM_CONDITIONAL([ENABLE_PYTHON], [test x"$enable_python" = x"yes"])
319 AM_CONDITIONAL([ENABLE_DAEMON], [true])
320
321 if test x"$enable_python" = x"yes"; then
322     # Check python.
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)
327     fi
328     if test x"$PYTHON_CONFIG" != x""; then
329         PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
330         PYTHON_LIBS=`$PYTHON_CONFIG --libs`
331     else
332         PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
333         PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
334     fi
335     PYTHON_INCLUDES="$PYTHON_CFLAGS"
336     AC_SUBST(PYTHON_CFLAGS)
337     AC_SUBST(PYTHON_INCLUDES)
338     AC_SUBST(PYTHON_LIBS)
339 else
340     enable_python="no (disabled, use --enable-python to enable)"
341 fi
342
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
348 )
349 AC_SUBST(GTK2_IM_MODULEDIR)
350
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
356 )
357 AC_SUBST(GTK3_IM_MODULEDIR)
358
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]
366     )
367     PKG_CHECK_MODULES(DBUS_PYTHON,
368         [dbus-python >= 0.83.0],
369         [IBUS_HAS_DBUS_PYTHON=yes],
370         [IBUS_HAS_DBUS_PYTHON=no]
371     )
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.])
375         else
376             AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
377         fi
378     fi
379 fi
380
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]
387 )
388 if test x"$enable_key_snooper" = x"yes"; then
389     AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
390 else
391     AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
392     enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
393 fi
394
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.*]
401 )
402 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
403     [Does not enbale keyboard snooper in those applications])
404
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"
412      fi
413      if test x"$with_panel_icon_keyboard" = x"legacy"; then
414          with_panel_icon_keyboard="ibus-keyboard"
415      fi
416      IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
417     ],
418     IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
419 )
420 AC_SUBST(IBUS_ICON_KEYBOARD)
421
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]
428 )
429 if test x"$enable_surrounding_text" = x"yes"; then
430     AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
431 else
432     enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
433 fi
434
435 # Check iso-codes.
436 PKG_CHECK_MODULES(ISOCODES, [
437     iso-codes
438 ])
439 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
440 AC_SUBST(ISOCODES_PREFIX)
441
442 # OUTPUT files
443 AC_CONFIG_FILES([ po/Makefile.in
444 Makefile
445 ibus-1.0.pc
446 ibus.spec
447 xinput-ibus
448 memconf/Makefile
449 memconf/memconf.xml.in
450 client/Makefile
451 client/gtk2/Makefile
452 client/gtk3/Makefile
453 client/x11/Makefile
454 src/Makefile
455 src/ibusversion.h
456 src/tests/Makefile
457 bus/Makefile
458 util/Makefile
459 util/IMdkit/Makefile
460 data/Makefile
461 data/icons/Makefile
462 data/keymaps/Makefile
463 data/dconf/Makefile
464 docs/Makefile
465 docs/reference/Makefile
466 docs/reference/ibus/ibus-docs.sgml
467 docs/reference/ibus/Makefile
468 m4/Makefile
469 ibus/_config.py
470 ibus/Makefile
471 ibus/interface/Makefile
472 ui/Makefile
473 ui/gtk/Makefile
474 ui/gtk/ibus-ui-gtk
475 ui/gtk/gtkpanel.xml.in
476 setup/Makefile
477 setup/ibus-setup
478 gconf/Makefile
479 gconf/gconf.xml.in
480 bindings/Makefile
481 bindings/vala/Makefile
482 dconf/Makefile
483 dconf/dconf.xml.in
484 ])
485
486 AC_OUTPUT
487 AC_MSG_RESULT([
488 Build options:
489   Version                   $IBUS_VERSION
490   Install prefix            $prefix
491   Build shared libs         $enable_shared
492   Build static libs         $enable_static
493   CFLAGS                    $CFLAGS
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
511 ])
512