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 subdir-objects])
25 LT_INIT([disable-static])
27 AM_GNU_GETTEXT_VERSION([0.19])
28 AM_GNU_GETTEXT([external])
30 CXXFLAGS="$CXXFLAGS -std=c++0x"
37 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
41 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
42 AC_REPLACE_FUNCS([round])
46 AS_HELP_STRING([--enable-debug],
47 [build with additional debugging checks (default is NO)]),
48 if test "x$enable_debug" = "xno"; then
56 AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
57 if test "x$with_gnome" = "xno"; then
61 # Need to work out how to translate replaced variables before uncommenting
62 # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
66 AC_ARG_ENABLE([speech],
67 [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher@:>@],
68 [build with speech support (default is YES)])])
71 AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]),
72 if test "x$withval" = "xno"; then
80 AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]),
81 if test "x$withval" = "xno"; then
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
100 AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
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
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
126 AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
127 if test "x$withval" = "xyes"; then
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;
144 WITHMAEMOFULLSCREEN=false;
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
154 dnl WITHDARWIN=false;
156 dnl WITHDARWIN=false)
159 AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
160 if test "x$withval" = "xno"; then
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
175 PKG_CHECK_MODULES(GTK, gtk+-3.0,
177 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14.0,
182 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
190 if test x$BUILDGTK = xtrue
192 PKG_CHECK_MODULES(GIO, gio-2.0,
193 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
195 save_CFLAGS="$CFLAGS"
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.])
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.])
209 CFLAGS="$save_CFLAGS"
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])
216 AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
217 [have_gsettings=false
218 PKG_CHECK_MODULES(GCONF, gconf-2.0,
220 AC_DEFINE([WITH_GCONF], 1, [Use GConf])
221 SETTINGS_CFLAGS=$GCONF_CFLAGS
222 SETTINGS_LIBS=$GCONF_LIBS],
224 AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
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])
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"
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
255 dnl OK if wanted no speech
258 dnl error if selected particular
259 dnl BTW test: The -a operator has higher precedence than the -o operator.
262 [test "x$enable_speech" = x],
263 [enable_speech=yes; only_warn_if_speech_not_found=yes])
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"
273 SPEECH_LIBS=-lspeechd])])])
275 [test $speech_module = none],
276 [AS_CASE(["x$enable_speech"],
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)
294 AC_CHECK_LIB(expat, XML_Parse,,[
295 if test x$no_x = xyes ; then
296 AC_MSG_ERROR([Expat library not found.])
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.])])
306 PKG_CHECK_MODULES([ATSPI],
311 PKG_CHECK_MODULES([CSPI],
312 [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
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],
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)'
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])
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.]))
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)
405 if test x"$WITHGPE" = xtrue ; then
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
432 Data/training/Makefile
433 Data/alphabets/Makefile
434 Data/colours/Makefile
435 Data/control/Makefile
438 Data/Help/Gnome/Makefile
439 Data/settings/Makefile
445 Src/DasherCore/Makefile
446 Src/DasherCore/LanguageModelling/Makefile