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