3 m4_esyscmd([build-aux/mkversion]),
4 [http://bugzilla.gnome.org/enter_bug.cgi?product=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],
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])
27 # IT_PROG_INTLTOOL requires AM_NLS but ignores --enable-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])
39 GETTEXT_PACKAGE=dasher
40 AC_SUBST(GETTEXT_PACKAGE)
41 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
50 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
54 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
55 AC_REPLACE_FUNCS([round])
59 AS_HELP_STRING([--enable-debug],
60 [build with additional debugging checks (default is NO)]),
61 if test "x$enable_debug" = "xno"; then
69 AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
70 if test "x$with_gnome" = "xno"; then
74 # Need to work out how to translate replaced variables before uncommenting
75 # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
79 AC_ARG_ENABLE([speech],
80 [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher,gnomespeech@:>@],
81 [build with speech support (default is YES)])])
84 AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]),
85 if test "x$withval" = "xno"; then
93 AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]),
94 if test "x$withval" = "xno"; then
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
113 AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
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
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
139 AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
140 if test "x$withval" = "xyes"; then
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;
157 WITHMAEMOFULLSCREEN=false;
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
167 dnl WITHDARWIN=false;
169 dnl WITHDARWIN=false)
172 AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
173 if test "x$withval" = "xno"; then
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
188 PKG_CHECK_MODULES(GTK, gtk+-3.0,
190 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6.0,
195 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
203 if test x$BUILDGTK = xtrue
205 PKG_CHECK_MODULES(GIO, gio-2.0,
206 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
208 save_CFLAGS="$CFLAGS"
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.])
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.])
222 CFLAGS="$save_CFLAGS"
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])
229 AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
230 [have_gsettings=false
231 PKG_CHECK_MODULES(GCONF, gconf-2.0,
233 AC_DEFINE([WITH_GCONF], 1, [Use GConf])
234 SETTINGS_CFLAGS=$GCONF_CFLAGS
235 SETTINGS_LIBS=$GCONF_LIBS],
237 AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
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])
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"
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
270 dnl OK if wanted no speech
273 dnl error if selected particular
274 dnl BTW test: The -a operator has higher precedence than the -o operator.
277 [test "x$enable_speech" = x],
278 [enable_speech=yes; only_warn_if_speech_not_found=yes])
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"
288 SPEECH_LIBS=-lspeechd])])])
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],
300 [test $speech_module = none],
301 [AS_CASE(["x$enable_speech"],
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)
319 AC_CHECK_LIB(expat, XML_Parse,,[
320 if test x$no_x = xyes ; then
321 AC_MSG_ERROR([Expat library not found.])
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.])])
331 PKG_CHECK_MODULES([ATSPI],
336 PKG_CHECK_MODULES([CSPI],
337 [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
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],
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)'
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])
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.]))
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)
435 if test x"$WITHGPE" = xtrue ; then
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
462 Data/training/Makefile
463 Data/alphabets/Makefile
464 Data/colours/Makefile
465 Data/control/Makefile
468 Data/Help/Gnome/Makefile
474 Src/DasherCore/Makefile
475 Src/DasherCore/LanguageModelling/Makefile
476 Src/DasherIM/Makefile
478 Src/Installer/Makefile
479 Src/InstallerTobii/Makefile
480 Src/InstallerW2K/Makefile