2.29.18
[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.29.18],[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
11 AM_MAINTAINER_MODE([enable])
12 m4_ifdef([AM_SILENT_RULES],[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 intltool  ***
24 dnl ****************************
25
26 IT_PROG_INTLTOOL([0.35.0])
27 GETTEXT_PACKAGE=glib-networking
28
29 AC_SUBST([GETTEXT_PACKAGE])
30 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
31 AM_GLIB_GNU_GETTEXT
32
33 dnl *****************************
34 dnl *** Check GLib GIO        ***
35 dnl *****************************
36 AM_PATH_GLIB_2_0(2.29.18,,AC_MSG_ERROR(GLIB not found),gio)
37
38 GIO_MODULE_DIR=$($PKG_CONFIG --variable giomoduledir gio-2.0)
39 AS_IF([test "x$GIO_MODULE_DIR" = "x"],
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 dnl *****************************
47 dnl *** Checks for LibProxy   ***
48 dnl *****************************
49
50 AC_ARG_WITH(libproxy,
51     [AC_HELP_STRING([--with-libproxy],
52                     [support for libproxy @<:@default=check@:>@])],
53     [],
54     [with_libproxy=check])
55 AS_IF([test "x$with_libproxy" != "xno"],
56     [PKG_CHECK_MODULES(LIBPROXY, [libproxy-1.0 >= 0.3.1],
57         [with_libproxy=yes; proxy_support=libproxy],
58         [AS_IF([test "x$with_libproxy" = "xyes"],
59                [AC_MSG_FAILURE("$LIBPROXY_PKG_ERRORS")])])])
60 AM_CONDITIONAL(HAVE_LIBPROXY, [test "x$with_libproxy" = "xyes"])
61 AC_SUBST(LIBPROXY_CFLAGS)
62 AC_SUBST(LIBPROXY_LIBS)
63
64 dnl **************************************
65 dnl *** Checks for GNOME proxy backend ***
66 dnl **************************************
67 AC_ARG_WITH(gnome-proxy,
68     [AC_HELP_STRING([--with-gnome-proxy],
69                     [support for GNOME proxy configuration @<:@default=check@:>@])]
70     [],
71     [with_gnome_proxy=check])
72 AS_IF([test "x$with_gnome_proxy" != "xno"],
73     [PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, [gsettings-desktop-schemas],
74         [with_gnome_proxy=yes; proxy_support="gnome $proxy_support"],
75         [AS_IF([test "x$with_gnome_proxy" = "xyes"],
76                [AC_MSG_FAILURE("$GSETTINGS_DESKTOP_SCHEMAS_PKG_ERRORS")])])])
77 AM_CONDITIONAL(HAVE_GNOME_PROXY, [test "x$with_gnome_proxy" = "xyes"])
78 AC_SUBST(GSETTINGS_DESKTOP_SCHEMAS_CFLAGS)
79
80 dnl *****************************
81 dnl *** Checks for GNUTLS     ***
82 dnl *****************************
83 AC_ARG_WITH(gnutls,
84     [AC_HELP_STRING([--with-gnutls],
85                     [support for GNUTLS @<:@default=yes@:>@])],
86     [],
87     [with_gnutls=yes])
88 AS_IF([test "x$with_gnutls" != "xno"],
89     [PKG_CHECK_MODULES(GNUTLS, [gnutls >= 2.1.7],
90         [with_gnutls=yes
91          tls_support=gnutls
92          AM_PATH_LIBGCRYPT([])],
93         [AS_IF([test "x$with_gnutls" = "xyes"],
94                [AC_MSG_FAILURE("$GNUTLS_PKG_ERRORS")])])])
95 AM_CONDITIONAL(HAVE_GNUTLS, [test "x$with_gnutls" = "xyes"])
96 AC_SUBST(GNUTLS_CFLAGS)
97 AC_SUBST(GNUTLS_LIBS)
98
99 if test "x$with_gnutls" = "xyes"; then
100     AC_MSG_CHECKING([location of system Certificate Authority list])
101     AC_ARG_WITH(ca-certificates,
102                 [AC_HELP_STRING([--with-ca-certificates=@<:@path@:>@],
103                                 [path to system Certificate Authority list])])
104     if test "$with_ca_certificates" = "no"; then
105         AC_MSG_RESULT([disabled])
106     else
107         if test -z "$with_ca_certificates"; then
108             for f in /etc/pki/tls/certs/ca-bundle.crt \
109                      /etc/ssl/certs/ca-certificates.crt; do
110                 if test -f "$f"; then
111                     with_ca_certificates="$f"
112                 fi
113             done
114             if test -z "$with_ca_certificates"; then
115                 AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or --without-ca-certificates to disable])
116             fi
117         fi
118
119         AC_MSG_RESULT($with_ca_certificates)
120         AC_DEFINE_UNQUOTED(GTLS_SYSTEM_CA_FILE, ["$with_ca_certificates"], [The system TLS CA list])
121     fi
122 fi
123
124 dnl *************************************
125 dnl *** Warnings to show if using GCC ***
126 dnl *************************************
127
128 AC_ARG_ENABLE(more-warnings,
129               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
130               set_more_warnings=no)
131
132 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
133         CFLAGS="$CFLAGS \
134                 -Wall -Wstrict-prototypes -Wmissing-declarations \
135                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
136                 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
137                 -Waggregate-return -Wmissing-format-attribute"
138
139         for option in -Wmissing-include-dirs -Wundef; do
140                 SAVE_CFLAGS="$CFLAGS"
141                 CFLAGS="$CFLAGS $option"
142                 AC_MSG_CHECKING([whether gcc understands $option])
143                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
144                                   [has_option=yes],
145                                   [has_option=no])
146                 AC_MSG_RESULT($has_option)
147                 if test $has_option = no; then
148                         CFLAGS="$SAVE_CFLAGS"
149                 fi
150         done
151 fi
152
153 dnl ************************************
154 dnl *** Enable lcov coverage reports ***
155 dnl ************************************
156
157 AC_ARG_ENABLE(gcov,
158   AS_HELP_STRING([--enable-gcov],
159                  [Enable gcov]),
160   [use_gcov=$enableval], [use_gcov=no])
161
162 if test "x$use_gcov" = "xyes"; then
163   dnl we need gcc:
164   if test "$GCC" != "yes"; then
165     AC_MSG_ERROR([GCC is required for --enable-gcov])
166   fi
167
168   ltp_version_list="1.6 1.7 1.8 1.9"
169   AC_CHECK_PROG(LTP, lcov, lcov)
170   AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
171
172   if test "$LTP"; then
173     AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
174       glib_cv_ltp_version=invalid
175       ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
176       for ltp_check_version in $ltp_version_list; do
177         if test "$ltp_version" = "$ltp_check_version"; then
178           glib_cv_ltp_version="$ltp_check_version (ok)"
179         fi
180       done
181     ])
182   else
183     ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
184     AC_MSG_ERROR([$ltp_msg])
185   fi
186
187   case $glib_cv_ltp_version in
188     ""|invalid[)]
189       ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
190       AC_MSG_ERROR([$ltp_msg])
191       LTP="exit 0;"
192       ;;
193   esac
194
195   if test -z "$LTP_GENHTML"; then
196     AC_MSG_ERROR([Could not find genhtml from the LTP package])
197   fi
198
199   AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
200
201   dnl Remove all optimization flags from CFLAGS
202   changequote({,})
203   CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
204   changequote([,])
205
206   dnl Add the special gcc flags
207   CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
208   LDFLAGS="$LDFLAGS -lgcov"
209 fi
210
211 dnl *****************************
212 dnl *** done                  ***
213 dnl *****************************
214 AC_CONFIG_FILES([Makefile
215                  po/Makefile.in po/Makefile
216                  proxy/libproxy/Makefile
217                  proxy/gnome/Makefile
218                  tls/gnutls/Makefile
219                  tls/tests/Makefile
220                 ])
221 AC_OUTPUT
222
223 echo ""
224 echo "  Proxy support: ${proxy_support:-no}"
225 echo "  TLS support:   ${tls_support:-no}"
226 if test "$tls_support" != "no"; then
227     echo "  TLS CA file:   ${with_ca_certificates:-(none)}"
228     if test -n "$with_ca_certificates"; then
229         if ! test -f "$with_ca_certificates"; then
230             AC_MSG_WARN([Specified certificate authority file '$with_ca_certificates' does not exist])
231         fi
232     fi
233 fi