Updated Brazilian Portuguese translation
[dasher.git] / configure.ac
blob1521b3292757664915cf88c1a9a26b112d5a986b
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 AC_PROG_MAKE_SET
27 # IT_PROG_INTLTOOL requires AM_NLS but ignores --enable-nls
28 AM_NLS
29 AM_CONDITIONAL(USE_INTLTOOL, test "x$USE_NLS" = "xyes")
30 AS_IF([test "x$USE_NLS" = "xyes"],[
31 IT_PROG_INTLTOOL([0.40.1])
33 [touch po/Makefile.in.in]) dnl as intltoolize insists
35 LT_INIT([disable-static])
37 dnl AM_ICONV
39 GETTEXT_PACKAGE=dasher
40 AC_SUBST(GETTEXT_PACKAGE)
41 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
42 AM_GLIB_GNU_GETTEXT
44 CXXFLAGS="$CXXFLAGS -std=c++0x"
45 AC_PROG_CXX
47 AC_PROG_LD_GNU
49 WITHGTK=true;
51 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
53 AC_LANG_PUSH(C++)
54 AC_CHECK_FUNCS(lldiv)
55 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
56 AC_REPLACE_FUNCS([round])
57 AC_LANG_POP(C++)
59 AC_ARG_ENABLE(debug,
60         AS_HELP_STRING([--enable-debug],
61                 [build with additional debugging checks (default is NO)]),
62         if test "x$enable_debug" = "xno"; then
63           DEBUG=false
64         else
65           DEBUG=true
66         fi,
67         DEBUG=false)
69 AC_ARG_WITH([gnome],
70         AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
71         if test "x$with_gnome" = "xno"; then
72           WITHGNOME=false 
73         else
74           WITHGNOME=true
75           # Need to work out how to translate replaced variables before uncommenting
76           # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
77         fi, 
78         WITHGNOME=true)
80 AC_ARG_ENABLE([speech],
81         [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher@:>@],
82                 [build with speech support (default is YES)])])
84 AC_ARG_WITH([qte],
85          AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]), 
86          if test "x$withval" = "xno"; then
87            WITHQTE=false; 
88          else
89            WITHQTE=true;
90          fi, 
91          WITHQTE=false)
93 AC_ARG_WITH([gpe],
94          AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]), 
95          if test "x$withval" = "xno"; then
96            WITHGPE=false; 
97          else
98            WITHGPE=true;
99          fi, 
100          WITHGPE=false)
102 AC_ARG_ENABLE([a11y],
103         [AS_HELP_STRING([--enable-a11y],
104                 [with Gtk2 use cspi rather than Xtst for direct entry mode if found (default is YES)])])
105 AC_ARG_ENABLE([atspi],
106         [AS_HELP_STRING([--enable-atspi],
107                 [with Gtk3 use atspi rather than Xtst for direct entry mode if found (default is YES)])])
109 AC_ARG_ENABLE([japanese],
110          AS_HELP_STRING([--enable-japanese],[build with support for Japanese Kanji entry (experimental -- default is NO)]),
111          if test "x$enableval" = "xno"; then
112            WITHJAPANESE=false; 
113          else
114            AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
115            WITHJAPANESE=true;
116          fi, 
117          WITHJAPANESE=false)
119 AC_ARG_ENABLE([joystick],
120          AS_HELP_STRING([--enable-joystick],[Build with Linux joystick support (note that other UNIX based operating systems aren't supported here)]),
121          if test "x$enableval" = "xno"; then
122            WITHJOYSTICK=false; 
123          else
124            WITHJOYSTICK=true;
125          fi, 
126          WITHJOYSTICK=false)
129 AC_ARG_ENABLE([tilt],
130          AS_HELP_STRING([--enable-tilt],[Build with experimental support for tilt sensor input (experimental -- default is NO)]),
131          if test "x$enableval" = "xno"; then
132            WITHTILT=false; 
133          else
134            WITHTILT=true;
135          fi, 
136          WITHTILT=false)
139 AC_ARG_WITH([maemo],
140         AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
141         if test "x$withval" = "xyes"; then
142            WITHMAEMO=true;
143            WITHGNOME=false;
144            enable_a11y=no;
145         else
146            WITHMAEMO=false;
147         fi,
148         WITHMAEMO=false)
150 AC_ARG_WITH([maemo-fullscreen],
151         AS_HELP_STRING([--with-maemo-fullscreen],[build as standalone Maemo fullscreen app (default is NO)]),
152         if test "x$withval" = "xyes"; then
153            WITHMAEMOFULLSCREEN=true;
154            WITHMAEMO=true;
155            WITHGNOME=false;
156            enable_a11y=no;
157         else
158            WITHMAEMOFULLSCREEN=false;
159         fi,
160         WITHMAEMOFULLSCREEN=false)
163 dnl AC_ARG_WITH([darwin],
164 dnl     AS_HELP_STRING([--with-darwin],[build with Darwin (Mac OS X) support (default is NO)]),
165 dnl     if test "x$withval" = "xyes"; then
166 dnl        WITHDARWIN=true;
167 dnl     else
168 dnl        WITHDARWIN=false;
169 dnl     fi,
170 dnl     WITHDARWIN=false)
172 AC_ARG_WITH([cairo],
173          AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
174          if test "x$withval" = "xno"; then
175            WITHCAIRO=false; 
176          else
177            WITHCAIRO=true;
178          fi, 
179          WITHCAIRO=true)
181 AC_ARG_WITH([gsettings],
182         [AS_HELP_STRING([--with-gsettings],
183                 [store user preferences using GSettings (default is YES)])])
184 AC_ARG_VAR([GLIB_COMPILE_SCHEMAS],
185         [Path to glib-compile-schemas, used for compiling GSettings schema])
187 if test x"$WITHGTK" = xtrue
188 then 
189         PKG_CHECK_MODULES(GTK, gtk+-3.0,
190                 [GTKHERE=true],
191                 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14.0,
192                         [GTKHERE=true],
193                         [GTKHERE=false])]) 
196 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
197 then
198         BUILDGTK=true
199 else 
200         BUILDGTK=false
203 DAM_GCONF_SOURCE_2
204 if test x$BUILDGTK = xtrue
205 then
206         PKG_CHECK_MODULES(GIO, gio-2.0,
207                 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
209         save_CFLAGS="$CFLAGS"
210         save_LIBS="$LIBS"
211         CFLAGS="$CFLAGS $GTK_CFLAGS"
212         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
213         LIBS="$LIBS $GTK_LIBS"
214         AC_CHECK_HEADERS([gdk/gdkkeysyms-compat.h])
215         AC_CHECK_FUNCS([gtk_builder_new gtk_show_uri gdk_window_get_width gtk_cairo_should_draw_window g_settings_new], [],
216                 [if test "x$ac_cv_func_gtk_builder_new" = "xno"; then
217                         AC_MSG_ERROR([A version of GTK+ providing GtkBuilder is necessary.])
218                 fi
219                 if test "x$ac_cv_func_gtk_show_uri" = "xno"; then
220                         AC_MSG_WARN([This version of GTK+ doesn't provide gtk_show_uri - help will not be displayed from within dasher.])
221                 fi]
222         )
223         CFLAGS="$save_CFLAGS"
224         LIBS="$save_LIBS"
226         AS_IF([test "x$with_gsettings" != "xno" -a "x$ac_cv_func_g_settings_new" = "xyes"],
227                 [AC_CHECK_TOOLS([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])
228          have_gsettings=true
229                  have_gconf=false
230                  AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
231                 [have_gsettings=false
232                  PKG_CHECK_MODULES(GCONF, gconf-2.0,
233                         [have_gconf=true
234                          AC_DEFINE([WITH_GCONF], 1, [Use GConf])
235                          SETTINGS_CFLAGS=$GCONF_CFLAGS
236                          SETTINGS_LIBS=$GCONF_LIBS],
237                         [have_gconf=false
238                          AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
239                 ])
240         AS_IF([test "x$with_gsettings" = "xyes" -a $have_gsettings = false],
241                 [AC_MSG_ERROR([GSettings requested but not found])])
242         AC_MSG_CHECKING([which settings store to use])
243         AS_IF(
244                 [test $have_gsettings = true  -a $have_gconf = false],
245                         [AC_MSG_RESULT([GSettings])],
246                 [test $have_gsettings = false -a $have_gconf = true],
247                         [AC_MSG_RESULT([GConf])],
248                 [test $have_gsettings = false -a $have_gconf = false],
249                         [AC_MSG_RESULT([none])],
250                 [AC_MSG_ERROR([Logic error in configure.ac - please send bug report!])])
252         # GtkBuilder's autoconnect feature requires dasher to be
253         # linked with the --export-dynamic flag. pkg-config does not
254         # provide it, and libtool knows what to do with -export-dynamic.
255         # (We need this e.g., for <object class="DasherEditor">)
256         GTK_LIBS="$GTK_LIBS -export-dynamic"
257 else
258         AC_MSG_ERROR("Unable to find GTK or another necessary library.")
261 if test x"$DEBUG" = xtrue; then
262         AC_DEFINE([DEBUG], 1, [Additional debug checks enabled])
265 dnl default: enable speech
266 dnl if speechdispatcher or default
267 dnl   check for speechdispatcher
268 dnl if nothing found
269 dnl   OK if wanted no speech
270 dnl   warn if default
271 dnl   error if yes
272 dnl   error if selected particular
273 dnl BTW test: The -a operator has higher precedence than the -o operator.
274 speech_module=none
275 AS_IF(
276         [test "x$enable_speech" = x],
277         [enable_speech=yes; only_warn_if_speech_not_found=yes])
278 AS_IF(
279         [test "x$enable_speech" = xspeechdispatcher -o "x$enable_speech" = xyes],
280         [AC_CHECK_HEADER([speech-dispatcher/libspeechd.h],
281                 [AC_CHECK_LIB([speechd], [spd_open],
282                         [AC_DEFINE([HAVE_SPEECHD], 1,
283                                 [speechdispatcher libraries are present])
284                          speech_module="speechdispatcher"
285                          SPEECH_CPPFLAGS=
286                          SPEECH_LDFLAGS=
287                          SPEECH_LIBS=-lspeechd])])])
288 AS_IF(
289         [test $speech_module = none],
290         [AS_CASE(["x$enable_speech"],
291                 [xno],
292                         [:],
293                 [xyes],
294                         [AS_IF([test x$only_warn_if_speech_not_found = xyes],
295                                 [AC_MSG_WARN([no speech module found])],
296                                 [AC_MSG_ERROR([speech requested but no speech module found])])],
297                 [AC_MSG_ERROR([speech module "$enable_speech" requested but not found])])])
298 AC_MSG_CHECKING([which speech module to use])
299 AC_MSG_RESULT([$speech_module])
300 AS_IF([test $speech_module != none],
301         [AC_DEFINE([WITH_SPEECH], 1, [text-to-speech is present])])
303 AC_SUBST(SPEECH_CPPFLAGS)
304 AC_SUBST(SPEECH_LDFLAGS)
305 AC_SUBST(SPEECH_LIBS)
307 AC_PATH_XTRA
308 AC_CHECK_LIB(expat, XML_Parse,,[
309         if test x$no_x = xyes ; then
310                 AC_MSG_ERROR([Expat library not found.])
311         else
312                 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
313                 LDFLAGS="$LDFLAGS $X_LIBS"
314                 dnl Check for different function to avoid cached "no" result.
315                 AC_CHECK_LIB(expat, XML_SetElementHandler,,
316                              [AC_MSG_ERROR([Expat library not found.])])
317         fi
320 PKG_CHECK_MODULES([ATSPI],
321         [atspi-2 >= 2.11],
322         [have_libatspi=yes],
323         [have_libatspi=no])
325 PKG_CHECK_MODULES([CSPI],
326         [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
327         [have_libcspi=yes],
328         [have_libcspi=no])
330 AS_IF(  [test x$no_x = xyes],
331         [AC_MSG_WARN([X development libraries not found])],
332         [X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"])
334 AC_CHECK_LIB([Xtst], [XTestFakeKeyEvent],
335         [have_libxtst=yes],
336         [have_libxtst=no],
337         [$X_LIBS])
339 AS_IF(  [test $have_libatspi = yes -a x$enable_atspi != xno],
340                 [connect_using=libatspi],
341         [test $have_libatspi = no -a x$enable_atspi = xyes],
342                 [AC_MSG_ERROR([atspi 2 requested but not found])],
343         [test $have_libcspi = yes -a x$enable_a11y != xno],
344                 [connect_using=libcspi
345                  AC_DEFINE([USE_CSPI], 1, [Use the libcspi for direct mode])],
346         [test $have_libcspi = no -a x$enable_a11y = xyes],
347                 [AC_MSG_ERROR([cspi requested but not found])],
348         [test $have_libxtst = yes],
349                 [connect_using=libxtst
350                  X_LIBS="$X_LIBS -lXtst"],
351         [AC_MSG_ERROR([No method to send characters into another application found])])
353 AM_CONDITIONAL(USE_CSPI,  test $connect_using = libcspi)
354 AM_CONDITIONAL(USE_ATSPI, test $connect_using = libatspi)
356 if test x"$WITHJAPANESE" = xtrue; then
357         AC_DEFINE([JAPANESE], 1, [Japanese support enabled])
358         JAPANESE_SOURCES='CannaConversionHelper.$(OBJEXT)'
359 else
360         JAPANESE_SOURCES=
363 AC_SUBST(JAPANESE_SOURCES)
365 if test x"$WITHJOYSTICK" = xtrue; then
366         AC_DEFINE([JOYSTICK], 1, [Linux joystick support enabled])
369 if test x"$WITHTILT" = xtrue; then
370         AC_DEFINE([TILT], 1, [Tilt input support enabled])
373 if test x"$WITHGPE" = xtrue; then
374         AC_DEFINE([WITH_GPE], 1, [gpe is present])
377 dnl if test x"$WITHDARWIN" = xtrue ; then
378 dnl         AC_DEFINE([WITH_DARWIN], 1, [Targeting Darwin/X11])
379 dnl fi
381 if test x"$WITHMAEMO" = xtrue; then
382       AC_DEFINE([WITH_MAEMO], 1, [Maemo is present])
383       PKG_CHECK_MODULES(hildon, hildon-libs)
384       AC_CHECK_LIB(osso, osso_initialize,, AC_MSG_ERROR([Osso library not found.]))
385 fi                      
387 if test x"$WITHMAEMOFULLSCREEN" = xtrue; then
388       AC_DEFINE([WITH_MAEMOFULLSCREEN], 1, [Building as fullscreen Maemo app])
391 if test x"$WITHCAIRO" = xtrue; then
392         PKG_CHECK_MODULES(cairo, cairo)
393         AC_DEFINE([WITH_CAIRO], 1, [use cairo])
396 if test x"$BUILDGTK" = xtrue; then 
397         PKG_CHECK_MODULES(gthread, gthread-2.0)
400 AC_SUBST(gthread_LIBS)
401 AC_SUBST(gthread_CFLAGS)
403 AC_SUBST(hildon_LIBS)
404 AC_SUBST(hildon_CFLAGS)
406 AC_SUBST(GETTEXT_PACKAGE)
408 AM_CONDITIONAL(DOGTK, test x$BUILDGTK = xtrue)
409 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
410 AM_CONDITIONAL(USE_SPEECHDISPATCHER, test $speech_module = speechdispatcher)
411 AM_CONDITIONAL(GNOME_HELP, test x$WITHGNOME = xtrue)
412 AM_CONDITIONAL(WITH_GPE, test x$WITHGPE = xtrue)
413 AM_CONDITIONAL(WITH_MAEMO, test x$WITHMAEMO = xtrue)
414 AM_CONDITIONAL(WITH_MAEMOFULLSCREEN, test x$WITHMAEMOFULLSCREEN = xtrue)
415 AM_CONDITIONAL(JAPANESE, test x$WITHJAPANESE = xtrue)
416 AM_CONDITIONAL(JOYSTICK, test x$WITHJOYSTICK = xtrue)
418 AC_SUBST(GTK_CFLAGS)
419 AC_SUBST(GTK_LIBS)
421 if test x"$WITHGPE" = xtrue ; then
422         SETTINGS_CFLAGS=" "
423         SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
426 GTKBUILD_CFLAGS="$GTK_CFLAGS $GIO_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $hildon_CFLAGS"
428 GTKBUILD_LIBS="$X_LIBS $GTK_LIBS $GIO_LIBS $SETTINGS_LIBS $gthread_LIBS $hildon_LIBS"
430 AC_SUBST(GTKBUILD_CFLAGS)
431 AC_SUBST(GTKBUILD_LIBS)
433 AC_MSG_CHECKING([for gnome-doc-utils])
434 dnl Avoid default action which is to complain if not found
435 GNOME_DOC_INIT([0.9.0],[gdu_cv_have_gdu=yes],[gdu_cv_have_gdu=no])
436 AC_MSG_RESULT($gdu_cv_have_gdu)
438 if test x"$WITHGNOME" = xtrue -a x"$gdu_cv_have_gdu" = xno ; then
439     AC_MSG_ERROR([gnome-doc-utils not found!])
442 dnl XXX PRLW How is this better than the standard
443 dnl gdu_cv_have_gdu && enable_scrollkeeper ?
444 AM_CONDITIONAL(ENABLE_SK, test x"$WITHGNOME" = xfalse -a x"$enable_scrollkeeper" = "xyes")
446 AC_CONFIG_FILES([Data/dasher.desktop.in
447                  Data/Makefile
448                  Data/training/Makefile
449                  Data/alphabets/Makefile
450                  Data/colours/Makefile
451                  Data/control/Makefile
452                  Data/GUI/Makefile
453                  Data/Help/Makefile
454                  Data/Help/Gnome/Makefile
455                  Data/settings/Makefile
456                  Doc/Makefile
457                  Doc/user/Makefile
458                  Makefile
459                  Src/Makefile
460                  Src/Common/Makefile
461                  Src/DasherCore/Makefile
462                  Src/DasherCore/LanguageModelling/Makefile
463                  Src/DasherIM/Makefile
464                  Src/Gtk2/Makefile
465                  po/Makefile.in
468 AC_OUTPUT