Bump versions.
[gnutls:gnutls.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
3 #    Free Software Foundation, Inc.
4 #
5 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 #
7 # This file is part of GNUTLS.
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
13 #
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22 # USA
23
24 AC_PREREQ(2.61)
25 AC_INIT([GnuTLS], [2.7.2], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
28
29 AM_INIT_AUTOMAKE([1.10 dist-bzip2 -Wall -Werror -Wno-override])
30 AM_CONFIG_HEADER(config.h)
31
32 opt_developer_mode=no
33 AC_MSG_CHECKING([whether to enable compiler warnings])
34 AC_ARG_ENABLE(developer-mode,
35         AS_HELP_STRING([--enable-developer-mode], [enable compiler warnings]),
36 opt_developer_mode=$enableval)
37 AC_MSG_RESULT($opt_developer_mode)
38
39 AC_MSG_RESULT([***
40 *** Checking for compilation programs...
41 ])
42
43 dnl Checks for programs.
44 AC_PROG_CC
45 AC_PROG_LN_S
46 GTK_DOC_CHECK(1.1)
47 AC_PATH_PROG([GAA], [gaa])
48 if test "x$GAA" = "x"; then
49    AC_MSG_WARN([[***
50 *** GAA was not found.  It is only needed if you wish to modify
51 *** the source code or command-line description files.  In this case,
52 *** you may want to get it from http://gaa.sourceforge.net/
53 ***]])
54 fi
55 AM_CONDITIONAL(HAVE_GCC,   test "x$GCC" = "xyes")
56
57
58 AC_MSG_RESULT([***
59 *** Detecting compiler options...
60 ])
61
62 gl_EARLY
63 AC_C_INLINE
64
65 LIBGNUTLS_HOOKS
66 LIBGNUTLS_EXTRA_HOOKS
67
68 if test $ac_cv_c_compiler_gnu != no; then
69
70         if test x$opt_developer_mode = xyes; then
71            AC_MSG_CHECKING([whether gcc supports various warning flags])
72            _gcc_cflags_save="$CFLAGS"
73            CFLAGS="${CFLAGS} -Wall -W -Wchar-subscripts -Wformat-security -Wnonnull -Winit-self -Wmissing-include-dirs -Wunused -Wno-unused-parameter -Wfloat-equal -Wdeclaration-after-statement -Wshadow -Wunsafe-loop-optimizations -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wpacked -Wredundant-decls -Wnested-externs -Winline -Wvolatile-register-var -Wdisabled-optimization -Wstack-protector -Woverlength-strings"
74            #removed "-Wlogical-op" and "-Wvla" which are not supported by my gcc --nmav
75            # -Wtraditional: warns on #elif which we use often
76            # -Wundef: warns on '#if GNULIB_PORTCHECK' etc in gnulib headers
77            # -Wpadded: many of our structs are not optimized for padding
78            # -Wtraditional-conversion: we catch missing prototypes anyway
79            # -Wno-unused-parameter: added because -Wunused cause too many warns
80            # -Wunreachable-code: appears to return many false positives
81            # -Wconversion: too many warnings for now
82            # -Wswitch-default: too many warnings for now
83            # -Wswitch-enum: too many warnings for now
84            AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_warns=yes,_gcc_warns=no)
85            AC_MSG_RESULT($_gcc_warns)
86            if test x"$_gcc_warns" != xyes ; then
87               CFLAGS=$_gcc_cflags_save;
88            fi
89         fi
90
91         AC_MSG_CHECKING([whether gcc supports -Wno-pointer-sign])
92         _gcc_cflags_save="$CFLAGS"
93         CFLAGS="${CFLAGS} -Wno-pointer-sign"
94         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
95         AC_MSG_RESULT($_gcc_psign)
96         if test "$_gcc_psign" != "yes"; then
97           CFLAGS="$_gcc_cflags_save";
98         fi
99
100         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
101         _gcc_cflags_save="$CFLAGS"
102         CFLAGS="${CFLAGS} -fgnu89-inline"
103         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
104           _gcc_gnu89_inline=yes, _gcc_gnu89_inline=no)
105         AC_MSG_RESULT($_gcc_gnu89_inline)
106         CFLAGS="$_gcc_cflags_save"
107 fi
108
109 # Needs to be called outside of 'if' clause.
110 AM_CONDITIONAL([HAVE_GCC_GNU89_INLINE_OPTION],
111                [test "$_gcc_gnu89_inline" = "yes"])
112
113 AC_MSG_RESULT([***
114 *** Detecting C library capabilities...
115 ])
116
117 AC_HEADER_STDC
118 AC_CHECK_FUNCS(fork,,)
119 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
120 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
121 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
122 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
123 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
124 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
125
126 # No fork on MinGW, disable some self-tests until we fix them.
127 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
128
129 AC_MSG_RESULT([***
130 *** Detecting system's parameters...
131 ])
132
133 # Run self-tests under valgrind?
134 if test "$cross_compiling" = no; then
135   AC_CHECK_PROGS(VALGRIND, valgrind)
136 fi
137 if test -n "$VALGRIND" && $VALGRIND true > /dev/null 2>&1; then
138   opt_valgrind_tests=yes
139 else
140   opt_valgrind_tests=no
141   VALGRIND=
142 fi 
143 AC_MSG_CHECKING([whether self tests are run under valgrind])
144 AC_ARG_ENABLE(valgrind-tests,
145         AS_HELP_STRING([--enable-valgrind-tests],
146                        [run self tests under valgrind]),
147   opt_valgrind_tests=$enableval)
148 AC_MSG_RESULT($opt_valgrind_tests)
149
150 AC_CHECK_TYPES(uint,,, [
151 # include <sys/types.h>
152 ])
153
154 AC_MSG_RESULT([***
155 *** Checking for external libraries...
156 ])
157
158 # For Guile bindings.
159
160 opt_guile_bindings=yes
161 AC_MSG_CHECKING([whether building Guile bindings])
162 AC_ARG_ENABLE(guile,
163         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
164 opt_guile_bindings=$enableval)
165 AC_MSG_RESULT($opt_guile_bindings)
166
167 AC_ARG_WITH([--with-guile-site-dir],
168   [AS_HELP_STRING([--with-guile-site-dir],
169      [use the given directory as the Guile site (use with care)])])
170
171 if test "x$opt_guile_bindings" = "xyes"; then
172    AC_MSG_RESULT([***
173 *** Detecting GNU Guile...
174 ])
175
176    AC_PATH_PROG([guile_snarf], [guile-snarf])
177    if test "x$guile_snarf" = "x"; then
178       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
179       opt_guile_bindings=no
180    else
181       GUILE_PROGS
182       GUILE_FLAGS
183
184       save_CFLAGS="$CFLAGS"
185       save_LIBS="$LIBS"
186       CFLAGS="$CFLAGS $GUILE_CFLAGS"
187       LIBS="$LIBS $GUILE_LDFLAGS"
188       AC_MSG_CHECKING([whether GNU Guile is recent enough])
189       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
190         [], [opt_guile_bindings=no])
191       CFLAGS="$save_CFLAGS"
192       LIBS="$save_LIBS"
193
194       if test "x$opt_guile_bindings" = "xyes"; then
195         AC_MSG_RESULT([yes])
196         case "x$with_guile_site_dir" in 
197              xno)
198                 # Use the default $(GUILE_SITE).
199                 GUILE_SITE_DIR
200                 ;;
201              x|xyes)
202                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
203                 # hack is used to allow `distcheck' to work (see
204                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
205                 GUILE_SITE="\$(datadir)/guile/site"
206                 AC_SUBST(GUILE_SITE)
207                 ;;
208              *)
209                 # Use the user-specified directory as $(GUILE_SITE).
210                 GUILE_SITE="$with_guile_site_dir"
211                 AC_SUBST(GUILE_SITE)
212                 ;;
213         esac
214       else
215         AC_MSG_RESULT([no])
216         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
217         opt_guile_bindings=no
218       fi
219    fi
220 fi
221 AM_CONDITIONAL(HAVE_GUILE, test "x$opt_guile_bindings" = "xyes")
222
223 dnl Check for libcfg+
224
225 SAVED_LIBS=$LIBS
226 AC_ARG_WITH(included-libcfg,
227         AS_HELP_STRING([--with-included-libcfg],
228                 [use the included libcfg+ (certtool only)]),
229         libcfg_enabled=$withval, 
230         libcfg_enabled=no
231 dnl We search for libcfg+ which is used by certtool
232 dnl
233         AC_CHECK_LIB(cfg+, cfg_get_context,:,
234                      libcfg_enabled=yes
235                      AC_MSG_WARN([[
236 *** 
237 *** Libcfg+ was not found. Will use the included one.]])))
238
239 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
240 LIBS=$SAVED_LIBS
241
242 AC_MSG_CHECKING([whether to use the included libcfg])
243 AC_MSG_RESULT($libcfg_enabled)
244
245 AC_MSG_RESULT([***
246 *** Setting up gnulib compatibility files...
247 ])
248 gl_INIT
249
250 AC_MSG_RESULT([***
251 *** Detecting options for shared libraries...
252 ])
253 AC_LIBTOOL_WIN32_DLL
254 AC_PROG_LIBTOOL
255
256 AC_CONFIG_SUBDIRS([lib])
257 AC_CONFIG_SUBDIRS([libextra])
258
259 AC_CONFIG_FILES([Makefile \
260         doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
261         doc/manpages/Makefile doc/reference/Makefile doc/doxygen/Doxyfile \
262         doc/credentials/Makefile doc/credentials/x509/Makefile \
263         doc/credentials/srp/Makefile doc/credentials/openpgp/Makefile \
264         gl/Makefile gl/tests/Makefile \
265         tests/Makefile tests/rsa-md5-collision/Makefile tests/userid/Makefile \
266         tests/pkcs1-padding/Makefile tests/pkcs8-decode/Makefile \
267         tests/pkcs12-decode/Makefile tests/pathlen/Makefile \
268         tests/key-id/Makefile tests/sha2/Makefile \
269         tests/openpgp-certs/Makefile \
270         src/Makefile \
271         src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
272         guile/Makefile guile/modules/Makefile \
273         guile/src/Makefile guile/tests/Makefile])
274
275 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
276
277 AC_OUTPUT