Compile with gcc warnings by default
[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.27.4],[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
12 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])],)
13 LT_INIT
14
15 dnl Checks for programs.
16 AC_PROG_CC
17 AC_PROG_CPP
18
19 dnl Checks for libraries.
20
21 dnl ****************************
22 dnl *** Checks for intltool  ***
23 dnl ****************************
24
25 IT_PROG_INTLTOOL([0.35.0])
26 GETTEXT_PACKAGE=glib-networking
27
28 AC_SUBST([GETTEXT_PACKAGE])
29 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[The gettext domain name])
30 AM_GLIB_GNU_GETTEXT
31
32 dnl *****************************
33 dnl *** Check GLib GIO        ***
34 dnl *****************************
35
36 PKG_CHECK_MODULES(GIO, [gio-2.0 >= 2.27.4])
37 AC_SUBST(GIO_CFLAGS)
38 AC_SUBST(GIO_LIBS)
39
40 GIO_MODULE_DIR=$($PKG_CONFIG --variable giomoduledir gio-2.0)
41 AS_IF([test "x$GIO_MODULE_DIR" = "x"],
42       [AC_MSG_FAILURE(GIO_MODULE_DIR is missing from gio-2.0.pc)])
43 AC_SUBST(GIO_MODULE_DIR)
44
45 AC_PATH_PROG(GIO_QUERYMODULES, gio-querymodules)
46 AC_SUBST(GIO_QUERYMODULES)
47
48 proxy_support=no
49 tls_support=no
50
51 dnl *****************************
52 dnl *** Checks for LibProxy   ***
53 dnl *****************************
54
55 AC_ARG_WITH(libproxy,
56     [AC_HELP_STRING([--with-libproxy],
57                     [support for libproxy @<:@default=check@:>@])],
58     [],
59     [with_libproxy=check])
60 AS_IF([test "x$with_libproxy" != "xno"],
61     [PKG_CHECK_MODULES(LIBPROXY, [libproxy-1.0 >= 0.3.1],
62         [with_libproxy=yes; proxy_support=libproxy],
63         [AS_IF([test "x$with_libproxy" = "xyes"],
64                [AC_MSG_FAILURE("$LIBPROXY_PKG_ERRORS")])])])
65 AM_CONDITIONAL(HAVE_LIBPROXY, [test "x$with_libproxy" = "xyes"])
66 AC_SUBST(LIBPROXY_CFLAGS)
67 AC_SUBST(LIBPROXY_LIBS)
68
69 dnl *****************************
70 dnl *** Checks for GNUTLS     ***
71 dnl *****************************
72 AC_ARG_WITH(gnutls,
73     [AC_HELP_STRING([--with-gnutls],
74                     [support for GNUTLS @<:@default=yes@:>@])],
75     [],
76     [with_gnutls=yes])
77 AS_IF([test "x$with_gnutls" != "xno"],
78     [PKG_CHECK_MODULES(GNUTLS, [gnutls >= 2.1.7],
79         [with_gnutls=yes
80          tls_support=gnutls
81          AM_PATH_LIBGCRYPT([])],
82         [AS_IF([test "x$with_gnutls" = "xyes"],
83                [AC_MSG_FAILURE("$GNUTLS_PKG_ERRORS")])])])
84 AM_CONDITIONAL(HAVE_GNUTLS, [test "x$with_gnutls" = "xyes"])
85 AC_SUBST(GNUTLS_CFLAGS)
86 AC_SUBST(GNUTLS_LIBS)
87
88 if test "x$with_gnutls" = "xyes"; then
89     AC_MSG_CHECKING([location of system Certificate Authority list])
90     AC_ARG_WITH(ca-certificates,
91                 [AC_HELP_STRING([--with-ca-certificates=@<:@path@:>@],
92                                 [path to system Certificate Authority list])])
93     if test "$with_ca_certificates" = "no"; then
94         AC_MSG_RESULT([disabled])
95     else
96         if test -z "$with_ca_certificates"; then
97             for f in /etc/pki/tls/certs/ca-bundle.crt \
98                      /etc/ssl/certs/ca-certificates.crt; do
99                 if test -f "$f"; then
100                     with_ca_certificates="$f"
101                 fi
102             done
103             if test -z "$with_ca_certificates"; then
104                 AC_MSG_ERROR([could not find. Use --with-ca-certificates=path to set, or --without-ca-certificates to disable])
105             fi
106         fi
107
108         AC_MSG_RESULT($with_ca_certificates)
109         AC_DEFINE_UNQUOTED(GTLS_SYSTEM_CA_FILE, ["$with_ca_certificates"], [The system TLS CA list])
110     fi
111 fi
112
113 dnl *************************************
114 dnl *** Warnings to show if using GCC ***
115 dnl *************************************
116
117 AC_ARG_ENABLE(more-warnings,
118               AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
119               set_more_warnings=no)
120
121 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
122         CFLAGS="$CFLAGS \
123                 -Wall -Wstrict-prototypes -Wmissing-declarations \
124                 -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
125                 -Wdeclaration-after-statement -Wformat=2 -Winit-self \
126                 -Waggregate-return -Wmissing-format-attribute"
127
128         for option in -Wmissing-include-dirs -Wundef; do
129                 SAVE_CFLAGS="$CFLAGS"
130                 CFLAGS="$CFLAGS $option"
131                 AC_MSG_CHECKING([whether gcc understands $option])
132                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
133                                   [has_option=yes],
134                                   [has_option=no])
135                 AC_MSG_RESULT($has_option)
136                 if test $has_option = no; then
137                         CFLAGS="$SAVE_CFLAGS"
138                 fi
139         done
140 fi
141
142 dnl *****************************
143 dnl *** done                  ***
144 dnl *****************************
145 AC_CONFIG_FILES([Makefile
146                  po/Makefile.in po/Makefile
147                  proxy/libproxy/Makefile
148                  tls/gnutls/Makefile
149                 ])
150 AC_OUTPUT
151
152 echo ""
153 echo "  Proxy support: $proxy_support"
154 echo "  TLS support:   $tls_support"
155 if test "$tls_support" != "no"; then
156     echo "  TLS CA file:   ${with_ca_certificates:-(none)}"
157     if test -n "$with_ca_certificates"; then
158         if ! test -f "$with_ca_certificates"; then
159             AC_MSG_WARN([Specified certificate authority file '$with_ca_certificates' does not exist])
160         fi
161     fi
162 fi