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])
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])
44 CXXFLAGS="$CXXFLAGS -std=c++0x"
51 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.6)
55 AC_CHECK_FUNC(socket,,[AC_CHECK_LIB(socket,socket)])
56 AC_REPLACE_FUNCS([round])
60 AS_HELP_STRING([--enable-debug],
61 [build with additional debugging checks (default is NO)]),
62 if test "x$enable_debug" = "xno"; then
70 AS_HELP_STRING([--with-gnome],[build GNOME documentation (default is YES)]),
71 if test "x$with_gnome" = "xno"; then
75 # Need to work out how to translate replaced variables before uncommenting
76 # AC_CONFIG_FILES([Data/Help/Gnome/C/dasher.xml])
80 AC_ARG_ENABLE([speech],
81 [AS_HELP_STRING([--enable-speech=@<:@speechdispatcher@:>@],
82 [build with speech support (default is YES)])])
85 AS_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]),
86 if test "x$withval" = "xno"; then
94 AS_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]),
95 if test "x$withval" = "xno"; then
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
114 AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
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
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
140 AS_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
141 if test "x$withval" = "xyes"; then
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;
158 WITHMAEMOFULLSCREEN=false;
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
168 dnl WITHDARWIN=false;
170 dnl WITHDARWIN=false)
173 AS_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
174 if test "x$withval" = "xno"; then
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
189 PKG_CHECK_MODULES(GTK, gtk+-3.0,
191 [PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.14.0,
196 if test x"$GTKHERE" = xtrue -a x"$WITHQTE" != xtrue
204 if test x$BUILDGTK = xtrue
206 PKG_CHECK_MODULES(GIO, gio-2.0,
207 [AC_DEFINE(HAVE_GIO, 1, [gio exists so use gvfs])])
209 save_CFLAGS="$CFLAGS"
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.])
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.])
223 CFLAGS="$save_CFLAGS"
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])
230 AC_DEFINE([WITH_GSETTINGS], 1, [Use GSettings])],
231 [have_gsettings=false
232 PKG_CHECK_MODULES(GCONF, gconf-2.0,
234 AC_DEFINE([WITH_GCONF], 1, [Use GConf])
235 SETTINGS_CFLAGS=$GCONF_CFLAGS
236 SETTINGS_LIBS=$GCONF_LIBS],
238 AC_MSG_WARN([Neither a glib with GSettings, nor GConf were detected - user preferences will not be stored.])])
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])
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"
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
269 dnl OK if wanted no speech
272 dnl error if selected particular
273 dnl BTW test: The -a operator has higher precedence than the -o operator.
276 [test "x$enable_speech" = x],
277 [enable_speech=yes; only_warn_if_speech_not_found=yes])
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"
287 SPEECH_LIBS=-lspeechd])])])
289 [test $speech_module = none],
290 [AS_CASE(["x$enable_speech"],
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)
308 AC_CHECK_LIB(expat, XML_Parse,,[
309 if test x$no_x = xyes ; then
310 AC_MSG_ERROR([Expat library not found.])
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.])])
320 PKG_CHECK_MODULES([ATSPI],
325 PKG_CHECK_MODULES([CSPI],
326 [bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 cspi-1.0 atk],
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],
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)'
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])
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.]))
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)
421 if test x"$WITHGPE" = xtrue ; then
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
448 Data/training/Makefile
449 Data/alphabets/Makefile
450 Data/colours/Makefile
451 Data/control/Makefile
454 Data/Help/Gnome/Makefile
455 Data/settings/Makefile
461 Src/DasherCore/Makefile
462 Src/DasherCore/LanguageModelling/Makefile
463 Src/DasherIM/Makefile