Fix some compile problems with Sun C compiler.
[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], [1])
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
52 # If only source code changed, lt_revision + 1
53 # If any interface added, lt_age + 1
54 # If any interfaces changed or removed, lt_current + 1
55 m4_define([lt_current], [0])
56 m4_define([lt_revision], [0])
57 m4_define([lt_age], [0])
58 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
59 AC_SUBST(LT_VERSION_INFO)
60
61 # check inotify
62 AC_CHECK_HEADERS([sys/inotify.h])
63
64 # check funcs
65 AC_CHECK_FUNCS(daemon)
66
67 # check glib2
68 AM_PATH_GLIB_2_0
69 PKG_CHECK_MODULES(GLIB2, [
70     glib-2.0 >= 2.18
71 ])
72 PKG_CHECK_MODULES(GOBJECT2, [
73     gobject-2.0 >= 2.18
74 ])
75 PKG_CHECK_MODULES(GIO2, [
76     gio-2.0 >= 2.18
77 ])
78 # PKG_CHECK_MODULES(PYGOBJECT2, [
79 #     pygobject-2.0 >= 2.14
80 # ])
81
82 # check for gtk, gdk & pygtk
83 PKG_CHECK_MODULES(GTK2, [
84     gtk+-2.0
85 ])
86
87 gtk_binary_version=`$PKG_CONFIG --variable=gtk_binary_version gtk+-2.0`
88 GTK_IM_MODULEDIR="$libdir"/gtk-2.0/$gtk_binary_version/immodules
89
90 PKG_CHECK_MODULES(GDK2, [
91     gdk-2.0
92 ])
93
94 # check for gtk-doc
95 GTK_DOC_CHECK(1.9)
96
97 # check for dbus-glib
98 PKG_CHECK_MODULES(DBUS, [
99     dbus-1
100 ])
101
102 # check gconf
103 PKG_CHECK_MODULES(GCONF,
104     [gconf-2.0 >= 2.12],
105 )
106
107 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
108 if test x"$GCONFTOOL" = xno; then
109     AC_MSG_ERROR([gconftool-2 executable not found in your path - should be installed with GConf])
110 fi
111
112 AM_GCONF_SOURCE_2
113
114 # GCONF_SERVERDIR=`$PKG_CONFIG --variable=gconf_serverdir gconf-2.0`
115 # old_path=$PATH
116 # if test x"$GCONF_SERVERDIR" != x; then
117 #     PATH=$GCONF_SERVERDIR:$PATH
118 # fi
119
120 # AC_PATH_PROG(GCONF_SANITY_CHECK, gconf-sanity-check-2, no)
121 # if test x"$GCONF_SANITY_CHECK" = xno; then
122 #     AC_MSG_ERROR([gconf-sanity-check-2 executable not found in your path - should be installed with GConf])
123 # fi
124
125 # AC_SUBST(GCONF_SANITY_CHECK)
126 # PATH=$old_path
127
128 # Check for Qt4
129 PKG_CHECK_MODULES(QT,
130     [QtCore >= 4.4.0 QtDBus >= 4.4.0],
131     [IBUS_HAS_QT4=yes],
132     [IBUS_HAS_QT4=no]
133 )
134
135 if test x"$IBUS_HAS_QT4" == x"yes"; then
136     QMAKE=`$PKG_CONFIG --variable=qmake Qt`
137     if test x"$QMAKE" == x""; then
138         AC_PATH_PROG(QMAKE, qmake-qt4)
139     fi
140     if test x"$QMAKE" == x""; then
141         AC_PATH_PROG(QMAKE, qmake)
142     fi
143     if test x"$QMAKE" == x""; then
144         IBUS_HAS_QT4=no
145         AC_MSG_WARN([Can not find qmake.])
146     fi
147     AC_SUBST(QMAKE)
148 fi
149
150 # Check for x11
151 PKG_CHECK_MODULES(X11, [
152     x11
153 ])
154
155 AC_CHECK_HEADERS([X11/XKBlib.h])
156
157 # check env
158 AC_PATH_PROG(ENV, env)
159 AC_SUBST(ENV)
160
161
162 # check python
163 AM_PATH_PYTHON([2.5])
164 AC_PATH_PROG(PYTHON_CONFIG, python$PYTHON_VERSION-config)
165 if test x"$PYTHON_CONFIG" == x""; then
166     AC_PATH_PROG(PYTHON_CONFIG, python-config)
167 fi
168 if test x"$PYTHON_CONFIG" != x""; then
169     PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
170     PYTHON_LIBS=`$PYTHON_CONFIG --libs`
171 else
172     PYTHON_CFLAGS=`$PYTHON $srcdir/python-config.py --includes`
173     PYTHON_LIBS=`$PYTHON $srcdir/python-config.py --libs`
174 fi
175 PYTHON_INCLUDES="$PYTHON_CFLAGS"
176 AC_SUBST(PYTHON_CFLAGS)
177 AC_SUBST(PYTHON_INCLUDES)
178 AC_SUBST(PYTHON_LIBS)
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", [Define to the read-only architecture-independent data directory.])
188
189 AM_GNU_GETTEXT([external])
190 AM_GNU_GETTEXT_VERSION(0.16.1)
191
192
193 # define configure arguments
194 AC_ARG_WITH(gtk-im-module-dir,
195     AS_HELP_STRING([--with-gtk-im-module-dir[=DIR]],
196         [Select gtk immodule dir]),
197     GTK_IM_MODULEDIR=$with_gtk_im_module_dir
198 )
199 AC_SUBST(GTK_IM_MODULEDIR)
200
201 AC_ARG_ENABLE(qt4-immodule,
202     AS_HELP_STRING([--disable-qt4-immodule],
203         [do not build qt4 immodule]),
204     [enable_qt4=$enableval],
205     [enable_qt4=yes],
206 )
207 if test x"$IBUS_HAS_QT4" != x"yes"; then
208     enable_qt4=no
209 fi
210 enable_qt4=no
211 AM_CONDITIONAL(IBUS_BUILD_QT4, [test x"$enable_qt4" = x"yes" ])
212
213 # check for dbus-python
214 AC_ARG_ENABLE(dbus-python-check,
215     AS_HELP_STRING([--disable-dbus-python-check],
216         [Do not check dbus-python]),
217     [enable_dbus_python_check=$enableval],
218     [enable_dbus_python_check=yes],
219 )
220 PKG_CHECK_MODULES(DBUS_PYTHON,
221     [dbus-python >= 0.83.0],
222     [IBUS_HAS_DBUS_PYTHON=yes],
223     [IBUS_HAS_DBUS_PYTHON=no]
224 )
225 if test x"$IBUS_HAS_DBUS_PYTHON" != x"yes"; then
226     if test x"$enable_dbus_python_check" != x"no"; then
227         AC_MSG_ERROR([can not find dbus-python >= 0.83.0. Please install or update dbus-python.])
228     else
229         AC_MSG_WARN([can not find dbus-python >= 0.83.0. It is required.])
230     fi
231 fi
232
233 # check iso-codes
234 AC_ARG_ENABLE(iso-codes-check,
235     AS_HELP_STRING([--disable-iso-codes-check],
236         [Do not check iso-codes]),
237     [enable_iso_codes_check=$enableval],
238     [enable_iso_codes_check=yes],
239 )
240 PKG_CHECK_MODULES(ISOCODES,
241     iso-codes,
242     [IBUS_HAS_ISOCODES=yes],
243     [IBUS_HAS_ISOCODES=no],
244 )
245 if test x"$IBUS_HAS_ISOCODES" != x"yes"; then
246     if test x"$enable_iso_codes_check" != x"no"; then
247         AC_MSG_ERROR([can not find iso-codes. Please install iso-codes or configure with --disable-iso-codes-check])
248     else
249         AC_MSG_WARN([can not find iso-codes. It is required.])
250     fi
251 fi
252
253 # OUTPUT files
254 AC_CONFIG_FILES([ po/Makefile.in
255 Makefile
256 ibus-1.0.pc
257 ibus.spec
258 ibus/_config.py
259 ibus/Makefile
260 ibus/interface/Makefile
261 ui/Makefile
262 ui/gtk/Makefile
263 ui/gtk/ibus-ui-gtk
264 ui/gtk/gtkpanel.xml.in
265 gconf/Makefile
266 gconf/gconf.xml.in
267 client/Makefile
268 client/gtk2/Makefile
269 client/qt4/Makefile
270 client/x11/Makefile
271 setup/Makefile
272 setup/ibus-setup
273 src/Makefile
274 bus/Makefile
275 bindings/Makefile
276 bindings/python/Makefile
277 util/Makefile
278 util/IMdkit/Makefile
279 data/Makefile
280 data/icons/Makefile
281 docs/Makefile
282 docs/reference/Makefile
283 docs/reference/ibus/Makefile
284 m4/Makefile
285 ])
286
287 AC_OUTPUT
288 AC_MSG_RESULT([
289 Build options:
290   Version                  $VERSION
291   Install prefix           $prefix
292   Build shared libs        $enable_shared
293   Build static libs        $enable_static
294   Gtk immodule dir         $GTK_IM_MODULEDIR
295   Enable Qt4 IM module     $enable_qt4
296   Build document           $enable_gtk_doc
297 ])
298