Fix:core:Improve configure checks for python
[navit-package] / configure.in
1 AC_INIT(navit, 0.1.1)
2 SOURCE_MODE=svn
3
4 AM_INIT_AUTOMAKE
5 AM_CONFIG_HEADER(config.h)
6
7 AC_SUBST(SOURCE_MODE)
8 AM_CONDITIONAL(SOURCE_MODE_SVN, [test "x${SOURCE_MODE}" = "xsvn"])
9
10 if test "x${SOURCE_MODE}" = "xsvn" ; then
11         USE_MAINTAINER_MODE=yes
12 else
13         USE_MAINTAINER_MODE=no
14 fi
15
16 AC_DEFUN([AM_MAINTAINER_MODE],
17 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
18   dnl maintainer-mode is enabled by default (reason of inclusion of this function)
19   AC_ARG_ENABLE(maintainer-mode,
20 [  --enable-maintainer-mode  enable make rules and dependencies not useful
21                           (and sometimes confusing) to the casual installer],
22       USE_MAINTAINER_MODE=$enableval)
23   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
24   AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
25   MAINT=$MAINTAINER_MODE_TRUE
26   AC_SUBST(MAINT)dnl
27 ]
28 )
29
30 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
31
32 AM_MAINTAINER_MODE
33
34
35 plugins=yes; plugins_reason=default
36 postgresql=yes; postgresql_reason=default
37 samplemap=yes; samplemap_reason=default
38 binding_dbus=yes; binding_dbus_reason=default
39 binding_python=yes; binding_python_reason=default
40 font_freetype=yes; font_freetype_reason=default
41 gui_gtk=no; gui_gtk_reason=default
42 gui_win32=no; gui_win32_reason=default
43 gui_internal=yes; gui_internal_reason=default
44 graphics_gd=no; graphics_gd_reason=default
45 graphics_gtk_drawing_area=no; graphics_gtk_drawing_area_reason=default
46 graphics_qt_qpainter=yes; graphics_qt_qpainter_reason=default
47 graphics_opengl=yes; graphics_opengl_reason=default
48 graphics_win32=no; graphics_win32_reason=default
49 speech_cmdline=yes; speech_cmdline_reason=default
50 speech_speech_dispatcher=yes; speech_speech_dispatcher_reason=default
51 vehicle_demo=yes; vehicle_demo_reason=default
52 vehicle_file=yes; vehicle_file_reason=default
53 vehicle_gpsd=yes; vehicle_gpsd_reason=default
54 vehicle_gypsy=yes; vehicle_gypsy_reason=default
55 vehicle_wince=no; vehicle_wince_reason=default
56
57 m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],
58         [AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS], [AC_GNU_SOURCE])])
59
60 AC_USE_SYSTEM_EXTENSIONS
61
62 AC_PROG_CC
63 if eval "test x$GCC = xyes"; then
64         CFLAGS="$CFLAGS -Wall -Wcast-align -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
65 fi
66 AM_PROG_CC_C_O
67
68 AC_PROG_CXX
69 if eval "test x$GXX = xyes"; then
70         CXXFLAGS="$CXXFLAGS -Wall -Wcast-align -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
71 fi
72
73 PKG_CHECK_EXISTS
74 if test "x${cross_compiling}" = "xyes"; then
75         samplemap="no";samplemap_reason="not supported for cross compiling"
76         binding_python="no";binding_python_reason="not supported for cross compiling"
77         postgresql="no";postgresql_reason="not supported for cross compiling"
78         AC_MSG_CHECKING([for a C compiler for build tools])
79         AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
80 else
81         CC_FOR_BUILD=$CC
82 fi
83 CCLD_FOR_BUILD="$CC_FOR_BUILD"
84 AC_SUBST(cross_compiling)
85 AC_SUBST(CC_FOR_BUILD)
86 AC_SUBST(CCLD_FOR_BUILD)
87
88 AC_ARG_ENABLE(variant, [  --enable-variant=something          set variant], NAVIT_VARIANT=$enableval)
89 AC_SUBST(NAVIT_VARIANT)
90
91 AC_ARG_ENABLE(avoid-unaligned, [  --enable-avoid-unaligned          avoid unaligned accesses], AVOID_UNALIGNED=$enableval, AVOID_UNALIGNED=no)
92 test x"${AVOID_UNALIGNED}" = xyes && AC_DEFINE(AVOID_UNALIGNED,[],Define to avoid unaligned access)
93
94 AC_ARG_ENABLE(avoid-float, [  --enable-avoid-float              avoid floating point calculations], AVOID_FLOAT=$enableval, AVOID_FLOAT=no)
95 test x"${AVOID_FLOAT}" = xyes && AC_DEFINE(AVOID_FLOAT,[],Define to avoid floating point)
96
97 AC_ARG_ENABLE(hildon, [  --disable-hildon              build without maemo/hildon support], enable_hildon=$enableval, enable_hildon=yes)
98 if test "x${enable_hildon}" = "xyes" ; then
99         PKG_CHECK_MODULES(HILDON, hildon-1 >= 0.9.9, , [
100                 AC_MSG_RESULT(no)
101                 enable_hildon=no
102         ])
103         PKG_CHECK_MODULES(GPSBT, gpsbt, [
104                 AC_DEFINE(HAVE_GPSBT, 1, [Have the gpsbt library])
105                 AC_SUBST(GPSBT_CFLAGS)
106                 AC_SUBST(GPSBT_LIBS)
107                 ], [
108                 AC_MSG_RESULT(no)
109         ])
110         if test x"${enable_hildon}" = xyes ; then
111                 AC_DEFINE(USE_HILDON, 1, [Build with maemo/hildon support])
112                 AC_SUBST(HILDON_CFLAGS)
113                 AC_SUBST(HILDON_LIBS)
114         fi
115 fi
116 AM_CONDITIONAL(USE_HILDON, test "${enable_hildon}" = "xyes")
117
118 AC_ARG_ENABLE(garmin, [  --disable-garmin             disable garmin support], USE_GARMIN=$enableval, USE_GARMIN=yes)
119
120 # samplemap
121 AC_PATH_PROG(_PATH_BZCAT,[bzcat])
122 if test "x${_PATH_BZCAT}" = "x" ; then
123         samplemap=no; samplemap_reason="bzcat missing"
124 fi
125 AC_ARG_ENABLE(samplemap, [  --disable-samplemap             don't build the samplemap], samplemap=$enableval;samplemap_reason="configure parameter")
126 AM_CONDITIONAL(BUILD_SAMPLEMAP, [test "x$samplemap" = "xyes"])
127
128 AC_ARG_ENABLE(fastmath, [  --disable-fastmath             don't build with fastmath], fastmath=$enableval, fastmath=yes)
129 AM_CONDITIONAL(FASTMATH, [test "x$fastmath" = "xyes"])
130
131 if test x"$fastmath" = xyes; then
132         if eval "test x$GCC = xyes"; then
133                 CFLAGS="$CFLAGS -ffast-math"
134         fi
135 fi
136
137 X_CFLAGS="-I$x_includes"
138 AS_IF([test -n "$ac_x_libraries"], [X_LIBS="-L$ac_x_libraries"])
139
140 # glib
141 AC_ARG_ENABLE(glib, [  --disable-glib             don't build with external glib], glib=$enableval, glib=yes)
142 if test x"${glib}" = "xyes"; then
143         PKG_CHECK_MODULES(GLIB, [glib-2.0 gthread-2.0], [glib=yes],[glib=no])
144 fi
145 if test "x${glib}" = "xyes"; then
146         AC_DEFINE(HAVE_GLIB, 1, [Define to 1 if you have (external) glib library])
147 else
148         GLIB_CFLAGS="-I\$(top_srcdir)/navit/support -I\$(top_srcdir)/navit/support/glib -I\$(top_srcdir)/navit/support/ezxml"
149         GLIB_LIBS="-L\$(top_builddir)/navit/support/glib -lsupport_glib -L\$(top_builddir)/navit/support/ezxml -lsupport_ezxml"
150 fi
151
152 # gmodule
153 AC_ARG_ENABLE(gmodule, [  --disable-gmodule             don't build with gmodule], gmodule=$enableval, gmodule=yes)
154 if test x"${gmodule}" = "xyes"; then
155         PKG_CHECK_MODULES(GMODULE, [gmodule-2.0], [gmodule=yes], [gmodule=no])
156 fi
157 if test "x${gmodule}" = "xyes"; then
158         AC_DEFINE(HAVE_GMODULE, 1, [Define to 1 if you have gmodule])
159 else
160         AC_CHECK_LIB(dl, dlopen,
161                 [plugins_reason="default, via dlopen";GMODULE_LIBS="-ldl";AC_DEFINE(HAVE_DLOPEN, 1, [Define to 1 if you have dlopen])],          
162                 [plugins="no"; plugins_reason="package gmodule and dlopen missing"]
163         )
164 fi
165 # plugins
166 AC_ARG_ENABLE(plugins,  [  --disable-plugins          disable plugins], [ plugins=$enableval;plugin_reason="configure parameter" ])
167 if test "x${plugins}" = "xyes"; then
168         AC_ENABLE_SHARED
169         AC_DISABLE_STATIC
170         AC_DEFINE(
171                 [USE_PLUGINS],
172                 [],
173                 Define to 1 if you have plugins.
174         )
175 else
176         AC_DISABLE_SHARED
177         AC_ENABLE_STATIC
178 fi
179 AM_CONDITIONAL(PLUGINS, [test "x$plugins" = "xyes"])
180 AC_PROG_LIBTOOL
181
182 AM_CONDITIONAL(EVENT_GLIB, [test "x$glib" = "xyes"])
183 AM_CONDITIONAL(SUPPORT_GLIB, [test "x$glib" = "xno"])
184 AM_CONDITIONAL(SUPPORT_EZXML, [test "x$glib" = "xno"])
185 AM_CONDITIONAL(MAP_POI_GEODOWNLOAD, [test "x$glib" = "xyes"])
186
187 AC_CHECK_HEADER(
188         zlib.h,
189         AC_DEFINE(
190                 [HAVE_ZLIB],
191                 [],
192                 Define to 1 if you have the <zlib.h> header file.
193         )
194         ZLIB_LIBS="-lz"
195         zlib=yes,
196         ZLIB_CFLAGS="-I\$(top_srcdir)/navit/support/zlib"
197         ZLIB_LIBS="-L\$(top_builddir)/navit/support/zlib -lsupport_zlib"
198         zlib=no
199 )
200 AM_CONDITIONAL(SUPPORT_ZLIB, [test "x$zlib" = "xno"])
201 AC_SUBST(ZLIB_CFLAGS)
202 AC_SUBST(ZLIB_LIBS)
203
204 # gtk
205 PKG_CHECK_MODULES(GTK2, [gtk+-2.0], [gtk2_pkgconfig=yes], [gtk2_pkgconfig=no])
206 if test "x$gtk2_pkgconfig" = "xyes"; then
207         AC_DEFINE(HAVE_GTK2, 1, [Define to 1 if you have gtk2])
208         graphics_gtk_drawing_area=yes; graphics_gtk_drawing_area_reason="gtk+-2.0 present"
209         gui_gtk=yes; gui_gtk_reason="gtk+-2.0 present"
210 fi
211
212 # fsync
213 AC_MSG_CHECKING(for fsync)
214 AC_TRY_LINK([#include <unistd.h>], [fsync(0);],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_FSYNC, 1, [Define to 1 if you have the `fsync' function.]),AC_MSG_RESULT(no))
215
216 # system
217 AC_MSG_CHECKING(for system)
218 AC_TRY_LINK([#include <stdlib.h>], [system("/bin/true");],AC_MSG_RESULT(yes);AC_DEFINE(HAVE_SYSTEM, 1, [Define to 1 if you have the `system' function.]),speech_cmdline=no; speech_cmdline_reason="not supported without system()"; AC_MSG_RESULT(no))
219
220 AC_ARG_ENABLE(graphics-sdl, [  --disable-graphics-sdl             don't create graphics sdl], enable_graphics_sdl=$enableval, enable_graphics_sdl=yes)
221 if test "x${enable_graphics_sdl}" = "xyes" ; then
222         if test -z "$SDL_CONFIG"; then
223             AC_PATH_PROG([SDL_CONFIG], [sdl-config], [])
224         fi
225 fi
226 if test "x${enable_graphics_sdl}" = "xyes" ; then
227         AC_MSG_CHECKING([for SDL libraries with $SDL_CONFIG])
228         if test ! -x "$SDL_CONFIG"; then
229             enable_graphics_sdl = "no"
230             AC_MSG_RESULT([no])
231         else
232             SDL_CFLAGS="`$SDL_CONFIG --cflags`"
233             SDL_LIBS="`$SDL_CONFIG --libs`"
234             AC_SUBST(SDL_CFLAGS)
235             AC_SUBST(SDL_LIBS)
236             AC_MSG_RESULT([yes])
237         fi 
238 fi
239 if test "x${enable_graphics_sdl}" = "xyes" ; then
240         save_CPPFLAGS=$CPPFLAGS
241         CPPFLAGS="$($SDL_CONFIG --cflags) $CPPFLAGS"
242         AC_CHECK_HEADER(SDL_image.h,SDL_IMAGE_LIBS=-lSDL_image,enable_graphics_sdl=no)
243         AC_SUBST(SDL_IMAGE_LIBS)
244         CPPFLAGS=$save_CPPFLAGS
245 fi
246 if test "x${enable_graphics_sdl}" = "xyes" ; then
247         AC_DEFINE(USE_GRAPICS_SDL, 1, [Build with graphics sdl])
248 fi
249 AM_CONDITIONAL(USE_GRAPHICS_SDL, test "x${enable_graphics_sdl}" = "xyes")
250
251 AC_ARG_ENABLE(postgresql, [  --disable-postgresql             don't add postgresql support to osm2navit], postgresql=$enableval;postgresql_reason="configure parameter")
252 if test "x${postgresql}" = "xyes" ; then
253         if test -z "$PG_CONFIG"; then
254             AC_PATH_PROG([PG_CONFIG], [pg_config], [])
255         fi
256         AC_MSG_CHECKING([for PostgreSQL libraries with $PG_CONFIG])
257         if test ! -x "$PG_CONFIG"; then
258             if test "x${PG_CONFIG}" = "x" ; then
259                  postgresql_reason="$PG_CONFIG not executable"
260             else
261                  postgresql_reason="pg_config missing"
262             fi
263             postgresql=no 
264             AC_MSG_RESULT([no])
265         else
266             POSTGRESQL_CFLAGS="-I`$PG_CONFIG --includedir`"
267             POSTGRESQL_LIBS="-L`$PG_CONFIG --libdir` -lpq"
268             AC_DEFINE(HAVE_POSTGRESQL, 1, [Postgresql libraries available])
269             AC_SUBST(POSTGRESQL_CFLAGS)
270             AC_SUBST(POSTGRESQL_LIBS)
271             AC_MSG_RESULT([yes])
272         fi 
273 fi
274 AM_CONDITIONAL(HAVE_POSTGRESQL, test "x${postgresql}" = "xyes")
275 # font
276 # freetype
277 AC_ARG_ENABLE(font-freetype, [  --disable-font-freetype             don't add freetype support], font_freetype=$enableval;font_freetype_reason="configure parameter")
278 if test "x${font_freetype}" = "xyes" -a "x${FREETYPE2_CFLAGS}" = "x" -a "x${FREETYPE2_LIBS}" = "x"; then
279         PKG_CHECK_MODULES(FREETYPE2, [freetype2], , [font_freetype=no;font_freetype_reason="Package freetype2 missing"])
280 fi
281 AC_SUBST(FREETYPE2_CFLAGS)
282 AC_SUBST(FREETYPE2_LIBS)
283 AM_CONDITIONAL(FONT_FREETYPE, test "x${font_freetype}" = "xyes")
284
285 PKG_CHECK_MODULES(FONTCONFIG, [fontconfig], [fontconfig_pkgconfig=yes], [fontconfig_pkgconfig=no])
286 if test "x$fontconfig_pkgconfig" = "xyes"; then
287    AC_DEFINE(HAVE_FONTCONFIG, 1, [Define to 1 if you have fontconfig])
288 fi
289 AC_SUBST(FONTCONFIG_CFLAGS)
290 AC_SUBST(FONTCONFIG_LIBS)
291
292 AM_CONDITIONAL(FONTS, test "x${font_freetype}" = "xyes" -a "x$fontconfig_pkgconfig" != "xyes")
293
294 PKG_CHECK_MODULES(IMLIB2, [imlib2], [imlib2_pkgconfig=yes], [imlib2_pkgconfig=no])
295 if test "x$imlib2_pkgconfig" = "xyes"; then
296    AC_DEFINE(HAVE_IMLIB2, 1, [Define to 1 if you have imlib2])
297 fi
298 AC_SUBST(IMLIB2_CFLAGS)
299 AC_SUBST(IMLIB2_LIBS)
300
301
302
303 AC_ARG_ENABLE(gui-sdl, [  --disable-gui-sdl             don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
304 if test "x$MODULE_GUI_SDL" = "xyes"; then
305         AC_CHECK_HEADER(
306                 SDL/SDL.h,
307                 AC_DEFINE(
308                         [HAVE_LIBSDL],
309                         [],
310                         Define to 1 if you have the <SDL/SDL.h> header file.
311                         )
312                         SDL_LIBS="-lSDL"
313                         sdl=yes,
314                 AC_MSG_WARN([*** no SDL/SDL.h -- SDL support disabled])
315         )
316 fi
317
318 AC_CHECK_HEADER(
319         X11/Xmu/Xmu.h,
320         AC_DEFINE(
321                 [HAVE_XMU],
322                 [],
323                 Define to 1 if you have the <X11/Xmu/Xmu.h> header file.
324                 )
325                 xmu=yes,
326         AC_MSG_WARN([*** no X11/Xmu/Xmu.h -- opengl and SDL support disabled])
327 )
328
329 AC_ARG_ENABLE(graphics-opengl, [  --disable-graphics-opengl      disable graphics type OpenGL], graphics_opengl=$enableval;graphics_opengl_reason="configure parameter")
330 if test "x${graphics_opengl}" = "xyes" ; then
331
332 AC_CHECK_HEADER(
333         GL/gl.h,
334         AC_DEFINE(
335                 [HAVE_OPENGL],
336                 [],
337                 Define to 1 if you have the <GL/gl.h> header file.
338                 )
339                 OPENGL_LIBS="$X_LIBS -lGL -lGLU"
340                 opengl=yes,
341         AC_MSG_WARN([*** no GL/gl.h -- opengl and SDL support disabled];graphics_opengl=no;graphics_opengl_reason="Headers missing")
342 )
343
344 AC_CHECK_HEADER(
345         GL/glut.h,
346         AC_DEFINE(
347                 [HAVE_GLUT],
348                 [],
349                 Define to 1 if you have the <GL/glut.h> header file.
350                 )
351                 glut=yes,
352         AC_MSG_WARN([*** no GL/glut.h -- opengl and SDL support disabled]);graphics_opengl=no;graphics_opengl_reason="Headers missing"
353 )
354
355 AC_SUBST(OPENGL_CFLAGS)
356 AC_SUBST(OPENGL_LIBS)
357
358 AC_CHECK_HEADER(
359         GL/glc.h,
360         AC_DEFINE(
361                 [HAVE_GLC],
362                 [],
363                 Define to 1 if you have the <GL/glc.h> header file.
364                 )
365                 GLC_LIBS="-lGLC"
366                 glc=yes,
367         AC_MSG_WARN([*** no GL/glc.h -- opengl and SDL support disabled])
368 )
369 AC_SUBST(GLC_CFLAGS)
370 AC_SUBST(GLC_LIBS)
371 fi
372
373 AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" -a "x$xmu" = "xyes" ])
374 AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$glut" = "xyes" - "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
375
376
377 if test x"${USE_GARMIN}" = xyes
378 then
379         # check for libgarmin
380         PKG_CHECK_MODULES(LIBGARMIN, libgarmin, use_libgarmin=yes, use_libgarmin=no)
381         AC_SUBST(LIBGARMIN_CFLAGS)
382         AC_SUBST(LIBGARMIN_LIBS)
383 fi
384         AM_CONDITIONAL(HAVELIBGARMIN, [test "x$use_libgarmin" = "xyes"])
385
386 ## binding
387 # python
388 AC_ARG_ENABLE(binding-python, [  --disable-binding-python             don't create binding python], binding_python=$enableval;binding_python_reason="configure parameter")
389 if test "x${binding_python}" = "xyes"; then
390         AC_PATH_PROG(_PATH_PYTHON,[python])
391         dnl Libraries and flags for embedded Python.
392         dnl FIXME: I wish there was a less icky way to get this.
393         if test "x${_PATH_PYTHON}" != "x" ; then
394                 AC_MSG_CHECKING(for Python linkage)
395                 PYTHON_CFLAGS="`python-config --cflags`"
396                 PYTHON_LIBS="`python-config --ldflags`"
397         else
398                 binding_python="no"
399                 binding_python_reason="python executable missing"
400         fi
401 fi
402 if test "x${binding_python}" = xyes ; then
403         AC_DEFINE(USE_BINDING_PYTHON, 1, [Build with binding python])
404 fi
405 AC_SUBST(PYTHON_CFLAGS)
406 AC_SUBST(PYTHON_LIBS)
407 AM_CONDITIONAL(BINDING_PYTHON, test "x${binding_python}" = "xyes")
408
409 # dbus
410 AC_ARG_ENABLE(binding-dbus,   [  --disable-binding-dbus               don't create binding dbus], binding_dbus=$enableval;binding_dbus_reason="configure parameter")
411 if test "x${binding_dbus}" = "xyes" ; then
412         PKG_CHECK_MODULES(DBUS, [dbus-glib-1], ,binding_dbus=no)
413 fi
414 if test "x${binding_dbus}" = "xyes" ; then
415         AC_DEFINE(USE_BINDING_DBUS, 1, [Build with binding dbus])
416 fi
417 AC_SUBST(DBUS_CFLAGS)
418 AC_SUBST(DBUS_LIBS)
419 AM_CONDITIONAL(BINDING_DBUS, test "x${binding_dbus}" = "xyes")
420
421 # svg
422 AC_ARG_ENABLE(svg, [  --disable-svg        disable Scalable Vector Graphics], enable_svg=$enableval, enable_svg=yes)
423 AC_ARG_ENABLE(svg2png, [  --disable-svg2png        disable conversion of svgs to pngs], enable_svg2png=$enableval, enable_svg2png=yes)
424 AC_ARG_ENABLE(svg2png-scaling, [  --enable-svg2png-scaling   enable conversion of svgs to pngs with specified sizes], SVG2PNG_SCALES=$enableval, SVG2PNG_SCALES="8 16 32 48 96")
425 AC_ARG_ENABLE(svg2png-scaling-flag, [  --enable-svg2png-scaling-flag   enable conversion of flag svgs to pngs with specified sizes], SVG2PNG_SCALES_FLAG=$enableval, SVG2PNG_SCALES_FLAG="")
426 AC_ARG_ENABLE(svg2png-scaling-nav, [  --enable-svg2png-scaling-nav   enable conversion of nav svgs to pngs with specified sizes], SVG2PNG_SCALES_NAV=$enableval, SVG2PNG_SCALES_NAV="")
427 AC_ARG_WITH(svg2png-use-convert, [  --with-svg2png-use-convert   use imagemagick's convert for png creation], SVG2PNG_CONVERTER="convert")
428 AC_ARG_WITH(svg2png-use-rsvg-convert, [  --with-svg2png-use-rsvg-convert   use librsvg's rsvg-convert for png creation], SVG2PNG_CONVERTER="rsvg-convert")
429 AC_ARG_WITH(svg2png-use-inkscape, [  --with-svg2png-use-inkscape   use inkscapes internal convert routines for png creation], SVG2PNG_CONVERTER="inkscape")
430 AC_ARG_WITH(svg2png-use-ksvgtopng4, [  --with-svg2png-use-ksvgtopng4   use kde4's ksvgtopng4 for png creation], SVG2PNG_CONVERTER="ksvgtopng4")
431 AC_ARG_WITH(svg2png-use-ksvgtopng, [  --with-svg2png-use-ksvgtopng   use kde3's convert for png creation], SVG2PNG_CONVERTER="ksvgtopng")
432 if test "x${enable_svg2png}" = "xyes" ; then
433     if test "x${SVG2PNG_CONVERTER}" = "x"; then
434         SVG2PNG_CONVERTER="ksvgtopng ksvgtopng4 rsvg-convert inkscape convert"
435     fi
436     AC_PATH_PROGS([SVG2PNG], "${SVG2PNG_CONVERTER}", [none])
437     if test "x${SVG2PNG}" = "xnone"; then
438         enable_svg2png="no"
439     fi
440 fi
441 AC_SUBST(SVG2PNG)
442 AC_SUBST(SVG2PNG_SCALES)
443 AC_SUBST(SVG2PNG_SCALES_FLAG)
444 AC_SUBST(SVG2PNG_SCALES_NAV)
445 AM_CONDITIONAL(USE_SVG2PNG_SCALES, test "x${SVG2PNG_SCALES}" != "xyes" -a "x${SVG2PNG_SCALES}" != "x")
446 AM_CONDITIONAL(USE_SVG2PNG_SCALES_FLAG, test "x${SVG2PNG_SCALES_FLAG}" != "xyes" -a "x${SVG2PNG_SCALES_FLAG}" != "x")
447 AM_CONDITIONAL(USE_SVG2PNG_SCALES_NAV, test "x${SVG2PNG_SCALES_NAV}" != "xyes" -a "x${SVG2PNG_SCALES_NAV}" != "x")
448 AM_CONDITIONAL(USE_SVG2PNG, test "x${enable_svg2png}" = "xyes")
449 AM_CONDITIONAL(USE_SVG, test "x${enable_svg}" = "xyes")
450
451 # NLS
452
453 AC_ARG_ENABLE(nls,
454   [  --disable-nls        disable Native Language Support ( gettext/libintl )],
455    enable_nls=$enableval, enable_nls=yes)
456
457
458 INTLIBS=""
459 MOFILES=""
460 POFILES=""
461 POIFILES=""
462 LINGUAS=""
463
464 if test "x$enable_nls" = "xyes"; then
465
466   AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"] 
467              AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
468                          INTLIBS="" ))
469
470   AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
471   AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
472   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
473
474   if test "$XGETTEXT" != ""; then 
475     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
476         echo "xgettext isn't GNU version"
477         XGETTEXT=""
478     fi
479   fi
480
481   if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
482      PO=""
483      if test "$LINGUAS" = ""; then
484            ling=` (cd $srcdir/po; /bin/ls *.po.in) `
485            for l in $ling; do
486                 lcode=`basename $l .po.in`
487                 LINGUAS="$LINGUAS$lcode "
488            done
489     fi
490     AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
491     echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
492   else
493    LINGUAS=""
494    PO=""
495    echo "xgettext and libintl.a don't both exist; will not build i18n support"
496    enable_nls = no
497  fi
498  for lang in $LINGUAS; do
499     MOFILES="$MOFILES $lang.mo"
500  done
501  for lang in $LINGUAS; do
502     POFILES="$POFILES $lang.po"
503  done
504  for lang in $LINGUAS; do
505     POIFILES="$POIFILES $lang.po.in"
506  done
507
508 AC_SUBST(INTLIBS)
509 AC_SUBST(MOFILES)
510 AC_SUBST(POFILES)
511 AC_SUBST(POIFILES)
512 AM_GNU_GETTEXT_VERSION
513 AM_GNU_GETTEXT(no-libtool, need-ngettext, \$(top_builddir)/intl/)
514 AC_SUBST(LIBINTL)
515 AC_SUBST(LTLIBINTL)
516 if test x"$LIBINTL" != "x" ;then
517         CFLAGS="$CFLAGS -I\$(top_builddir)/intl/"
518 fi
519
520 fi
521 AM_CONDITIONAL(ENABLE_NLS, [test "x$enable_nls" = "xyes"])
522 AC_CHECK_HEADER(
523         byteswap.h,
524         AC_DEFINE(
525                 [HAVE_BYTESWAP_H],
526                 [1],
527                 [Define to 1 if you have byteswap.h],
528                 )
529                 ,
530 )
531
532 PACKAGE=navit
533 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
534 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
535 AC_SUBST(PACKAGE)
536 AC_SUBST(VERSION)
537
538 AC_CHECK_HEADER(wordexp.h,wordexp_h=yes,wordexp_h=no;NAVIT_CFLAGS="$NAVIT_CFLAGS -I\$(top_srcdir)/navit/support/wordexp";NAVIT_LIBS="$NAVIT_LIBS -L\$(top_builddir)/navit/support/wordexp -lsupport_wordexp")
539 AM_CONDITIONAL(SUPPORT_WORDEXP, [test "x$wordexp_h" = "xno"])
540
541 AC_CANONICAL_HOST
542 win32=no
543 win32ce=no
544 case $host_os in
545 wince)
546         win32=yes
547         win32ce=yes
548         AC_DEFINE(HAVE_API_WIN32_BASE, 1, [Have Windows Base API])
549         AC_DEFINE(HAVE_API_WIN32_CE, 1, [Have Windows CE API])
550         gui_win32=yes; gui_win32_reason="host_os is wince"
551         graphics_win32=yes; graphics_win32_reason="host_os is wince"
552         vehicle_wince=yes; vehcile_wince_reason="host_os is wince"
553         ;;
554 mingw32)
555         win32=yes
556         AC_DEFINE(HAVE_API_WIN32_BASE, 1, [Have Windows Base API])
557         AC_DEFINE(HAVE_API_WIN32, 1, [Have Windows API])
558         gui_win32=yes; gui_win32_reason="host_os is mingw32"
559         graphics_win32=yes; graphics_win32_reason="host_os is mingw32"
560 esac
561 if test "x$win32" = "xyes"
562 then
563         NAVIT_CFLAGS="$NAVIT_CFLAGS -I\$(top_srcdir)/navit/support/win32"
564         NAVIT_LIBS="$NAVIT_LIBS -L\$(top_builddir)/navit/support/win32 -lsupport_win32"
565 fi
566 AM_CONDITIONAL(SUPPORT_WIN32, [test "x$win32" = "xyes"])
567 AM_CONDITIONAL(SUPPORT_WIN32CE, [test "x$win32ce" = "xyes"])
568
569 LIBS="$LIBS -lm"
570 if test "$win32" == "no"; then
571         LIBS="$LIBS -rdynamic"
572 fi
573
574 support_libc=no
575 AC_ARG_ENABLE(support_libc, [  --enable-support-libc enable builtin mini libc ], support_libc=$enableval)
576 AM_CONDITIONAL(SUPPORT_LIBC, [test "x$support_libc" = "xyes"])
577 if test "x$support_libc" = "xyes"; then
578         CFLAGS="$CFLAGS -I\$(top_srcdir)/navit/support/libc"
579 fi
580
581 ## graphics
582 # gd
583 AC_ARG_ENABLE(graphics-gd, [  --enable-graphics-gd                enable graphics type gd], graphics_gd=$enableval;graphics_gd_reason="configure parameter")
584 if test "x${graphics_gd}" = "xyes" ; then
585         if test -z "$GDLIB_CONFIG"; then
586             AC_PATH_PROG([GDLIB_CONFIG], [gdlib-config], [])
587         fi
588         AC_MSG_CHECKING([for gdlib with $GDLIB_CONFIG])
589         if test ! -x "$GDLIB_CONFIG"; then
590             if test "x${GDLIB_CONFIG}" = "x" ; then
591                  graphics_gd_reason="$GDLIB_CONFIG not executable"
592             else
593                  graphics_gd_reason="gdlib-config missing"
594             fi
595             graphics_gd=no 
596             AC_MSG_RESULT([no])
597         else
598             GD_CFLAGS="-I`$GDLIB_CONFIG --includedir`"
599             GD_LIBS="-L`$GDLIB_CONFIG --libdir` -lgd `$GDLIB_CONFIG --libs`"
600             AC_SUBST(GD_CFLAGS)
601             AC_SUBST(GD_LIBS)
602             AC_MSG_RESULT([yes])
603         fi 
604 fi
605 AM_CONDITIONAL(GRAPHICS_GD, test "x${graphics_gd}" = "xyes")
606 # gtk_drawing_area
607 AC_ARG_ENABLE(graphics-gtk-drawing-area, [  --disable-graphics-gtk-drawing-area disable graphics type gtk_drawing_area], graphics_gtk_drawing_area=$enableval;graphics_gtk_drawing_area_reason="configure parameter")
608 AM_CONDITIONAL(GRAPHICS_GTK_DRAWING_AREA, [test "x${graphics_gtk_drawing_area}" = "xyes"])
609 # win32
610 AC_ARG_ENABLE(graphics-win32, [  --disable-graphics-win32            disable graphics type win32], graphics_win32=$enableval;graphics_win32_reason="configure parameter")
611 AM_CONDITIONAL(GRAPHICS_WIN32, test "x${graphics_win32}" = "xyes")
612 # qt_qpainter
613 AC_ARG_ENABLE(graphics-qt-qpainter, [  --disable-graphics-qt-qpainter      disable graphics type qt-qpainter], graphics_qt_qpainter=$enableval;graphics_qt_qpainter_reason="configure parameter")
614 if test "x${graphics_qt_qpainter}" = "xyes" -a "x${QT_GUI_CFLAGS}" = "x" -a "x${QT_GUI_LIBS}" = "x"; then
615         PKG_CHECK_MODULES(QT_GUI, [QtGui QtCore], ,graphics_qt_qpainter=no,graphics_qt_qpainter_reason="Packages QtGui and/or QtCore missing")
616 fi
617 if test "x${graphics_qt_qpainter}" = "xyes" ; then
618         AC_DEFINE(USE_GRAPICS_QT_QPAINTER, 1, [Build with graphics qt_qpainter])
619 fi
620 AC_SUBST(QT_GUI_CFLAGS)
621 AC_SUBST(QT_GUI_LIBS)
622 AM_CONDITIONAL(GRAPHICS_QT_QPAINTER, test "x${graphics_qt_qpainter}" = "xyes")
623
624 ## gui
625 # gtk
626 AC_ARG_ENABLE(gui-gtk, [  --disable-gui-gtk                   disable gui type gtk ], gui_gtk=$enableval)
627 AM_CONDITIONAL(GUI_GTK, [test "x${gui_gtk}" = "xyes"])
628 # internal
629 AC_ARG_ENABLE(gui-internal, [  --disable-gui-internal              disable gui type internal], gui_internal=$enableval;gui_internal_reason="configure parameter")
630 AM_CONDITIONAL(GUI_INTERNAL, test "x${gui_internal}" = "xyes")
631 # win32
632 AC_ARG_ENABLE(gui-win32, [  --disable-gui-win32                 disable gui type win32], gui_win32=$enableval;gui_win32_reason="configure parameter")
633 AM_CONDITIONAL(GUI_WIN32, test "x${gui_win32}" = "xyes")
634
635 ## speech
636 # cmdline
637 AC_ARG_ENABLE(speech-cmdline, [  --disable-speech-cmdline            disable speech type cmdline], speech_cmdline=$enableval;speech_cmdline_reason="configure parameter")
638 AM_CONDITIONAL(SPEECH_CMDLINE, test "x${speech_cmdline}" = "xyes")
639 # cmdline
640 AC_ARG_ENABLE(speech-speechd, [  --disable-speech-speech-dispatcher  disable speech type speech-dispatcher], speech_speech_dispatcher=$enableval;speech_speech_dispatcher_reason="configure parameter")
641 if test "x$speech_speech_dispatcher" = "xyes"; then
642         AC_CHECK_HEADER(libspeechd.h, AC_DEFINE([HAVE_LIBSPEECHD],[],Define to 1 if you have the <libspeechd.h> header file.) SPEECHD_LIBS="-lspeechd",  speech_speech_dispatcher=no; speech_speech_dispatcher_reason="libspeechd.h missing")
643 fi
644 AC_SUBST(SPEECHD_CFLAGS)
645 AC_SUBST(SPEECHD_LIBS)
646 AM_CONDITIONAL(SPEECH_SPEECH_DISPATCHER, test "x${speech_speech_dispatcher}" = "xyes")
647
648 ## vehicle
649 # demo
650 AC_ARG_ENABLE(vehicle-demo, [  --disable-vehicle-demo              disable vehicle type demo], vehicle_demo=$enableval;vehicle_demo_reason="configure parameter")
651 AM_CONDITIONAL(VEHICLE_DEMO, test "x${vehicle_demo}" = "xyes")
652 # file
653 AC_ARG_ENABLE(vehicle-file, [  --disable-vehicle-file              disable vehicle type file], vehicle_file=$enableval;vehicle_file_reason="configure parameter")
654 AM_CONDITIONAL(VEHICLE_FILE, test "x${vehicle_file}" = "xyes")
655 # gpsd
656 AC_ARG_ENABLE(vehicle-gpsd, [  --disable-vehicle-gpsd              disable vehicle type gpsd], vehicle_gpsd=$enableval;vehicle_gpsd_reason="configure parameter")
657 if test "x${vehicle_gpsd}" = xyes
658 then
659         AC_CHECK_HEADER(gps.h, AC_DEFINE([HAVE_LIBGPS],[],Define to 1 if you have the <gps.h> header file.) GPSD_LIBS="-lgps", vehicle_gpsd=no; vehicle_gpsd_reason="no gps.h" )
660 fi
661 AC_SUBST(GPSD_CFLAGS)
662 AC_SUBST(GPSD_LIBS)
663 AM_CONDITIONAL(VEHICLE_GPSD, [test "x${vehicle_gpsd}" = "xyes"])
664 # gypsy
665 AC_ARG_ENABLE(vehicle-gypsy,[  --disable-vehicle-gypsy             disable vehicle type gypsy], vehicle_gypsy=$enableval;vehicle_gypsy_reason="configure parameter")
666 if test "x${vehicle_gypsy}" = "xyes"
667 then
668         PKG_CHECK_MODULES(GYPSY, gypsy, ,vehicle_gypsy=no;vehicle_gypsy_reason="package gypsy missing")
669 fi
670 AC_SUBST(GYPSY_CFLAGS)
671 AC_SUBST(GYPSY_LIBS)
672 AM_CONDITIONAL(VEHICLE_GYPSY, test "x${vehicle_gypsy}" = "xyes")
673 # wince
674 AC_ARG_ENABLE(vehicle-wince, [  --disable-vehicle-wince             disable vehicle type wince], vehicle_wince=$enableval;vehicle_wince_reason="configure parameter")
675 AM_CONDITIONAL(VEHICLE_WINCE, test "x${vehicle_wince}" = "xyes")
676
677 NAVIT_CFLAGS="$NAVIT_CFLAGS $GLIB_CFLAGS $GMODULE_CFLAGS"
678 NAVIT_LIBS="$NAVIT_LIBS $GLIB_LIBS $GMODULE_LIBS $LIBINTL"
679 AC_SUBST(NAVIT_CFLAGS)
680 AC_SUBST(NAVIT_LIBS)
681 AC_SUBST(WINDRES)
682
683 AC_CONFIG_FILES([
684 Makefile
685 navit/Makefile
686 navit/binding/Makefile
687 navit/binding/python/Makefile
688 navit/binding/dbus/Makefile
689 navit/map/Makefile
690 navit/map/mg/Makefile
691 navit/map/textfile/Makefile
692 navit/map/shapefile/Makefile
693 navit/map/binfile/Makefile
694 navit/map/garmin/Makefile
695 navit/map/poi_geodownload/Makefile
696 navit/map/poi_geodownload/libmdb/Makefile
697 navit/map/poi_geodownload/libmdb/include/Makefile
698 navit/fib-1.1/Makefile
699 navit/font/Makefile
700 navit/font/freetype/Makefile
701 navit/fonts/Makefile
702 navit/graphics/Makefile
703 navit/graphics/gd/Makefile
704 navit/graphics/gtk_drawing_area/Makefile
705 navit/graphics/opengl/Makefile
706 navit/graphics/null/Makefile
707 navit/graphics/sdl/Makefile
708 navit/graphics/qt_qpainter/Makefile
709 navit/graphics/win32/Makefile
710 navit/gui/Makefile
711 navit/gui/gtk/Makefile
712 navit/gui/internal/Makefile
713 navit/gui/win32/Makefile
714 navit/osd/Makefile
715 navit/osd/core/Makefile
716 navit/speech/Makefile
717 navit/speech/cmdline/Makefile
718 navit/speech/speech_dispatcher/Makefile
719 navit/support/Makefile
720 navit/support/ezxml/Makefile
721 navit/support/glib/Makefile
722 navit/support/libc/Makefile
723 navit/support/win32/Makefile
724 navit/support/wordexp/Makefile
725 navit/support/zlib/Makefile
726 navit/vehicle/Makefile
727 navit/vehicle/file/Makefile
728 navit/vehicle/gpsd/Makefile
729 navit/vehicle/gypsy/Makefile
730 navit/vehicle/demo/Makefile
731 navit/vehicle/wince/Makefile
732 navit/xpm/Makefile
733 navit/maps/Makefile
734 intl/Makefile
735 po/Makefile
736 ])
737 #src/data/garmin_img/Makefile
738
739 AC_OUTPUT
740
741
742 echo ""
743 echo ""
744 echo "Summary of your installation :"
745 # FIXME : maybe elaborate missing dependencies
746 if test x"$sdl" != xyes
747         then
748         sdl_failures="(libsdl maybe?) "
749 fi
750 if test x"$xmu" != xyes
751         then                
752         sdl_failures=$sdl_failures"libxmu "
753 fi        
754 if test x"$glut" != xyes
755        then
756         sdl_failures=$sdl_failures"glut "
757 fi
758 if test x"$glc" != xyes
759         then
760         sdl_failures=$sdl_failures"quesoglc "
761 fi
762 if test -z "$sdl_failures"
763         then
764         echo "OpenGL gui  : ENABLED, with $CEGUI_LIBS"
765         else
766                  echo "OpenGL gui  : DISABLED : you are missing $sdl_failures"
767 fi
768 if test x"$enable_hildon" = xyes
769         then
770         echo "Maemo/Hildon: ENABLED"
771         else
772         echo "Maemo/Hildon: DISABLED"
773 fi
774 if test x"${USE_GARMIN}" = xyes
775         then
776         if test "x$use_libgarmin" = "xyes"
777                 then
778                 echo "Garmin IMG  : ENABLED"
779                 else
780                 echo "Garmin IMG  : DISABLED (you don't have libgarmin)"
781         fi
782         else 
783                 echo "Garmin IMG  : DISABLED (you requested it)"
784 fi
785
786 if test x"$LIBINTL" = "x" ;then
787         nls_libs="system gettext support"
788 else
789         nls_libs="$LIBINTL"
790 fi
791 echo "Plugins:             $plugins ($plugins_reason)"
792 echo "Postgresql:          $postgresql ($postgresql_reason)"
793 echo "Samplemap:           $samplemap ($samplemap_reason)"
794 echo "NLS Support:         $enable_nls ($nls_libs)"
795 echo "Font renderers:"
796 echo "  freetype:          $font_freetype ($font_freetype_reason)"
797 echo "Graphics types:"
798 echo "  gtk_drawing_area:  $graphics_gtk_drawing_area ($graphics_gtk_drawing_area_reason)"
799 echo "  qt_qpainter:       $graphics_qt_qpainter ($graphics_qt_qpainter_reason)"
800 echo "  win32:             $graphics_win32 ($graphics_win32_reason)"
801 echo "  OpenGL:            $graphics_opengl ($graphics_opengl_reason)"
802 echo "  gd:                $graphics_gd ($graphics_gd_reason)"
803
804 echo "GUI types:"
805 echo "  gtk:               $gui_gtk ($gui_gtk_reason)"
806 echo "  internal:          $gui_internal ($gui_internal_reason)"
807 echo "  win32:             $gui_win32 ($gui_win32_reason)"
808
809 echo "Bindings:"
810 echo "  dbus:              $binding_dbus ($binding_dbus_reason)"
811 echo "  python:            $binding_python ($binding_python_reason)"
812
813 echo "Speech types:"
814 echo "  cmdline:           $speech_cmdline ($speech_cmdline_reason)"
815 echo "  speech_dispatcher: $speech_speech_dispatcher ($speech_speech_dispatcher_reason)"
816
817 echo "Vehicle types:"
818 echo "  demo:              $vehicle_demo ($vehicle_demo_reason)"
819 echo "  file:              $vehicle_file ($vehicle_file_reason)"
820 echo "  gpsd:              $vehicle_gpsd ($vehicle_gpsd_reason)"
821 echo "  gypsy:             $vehicle_gypsy ($vehicle_gypsy_reason)"
822 echo "  wince:             $vehicle_wince ($vehicle_wince_reason)"
823
824 if  test "x${gtk2_pkgconfig}" != "xyes" -a "x${gui_win32}" != "xyes" -a "x${gui_internal}" != "xyes"
825 then
826         echo ""
827         echo "" 
828         echo "*** WARNING! you have no gui that can be built! ***"
829         echo "Please install the dependency for at least gtk or sdl gui"
830         echo "For more details, see the wiki at http://wiki.navit-project.org/"
831         echo "" 
832         exit 1
833 fi
834