Added zaxl patches for libgarmin
[navit-package] / configure.in
1 AC_INIT(navit, 0.0.2)
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
33 PKG_CHECK_MODULES(NAVIT, [glib-2.0 gmodule-2.0])
34 AC_SUBST(NAVIT_CFLAGS)
35 AC_SUBST(NAVIT_LIBS)
36
37 AC_ARG_ENABLE(gui-gtk, [  --disable-gui-gtk             don't create gui gtk ], MODULE_GUI_GTK=$enableval, MODULE_GUI_GTK=yes)
38 if test "x$MODULE_GUI_GTK" = "xyes"; then
39         PKG_CHECK_MODULES(GTK2, [gtk+-2.0], [gtk2_pkgconfig=yes], [gtk2_pkgconfig=no])
40         if test "x$gtk2_pkgconfig" = "xyes"; then
41                 AC_DEFINE(HAVE_GTK2, 1, [Define to 1 if you have imlib2])
42         fi
43 fi
44 AC_SUBST(GTK2_CFLAGS)
45 AC_SUBST(GTK2_LIBS)
46 AM_CONDITIONAL(GUI_GTK, [test "x$gtk2_pkgconfig" = "xyes"])
47 AM_CONDITIONAL(GRAPHICS_GTK_DRAWING_AREA, [test "x$gtk2_pkgconfig" = "xyes"])
48
49 PKG_CHECK_MODULES(FREETYPE2, [freetype2], [freetype2_pkgconfig=yes], [freetype2_pkgconfig=no])
50 if test "x$freetype2_pkgconfig" = "xyes"; then
51    AC_DEFINE(HAVE_FREETYPE2, 1, [Define to 1 if you have imlib2])
52 fi
53 AC_SUBST(FREETYPE2_CFLAGS)
54 AC_SUBST(FREETYPE2_LIBS)
55
56 PKG_CHECK_MODULES(IMLIB2, [imlib2], [imlib2_pkgconfig=yes], [imlib2_pkgconfig=no])
57 if test "x$imlib2_pkgconfig" = "xyes"; then
58    AC_DEFINE(HAVE_IMLIB2, 1, [Define to 1 if you have imlib2])
59 fi
60 AC_SUBST(IMLIB2_CFLAGS)
61 AC_SUBST(IMLIB2_LIBS)
62
63
64 AC_ARG_ENABLE(speech-speechd, [  --disable-speech-speechd             don't create speech speechd ], MODULE_SPEECH_SPEECHD=$enableval, MODULE_SPEECH_SPEECHD=yes)
65 if test "x$MODULE_SPEECH_SPEECHD" = "xyes"; then
66         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]))
67 fi
68 AC_SUBST(SPEECHD_CFLAGS)
69 AC_SUBST(SPEECHD_LIBS)
70 AM_CONDITIONAL(SPEECH_SPEECH_DISPATCHER, [test "x$speechd" = "xyes"])
71
72
73 AC_ARG_ENABLE(gui-sdl, [  --disable-gui-sdl             don't create gui sdl ], MODULE_GUI_SDL=$enableval, MODULE_GUI_SDL=yes)
74 if test "x$MODULE_GUI_SDL" = "xyes"; then
75         AC_CHECK_HEADER(
76                 SDL/SDL.h,
77                 AC_DEFINE(
78                         [HAVE_LIBSDL],
79                         [],
80                         Define to 1 if you have the <SDL/SDL.h> header file.
81                         )
82                         SDL_LIBS="-lSDL"
83                         sdl=yes,
84                 AC_MSG_WARN([*** no SDL/SDL.h -- SDL support disabled])
85         )
86 fi
87 AC_SUBST(SDL_CFLAGS)
88 AC_SUBST(SDL_LIBS)
89
90 AC_PREPROC_IFELSE(
91         CEGUI/CEGUI.h,
92         AC_DEFINE(
93                 [HAVE_CEGUI],
94                 [],
95                 Define to 1 if you have the <CEGUI/CEGUI.h> header file.
96                 )
97                 CEGUI_LIBS="-lCEGUIBase -lCEGUIOpenGLRenderer -lCEGUISILLYImageCodec -lCEGUIExpatParser -lCEGUIFalagardWRBase"
98                 CEGUI_CFLAGS="-I /usr/local/include/CEGUI -I /usr/include/CEGUI"
99                 cegui=yes,
100         AC_MSG_WARN([*** no CEGUI/CEGUI.h -- SDL support disabled])
101         exit 1
102 )
103 AC_SUBST(CEGUI_CFLAGS)
104 AC_SUBST(CEGUI_LIBS)
105
106 AC_CHECK_HEADER(
107         GL/gl.h,
108         AC_DEFINE(
109                 [HAVE_OPENGL],
110                 [],
111                 Define to 1 if you have the <GL/gl.h> header file.
112                 )
113                 OPENGL_LIBS="-lGL -lGLU"
114                 opengl=yes,
115         AC_MSG_WARN([*** no GL/gl.h -- opengl and SDL support disabled])
116 )
117 AC_SUBST(OPENGL_CFLAGS)
118 AC_SUBST(OPENGL_LIBS)
119
120 AC_CHECK_HEADER(
121         GL/glc.h,
122         AC_DEFINE(
123                 [HAVE_GLC],
124                 [],
125                 Define to 1 if you have the <GL/glc.h> header file.
126                 )
127                 GLC_LIBS="-lGLC"
128                 glc=yes,
129         AC_MSG_WARN([*** no GL/glc.h -- opengl and SDL support disabled])
130 )
131 AC_SUBST(GLC_CFLAGS)
132 AC_SUBST(GLC_LIBS)
133
134 AM_CONDITIONAL(GUI_SDL, [test "x$sdl" = "xyes" -a "x$cegui" = "xyes" -a "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
135 AM_CONDITIONAL(GRAPHICS_OPENGL, [test "x$opengl" = "xyes" -a "x$glc" = "xyes" ])
136
137 if test x"${USE_LIBGPS}" = xyes
138 then
139         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]))
140 fi
141 AC_SUBST(GPSD_CFLAGS)
142 AC_SUBST(GPSD_LIBS)
143 AM_CONDITIONAL(VEHICLE_GPSD, [test "x$gpsd" = "xyes"])
144
145 # check for libgarmin
146 PKG_CHECK_MODULES(LIBGARMIN, libgarmin, use_libgarmin=yes, use_libgarmin=no)
147 AC_SUBST(LIBGARMIN_CFLAGS)
148 AC_SUBST(LIBGARMIN_LIBS)
149 AM_CONDITIONAL(HAVELIBGARMIN, [test "x$use_libgarmin" = "xyes"])
150
151 AC_ARG_ENABLE(binding-python, [  --disable-binding-python             don't create binding python ], MODULE_BINDING_PYTHON=$enableval, MODULE_BINDING_PYTHON=yes)
152 if test "$cross_compiling" = no; then
153         if test "x$MODULE_BINDING_PYTHON" = "xyes"; then
154                 AC_PATH_PROG(_PATH_PYTHON,[python])
155                 dnl Libraries and flags for embedded Python.
156                 dnl FIXME: I wish there was a less icky way to get this.
157                 if test x"$_PATH_PYTHON" != x ; then
158                         AC_MSG_CHECKING(for Python linkage)
159                         py_prefix=`$_PATH_PYTHON -c 'import sys; print sys.prefix'`
160                         py_ver=`$_PATH_PYTHON -c 'import sys; print sys.version[[:3]]'`
161                         py_libdir="${py_prefix}/lib/python${py_ver}"
162                         PYTHON_CFLAGS="-I${py_prefix}/include/python${py_ver}"
163                         if test -f $py_libdir/config/Makefile ; then
164                                 py_libs=`grep '^LIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
165                                 py_libc=`grep '^LIBC=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
166                                 py_libm=`grep '^LIBM=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
167                                 py_liblocalmod=`grep '^LOCALMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
168                                 py_libbasemod=`grep '^BASEMODLIBS=' $py_libdir/config/Makefile | sed -e 's/^.*=//'`
169                                 PYTHON_LIBS="-L$py_libdir/config $py_libs $py_libc $py_libm -lpython$py_ver $py_liblocalmod $py_libbasemod"
170                                 PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/[ \\t]*/ /g'`
171                                 AC_DEFINE(HAVE_PYTHON, 1, [Define to 1 if you have python])
172                                 python=yes
173                                 AC_MSG_RESULT($py_libdir)
174                         else
175                                 AC_MSG_WARN([$py_libdir/config/Makefile missing, support for python disabled])
176                         fi
177                 fi
178         fi
179 else
180         AC_MSG_WARN([*** cross compiling, support for python disabled])
181 fi
182 AC_SUBST(PYTHON_CFLAGS)
183 AC_SUBST(PYTHON_LIBS)
184 AM_CONDITIONAL(BINDING_PYTHON, [test "x$python" = "xyes"])
185
186 # NLS
187
188 AC_ARG_ENABLE(nls,
189   [  --disable-nls        disable Native Language Support ( gettext/libintl )],
190    enable_nls=$enableval, enable_nls=yes)
191
192
193 INTLIBS=""
194 MOFILES=""
195 POFILES=""
196 LINGUAS=""
197
198 if test x$enable_nls = xyes; then
199
200   AC_CHECK_FUNC(gettext, [HAVEGETTEXT="yes"], 
201              AC_CHECK_LIB(intl, gettext, [INTLIBS="-lintl" HAVEGETTEXT="yes"],
202                          INTLIBS="" ))
203
204   AC_CHECK_PROG(XGETTEXT, xgettext, xgettext)
205   AC_CHECK_PROG(MSGMERGE, msgmerge, msgmerge)
206   AC_CHECK_PROG(MSGFMT, msgfmt, msgfmt)
207
208   if test "$XGETTEXT" != ""; then 
209     if $XGETTEXT --help 2>&1 | grep illegal >/dev/null ; then
210         echo "xgettext isn't GNU version"
211         XGETTEXT=""
212     fi
213   fi
214
215   if test "$XGETTEXT" != "" -a "$HAVEGETTEXT" != ""; then
216      PO=""
217      if test "$LINGUAS" = ""; then
218            ling=` (cd $srcdir/po; /bin/ls *.po) `
219            for l in $ling; do
220                 lcode=`basename $l .po`
221                 LINGUAS="$LINGUAS$lcode "
222            done
223     fi
224     AC_DEFINE(ENABLE_NLS, [1], [NLS Please])
225     echo "xgettext and gettext() exist; will build i18n support for $LINGUAS"
226   else
227    LINGUAS=""
228    PO=""
229    echo "xgettext and libintl.a don't both exist; will not build i18n support"
230  fi
231  for lang in $LINGUAS; do
232     MOFILES="$MOFILES $lang.mo"
233  done
234  for lang in $LINGUAS; do
235     POFILES="$POFILES $lang.po"
236  done
237 fi
238
239
240 AC_SUBST(INTLIBS)
241 AC_SUBST(MOFILES)
242 AC_SUBST(POFILES)
243 AM_GNU_GETTEXT_VERSION
244 AM_GNU_GETTEXT
245
246 LIBS="$LIBS -lm -rdynamic"
247
248 PACKAGE=navit
249 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
250 AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
251 AC_SUBST(PACKAGE)
252 AC_SUBST(VERSION)
253
254 AC_CONFIG_FILES([
255 Makefile
256 src/Makefile
257 src/binding/Makefile
258 src/binding/python/Makefile
259 src/data/Makefile
260 src/data/mg/Makefile
261 src/data/textfile/Makefile
262 src/data/binfile/Makefile
263 src/data/garmin_img/Makefile
264 src/data/poi_geodownload/Makefile
265 src/data/poi_geodownload/libmdb/Makefile
266 src/data/poi_geodownload/libmdb/include/Makefile
267 src/fib-1.1/Makefile
268 src/graphics/Makefile
269 src/graphics/gtk_drawing_area/Makefile
270 src/graphics/opengl/Makefile
271 src/graphics/null/Makefile
272 src/gui/Makefile
273 src/gui/gtk/Makefile
274 src/gui/sdl/Makefile
275 src/gui/sdl/datafiles/Makefile
276 src/osd/Makefile
277 src/osd/core/Makefile
278 src/speech/Makefile
279 src/speech/cmdline/Makefile
280 src/speech/speech_dispatcher/Makefile
281 src/vehicle/Makefile
282 src/vehicle/file/Makefile
283 src/vehicle/gpsd/Makefile
284 src/xpm/Makefile
285 intl/Makefile
286 po/Makefile
287 ])
288
289 if test -d src/data/garmin; then
290       if test "x$use_libgarmin" = "xyes"; then
291               AC_CONFIG_FILES([src/data/garmin/Makefile])
292       fi
293 fi
294 AC_OUTPUT
295
296
297 echo ""
298 echo ""
299 echo "Summary of your installation :"
300 if test x"$gtk2_pkgconfig" = xyes
301         then
302         echo "GTK gui     : ENABLED"
303         else
304         echo "GTK gui     : DISABLED : you are missing a dependency"
305 fi
306 if test x"$sdl" = xyes
307         then
308         echo "SDL gui     : ENABLED"
309         else
310         echo "SDL gui     : DISABLED : you are missing a dependency"
311 fi
312 if test x"$gpsd" = xyes
313         then
314         echo "GPS support : ENABLED"
315         else
316         echo "GPS support : DISABLED"
317 fi
318 if test x"$speechd" = xyes
319         then
320         echo "SPEECHD     : ENABLED"
321         else
322         echo "SPEECHD     : DISABLED"
323 fi
324 if test "x$use_libgarmin" = "xyes"
325         then
326         echo "Garmin IMG  : ENABLED"
327         else
328         echo "Garmin IMG  : DISABLED (you don't have libgarmin)"
329 fi
330 if  [ test x"$gtk2_pkgconfig" != xyes ] && [ test x"$sdl" != xyes ]
331         then
332         echo ""
333         echo "" 
334         echo "*** WARNING! you have no gui that can be built! ***"
335         echo "Please install the dependency for at least gtk or sdl gui"
336         echo "For more details, see the wiki at http://navit.sf.net/wiki/"
337         echo "" 
338         exit 1
339 fi