Updated Hungarian translation
[dasher.git] / configure.ac
blobd3c317ba56141f7f06ea99f0c5de0911c7c1c2d8
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])
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 AC_PROG_CXX
46 AC_PROG_LD_GNU
48 WITHGTK=true;
50 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
52 AC_LANG_PUSH(C++)
53 AC_CHECK_FUNCS(lldiv)
54 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
55 AC_REPLACE_FUNCS([round])
56 AC_LANG_POP(C++)
58 AC_ARG_ENABLE(debug,
59         AS_HELP_STRING([--enable-debug],
60                 [build with additional debugging checks (default is NO)]),
61         if test "x$enable_debug" = "xno"; then
62           DEBUG=false
63         else
64           DEBUG=true
65         fi,
66         DEBUG=false)
68 AC_ARG_WITH([gnome],
69         AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
70         if test "x$with_gnome" = "xno"; then
71           WITHGNOME=false 
72         else
73           WITHGNOME=true
74           # Need to work out how to translate replaced variables before uncommenting
75           # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
76         fi, 
77         WITHGNOME=true)
79 AC_ARG_ENABLE([speech],
80         [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher,gnomespeech@:>@],
81                 [build with speech support (default is YES)])])
83 AC_ARG_WITH([qte],
84          AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]), 
85          if test "x$withval" = "xno"; then
86            WITHQTE=false; 
87          else
88            WITHQTE=true;
89          fi, 
90          WITHQTE=false)
92 AC_ARG_WITH([gpe],
93          AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]), 
94          if test "x$withval" = "xno"; then
95            WITHGPE=false; 
96          else
97            WITHGPE=true;
98          fi, 
99          WITHGPE=false)
101 AC_ARG_ENABLE([a11y],
102         [AS_HELP_STRING([--enable-a11y],
103                 [with Gtk2 use cspi rather than Xtst for direct entry mode if found (default is YES)])])
104 AC_ARG_ENABLE([atspi],
105         [AS_HELP_STRING([--enable-atspi],
106                 [with Gtk3 use atspi rather than Xtst for direct entry mode if found (default is YES)])])
108 AC_ARG_ENABLE([japanese],
109          AS_HELP_STRING([--enable-japanese],[build with support for Japanese Kanji entry (experimental -- default is NO)]),
110          if test "x$enableval" = "xno"; then
111            WITHJAPANESE=false; 
112          else
113            AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
114            WITHJAPANESE=true;
115          fi, 
116          WITHJAPANESE=false)
118 AC_ARG_ENABLE([joystick],
119          AS_HELP_STRING([--enable-joystick],[Build with Linux joystick support (note that other UNIX based operating systems aren't supported here)]),
120          if test "x$enableval" = "xno"; then
121            WITHJOYSTICK=false; 
122          else
123            WITHJOYSTICK=true;
124          fi, 
125          WITHJOYSTICK=false)
128 AC_ARG_ENABLE([tilt],
129          AS_HELP_STRING([--enable-tilt],[Build with experimental support for tilt sensor input (experimental -- default is NO)]),
130          if test "x$enableval" = "xno"; then
131            WITHTILT=false; 
132          else
133            WITHTILT=true;
134          fi, 
135          WITHTILT=false)
138 AC_ARG_WITH([maemo],
139         AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
140         if test "x$withval" = "xyes"; then
141            WITHMAEMO=true;
142            WITHGNOME=false;
143            enable_a11y=no;
144         else
145            WITHMAEMO=false;
146         fi,
147         WITHMAEMO=false)
149 AC_ARG_WITH([maemo-fullscreen],
150         AS_HELP_STRING([--with-maemo-fullscreen],[build as standalone Maemo fullscreen app (default is NO)]),
151         if test "x$withval" = "xyes"; then
152            WITHMAEMOFULLSCREEN=true;
153            WITHMAEMO=true;
154            WITHGNOME=false;
155            enable_a11y=no;
156         else
157            WITHMAEMOFULLSCREEN=false;
158         fi,
159         WITHMAEMOFULLSCREEN=false)
162 dnl AC_ARG_WITH([darwin],
163 dnl     AS_HELP_STRING([--with-darwin],[build with Darwin (Mac OS X) support (default is NO)]),
164 dnl     if test "x$withval" = "xyes"; then
165 dnl        WITHDARWIN=true;
166 dnl     else
167 dnl        WITHDARWIN=false;
168 dnl     fi,
169 dnl     WITHDARWIN=false)
171 AC_ARG_WITH([cairo],
172          AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
173          if test "x$withval" = "xno"; then
174            WITHCAIRO=false; 
175          else
176            WITHCAIRO=true;
177          fi, 
178          WITHCAIRO=true)
180 AC_ARG_WITH([gsettings],
181         [AS_HELP_STRING([--with-gsettings],
182                 [store user preferences using GSettings (default is YES)])])
183 AC_ARG_VAR([GLIB_COMPILE_SCHEMAS],
184         [Path to glib-compile-schemas, used for compiling GSettings schema])
186 if test x"$WITHGTK" = xtrue
187 then 
188         PKG_CHECK_MODULES(GTK, gtk+-3.0,
189                 [GTKHERE=true],
190                 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0,
191                         [GTKHERE=true],
192                         [GTKHERE=false])]) 
195 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
196 then
197         BUILDGTK=true
198 else 
199         BUILDGTK=false
202 DAM_GCONF_SOURCE_2
203 if test x$BUILDGTK = xtrue
204 then
205         PKG_CHECK_MODULES(GIO, gio-2.0,
206                 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
208         save_CFLAGS="$CFLAGS"
209         save_LIBS="$LIBS"
210         CFLAGS="$CFLAGS $GTK_CFLAGS"
211         CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
212         LIBS="$LIBS $GTK_LIBS"
213         AC_CHECK_HEADERS([gdk/gdkkeysyms-compat.h])
214         AC_CHECK_FUNCS([gtk_builder_new gtk_show_uri gdk_window_get_width gtk_cairo_should_draw_window g_settings_new], [],
215                 [if test "x$ac_cv_func_gtk_builder_new" = "xno"; then
216                         AC_MSG_ERROR([A version of GTK+ providing GtkBuilder is necessary.])
217                 fi
218                 if test "x$ac_cv_func_gtk_show_uri" = "xno"; then
219                         AC_MSG_WARN([This version of GTK+ doesn't provide gtk_show_uri - help will not be displayed from within dasher.])
220                 fi]
221         )
222         CFLAGS="$save_CFLAGS"
223         LIBS="$save_LIBS"
225         AS_IF([test "x$with_gsettings" != "xno" -a "x$ac_cv_func_g_settings_new" = "xyes"],
226                 [AC_CHECK_TOOLS([GLIB_COMPILE_SCHEMAS], [glib-compile-schemas])
227          have_gsettings=true
228                  have_gconf=false
229                  AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
230                 [have_gsettings=false
231                  PKG_CHECK_MODULES(GCONF, gconf-2.0,
232                         [have_gconf=true
233                          AC_DEFINE([WITH_GCONF], 1, [Use GConf])
234                          SETTINGS_CFLAGS=$GCONF_CFLAGS
235                          SETTINGS_LIBS=$GCONF_LIBS],
236                         [have_gconf=false
237                          AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
238                 ])
239         AS_IF([test "x$with_gsettings" = "xyes" -a $have_gsettings = false],
240                 [AC_MSG_ERROR([GSettings requested but not found])])
241         AC_MSG_CHECKING([which settings store to use])
242         AS_IF(
243                 [test $have_gsettings = true  -a $have_gconf = false],
244                         [AC_MSG_RESULT([GSettings])],
245                 [test $have_gsettings = false -a $have_gconf = true],
246                         [AC_MSG_RESULT([GConf])],
247                 [test $have_gsettings = false -a $have_gconf = false],
248                         [AC_MSG_RESULT([none])],
249                 [AC_MSG_ERROR([Logic error in configure.ac - please send bug report!])])
251         # GtkBuilder's autoconnect feature requires dasher to be
252         # linked with the --export-dynamic flag. pkg-config does not
253         # provide it, and libtool knows what to do with -export-dynamic.
254         # (We need this e.g., for <object class="DasherEditor">)
255         GTK_LIBS="$GTK_LIBS -export-dynamic"
256 else
257         AC_MSG_ERROR("Unable to find GTK or another necessary library.")
260 if test x"$DEBUG" = xtrue; then
261         AC_DEFINE([DEBUG], 1, [Additional debug checks enabled])
264 dnl default: enable speech
265 dnl if speechdispatcher or default
266 dnl   check for speechdispatcher
267 dnl if gnomespeech or (default and nothing found)
268 dnl   check for gnomespeech
269 dnl if nothing found
270 dnl   OK if wanted no speech
271 dnl   warn if default
272 dnl   error if yes
273 dnl   error if selected particular
274 dnl BTW test: The -a operator has higher precedence than the -o operator.
275 speech_module=none
276 AS_IF(
277         [test "x$enable_speech" = x],
278         [enable_speech=yes; only_warn_if_speech_not_found=yes])
279 AS_IF(
280         [test "x$enable_speech" = xspeechdispatcher -o "x$enable_speech" = xyes],
281         [AC_CHECK_HEADER([speech-dispatcher/libspeechd.h],
282                 [AC_CHECK_LIB([speechd], [spd_open],
283                         [AC_DEFINE([HAVE_SPEECHD], 1,
284                                 [speechdispatcher libraries are present])
285                          speech_module="speechdispatcher"
286                          SPEECH_CPPFLAGS=
287                          SPEECH_LDFLAGS=
288                          SPEECH_LIBS=-lspeechd])])])
289 AS_IF(
290         [test "x$enable_speech" = xgnomespeech -o "x$enable_speech" = xyes -a $speech_module = none],
291         [PKG_CHECK_MODULES([gnome_speech],
292                 [gnome-speech-1.0 bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0],
293                 [AC_DEFINE([GNOME_SPEECH], 1, [gnome_speech-1 libraries are present])
294                  SPEECH_CPPFLAGS=$gnome_speech_CFLAGS
295                  SPEECH_LDFLAGS=$gnome_speech_LIBS
296                  SPEECH_LIBS=$gnome_speech_LIBS
297                  speech_module=gnomespeech],
298                 [:])])
299 AS_IF(
300         [test $speech_module = none],
301         [AS_CASE(["x$enable_speech"],
302                 [xno],
303                         [:],
304                 [xyes],
305                         [AS_IF([test x$only_warn_if_speech_not_found = xyes],
306                                 [AC_MSG_WARN([no speech module found])],
307                                 [AC_MSG_ERROR([speech requested but no speech module found])])],
308                 [AC_MSG_ERROR([speech module "$enable_speech" requested but not found])])])
309 AC_MSG_CHECKING([which speech module to use])
310 AC_MSG_RESULT([$speech_module])
311 AS_IF([test $speech_module != none],
312         [AC_DEFINE([WITH_SPEECH], 1, [text-to-speech is present])])
314 AC_SUBST(SPEECH_CPPFLAGS)
315 AC_SUBST(SPEECH_LDFLAGS)
316 AC_SUBST(SPEECH_LIBS)
318 AC_PATH_XTRA
319 AC_CHECK_LIB(expat, XML_Parse,,[
320         if test x$no_x = xyes ; then
321                 AC_MSG_ERROR([Expat library not found.])
322         else
323                 CPPFLAGS="$CPPFLAGS $X_CFLAGS"
324                 LDFLAGS="$LDFLAGS $X_LIBS"
325                 dnl Check for different function to avoid cached "no" result.
326                 AC_CHECK_LIB(expat, XML_SetElementHandler,,
327                              [AC_MSG_ERROR([Expat library not found.])])
328         fi
331 PKG_CHECK_MODULES([ATSPI],
332         [atspi-2],
333         [have_libatspi=yes],
334         [have_libatspi=no])
336 PKG_CHECK_MODULES([CSPI],
337         [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
338         [have_libcspi=yes],
339         [have_libcspi=no])
341 AS_IF(  [test x$no_x = xyes],
342         [AC_MSG_WARN([X development libraries not found])],
343         [X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"])
345 AC_CHECK_LIB([Xtst], [XTestFakeKeyEvent],
346         [have_libxtst=yes],
347         [have_libxtst=no],
348         [$X_LIBS])
350 AS_IF(  [test $have_libatspi = yes -a x$enable_atspi != xno],
351                 [connect_using=libatspi],
352         [test $have_libatspi = no -a x$enable_atspi = xyes],
353                 [AC_MSG_ERROR([atspi 2 requested but not found])],
354         [test $have_libcspi = yes -a x$enable_a11y != xno],
355                 [connect_using=libcspi
356                  AC_DEFINE([USE_CSPI], 1, [Use the libcspi for direct mode])],
357         [test $have_libcspi = no -a x$enable_a11y = xyes],
358                 [AC_MSG_ERROR([cspi requested but not found])],
359         [test $have_libxtst = yes],
360                 [connect_using=libxtst
361                  X_LIBS="$X_LIBS -lXtst"],
362         [AC_MSG_ERROR([No method to send characters into another application found])])
364 AM_CONDITIONAL(USE_CSPI,  test $connect_using = libcspi)
365 AM_CONDITIONAL(USE_ATSPI, test $connect_using = libatspi)
367 if test x"$WITHJAPANESE" = xtrue; then
368         AC_DEFINE([JAPANESE], 1, [Japanese support enabled])
369         JAPANESE_SOURCES='CannaConversionHelper.$(OBJEXT)'
370 else
371         JAPANESE_SOURCES=
374 AC_SUBST(JAPANESE_SOURCES)
376 if test x"$WITHJOYSTICK" = xtrue; then
377         AC_DEFINE([JOYSTICK], 1, [Linux joystick support enabled])
380 if test x"$WITHTILT" = xtrue; then
381         AC_DEFINE([TILT], 1, [Tilt input support enabled])
384 if test x"$WITHGPE" = xtrue; then
385         AC_DEFINE([WITH_GPE], 1, [gpe is present])
388 dnl if test x"$WITHDARWIN" = xtrue ; then
389 dnl         AC_DEFINE([WITH_DARWIN], 1, [Targeting Darwin/X11])
390 dnl fi
392 if test x"$WITHMAEMO" = xtrue; then
393       AC_DEFINE([WITH_MAEMO], 1, [Maemo is present])
394       PKG_CHECK_MODULES(hildon, hildon-libs)
395       AC_CHECK_LIB(osso, osso_initialize,, AC_MSG_ERROR([Osso library not found.]))
396 fi                      
398 if test x"$WITHMAEMOFULLSCREEN" = xtrue; then
399       AC_DEFINE([WITH_MAEMOFULLSCREEN], 1, [Building as fullscreen Maemo app])
402 if test x"$WITHCAIRO" = xtrue; then
403         PKG_CHECK_MODULES(cairo, cairo)
404         AC_DEFINE([WITH_CAIRO], 1, [use cairo])
407 if test x"$BUILDGTK" = xtrue; then 
408         PKG_CHECK_MODULES(gthread, gthread-2.0)
411 AC_SUBST(gthread_LIBS)
412 AC_SUBST(gthread_CFLAGS)
414 AC_SUBST(hildon_LIBS)
415 AC_SUBST(hildon_CFLAGS)
417 AC_SUBST(GETTEXT_PACKAGE)
419 AM_CONDITIONAL(USE_GCONF, test x$have_gconf = xtrue)
420 AM_CONDITIONAL(USE_GSETTINGS, test x$have_gsettings = xtrue)
421 AM_CONDITIONAL(DOGTK, test x$BUILDGTK = xtrue)
422 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
423 AM_CONDITIONAL(USE_GNOMESPEECH, test $speech_module = gnomespeech)
424 AM_CONDITIONAL(USE_SPEECHDISPATCHER, test $speech_module = speechdispatcher)
425 AM_CONDITIONAL(GNOME_HELP, test x$WITHGNOME = xtrue)
426 AM_CONDITIONAL(WITH_GPE, test x$WITHGPE = xtrue)
427 AM_CONDITIONAL(WITH_MAEMO, test x$WITHMAEMO = xtrue)
428 AM_CONDITIONAL(WITH_MAEMOFULLSCREEN, test x$WITHMAEMOFULLSCREEN = xtrue)
429 AM_CONDITIONAL(JAPANESE, test x$WITHJAPANESE = xtrue)
430 AM_CONDITIONAL(JOYSTICK, test x$WITHJOYSTICK = xtrue)
432 AC_SUBST(GTK_CFLAGS)
433 AC_SUBST(GTK_LIBS)
435 if test x"$WITHGPE" = xtrue ; then
436         SETTINGS_CFLAGS=" "
437         SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
440 GTKBUILD_CFLAGS="$GTK_CFLAGS $GIO_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $hildon_CFLAGS"
442 GTKBUILD_LIBS="$X_LIBS $GTK_LIBS $GIO_LIBS $SETTINGS_LIBS $gthread_LIBS $hildon_LIBS"
444 AC_SUBST(GTKBUILD_CFLAGS)
445 AC_SUBST(GTKBUILD_LIBS)
447 AC_MSG_CHECKING([for gnome-doc-utils])
448 dnl Avoid default action which is to complain if not found
449 GNOME_DOC_INIT([0.9.0],[gdu_cv_have_gdu=yes],[gdu_cv_have_gdu=no])
450 AC_MSG_RESULT($gdu_cv_have_gdu)
452 if test x"$WITHGNOME" = xtrue -a x"$gdu_cv_have_gdu" = xno ; then
453     AC_MSG_ERROR([gnome-doc-utils not found!])
456 dnl XXX PRLW How is this better than the standard
457 dnl gdu_cv_have_gdu && enable_scrollkeeper ?
458 AM_CONDITIONAL(ENABLE_SK, test x"$WITHGNOME" = xfalse -a x"$enable_scrollkeeper" = "xyes")
460 AC_CONFIG_FILES([Data/dasher.desktop.in
461                  Data/Makefile
462                  Data/training/Makefile
463                  Data/alphabets/Makefile
464                  Data/colours/Makefile
465                  Data/control/Makefile
466                  Data/GUI/Makefile
467                  Data/Help/Makefile
468                  Data/Help/Gnome/Makefile
469                  Doc/Makefile
470                  Doc/user/Makefile
471                  Makefile
472                  Src/Makefile
473                  Src/Common/Makefile
474                  Src/DasherCore/Makefile
475                  Src/DasherCore/LanguageModelling/Makefile
476                  Src/DasherIM/Makefile
477                  Src/Gtk2/Makefile
478                  Src/Installer/Makefile
479                  Src/InstallerTobii/Makefile
480                  Src/InstallerW2K/Makefile
481                  Src/Win32/Makefile
482                  po/Makefile.in
485 AC_OUTPUT