Added gnutls_pkcs11_reinit().
[gnutls.git] / configure.ac
blob49230d7e4e7c039c7831c620bd5dd2deba506009
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 # 2009, 2010 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
7 # This file is part of GnuTLS.
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.
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.
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
24 AC_PREREQ(2.61)
25 AC_INIT([GnuTLS], [2.12.17], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([1.10 no-dist-gzip dist-bzip2 -Wall -Werror -Wno-override])
30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 AM_CONFIG_HEADER(config.h)
33 AC_MSG_RESULT([***
34 *** Checking for compilation programs...
37 dnl Checks for programs.
38 AC_PROG_CC
39 AC_PROG_LN_S
40 GTK_DOC_CHECK(1.1)
41 AC_PATH_PROG([GAA], [gaa])
42 if test "x$GAA" = "x"; then
43    AC_MSG_WARN([[***
44 *** GAA was not found.  It is only needed if you wish to modify
45 *** the source code or command-line description files.  In this case,
46 *** you may want to get it from http://gaa.sourceforge.net/ and
47 *** read doc/README.gaa.
48 ***]])
51 gl_EARLY
52 AC_C_INLINE
54 # For the C++ code
55 AC_PROG_CXX
56 AC_ARG_ENABLE(cxx,
57   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
58     use_cxx=$enableval, use_cxx=yes)
59 if test "$use_cxx" != "no"; then
60   AC_LANG_PUSH(C++)
61   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
62   AC_LANG_POP(C++)
64 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
65 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
67 LIBGNUTLS_HOOKS
68 LIBGNUTLS_EXTRA_HOOKS
70 AC_HEADER_STDC
71 AC_DEFINE([HAVE_STRINGS_H], 1, [Hard-code for src/cfg/.])
72 AC_DEFINE([HAVE_FLOAT_H], 1, [Hard-code for src/cfg/.])
73 AC_DEFINE([HAVE_LIMITS_H], 1, [Hard-code for src/cfg/.])
74 AC_DEFINE([HAVE_MATH_H], 1, [Hard-code for src/cfg/.])
75 AC_DEFINE([HAVE_CTYPE_H], 1, [Hard-code for src/cfg/.])
76 AC_DEFINE([HAVE_ERRNO_H], 1, [Hard-code for src/cfg/.])
78 # No fork on MinGW, disable some self-tests until we fix them.
79 AC_CHECK_FUNCS(fork,,)
80 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
82 dnl Check for p11-kit
83 AC_ARG_WITH(p11-kit,
84         AS_HELP_STRING([--without-p11-kit],
85                 [Build without p11-kit and PKCS#11 support]))
86 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
87 if test "$with_p11_kit" != "no"; then
88         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.11])
89         AC_DEFINE(ENABLE_PKCS11, 1, [Build PKCS#11 support])
90         CFLAGS="$CFLAGS $P11_KIT_CFLAGS"
91         LIBS="$LIBS $P11_KIT_LIBS"
92         with_p11_kit=yes
95 AC_CHECK_TYPES(uint,,, [
96 # include <sys/types.h>
99 # For Guile bindings.
100 opt_guile_bindings=yes
101 AC_MSG_CHECKING([whether building Guile bindings])
102 AC_ARG_ENABLE(guile,
103         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
104 opt_guile_bindings=$enableval)
105 AC_MSG_RESULT($opt_guile_bindings)
107 AC_ARG_WITH([--with-guile-site-dir],
108   [AS_HELP_STRING([--with-guile-site-dir],
109      [use the given directory as the Guile site (use with care)])])
111 if test "$opt_guile_bindings" = "yes"; then
112    AC_MSG_RESULT([***
113 *** Detecting GNU Guile...
116    AC_PATH_PROG([guile_snarf], [guile-snarf])
117    if test "x$guile_snarf" = "x"; then
118       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
119       opt_guile_bindings=no
120    else
121       GUILE_PROGS
122       GUILE_FLAGS
124       save_CFLAGS="$CFLAGS"
125       save_LIBS="$LIBS"
126       CFLAGS="$CFLAGS $GUILE_CFLAGS"
127       LIBS="$LIBS $GUILE_LDFLAGS"
128       AC_MSG_CHECKING([whether GNU Guile is recent enough])
129       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
130         [], [opt_guile_bindings=no])
131       CFLAGS="$save_CFLAGS"
132       LIBS="$save_LIBS"
134       if test "$opt_guile_bindings" = "yes"; then
135         AC_MSG_RESULT([yes])
136         case "x$with_guile_site_dir" in 
137              xno)
138                 # Use the default $(GUILE_SITE).
139                 GUILE_SITE_DIR
140                 ;;
141              x|xyes)
142                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
143                 # hack is used to allow `distcheck' to work (see
144                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
145                 GUILE_SITE="\$(datadir)/guile/site"
146                 AC_SUBST(GUILE_SITE)
147                 ;;
148              *)
149                 # Use the user-specified directory as $(GUILE_SITE).
150                 GUILE_SITE="$with_guile_site_dir"
151                 AC_SUBST(GUILE_SITE)
152                 ;;
153         esac
154         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
155         _gcc_cflags_save="$CFLAGS"
156         CFLAGS="${CFLAGS} -fgnu89-inline"
157         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
158                           gnu89_inline=yes, gnu89_inline=no)
159         AC_MSG_RESULT($gnu89_inline)
160         CFLAGS="$_gcc_cflags_save"
162         # Optional Guile functions.
163         save_CFLAGS="$CFLAGS"
164         save_LIBS="$LIBS"
165         CFLAGS="$CFLAGS $GUILE_CFLAGS"
166         LIBS="$LIBS $GUILE_LDFLAGS"
167         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
168         CFLAGS="$save_CFLAGS"
169         LIBS="$save_LIBS"
170       else
171         AC_MSG_RESULT([no])
172         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
173         opt_guile_bindings=no
174       fi
175    fi
177 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
178 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
179 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
181 dnl Check for libcfg+
183 SAVED_LIBS=$LIBS
184 AC_ARG_WITH(included-libcfg,
185         AS_HELP_STRING([--with-included-libcfg],
186                 [use the included libcfg+ (certtool only)]),
187         libcfg_enabled=$withval, 
188         libcfg_enabled=no
189 dnl We search for libcfg+ which is used by certtool
191         AC_CHECK_LIB(cfg+, cfg_get_context,:,
192                      libcfg_enabled=yes
193                      AC_MSG_WARN([[
194 *** 
195 *** Libcfg+ was not found. Will use the included one.]])))
197 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
198 LIBS=$SAVED_LIBS
200 AC_MSG_CHECKING([whether to use the included libcfg])
201 AC_MSG_RESULT($libcfg_enabled)
203 AC_LIBTOOL_WIN32_DLL
204 AC_PROG_LIBTOOL
206 gl_INIT
208 AC_ARG_ENABLE([gcc-warnings],
209   [AS_HELP_STRING([--enable-gcc-warnings],
210                   [turn on lots of GCC warnings (for developers)])],
211   [case $enableval in
212      yes|no) ;;
213      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
214    esac
215    gl_gcc_warnings=$enableval],
216   [gl_gcc_warnings=no]
219 if test "$gl_gcc_warnings" = yes; then
220   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
221   gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
223   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
224   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
225   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
226   nw="$nw -Wtraditional"            # Warns on #elif which we use often
227   nw="$nw -Wlogical-op"             # Too many false positives
228   nw="$nw -Wold-style-definition"   # 
229   nw="$nw -Wpadded"                 # Our structs are not padded
230   nw="$nw -Wunreachable-code"       # Too many false positives
231   nw="$nw -Wtraditional-conversion" # Too many warnings for now
232   nw="$nw -Wcast-qual"              # Too many warnings for now
233   nw="$nw -Waggregate-return"       # Too many warnings for now
234   nw="$nw -Wshadow"                 # Too many warnings for now
235   nw="$nw -Wswitch-default"         # Too many warnings for now
236   nw="$nw -Wswitch-enum"            # Too many warnings for now
237   nw="$nw -Wconversion"             # Too many warnings for now
238   nw="$nw -Wsign-conversion"        # Too many warnings for now
239   nw="$nw -Wformat-y2k"             # Too many warnings for now
240   nw="$nw -Wvla"                    # There is no point to avoid C99 variable length arrays
241   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
242   nw="$nw -Wunsafe-loop-optimizations"
243   nw="$nw -Wstrict-overflow"
244   nw="$nw -Wmissing-noreturn"
246   gl_MANYWARN_ALL_GCC([ws])
247   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
248   for w in $ws; do
249     gl_WARN_ADD([$w])
250   done
252   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
253   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
254   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
255   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
256   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
257   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
258   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
259   gl_WARN_ADD([-fdiagnostics-show-option])
262 # Export things for */configure.ac.
263 export WERROR_CFLAGS
264 export WSTACK_CFLAGS
265 export WARN_CFLAGS
266 export use_cxx
268 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
270 AC_CONFIG_SUBDIRS([lib])
271 AC_CONFIG_SUBDIRS([libextra])
273 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
274 AC_CONFIG_FILES([
275   Makefile
276   doc/Makefile
277   doc/credentials/Makefile
278   doc/credentials/openpgp/Makefile
279   doc/credentials/srp/Makefile
280   doc/credentials/x509/Makefile
281   doc/cyclo/Makefile
282   doc/doxygen/Doxyfile
283   doc/examples/Makefile
284   doc/manpages/Makefile
285   doc/reference/Makefile
286   doc/scripts/Makefile
287   gl/Makefile
288   gl/tests/Makefile
289   guile/Makefile
290   guile/modules/Makefile
291   guile/src/Makefile
292   guile/tests/Makefile
293   src/Makefile
294   src/cfg/Makefile
295   src/cfg/platon/Makefile
296   src/cfg/platon/str/Makefile
297   tests/Makefile
298   tests/key-id/Makefile
299   tests/dsa/Makefile
300   tests/openpgp-certs/Makefile
301   tests/safe-renegotiation/Makefile
302   tests/pathlen/Makefile
303   tests/pkcs1-padding/Makefile
304   tests/pkcs12-decode/Makefile
305   tests/pkcs8-decode/Makefile
306   tests/rsa-md5-collision/Makefile
307   tests/sha2/Makefile
308   tests/userid/Makefile
309   tests/suite/Makefile
312 AC_OUTPUT
314 AC_MSG_NOTICE([summary of build options:
316   version:          ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
317   Host type:        ${host}
318   Install prefix:   ${prefix}
319   Compiler:         ${CC}
320   Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
321   Library types:    Shared=${enable_shared}, Static=${enable_static}
322   Valgrind:         $opt_valgrind_tests ${VALGRIND}
323   Guile wrappers:   $opt_guile_bindings
324   C++ library:      $use_cxx
325   OpenSSL library:  $enable_openssl
326   /dev/crypto:      $enable_cryptodev
327   Crypto library:   $cryptolib
328   PKCS#11 support:  $with_p11_kit