Merge branch 'no_snooper_apps'
[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 # if not 1, append datestamp to the version number.
24 m4_define([ibus_released], [1])
25 m4_define([ibus_major_version], [1])
26 m4_define([ibus_minor_version], [3])
27 m4_define([ibus_micro_version], [2])
28 m4_define(ibus_maybe_datestamp,
29     m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
30
31 m4_define([ibus_version],
32     ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
33
34 AC_INIT([ibus], [ibus_version], [http://code.google.com/p/ibus/issues/entry],[ibus])
35 AM_INIT_AUTOMAKE([1.10])
36 AC_GNU_SOURCE
37
38 AC_CONFIG_HEADERS([config.h])
39 AC_CONFIG_MACRO_DIR([m4])
40 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
41
42 # define PACKAGE_VERSION_* variables
43 AS_VERSION
44 AS_NANO
45 AM_MAINTAINER_MODE
46 AM_DISABLE_STATIC
47 AC_PROG_CC
48 AM_PROG_CC_C_O
49 AC_PROG_CXX
50 AC_ISC_POSIX
51 AC_HEADER_STDC
52 AM_PROG_LIBTOOL
53 IT_PROG_INTLTOOL([0.35.0])
54
55 # For dislpay Date
56 m4_define(ibus_datedisplay,
57     m4_esyscmd(date '+%a %b %d %Y' | tr -d '\n\r'))
58 DATE_DISPLAY="ibus_datedisplay"
59 AC_SUBST(DATE_DISPLAY)
60
61 # If only source code changed, lt_revision + 1
62 # If any interface added, lt_age + 1
63 # If any interfaces changed or removed, lt_current + 1, lt_revision = 0, lt_age = 0
64 m4_define([lt_current], [2])
65 m4_define([lt_revision], [0])
66 m4_define([lt_age], [0])
67 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
68 AC_SUBST(LT_VERSION_INFO)
69
70 # check inotify
71 AC_CHECK_HEADERS([sys/inotify.h])
72
73 # check funcs
74 AC_CHECK_FUNCS(daemon)
75
76 # check glib2
77 AM_PATH_GLIB_2_0
78 PKG_CHECK_MODULES(GLIB2, [
79     glib-2.0 >= 2.18
80 ])
81 PKG_CHECK_MODULES(GOBJECT2, [
82     gobject-2.0 >= 2.18
83 ])
84 PKG_CHECK_MODULES(GIO2, [
85     gio-2.0 >= 2.18
86 ])
87 PKG_CHECK_MODULES(GTHREAD2, [
88     gthread-2.0 >= 2.18
89 ])
90 # PKG_CHECK_MODULES(PYGOBJECT2, [
91 #     pygobject-2.0 >= 2.14
92 # ])
93
94 # check for gtk, gdk & pygtk
95 PKG_CHECK_MODULES(GTK2, [
96     gtk+-2.0
97 ])
98
99 gtk_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
100 GTK_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk_binary_version/immodules
101
102 PKG_CHECK_MODULES(GDK2, [
103     gdk-2.0
104 ])
105
106 # check for gtk-doc
107 GTK_DOC_CHECK(1.9)
108
109 # check for dbus-glib
110 PKG_CHECK_MODULES(DBUS, [
111     dbus-1
112 ])
113
114 AC_ARG_ENABLE(gconf,
115     AS_HELP_STRING([--disable-gconf],
116                    [Do not use GConf code]),
117     [enable_gconf=$enableval],
118     [enable_gconf=yes]
119 )
120
121 AM_CONDITIONAL([ENABLE_GCONF], [test "x$enable_gconf" = "xyes"])
122
123 if test x"$enable_gconf" != x"no"; then
124     # check gconf
125     PKG_CHECK_MODULES(GCONF,
126         [gconf-2.0 >= 2.12],
127     )
128
129     AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
130     if test x"$GCONFTOOL" = xno; then
131         AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
132     fi
133
134     AM_GCONF_SOURCE_2
135     # GCONF_SCHEMAS_INSTALL should be set in macro AM_GCONF_SOURCE_2
136 else
137     AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [false])
138 fi
139
140 # Check for x11
141 PKG_CHECK_MODULES(X11, [
142     x11
143 ])
144
145 AC_CHECK_HEADERS([X11/XKBlib.h])
146
147 # check env
148 AC_PATH_PROG(ENV, env)
149 AC_SUBST(ENV)
150
151 AC_ARG_ENABLE(python,
152     AS_HELP_STRING([--disable-python],
153                    [Do not use Python code]),
154     [enable_python=$enableval],
155     [enable_python=yes]
156 )
157
158 AM_CONDITIONAL([ENABLE_PYTHON], [test "x$enable_python" = "xyes"])
159
160 if test x"$enable_python" != x"no"; then
161     # check python
162     AM_PATH_PYTHON([2.5])
163     AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
164     if test x"$PYTHON_CONFIG" = x""; then
165         AC_PATH_PROG(PYTHON_CONFIG, python-config)
166     fi
167     if test x"$PYTHON_CONFIG" != x""; then
168         PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
169         PYTHON_LIBS=`$PYTHON_CONFIG --libs`
170     else
171         PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
172         PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
173     fi
174     PYTHON_INCLUDES="$PYTHON_CFLAGS"
175     AC_SUBST(PYTHON_CFLAGS)
176     AC_SUBST(PYTHON_INCLUDES)
177     AC_SUBST(PYTHON_LIBS)
178 fi
179
180 #
181 # REBUILD = \#
182 # AC_SUBST(REBUILD)
183
184 # define GETTEXT_* variables
185 GETTEXT_PACKAGE=ibus
186 AC_SUBST(GETTEXT_PACKAGE)
187 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
188
189 AM_GLIB_GNU_GETTEXT
190
191 # define configure arguments
192 AC_ARG_WITH(gtk-im-module-dir,
193     AS_HELP_STRING([--with-gtk-im-module-dir[=DIR]],
194         [Select gtk immodule dir]),
195     GTK_IM_MODULEDIR=$with_gtk_im_module_dir
196 )
197 AC_SUBST(GTK_IM_MODULEDIR)
198
199 if test x"$enable_python" != x"no"; then
200     # check for dbus-python
201     AC_ARG_ENABLE(dbus-python-check,
202         AS_HELP_STRING([--disable-dbus-python-check],
203             [Do not check dbus-python]),
204         [enable_dbus_python_check=$enableval],
205         [enable_dbus_python_check=yes]
206     )
207     PKG_CHECK_MODULES(DBUS_PYTHON,
208         [dbus-python >= 0.83.0],
209         [IBUS_HAS_DBUS_PYTHON=yes],
210         [IBUS_HAS_DBUS_PYTHON=no]
211     )
212     if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
213         if test x"$enable_dbus_python_check" != x"no"; then
214             AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
215         else
216             AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
217         fi
218     fi
219 fi
220
221 # option for disable snooper applications
222 AC_ARG_ENABLE(key-snooper,
223     AS_HELP_STRING([--disable-key-snooper],
224         [Disable key snooper in gtk im module]),
225     [enable_key_snooper=$enableval],
226     [enable_key_snooper=yes]
227 )
228 if test x"$enable_key_snooper" != x"no"; then
229     AC_DEFINE(ENABLE_SNOOPER, TRUE, [Enable key snooper])
230 else
231     AC_DEFINE(ENABLE_SNOOPER, FALSE, [Enable key snooper])
232 fi
233
234 # option for no snooper applications
235 AC_ARG_WITH(no-snooper-apps,
236     AS_HELP_STRING([--with-no-snooper-apps[=app1,app2]],
237         [Does not enable keyboard snooper in those applications]),
238     NO_SNOOPER_APPS=$with_no_snooper_apps
239 )
240 AC_DEFINE_UNQUOTED(NO_SNOOPER_APPS, "$NO_SNOOPER_APPS",
241     [Does not enbale key snooper in those applications])
242
243 # check iso-codes
244 PKG_CHECK_MODULES(ISOCODES, [
245     iso-codes
246 ])
247 ISOCODES_PREFIX=`pkg-config iso-codes --variable=prefix`
248 AC_SUBST(ISOCODES_PREFIX)
249
250 # OUTPUT files
251 AC_CONFIG_FILES([ po/Makefile.in
252 Makefile
253 ibus-1.0.pc
254 ibus.spec
255 xinput-ibus
256 client/Makefile
257 client/gtk2/Makefile
258 client/x11/Makefile
259 src/Makefile
260 src/ibusversion.h
261 bus/Makefile
262 util/Makefile
263 util/IMdkit/Makefile
264 data/Makefile
265 data/icons/Makefile
266 data/keymaps/Makefile
267 docs/Makefile
268 docs/reference/Makefile
269 docs/reference/ibus/Makefile
270 m4/Makefile
271 ibus/_config.py
272 ibus/Makefile
273 ibus/interface/Makefile
274 ui/Makefile
275 ui/gtk/Makefile
276 ui/gtk/ibus-ui-gtk
277 ui/gtk/gtkpanel.xml.in
278 setup/Makefile
279 setup/ibus-setup
280 gconf/Makefile
281 gconf/gconf.xml.in
282 ])
283
284 AC_OUTPUT
285 AC_MSG_RESULT([
286 Build options:
287   Version                   $VERSION
288   Install prefix            $prefix
289   Build shared libs         $enable_shared
290   Build static libs         $enable_static
291   Gtk immodule dir          $GTK_IM_MODULEDIR
292   Build python modules      $enable_python
293   Build gconf modules       $enable_gconf
294   Build document            $enable_gtk_doc
295   Enable key snooper        $enable_key_snooper
296   No snooper apps           "$NO_SNOOPER_APPS"
297 ])
298