81e1ceebfcb6f6cb7ca6c7bb6f9c5a57d191e04c
[platform/upstream/ibus.git] / configure.ac
1 # vim:set et ts=4:
2 #
3 # ibus - The Input Bus
4 #
5 # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, write to the
19 # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 # Boston, MA  02111-1307  USA
21
22 # if not 1, append datestamp to the version number.
23 m4_define([ibus_released], [0])
24 m4_define([ibus_major_version], [1])
25 m4_define([ibus_minor_version], [2])
26 m4_define([ibus_micro_version], [0])
27 m4_define(ibus_maybe_datestamp,
28     m4_esyscmd([if test x]ibus_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
29
30 m4_define([ibus_version],
31     ibus_major_version.ibus_minor_version.ibus_micro_version[]ibus_maybe_datestamp)
32
33 AC_INIT([ibus], [ibus_version], [http://code.google.com/p/ibus/issues/entry],[ibus])
34 AM_INIT_AUTOMAKE([1.10])
35 AC_GNU_SOURCE
36
37 AC_CONFIG_HEADERS([config.h])
38 AC_CONFIG_MACRO_DIR([m4])
39
40 # define PACKAGE_VERSION_* variables
41 AS_VERSION
42 AS_NANO
43 AM_MAINTAINER_MODE
44 AM_DISABLE_STATIC
45 AC_PROG_CC
46 AM_PROG_CC_C_O
47 AC_PROG_CXX
48 AC_ISC_POSIX
49 AC_HEADER_STDC
50 AM_PROG_LIBTOOL
51 IT_PROG_INTLTOOL([0.35.0])
52
53 # For dislpay Date
54 m4_define(ibus_maybe_datedisplay,
55     m4_esyscmd([if test x]ibus_released[ != x1; then date '+%a %b %d %Y' | tr -d '\n\r'; fi]))
56 m4_define([ibus_datedisplay], ibus_maybe_datedisplay)
57 DATE_DISPLAY="ibus_datedisplay"
58 AC_SUBST(DATE_DISPLAY)
59
60 # If only source code changed, lt_revision + 1
61 # If any interface added, lt_age + 1
62 # If any interfaces changed or removed, lt_current + 1
63 m4_define([lt_current], [1])
64 m4_define([lt_revision], [0])
65 m4_define([lt_age], [0])
66 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
67 AC_SUBST(LT_VERSION_INFO)
68
69 # check inotify
70 AC_CHECK_HEADERS([sys/inotify.h])
71
72 # check funcs
73 AC_CHECK_FUNCS(daemon)
74
75 # check glib2
76 AM_PATH_GLIB_2_0
77 PKG_CHECK_MODULES(GLIB2, [
78     glib-2.0 >= 2.18
79 ])
80 PKG_CHECK_MODULES(GOBJECT2, [
81     gobject-2.0 >= 2.18
82 ])
83 PKG_CHECK_MODULES(GIO2, [
84     gio-2.0 >= 2.18
85 ])
86 # PKG_CHECK_MODULES(PYGOBJECT2, [
87 #     pygobject-2.0 >= 2.14
88 # ])
89
90 # check for gtk, gdk & pygtk
91 PKG_CHECK_MODULES(GTK2, [
92     gtk+-2.0
93 ])
94
95 gtk_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
96 GTK_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk_binary_version/immodules
97
98 PKG_CHECK_MODULES(GDK2, [
99     gdk-2.0
100 ])
101
102 # check for gtk-doc
103 GTK_DOC_CHECK(1.9)
104
105 # check for dbus-glib
106 PKG_CHECK_MODULES(DBUS, [
107     dbus-1
108 ])
109
110 # check gconf
111 PKG_CHECK_MODULES(GCONF,
112     [gconf-2.0 >= 2.12],
113 )
114
115 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
116 if test x"$GCONFTOOL" = xno; then
117     AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
118 fi
119
120 AM_GCONF_SOURCE_2
121
122 # GCONF_SERVERDIR=`$PKG_CONFIG --variable=gconf_serverdir gconf-2.0`
123 # old_path=$PATH
124 # if test x"$GCONF_SERVERDIR" != x; then
125 #     PATH=$GCONF_SERVERDIR:$PATH
126 # fi
127
128 # AC_PATH_PROG(GCONF_SANITY_CHECK, gconf-sanity-check-2, no)
129 # if test x"$GCONF_SANITY_CHECK" = xno; then
130 #     AC_MSG_ERROR([gconf-sanity-check-2 executable not found in your path - should be installed with GConf])
131 # fi
132
133 # AC_SUBST(GCONF_SANITY_CHECK)
134 # PATH=$old_path
135
136 # Check for Qt4
137 # PKG_CHECK_MODULES(QT,
138 #     [QtCore >= 4.4.0 QtDBus >= 4.4.0],
139 #     [IBUS_HAS_QT4=yes],
140 #     [IBUS_HAS_QT4=no]
141 # )
142
143 # if test x"$IBUS_HAS_QT4" == x"yes"; then
144 #     QMAKE=`$PKG_CONFIG --variable=qmake Qt`
145 #     if test x"$QMAKE" == x""; then
146 #         AC_PATH_PROG(QMAKE, qmake-qt4)
147 #     fi
148 #     if test x"$QMAKE" == x""; then
149 #         AC_PATH_PROG(QMAKE, qmake)
150 #     fi
151 #     if test x"$QMAKE" == x""; then
152 #         IBUS_HAS_QT4=no
153 #         AC_MSG_WARN([Can not find qmake.])
154 #     fi
155 #     AC_SUBST(QMAKE)
156 # fi
157
158 # Check for x11
159 PKG_CHECK_MODULES(X11, [
160     x11
161 ])
162
163 AC_CHECK_HEADERS([X11/XKBlib.h])
164
165 # check env
166 AC_PATH_PROG(ENV, env)
167 AC_SUBST(ENV)
168
169
170 # check python
171 AM_PATH_PYTHON([2.5])
172 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
173 if test x"$PYTHON_CONFIG" == x""; then
174     AC_PATH_PROG(PYTHON_CONFIG, python-config)
175 fi
176 if test x"$PYTHON_CONFIG" != x""; then
177     PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
178     PYTHON_LIBS=`$PYTHON_CONFIG --libs`
179 else
180     PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
181     PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
182 fi
183 PYTHON_INCLUDES="$PYTHON_CFLAGS"
184 AC_SUBST(PYTHON_CFLAGS)
185 AC_SUBST(PYTHON_INCLUDES)
186 AC_SUBST(PYTHON_LIBS)
187
188 #
189 # REBUILD = \#
190 # AC_SUBST(REBUILD)
191
192 # define GETTEXT_* variables
193 GETTEXT_PACKAGE=ibus
194 AC_SUBST(GETTEXT_PACKAGE)
195 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
196
197 AM_GLIB_GNU_GETTEXT
198
199 # define configure arguments
200 AC_ARG_WITH(gtk-im-module-dir,
201     AS_HELP_STRING([--with-gtk-im-module-dir[=DIR]],
202         [Select gtk immodule dir]),
203     GTK_IM_MODULEDIR=$with_gtk_im_module_dir
204 )
205 AC_SUBST(GTK_IM_MODULEDIR)
206
207 # AC_ARG_ENABLE(qt4-immodule,
208 #     AS_HELP_STRING([--disable-qt4-immodule],
209 #         [do not build qt4 immodule]),
210 #     [enable_qt4=$enableval],
211 #     [enable_qt4=yes],
212 # )
213 # if test x"$IBUS_HAS_QT4" != x"yes"; then
214 #     enable_qt4=no
215 # fi
216 # enable_qt4=no
217 # AM_CONDITIONAL(IBUS_BUILD_QT4, [test x"$enable_qt4" = x"yes" ])
218
219 # check for dbus-python
220 AC_ARG_ENABLE(dbus-python-check,
221     AS_HELP_STRING([--disable-dbus-python-check],
222         [Do not check dbus-python]),
223     [enable_dbus_python_check=$enableval],
224     [enable_dbus_python_check=yes],
225 )
226 PKG_CHECK_MODULES(DBUS_PYTHON,
227     [dbus-python >= 0.83.0],
228     [IBUS_HAS_DBUS_PYTHON=yes],
229     [IBUS_HAS_DBUS_PYTHON=no]
230 )
231 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
232     if test x"$enable_dbus_python_check" != x"no"; then
233         AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
234     else
235         AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
236     fi
237 fi
238
239 # check iso-codes
240 AC_ARG_ENABLE(iso-codes-check,
241     AS_HELP_STRING([--disable-iso-codes-check],
242         [Do not check iso-codes]),
243     [enable_iso_codes_check=$enableval],
244     [enable_iso_codes_check=yes],
245 )
246 PKG_CHECK_MODULES(ISOCODES,
247     iso-codes,
248     [IBUS_HAS_ISOCODES=yes],
249     [IBUS_HAS_ISOCODES=no],
250 )
251 if test x"$IBUS_HAS_ISOCODES" != x"yes"; then
252     if test x"$enable_iso_codes_check" != x"no"; then
253         AC_MSG_ERROR([can not find iso-codes. Please install iso-codes or configure with --disable-iso-codes-check])
254     else
255         AC_MSG_WARN([can not find iso-codes. It is required.])
256     fi
257 fi
258
259 # OUTPUT files
260 AC_CONFIG_FILES([ po/Makefile.in
261 Makefile
262 ibus-1.0.pc
263 ibus.spec
264 ibus/_config.py
265 ibus/Makefile
266 ibus/interface/Makefile
267 ui/Makefile
268 ui/gtk/Makefile
269 ui/gtk/ibus-ui-gtk
270 ui/gtk/gtkpanel.xml.in
271 gconf/Makefile
272 gconf/gconf.xml.in
273 client/Makefile
274 client/gtk2/Makefile
275 client/x11/Makefile
276 setup/Makefile
277 setup/ibus-setup
278 src/Makefile
279 src/ibusversion.h
280 bus/Makefile
281 util/Makefile
282 util/IMdkit/Makefile
283 data/Makefile
284 data/icons/Makefile
285 data/keymaps/Makefile
286 docs/Makefile
287 docs/reference/Makefile
288 docs/reference/ibus/Makefile
289 m4/Makefile
290 ])
291
292 AC_OUTPUT
293 AC_MSG_RESULT([
294 Build options:
295   Version                  $VERSION
296   Install prefix           $prefix
297   Build shared libs        $enable_shared
298   Build static libs        $enable_static
299   Gtk immodule dir         $GTK_IM_MODULEDIR
300   Build document           $enable_gtk_doc
301 ])
302