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