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