c3bd42313aedf14814f552ba3058ae39a1465cb9
[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 AC_PREFEQ([2.62])
23
24 AC_CONFIG_HEADERS([config.h])
25 AC_CONFIG_MACRO_DIR([m4])
26
27
28 # if not 1, append datestamp to the version number.
29 m4_define([ibus_released], [0])
30 m4_define([ibus_major_version], [1])
31 m4_define([ibus_minor_version], [3])
32 m4_define([ibus_micro_version], [99])
33 m4_define(ibus_maybe_datestamp,
34     m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
35 m4_define([ibus_version],
36     ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
37 # This is the X.Y used in -libus-X.Y
38 m4_define([ibus_api_version], [1.0])
39
40
41 # Required versions of other packages
42 m4_define([glib_required_version], [2.26.0])
43
44
45 AC_INIT([ibus], [ibus_version],
46         [http://code.google.com/p/ibus/issues/entry],
47         [ibus])
48
49 # Init automake
50 AM_INIT_AUTOMAKE([1.10])
51 AM_MAINTAINER_MODE([enable])
52 AC_GNU_SOURCE
53
54 # Support silent build
55 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
56
57 # Define sustituted variables:
58 IBUS_MAJOR_VERSION=ibus_major_version
59 IBUS_MINOR_VERSION=ibus_minor_version
60 IBUS_MICRO_VERSION=ibus_micro_version
61 IBUS_API_VERSION=ibus_api_version
62 AC_SUBST(IBUS_MAJOR_VERSION)
63 AC_SUBST(IBUS_MINOR_VERSION)
64 AC_SUBST(IBUS_MICRO_VERSION)
65 AC_SUBST(IBUS_API_VERSION)
66
67 # Check for programs
68 AC_PROG_CC
69 AM_PROG_CC_C_O
70 AC_PROG_CC_STDC
71 AC_PROG_INSTALL
72 AC_PROG_CXX
73
74 # define PACKAGE_VERSION_* variables
75 AM_DISABLE_STATIC
76 AC_ISC_POSIX
77 AC_HEADER_STDC
78 AM_PROG_LIBTOOL
79 IT_PROG_INTLTOOL([0.35.0])
80
81 # If only source code changed, lt_revision + 1
82 # If any interface added, lt_age + 1
83 # If any interfaces changed or removed, lt_current + 1, lt_revision = 0, lt_age = 0
84 m4_define([lt_current], [0])
85 m4_define([lt_revision], [0])
86 m4_define([lt_age], [0])
87 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
88 AC_SUBST(LT_VERSION_INFO)
89
90 # check funcs
91 AC_CHECK_FUNCS(daemon)
92
93 # check glib2
94 AM_PATH_GLIB_2_0
95 PKG_CHECK_MODULES(GLIB2, [
96     glib-2.0 >= glib_required_version
97 ])
98 PKG_CHECK_MODULES(GOBJECT2, [
99     gobject-2.0 >= glib_required_version
100 ])
101 PKG_CHECK_MODULES(GIO2, [
102     gio-2.0 >= glib_required_version
103 ])
104 PKG_CHECK_MODULES(GTHREAD2, [
105     gthread-2.0 >= glib_required_version
106 ])
107
108 AC_ARG_ENABLE(gtk2,
109     AS_HELP_STRING([--disable-gtk2],
110                    [Do not build gtk2 im module]),
111     [enable_gtk2=$enableval],
112     [enable_gtk2=yes]
113 )
114 AM_CONDITIONAL([ENABLE_GTK2], [test x"$enable_gtk2" = x"yes"])
115
116 AC_ARG_ENABLE(gtk3,
117     AS_HELP_STRING([--enable-gtk3],
118                    [Build gtk3 im module]),
119     [enable_gtk3=$enableval],
120     [enable_gtk3=no]
121 )
122 AM_CONDITIONAL([ENABLE_GTK3], [test x"$enable_gtk3" = x"yes"])
123
124 AC_ARG_ENABLE(xim,
125     AS_HELP_STRING([--disable-xim],
126                    [Do not build xim server]),
127     [enable_xim=$enableval],
128     [enable_xim=yes]
129 )
130 AM_CONDITIONAL([ENABLE_XIM], [test x"$enable_xim" = x"yes"])
131
132 AC_ARG_ENABLE(vala,
133     AS_HELP_STRING([--disable-vala],
134                    [Do not build ibus vala binding]),
135     [enable_vala=$enableval],
136     [enable_vala=yes]
137 )
138 AM_CONDITIONAL([ENABLE_VALA], [test x"$enable_vala" = x"yes"])
139 if test x"$enable_vala" != x"yes"; then
140     enable_vala="no (disabled, use --enable-vala to enable)"
141 fi
142
143 if test x"$enable_gtk2" = x"yes" -o x"$enable_xim" = x"yes" ; then
144     # check for gtk2
145     PKG_CHECK_MODULES(GTK2, [
146         gtk+-2.0
147     ])
148 fi
149
150 if test x"$enable_gtk2" = x"yes"; then
151     # check for gdk2
152     gtk2_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
153     GTK2_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk2_binary_version/immodules
154
155     PKG_CHECK_MODULES(GDK2, [
156         gdk-2.0
157     ])
158 else
159     enable_gtk2="no (disabled, use --enable-gtk2 to enable)"
160 fi
161
162 if test x"$enable_gtk3" = x"yes"; then
163     # check for gtk3, gdk3
164     PKG_CHECK_MODULES(GTK3, [
165         gtk+-3.0
166     ])
167
168     gtk3_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-3.0`
169     GTK3_IM_MODULEDIR="$libdir"/gtk-3.0/$gtk3_binary_version/immodules
170
171     PKG_CHECK_MODULES(GDK3, [
172         gdk-3.0
173     ])
174 else
175     enable_gtk3="no (disabled, use --enable-gtk3 to enable)"
176 fi
177
178 if test x"$enable_xim" = x"yes"; then
179     # Check for x11
180     PKG_CHECK_MODULES(X11, [
181         x11
182     ])
183     AC_CHECK_HEADERS([X11/XKBlib.h])
184 else
185     enable_xim="no (disabled, use --enable-xim to enable)"
186 fi
187
188 # GObject introspection
189 GOBJECT_INTROSPECTION_CHECK([0.6.8])
190
191 IBUS_GIR_SCANNERFLAGS=
192 if test x"$found_introspection" = x"yes" ; then
193     IBUS_GIR_SCANNERFLAGS="--identifier-prefix=IBus --symbol-prefix=ibus"
194     PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
195                      [gir_symbol_prefix=yes],
196                      [gir_symbol_prefix=no])
197     if test x"$gir_symbol_prefix" = x"no" ; then
198         IBUS_GIR_SCANNERFLAGS="--strip-prefix=IBus"
199     fi
200 fi
201 AC_SUBST(IBUS_GIR_SCANNERFLAGS)
202
203 # check for gtk-doc
204 GTK_DOC_CHECK(1.9)
205 if test x"$enable_gtk_doc" = x"no"; then
206     enable_gtk_doc="no (disabled, use --enable-gtk-doc to enable)"
207 fi
208
209 # check for dbus
210 PKG_CHECK_MODULES(DBUS, [
211     dbus-1
212 ])
213
214 AC_ARG_ENABLE(gconf,
215     AS_HELP_STRING([--disable-gconf],
216                    [Do not use GConf code]),
217     [enable_gconf=$enableval],
218     [enable_gconf=yes]
219 )
220 AM_CONDITIONAL([ENABLE_GCONF], [test x"$enable_gconf" = x"yes"])
221
222 if test x"$enable_gconf" = x"yes"; then
223     # check gconf
224     PKG_CHECK_MODULES(GCONF,
225         [gconf-2.0 >= 2.12],
226     )
227
228     AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
229     if test x"$GCONFTOOL" = xno; then
230         AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
231     fi
232
233     AM_GCONF_SOURCE_2
234     # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
235 else
236     AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
237     enable_gconf="no (disabled, use --enable-gconf to enable)"
238 fi
239
240 AC_ARG_ENABLE(memconf,
241     AS_HELP_STRING([--enable-memconf],
242                    [Enable configure base on memory]),
243     [enable_memconf=$enableval],
244     [enable_memconf=no]
245 )
246 AM_CONDITIONAL([ENABLE_MEMCONF], [test "x$enable_memconf" = "xyes"])
247
248 AC_ARG_ENABLE(dconf,
249     AS_HELP_STRING([--enable-dconf],
250                    [Enable configure base on dconf]),
251     [enable_dconf=$enableval],
252     [enable_dconf=no]
253 )
254
255 if test x"$enable_dconf" = x"yes"; then
256     # check dconf
257     PKG_CHECK_MODULES(DCONF,
258         [dconf >= 0.7.5], ,
259         enable_dconf=no
260     )
261     # check glib-compile-schemas
262     GLIB_GSETTINGS
263 fi
264 AM_CONDITIONAL([ENABLE_DCONF], [test x"$enable_dconf" = x"yes"])
265
266 # check env
267 AC_PATH_PROG(ENV_IBUS_TEST, env)
268 AC_SUBST(ENV_IBUS_TEST)
269
270 AC_ARG_ENABLE(python,
271     AS_HELP_STRING([--disable-python],
272                    [Do not use Python code]),
273     [enable_python=$enableval],
274     [enable_python=yes]
275 )
276
277 AM_CONDITIONAL([ENABLE_PYTHON], [test x"$enable_python" = x"yes"])
278 AM_CONDITIONAL([ENABLE_DAEMON], [true])
279
280 if test x"$enable_python" = x"yes"; then
281     # check python
282     AM_PATH_PYTHON([2.5])
283     AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
284     if test x"$PYTHON_CONFIG" = x""; then
285         AC_PATH_PROG(PYTHON_CONFIG, python-config)
286     fi
287     if test x"$PYTHON_CONFIG" != x""; then
288         PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
289         PYTHON_LIBS=`$PYTHON_CONFIG --libs`
290     else
291         PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
292         PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
293     fi
294     PYTHON_INCLUDES="$PYTHON_CFLAGS"
295     AC_SUBST(PYTHON_CFLAGS)
296     AC_SUBST(PYTHON_INCLUDES)
297     AC_SUBST(PYTHON_LIBS)
298 else
299     enable_python="no (disabled, use --enable-python to enable)"
300 fi
301
302 #
303 # REBUILD = \#
304 # AC_SUBST(REBUILD)
305
306 # define GETTEXT_* variables
307 GETTEXT_PACKAGE=ibus10
308 AC_SUBST(GETTEXT_PACKAGE)
309 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
310
311 AM_GLIB_GNU_GETTEXT
312
313 # define gtk2 immodule dir
314 AC_ARG_WITH(gtk2-im-module-dir,
315     AS_HELP_STRING([--with-gtk2-im-module-dir[=DIR]],
316         [Select gtk2 immodule dir]),
317     GTK2_IM_MODULEDIR=$with_gtk2_im_module_dir
318 )
319 AC_SUBST(GTK2_IM_MODULEDIR)
320
321 # define gtk3 immodule dir
322 AC_ARG_WITH(gtk3-im-module-dir,
323     AS_HELP_STRING([--with-gtk3-im-module-dir[=DIR]],
324         [Select gtk3 immodule dir]),
325     GTK3_IM_MODULEDIR=$with_gtk3_im_module_dir
326 )
327 AC_SUBST(GTK3_IM_MODULEDIR)
328
329 if test x"$enable_python" = x"yes"; then
330     # check for dbus-python
331     AC_ARG_ENABLE(dbus-python-check,
332         AS_HELP_STRING([--disable-dbus-python-check],
333             [Do not check dbus-python]),
334         [enable_dbus_python_check=$enableval],
335         [enable_dbus_python_check=yes]
336     )
337     PKG_CHECK_MODULES(DBUS_PYTHON,
338         [dbus-python >= 0.83.0],
339         [IBUS_HAS_DBUS_PYTHON=yes],
340         [IBUS_HAS_DBUS_PYTHON=no]
341     )
342     if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
343         if test x"$enable_dbus_python_check" != x"no"; then
344             AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
345         else
346             AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
347         fi
348     fi
349 fi
350
351 # option for always disable snooper applications
352 AC_ARG_ENABLE(key-snooper,
353     AS_HELP_STRING([--disable-key-snooper],
354         [Always disable key snooper in gtk im module]),
355     [enable_key_snooper=$enableval],
356     [enable_key_snooper=yes]
357 )
358 if test x"$enable_key_snooper" = x"yes"; then
359     AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
360 else
361     AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
362     enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
363 fi
364
365 # option for no snooper applications
366 AC_ARG_WITH(no-snooper-apps,
367     AS_HELP_STRING([--with-no-snooper-apps[=regex1,regex2]],
368         [Does not enable keyboard snooper in those applications (like: .*chrome.*,firefox.*)]),
369     NO_SNOOPER_APPS=$with_no_snooper_apps,
370     NO_SNOOPER_APPS=[.*chrome.*,.*chromium.*,firefox.*,Do.*]
371 )
372 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
373     [Does not enbale keyboard snooper in those applications])
374
375 # GNOME 3 uses the theme's icon
376 AC_ARG_WITH(panel-icon-keyboard,
377     AS_HELP_STRING([--with-panel-icon-keyboard[=icon_name]],
378         [Set the default panel icon (default: "input-keyboard-symbolic")]),
379     [if test x"$with_panel_icon_keyboard" = x"yes" -o \
380              x"$with_panel_icon_keyboard" = x; then
381          with_panel_icon_keyboard="input-keyboard-symbolic"
382      fi
383      if test x"$with_panel_icon_keyboard" = x"legacy"; then
384          with_panel_icon_keyboard="ibus-keyboard"
385      fi
386      IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
387     ],
388     IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
389 )
390 AC_SUBST(IBUS_ICON_KEYBOARD)
391
392 # option for enable surrounding-text
393 AC_ARG_ENABLE(surrounding-text,
394     AS_HELP_STRING([--enable-surrounding-text],
395         [Enable surrounding-text support]),
396     [enable_surrounding_text=$enableval],
397     [enable_surrounding_text=no]
398 )
399 if test x"$enable_surrounding_text" = x"yes"; then
400     AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
401 else
402     enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
403 fi
404
405 # check iso-codes
406 PKG_CHECK_MODULES(ISOCODES, [
407     iso-codes
408 ])
409 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
410 AC_SUBST(ISOCODES_PREFIX)
411
412 # OUTPUT files
413 AC_CONFIG_FILES([ po/Makefile.in
414 Makefile
415 ibus-1.0.pc
416 ibus.spec
417 xinput-ibus
418 memconf/Makefile
419 memconf/memconf.xml.in
420 client/Makefile
421 client/gtk2/Makefile
422 client/gtk3/Makefile
423 client/x11/Makefile
424 src/Makefile
425 src/ibusversion.h
426 src/tests/Makefile
427 bus/Makefile
428 util/Makefile
429 util/IMdkit/Makefile
430 data/Makefile
431 data/icons/Makefile
432 data/keymaps/Makefile
433 data/dconf/Makefile
434 docs/Makefile
435 docs/reference/Makefile
436 docs/reference/ibus/ibus-docs.sgml
437 docs/reference/ibus/Makefile
438 m4/Makefile
439 ibus/_config.py
440 ibus/Makefile
441 ibus/interface/Makefile
442 ui/Makefile
443 ui/gtk/Makefile
444 ui/gtk/ibus-ui-gtk
445 ui/gtk/gtkpanel.xml.in
446 setup/Makefile
447 setup/ibus-setup
448 gconf/Makefile
449 gconf/gconf.xml.in
450 bindings/Makefile
451 bindings/vala/Makefile
452 dconf/Makefile
453 dconf/dconf.xml.in
454 ])
455
456 AC_OUTPUT
457 AC_MSG_RESULT([
458 Build options:
459   Version                   $VERSION
460   Install prefix            $prefix
461   Build shared libs         $enable_shared
462   Build static libs         $enable_static
463   CFLAGS                    $CFLAGS
464   Gtk2 immodule dir         $GTK2_IM_MODULEDIR
465   Gtk3 immodule dir         $GTK3_IM_MODULEDIR
466   Build gtk2 immodule       $enable_gtk2
467   Build gtk3 immodule       $enable_gtk3
468   Build XIM agent server    $enable_xim
469   Build python modules      $enable_python
470   Build gconf modules       $enable_gconf
471   Build memconf modules     $enable_memconf
472   Build dconf modules       $enable_dconf
473   Build introspection       $found_introspection
474   IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
475   Build vala binding        $enable_vala
476   Build document            $enable_gtk_doc
477   Enable key snooper        $enable_key_snooper
478   No snooper regexes        "$NO_SNOOPER_APPS"
479   Panel icon                "$IBUS_ICON_KEYBOARD"
480   Enable surrounding-text   $enable_surrounding_text
481 ])
482