forked from hotosm/underpass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
302 lines (269 loc) · 8.84 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
dnl
dnl Copyright (c) 2020, 2021, 2023 Humanitarian OpenStreetMap Team
dnl
dnl This file is part of Underpass.
dnl
dnl Underpass is free software: you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Underpass is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Underpass. If not, see <https:dnlwww.gnu.org/licenses/>.
dnl
AC_PREREQ(2.59c)
AC_INIT(underpass, 0.3_dev)
LT_INIT
AM_INIT_AUTOMAKE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([unconfig.h])
AC_PROG_CC
AC_PROG_CXX
AC_EXEEXT
AC_PROG_INSTALL
AC_CHECK_HEADER_STDBOOL
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl AC_DISABLE_STATIC
LT_INIT
DLOPEN="-dlopen"
DLPREOPEN="-dlpreopen"
AC_SUBST(DLOPEN)
AC_SUBST(DLPREOPEN)
AC_PATH_PROG(GIT, git)
AC_SUBST(GIT)
dnl Set the path to our pkg-config files
export PKG_CONFIG_PATH=$(dirname $0)/m4
build_single_loader=yes
build_multi_loader=no
AC_ARG_ENABLE(threads,
AS_HELP_STRING([--enable-downloader], [Enable support for multi-threaded downloader (default=single)]),
[if test -n ${enableval}; then
enableval=`echo ${enableval} | tr '\054' ' ' `
fi
while test -n "${enableval}" ; do
val=`echo ${enableval} | cut -d ' ' -f 1`
case "${val}" in
single|s)
build_single_loader=yes
;;
multi|m)
build_multi_loader=yes
;;
*) AC_MSG_ERROR([invalid option ${enableval} given (accept: single, multi)])
;;
esac
enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
if test "x$val" = "x$enableval"; then
break;
fi
done]
])
if test x"${build_single_loader}" = x"yes"; then
AC_DEFINE(USE_SINGLE_LOADER, [1], [Don't use multiple threaded file downloader])
else
AC_DEFINE(USE_MULTI_LOADER, [1], [Use multiple threaded downloader])
fi
dnl RapidXML is the default, as it's used by boost
build_rapidxml=no
build_libxml=yes
AC_ARG_ENABLE(parser,
AS_HELP_STRING([--enable-parser], [Enable support for the specified XML parser (default=libxml++)]),
[if test -n ${enableval}; then
enableval=`echo ${enableval} | tr '\054' ' ' `
fi
while test -n "${enableval}" ; do
val=`echo ${enableval} | cut -d ' ' -f 1`
case "${val}" in
rapidxml|rapid|r)
build_rapidxml=yes
;;
libxml++|lib|l)
build_libxml=yes
;;
*) AC_MSG_ERROR([invalid XML parser ${enableval} given (accept: rapidxml, libxml++)])
;;
esac
enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
if test "x$val" = "x$enableval"; then
break;
fi
done]
])
dnl Conflation can be a computationally expensive calulation,
dnl so make it optional. Works best with smaller datasets.
conflation=no
AC_ARG_ENABLE(conflation,
AS_HELP_STRING([--enable-conflation], [Enable support for expensive conflation (default=no)]),
[case "${enableval}" in
yes) conflation=yes ;;
no) conflation=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for enable-conflation option]) ;;
esac], conflation=no
)
if test x"${conflation}" = x"yes"; then
AC_DEFINE(USE_CONFLATION, [1], [Do additional conflation calculations ])
fi
jemalloc=yes
AC_ARG_ENABLE(jemalloc,
AS_HELP_STRING([--enable-jemalloc], [Enable support for Jemalloc (default=yes)]),
[case "${enableval}" in
yes) jemalloc=yes ;;
no) jemalloc=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for enable-jemalloc option]) ;;
esac], jemalloc=yes
)
AM_CONDITIONAL([JEMALLOC], [ test x"${jemalloc}" = x"yes" ])
if test x"${jemalloc}" = x"yes"; then
AC_MSG_NOTICE([Using Jemalloc instead of system malloc])
fi
memory__debug=no
AC_ARG_ENABLE(memory-debug,
AS_HELP_STRING([--enable-memory-debug], [Enable support for Memory debugging (default=no)]),
[case "${enableval}" in
yes) memory_debug=yes ;;
no) memory_debug=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for enable-memory-debug option]) ;;
esac]
)
if test x"${memory_debug}" = x"yes"; then
AC_MSG_NOTICE([Enabling Memory memory debugging for leaks])
AC_DEFINE(MEMORY_DEBUG, [1], [Enable memory debugging])
fi
conflation=no
AC_ARG_ENABLE(conflation,
AS_HELP_STRING([--enable-conflation], [Enable support for expensive conflation (default=no)]),
[case "${enableval}" in
yes) conflation=yes ;;
no) conflation=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for enable-conflation option]) ;;
esac], conflation=no
)
if test x"${conflation}" = x"yes"; then
AC_DEFINE(USE_CONFLATION, [1], [Do additional conflation calculations ])
fi
dnl range-v3
CPPFLAGS+=" $(pkg-config --cflags libpqxx)"
CPPFLAGS+=" $(pkg-config --cflags gumbo)"
CPPFLAGS+=" $(pkg-config --cflags ompi)"
CPPFLAGS+=" $(python3-config --cflags)"
dnl This is a C++ project only
AC_LANG_PUSH(C++)
dnl pqxx requires C++17
CXXFLAGS+=" -std=c++17 "
dnl Osmium headers
AC_CHECK_HEADERS([osmium/osm/node.hpp])
LIBS+=" $(pkg-config --libs expat)"
LIBS+=" $(pkg-config --libs zlib)"
LIBS+=" $(pkg-config --libs bzip2)"
LIBS+=" $(pkg-config --libs libpqxx)"
LIBS+=" $(pkg-config --libs openssl)"
LIBS+=" $(pkg-config --libs gumbo)"
LIBS+=" $(pkg-config --libs zlib)"
LIBS+=" $(pkg-config --libs ompi)"
LIBS+=" $(python3-config --libs)"
if test x"${build_libxml}" = x"yes"; then
dnl Debian Buster and Ubuntu Focal ship 2.6, Fedora ships 3,.0
dnl The version in Focal is broken, so either build libxml++-3.0
dnl from source, or wait for 20.10 to be released.
$(pkg-config --exists libxml++-3.0)
if test $? -gt 0 ; then
CPPFLAGS+=" $(pkg-config --cflags libxml++-2.6)"
LIBS+=" $(pkg-config --libs libxml++-2.6)"
else
CPPFLAGS+=" $(pkg-config --cflags libxml++-3.0)"
LIBS+=" $(pkg-config --libs libxml++-3.0)"
fi
AC_DEFINE([LIBXML], [1], [Use libxml++ library])
else
dnl RapidXML is header only, and we access it through boost, so this
dnl is unnecessary
AC_DEFINE([RAPIDXML], [1], [Use rapidxml library in boost])
fi
dnl AM_CONDITIONAL(BUILD_RAPIDXML, [ test x$build_rapidxml = xyes ])
LIBS+=" -lpthread -ldl"
dnl 1.69 or newer
AX_BOOST_BASE(1.69)
AX_BOOST_IOSTREAMS
AX_BOOST_SYSTEM
AX_BOOST_SERIALIZATION
AX_BOOST_DATE_TIME
AX_BOOST_FILESYSTEM
AX_BOOST_THREAD
AX_BOOST_LOCALE
AX_BOOST_TIMER
AX_BOOST_LOG
AX_BOOST_PROGRAM_OPTIONS
dnl For some reason this test works on Fedora, and fails on Debian. For now
dnl hardcode it.
dnl AX_BOOST_REGEX
LIBS+=" -lboost_regex"
dnl LIBS += "${BOOST_DATE_TIME} ${BOOST_SYSTEM} ${BOOST_FILESYSTEM} ${BOOST_LOG_LIB}"
AC_LANG_POP(C++)
CPPFLAGS+=" $(pkg-config --cflags gdal)"
LIBS+=" $(pkg-config --libs gdal)"
AM_PATH_PYTHON([3])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python],[Enable Python binding]), [], [enable_python=yes])
if test x"${enable_python}" = x"yes"; then
LIBS+=" $(python3-config --libs)"
LIBS+=" $(python3-config --embed)"
CPPFLAGS+=" $(python3-config --cflags)"
AX_BOOST_PYTHON
AC_DEFINE(USE_PYTHON, [1], [Enable Python binding])
fi
AM_CONDITIONAL(ENABLE_PYTHON, [ test x"${enable_python}" != x"no" ])
AC_PATH_PROG(DOXYGEN, doxygen)
AM_CONDITIONAL(ENABLE_DOXYGEN, [ test x"$DOXYGEN" != x ])
if test x"$DOXYGEN" != x; then
CPPFLAGS+=" $(pkg-config --cflags webkit2gtk-4.0)"
CPPFLAGS+=" $(pkg-config --cflags glibmm-2.4)"
LIBS+=" $(pkg-config --libs webkit2gtk-4.0)"
LIBS+=" $(pkg-config --libs glibmm-2.4)"
fi
AC_ARG_ENABLE([pch],
AS_HELP_STRING([--enable-pch],[Enable precompiled header support]), [], [enable_pch=no])
AC_ARG_ENABLE([cache],
AS_HELP_STRING([--enable-cache],[Enable storing downloaded filea to disk]), [], [enable_cache=yes])
if test x"${enable_cache}" = x"yes"; then
AC_DEFINE(USE_CACHE, [1], [Store downloaded files to disk])
fi
AC_ARG_ENABLE([tmp],
AS_HELP_STRING([--enable-tmp],[Enable using a tmp file instead of memory]), [], [enable_tmp=no])
if test x"${enable_tmp}" = x"yes"; then
AC_DEFINE(USE_TMPFILE, [1], [Use tmp file for downloaded files])
fi
ARCH=${host_cpu}
AC_SUBST(ARCH)
AM_CONDITIONAL([ENABLE_PCH], [test x"$enable_pch" != x"no"])
PCH_FLAGS="-include all-includes.h -Winvalid-pch"
AC_SUBST(PCH_FLAGS)
AM_GNU_GETTEXT([external])
AM_CONDITIONAL([HAS_GETTEXT], [test x"$gt_use_preinstalled_gnugettext" != x"no"])
AC_SUBST([POMAKEFILEDEPS])
SRCDIR=${srcdir}
AC_SUBST(SRCDIR)
AC_CONFIG_FILES([
Makefile
docs/Doxyfile
src/validate/Makefile
src/testsuite/Makefile
src/testsuite/libunderpass.all/Makefile
dist/redhat/underpass.spec
])
AC_OUTPUT
if test x"${build_libxml}" = x"yes"; then
echo "Using libxml for XML parsing"
else
echo "Using RapidXML for XML parsing, which is used by boost::parse_tree"
fi
# Local Variables:
# c-basic-offset: 2
# tab-width: 2
# indent-tabs-mode: nil
# End: