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