Added a gnulib with GPL components for use by applications.
[gnutls:gnutls.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
3 #
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
5 #
6 # This file is part of GnuTLS.
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 # USA
22
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [3.2.6], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
27 AC_CANONICAL_HOST
28
29 AM_INIT_AUTOMAKE([1.12.2 no-dist-gzip dist-xz dist-lzip -Wall -Wno-override])
30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 AC_CONFIG_HEADERS([config.h])
32
33 AC_MSG_RESULT([***
34 *** Checking for compilation programs...
35 ])
36
37 dnl Checks for programs.
38 AC_PROG_CC
39 gl_EARLY
40 ggl_EARLY
41 AM_PROG_AS
42 AM_PROG_AR
43 AC_PROG_CXX
44 AM_PROG_CC_C_O
45 AC_PROG_YACC
46 AC_CHECK_PROG([AUTOGEN], [autogen], [autogen], [/bin/true])
47
48 if test x"$AUTOGEN" = "x/bin/true"; then
49   AC_MSG_WARN([[
50 ***
51 *** autogen not found. Will not link against libopts.
52 *** ]])
53 NEED_LIBOPTS_DIR=true
54 fi
55
56 # For includes/gnutls/gnutls.h.in.
57 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
58 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
59 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
60 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
61
62 touch suppressions.valgrind
63 dnl C and C++ capabilities
64 AC_C_INLINE
65 AC_HEADER_STDC
66
67 # For the C++ code
68 AC_ARG_ENABLE(cxx,
69   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
70     use_cxx=$enableval, use_cxx=yes)
71 if test "$use_cxx" != "no"; then
72   AC_LANG_PUSH(C++)
73   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
74   AC_LANG_POP(C++)
75 fi
76 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
77 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
78
79 dnl Detect windows build
80 case "$host" in
81   *mingw32* | *mingw64*)
82     have_win=yes
83   ;;
84   *darwin*)
85     have_macosx=yes
86   ;;
87   *)
88     have_elf=yes
89   ;;
90 esac
91
92 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
93 AM_CONDITIONAL(MACOSX, test "$have_macosx" = yes)
94 AM_CONDITIONAL(ELF, test "$have_elf" = yes)
95
96 dnl Hardware Acceleration
97 AC_ARG_ENABLE(hardware-acceleration,
98   AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
99     use_accel=$enableval, use_accel=yes)
100 hw_accel=none
101
102
103 if test "$use_accel" != "no"; then
104 case $host_cpu in
105   i?86 | x86_64 | amd64)
106       AC_CHECK_HEADERS(cpuid.h)
107       if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
108         hw_accel="x86-64"
109       else
110         hw_accel="x86"
111       fi
112   ;;
113   *)
114   ;;
115 esac
116
117 fi
118
119 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
120 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
121 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86-64")
122 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
123 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
124
125 dnl Try the hooks.m4
126 LIBGNUTLS_HOOKS
127 LIBGNUTLS_EXTRA_HOOKS
128
129 AC_ARG_ENABLE(doc,
130   AS_HELP_STRING([--disable-doc], [don't generate any documentation]),
131     enable_doc=$enableval, enable_doc=yes)
132 AM_CONDITIONAL(ENABLE_DOC, test "$enable_doc" != "no")
133
134 AC_ARG_ENABLE(tests,
135   AS_HELP_STRING([--disable-tests], [don't compile or run any tests]),
136     enable_tests=$enableval, enable_tests=yes)
137 AM_CONDITIONAL(ENABLE_TESTS, test "$enable_tests" != "no")
138
139 GTK_DOC_CHECK(1.1)
140 AM_GNU_GETTEXT([external])
141 AM_GNU_GETTEXT_VERSION([0.18])
142
143 AC_C_BIGENDIAN
144
145 gl_INIT
146 ggl_INIT
147
148 dnl GCC warnings to enable
149
150 AC_ARG_ENABLE([gcc-warnings],
151   [AS_HELP_STRING([--enable-gcc-warnings],
152                   [turn on lots of GCC warnings (for developers)])],
153   [case $enableval in
154      yes|no) ;;
155      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
156    esac
157    gl_gcc_warnings=$enableval],
158   [gl_gcc_warnings=no]
159 )
160
161 if test "$gl_gcc_warnings" = yes; then
162   gl_WARN_ADD([-Wframe-larger-than=1024], [WSTACK_CFLAGS])
163
164   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
165   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
166   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
167   nw="$nw -Wtraditional"            # Warns on #elif which we use often
168   nw="$nw -Wlogical-op"             # Too many false positives
169   nw="$nw -Wold-style-definition"   # 
170   nw="$nw -Wpadded"                 # Our structs are not padded
171   nw="$nw -Wunreachable-code"       # Too many false positives
172   nw="$nw -Wtraditional-conversion" # Too many warnings for now
173   nw="$nw -Wcast-qual"              # Too many warnings for now
174   nw="$nw -Waggregate-return"       # Too many warnings for now
175   nw="$nw -Wshadow"                 # Too many warnings for now
176   nw="$nw -Wswitch-default"         # Too many warnings for now
177   nw="$nw -Wswitch-enum"            # Too many warnings for now
178   nw="$nw -Wconversion"             # Too many warnings for now
179   nw="$nw -Wsign-conversion"        # Too many warnings for now
180   nw="$nw -Wformat-y2k"             # Too many warnings for now
181   nw="$nw -Woverlength-strings"     # We use some in tests/
182   nw="$nw -Wvla"                    # There is no point to avoid C99 variable length arrays
183   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
184   nw="$nw -Wunsafe-loop-optimizations"
185   nw="$nw -Wstrict-overflow"
186   nw="$nw -Wmissing-noreturn"
187   nw="$nw -Winline"                 # Too compiler dependent
188   nw="$nw -Wsuggest-attribute=pure" # Is it worth using attributes?
189   nw="$nw -Wsuggest-attribute=const" # Is it worth using attributes?
190   nw="$nw -Wsuggest-attribute=noreturn" # Is it worth using attributes?
191   nw="$nw -Wstack-protector"        # Some functions cannot be protected
192   nw="$nw -Wredundant-decls"        # Some files cannot be compiled with that (gl_fd_to_handle)
193
194   gl_MANYWARN_ALL_GCC([ws])
195   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
196   for w in $ws; do
197     gl_WARN_ADD([$w])
198   done
199
200   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
201   gl_WARN_ADD([-Wno-format-y2k])     # Too many warnings for now
202   gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
203   gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
204   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
205   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
206   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
207   gl_WARN_ADD([-fdiagnostics-show-option])
208 fi
209
210 AC_SUBST([WERROR_CFLAGS])
211 AC_SUBST([WSTACK_CFLAGS])
212 AC_SUBST([WARN_CFLAGS])
213
214 dnl Programs for compilation or development
215 AC_PROG_LN_S
216 AC_LIBTOOL_WIN32_DLL
217 AC_PROG_LIBTOOL
218
219
220 dnl No fork on MinGW, disable some self-tests until we fix them.
221 dnl Check clock_gettime and pthread_mutex_lock in libc (avoid linking to other libs)
222 AC_CHECK_FUNCS([fork getrusage getpwuid_r nanosleep daemon getpid clock_gettime pthread_mutex_lock iconv localtime vasprintf],,)
223 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
224
225 AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>
226 #include <signal.h>
227 ], [timer_create (0,0,0);])
228
229 if test "$ac_cv_func_pthread_mutex_lock" != "yes";then
230   AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
231 fi
232
233 if test "$ac_cv_func_nanosleep" != "yes";then
234   AC_LIB_HAVE_LINKFLAGS(rt,, [#include <time.h>], [nanosleep (0, 0);])
235 fi
236
237 ac_have_unicode=no
238 if test "$ac_cv_func_iconv" != "yes";then
239   AC_LIB_HAVE_LINKFLAGS(iconv,, [#include <iconv.h>], [iconv (0, 0, 0, 0, 0);])
240   if test "$HAVE_LIBICONV" = "yes";then
241     ac_have_unicode=yes
242   fi
243 else
244   ac_have_unicode=yes
245 fi
246
247 if test "$ac_have_unicode" != "yes";then
248   if test "$have_win" = "yes";then
249     ac_have_unicode=yes
250   fi
251 fi
252
253 AC_MSG_CHECKING([whether to build libdane])
254 AC_ARG_ENABLE(libdane,
255     AS_HELP_STRING([--disable-libdane],
256                    [disable the built of libdane]),
257     enable_dane=$enableval, enable_dane=yes)
258 AC_MSG_RESULT($enable_dane)
259
260 if test "$enable_dane" != "no"; then
261     LIBS="$oldlibs -lunbound"
262     AC_MSG_CHECKING([for unbound library])
263     AC_LINK_IFELSE([AC_LANG_PROGRAM([
264                    #include <unbound.h>],[
265                    struct ub_ctx* ctx;
266                    ctx = ub_ctx_create();])],
267                   [AC_MSG_RESULT(yes)
268                    AC_SUBST([UNBOUND_LIBS], [-lunbound])
269                    AC_SUBST([UNBOUND_CFLAGS], [])
270                    AC_DEFINE([HAVE_DANE], 1, [Enable the DANE library])
271                    enable_dane=yes],
272                   [AC_MSG_RESULT(no)
273                    AC_MSG_WARN([[
274 *** 
275 *** libunbound was not found. Libdane will not be built.
276 *** ]])
277                   enable_dane=no])
278     LIBS="$oldlibs"
279 fi
280
281 AM_CONDITIONAL(ENABLE_DANE, test "$enable_dane" = "yes")
282
283 AC_ARG_WITH(unbound-root-key-file, AS_HELP_STRING([--with-unbound-root-key-file],
284                                  [specify the unbound root key file]),
285             unbound_root_key_file="$withval", 
286 if test "$have_win" = yes; then
287     unbound_root_key_file="C:\\Program Files\\Unbound\\root.key"
288 else
289     unbound_root_key_file="/etc/unbound/root.key"
290 fi
291 )
292
293 AC_DEFINE_UNQUOTED([UNBOUND_ROOT_KEY_FILE],
294   ["$unbound_root_key_file"], [The DNSSEC root key file])
295
296 dnl Check for p11-kit
297 P11_KIT_MINIMUM=0.19.1
298 AC_ARG_WITH(p11-kit,
299         AS_HELP_STRING([--without-p11-kit],
300                 [Build without p11-kit and PKCS#11 support]))
301 if test "$with_p11_kit" != "no"; then
302         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= $P11_KIT_MINIMUM], [with_p11_kit=yes], [with_p11_kit=no])
303         if test "$with_p11_kit" != "no";then
304                 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
305                 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
306                         GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
307                 else
308                         GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
309                 fi
310         else
311                 with_p11_kit=no
312                 AC_MSG_WARN([[
313 *** 
314 *** p11-kit >= $P11_KIT_MINIMUM was not found. PKCS #11 support will be disabled.
315 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
316 *** ]])
317         fi
318 fi
319
320 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
321
322 AC_ARG_WITH(tpm,
323         AS_HELP_STRING([--without-tpm],
324                 [Disable TPM (trousers) support.]),
325                 [with_tpm=$withval], [with_tpm=yes])
326 if test "$with_tpm" != "no"; then
327     LIBS="$oldlibs -ltspi"
328     AC_MSG_CHECKING([for tss library])
329     AC_LINK_IFELSE([AC_LANG_PROGRAM([
330                    #include <trousers/tss.h>
331                    #include <trousers/trousers.h>],[
332                    int err = Tspi_Context_Create((void *)0);
333                    Trspi_Error_String(err);])],
334                   [AC_MSG_RESULT(yes)
335                    AC_SUBST([TSS_LIBS], [-ltspi])
336                    AC_SUBST([TSS_CFLAGS], [])
337                    AC_DEFINE([HAVE_TROUSERS], 1, [Enable TPM])
338                    with_tpm=yes],
339                   [AC_MSG_RESULT(no)
340                    AC_MSG_WARN([[
341 *** 
342 *** trousers was not found. TPM support will be disabled.
343 *** ]])
344                   with_tpm=no])
345     LIBS="$oldlibs"
346 fi
347
348 AM_CONDITIONAL(ENABLE_TROUSERS, test "$with_tpm" != "no")
349
350 ac_enable_local_libopts=yes
351 LIBOPTS_CHECK([src/libopts])
352 if test "$NEED_LIBOPTS_DIR" != "true";then
353         dnl delete libopts-generated files
354         for i in ${srcdir}/src/*-args.c.bak ${srcdir}/src/*-args.h.bak; do
355                 nam=`echo $i|sed 's/.bak//g'`
356                 if test -f $i;then
357                         cp -f $i $nam
358                 fi
359         done
360         AC_SUBST([AUTOGEN], [/bin/true])
361         ac_enable_local_libopts=no
362 fi
363
364 AC_CHECK_TYPE(ssize_t,
365   [
366     DEFINE_SSIZE_T="#include <sys/types.h>"
367     AC_SUBST(DEFINE_SSIZE_T)
368   ], [
369     AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
370     DEFINE_SSIZE_T="typedef int ssize_t;"
371     AC_SUBST(DEFINE_SSIZE_T)
372   ], [
373     #include <sys/types.h>
374   ])
375
376 # For minitasn1.
377 AC_CHECK_SIZEOF(unsigned long int, 4)
378 AC_CHECK_SIZEOF(unsigned int, 4)
379
380 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
381                                  [disable zlib compression support]),
382             ac_zlib=$withval, ac_zlib=yes)
383 AC_MSG_CHECKING([whether to include zlib compression support])
384 if test x$ac_zlib != xno; then
385  AC_MSG_RESULT(yes)
386  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
387  if test x$ac_cv_libz != xyes; then
388    AC_MSG_WARN(
389 *** 
390 *** ZLIB was not found. You will not be able to use ZLIB compression.)
391  fi
392 else
393  AC_MSG_RESULT(no)
394 fi
395
396 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
397
398 if test x$ac_zlib != xno; then
399   if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
400     if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
401       GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
402     else
403       GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
404     fi
405   fi
406 fi
407 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
408
409
410
411 AC_ARG_WITH([default-trust-store-pkcs11],
412   [AS_HELP_STRING([--with-default-trust-store-pkcs11=URI],
413     [use the given pkcs11 uri as default trust store])])
414
415 if test "x$with_default_trust_store_pkcs11" != x; then
416   if test "x$with_p11_kit" = xno; then
417     AC_MSG_ERROR([cannot use pkcs11 store without p11-kit])
418   fi
419   AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_PKCS11],
420     ["$with_default_trust_store_pkcs11"], [use the given pkcs11 uri as default trust store])
421 fi
422
423 dnl auto detect http://lists.gnu.org/archive/html/help-gnutls/2012-05/msg00004.html
424 AC_ARG_WITH([default-trust-store-file],
425   [AS_HELP_STRING([--with-default-trust-store-file=FILE],
426     [use the given file default trust store])], with_default_trust_store_file="$withval",
427   [if test "$build" = "$host";then
428   for i in \
429     /etc/ssl/ca-bundle.pem \
430     /etc/ssl/certs/ca-certificates.crt \
431     /etc/pki/tls/cert.pem \
432     /usr/local/share/certs/ca-root-nss.crt \
433     /etc/ssl/cert.pem
434     do
435     if test -e $i; then
436       with_default_trust_store_file="$i"
437       break
438     fi
439   done
440   fi]
441 )
442
443 if test "$with_default_trust_store_file" = "no";then
444   with_default_trust_store_file=""
445 fi
446
447 AC_ARG_WITH([default-crl-file],
448   [AS_HELP_STRING([--with-default-crl-file=FILE],
449     [use the given CRL file as default])])
450
451 if test "x$with_default_trust_store_file" != x; then
452   AC_DEFINE_UNQUOTED([DEFAULT_TRUST_STORE_FILE],
453     ["$with_default_trust_store_file"], [use the given file default trust store])
454 fi
455
456 if test "x$with_default_crl_file" != x; then
457   AC_DEFINE_UNQUOTED([DEFAULT_CRL_FILE],
458     ["$with_default_crl_file"], [use the given CRL file])
459 fi
460
461 dnl Guile bindings.
462 opt_guile_bindings=yes
463 AC_MSG_CHECKING([whether building Guile bindings])
464 AC_ARG_ENABLE(guile,
465         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
466 opt_guile_bindings=$enableval)
467 AC_MSG_RESULT($opt_guile_bindings)
468
469 AC_ARG_WITH([guile-site-dir],
470   [AS_HELP_STRING([--with-guile-site-dir],
471      [use the given directory as the Guile site (use with care)])])
472
473 if test "$opt_guile_bindings" = "yes"; then
474    AC_MSG_RESULT([***
475 *** Detecting GNU Guile...
476 ])
477
478    AC_PATH_PROG([guile_snarf], [guile-snarf])
479    if test "x$guile_snarf" = "x"; then
480       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
481       opt_guile_bindings=no
482    else
483       GUILE_PROGS
484       GUILE_FLAGS
485
486       save_CFLAGS="$CFLAGS"
487       save_LIBS="$LIBS"
488       CFLAGS="$CFLAGS $GUILE_CFLAGS"
489       LIBS="$LIBS $GUILE_LDFLAGS"
490       AC_MSG_CHECKING([whether GNU Guile is recent enough])
491       AC_LINK_IFELSE([AC_LANG_PROGRAM([], [scm_from_locale_string ("")])],
492         [], [opt_guile_bindings=no])
493       CFLAGS="$save_CFLAGS"
494       LIBS="$save_LIBS"
495
496       if test "$opt_guile_bindings" = "yes"; then
497         AC_MSG_RESULT([yes])
498         case "x$with_guile_site_dir" in 
499              xno)
500                 # Use the default $(GUILE_SITE).
501                 GUILE_SITE_DIR
502                 ;;
503              x|xyes)
504                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
505                 # hack is used to allow `distcheck' to work (see
506                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
507                 GUILE_SITE="\$(datadir)/guile/site"
508                 AC_SUBST(GUILE_SITE)
509                 ;;
510              *)
511                 # Use the user-specified directory as $(GUILE_SITE).
512                 GUILE_SITE="$with_guile_site_dir"
513                 AC_SUBST(GUILE_SITE)
514                 ;;
515         esac
516         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
517         _gcc_cflags_save="$CFLAGS"
518         CFLAGS="${CFLAGS} -fgnu89-inline"
519         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
520                           gnu89_inline=yes, gnu89_inline=no)
521         AC_MSG_RESULT($gnu89_inline)
522         CFLAGS="$_gcc_cflags_save"
523
524         # Optional Guile functions.
525         save_CFLAGS="$CFLAGS"
526         save_LIBS="$LIBS"
527         CFLAGS="$CFLAGS $GUILE_CFLAGS"
528         LIBS="$LIBS $GUILE_LDFLAGS"
529         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
530         CFLAGS="$save_CFLAGS"
531         LIBS="$save_LIBS"
532
533         # The place where guile-gnutls.la will go.
534         AC_MSG_CHECKING([the Guile effective version])
535         guile_effective_version="`$GUILE -c '(display (effective-version))'`"
536         AC_MSG_RESULT([$guile_effective_version])
537         guileextensiondir="$libdir/guile/$guile_effective_version"
538         AC_SUBST([guileextensiondir])
539       else
540         AC_MSG_RESULT([no])
541         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
542         opt_guile_bindings=no
543       fi
544    fi
545 fi
546 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
547
548 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
549 LIBGNUTLS_CFLAGS="-I${includedir}"
550 AC_SUBST(LIBGNUTLS_LIBS)
551 AC_SUBST(LIBGNUTLS_CFLAGS)
552
553
554 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
555 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
556
557 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
558 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
559 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
560
561 dnl Crywrap dependencies
562    AC_MSG_RESULT([***
563 *** Checking dependencies for crywrap...
564 ])
565
566 crywrap=no
567
568 if test "$have_win" != "yes"; then
569
570 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
571
572 dnl **********************
573 dnl * Typedefs & co
574 dnl **********************
575 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
576 [AC_LANG_PROGRAM([#include <sys/types.h>
577 #include <signal.h>
578 ],
579                  [return *(signal (0, 0)) (0) == 1;])],
580                    [ac_cv_type_signal=int],
581                    [ac_cv_type_signal=void])])
582 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
583                     (`int' or `void').])
584
585 AC_FUNC_SELECT_ARGTYPES
586 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
587                 putenv regcomp scandir select socket strcasecmp strchr \
588                 strdup strerror strncasecmp strrchr strstr strtoul uname])
589
590 AC_ARG_ENABLE(crywrap,
591         AS_HELP_STRING([--disable-crywrap], [unconditionally disable the crywrap TLS proxy service]))
592
593  libidn=no
594
595  if test "x$enable_crywrap" != "xno" ; then
596         PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
597         AC_CHECK_FUNCS([argp_usage],[ac_argp=yes],[ac_argp=no])
598  fi
599
600  if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no" && test "$ac_argp" != "no";then
601   crywrap=yes
602  fi
603
604 fi
605
606 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
607
608 dnl end of crywrap requirements
609
610 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
611 AC_CONFIG_FILES([
612   Makefile
613   doc/Makefile
614   doc/credentials/Makefile
615   doc/credentials/openpgp/Makefile
616   doc/credentials/srp/Makefile
617   doc/credentials/x509/Makefile
618   doc/cyclo/Makefile
619   doc/doxygen/Doxyfile
620   doc/examples/Makefile
621   doc/latex/Makefile
622   doc/manpages/Makefile
623   doc/reference/Makefile
624   doc/reference/version.xml
625   doc/scripts/Makefile
626   extra/Makefile
627   extra/includes/Makefile
628   libdane/Makefile
629   libdane/includes/Makefile
630   libdane/gnutls-dane.pc
631   gl/Makefile
632   gl/tests/Makefile
633   guile/Makefile
634   guile/modules/Makefile
635   guile/src/Makefile
636   guile/tests/Makefile
637   lib/Makefile
638   lib/accelerated/Makefile
639   lib/accelerated/x86/Makefile
640   lib/algorithms/Makefile
641   lib/auth/Makefile
642   lib/ext/Makefile
643   lib/extras/Makefile
644   lib/gnutls.pc
645   lib/includes/Makefile
646   lib/includes/gnutls/gnutls.h
647   lib/minitasn1/Makefile
648   lib/nettle/Makefile
649   lib/opencdk/Makefile
650   lib/openpgp/Makefile
651   lib/x509/Makefile
652   po/Makefile.in
653   src/Makefile
654   src/crywrap/Makefile
655   src/gl/Makefile
656   tests/Makefile
657   tests/cert-tests/Makefile
658   tests/dsa/Makefile
659   tests/dtls/Makefile
660   tests/srp/Makefile
661   tests/ecdsa/Makefile
662   tests/key-id/Makefile
663   tests/openpgp-certs/Makefile
664   tests/pkcs1-padding/Makefile
665   tests/pkcs12-decode/Makefile
666   tests/pkcs8-decode/Makefile
667   tests/rsa-md5-collision/Makefile
668   tests/safe-renegotiation/Makefile
669   tests/scripts/Makefile
670   tests/sha2/Makefile
671   tests/slow/Makefile
672   tests/suite/Makefile
673   tests/userid/Makefile
674 ])
675
676 AC_OUTPUT
677
678 dnl  Warning flags:        errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
679 dnl  Valgrind:             $opt_valgrind_tests ${VALGRIND}
680 AC_MSG_NOTICE([summary of build options:
681
682   version:              ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
683   Host/Target system:   ${host}
684   Build system:         ${build}
685   Install prefix:       ${prefix}
686   Compiler:             ${CC}
687   CFlags:               ${CFLAGS}
688   Library types:        Shared=${enable_shared}, Static=${enable_static}
689 ])
690
691 AC_MSG_NOTICE([External hardware support:
692
693   /dev/crypto:          $enable_cryptodev
694   Hardware accel:       $hw_accel
695   PKCS#11 support:      $with_p11_kit
696   TPM support:          $with_tpm
697 ])
698
699 AC_MSG_NOTICE([Optional features:
700 (note that included applications might not compile properly
701 if features are disabled)
702
703   DTLS-SRTP support:    $ac_enable_srtp
704   ALPN support:         $ac_enable_alpn
705   OCSP support:         $ac_enable_ocsp
706   OpenPGP support:      $ac_enable_openpgp
707   SRP support:          $ac_enable_srp
708   PSK support:          $ac_enable_psk
709   DHE support:          $ac_enable_dhe
710   ECDHE support:        $ac_enable_ecdhe
711   Anon auth support:    $ac_enable_anon
712   Heartbeat support:    $ac_enable_heartbeat
713   RSA-EXPORT compat:    $ac_enable_rsa_export
714   Unicode support:      $ac_have_unicode
715 ])
716
717 AC_MSG_NOTICE([Optional applications:
718
719   crywrap app:          $libidn
720   local libopts:        ${ac_enable_local_libopts}
721   local libtasn1:       ${included_libtasn1}
722 ])
723
724 AC_MSG_NOTICE([Optional libraries:
725
726   Guile wrappers:       $opt_guile_bindings
727   C++ library:          $use_cxx
728   DANE library:         $enable_dane
729   OpenSSL compat:       $enable_openssl
730 ])
731
732 AC_MSG_NOTICE([System files:
733
734   Trust store pkcs:     $with_default_trust_store_pkcs11
735   Trust store file:     $with_default_trust_store_file
736   CRL file:             $with_default_crl_file
737   DNSSEC root key file: $unbound_root_key_file
738 ])
739
740 if test ! -f "$unbound_root_key_file"; then
741 AC_MSG_WARN([[
742 *** 
743 *** The DNSSEC root key file in $unbound_root_key_file was not found. 
744 *** This file is needed for the verification of DNSSEC responses.
745 *** Use the command: unbound-anchor -a "$unbound_root_key_file"
746 *** to generate or update it.
747 *** ]])
748 fi