031d5dfa1ab707754b50aeabed13536d17e48047
[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 PKG_CHECK_MODULES(
113         [CEGUI],
114         [CEGUI-OPENGL >= 0.5.0],
115         [
116                 AC_DEFINE(
117                         [HAVE_CEGUI],
118                         [],
119                         [Define to 1 if you have the @<:@CEGUI/CEGUI.h@:>@ header file.])
120                 cegui=yes
121         ],
122         [AC_MSG_WARN([*** CEGUI not found -- SDL support disabled])]
123 )
124
125 AC_CHECK_HEADER(
126         GL/gl.h,
127         AC_DEFINE(
128                 [HAVE_OPENGL],
129                 [],
130                 Define to 1 if you have the <GL/gl.h> header file.
131                 )
132                 OPENGL_LIBS="$X_LIBS -lGL -lGLU"
133                 opengl=yes,
134         AC_MSG_WARN([*** no GL/gl.h -- opengl and SDL support disabled])
135 )
136
137 AC_CHECK_HEADER(
138         GL/glut.h,
139         AC_DEFINE(
140                 [HAVE_GLUT],
141                 [],
142                 Define to 1 if you have the <GL/glut.h> header file.
143                 )
144                 glut=yes,
145         AC_MSG_WARN([*** no GL/glut.h -- opengl and SDL support disabled])
146 )
147
148 AC_SUBST(OPENGL_CFLAGS)
149 AC_SUBST(OPENGL_LIBS)
150
151 AC_CHECK_HEADER(
152         GL/glc.h,
153         AC_DEFINE(
154                 [HAVE_GLC],
155                 [],
156                 Define to 1 if you have the <GL/glc.h> header file.
157                 )
158                 GLC_LIBS="-lGLC"
159                 glc=yes,
160         AC_MSG_WARN([*** no GL/glc.h -- opengl and SDL support disabled])
161 )
162 AC_SUBST(GLC_CFLAGS)
163 AC_SUBST(GLC_LIBS)
164
165 AC_SUBST(CEGUI_CFLAGS)
166 AC_SUBST(CEGUI_LIBS)
167
168 AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$cegui" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
169 AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
170
171
172 if test x"${USE_LIBGPS}" = xyes
173 then
174         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]))
175 fi
176 AC_SUBST(GPSD_CFLAGS)
177 AC_SUBST(GPSD_LIBS)
178 AM_CONDITIONAL(VEHICLE_GPSD, [test "x$gpsd" = "xyes"])
179
180 # check for libgarmin
181 PKG_CHECK_MODULES(LIBGARMIN, libgarmin, use_libgarmin=yes, use_libgarmin=no)
182 AC_SUBST(LIBGARMIN_CFLAGS)
183 AC_SUBST(LIBGARMIN_LIBS)
184 AM_CONDITIONAL(HAVELIBGARMIN, [test "x$use_libgarmin" = "xyes"])
185
186 AC_ARG_ENABLE(binding-python, [  --disable-binding-python             don't create binding python ], MODULE_BINDING_PYTHON=$enableval, MODULE_BINDING_PYTHON=yes)
187 if test "$cross_compiling" = no; then
188         if test "x$MODULE_BINDING_PYTHON" = "xyes"; then
189                 AC_PATH_PROG(_PATH_PYTHON,[python])
190                 dnl Libraries and flags for embedded Python.
191                 dnl FIXME: I wish there was a less icky way to get this.
192                 if test x"$_PATH_PYTHON" != x ; then
193                         AC_MSG_CHECKING(for Python linkage)
194                         py_prefix=`$_PATH_PYTHON -c 'import sys; print sys.prefix'`
195                         py_ver=`$_PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
196                         py_libdir="${py_prefix}/lib/python${py_ver}"
197                         PYTHON_CFLAGS="-I${py_prefix}/include/python${py_ver}"
198                         if test -f $py_libdir/config/Makefile ; then
199                                 py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
200                                 py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
201                                 py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
202                                 py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
203                                 py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
204                                 PYTHON_LIBS="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
205                                 PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
206                                 AC_DEFINE(HAVE_PYTHON, 1, [Define to 1 if you have python])
207                                 python=yes
208                                 AC_MSG_RESULT($py_libdir)
209                         else
210                                 AC_MSG_WARN([$py_libdir/config/Makefile missing, support for python disabled])
211                         fi
212                 fi
213         fi
214 else
215         AC_MSG_WARN([*** cross compiling, support for python disabled])
216 fi
217 AC_SUBST(PYTHON_CFLAGS)
218 AC_SUBST(PYTHON_LIBS)
219 AM_CONDITIONAL(BINDING_PYTHON, [test "x$python" = "xyes"])
220
221 # NLS
222
223 AC_ARG_ENABLE(nls,
224   [  --disable-nls        disable Native Language Support ( gettext/libintl )],
225    enable_nls=$enableval, enable_nls=yes)
226
227
228 INTLIBS=""
229 MOFILES=""
230 POFILES=""
231 LINGUAS=""
232
233 if test x$enable_nls = xyes; then
234
235   AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
236              AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
237                          INTLIBS="" ))
238
239   AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
240   AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
241   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
242
243   if test "$XGETTEXT" != ""; then 
244     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
245         echo "xgettext isn't GNU version"
246         XGETTEXT=""
247     fi
248   fi
249
250   if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
251      PO=""
252      if test "$LINGUAS" = ""; then
253            ling=` (cd $srcdir/po; /bin/ls *.po) `
254            for l in $ling; do
255                 lcode=`basename $l .po`
256                 LINGUAS="$LINGUAS$lcode "
257            done
258     fi
259     AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
260     echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
261   else
262    LINGUAS=""
263    PO=""
264    echo "xgettext and libintl.a don't both exist; will not build i18n support"
265  fi
266  for lang in $LINGUAS; do
267     MOFILES="$MOFILES $lang.mo"
268  done
269  for lang in $LINGUAS; do
270     POFILES="$POFILES $lang.po"
271  done
272 fi
273
274
275 AC_SUBST(INTLIBS)
276 AC_SUBST(MOFILES)
277 AC_SUBST(POFILES)
278 AM_GNU_GETTEXT_VERSION
279 AM_GNU_GETTEXT
280
281 LIBS="$LIBS -lm -rdynamic"
282
283 PACKAGE=navit
284 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
285 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
286 AC_SUBST(PACKAGE)
287 AC_SUBST(VERSION)
288
289 AC_CONFIG_FILES([
290 Makefile
291 src/Makefile
292 src/binding/Makefile
293 src/binding/python/Makefile
294 src/data/Makefile
295 src/data/mg/Makefile
296 src/data/textfile/Makefile
297 src/data/binfile/Makefile
298 src/data/garmin/Makefile
299 src/data/poi_geodownload/Makefile
300 src/data/poi_geodownload/libmdb/Makefile
301 src/data/poi_geodownload/libmdb/include/Makefile
302 src/fib-1.1/Makefile
303 src/graphics/Makefile
304 src/graphics/gtk_drawing_area/Makefile
305 src/graphics/opengl/Makefile
306 src/graphics/null/Makefile
307 src/gui/Makefile
308 src/gui/gtk/Makefile
309 src/gui/sdl/Makefile
310 src/gui/sdl/datafiles/Makefile
311 src/osd/Makefile
312 src/osd/core/Makefile
313 src/speech/Makefile
314 src/speech/cmdline/Makefile
315 src/speech/speech_dispatcher/Makefile
316 src/vehicle/Makefile
317 src/vehicle/file/Makefile
318 src/vehicle/gpsd/Makefile
319 src/xpm/Makefile
320 src/maps/Makefile
321 intl/Makefile
322 po/Makefile
323 ])
324 #src/data/garmin_img/Makefile
325
326 AC_OUTPUT
327
328
329 echo ""
330 echo ""
331 echo "Summary of your installation :"
332 if test x"$gtk2_pkgconfig" = xyes
333         then
334         echo "GTK gui     : ENABLED"
335         else
336         echo "GTK gui     : DISABLED : you are missing a dependency"
337 fi
338 # FIXME : maybe elaborate missing dependencies
339 if test x"$sdl" = xyes
340         then
341         if test x"$cegui" = xyes
342         then
343                 echo "SDL gui     : ENABLED, with $CEGUI_LIBS"
344                 else
345                 echo "SDL gui     : DISABLED : you are missing cegui-devel >= 0.5"
346         fi
347         else
348         echo "SDL gui     : DISABLED : you are missing a SDL dependency"
349 fi
350 if test x"$gpsd" = xyes
351         then
352         echo "GPS support : ENABLED"
353         else
354         echo "GPS support : DISABLED"
355 fi
356 if test x"$speechd" = xyes
357         then
358         echo "SPEECHD     : ENABLED"
359         else
360         echo "SPEECHD     : DISABLED"
361 fi
362 if test "x$use_libgarmin" = "xyes"
363         then
364         echo "Garmin IMG  : ENABLED"
365         else
366         echo "Garmin IMG  : DISABLED (you don't have libgarmin)"
367 fi
368 if test "x$samplemap" = "xyes"
369         then
370         echo "Samplemap   : ENABLED"
371         else
372         echo "Samplemap   : DISABLED"
373 fi
374 if  [ test x"$gtk2_pkgconfig" != xyes ] && [ test x"$sdl" != xyes ]
375         then
376         echo ""
377         echo "" 
378         echo "*** WARNING! you have no gui that can be built! ***"
379         echo "Please install the dependency for at least gtk or sdl gui"
380         echo "For more details, see the wiki at http://navit.sf.net/wiki/"
381         echo "" 
382         exit 1
383 fi