-
Notifications
You must be signed in to change notification settings - Fork 279
/
configure.ac
330 lines (265 loc) · 8.61 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.61])
AC_INIT([poedit], [3.5.2], [help@poedit.net])
AC_CONFIG_AUX_DIR([admin])
AC_CONFIG_MACRO_DIR([admin])
AC_CONFIG_SRCDIR([net.poedit.Poedit.desktop])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([subdir-objects foreign])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
WX_CONFIG_OPTIONS
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[Enable debug build]),
USE_DEBUG="$enableval", USE_DEBUG="no")
AC_MSG_CHECKING(for install location)
case "$prefix" in
NONE) AC_CACHE_VAL(m_cv_prefix,m_cv_prefix=$ac_default_prefix);;
*) m_cv_prefix=$prefix ;;
esac
AC_MSG_RESULT($m_cv_prefix)
case "$m_cv_prefix" in /*) ;; *)
AC_MSG_WARN([--prefix=$prefix must be an absolute path name, using $ac_default_prefix])
m_cv_prefix=$ac_default_prefix
esac
prefix=$m_cv_prefix
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CXXCPP
AC_LANG([C++])
AX_CXX_COMPILE_STDCXX([17], [], [mandatory])
WXLIBS_USED="xrc,xml,webview,adv,core,net"
case "$USE_DEBUG" in
yes) DEBUG_FLAGS="-g -Wall -O0"
;;
esac
AX_BOOST_BASE([1.60], [], [AC_MSG_ERROR([Boost libraries are required])])
AX_BOOST_SYSTEM
AX_BOOST_THREAD
CXXFLAGS="$CXXFLAGS $BOOST_CPPFLAGS"
dnl Check for C++REST SDK used for online features
AC_ARG_WITH([cpprest],
AS_HELP_STRING([--without-cpprest], [Ignore presence of C++ REST SDK and disable it]))
AS_IF([test "x$with_cpprest" != "xno"],
[
AX_BOOST_IOSTREAMS
have_cpprest=no
dnl C++11 check above modified CXXFLAGS, but AC_CHECK_HEADERS needs
dnl it for this header too and it uses only the preprocessor in one
dnl of its two phases:
old_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $CXXFLAGS $BOOST_CPPFLAGS"
AC_CHECK_HEADERS([cpprest/http_client.h],
[
AC_MSG_CHECKING([for libcpprest >= 2.10.8])
old_LIBS="$LIBS"
LIBS="-lcpprest $BOOST_SYSTEM_LIB $BOOST_THREAD_LIB -lssl -lcrypto $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <cpprest/version.h>
#include <cpprest/http_client.h>
],
[
#if CPPREST_VERSION < 201008
#error "cpprest >= 2.10.8 required"
#endif
web::http::client::http_client c(U("https://poedit.net"));
])],
[have_cpprest=yes])
LIBS="$old_LIBS"
AC_MSG_RESULT([$have_cpprest])
])
CPPFLAGS="$old_CPPFLAGS"
],
[have_cpprest=no])
AS_IF([test "x$have_cpprest" = "xyes"],
[
AC_DEFINE([HAVE_HTTP_CLIENT])
AC_DEFINE([HAVE_PPL])
CPPREST_LIBS="-lcpprest $BOOST_IOSTREAMS_LIB $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB -lssl -lcrypto"
AC_SUBST(CPPREST_LIBS)
PKG_CHECK_MODULES([LIBSECRET], [libsecret-1], [
CXXFLAGS="$CXXFLAGS $LIBSECRET_CFLAGS"
AC_SUBST(LIBSECRET_LIBS)
])
],
[
AS_IF([test "x$with_cpprest" = "xyes"],
[AC_MSG_ERROR([C++ REST SDK requested but not found])])
])
AM_CONDITIONAL([HAVE_CPPREST], [test "x$have_cpprest" != "xno"])
AC_CHECK_HEADERS([nlohmann/json.hpp])
WX_CONFIG_CHECK([3.2.4], [WXFOUND=1], [WXFOUND=0], [$WXLIBS_USED], [--unicode])
if test "$WXFOUND" != 1; then
AC_MSG_ERROR([wxWidgets library is required])
fi
dnl Sanity checks for common wxWidgets misconfigurations:
saved_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS"
AC_MSG_CHECKING([whether wxWidgets was built with wxUSE_XRC])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <wx/xrc/xmlres.h>], [
#if !defined(wxUSE_XRC) || !wxUSE_XRC
#error "XRC not compiled in"
#endif
])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([XRC is required to build poedit!])
])
AC_MSG_CHECKING([whether wxWidgets was built with wxUSE_WEBVIEW])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <wx/webview.h>], [
#if !defined(wxUSE_WEBVIEW) || !wxUSE_WEBVIEW
#error "wxWebView not compiled in"
#endif
])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([wxWebView is required to build poedit!])
])
CXXFLAGS="$saved_CXXFLAGS"
CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS"
WXRC_CHECK([], [AC_MSG_ERROR([wxrc is needed to compile Poedit.])])
AC_CHECK_FUNCS([mkdtemp])
PKG_CHECK_MODULES([ICU], [icu-uc icu-i18n >= 54],
[
CXXFLAGS="$CXXFLAGS $ICU_CFLAGS"
LIBS="$LIBS $ICU_LIBS"
],
[
AC_MSG_ERROR([missing ICU library])
])
dnl we need GtkSpell and GTK+ >= 2 for this, check if we're compatible
AC_MSG_CHECKING([if wxWidgets toolkit uses GTK+ 3])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <wx/defs.h>]], [
#ifndef __WXGTK3__
#error "not GTK+ 3"
#endif
])],
[
AC_MSG_RESULT([yes])
gtkspell_packages="gtkspell3-3.0 gtk+-3.0"
],
[
AC_MSG_RESULT([no])
AC_MSG_CHECKING([if wxWidgets toolkit uses GTK+ 2])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <wx/defs.h>], [
#ifndef __WXGTK20__
#error "not GTK+ 2"
#endif
])],
[
AC_MSG_RESULT([yes])
gtkspell_packages="gtkspell-2.0 gtk+-2.0 >= 2.20"
],
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([GTK+ build of wxWidgets is required])
])
])
PKG_CHECK_MODULES([GTKSPELL], [$gtkspell_packages],
[
CXXFLAGS="$CXXFLAGS $GTKSPELL_CFLAGS"
LIBS="$LIBS $GTKSPELL_LIBS"
],
[
AC_MSG_ERROR([missing GtkSpell library])
])
PKG_CHECK_MODULES([LUCENE], [liblucene++ >= 3.0.5],
[
CXXFLAGS="$CXXFLAGS $LUCENE_CFLAGS"
AC_SUBST(LUCENE_LIBS)
],
[
AC_MSG_ERROR([missing Lucene++ library])
])
PKG_CHECK_MODULES([PUGIXML], [pugixml >= 1.9],
[
CXXFLAGS="$CXXFLAGS $PUGIXML_CFLAGS -DHAVE_PUGIXML"
AC_SUBST(PUGIXML_LIBS)
],
[
dnl use bundled copy
])
dnl Check for Compact Language Detector 2
dnl (used for better language detection and for non-English source languages)
AC_ARG_WITH([cld2],
AS_HELP_STRING([--without-cld2], [Ignore presence of cld2 and disable it]))
AS_IF([test "x$with_cld2" != "xno"],
[
have_cld2=no
AC_CHECK_HEADERS([cld2/public/compact_lang_det.h],
[
AC_MSG_CHECKING([for libcld2])
old_LIBS="$LIBS"
LIBS="-lcld2 $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[
#include <stdio.h>
#include <cld2/public/compact_lang_det.h>
],
[
CLD2::isDataDynamic();
])],
[have_cld2=yes])
LIBS="$old_LIBS"
AC_MSG_RESULT([$have_cld2])
])
],
[have_cld2=no])
AS_IF([test "x$have_cld2" = "xyes"],
[
AC_DEFINE([HAVE_CLD2])
CLD2_LIBS="-lcld2"
AC_SUBST(CLD2_LIBS)
],
[
AS_IF([test "x$with_cld2" = "xyes"],
[AC_MSG_ERROR([cld2 requested but not found])])
])
CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -DwxNO_UNSAFE_WXSTRING_CONV=1 \"-DPOEDIT_PREFIX=\\\"$prefix\\\"\""
AC_SUBST(LDFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(WX_CONFIG_WITH_ARGS)
AC_SUBST(WX_LIBS)
AC_CONFIG_FILES([
Makefile
src/Makefile
artwork/Makefile
locales/Makefile
docs/Makefile
])
AC_OUTPUT
echo "
Configured $PACKAGE-$VERSION for $host
Enabled features:
* debug build: $USE_DEBUG
* language detection: $have_cld2
* cloud accounts integration: $have_cpprest
"
if test "x$have_cld2" != "xyes" -o "x$have_cpprest" != "xyes" ; then
echo "
!!! WARNING !!!
Your are building a limited version of Poedit without some important
features (see above). This makes Poedit harder to use and is strongly
advised against.
!!! WARNING !!!
"
fi