Specify lib directory for QB
[platform/upstream/glib-networking.git] / configure.ac
1 AC_PREREQ(2.65)
2 AC_CONFIG_MACRO_DIR([m4])
3
4 AC_INIT([glib-networking],[2.50.0],[http://bugzilla.gnome.org/enter_bug.cgi?product=glib&component=network])
5
6 AC_CONFIG_SRCDIR([proxy/libproxy/glibproxyresolver.h])
7 AC_CONFIG_HEADERS([config.h])
8
9 dnl Other initialization
10 AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz -Wno-portability])
11 AM_MAINTAINER_MODE([enable])
12 AM_SILENT_RULES([yes])
13 LT_INIT
14
15 dnl Checks for programs.
16 AC_PROG_CC
17 AM_PROG_CC_C_O
18 AC_PROG_CPP
19
20 dnl Checks for libraries.
21
22 dnl ****************************
23 dnl *** Checks for gettext   ***
24 dnl ****************************
25 AM_GNU_GETTEXT_VERSION([0.19.4])
26 AM_GNU_GETTEXT([external])
27
28 GETTEXT_PACKAGE=glib-networking
29 AC_SUBST([GETTEXT_PACKAGE])
30 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
31
32 dnl *****************************
33 dnl *** Check GLib GIO        ***
34 dnl *****************************
35 AM_PATH_GLIB_2_0(2.46.0,,AC_MSG_ERROR(GLIB not found),gio)
36 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46"
37
38 GIO_MODULE_DIR=$($PKG_CONFIG --variable giomoduledir gio-2.0)
39 AS_IF([test "$GIO_MODULE_DIR" = ""],
40       [AC_MSG_FAILURE(GIO_MODULE_DIR is missing from gio-2.0.pc)])
41 AC_SUBST(GIO_MODULE_DIR)
42
43 AC_PATH_PROG(GIO_QUERYMODULES, gio-querymodules)
44 AC_SUBST(GIO_QUERYMODULES)
45
46 GLIB_TESTS
47
48 dnl *****************************
49 dnl *** Checks for LibProxy   ***
50 dnl *****************************
51
52 AC_ARG_WITH(libproxy,
53     [AC_HELP_STRING([--with-libproxy],
54                     [support for libproxy @<:@default=check@:>@])],
55     [],
56     [with_libproxy=check])
57 AS_IF([test "$with_libproxy" != "no"],
58     [PKG_CHECK_MODULES(LIBPROXY, [libproxy-1.0 >= 0.3.1],
59         [with_libproxy=yes; proxy_support=libproxy],
60         [AS_IF([test "$with_libproxy" = "yes"],
61                [AC_MSG_FAILURE("$LIBPROXY_PKG_ERRORS")])])])
62 AM_CONDITIONAL(HAVE_LIBPROXY, [test "$with_libproxy" = "yes"])
63 AC_SUBST(LIBPROXY_CFLAGS)
64 AC_SUBST(LIBPROXY_LIBS)
65
66 dnl **************************************
67 dnl *** Checks for GNOME proxy backend ***
68 dnl **************************************
69 AC_ARG_WITH(gnome-proxy,
70     [AC_HELP_STRING([--with-gnome-proxy],
71                     [support for GNOME proxy configuration @<:@default=check@:>@])],
72     [],
73     [with_gnome_proxy=check])
74 AS_IF([test "$with_gnome_proxy" != "no"],
75     [PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, [gsettings-desktop-schemas],
76         [with_gnome_proxy=yes; proxy_support="gnome $proxy_support"],
77         [AS_IF([test "$with_gnome_proxy" = "yes"],
78                [AC_MSG_FAILURE("$GSETTINGS_DESKTOP_SCHEMAS_PKG_ERRORS")])])])
79 AM_CONDITIONAL(HAVE_GNOME_PROXY, [test "$with_gnome_proxy" = "yes"])
80 AC_SUBST(GSETTINGS_DESKTOP_SCHEMAS_CFLAGS)
81
82 dnl *****************************
83 dnl *** Checks for GNUTLS     ***
84 dnl *****************************
85
86 GNUTLS_MIN_REQUIRED=3.0
87
88 AC_ARG_WITH(gnutls,
89     [AC_HELP_STRING([--with-gnutls],
90                     [support for GNUTLS @<:@default=yes@:>@])],
91     [],
92     [with_gnutls=yes])
93 if test "$with_gnutls" != "no"; then
94         PKG_CHECK_MODULES(GNUTLS,
95                           [gnutls >= $GNUTLS_MIN_REQUIRED],
96                           [with_gnutls=yes
97                            tls_support="${tls_support}gnutls "],
98                           [AS_IF([test "$with_gnutls" = "yes"],
99                                  [AC_MSG_FAILURE("$GNUTLS_PKG_ERRORS")])])
100 fi
101 AM_CONDITIONAL(HAVE_GNUTLS, [test "$with_gnutls" = "yes"])
102 AC_SUBST(GNUTLS_CFLAGS)
103 AC_SUBST(GNUTLS_LIBS)
104
105 if test "$with_gnutls" = "yes"; then
106     AC_MSG_CHECKING([location of system Certificate Authority list])
107     AC_ARG_WITH(ca-certificates,
108                 [AC_HELP_STRING([--with-ca-certificates=@<:@path@:>@],
109                                 [path to system Certificate Authority list])])
110     if test "$with_ca_certificates" = "no"; then
111         AC_MSG_RESULT([disabled])
112     else
113         if test -z "$with_ca_certificates"; then
114             for f in /etc/pki/tls/certs/ca-bundle.crt \
115                      /etc/ssl/certs/ca-certificates.crt \
116                      /etc/ssl/ca-bundle.pem; do
117                 if test -f "$f"; then
118                     with_ca_certificates="$f"
119                 fi
120             done
121             if test -z "$with_ca_certificates"; then
122                 AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or --without-ca-certificates to disable])
123             fi
124         fi
125
126         AC_MSG_RESULT($with_ca_certificates)
127         AC_DEFINE_UNQUOTED(GTLS_SYSTEM_CA_FILE, ["$with_ca_certificates"], [The system TLS CA list])
128     fi
129 fi
130
131 dnl *****************************
132 dnl *** Checks for pkcs11    ***
133 dnl *****************************
134
135 P11_KIT_REQUIRED=0.8
136
137 AC_ARG_WITH(pkcs11,
138         [AC_HELP_STRING([--with-pkcs11],
139                         [support for pkcs11 @<:@default=check@:>@])],
140                         [],
141                         [with_pkcs11=check])
142 if test "$with_pkcs11" != "no"; then
143         PKG_CHECK_MODULES(PKCS11,
144                           [p11-kit-1 >= $P11_KIT_REQUIRED],
145                           [with_pkcs11=yes
146                            pkcs11_support=p11-kit
147                            tls_support="${tls_support}gnutls-pkcs11 "
148                            AC_DEFINE_UNQUOTED([HAVE_PKCS11], [1], [Building with PKCS#11 support])],
149                           [AS_IF([test "$with_pkcs11" = "yes"],
150                                  [AC_MSG_FAILURE("$PKCS11_PKG_ERRORS")])
151                            pkcs11_support=no])
152 else
153         pkcs11_support=no
154 fi
155 AM_CONDITIONAL(HAVE_PKCS11, [test "$with_pkcs11" = "yes"])
156 AC_SUBST(PKCS11_CFLAGS)
157 AC_SUBST(PKCS11_LIBS)
158
159 dnl *************************
160 dnl *** Tizen multiple certificate support  ***
161 dnl *************************
162
163 AC_ARG_ENABLE(tizen-multiple-certificate,
164         AS_HELP_STRING([--enable-tizen-multiple-certificate], [Enable Tizen multiple certificate support ]),        ,
165         enable_tizen_multiple_certificate=no)
166
167 AC_MSG_CHECKING([for Tizen multiple certificate])
168 if test $enable_tizen_multiple_certificate != no;then
169         AC_DEFINE(ENABLE_TIZEN_TV_MULTIPLE_CERTIFICATE, 1, [Add new feature, support to install more than one file, multiple file path will be seperated by colon symbol])
170 fi
171 AC_MSG_RESULT($enable_tizen_multiple_certificate)
172
173 AM_CONDITIONAL(TIZEN_TV_MULTIPLE_CERTIFICATE, [test $enable_tizen_multiple_certificate = yes])
174
175 dnl ***************************
176 dnl *** Tizen dlog support  ***
177 dnl ***************************
178
179 AC_ARG_ENABLE(tizen-dlog,
180         AS_HELP_STRING([--enable-tizen-dlog], [Enable Tizen dlog support ]),        ,
181         enable_tizen_dlog=no)
182
183 AC_MSG_CHECKING([for Tizen dlog])
184 if test $enable_tizen_dlog != no;then
185         AC_DEFINE(ENABLE_TIZEN_DLOG, 1, [Add new feature, support to add tizen dlog in glib-networking])
186 fi
187 AC_MSG_RESULT($enable_tizen_dlog)
188
189 AM_CONDITIONAL(TIZEN_DLOG, [test $enable_tizen_dlog = yes])
190
191 dnl ****************************
192 dnl *** GNUTLS debug support ***
193 dnl ****************************
194
195 AC_ARG_ENABLE(tizen-gnutls-debug,
196                 AS_HELP_STRING([--enable-tizen-gnutls-debug], [Enable Tizen GNUTLS debug support ]),        ,
197                 enable_tizen_gnutls_debug=no)
198
199 AC_MSG_CHECKING([for Tizen GNUTLS debug])
200 if test $enable_tizen_gnutls_debug != no;then
201                 AC_DEFINE(ENABLE_TIZEN_GNUTLS_DEBUG, 1,
202                                 [Add new feature, support to enable GNUTLS debug function in glib-networking])
203 fi
204 AC_MSG_RESULT($enable_tizen_gnutls_debug)
205
206 AM_CONDITIONAL(TIZEN_GNUTLS_DEBUG, [test $enable_tizen_gnutls_debug = yes])
207
208
209 dnl *****************************************************
210 dnl *** Tizen update gnutls default priority support  ***
211 dnl *****************************************************
212
213 AC_ARG_ENABLE(tizen-tv-update-default-priority,
214         AS_HELP_STRING([--enable-tizen-tv-update-default-priority], [Enable Tizen update gnults default priority support ]),        ,
215         enable_tizen_tv_update_default_priority=no)
216
217 AC_MSG_CHECKING([for Tizen tv update default priority])
218 if test $enable_tizen_tv_update_default_priority != no;then
219         AC_DEFINE(ENABLE_TIZEN_TV_UPDATE_DEFAULT_PRIORITY, 1, [Add new feature, support to update gnutls default priority in glib-networking])
220 fi
221 AC_MSG_RESULT($enable_tizen_tv_update_default_priority)
222
223 AM_CONDITIONAL(TIZEN_TV_UPDATE_DEFAULT_PRIORITY, [test $enable_tizen_tv_update_default_priority = yes])
224
225 dnl *******************************
226 dnl *** Tizen performance test  ***
227 dnl *******************************
228
229 AC_ARG_ENABLE(tizen-performance-test-log,
230         AS_HELP_STRING([--enable-tizen-performance-test-log], [Enable Tizen performance test log]),        ,
231         enable_tizen_performance_test_log=no)
232
233 AC_MSG_CHECKING([for Tizen performance test log])
234 if test $enable_tizen_performance_test_log != no;then
235         AC_DEFINE(ENABLE_TIZEN_PERFORMANCE_TEST_LOG, 1, [Add performance test log])
236 fi
237 AC_MSG_RESULT($enable_tizen_performance_test_log)
238
239 AM_CONDITIONAL(TIZEN_PERFORMANCE_TEST_LOG, [test $enable_tizen_performance_test_log = yes])
240
241 dnl *************************************************************************
242 dnl *** Use soupTimeOffset to adjust time for certificate or cookie case  ***
243 dnl *************************************************************************
244
245 AC_ARG_ENABLE(tizen-tv-adjust-time,
246         AS_HELP_STRING([--enable-tizen-tv-adjust-time], [Enable Tizen use soupTimeOffset to adjust time for certificate or cookie case ]),        ,
247         enable_tizen_tv_adjust_time=no)
248
249 AC_MSG_CHECKING([for Tizen use soupTimeOffset to adjust time for certificate or cookie case])
250 if test $enable_tizen_tv_adjust_time != no;then
251         AC_DEFINE(ENABLE_TIZEN_TV_ADJUST_TIME, 1, [Add new feature, which use soupTimeOffset to adjust time for certificate or cookie case])
252 fi
253 AC_MSG_RESULT($enable_tizen_tv_adjust_time)
254
255 AM_CONDITIONAL(TIZEN_TV_ADJUST_TIME, [test $enable_tizen_tv_adjust_time = yes])
256
257 dnl ************************************
258 dnl *** Enable lcov coverage reports ***
259 dnl ************************************
260
261 AC_ARG_ENABLE(gcov,
262   AS_HELP_STRING([--enable-gcov],
263                  [Enable gcov]),
264   [use_gcov=$enableval], [use_gcov=no])
265
266 if test "$use_gcov" = "yes"; then
267   dnl we need gcc:
268   if test "$GCC" != "yes"; then
269     AC_MSG_ERROR([GCC is required for --enable-gcov])
270   fi
271
272   ltp_version_list="1.6 1.7 1.8 1.9"
273   AC_CHECK_PROG(LTP, lcov, lcov)
274   AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
275
276   if test "$LTP"; then
277     AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
278       glib_cv_ltp_version=invalid
279       ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
280       for ltp_check_version in $ltp_version_list; do
281         if test "$ltp_version" = "$ltp_check_version"; then
282           glib_cv_ltp_version="$ltp_check_version (ok)"
283         fi
284       done
285     ])
286   else
287     ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
288     AC_MSG_ERROR([$ltp_msg])
289   fi
290
291   case $glib_cv_ltp_version in
292     ""|invalid[)]
293       ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
294       AC_MSG_ERROR([$ltp_msg])
295       LTP="exit 0;"
296       ;;
297   esac
298
299   if test -z "$LTP_GENHTML"; then
300     AC_MSG_ERROR([Could not find genhtml from the LTP package])
301   fi
302
303   AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
304
305   dnl Remove all optimization flags from CFLAGS
306   changequote({,})
307   CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
308   changequote([,])
309
310   dnl Add the special gcc flags
311   CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
312   LDFLAGS="$LDFLAGS -lgcov"
313 fi
314
315 dnl ****************************************************
316 dnl *** Warnings to show if using GCC                ***
317 dnl *** (do this last so -Werror won't mess up tests ***
318 dnl ****************************************************
319
320 AC_ARG_ENABLE(more-warnings,
321               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
322               set_more_warnings=no)
323
324 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
325         CFLAGS="$CFLAGS \
326                 -Wall -Wstrict-prototypes -Werror=missing-prototypes \
327                 -Werror=implicit-function-declaration \
328                 -Werror=pointer-arith -Werror=init-self -Werror=format=2 \
329                 -Werror=missing-include-dirs \
330                 -Werror=declaration-after-statement"
331 fi
332
333 dnl *****************************
334 dnl *** done                  ***
335 dnl *****************************
336 AC_CONFIG_FILES([Makefile
337                  po/Makefile.in po/Makefile
338                  proxy/libproxy/Makefile
339                  proxy/gnome/Makefile
340                  proxy/tests/Makefile
341                  tls/gnutls/Makefile
342                  tls/pkcs11/Makefile
343                  tls/tests/Makefile
344                 ])
345 AC_OUTPUT
346
347 echo ""
348 echo     "  Proxy support:     ${proxy_support:-no}"
349 echo     "  TLS support:       ${tls_support:-no}"
350 if test "$tls_support" != "no"; then
351     echo "  PKCS#11 Support:   $pkcs11_support"
352     echo "  TLS CA file:       ${with_ca_certificates:-(none)}"
353     if test "x$with_ca_certificates" != xno -a -n "$with_ca_certificates"; then
354         if ! test -f "$with_ca_certificates"; then
355             AC_MSG_WARN([Specified certificate authority file '$with_ca_certificates' does not exist])
356         fi
357     fi
358 fi