f625dbc9894dbda2aee85dee0abdf68e0b995739
[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], [0])
26
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])
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-library,
313     AS_HELP_STRING([--enable-python-library],
314                    [Use ibus python library]),
315     [enable_python_library=$enableval],
316     [enable_python_library=no]
317 )
318
319 AC_ARG_ENABLE(setup,
320     AS_HELP_STRING([--disable-setup],
321                    [Do not use setup ui.]),
322     [enable_setup=$enableval],
323     [enable_setup=yes]
324 )
325
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])
329
330 if test x"$enable_python_library" = x"yes"; then
331     # Check python.
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)
336     fi
337     if test x"$PYTHON_CONFIG" != x""; then
338         PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
339         PYTHON_LIBS=`$PYTHON_CONFIG --libs`
340     else
341         PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
342         PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
343     fi
344     PYTHON_INCLUDES="$PYTHON_CFLAGS"
345     AC_SUBST(PYTHON_CFLAGS)
346     AC_SUBST(PYTHON_INCLUDES)
347     AC_SUBST(PYTHON_LIBS)
348 else
349     enable_python_library="no (disabled, use --enable-python-library to enable)"
350 fi
351
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
357 )
358 AC_SUBST(GTK2_IM_MODULEDIR)
359
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
365 )
366 AC_SUBST(GTK3_IM_MODULEDIR)
367
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]
375     )
376     PKG_CHECK_MODULES(DBUS_PYTHON,
377         [dbus-python >= 0.83.0],
378         [IBUS_HAS_DBUS_PYTHON=yes],
379         [IBUS_HAS_DBUS_PYTHON=no]
380     )
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.])
384         else
385             AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
386         fi
387     fi
388 fi
389
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]
396 )
397 if test x"$enable_key_snooper" = x"yes"; then
398     AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
399 else
400     AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
401     enable_key_snooper="no (disabled, use --enable-key-snooper to enable)"
402 fi
403
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.*]
410 )
411 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
412     [Does not enbale keyboard snooper in those applications])
413
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"
421      fi
422      if test x"$with_panel_icon_keyboard" = x"legacy"; then
423          with_panel_icon_keyboard="ibus-keyboard"
424      fi
425      IBUS_ICON_KEYBOARD=$with_panel_icon_keyboard
426     ],
427     IBUS_ICON_KEYBOARD="input-keyboard-symbolic"
428 )
429 AC_SUBST(IBUS_ICON_KEYBOARD)
430
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]
437 )
438 if test x"$enable_surrounding_text" = x"yes"; then
439     AC_DEFINE(ENABLE_SURROUNDING, TRUE, [Enable surrounding-text support])
440 else
441     enable_surrounding_text="no (disabled, use --enable-surrounding-text to enable)"
442 fi
443
444 # Check iso-codes.
445 PKG_CHECK_MODULES(ISOCODES, [
446     iso-codes
447 ])
448 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
449 AC_SUBST(ISOCODES_PREFIX)
450
451 # OUTPUT files
452 AC_CONFIG_FILES([ po/Makefile.in
453 Makefile
454 ibus-1.0.pc
455 ibus.spec
456 xinput-ibus
457 client/Makefile
458 client/gtk2/Makefile
459 client/gtk3/Makefile
460 client/x11/Makefile
461 src/Makefile
462 src/ibusversion.h
463 src/tests/Makefile
464 bus/Makefile
465 engine/Makefile
466 engine/simple.xml.in
467 util/Makefile
468 util/IMdkit/Makefile
469 data/Makefile
470 data/icons/Makefile
471 data/keymaps/Makefile
472 data/dconf/Makefile
473 docs/Makefile
474 docs/reference/Makefile
475 docs/reference/ibus/ibus-docs.sgml
476 docs/reference/ibus/Makefile
477 m4/Makefile
478 ibus/_config.py
479 ibus/Makefile
480 ibus/interface/Makefile
481 ui/Makefile
482 ui/gtk2/Makefile
483 ui/gtk2/ibus-ui-gtk
484 ui/gtk2/gtkpanel.xml.in
485 ui/gtk3/Makefile
486 setup/Makefile
487 setup/ibus-setup
488 bindings/Makefile
489 bindings/vala/Makefile
490 conf/Makefile
491 conf/gconf/Makefile
492 conf/gconf/gconf.xml.in
493 conf/dconf/Makefile
494 conf/dconf/dconf.xml.in
495 conf/memconf/Makefile
496 conf/memconf/memconf.xml.in
497 tools/Makefile
498 ])
499
500 AC_OUTPUT
501 AC_MSG_RESULT([
502 Build options:
503   Version                   $IBUS_VERSION
504   Install prefix            $prefix
505   Build shared libs         $enable_shared
506   Build static libs         $enable_static
507   CFLAGS                    $CFLAGS
508   Gtk2 immodule dir         $GTK2_IM_MODULEDIR
509   Gtk3 immodule dir         $GTK3_IM_MODULEDIR
510   Build gtk2 immodule       $enable_gtk2
511   Build gtk3 immodule       $enable_gtk3
512   Build XIM agent server    $enable_xim
513   Build python library      $enable_python_library
514   Build gconf modules       $enable_gconf
515   Build memconf modules     $enable_memconf
516   Build dconf modules       $enable_dconf
517   Build introspection       $found_introspection
518   IBus-1.0.gir scannerflags "$IBUS_GIR_SCANNERFLAGS"
519   Build vala binding        $enable_vala
520   Build document            $enable_gtk_doc
521   Enable key snooper        $enable_key_snooper
522   No snooper regexes        "$NO_SNOOPER_APPS"
523   Panel icon                "$IBUS_ICON_KEYBOARD"
524   Enable surrounding-text   $enable_surrounding_text
525 ])
526