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