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