Fix loading of UTF-8 training text which for instance caused crashes when
[dasher.git] / configure.in
blob95c39ed095bd70d9a7b3990423f2f9ee3adfc57e
1 AC_PREREQ(2.56)
2 AC_INIT([dasher],[4.9.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=dasher])
3 AC_REVISION([$Id: configure.in,v])
4 AC_CONFIG_SRCDIR([Src/main.cc])
5 AC_CONFIG_HEADERS(config.h)
7 dnl The following two changes are required currently for the Maemo build (but will break the GNOME build)
9 dnl AM_INIT_AUTOMAKE([1.9 gnu check-news dist-bzip2 no-dist-gzip])
10 AM_INIT_AUTOMAKE([1.8 gnu check-news dist-bzip2 no-dist-gzip])
11 AM_MAINTAINER_MODE
13 AC_PROG_MAKE_SET
14 IT_PROG_INTLTOOL([0.34.90])
15 dnl AC_PROG_INTLTOOL(0.30)
17 AC_DISABLE_STATIC
18 AC_PROG_LIBTOOL
20 dnl AM_ICONV
22 GETTEXT_PACKAGE=dasher
23 AC_SUBST(GETTEXT_PACKAGE)
24 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
25 AM_GLIB_GNU_GETTEXT
27 AC_PROG_CXX
29 AC_PROG_LD_GNU
31 WITHGTK2=true;
33 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4)
35 AC_CHECK_LIB(expat, XML_Parse,, AC_MSG_ERROR([Expat library not found.]))
37 AC_ARG_ENABLE(debug,
38         AC_HELP_STRING([--enable-debug],[build with additional debugging checks (default is NO)]),
39          if test $withval = "no"; then
40            DEBUG=false;
41          else
42            DEBUG=true;
43          fi,
44          DEBUG=false)
46 AC_ARG_WITH([gnome],
47          AC_HELP_STRING([--with-gnome],[build with GNOME support (default is YES)]), 
48          if test $withval = "no"; then
49            WITHGNOME=false; 
50          else
51            WITHGNOME=true;
52          fi, 
53          WITHGNOME=true)
55 dnl Just useful for debugging
56 AC_ARG_WITH([gvfs],
57         AC_HELP_STRING([--with-gvfs],
58                 [build with gvfs from gio in glib (default is YES)]),
59         [],
60         with_gvfs="yes")
61 if test $with_gvfs != "no"; then
62         PKG_CHECK_MODULES(GIO, gio-2.0,
63                 [have_gio=true
64                 AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])],
65                 [have_gio=false])
68 AC_ARG_ENABLE([speech],
69          AC_HELP_STRING([--enable-speech],[build with speech support (default is NO)]),
70          if test $enableval = "no"; then
71            WITHSPEECH=false; 
72          else
73            WITHSPEECH=true;
74          fi, 
75          WITHSPEECH=false)
77 AC_ARG_WITH([qte],
78          AC_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]), 
79          if test $withval = "no"; then
80            WITHQTE=false; 
81          else
82            WITHQTE=true;
83          fi, 
84          WITHQTE=false)
86 AC_ARG_WITH([gpe],
87          AC_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]), 
88          if test $withval = "no"; then
89            WITHGPE=false; 
90          else
91            WITHGPE=true;
92          fi, 
93          WITHGPE=false)
95 AC_ARG_ENABLE([a11y],
96          AC_HELP_STRING([--enable-a11y],[build with support for the GNOME accessibility framework (default is YES)]),
97          if test $enableval = "no"; then
98            WITHA11Y=false; 
99          else
100            WITHA11Y=true;
101          fi, 
102          WITHA11Y=true)
104 AC_ARG_ENABLE([japanese],
105          AC_HELP_STRING([--enable-japanese],[build with support for Japanese Kanji entry (experimental -- default is NO)]),
106          if test $enableval = "no"; then
107            WITHJAPANESE=false; 
108          else
109            AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
110            WITHJAPANESE=true;
111          fi, 
112          WITHJAPANESE=false)
114 AC_ARG_ENABLE([chinese],
115          AC_HELP_STRING([--enable-chinese],[build with support for Chinese PinYin entry (experimental -- default is NO)]),
116          if test $enableval = "no"; then
117            WITHCHINESE=false; 
118          else
119            WITHCHINESE=true;
120          fi, 
121          WITHCHINESE=false)
123 AC_ARG_ENABLE([joystick],
124          AC_HELP_STRING([--enable-joystick],[Build with Linux joystick support (note that other UNIX based operating systems aren't supported here)]),
125          if test $enableval = "no"; then
126            WITHJOYSTICK=false; 
127          else
128            WITHJOYSTICK=true;
129          fi, 
130          WITHJOYSTICK=false)
133 AC_ARG_ENABLE([tilt],
134          AC_HELP_STRING([--enable-tilt],[Build with experimental support for tilt sensor input (experimental -- default is NO)]),
135          if test $enableval = "no"; then
136            WITHTILT=false; 
137          else
138            WITHTILT=true;
139          fi, 
140          WITHTILT=false)
143 AC_ARG_WITH([maemo],
144         AC_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
145         if test $withval = "yes"; then
146            WITHMAEMO=true;
147            WITHGNOME=false;
148            WITHA11Y=false;
149         else
150            WITHMAEMO=false;
151         fi,
152         WITHMAEMO=false)
154 AC_ARG_WITH([maemo-fullscreen],
155         AC_HELP_STRING([--with-maemo-fullscreen],[build as standalone Maemo fullscreen app (default is NO)]),
156         if test $withval = "yes"; then
157            WITHMAEMOFULLSCREEN=true;
158            WITHMAEMO=true;
159            WITHGNOME=false;
160            WITHA11Y=false;
161         else
162            WITHMAEMOFULLSCREEN=false;
163         fi,
164         WITHMAEMOFULLSCREEN=false)
167 dnl AC_ARG_WITH([darwin],
168 dnl     AC_HELP_STRING([--with-darwin],[build with Darwin (Mac OS X) support (default is NO)]),
169 dnl     if test $withval = "yes"; then
170 dnl        WITHDARWIN=true;
171 dnl     else
172 dnl        WITHDARWIN=false;
173 dnl     fi,
174 dnl     WITHDARWIN=false)
176 AC_ARG_WITH([cairo],
177          AC_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
178          if test $withval = "no"; then
179            WITHCAIRO=false; 
180          else
181            WITHCAIRO=true;
182          fi, 
183          WITHCAIRO=true)
185 if [[ x"$WITHGTK2" = xtrue ]]
186 then 
187         PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0,[GTK2HERE=true],[GTK2HERE=false]) 
188         PKG_CHECK_MODULES(GCONF, gconf-2.0,[GCONF2HERE=true],[GCONF2HERE=false])
189         if [[ x$GCONF2HERE = xfalse ]]; then
190            AC_MSG_WARN("GConf was not detected - user preferences will not be stored.")
191         fi
194 if [[ x"$GTK2HERE" = xtrue ]] && [[ x"$WITHGTK2" = xtrue ]] && [[ x"$WITHQTE" != xtrue ]]
195 then
196         BUILDGTK2=true
197 elif [[ x"$GTK2HERE" = xtrue ]] && [[ x"$WITHQTE" != xtrue ]]
198 then
199         BUILDGTK2=true
200 else 
201         BUILDGTK2=false
204 if [[ x$BUILDGTK2 = xfalse ]] && [[ x"$WITHQTE" != xtrue ]]
205 then
206         echo $WITHGTK2
207         AC_ERROR("Unable to find GTK2 or another necessary library. See the previous line for more useful data.")
210 if [[ x"$WITHQTE" != xtrue ]]
211 then
212 dnl test for X libraries
213         if test x$no_x = xyes ; then
214           AC_MSG_ERROR([X development libraries not found])
215         else
216           X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
217         fi
219 dnl path to Xtst
220         AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, XTST_LIBS=-lXtst)
221         if test "x$XTST_LIBS" = x; then
222           save_LIBS="$LIBS"
223           for xtstpath in /usr/X11R6/lib64 /usr/X11R6/lib /usr/openwin/lib $x_libraries; do
224             LIBS="-L$xtstpath -lXtst"
225             case "$host" in
226             *solaris*) XTST_RPATH_FLAGS="-R$xtstpath" ;;
227             esac
228             AC_MSG_CHECKING(for -lXtst in $xtstpath)
229             AC_TRY_LINK([], [XTestFakeKeyEvent()], [
230                 AC_MSG_RESULT(yes)
231                 XTST_LIBS="$XTST_RPATH_FLAGS -L$xtstpath -lXtst"
232                 LIBS="$save_LIBS"
233                 break],[AC_MSG_RESULT(no)])
234           done
235         fi
236         if test "x$XTST_LIBS" = x; then
237           AC_MSG_ERROR(Couldn't find the Xtst library. Check config.log for details)
238         else
239           X_LIBS="$X_LIBS $XTST_LIBS"
240           AC_DEFINE(HAVE_XTST, 1, [The XTest extension is present])
241         fi
243 AC_SUBST(X_LIBS)
246 if [[ x"$DEBUG" = xtrue ]]; then
247         AC_DEFINE([DEBUG], 1, [Additional debug checks enabled])
250 if [[ x"$WITHGNOME" = xtrue ]]; then
251         PKG_CHECK_MODULES(gnome, libgnome-2.0 libgnomeui-2.0 )
252         AC_DEFINE([GNOME_LIBS], 1, [libgnome-2 and libgnomeui-2 are present])
255 if [[ x"$WITHSPEECH" = xtrue ]]; then
256         PKG_CHECK_MODULES(gnome_speech, gnome-speech-1.0 bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0)
257         AC_DEFINE([GNOME_SPEECH], 1, [gnome_speech-1 libraries are present])
258 #       SPEECH_SOURCES='speech.$(OBJEXT)'
261 if [[ x"$WITHA11Y" = xtrue ]]; then
262         PKG_CHECK_MODULES(gnome_a11y, bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 libgnomeui-2.0 cspi-1.0 atk)
263         AC_DEFINE([GNOME_A11Y], 1, [gnome_a11y libraries are present])
266 if [[ x"$WITHJAPANESE" = xtrue ]]; then
267         AC_DEFINE([JAPANESE], 1, [Japanese support enabled])
268         JAPANESE_SOURCES='CannaConversionHelper.$(OBJEXT)'
269 else
270         JAPANESE_SOURCES=
273 AC_SUBST(JAPANESE_SOURCES)
275 if [[ x"$WITHCHINESE" = xtrue ]]; then
276         AC_DEFINE([CHINESE], 1, [Chinese support enabled])
277         CHINESE_SOURCES='PinYinConversionHelper.$(OBJEXT) PinyinParser.$(OBJEXT)'
279 else
280         CHINESE_SOURCES=
283 AC_SUBST(CHINESE_SOURCES)
285 if [[ x"$WITHJOYSTICK" = xtrue ]]; then
286         AC_DEFINE([JOYSTICK], 1, [Linux joystick support enabled])
289 if [[ x"$WITHTILT" = xtrue ]]; then
290         AC_DEFINE([TILT], 1, [Tilt input support enabled])
293 if [[ x"$WITHGPE" = xtrue ]]; then
294         AC_DEFINE([WITH_GPE], 1, [gpe is present])
297 dnl if [[ x"$WITHDARWIN" = xtrue ]]; then
298 dnl         AC_DEFINE([WITH_DARWIN], 1, [Targeting Darwin/X11])
299 dnl fi
301 if [[ x"$WITHMAEMO" = xtrue ]]; then
302       AC_DEFINE([WITH_MAEMO], 1, [Maemo is present])
303       dnl Yes, this sucks
304       glade_LIBS="/usr/lib/libglade-2.0.a"
305       PKG_CHECK_MODULES(hildon, hildon-libs)
306       AC_CHECK_LIB(osso, osso_initialize,, AC_MSG_ERROR([Osso library not found.]))
307 fi                      
309 if [[ x"$WITHMAEMOFULLSCREEN" = xtrue ]]; then
310       AC_DEFINE([WITH_MAEMOFULLSCREEN], 1, [Building as fullscreen Maemo app])
313 if [[ x"$WITHCAIRO" = xtrue ]]; then
314         PKG_CHECK_MODULES(cairo, gtk+-2.0 >= 2.8.0)
315         AC_DEFINE([WITH_CAIRO], 1, [use cairo (needs Gtk+ >= 2.8.0)])
318 if [[ x"$BUILDGTK2" = xtrue ]]; then 
319         PKG_CHECK_MODULES(glade, libglade-2.0)
320         if [[ x"$WITHMAEMO" = xtrue ]]; then
321                 dnl Yes, this sucks
322                 glade_LIBS=`echo $glade_LIBS | sed s/-lglade-2.0//`
323                 glade_LIBS="$glade_LIBS /usr/lib/libglade-2.0.a"
324         fi
326         PKG_CHECK_MODULES(gthread, gthread-2.0)
329 dnl     if [[ x"$WITHMAEMO" = xfalse ]]; then
330 dnl             PKG_CHECK_MODULES(wnck, libwnck-1.0)
331 dnl             AC_DEFINE([HAVE_WNCK], 1, [wnck is present])
332 dnl     fi
335 # libglade's autoconnect feature requires dasher to be linked with
336 # the --export-dynamic flag. pkg-config does not provide it, and libtool
337 # knows what to do with -export-dynamic.
338 if [[ x"$glade_LIBS" != x ]]; then
339         glade_LIBS="$glade_LIBS -export-dynamic"
342 if [[ x"$GCONF2HERE" = xtrue ]]; then
343         AM_GCONF_SOURCE_2
344         AC_DEFINE([WITH_GCONF], 1, [Use GConf])
347 AC_SUBST(gnome_speech_LIBS)
348 AC_SUBST(gnome_speech_CFLAGS)
349 AC_SUBST([SPEECH_SOURCES])
351 AC_SUBST(gnome_a11y_LIBS)
352 AC_SUBST(gnome_a11y_CFLAGS)
353 AC_SUBST([A11Y_SOURCES])
355 AC_SUBST(gnome_LIBS)
356 AC_SUBST(gnome_CFLAGS)
358 AC_SUBST(glade_LIBS)
359 AC_SUBST(glade_CFLAGS)
361 AC_SUBST(gthread_LIBS)
362 AC_SUBST(gthread_CFLAGS)
364 AC_SUBST(wnck_LIBS)
365 AC_SUBST(wnck_CFLAGS)
367 AC_SUBST(hildon_LIBS)
368 AC_SUBST(hildon_CFLAGS)
370 AC_SUBST(GETTEXT_PACKAGE)
372 AM_CONDITIONAL(DOGTK2, test x$BUILDGTK2 = xtrue)        
373 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
374 AM_CONDITIONAL(GNOME_SPEECH, test x$WITHSPEECH = xtrue)
375 AM_CONDITIONAL(GNOME_A11Y, test x$WITHA11Y = xtrue)
376 AM_CONDITIONAL(GNOME_HELP, test x$WITHGNOME = xtrue)
377 AM_CONDITIONAL(WITH_GPE, test x$WITHGPE = xtrue)
378 AM_CONDITIONAL(WITH_MAEMO, test x$WITHMAEMO = xtrue)
379 AM_CONDITIONAL(WITH_MAEMOFULLSCREEN, test x$WITHMAEMOFULLSCREEN = xtrue)
380 AM_CONDITIONAL(JAPANESE, test x$WITHJAPANESE = xtrue)
381 AM_CONDITIONAL(CHINESE, test x$WITHCHINESE = xtrue)
382 AM_CONDITIONAL(JOYSITICK, test x$WITHJOYSTICK = xtrue)
384 AC_SUBST(GTK2_CFLAGS)
385 AC_SUBST(GTK2_LIBS)
387 AC_SUBST(GCONF_CFLAGS)
388 AC_SUBST(GCONF_LIBS)
390 if [[ x"$WITHGPE" = xtrue ]]; then
391         SETTINGS_CFLAGS=" "
392         SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
393 else
394         SETTINGS_CFLAGS=$GCONF_CFLAGS
395         SETTINGS_LIBS=$GCONF_LIBS
397 AC_SUBST(SETTINGS_CFLAGS)
398 AC_SUBST(SETTINGS_LIBS)
400 GTK2BUILD_CFLAGS="$GTK2_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $gnome_speech_CFLAGS $gnome_a11y_CFLAGS $glade_CFLAGS $gnome_CFLAGS $wnck_CFLAGS $hildon_CFLAGS"
402 GTK2BUILD_LIBS="$X_LIBS $GTK2_LIBS $SETTINGS_LIBS $gthread_LIBS $gnome_speech_LIBS $gnome_a11y_LIBS $glade_LIBS $gnome_LIBS $wnck_LIBS $hildon_LIBS"
404 AC_SUBST(GTK2BUILD_CFLAGS)
405 AC_SUBST(GTK2BUILD_LIBS)
407 AC_MSG_CHECKING([for gnome-doc-utils])
408 GNOME_DOC_INIT([0.9.0],[have_gdu=yes],[have_gdu=no])
409 AC_MSG_RESULT($have_gdu)
411 if [[ x"$WITHGNOME" = xtrue ]] && [[ x"$have_gdu" = xno ]]; then
412     AC_MSG_ERROR([gnome-doc-utils not found!])
415 AM_CONDITIONAL(ENABLE_SK, test x"$WITHGNOME" = xfalse -a x"$enable_scrollkeeper" = "xyes")
417 AC_CONFIG_FILES([Data/dasher.desktop.in
418                  Data/Makefile
419                  Data/training/Makefile
420                  Data/alphabets/Makefile
421                  Data/glade/Makefile
422                  Data/colours/Makefile
423                  Data/controllabels/Makefile
424                  Data/Help/Makefile
425                  Data/Help/Gnome/Makefile
426                  Doc/Makefile
427                  Doc/user/Makefile
428                  Makefile
429                  Src/Makefile
430                  Src/Common/Makefile
431                  Src/DasherCore/Makefile
432                  Src/DasherCore/LanguageModelling/Makefile
433                  Src/DasherIM/Makefile
434                  Src/Gtk2/Makefile
435                  Src/Installer/Makefile
436                  Src/InstallerTobii/Makefile
437                  Src/InstallerW2K/Makefile
438                  Src/Win32/Makefile
439                  po/Makefile.in])
441 AC_OUTPUT