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