Add:core:Added --disable-garmin to configure
[navit-package] / configure.in
1 AC_INIT(navit, 0.0.4)
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 AC_PROG_CXX
17 if eval "test x$GXX = xyes"; then
18         CXXFLAGS="$CXXFLAGS -Wall -Wcast-align -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wreturn-type -D_GNU_SOURCE"
19 fi
20
21 PKG_CHECK_EXISTS
22
23 AC_ARG_ENABLE(plugins,  [  --disable-plugins          disable plugins], 
24                         [
25                                 AC_DISABLE_SHARED
26                                 AC_ENABLE_STATIC
27                                 plugins=$enableval
28                         ],
29                         [
30                                 AC_ENABLE_SHARED
31                                 AC_DISABLE_STATIC
32                                 AC_DEFINE(
33                                         [USE_PLUGINS],
34                                         [],
35                                         Define to 1 if you have plugins.
36                                 )
37                                 plugins=yes
38                         ]
39 )
40 AC_PROG_LIBTOOL
41
42 AC_ARG_ENABLE(avoid-unaligned, [  --enable-avoid-unaligned          avoid unaligned accesses], AVOID_UNALIGNED=$enableval, AVOID_UNALIGNED=no)
43 test x"${AVOID_UNALIGNED}" = xyes && AC_DEFINE(AVOID_UNALIGNED,[],Define to avoid unaligned access)
44
45 AC_ARG_ENABLE(avoid-float, [  --enable-avoid-float              avoid floating point calculations], AVOID_FLOAT=$enableval, AVOID_FLOAT=no)
46 test x"${AVOID_FLOAT}" = xyes && AC_DEFINE(AVOID_FLOAT,[],Define to avoid floating point)
47
48 AC_ARG_ENABLE(libgps, [  --disable-libgps             don't use libgps], USE_LIBGPS=$enableval, USE_LIBGPS=yes)
49 AC_ARG_ENABLE(garmin, [  --disable-garmin             disable garmin support], USE_GARMIN=$enableval, USE_GARMIN=yes)
50
51 AC_ARG_ENABLE(samplemap, [  --disable-samplemap             don't build the samplemap], samplemap=$enableval, samplemap=yes)
52 AM_CONDITIONAL(BUILD_SAMPLEMAP, [test "x$samplemap" = "xyes"])
53
54 AC_ARG_ENABLE(fastmath, [  --disable-fastmath             don't build with fastmath], fastmath=$enableval, fastmath=yes)
55 AM_CONDITIONAL(FASTMATH, [test "x$fastmath" = "xyes"])
56
57 if test x"$fastmath" = xyes; then
58         if eval "test x$GCC = xyes"; then
59                 CFLAGS="$CFLAGS -ffast-math"
60         fi
61 fi
62
63 X_CFLAGS="-I$x_includes"
64 X_LIBS="-L$ac_x_libraries"
65
66 PKG_CHECK_MODULES(NAVIT, [glib-2.0 gmodule-2.0], [], AC_MSG_ERROR([glib-2.0 or gmodule-2.0 not found. Usually you need to install a package named glib2-devel or libglib2.0-dev]))
67 AC_SUBST(NAVIT_CFLAGS)
68 AC_SUBST(NAVIT_LIBS)
69
70 AC_CHECK_HEADER(
71         zlib.h,
72         AC_DEFINE(
73                 [HAVE_ZLIB],
74                 [],
75                 Define to 1 if you have the <zlib.h> header file.
76                 )
77                 ZLIB_LIBS="-lz",
78         AC_MSG_WARN([*** no zlib.h\ -- reduced functionality of osm2navit])
79         )
80 AC_SUBST(ZLIB_LIBS)
81
82 AC_ARG_ENABLE(gui-gtk, [  --disable-gui-gtk             don't create gui gtk ], MODULE_GUI_GTK=$enableval, MODULE_GUI_GTK=yes)
83 if test "x$MODULE_GUI_GTK" = "xyes"; then
84         PKG_CHECK_MODULES(GTK2, [gtk+-2.0], [gtk2_pkgconfig=yes], [gtk2_pkgconfig=no])
85         if test "x$gtk2_pkgconfig" = "xyes"; then
86                 AC_DEFINE(HAVE_GTK2, 1, [Define to 1 if you have imlib2])
87         fi
88 fi
89
90 GTK2_CFLAGS="$GTK2_CFLAGS -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED"
91
92 AC_SUBST(GTK2_CFLAGS)
93 AC_SUBST(GTK2_LIBS)
94 AM_CONDITIONAL(GUI_GTK, [test "x$gtk2_pkgconfig" = "xyes"])
95 AM_CONDITIONAL(GRAPHICS_GTK_DRAWING_AREA, [test "x$gtk2_pkgconfig" = "xyes"])
96 AM_CONDITIONAL(PLUGINS, [test "x$plugins" = "xyes"])
97
98 PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_pkgconfig=yes], [freetype2_pkgconfig=no])
99 if test "x$freetype2_pkgconfig" = "xyes"; then
100    AC_DEFINE(HAVE_FREETYPE2, 1, [Define to 1 if you have imlib2])
101 fi
102 AC_SUBST(FREETYPE2_CFLAGS)
103 AC_SUBST(FREETYPE2_LIBS)
104
105 PKG_CHECK_MODULES(IMLIB2, [imlib2], [imlib2_pkgconfig=yes], [imlib2_pkgconfig=no])
106 if test "x$imlib2_pkgconfig" = "xyes"; then
107    AC_DEFINE(HAVE_IMLIB2, 1, [Define to 1 if you have imlib2])
108 fi
109 AC_SUBST(IMLIB2_CFLAGS)
110 AC_SUBST(IMLIB2_LIBS)
111
112
113 AC_ARG_ENABLE(speech-speechd, [  --disable-speech-speechd             don't create speech speechd ], MODULE_SPEECH_SPEECHD=$enableval, MODULE_SPEECH_SPEECHD=yes)
114 if test "x$MODULE_SPEECH_SPEECHD" = "xyes"; then
115         AC_CHECK_HEADER(libspeechd.h, AC_DEFINE([HAVE_LIBSPEECHD],[],Define to 1 if you have the <libspeechd.h> header file.) SPEECHD_LIBS="-lspeechd" speechd=yes,  AC_MSG_WARN([*** no libspeechd.h -- Speech output disabled]))
116 fi
117 AC_SUBST(SPEECHD_CFLAGS)
118 AC_SUBST(SPEECHD_LIBS)
119 AM_CONDITIONAL(SPEECH_SPEECH_DISPATCHER, [test "x$speechd" = "xyes"])
120
121
122 AC_ARG_ENABLE(gui-sdl, [  --disable-gui-sdl             don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
123 if test "x$MODULE_GUI_SDL" = "xyes"; then
124         AC_CHECK_HEADER(
125                 SDL/SDL.h,
126                 AC_DEFINE(
127                         [HAVE_LIBSDL],
128                         [],
129                         Define to 1 if you have the <SDL/SDL.h> header file.
130                         )
131                         SDL_LIBS="-lSDL"
132                         sdl=yes,
133                 AC_MSG_WARN([*** no SDL/SDL.h -- SDL support disabled])
134         )
135 fi
136 AC_SUBST(SDL_CFLAGS)
137 AC_SUBST(SDL_LIBS)
138
139 PKG_CHECK_MODULES(
140         [CEGUI],
141         [CEGUI-OPENGL >= 0.5.0],
142         [
143                 AC_DEFINE(
144                         [HAVE_CEGUI],
145                         [],
146                         [Define to 1 if you have the @<:@CEGUI/CEGUI.h@:>@ header file.])
147                 cegui=yes
148         ],
149         [AC_MSG_WARN([*** CEGUI not found -- SDL support disabled])]
150 )
151
152 AC_CHECK_HEADER(
153         GL/gl.h,
154         AC_DEFINE(
155                 [HAVE_OPENGL],
156                 [],
157                 Define to 1 if you have the <GL/gl.h> header file.
158                 )
159                 OPENGL_LIBS="$X_LIBS -lGL -lGLU"
160                 opengl=yes,
161         AC_MSG_WARN([*** no GL/gl.h -- opengl and SDL support disabled])
162 )
163
164 AC_CHECK_HEADER(
165         GL/glut.h,
166         AC_DEFINE(
167                 [HAVE_GLUT],
168                 [],
169                 Define to 1 if you have the <GL/glut.h> header file.
170                 )
171                 glut=yes,
172         AC_MSG_WARN([*** no GL/glut.h -- opengl and SDL support disabled])
173 )
174
175 AC_SUBST(OPENGL_CFLAGS)
176 AC_SUBST(OPENGL_LIBS)
177
178 AC_CHECK_HEADER(
179         GL/glc.h,
180         AC_DEFINE(
181                 [HAVE_GLC],
182                 [],
183                 Define to 1 if you have the <GL/glc.h> header file.
184                 )
185                 GLC_LIBS="-lGLC"
186                 glc=yes,
187         AC_MSG_WARN([*** no GL/glc.h -- opengl and SDL support disabled])
188 )
189 AC_SUBST(GLC_CFLAGS)
190 AC_SUBST(GLC_LIBS)
191
192 if test x"$cegui" = xyes         
193                 then     
194          # Save the LIBS into a temp var since AC_CHECK_LIB adds the lib into LIBS       
195          # and we want just to check and use CEGUI_LIBS          
196          libstemp="$LIBS"        
197          # For CEGUI, we have to check the presence of some libraries.   
198          # The following are mandatory (used by navit)   
199          # If the user installed NavIt without, issue a warning and disable CEGUI        
200          AC_CHECK_LIB(CEGUIBase, main,   
201                   [],    
202                   [      
203                  echo "Error! Something is wrong with CEGUIBase. Do you have at least cegui-0.5?"        
204                  exit -1         
205                  ])      
206          AC_CHECK_LIB(CEGUIOpenGLRenderer, main,         
207                   [],    
208                   [      
209                  echo "Error! Something is wrong with CEGUIOpenGLRenderer. Do you have at least cegui-0.5? "     
210                  exit -1         
211                  ], $OPENGL_LIBS )       
212          AC_CHECK_LIB(CEGUIFalagardWRBase, main,         
213                   [],    
214                   [      
215                  echo "Error! Something is wrong with CEGUIFalagardWRBase. Do you have at least cegui-0.5?"      
216                  exit -1         
217                  ], $OPENGL_LIBS)        
218          CEGUI_LIBS="-lCEGUIBase -lCEGUIOpenGLRenderer -lCEGUIFalagardWRBase"    
219                  
220          # The following are optionnal, but we need to link against them if cegui was built with them    
221          libssilly="$OPENGL_LIBS -lpng"          
222          AC_CHECK_LIB(CEGUISILLYImageCodec, createImageCodec,    
223                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUISILLYImageCodec"],     
224                   [echo "CEGUISILLYImageCodec not found/not working, disabled."],        
225                   $libssilly     
226          )       
227                  
228          AC_CHECK_LIB(CEGUIXercesParser, main,   
229                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIXercesParser"],        
230                   [echo "CEGUIXercesParser not found/not working, disabled."],   
231                   $OPENGL_LIBS   
232          )       
233                  
234          AC_CHECK_LIB(CEGUIExpatParser, main,    
235                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIExpatParser"],         
236                   [echo "CEGUIExpatParser not found/not working, disabled."],    
237                   $OPENGL_LIBS   
238          )       
239                  
240          AC_CHECK_LIB(CEGUILibxmlParser, main,   
241                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUILibxmlParser"],        
242                   [echo "CEGUILibxmlParser not found/not working, disabled."],   
243                   $OPENGL_LIBS   
244          )       
245                  
246          AC_CHECK_LIB(CEGUITinyXMLParser, main,          
247                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUITinyXMLParser"],       
248                   [echo "CEGUITinyXMLParser not found/not working, disabled."],          
249                   $OPENGL_LIBS   
250          )       
251                  
252          AC_CHECK_LIB(CEGUIDevILImageCodec, main,        
253                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUIDevILImageCodec"],     
254                   [echo "CEGUIDevILImageCodec not found/not working, disabled."],        
255                   $OPENGL_LIBS   
256          )       
257                  
258          AC_CHECK_LIB(CEGUITGAImageCodec, createImageCodec,      
259                   [CEGUI_LIBS="$CEGUI_LIBS -lCEGUITGAImageCodec"],       
260                   [echo "GUITGAImageCodec not found/not working, disabled."],    
261                   $OPENGL_LIBS   
262          )       
263                  
264          LIBS="$libstemp"        
265          echo "LIBS : $CEGUI_LIBS"       
266          fi
267
268 AC_SUBST(CEGUI_CFLAGS)
269 AC_SUBST(CEGUI_LIBS)
270
271 AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$cegui" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
272 AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
273
274
275 if test x"${USE_LIBGPS}" = xyes
276 then
277         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]))
278 fi
279 AC_SUBST(GPSD_CFLAGS)
280 AC_SUBST(GPSD_LIBS)
281 AM_CONDITIONAL(VEHICLE_GPSD, [test "x$gpsd" = "xyes"])
282
283 if test x"${USE_GARMIN}" = xyes
284 then
285         # check for libgarmin
286         PKG_CHECK_MODULES(LIBGARMIN, libgarmin, use_libgarmin=yes, use_libgarmin=no)
287         AC_SUBST(LIBGARMIN_CFLAGS)
288         AC_SUBST(LIBGARMIN_LIBS)
289 fi
290         AM_CONDITIONAL(HAVELIBGARMIN, [test "x$use_libgarmin" = "xyes"])
291
292
293 AC_ARG_ENABLE(binding-python, [  --disable-binding-python             don't create binding python ], MODULE_BINDING_PYTHON=$enableval, MODULE_BINDING_PYTHON=yes)
294 if test "$cross_compiling" = no; then
295         if test "x$MODULE_BINDING_PYTHON" = "xyes"; then
296                 AC_PATH_PROG(_PATH_PYTHON,[python])
297                 dnl Libraries and flags for embedded Python.
298                 dnl FIXME: I wish there was a less icky way to get this.
299                 if test x"$_PATH_PYTHON" != x ; then
300                         AC_MSG_CHECKING(for Python linkage)
301                         py_prefix=`$_PATH_PYTHON -c 'import sys; print sys.prefix'`
302                         py_ver=`$_PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
303                         py_libdir="${py_prefix}/lib/python${py_ver}"
304                         PYTHON_CFLAGS="-I${py_prefix}/include/python${py_ver}"
305                         if test -f $py_libdir/config/Makefile -a -f $py_prefix/include/python${py_ver}/Python.h; then
306                                 py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
307                                 py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
308                                 py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
309                                 py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
310                                 py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
311                                 PYTHON_LIBS="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
312                                 PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
313                                 AC_DEFINE(HAVE_PYTHON, 1, [Define to 1 if you have python])
314                                 python=yes
315                                 AC_MSG_RESULT($py_libdir)
316                         else
317                                 AC_MSG_WARN([$py_libdir/config/Makefile or $py_prefix/include/python${py_ver}/Python.h missing, support for python disabled])
318                         fi
319                 fi
320         fi
321 else
322         AC_MSG_WARN([*** cross compiling, support for python disabled])
323 fi
324 AC_SUBST(PYTHON_CFLAGS)
325 AC_SUBST(PYTHON_LIBS)
326 AM_CONDITIONAL(BINDING_PYTHON, [test "x$python" = "xyes"])
327
328 # NLS
329
330 AC_ARG_ENABLE(nls,
331   [  --disable-nls        disable Native Language Support ( gettext/libintl )],
332    enable_nls=$enableval, enable_nls=yes)
333
334
335 INTLIBS=""
336 MOFILES=""
337 POFILES=""
338 LINGUAS=""
339
340 if test x$enable_nls = xyes; then
341
342   AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
343              AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
344                          INTLIBS="" ))
345
346   AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
347   AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
348   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
349
350   if test "$XGETTEXT" != ""; then 
351     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
352         echo "xgettext isn't GNU version"
353         XGETTEXT=""
354     fi
355   fi
356
357   if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
358      PO=""
359      if test "$LINGUAS" = ""; then
360            ling=` (cd $srcdir/po; /bin/ls *.po) `
361            for l in $ling; do
362                 lcode=`basename $l .po`
363                 LINGUAS="$LINGUAS$lcode "
364            done
365     fi
366     AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
367     echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
368   else
369    LINGUAS=""
370    PO=""
371    echo "xgettext and libintl.a don't both exist; will not build i18n support"
372  fi
373  for lang in $LINGUAS; do
374     MOFILES="$MOFILES $lang.mo"
375  done
376  for lang in $LINGUAS; do
377     POFILES="$POFILES $lang.po"
378  done
379 fi
380
381
382 AC_SUBST(INTLIBS)
383 AC_SUBST(MOFILES)
384 AC_SUBST(POFILES)
385 AM_GNU_GETTEXT_VERSION
386 AM_GNU_GETTEXT
387
388 LIBS="$LIBS -lm -rdynamic"
389
390 PACKAGE=navit
391 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
392 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
393 AC_SUBST(PACKAGE)
394 AC_SUBST(VERSION)
395
396 AC_CONFIG_FILES([
397 Makefile
398 src/Makefile
399 src/binding/Makefile
400 src/binding/python/Makefile
401 src/data/Makefile
402 src/data/mg/Makefile
403 src/data/textfile/Makefile
404 src/data/binfile/Makefile
405 src/data/garmin/Makefile
406 src/data/poi_geodownload/Makefile
407 src/data/poi_geodownload/libmdb/Makefile
408 src/data/poi_geodownload/libmdb/include/Makefile
409 src/fib-1.1/Makefile
410 src/graphics/Makefile
411 src/graphics/gtk_drawing_area/Makefile
412 src/graphics/opengl/Makefile
413 src/graphics/null/Makefile
414 src/gui/Makefile
415 src/gui/gtk/Makefile
416 src/gui/sdl/Makefile
417 src/gui/sdl/datafiles/Makefile
418 src/osd/Makefile
419 src/osd/core/Makefile
420 src/speech/Makefile
421 src/speech/cmdline/Makefile
422 src/speech/speech_dispatcher/Makefile
423 src/vehicle/Makefile
424 src/vehicle/file/Makefile
425 src/vehicle/gpsd/Makefile
426 src/vehicle/demo/Makefile
427 src/xpm/Makefile
428 src/maps/Makefile
429 intl/Makefile
430 po/Makefile
431 ])
432 #src/data/garmin_img/Makefile
433
434 AC_OUTPUT
435
436
437 echo ""
438 echo ""
439 echo "Summary of your installation :"
440 if test x"$gtk2_pkgconfig" = xyes
441         then
442         echo "GTK gui     : ENABLED"
443         else
444         echo "GTK gui     : DISABLED : you are missing a dependency. To fix this install a package named gtk2-devel or libgtk2.0-dev"
445 fi
446 # FIXME : maybe elaborate missing dependencies
447 if test x"$sdl" = xyes
448         then
449         if test x"$cegui" = xyes
450                 then
451                 if test x"$glut" = xyes
452                         then
453                         if test x"$glc" = xyes
454                                 then
455                                 echo "SDL gui     : ENABLED, with $CEGUI_LIBS"
456                                 else
457                                 echo "SDL gui     : DISABLED, you are missing quesoglc"
458                                 fi
459                         else
460                         echo "SDL gui     : DISABLED, your are missing glut"
461                         fi
462                 else
463                 echo "SDL gui     : DISABLED : you are missing cegui-devel >= 0.5"
464         fi
465         else
466         echo "SDL gui     : DISABLED : you are missing a SDL dependency"
467 fi
468 if test x"$gpsd" = xyes
469         then
470         echo "GPSD support: ENABLED"
471         else
472         echo "GPSD support: DISABLED"
473 fi
474 if test x"$speechd" = xyes
475         then
476         echo "SPEECHD     : ENABLED"
477         else
478         echo "SPEECHD     : DISABLED"
479 fi
480 if test x"${USE_GARMIN}" = xyes
481         then
482         if test "x$use_libgarmin" = "xyes"
483                 then
484                 echo "Garmin IMG  : ENABLED"
485                 else
486                 echo "Garmin IMG  : DISABLED (you don't have libgarmin)"
487         fi
488         else 
489                 echo "Garmin IMG  : DISABLED (you requested it)"
490 fi
491 if test "x$samplemap" = "xyes"
492         then
493         echo "Samplemap   : ENABLED"
494         else
495         echo "Samplemap   : DISABLED"
496 fi
497 if  [ test x"$gtk2_pkgconfig" != xyes ] && [ test x"$sdl" != xyes ]
498         then
499         echo ""
500         echo "" 
501         echo "*** WARNING! you have no gui that can be built! ***"
502         echo "Please install the dependency for at least gtk or sdl gui"
503         echo "For more details, see the wiki at http://navit.sf.net/wiki/"
504         echo "" 
505         exit 1
506 fi