Add missing include glib/gprintf.h
[viking.git] / configure.ac
blob0af77887450ca7d8118b6f921b210c5e50f5f540
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(viking, 0.9.8)
6 AM_INIT_AUTOMAKE()
7 dnl AC_CONFIG_SRCDIR([src/main.c])
8 AC_CONFIG_HEADERS([src/config.h])
10 # Checks for programs.
11 AC_PROG_CC
12 AC_PROG_MAKE_SET
13 AC_PROG_RANLIB
15 # I18N
16 GETTEXT_PACKAGE=viking
17 AC_SUBST(GETTEXT_PACKAGE)
18 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
20 AM_GLIB_DEFINE_LOCALEDIR(LOCALEDIR)
22 AM_GLIB_GNU_GETTEXT
23 IT_PROG_INTLTOOL([0.35.0])
25 AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
27 dnl This will cause the automake generated makefiles to pass the
28 dnl correct flags to aclocal.
29 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
30 AC_SUBST(ACLOCAL_AMFLAGS)
32 # Checks for header files.
33 AC_HEADER_STDC
34 AC_CHECK_HEADERS([malloc.h netdb.h netinet/in.h stdlib.h string.h sys/param.h sys/socket.h sys/types.h sys/wait.h unistd.h math.h])
36 # Checks for typedefs, structures, and compiler characteristics.
37 AC_C_CONST
38 AC_TYPE_MODE_T
40 # Checks for library functions.
41 AC_FUNC_STAT
42 AC_FUNC_STRTOD
43 AC_CHECK_FUNCS([floor gethostbyname memset mkdtemp pow realpath socket sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
45 # Expat
46 AM_WITH_EXPAT
48 # Curl
49 LIBCURL_CHECK_CONFIG([yes],[],[],[AC_MSG_ERROR([libcurl is needed but not found])])
51 AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
52 if test $GDK_PIXBUF_CSOURCE != "yes"
53 then
54   AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
57 # Checks for libraries.
58 AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(needs GTK+ 2.2.0),gthread)
60 # Options
61 AC_ARG_ENABLE(alphabetized-trw, AC_HELP_STRING([--enable-alphabetized-trw],
62               [enable alphabetized track & waypoints (default is enable)]),
63               [ac_cv_enable_alpha_trw=$enableval],
64               [ac_cv_enable_alpha_trw=yes])
65 AC_CACHE_CHECK([whether to enable alphabetized track & waypoint],
66                [ac_cv_enable_alpha_trw], [ac_cv_enable_alpha_trw=yes])
67 case $ac_cv_enable_alpha_trw in
68   yes)
69     AC_DEFINE(VIK_CONFIG_ALPHABETIZED_TRW, [], [NO ALPHABETIZED TRW])
70     ;;
71 esac
73 AC_ARG_ENABLE(google, AC_HELP_STRING([--enable-google],
74               [enable Google stuff (default is enable)]),
75               [ac_cv_enable_google=$enableval],
76               [ac_cv_enable_google=yes])
77 AC_CACHE_CHECK([whether to enable Google stuff],
78                [ac_cv_enable_google], [ac_cv_enable_google=yes])
79 case $ac_cv_enable_google in
80   yes)
81     AC_DEFINE(VIK_CONFIG_GOOGLE, [], [GOOGLE STUFF])
82     ;;
83 esac
84 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
86 AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver],
87               [enable Terraserver stuff (default is enable)]),
88               [ac_cv_enable_terraserver=$enableval],
89               [ac_cv_enable_terraserver=yes])
90 AC_CACHE_CHECK([whether to enable Terraserver stuff],
91                [ac_cv_enable_terraserver], [ac_cv_enable_terraserver=yes])
92 case $ac_cv_enable_terraserver in
93   yes)
94     AC_DEFINE(VIK_CONFIG_TERRASERVER, [], [TERRASERVER STUFF])
95     ;;
96 esac
97 AM_CONDITIONAL([TERRASERVER], [test x$ac_cv_enable_terraserver = xyes])
99 AC_ARG_ENABLE(expedia, AC_HELP_STRING([--enable-expedia],
100               [enable Expedia stuff (default is disable)]),
101               [ac_cv_enable_expedia=$enableval],
102               [ac_cv_enable_expedia=no])
103 AC_CACHE_CHECK([whether to enable Expedia stuff],
104                [ac_cv_enable_expedia], [ac_cv_enable_expedia=yes])
105 case $ac_cv_enable_expedia in
106   yes)
107     AC_DEFINE(VIK_CONFIG_EXPEDIA, [], [EXPEDIA STUFF])
108     ;;
109 esac
110 AM_CONDITIONAL([EXPEDIA], [test x$ac_cv_enable_expedia = xyes])
112 # OpenStreetMap http://www.openstreetmap.org/
113 AC_ARG_ENABLE(openstreetmap, AC_HELP_STRING([--enable-openstreetmap],
114               [enable OpenStreetMap stuff (default is enable)]),
115               [ac_cv_enable_openstreetmap=$enableval],
116               [ac_cv_enable_openstreetmap=yes])
117 AC_CACHE_CHECK([whether to enable OpenStreetMap stuff],
118                [ac_cv_enable_openstreetmap], [ac_cv_enable_openstreetmap=yes])
119 case $ac_cv_enable_openstreetmap in
120   yes)
121     AC_DEFINE(VIK_CONFIG_OPENSTREETMAP, [], [OPENSTREETMAP STUFF])
122     ;;
123 esac
124 AM_CONDITIONAL([OPENSTREETMAP], [test x$ac_cv_enable_openstreetmap = xyes])
126 # BlueMarble
127 AC_ARG_ENABLE(bluemarble, AC_HELP_STRING([--enable-bluemarble],
128               [enable BlueMarble stuff (default is enable)]),
129               [ac_cv_enable_bluemarble=$enableval],
130               [ac_cv_enable_bluemarble=yes])
131 AC_CACHE_CHECK([whether to enable BlueMarble stuff],
132                [ac_cv_enable_bluemarble], [ac_cv_enable_bluemarble=yes])
133 case $ac_cv_enable_bluemarble in
134   yes)
135     AC_DEFINE(VIK_CONFIG_BLUEMARBLE, [], [BLUEMARBLE STUFF])
136     ;;
137 esac
138 AM_CONDITIONAL([BLUEMARBLE], [test x$ac_cv_enable_bluemarble = xyes])
140 # OpenAerial
141 AC_ARG_ENABLE(openaerial, AC_HELP_STRING([--enable-openaerial],
142               [enable OpenAerial stuff (default is enable)]),
143               [ac_cv_enable_openaerial=$enableval],
144               [ac_cv_enable_openaerial=yes])
145 AC_CACHE_CHECK([whether to enable OpenAerial stuff],
146                [ac_cv_enable_openaerial], [ac_cv_enable_openaerial=yes])
147 case $ac_cv_enable_openaerial in
148   yes)
149     AC_DEFINE(VIK_CONFIG_OPENAERIAL, [], [OPENAERIAL STUFF])
150     ;;
151 esac
152 AM_CONDITIONAL([OPENAERIAL], [test x$ac_cv_enable_openaerial = xyes])
154 # GeoNames http://www.geonames.org/
155 AC_ARG_ENABLE(geonames, AC_HELP_STRING([--enable-geonames],
156               [enable Geonames stuff (default is enable)]),
157               [ac_cv_enable_geonames=$enableval],
158               [ac_cv_enable_geonames=yes])
159 AC_CACHE_CHECK([whether to enable Geonames stuff],
160                [ac_cv_enable_geonames], [ac_cv_enable_geonames=yes])
161 case $ac_cv_enable_geonames in
162   yes)
163     AC_DEFINE(VIK_CONFIG_GEONAMES, [], [GEONAMES STUFF])
164     ;;
165 esac
166 AM_CONDITIONAL([GEONAMES], [test x$ac_cv_enable_geonames = xyes])
168 AC_ARG_ENABLE(geocaches, AC_HELP_STRING([--enable-geocaches],
169               [enable Geocaches Acquire (default is disable).]),
170               [ac_cv_enable_geocaches=$enableval],
171               [ac_cv_enable_geocaches=no])
172 AC_CACHE_CHECK([whether to enable Geocaches Acquire],
173                [ac_cv_enable_geocaches], [ac_cv_enable_geocaches=yes])
174 case $ac_cv_enable_geocaches in
175   yes)
176     AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
177     ;;
178 esac
179 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
182 AC_ARG_ENABLE(dem24k, AC_HELP_STRING([--enable-dem24k],
183               [enable USGS 24k DEM (default is disable) download source. Requires dem24k.pl script in path.]),
184               [ac_cv_enable_dem24k=$enableval],
185               [ac_cv_enable_dem24k=no])
186 AC_CACHE_CHECK([whether to enable USGS DEM 24k download source],
187                [ac_cv_enable_dem24k], [ac_cv_enable_dem24k=yes])
188 case $ac_cv_enable_dem24k in
189   yes)
190     AC_DEFINE(VIK_CONFIG_DEM24K, [], [DEM24K STUFF])
191     ;;
192 esac
193 AM_CONDITIONAL([DEM24K], [test x$ac_cv_enable_dem24k = xyes])
195 # Realtime GPS tracking
196 AC_ARG_ENABLE(realtime-gps-tracking, AC_HELP_STRING([--enable-realtime-gps-tracking],
197               [enable realtime GPS tracking (default is enable)]),
198               [ac_cv_enable_realtimegpstracking=$enableval],
199               [ac_cv_enable_realtimegpstracking=yes])
200 AC_CACHE_CHECK([whether to enable Realtime GPS Tracking stuff],
201                [ac_cv_enable_realtimegpstracking], [ac_cv_enable_realtimegpstracking=yes])
202 case $ac_cv_enable_realtimegpstracking in
203   yes)
204     AC_CHECK_LIB(gps,gps_poll,,AC_MSG_ERROR([libgps is needed for Realtime GPS Tracking feature[,] but not found. The feature can be disable with --disable-realtime-gps-tracking]))
205     AC_DEFINE(VIK_CONFIG_REALTIME_GPS_TRACKING, [], [REALTIME GPS TRACKING STUFF])
206     ;;
207 esac
208 AM_CONDITIONAL([REALTIME_GPS_TRACKING], [test x$ac_cv_enable_realtimegpstracking = xyes])
210 AC_ARG_WITH(search,
211             [AC_HELP_STRING([--with-search],
212                             [specify google or geonames for searching (default is google)])],
213             [case "x$withval" in
214                "xgoogle")
215                  VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE
216                  ;;
217                "xgeonames")
218                  VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GEONAMES
219                  ;;
220                *)
221                 AC_MSG_ERROR([Please, set a value for search method])
222              esac],
223              [VIK_CONFIG_SEARCH=VIK_CONFIG_SEARCH_GOOGLE])
224 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GOOGLE, 1,
225                    [Id. for searching via GOOGLE])
226 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH_GEONAMES, 2,
227                    [Id. for searching via GEONAMES])
228 AC_DEFINE_UNQUOTED(VIK_CONFIG_SEARCH, ${VIK_CONFIG_SEARCH},
229                    [Method for the search])
232 AC_ARG_WITH(mapcache,
233             [AC_HELP_STRING([--with-mapcache],
234                             [specify the size of the map cache (default is 50331648)])],
235             [if test "x$withval" = "xno"; then
236                 VIK_CONFIG_MAPCACHE_SIZE=0;
237              elif test "x$withval" = "xyes"; then
238                 AC_MSG_ERROR([Please, set a value for size of the map cache])
239              else
240                 VIK_CONFIG_MAPCACHE_SIZE=${withval}
241              fi],
242              [VIK_CONFIG_MAPCACHE_SIZE=50331648])
243 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPCACHE_SIZE, ${VIK_CONFIG_MAPCACHE_SIZE},
244                    [Size of the map cache])
246 dnl man pages processing
247 DB2MAN_XSL=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
248 AC_SUBST(DB2MAN_XSL)
249 AC_PATH_PROG(XP,xsltproc)
250 AM_CONDITIONAL([GEN_MANPAGES],[test "x$XP" != "x" && test -r "$DB2MAN_XSL"])
252 dnl This will cause the automake generated makefiles to pass the
253 dnl correct flags to aclocal.
254 ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
255 AC_SUBST(ACLOCAL_AMFLAGS)
257 # Configuration
258 AC_CONFIG_FILES([Makefile
259                  src/Makefile
260                  src/icons/Makefile
261                  po/Makefile.in
262                  test/Makefile
263                  doc/Makefile
264                  doc/dev/Makefile])
265 AC_OUTPUT([
266            viking.spec
267            ])
269 dnl Output the configuration summary
270 echo ""
271 echo "==========================================="
272 echo "$PACKAGE $VERSION"
273 echo "-------------------------------------------"
274 echo "Alphabetized track & waypoints   : $ac_cv_enable_alpha_trw"
275 echo "Google Maps                      : $ac_cv_enable_google"
276 echo "Terraserver Maps                 : $ac_cv_enable_terraserver"
277 #echo "Expedia Maps                     : $ac_cv_enable_expedia"
278 echo "Open Street Map                  : $ac_cv_enable_openstreetmap"
279 echo "Geonames                         : $ac_cv_enable_geonames"
280 #echo "Geocaches Acquire                : $ac_cv_enable_geocaches"
281 echo "USGS 24k DEM                     : $ac_cv_enable_dem24k"
282 echo "Realtime GPS Tracking            : $ac_cv_enable_realtimegpstracking"
283 echo "Size of map cache (in memory)    : ${VIK_CONFIG_MAPCACHE_SIZE}"
284 echo "-------------------------------------------"
285 echo ""
286 echo "Configure finished, type 'make' to build."