Update Brazilian Portuguese translation
[dasher.git] / configure.ac
blob43f958f83823a6f1ee82e0141480a49c77b402fa
1 AC_PREREQ(2.59)
2 AC_INIT([dasher],
3   m4_esyscmd([build-aux/mkversion]),
4   [http://bugzilla.gnome.org/enter_bug.cgi?product=dasher],
5   [dasher],
6   [http://www.inference.phy.cam.ac.uk/dasher/])
8 # This becomes part of AC_INIT in autoconf 2.64
9 m4_ifndef([AC_PACKAGE_URL],
10         [m4_define([AC_PACKAGE_URL],["http://www.inference.phy.cam.ac.uk/dasher/"])
11         AC_DEFINE_UNQUOTED([PACKAGE_URL],
12                        [AC_PACKAGE_URL],
13                        [Define to the home page for this package.])
14         AC_SUBST([PACKAGE_URL],[AC_PACKAGE_URL])])
16 AC_CONFIG_SRCDIR([Src/main.cc])
17 AC_CONFIG_HEADERS(config.h)
18 AC_CONFIG_AUX_DIR([build-aux])
19 AC_CONFIG_MACRO_DIR([m4])
20 AC_CONFIG_LIBOBJ_DIR([Src/Common])
22 AM_INIT_AUTOMAKE([1.8 gnu check-news dist-bzip2 subdir-objects])
23 AM_MAINTAINER_MODE
25 LT_INIT([disable-static])
27 AM_GNU_GETTEXT_VERSION([0.19])
28 AM_GNU_GETTEXT([external])
30 CXXFLAGS="$CXXFLAGS -std=c++0x"
31 AC_PROG_CXX
33 AC_PROG_LD_GNU
35 WITHGTK=true;
37 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
39 AC_LANG_PUSH(C++)
40 AC_CHECK_FUNCS(lldiv)
41 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
42 AC_REPLACE_FUNCS([round])
43 AC_LANG_POP(C++)
45 AC_ARG_ENABLE(debug,
46         AS_HELP_STRING([--enable-debug],
47                 [build with additional debugging checks (default is NO)]),
48         if test "x$enable_debug" = "xno"; then
49           DEBUG=false
50         else
51           DEBUG=true
52         fi,
53         DEBUG=false)
55 AC_ARG_WITH([gnome],
56         AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
57         if test "x$with_gnome" = "xno"; then
58           WITHGNOME=false 
59         else
60           WITHGNOME=true
61           # Need to work out how to translate replaced variables before uncommenting
62           # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
63         fi, 
64         WITHGNOME=true)
66 AC_ARG_ENABLE([speech],
67         [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher@:>@],
68                 [build with speech support (default is YES)])])
70 AC_ARG_WITH([qte],
71          AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]), 
72          if test "x$withval" = "xno"; then
73            WITHQTE=false; 
74          else
75            WITHQTE=true;
76          fi, 
77          WITHQTE=false)
79 AC_ARG_WITH([gpe],
80          AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]), 
81          if test "x$withval" = "xno"; then
82            WITHGPE=false; 
83          else
84            WITHGPE=true;
85          fi, 
86          WITHGPE=false)
88 AC_ARG_ENABLE([a11y],
89         [AS_HELP_STRING([--enable-a11y],
90                 [with Gtk2 use cspi rather than Xtst for direct entry mode if found (default is YES)])])
91 AC_ARG_ENABLE([atspi],
92         [AS_HELP_STRING([--enable-atspi],
93                 [with Gtk3 use atspi rather than Xtst for direct entry mode if found (default is YES)])])
95 AC_ARG_ENABLE([japanese],
96          AS_HELP_STRING([--enable-japanese],[build with support for Japanese Kanji entry (experimental -- default is NO)]),
97          if test "x$enableval" = "xno"; then
98            WITHJAPANESE=false; 
99          else
100            AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
101            WITHJAPANESE=true;
102          fi, 
103          WITHJAPANESE=false)
105 AC_ARG_ENABLE([joystick],
106          AS_HELP_STRING([--enable-joystick],[Build with Linux joystick support (note that other UNIX based operating systems aren't supported here)]),
107          if test "x$enableval" = "xno"; then
108            WITHJOYSTICK=false; 
109          else
110            WITHJOYSTICK=true;
111          fi, 
112          WITHJOYSTICK=false)
115 AC_ARG_ENABLE([tilt],
116          AS_HELP_STRING([--enable-tilt],[Build with experimental support for tilt sensor input (experimental -- default is NO)]),
117          if test "x$enableval" = "xno"; then
118            WITHTILT=false; 
119          else
120            WITHTILT=true;
121          fi, 
122          WITHTILT=false)
125 AC_ARG_WITH([maemo],
126         AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
127         if test "x$withval" = "xyes"; then
128            WITHMAEMO=true;
129            WITHGNOME=false;
130            enable_a11y=no;
131         else
132            WITHMAEMO=false;
133         fi,
134         WITHMAEMO=false)
136 AC_ARG_WITH([maemo-fullscreen],
137         AS_HELP_STRING([--with-maemo-fullscreen],[build as standalone Maemo fullscreen app (default is NO)]),
138         if test "x$withval" = "xyes"; then
139            WITHMAEMOFULLSCREEN=true;
140            WITHMAEMO=true;
141            WITHGNOME=false;
142            enable_a11y=no;
143         else
144            WITHMAEMOFULLSCREEN=false;
145         fi,
146         WITHMAEMOFULLSCREEN=false)
149 dnl AC_ARG_WITH([darwin],
150 dnl     AS_HELP_STRING([--with-darwin],[build with Darwin (Mac OS X) support (default is NO)]),
151 dnl     if test "x$withval" = "xyes"; then
152 dnl        WITHDARWIN=true;
153 dnl     else
154 dnl        WITHDARWIN=false;
155 dnl     fi,
156 dnl     WITHDARWIN=false)
158 AC_ARG_WITH([cairo],
159          AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
160          if test "x$withval" = "xno"; then
161            WITHCAIRO=false; 
162          else
163            WITHCAIRO=true;
164          fi, 
165          WITHCAIRO=true)
167 AC_ARG_WITH([gsettings],
168         [AS_HELP_STRING([--with-gsettings],
169                 [store user preferences using GSettings (default is YES)])])
170 AC_ARG_VAR([GLIB_COMPILE_SCHEMAS],
171         [Path to glib-compile-schemas, used for compiling GSettings schema])
173 if test x"$WITHGTK" = xtrue
174 then 
175         PKG_CHECK_MODULES(GTK, gtk+-3.0,
176                 [GTKHERE=true],
177                 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14.0,
178                         [GTKHERE=true],
179                         [GTKHERE=false])]) 
182 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
183 then
184         BUILDGTK=true
185 else 
186         BUILDGTK=false
189 DAM_GCONF_SOURCE_2
190 if test x$BUILDGTK = xtrue
191 then
192         PKG_CHECK_MODULES(GIO, gio-2.0,
193                 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
195         save_CFLAGS="$CFLAGS"
196         save_LIBS="$LIBS"
197         CFLAGS="$CFLAGS $GTK_CFLAGS"
198         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
199         LIBS="$LIBS $GTK_LIBS"
200         AC_CHECK_HEADERS([gdk/gdkkeysyms-compat.h])
201         AC_CHECK_FUNCS([gtk_builder_new gtk_show_uri gdk_window_get_width gtk_cairo_should_draw_window g_settings_new], [],
202                 [if test "x$ac_cv_func_gtk_builder_new" = "xno"; then
203                         AC_MSG_ERROR([A version of GTK+ providing GtkBuilder is necessary.])
204                 fi
205                 if test "x$ac_cv_func_gtk_show_uri" = "xno"; then
206                         AC_MSG_WARN([This version of GTK+ doesn't provide gtk_show_uri - help will not be displayed from within dasher.])
207                 fi]
208         )
209         CFLAGS="$save_CFLAGS"
210         LIBS="$save_LIBS"
212         AS_IF([test "x$with_gsettings" != "xno" -a "x$ac_cv_func_g_settings_new" = "xyes"],
213                 [AC_CHECK_TOOLS([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])
214          have_gsettings=true
215                  have_gconf=false
216                  AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
217                 [have_gsettings=false
218                  PKG_CHECK_MODULES(GCONF, gconf-2.0,
219                         [have_gconf=true
220                          AC_DEFINE([WITH_GCONF], 1, [Use GConf])
221                          SETTINGS_CFLAGS=$GCONF_CFLAGS
222                          SETTINGS_LIBS=$GCONF_LIBS],
223                         [have_gconf=false
224                          AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
225                 ])
226         AS_IF([test "x$with_gsettings" = "xyes" -a $have_gsettings = false],
227                 [AC_MSG_ERROR([GSettings requested but not found])])
228         AC_MSG_CHECKING([which settings store to use])
229         AS_IF(
230                 [test $have_gsettings = true  -a $have_gconf = false],
231                         [AC_MSG_RESULT([GSettings])],
232                 [test $have_gsettings = false -a $have_gconf = true],
233                         [AC_MSG_RESULT([GConf])],
234                 [test $have_gsettings = false -a $have_gconf = false],
235                         [AC_MSG_RESULT([none])],
236                 [AC_MSG_ERROR([Logic error in configure.ac - please send bug report!])])
238         # GtkBuilder's autoconnect feature requires dasher to be
239         # linked with the --export-dynamic flag. pkg-config does not
240         # provide it, and libtool knows what to do with -export-dynamic.
241         # (We need this e.g., for <object class="DasherEditor">)
242         GTK_LIBS="$GTK_LIBS -export-dynamic"
243 else
244         AC_MSG_ERROR("Unable to find GTK or another necessary library.")
247 if test x"$DEBUG" = xtrue; then
248         AC_DEFINE([DEBUG], 1, [Additional debug checks enabled])
251 dnl default: enable speech
252 dnl if speechdispatcher or default
253 dnl   check for speechdispatcher
254 dnl if nothing found
255 dnl   OK if wanted no speech
256 dnl   warn if default
257 dnl   error if yes
258 dnl   error if selected particular
259 dnl BTW test: The -a operator has higher precedence than the -o operator.
260 speech_module=none
261 AS_IF(
262         [test "x$enable_speech" = x],
263         [enable_speech=yes; only_warn_if_speech_not_found=yes])
264 AS_IF(
265         [test "x$enable_speech" = xspeechdispatcher -o "x$enable_speech" = xyes],
266         [AC_CHECK_HEADER([speech-dispatcher/libspeechd.h],
267                 [AC_CHECK_LIB([speechd], [spd_open],
268                         [AC_DEFINE([HAVE_SPEECHD], 1,
269                                 [speechdispatcher libraries are present])
270                          speech_module="speechdispatcher"
271                          SPEECH_CPPFLAGS=
272                          SPEECH_LDFLAGS=
273                          SPEECH_LIBS=-lspeechd])])])
274 AS_IF(
275         [test $speech_module = none],
276         [AS_CASE(["x$enable_speech"],
277                 [xno],
278                         [:],
279                 [xyes],
280                         [AS_IF([test x$only_warn_if_speech_not_found = xyes],
281                                 [AC_MSG_WARN([no speech module found])],
282                                 [AC_MSG_ERROR([speech requested but no speech module found])])],
283                 [AC_MSG_ERROR([speech module "$enable_speech" requested but not found])])])
284 AC_MSG_CHECKING([which speech module to use])
285 AC_MSG_RESULT([$speech_module])
286 AS_IF([test $speech_module != none],
287         [AC_DEFINE([WITH_SPEECH], 1, [text-to-speech is present])])
289 AC_SUBST(SPEECH_CPPFLAGS)
290 AC_SUBST(SPEECH_LDFLAGS)
291 AC_SUBST(SPEECH_LIBS)
293 AC_PATH_XTRA
294 AC_CHECK_LIB(expat, XML_Parse,,[
295         if test x$no_x = xyes ; then
296                 AC_MSG_ERROR([Expat library not found.])
297         else
298                 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
299                 LDFLAGS="$LDFLAGS $X_LIBS"
300                 dnl Check for different function to avoid cached "no" result.
301                 AC_CHECK_LIB(expat, XML_SetElementHandler,,
302                              [AC_MSG_ERROR([Expat library not found.])])
303         fi
306 PKG_CHECK_MODULES([ATSPI],
307         [atspi-2 >= 2.11],
308         [have_libatspi=yes],
309         [have_libatspi=no])
311 PKG_CHECK_MODULES([CSPI],
312         [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
313         [have_libcspi=yes],
314         [have_libcspi=no])
316 AS_IF(  [test x$no_x = xyes],
317         [AC_MSG_WARN([X development libraries not found])],
318         [X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"])
320 AC_CHECK_LIB([Xtst], [XTestFakeKeyEvent],
321         [have_libxtst=yes],
322         [have_libxtst=no],
323         [$X_LIBS])
325 AS_IF(  [test $have_libatspi = yes -a x$enable_atspi != xno],
326                 [connect_using=libatspi],
327         [test $have_libatspi = no -a x$enable_atspi = xyes],
328                 [AC_MSG_ERROR([atspi 2 requested but not found])],
329         [test $have_libcspi = yes -a x$enable_a11y != xno],
330                 [connect_using=libcspi
331                  AC_DEFINE([USE_CSPI], 1, [Use the libcspi for direct mode])],
332         [test $have_libcspi = no -a x$enable_a11y = xyes],
333                 [AC_MSG_ERROR([cspi requested but not found])],
334         [test $have_libxtst = yes],
335                 [connect_using=libxtst
336                  X_LIBS="$X_LIBS -lXtst"],
337         [AC_MSG_ERROR([No method to send characters into another application found])])
339 AM_CONDITIONAL(USE_CSPI,  test $connect_using = libcspi)
340 AM_CONDITIONAL(USE_ATSPI, test $connect_using = libatspi)
342 if test x"$WITHJAPANESE" = xtrue; then
343         AC_DEFINE([JAPANESE], 1, [Japanese support enabled])
344         JAPANESE_SOURCES='CannaConversionHelper.$(OBJEXT)'
345 else
346         JAPANESE_SOURCES=
349 AC_SUBST(JAPANESE_SOURCES)
351 if test x"$WITHJOYSTICK" = xtrue; then
352         AC_DEFINE([JOYSTICK], 1, [Linux joystick support enabled])
355 if test x"$WITHTILT" = xtrue; then
356         AC_DEFINE([TILT], 1, [Tilt input support enabled])
359 if test x"$WITHGPE" = xtrue; then
360         AC_DEFINE([WITH_GPE], 1, [gpe is present])
363 dnl if test x"$WITHDARWIN" = xtrue ; then
364 dnl         AC_DEFINE([WITH_DARWIN], 1, [Targeting Darwin/X11])
365 dnl fi
367 if test x"$WITHMAEMO" = xtrue; then
368       AC_DEFINE([WITH_MAEMO], 1, [Maemo is present])
369       PKG_CHECK_MODULES(hildon, hildon-libs)
370       AC_CHECK_LIB(osso, osso_initialize,, AC_MSG_ERROR([Osso library not found.]))
371 fi                      
373 if test x"$WITHMAEMOFULLSCREEN" = xtrue; then
374       AC_DEFINE([WITH_MAEMOFULLSCREEN], 1, [Building as fullscreen Maemo app])
377 if test x"$WITHCAIRO" = xtrue; then
378         PKG_CHECK_MODULES(cairo, cairo)
379         AC_DEFINE([WITH_CAIRO], 1, [use cairo])
382 if test x"$BUILDGTK" = xtrue; then 
383         PKG_CHECK_MODULES(gthread, gthread-2.0)
386 AC_SUBST(gthread_LIBS)
387 AC_SUBST(gthread_CFLAGS)
389 AC_SUBST(hildon_LIBS)
390 AC_SUBST(hildon_CFLAGS)
392 AM_CONDITIONAL(DOGTK, test x$BUILDGTK = xtrue)
393 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
394 AM_CONDITIONAL(USE_SPEECHDISPATCHER, test $speech_module = speechdispatcher)
395 AM_CONDITIONAL(GNOME_HELP, test x$WITHGNOME = xtrue)
396 AM_CONDITIONAL(WITH_GPE, test x$WITHGPE = xtrue)
397 AM_CONDITIONAL(WITH_MAEMO, test x$WITHMAEMO = xtrue)
398 AM_CONDITIONAL(WITH_MAEMOFULLSCREEN, test x$WITHMAEMOFULLSCREEN = xtrue)
399 AM_CONDITIONAL(JAPANESE, test x$WITHJAPANESE = xtrue)
400 AM_CONDITIONAL(JOYSTICK, test x$WITHJOYSTICK = xtrue)
402 AC_SUBST(GTK_CFLAGS)
403 AC_SUBST(GTK_LIBS)
405 if test x"$WITHGPE" = xtrue ; then
406         SETTINGS_CFLAGS=" "
407         SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
410 GTKBUILD_CFLAGS="$GTK_CFLAGS $GIO_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $hildon_CFLAGS"
412 GTKBUILD_LIBS="$X_LIBS $GTK_LIBS $GIO_LIBS $SETTINGS_LIBS $gthread_LIBS $hildon_LIBS"
414 AC_SUBST(GTKBUILD_CFLAGS)
415 AC_SUBST(GTKBUILD_LIBS)
417 AC_MSG_CHECKING([for gnome-doc-utils])
418 dnl Avoid default action which is to complain if not found
419 GNOME_DOC_INIT([0.9.0],[gdu_cv_have_gdu=yes],[gdu_cv_have_gdu=no])
420 AC_MSG_RESULT($gdu_cv_have_gdu)
422 if test x"$WITHGNOME" = xtrue -a x"$gdu_cv_have_gdu" = xno ; then
423     AC_MSG_ERROR([gnome-doc-utils not found!])
426 dnl XXX PRLW How is this better than the standard
427 dnl gdu_cv_have_gdu && enable_scrollkeeper ?
428 AM_CONDITIONAL(ENABLE_SK, test x"$WITHGNOME" = xfalse -a x"$enable_scrollkeeper" = "xyes")
430 AC_CONFIG_FILES([Data/dasher.desktop.in
431                  Data/Makefile
432                  Data/training/Makefile
433                  Data/alphabets/Makefile
434                  Data/colours/Makefile
435                  Data/control/Makefile
436                  Data/GUI/Makefile
437                  Data/Help/Makefile
438                  Data/Help/Gnome/Makefile
439                  Data/settings/Makefile
440                  Doc/Makefile
441                  Doc/user/Makefile
442                  Makefile
443                  Src/Makefile
444                  Src/Common/Makefile
445                  Src/DasherCore/Makefile
446                  Src/DasherCore/LanguageModelling/Makefile
447                  Src/Gtk2/Makefile
448                  po/Makefile.in
451 AC_OUTPUT