Fix #1789550: mkdtemp usage is conditioned
[viking/guyou.git] / configure.ac
blob3bdab7de5b00f79415396529489ca8deac6e46cc
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(viking, 0.9.2)
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
14 # Checks for header files.
15 AC_HEADER_STDC
16 AC_CHECK_HEADERS([malloc.h netdb.h netinet/in.h stdlib.h string.h sys/param.h sys/socket.h unistd.h math.h])
18 # Checks for typedefs, structures, and compiler characteristics.
19 AC_C_CONST
20 AC_TYPE_MODE_T
22 # Checks for library functions.
23 AC_FUNC_STAT
24 AC_FUNC_STRTOD
25 AC_CHECK_FUNCS([bzero floor gethostbyname memset mkdir mkdtemp pow realpath socket sqrt strcasecmp strchr strdup strncasecmp strtol strtoul])
27 # Expat
28 AM_WITH_EXPAT
30 # Curl
31 LIBCURL_CHECK_CONFIG([yes],[],[],[AC_MSG_ERROR([libcurl is needed but not found])])
33 AC_CHECK_PROG([GDK_PIXBUF_CSOURCE],gdk-pixbuf-csource,[yes])
34 if test $GDK_PIXBUF_CSOURCE != "yes"
35 then
36   AC_MSG_ERROR([gdk-pixbuf-csource is needed but not found])
39 # Checks for libraries.
40 AM_PATH_GTK_2_0(2.2.0,,AC_MSG_ERROR(needs GTK+ 2.2.0),gthread)
42 # Options
43 AC_ARG_ENABLE(alphabetized-trw, AC_HELP_STRING([--enable-alphabetized-trw],
44               [enable alphabetized track & waypoints (default is enable)]),
45               [ac_cv_enable_alpha_trw=$enableval],
46               [ac_cv_enable_alpha_trw=yes])
47 AC_CACHE_CHECK([whether to enable alphabetized track & waypoint],
48                [ac_cv_enable_alpha_trw], [ac_cv_enable_alpha_trw=yes])
49 case $ac_cv_enable_alpha_trw in
50   yes)
51     AC_DEFINE(VIK_CONFIG_ALPHABETIZED_TRW, [], [NO ALPHABETIZED TRW])
52     ;;
53 esac
55 AC_ARG_ENABLE(google, AC_HELP_STRING([--enable-google],
56               [enable Google stuff (default is enable)]),
57               [ac_cv_enable_google=$enableval],
58               [ac_cv_enable_google=yes])
59 AC_CACHE_CHECK([whether to enable Google stuff],
60                [ac_cv_enable_google], [ac_cv_enable_google=yes])
61 case $ac_cv_enable_google in
62   yes)
63     AC_DEFINE(VIK_CONFIG_GOOGLE, [], [GOOGLE STUFF])
64     ;;
65 esac
66 AM_CONDITIONAL([GOOGLE], [test x$ac_cv_enable_google = xyes])
68 AC_ARG_ENABLE(oldgoogle, AC_HELP_STRING([--enable-old-google],
69               [enable old Google stuff (default is disable)]),
70               [ac_cv_enable_google=$enableval],
71               [ac_cv_enable_google=no])
72 AC_CACHE_CHECK([whether to enable Old Google stuff],
73                [ac_cv_enable_old_google], [ac_cv_enable_old_google=yes])
74 case $ac_cv_enable_google in
75   yes)
76     AC_DEFINE(VIK_CONFIG_OLD_GOOGLE, [], [OLD GOOGLE STUFF])
77     ;;
78 esac
79 AM_CONDITIONAL([OLDGOOGLE], [test x$ac_cv_enable_old_google = xyes])
81 AC_ARG_ENABLE(terraserver, AC_HELP_STRING([--enable-terraserver],
82               [enable Terraserver stuff (default is enable)]),
83               [ac_cv_enable_terraserver=$enableval],
84               [ac_cv_enable_terraserver=yes])
85 AC_CACHE_CHECK([whether to enable Terraserver stuff],
86                [ac_cv_enable_terraserver], [ac_cv_enable_terraserver=yes])
87 case $ac_cv_enable_terraserver in
88   yes)
89     AC_DEFINE(VIK_CONFIG_TERRASERVER, [], [TERRASERVER STUFF])
90     ;;
91 esac
92 AM_CONDITIONAL([TERRASERVER], [test x$ac_cv_enable_terraserver = xyes])
94 AC_ARG_ENABLE(expedia, AC_HELP_STRING([--enable-expedia],
95               [enable Expedia stuff (default is disable)]),
96               [ac_cv_enable_expedia=$enableval],
97               [ac_cv_enable_expedia=no])
98 AC_CACHE_CHECK([whether to enable Expedia stuff],
99                [ac_cv_enable_expedia], [ac_cv_enable_expedia=yes])
100 case $ac_cv_enable_expedia in
101   yes)
102     AC_DEFINE(VIK_CONFIG_EXPEDIA, [], [EXPEDIA STUFF])
103     ;;
104 esac
105 AM_CONDITIONAL([EXPEDIA], [test x$ac_cv_enable_expedia = xyes])
107 # OpenStreetMap http://www.openstreetmap.org/
108 AC_ARG_ENABLE(openstreetmap, AC_HELP_STRING([--enable-openstreetmap],
109               [enable OpenStreetMap stuff (default is enable)]),
110               [ac_cv_enable_openstreetmap=$enableval],
111               [ac_cv_enable_openstreetmap=yes])
112 AC_CACHE_CHECK([whether to enable OpenStreetMap stuff],
113                [ac_cv_enable_openstreetmap], [ac_cv_enable_openstreetmap=yes])
114 case $ac_cv_enable_openstreetmap in
115   yes)
116     AC_DEFINE(VIK_CONFIG_OPENSTREETMAP, [], [OPENSTREETMAP STUFF])
117     ;;
118 esac
119 AM_CONDITIONAL([OPENSTREETMAP], [test x$ac_cv_enable_openstreetmap = xyes])
121 AC_ARG_ENABLE(geocaches, AC_HELP_STRING([--enable-geocaches],
122               [enable Geocaches Acquire (default is disable). WARNING: Broken, do not enable]),
123               [ac_cv_enable_geocaches=$enableval],
124               [ac_cv_enable_geocaches=no])
125 AC_CACHE_CHECK([whether to enable Geocaches Acquire],
126                [ac_cv_enable_geocaches], [ac_cv_enable_geocaches=yes])
127 case $ac_cv_enable_geocaches in
128   yes)
129     AC_DEFINE(VIK_CONFIG_GEOCACHES, [], [GEOCACHES STUFF])
130     ;;
131 esac
132 AM_CONDITIONAL([GEOCACHES], [test x$ac_cv_enable_geocaches = xyes])
134 AC_ARG_WITH(mapcache,
135             [AC_HELP_STRING([--with-mapcache],
136                             [specify the size of the map cache (default is 50331648)])],
137             [if test "x$withval" = "xno"; then
138                 VIK_CONFIG_MAPCACHE_SIZE=0;
139              elif test "x$withval" = "xyes"; then
140                 AC_MSG_ERROR([Please, set a value for size of the map cache])
141              else
142                 VIK_CONFIG_MAPCACHE_SIZE=${withval}
143              fi],
144              [VIK_CONFIG_MAPCACHE_SIZE=50331648])
145 AC_DEFINE_UNQUOTED(VIK_CONFIG_MAPCACHE_SIZE, ${VIK_CONFIG_MAPCACHE_SIZE},
146                    [Size of the map cache])
148 # Configuration
149 AC_CONFIG_FILES([Makefile
150                  src/Makefile
151                  src/icons/Makefile
152                  test/Makefile
153                  doc/Makefile
154                  doc/dev/Makefile])
155 AC_OUTPUT([
156            viking.spec
157            ])