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