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