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