-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
283 lines (239 loc) · 7.92 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
m4_define([summer_major_version], [0])
m4_define([summer_minor_version], [2])
m4_define([summer_micro_version], [0])
m4_define([summer_version],
[summer_major_version.summer_minor_version.summer_micro_version])
AC_INIT([libsummer], [summer_version], [http://wrya.net/services/trac/summer], [libsummer])
AC_CONFIG_SRCDIR([libsummer/summer.h])
AC_CONFIG_HEADERS(config.h)
AM_INIT_AUTOMAKE([dist-bzip2])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])
SUMMER_MAJOR_VERSION=summer_major_version
SUMMER_MINOR_VERSION=summer_minor_version
SUMMER_MICRO_VERSION=summer_micro_version
SUMMER_VERSION=summer_version
AC_SUBST(SUMMER_MAJOR_VERSION)
AC_SUBST(SUMMER_MINOR_VERSION)
AC_SUBST(SUMMER_MICRO_VERSION)
AC_SUBST(SUMMER_VERSION)
AC_DEFINE(SUMMER_MAJOR_VERSION, [summer_major_version],
[Define to the SUMMER major version])
AC_DEFINE(SUMMER_MINOR_VERSION, [summer_minor_version],
[Define to the SUMMER minor version])
AC_DEFINE(SUMMER_MICRO_VERSION, [summer_micro_version],
[Define to the SUMMER micro version])
AC_PROG_CC
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
DOLT
GNOME_COMMON_INIT
GNOME_DOC_INIT
GNOME_MAINTAINER_MODE_DEFINES
GNOME_COMPILE_WARNINGS
GNOME_CXX_WARNINGS
GTK_DOC_CHECK(1.9)
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
GLIB_REQUIRED=2.18.0
LIBSOUP_REQUIRED=2.24
LIBTORRENT_REQUIRED=0.14
LIBXML_REQUIRED=2.6
VALA_REQUIRED=0.5.0
AM_PATH_GLIB_2_0($GLIB_REQUIRED,,,gobject gio gmodule)
if test "$GLIB_LIBS" = ""; then
AC_MSG_ERROR(GLIB $GLIB_REQUIRED or later is required to build libsummer)
fi
GLIB_CFLAGS="$GLIB_CFLAGS -DG_DISABLE_SINGLE_INCLUDES"
PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= $LIBSOUP_REQUIRED)
PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED)
# ***************
# Torrent backend
# ***************
AC_MSG_CHECKING([whether bittorrent support is requested])
AC_ARG_ENABLE([bittorrent],
AS_HELP_STRING([--enable-bittorrent],[Enable bittorrent support]),
[enable_bittorrent=$enableval],
[enable_bittorrent=autodetect])
AC_MSG_RESULT([$enable_bittorrent])
if test "x$enable_bittorrent" != "xno"; then
PKG_CHECK_MODULES(LIBTORRENT, libtorrent-rasterbar >= $LIBTORRENT_REQUIRED, [
enable_bittorrent=yes
SUMMER_CFLAGS+=-DENABLE_BITTORRENT
], [
if test "x$enable_bittorrent" = "xyes"; then
AC_MSG_ERROR([libtorrent-rasterbar not found])
else
AC_MSG_WARN([libtorrent-rasterbar not found, disabling bittorrent support])
enable_bittorrent=no
fi
])
fi
AM_CONDITIONAL([ENABLE_BITTORRENT],[test "x$enable_bittorrent" = "xyes"])
# ******
# Python
# ******
AC_MSG_CHECKING([whether python support is requested])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--enable-python],[Enable python support]),
[enable_python=$enableval have_python=$enableval],
[enable_python=autodetect have_python=yes])
AC_MSG_RESULT([$enable_python])
if test "x$have_python" != "xno"; then
AM_PATH_PYTHON([2.3],[],[no])
if test "x$PYTHON" = "x:"; then
have_python=no
fi
fi
if test "x$have_python" != "xno"; then
AM_CHECK_PYTHON_HEADERS([],[have_python=no])
fi
if test "x$have_python" != "xno"; then
PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
PYTHON_LIBS="-lpython$PYTHON_VERSION"
PYTHON_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config"
PYTHON_CFLAGS="-I$PY_PREFIX/include/python$PYTHON_VERSION"
PYTHON_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PYTHON_VERSION/config/Makefile"
PYTHON_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PYTHON_MAKEFILE`
PYTHON_EXTRA_LIBS="$PYTHON_LOCALMODLIBS $PYTHON_BASEMODLIBS $PYTHON_OTHER_LIBS"
AC_SUBST([PYTHON_LIBS])
AC_SUBST([PYTHON_LIB_LOC])
AC_SUBST([PYTHON_CFLAGS])
AC_SUBST([PYTHON_EXTRA_LIBS])
fi
if test "x$have_python" != "xyes"; then
if test "x$enable_python" = "xyes"; then
AC_MSG_ERROR([Python not found])
elif test "x$enable_python" = "xautodetect"; then
enable_python=no
AC_MSG_WARN([Python not found, disabling python support])
fi
fi
if test "x$have_python" != "xno"; then
PYGOBJECT_REQUIRED=2.15.2
PKG_CHECK_MODULES([PYGOBJECT], [pygobject-2.0 >= $PYGOBJECT_REQUIRED], [], [
have_python=no
if test "x$enable_python" = "xyes"; then
AC_MSG_ERROR([$PYGOBJECT_PKG_ERRORS])
elif test "x$enable_python" = "xautodetect"; then
enable_python=no
AC_MSG_WARN([$PYGOBJECT_PKG_ERRORS])
AC_MSG_WARN([Disabling python support])
fi
])
PYGLIB_LIBS=
BASE=$(pkg-config --variable=libdir gobject-2.0);
if test -f $BASE/libpyglib-2.0-python$PYTHON_VERSION.so; then
PYGLIB_LIBS="-L$BASE -lpyglib-2.0-python$PYTHON_VERSION";
elif test -f $BASE/libpyglib-2.0-python.so; then
PYGLIB_LIBS="-L$BASE -lpyglib-2.0-python";
else
PYGLIB_LIBS="-L$BASE -lpyglib-2.0";
fi
AC_SUBST([PYGLIB_LIBS])
AC_SUBST([PYGOBJECT_CFLAGS])
AC_SUBST([PYGOBJECT_LIBS])
fi
if test "x$have_python" != "xno"; then
AC_MSG_CHECKING([for pygobject defs])
PYGOBJECT_DEFSDIR=`$PKG_CONFIG --variable=defsdir pygobject-2.0`
AC_MSG_RESULT([$PYGOBJECT_DEFSDIR])
AC_MSG_CHECKING([for pygobject codegen])
PYGOBJECT_CODEGEN="$PYTHON `$PKG_CONFIG --variable=codegendir pygobject-2.0`/codegen.py"
AC_MSG_RESULT([$PYGOBJECT_CODEGEN])
AC_SUBST([PYGOBJECT_DEFSDIR])
AC_SUBST([PYGOBJECT_CODEGEN])
fi
if test "x$have_python" != "xno" -a "x$enable_python" != "xno"; then
enable_python=yes
AC_DEFINE([ENABLE_PYTHON],[1],[Define to compile with python support])
fi
AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
# ***
# Vala
# ***
AC_MSG_CHECKING([whether vala support is requested])
AC_ARG_ENABLE([vala],
AS_HELP_STRING([--enable-vala],[Enable vala support]),
[enable_vala=$enableval],
[enable_vala=autodetect])
AC_MSG_RESULT([$enable_vala])
if test "x$enable_vala" != "xno"; then
PKG_CHECK_MODULES(VALA, vala-1.0 >= $VALA_REQUIRED, [
VAPIGEN="$($PKG_CONFIG --variable=vapigen vala-1.0)"
VALA_GEN_INTROSPECT="$($PKG_CONFIG --variable=vala_gen_introspect vala-1.0)"
AC_SUBST(VAPIGEN)
AC_SUBST(VALA_GEN_INTROSPECT)
enable_vala=yes
], [
if test "x$enable_vala" = "xyes"; then
AC_MSG_ERROR([Vala not found])
else
AC_MSG_WARN([Vala not found, disabling vala support])
enable_vala=no
fi
])
fi
AM_CONDITIONAL([ENABLE_VALA],[test "x$enable_vala" = "xyes"])
# *****************
# coverage analysis
# *****************
AC_MSG_CHECKING(whether to enable coverage analysis)
AC_ARG_ENABLE(
coverage,
AS_HELP_STRING([--enable-coverage],[enable coverage analysis (default=no)]),
,
[enable_coverage="no"])
AC_MSG_RESULT($enable_coverage)
if test "$enable_coverage" = "yes"; then
COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
COVERAGE_LIBS="-lgcov"
AC_PATH_PROG(lcov_path, [lcov], [no])
if test "x$lcov_path" = "xno" ; then
AC_MSG_ERROR([lcov not found])
else
LCOV_VERSION=`lcov --version|head -n 1| $SED 's/^.* version //'`
LCOV_MAJOR=`echo $LCOV_VERSION | cut -d. -f1 | $SED s/[a-zA-Z\-].*//g`
LCOV_MINOR=`echo $LCOV_VERSION | cut -d. -f2 | $SED s/[a-zA-Z\-].*//g`
if [[ "$LCOV_MAJOR" -lt "1" ]]; then
AC_MSG_WARN([lcov >= 1.6 is required, you have $LCOV_VERSION])
lcov_path="no"
elif [[ "$LCOV_MAJOR" -eq "1" ] && \
[ "$LCOV_MINOR" -lt "6" ]]; then
AC_MSG_WARN([lcov >= 1.6 is required, you have $LCOV_VERSION])
lcov_path="no"
fi
fi
else
COVERAGE_CFLAGS=""
COVERAGE_LIBS=""
fi
AM_CONDITIONAL(USE_LCOV, test ! x$lcov_path = xyes)
SUMMER_CFLAGS+=" $COVERAGE_CFLAGS"
SUMMER_LIBS+=" $COVERAGE_LIBS"
AC_SUBST(SUMMER_CFLAGS)
AC_SUBST(SUMMER_LIBS)
SHAVE_INIT(., enable)
AC_CONFIG_FILES([
Makefile
shave
shave-libtool
libsummer-1.0.pc
libsummer-1.0-uninstalled.pc
bindings/python/Makefile
docs/reference/summer/Makefile
docs/reference/summer/version.xml])
AC_OUTPUT
echo "
Libsummer was configured with the following options:
Bittorrent support: $enable_bittorrent
Python bindings: $enable_python
Vala bindings: $enable_vala
Gtk-Doc Support: $enable_gtk_doc
Test Coverage Analysis: $enable_coverage
"