keeping make distcheck happy
[dasher.git] / configure.in
blob806fc1a95175d5843d5c41c6870a83a51726ebbe
1 AC_PREREQ(2.56)
2 AC_INIT([dasher],[4.3.4],[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
19 changequote(,)dnl
20 if test "x$GCC" = "xyes"; then
21   CXXFLAGS="$CXXFLAGS -Wall -Wno-non-virtual-dtor"
22   case " $CXXFLAGS " in
23   *[\ \ ]-O*) ;;
24   *) CXXFLAGS="$CXXFLAGS -O2" ;;
25   esac
27 changequote([,])dnl
29 dnl AM_ICONV
31 GETTEXT_PACKAGE=dasher
32 AC_SUBST(GETTEXT_PACKAGE)
33 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
34 AM_GLIB_GNU_GETTEXT
36 AC_PROG_CXX
38 AC_PROG_LD_GNU
40 WITHGTK2=true;
42 PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.4, have_glib=true, have_glib=false)
44 AC_CHECK_LIB(expat, XML_Parse,, AC_MSG_ERROR([Expat library not found.]))
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 AC_ARG_ENABLE([speech],
56          AC_HELP_STRING([--enable-speech],[build with speech support (default is NO)]),
57          if test $enableval = "no"; then
58            WITHSPEECH=false; 
59          else
60            WITHSPEECH=true;
61          fi, 
62          WITHSPEECH=false)
64 AC_ARG_WITH([qte],
65          AC_HELP_STRING([--with-qte],[build with QTE support (default is NO -- currently untested)]), 
66          if test $withval = "no"; then
67            WITHQTE=false; 
68          else
69            WITHQTE=true;
70          fi, 
71          WITHQTE=false)
73 AC_ARG_WITH([gpe],
74          AC_HELP_STRING([--with-gpe],[build with GPE support (default is NO -- currently untested)]), 
75          if test $withval = "no"; then
76            WITHGPE=false; 
77          else
78            WITHGPE=true;
79          fi, 
80          WITHGPE=false)
82 AC_ARG_ENABLE([a11y],
83          AC_HELP_STRING([--enable-a11y],[build with support for the GNOME accessibility framework (default is YES)]),
84          if test $enableval = "no"; then
85            WITHA11Y=false; 
86          else
87            WITHA11Y=true;
88          fi, 
89          WITHA11Y=true)
91 AC_ARG_ENABLE([japanese],
92          AC_HELP_STRING([--enable-japanese],[build with support for Japanese Kanji entry (experimental -- default is NO)]),
93          if test $enableval = "no"; then
94            WITHJAPANESE=false; 
95          else
96            AC_CHECK_LIB(canna, RkBgnBun,, AC_MSG_ERROR([Canna library not found (required for Japanese).]))
97            WITHJAPANESE=true;
98          fi, 
99          WITHJAPANESE=false)
101 AC_ARG_ENABLE([chinese],
102          AC_HELP_STRING([--enable-chinese],[build with support for Chinese PinYin entry (experimental -- default is NO)]),
103          if test $enableval = "no"; then
104            WITHCHINESE=false; 
105          else
106            AC_CHECK_LIB(ce, CEConvert, , AC_MSG_ERROR([CE library not found (required for Chinese).]))
107            WITHCHINESE=true;
108          fi, 
109          WITHCHINESE=false)
111 AC_ARG_ENABLE([joystick],
112          AC_HELP_STRING([--enable-joystick],[Build with Linux joystick support (note that other UNIX based operating systems aren't supported here)]),
113          if test $enableval = "no"; then
114            WITHJOYSTICK=false; 
115          else
116            WITHJOYSTICK=true;
117          fi, 
118          WITHJOYSTICK=false)
120 AC_ARG_WITH([maemo],
121         AC_HELP_STRING([--with-maemo],[build with Maemo support (default is NO)]),
122         if test $withval = "yes"; then
123            WITHMAEMO=true;
124            WITHGNOME=false;
125            WITHA11Y=false;
126         else
127            WITHMAEMO=false;
128         fi,
129         WITHMAEMO=false)
131 AC_ARG_WITH([maemo-fullscreen],
132         AC_HELP_STRING([--with-maemo-fullscreen],[build as standalone Maemo fullscreen app (default is NO)]),
133         if test $withval = "yes"; then
134            WITHMAEMOFULLSCREEN=true;
135            WITHMAEMO=true;
136            WITHGNOME=false;
137            WITHA11Y=false;
138         else
139            WITHMAEMOFULLSCREEN=false;
140         fi,
141         WITHMAEMOFULLSCREEN=false)
144 dnl AC_ARG_WITH([darwin],
145 dnl     AC_HELP_STRING([--with-darwin],[build with Darwin (Mac OS X) support (default is NO)]),
146 dnl     if test $withval = "yes"; then
147 dnl        WITHDARWIN=true;
148 dnl     else
149 dnl        WITHDARWIN=false;
150 dnl     fi,
151 dnl     WITHDARWIN=false)
153 AC_ARG_WITH([cairo],
154          AC_HELP_STRING([--with-cairo],[build with cairo support (default is YES)]),
155          if test $withval = "no"; then
156            WITHCAIRO=false; 
157          else
158            WITHCAIRO=true;
159          fi, 
160          WITHCAIRO=true)
162 if [[ x"$WITHGTK2" = xtrue ]]
163 then 
164         PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.4.0,[GTK2HERE=true],[GTK2HERE=false]) 
165         PKG_CHECK_MODULES(GCONF, gconf-2.0,[GCONF2HERE=true],[GCONF2HERE=false])
166         if [[ x$GCONF2HERE = xfalse ]]; then
167            AC_MSG_WARN("GConf was not detected - user preferences will not be stored.")
168         fi
171 if [[ x"$GTK2HERE" = xtrue ]] && [[ x"$WITHGTK2" = xtrue ]] && [[ x"$WITHQTE" != xtrue ]]
172 then
173         BUILDGTK2=true
174 elif [[ x"$GTK2HERE" = xtrue ]] && [[ x"$WITHQTE" != xtrue ]]
175 then
176         BUILDGTK2=true
177 else 
178         BUILDGTK2=false
181 if [[ x$BUILDGTK2 = xfalse ]] && [[ x"$WITHQTE" != xtrue ]]
182 then
183         echo $WITHGTK2
184         AC_ERROR("Unable to find GTK2 or another necessary library. See the previous line for more useful data.")
187 if [[ x"$WITHQTE" != xtrue ]]
188 then
189 dnl test for X libraries
190         if test x$no_x = xyes ; then
191           AC_MSG_ERROR([X development libraries not found])
192         else
193           X_LIBS="$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
194         fi
196 dnl path to Xtst
197         AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, XTST_LIBS=-lXtst)
198         if test "x$XTST_LIBS" = x; then
199           save_LIBS="$LIBS"
200           for xtstpath in /usr/X11R6/lib64 /usr/X11R6/lib /usr/openwin/lib $x_libraries; do
201             LIBS="-L$xtstpath -lXtst"
202             case "$host" in
203             *solaris*) XTST_RPATH_FLAGS="-R$xtstpath" ;;
204             esac
205             AC_MSG_CHECKING(for -lXtst in $xtstpath)
206             AC_TRY_LINK([], [XTestFakeKeyEvent()], [
207                 AC_MSG_RESULT(yes)
208                 XTST_LIBS="$XTST_RPATH_FLAGS -L$xtstpath -lXtst"
209                 LIBS="$save_LIBS"
210                 break],[AC_MSG_RESULT(no)])
211           done
212         fi
213         if test "x$XTST_LIBS" = x; then
214           AC_MSG_ERROR(Couldn't find the Xtst library. Check config.log for details)
215         else
216           X_LIBS="$X_LIBS $XTST_LIBS"
217           AC_DEFINE(HAVE_XTST, 1, [The XTest extension is present])
218         fi
220 AC_SUBST(X_LIBS)
224 if [[ x"$WITHGNOME" = xtrue ]]; then
225         PKG_CHECK_MODULES(gnome, libgnome-2.0 libgnomeui-2.0 gnome-vfs-2.0)
226         AC_DEFINE([GNOME_LIBS], 1, [libgnome-2, libgnomeui-2, and gnome-vfs-2 are present])
229 if [[ x"$WITHSPEECH" = xtrue ]]; then
230         PKG_CHECK_MODULES(gnome_speech, gnome-speech-1.0 bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0)
231         AC_DEFINE([GNOME_SPEECH], 1, [gnome_speech-1 libraries are present])
232 #       SPEECH_SOURCES='speech.$(OBJEXT)'
235 if [[ x"$WITHA11Y" = xtrue ]]; then
236         PKG_CHECK_MODULES(gnome_a11y, bonobo-activation-2.0 libbonobo-2.0 ORBit-2.0 libgnomeui-2.0 cspi-1.0 atk)
237         AC_DEFINE([GNOME_A11Y], 1, [gnome_a11y libraries are present])
240 if [[ x"$WITHJAPANESE" = xtrue ]]; then
241         AC_DEFINE([JAPANESE], 1, [Japanese support enabled])
242         JAPANESE_SOURCES='CannaConversionHelper.$(OBJEXT)'
243 else
244         JAPANESE_SOURCES=
247 AC_SUBST(JAPANESE_SOURCES)
249 if [[ x"$WITHCHINESE" = xtrue ]]; then
250         AC_DEFINE([CHINESE], 1, [Chinese support enabled])
251         CHINESE_SOURCES='PinYinConversionHelper.$(OBJEXT)'
252 else
253         CHINESE_SOURCES=
256 AC_SUBST(CHINESE_SOURCES)
258 if [[ x"$WITHJOYSTICK" = xtrue ]]; then
259         AC_DEFINE([JOYSTICK], 1, [Linux joystick support enabled])
263 if [[ x"$WITHGPE" = xtrue ]]; then
264         AC_DEFINE([WITH_GPE], 1, [gpe is present])
267 dnl if [[ x"$WITHDARWIN" = xtrue ]]; then
268 dnl         AC_DEFINE([WITH_DARWIN], 1, [Targeting Darwin/X11])
269 dnl fi
271 if [[ x"$WITHMAEMO" = xtrue ]]; then
272       AC_DEFINE([WITH_MAEMO], 1, [Maemo is present])
273       dnl Yes, this sucks
274       glade_LIBS="/usr/lib/libglade-2.0.a"
275       PKG_CHECK_MODULES(hildon, hildon-libs)
276       AC_CHECK_LIB(osso, osso_initialize,, AC_MSG_ERROR([Osso library not found.]))
277 fi                      
279 if [[ x"$WITHMAEMOFULLSCREEN" = xtrue ]]; then
280       AC_DEFINE([WITH_MAEMOFULLSCREEN], 1, [Building as fullscreen Maemo app])
283 if [[ x"$WITHCAIRO" = xtrue ]]; then
284         PKG_CHECK_MODULES(cairo, gtk+-2.0 >= 2.8.0)
285         AC_DEFINE([WITH_CAIRO], 1, [use cairo (needs Gtk+ >= 2.8.0)])
288 if [[ x"$BUILDGTK2" = xtrue ]]; then 
289         PKG_CHECK_MODULES(glade, libglade-2.0)
290         if [[ x"$WITHMAEMO" = xtrue ]]; then
291                 dnl Yes, this sucks
292                 glade_LIBS=`echo $glade_LIBS | sed s/-lglade-2.0//`
293                 glade_LIBS="$glade_LIBS /usr/lib/libglade-2.0.a"
294         fi
296         PKG_CHECK_MODULES(gthread, gthread-2.0)
299 dnl     if [[ x"$WITHMAEMO" = xfalse ]]; then
300 dnl             PKG_CHECK_MODULES(wnck, libwnck-1.0)
301 dnl             AC_DEFINE([HAVE_WNCK], 1, [wnck is present])
302 dnl     fi
305 if [[ x"$GCONF2HERE" = xtrue ]]; then
306         AM_GCONF_SOURCE_2
307         AC_DEFINE([WITH_GCONF], 1, [Use GConf])
310 AC_SUBST(gnome_speech_LIBS)
311 AC_SUBST(gnome_speech_CFLAGS)
312 AC_SUBST([SPEECH_SOURCES])
314 AC_SUBST(gnome_a11y_LIBS)
315 AC_SUBST(gnome_a11y_CFLAGS)
316 AC_SUBST([A11Y_SOURCES])
318 AC_SUBST(gnome_LIBS)
319 AC_SUBST(gnome_CFLAGS)
321 AC_SUBST(glade_LIBS)
322 AC_SUBST(glade_CFLAGS)
324 AC_SUBST(gthread_LIBS)
325 AC_SUBST(gthread_CFLAGS)
327 AC_SUBST(wnck_LIBS)
328 AC_SUBST(wnck_CFLAGS)
330 AC_SUBST(hildon_LIBS)
331 AC_SUBST(hildon_CFLAGS)
333 AC_SUBST(GETTEXT_PACKAGE)
335 AM_CONDITIONAL(DOGTK2, test x$BUILDGTK2 = xtrue)        
336 AM_CONDITIONAL(DOQTE, test x$WITHQTE = xtrue)
337 AM_CONDITIONAL(GNOME_SPEECH, test x$WITHSPEECH = xtrue)
338 AM_CONDITIONAL(GNOME_A11Y, test x$WITHA11Y = xtrue)
339 AM_CONDITIONAL(WITH_GPE, test x$WITHGPE = xtrue)
340 AM_CONDITIONAL(WITH_MAEMO, test x$WITHMAEMO = xtrue)
341 AM_CONDITIONAL(WITH_MAEMOFULLSCREEN, test x$WITHMAEMOFULLSCREEN = xtrue)
342 AM_CONDITIONAL(JAPANESE, test x$WITHJAPANESE = xtrue)
343 AM_CONDITIONAL(CHINESE, test x$WITHCHINESE = xtrue)
344 AM_CONDITIONAL(JOYSITICK, test x$WITHJOYSTICK = xtrue)
346 AC_SUBST(GTK2_CFLAGS)
347 AC_SUBST(GTK2_LIBS)
349 AC_SUBST(GCONF_CFLAGS)
350 AC_SUBST(GCONF_LIBS)
352 if [[ x"$WITHGPE" = xtrue ]]; then
353         SETTINGS_CFLAGS=" "
354         SETTINGS_LIBS="-lgpewidget -lXsettings-client -lXsettings"
355 else
356         SETTINGS_CFLAGS=$GCONF_CFLAGS
357         SETTINGS_LIBS=$GCONF_LIBS
359 AC_SUBST(SETTINGS_CFLAGS)
360 AC_SUBST(SETTINGS_LIBS)
362 GTK2BUILD_CFLAGS="$GTK2_CFLAGS $SETTINGS_CFLAGS $gthread_CFLAGS $gnome_speech_CFLAGS $gnome_a11y_CFLAGS $glade_CFLAGS $gnome_CFLAGS $wnck_CFLAGS $hildon_CFLAGS"
364 dnl Check for GNU ld stolen from libtool.m4 - code reuse would be nice here
366 AC_CACHE_CHECK([if the linker ($LD) is GNU ld], have_prog_gnu_ld,
367 [# I'd rather use --version here, but apparently some GNU lds only accept -v.
368 case `$LD -v 2>&1 </dev/null` in
369 *GNU* | *'with BFD'*)
370 have_prog_gnu_ld=yes
373 have_prog_gnu_ld=no
375 esac])
377 if [[ x"$have_prog_gnu_ld" = xyes ]]; then
378    ed_flags="-Wl,--export-dynamic,"
379 else
380    ed_flags=""
383 GTK2BUILD_LIBS="$X_LIBS $GTK2_LIBS $SETTINGS_LIBS $gthread_LIBS $gnome_speech_LIBS $gnome_a11y_LIBS $glade_LIBS $gnome_LIBS $wnck_LIBS $hildon_LIBS $ed_flags"
385 AC_SUBST(GTK2BUILD_CFLAGS)
386 AC_SUBST(GTK2BUILD_LIBS)
388 if [[ x"$WITHGNOME" = xtrue ]]; then
389 GNOME_DOC_INIT
392 AC_CONFIG_FILES([Makefile
393                  Src/Makefile
394                  Src/Common/Makefile
395                  Src/DasherCore/Makefile
396                  Src/DasherCore/Alphabet/Makefile
397                  Src/DasherCore/LanguageModelling/Makefile
398                  Src/Gtk2/Makefile
399                  Src/Qt/Makefile
400                  Src/Win32/Makefile
401                  Data/dasher.desktop.in
402                  Data/Makefile
403                  Data/Translations/Makefile
404                  Data/system.rc/Makefile
405                  Data/Help/Makefile
406                  Data/Help/Gnome/Makefile
407                  Doc/Makefile
408                  Utils/Makefile
409                  po/Makefile.in])
412 dnl              Data/Help/Gnome/eu/Makefile
415 AC_OUTPUT