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