This patch fixes following kind of issue with automake 1.12
[gnutls.git] / configure.ac
blobee37707d23e0ee58093fa7cd832237996f934bc4
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000-2012 Free Software Foundation, Inc.
4 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
6 # This file is part of GnuTLS.
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.
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.
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
23 AC_PREREQ(2.61)
24 AC_INIT([GnuTLS], [3.0.19], [bug-gnutls@gnu.org])
25 AC_CONFIG_AUX_DIR([build-aux])
26 AC_CONFIG_MACRO_DIR([m4])
28 AM_INIT_AUTOMAKE([1.11 no-dist-gzip dist-xz dist-lzip -Wall -Werror -Wno-override])
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
30 AM_CONFIG_HEADER(config.h)
32 AC_MSG_RESULT([***
33 *** Checking for compilation programs...
36 dnl Checks for programs.
37 AC_PROG_CC
38 AM_PROG_AS
40 # automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
41 m4_pattern_allow([AM_PROG_AR])
42 AM_PROG_AR
44 AC_PROG_CXX
45 gl_EARLY
47 # For includes/gnutls/gnutls.h.in.
48 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
49 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
50 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
51 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
53 touch suppressions.valgrind
54 dnl C and C++ capabilities
55 AC_C_INLINE
56 AC_HEADER_STDC
58 # For the C++ code
59 AC_ARG_ENABLE(cxx,
60   AS_HELP_STRING([--disable-cxx], [unconditionally disable the C++ library]),
61     use_cxx=$enableval, use_cxx=yes)
62 if test "$use_cxx" != "no"; then
63   AC_LANG_PUSH(C++)
64   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], use_cxx=yes, use_cxx=no)
65   AC_LANG_POP(C++)
67 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
68 AM_CONDITIONAL(WANT_TEST_SUITE, [test -f tests/suite/mini-eagain2.c])
70 dnl Detect windows build
71 case "$host" in
72   *mingw32* | *mingw64*)
73     have_win=yes
74   ;;
75   *darwin*)
76     have_macosx=yes
77   ;;
78   *)
79     have_elf=yes
80   ;;
81 esac
83 AM_CONDITIONAL(WINDOWS, test "$have_win" = yes)
84 AM_CONDITIONAL(MACOSX, test "$have_macosx" = yes)
85 AM_CONDITIONAL(ELF, test "$have_elf" = yes)
87 dnl Hardware Acceleration
88 AC_ARG_ENABLE(hardware-acceleration,
89   AS_HELP_STRING([--disable-hardware-acceleration], [unconditionally disable hardware acceleration]),
90     use_accel=$enableval, use_accel=yes)
91 hw_accel=none
94 if test "$use_accel" != "no"; then
95 case $host_cpu in
96   i?86 | x86_64 | amd64)
97 dnl    GCC_FLAG_ADD([-maes -mpclmul],[X86])
98 dnl    if test "x$X86" = "xyes";then
99       AC_CHECK_HEADERS(cpuid.h)
100       if test "$host_cpu" = "x86_64" || test "$host_cpu" = "amd64"; then
101         hw_accel="x86-64"
102       else
103         hw_accel="x86"
104       fi
105 dnl    fi
106   ;;
107   *)
108   ;;
109 esac
113 AM_CONDITIONAL(ASM_X86_64, test x"$hw_accel" = x"x86-64")
114 AM_CONDITIONAL(ASM_X86_32, test x"$hw_accel" = x"x86")
115 AM_CONDITIONAL(ASM_X86, test x"$hw_accel" = x"x86" || test x"$hw_accel" = x"x86-64")
116 AM_CONDITIONAL(HAVE_GCC_GNU89_INLINE_OPTION, test "$gnu89_inline" = "yes"])
117 AM_CONDITIONAL(HAVE_GCC, test "$GCC" = "yes")
119 dnl Try the hooks.m4
120 LIBGNUTLS_HOOKS
121 LIBGNUTLS_EXTRA_HOOKS
123 GTK_DOC_CHECK(1.1)
124 AM_GNU_GETTEXT([external])
125 AM_GNU_GETTEXT_VERSION([0.18])
127 AC_C_BIGENDIAN
131 dnl No fork on MinGW, disable some self-tests until we fix them.
132 AC_CHECK_FUNCS([fork getrusage getpwuid_r daemon],,)
133 AM_CONDITIONAL(HAVE_FORK, test "$ac_cv_func_fork" != "no")
134 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
136 dnl Check for p11-kit
137 AC_ARG_WITH(p11-kit,
138         AS_HELP_STRING([--without-p11-kit],
139                 [Build without p11-kit and PKCS#11 support]))
140 if test "$with_p11_kit" != "no"; then
141         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.11], [with_p11_kit=yes], [with_p11_kit=no])
142         if test "$with_p11_kit" != "no";then
143                 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
144                 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
145                         GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
146                 else
147                         GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
148                 fi
149         else
150                 with_p11_kit=no
151                 AC_MSG_WARN([[
152 *** 
153 *** p11-kit was not found. PKCS #11 support will be disabled.
154 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
155 *** ]])
156         fi
159 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
161 enable_local_libopts=yes
162 dnl PKG_CHECK_MODULES([autoopts], autoopts >= 36.2.11,, [enable_local_libopts=yes])
164 NEED_LIBOPTS_DIR=true
165 LIBOPTS_CHECK([src/libopts])
167 AC_CHECK_TYPE(ssize_t,
168   [
169     DEFINE_SSIZE_T="#include <sys/types.h>"
170     AC_SUBST(DEFINE_SSIZE_T)
171   ], [
172     AC_DEFINE([NO_SSIZE_T], 1, [no ssize_t type was found])
173     DEFINE_SSIZE_T="typedef int ssize_t;"
174     AC_SUBST(DEFINE_SSIZE_T)
175   ], [
176     #include <sys/types.h>
177   ])
179 # For minitasn1.
180 AC_CHECK_SIZEOF(unsigned long int, 4)
181 AC_CHECK_SIZEOF(unsigned int, 4)
183 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
184                                  [disable zlib compression support]),
185             ac_zlib=$withval, ac_zlib=yes)
186 AC_MSG_CHECKING([whether to include zlib compression support])
187 if test x$ac_zlib != xno; then
188  AC_MSG_RESULT(yes)
189  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
190  if test x$ac_cv_libz != xyes; then
191    AC_MSG_WARN(
192 *** 
193 *** ZLIB was not found. You will not be able to use ZLIB compression.)
194  fi
195 else
196  AC_MSG_RESULT(no)
199 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
201 if test x$ac_zlib != xno; then
202   if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
203     if test "x$GNUTLS_REQUIRES_PRIVATE" = x; then
204       GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
205     else
206       GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE, zlib"
207     fi
208   else
209     GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
210   fi
212 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
213 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
216 gl_INIT
218 dnl GCC warnings to enable
220 AC_ARG_ENABLE([gcc-warnings],
221   [AS_HELP_STRING([--enable-gcc-warnings],
222                   [turn on lots of GCC warnings (for developers)])],
223   [case $enableval in
224      yes|no) ;;
225      *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
226    esac
227    gl_gcc_warnings=$enableval],
228   [gl_gcc_warnings=no]
231 if test "$gl_gcc_warnings" = yes; then
232   gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
233   gl_WARN_ADD([-Wframe-larger-than=5120], [WSTACK_CFLAGS])
235   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
236   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
237   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
238   nw="$nw -Wtraditional"            # Warns on #elif which we use often
239   nw="$nw -Wlogical-op"             # Too many false positives
240   nw="$nw -Wold-style-definition"   # 
241   nw="$nw -Wpadded"                 # Our structs are not padded
242   nw="$nw -Wunreachable-code"       # Too many false positives
243   nw="$nw -Wtraditional-conversion" # Too many warnings for now
244   nw="$nw -Wcast-qual"              # Too many warnings for now
245   nw="$nw -Waggregate-return"       # Too many warnings for now
246   nw="$nw -Wshadow"                 # Too many warnings for now
247   nw="$nw -Wswitch-default"         # Too many warnings for now
248   nw="$nw -Wswitch-enum"            # Too many warnings for now
249   nw="$nw -Wconversion"             # Too many warnings for now
250   nw="$nw -Wsign-conversion"        # Too many warnings for now
251   nw="$nw -Wformat-y2k"             # Too many warnings for now
252   nw="$nw -Wvla"                    # There is no point to avoid C99 variable length arrays
253   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
254   nw="$nw -Wunsafe-loop-optimizations"
255   nw="$nw -Wstrict-overflow"
256   nw="$nw -Wmissing-noreturn"
258   gl_MANYWARN_ALL_GCC([ws])
259   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
260   for w in $ws; do
261     gl_WARN_ADD([$w])
262   done
264   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
265   gl_WARN_ADD([-Wno-format-y2k])     # Too many warnings for now
266   gl_WARN_ADD([-Wno-suggest-attribute=pure])     # Too many warnings for now
267   gl_WARN_ADD([-Wno-suggest-attribute=const])     # Too many warnings for now
268   gl_WARN_ADD([-Wno-suggest-attribute=noreturn])     # Too many warnings for now
269   gl_WARN_ADD([-Wno-unused-value]) # warnings for things we don't want to get
270   gl_WARN_ADD([-Wno-unused-result]) # warnings for things we don't want to get
271   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
272   gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
273   gl_WARN_ADD([-Wno-stack-protector])  # Some functions cannot be protected
274   gl_WARN_ADD([-Wno-int-to-pointer-cast])  # Some files cannot be compiled with that (gl_fd_to_handle)
275   gl_WARN_ADD([-Wno-redundant-decls])  # Some files cannot be compiled with that (gl_fd_to_handle)
276   gl_WARN_ADD([-fdiagnostics-show-option])
279 AC_SUBST([WERROR_CFLAGS])
280 AC_SUBST([WSTACK_CFLAGS])
281 AC_SUBST([WARN_CFLAGS])
283 dnl Programs for compilation or development
284 AC_PROG_LN_S
285 AC_LIBTOOL_WIN32_DLL
286 AC_PROG_LIBTOOL
288 dnl Guile bindings.
289 opt_guile_bindings=yes
290 AC_MSG_CHECKING([whether building Guile bindings])
291 AC_ARG_ENABLE(guile,
292         AS_HELP_STRING([--enable-guile], [build GNU Guile bindings]),
293 opt_guile_bindings=$enableval)
294 AC_MSG_RESULT($opt_guile_bindings)
296 AC_ARG_WITH([--with-guile-site-dir],
297   [AS_HELP_STRING([--with-guile-site-dir],
298      [use the given directory as the Guile site (use with care)])])
300 if test "$opt_guile_bindings" = "yes"; then
301    AC_MSG_RESULT([***
302 *** Detecting GNU Guile...
305    AC_PATH_PROG([guile_snarf], [guile-snarf])
306    if test "x$guile_snarf" = "x"; then
307       AC_MSG_WARN([`guile-snarf' from Guile 1.8 not found.  Guile bindings not built.])
308       opt_guile_bindings=no
309    else
310       GUILE_PROGS
311       GUILE_FLAGS
313       save_CFLAGS="$CFLAGS"
314       save_LIBS="$LIBS"
315       CFLAGS="$CFLAGS $GUILE_CFLAGS"
316       LIBS="$LIBS $GUILE_LDFLAGS"
317       AC_MSG_CHECKING([whether GNU Guile is recent enough])
318       AC_LINK_IFELSE(AC_LANG_CALL([], [scm_from_locale_string]),
319         [], [opt_guile_bindings=no])
320       CFLAGS="$save_CFLAGS"
321       LIBS="$save_LIBS"
323       if test "$opt_guile_bindings" = "yes"; then
324         AC_MSG_RESULT([yes])
325         case "x$with_guile_site_dir" in 
326              xno)
327                 # Use the default $(GUILE_SITE).
328                 GUILE_SITE_DIR
329                 ;;
330              x|xyes)
331                 # Automatically derive $(GUILE_SITE) from $(pkgdatadir).  This
332                 # hack is used to allow `distcheck' to work (see
333                 # `DISTCHECK_CONFIGURE_FLAGS' in the top-level `Makefile.am').
334                 GUILE_SITE="\$(datadir)/guile/site"
335                 AC_SUBST(GUILE_SITE)
336                 ;;
337              *)
338                 # Use the user-specified directory as $(GUILE_SITE).
339                 GUILE_SITE="$with_guile_site_dir"
340                 AC_SUBST(GUILE_SITE)
341                 ;;
342         esac
343         AC_MSG_CHECKING([whether gcc supports -fgnu89-inline])
344         _gcc_cflags_save="$CFLAGS"
345         CFLAGS="${CFLAGS} -fgnu89-inline"
346         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
347                           gnu89_inline=yes, gnu89_inline=no)
348         AC_MSG_RESULT($gnu89_inline)
349         CFLAGS="$_gcc_cflags_save"
351         # Optional Guile functions.
352         save_CFLAGS="$CFLAGS"
353         save_LIBS="$LIBS"
354         CFLAGS="$CFLAGS $GUILE_CFLAGS"
355         LIBS="$LIBS $GUILE_LDFLAGS"
356         AC_CHECK_FUNCS([scm_gc_malloc_pointerless])
357         CFLAGS="$save_CFLAGS"
358         LIBS="$save_LIBS"
360         # The place where guile-gnutls.la will go.
361         AC_MSG_CHECKING([the Guile effective version])
362         guile_effective_version="`$GUILE -c '(display (effective-version))'`"
363         AC_MSG_RESULT([$guile_effective_version])
364         guileextensiondir="$libdir/guile/$guile_effective_version"
365         AC_SUBST([guileextensiondir])
366       else
367         AC_MSG_RESULT([no])
368         AC_MSG_WARN([A sufficiently recent GNU Guile not found.  Guile bindings not built.])
369         opt_guile_bindings=no
370       fi
371    fi
373 AM_CONDITIONAL(HAVE_GUILE, test "$opt_guile_bindings" = "yes")
375 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
376 LIBGNUTLS_CFLAGS="-I${includedir}"
377 AC_SUBST(LIBGNUTLS_LIBS)
378 AC_SUBST(LIBGNUTLS_CFLAGS)
381 AC_DEFINE([GNUTLS_COMPAT_H], 1, [Make sure we don't use old features in code.])
382 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
384 AC_DEFINE([fread_file], [_gnutls_fread_file], [static lib rename])
385 AC_DEFINE([read_file], [_gnutls_read_file], [static lib rename])
386 AC_DEFINE([read_binary_file], [_gnutls_read_binary_file], [static lib rename])
388 dnl Crywrap dependencies
389    AC_MSG_RESULT([***
390 *** Checking dependencies for crywrap...
393 crywrap=no
395 if test "$have_win" != "yes"; then
397 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h sys/select.h sys/types.h sys/wait.h])
399 dnl **********************
400 dnl * Typedefs & co
401 dnl **********************
402 AC_CACHE_CHECK([return type of signal handlers],[ac_cv_type_signal],[AC_COMPILE_IFELSE(
403 [AC_LANG_PROGRAM([#include <sys/types.h>
404 #include <signal.h>
406                  [return *(signal (0, 0)) (0) == 1;])],
407                    [ac_cv_type_signal=int],
408                    [ac_cv_type_signal=void])])
409 AC_DEFINE_UNQUOTED([RETSIGTYPE],[$ac_cv_type_signal],[Define as the return type of signal handlers
410                     (`int' or `void').])
412 AC_FUNC_SELECT_ARGTYPES
413 AC_CHECK_FUNCS([alarm atexit dup2 epoll_create kqueue memchr memset munmap \
414                 putenv regcomp scandir select socket strcasecmp strchr \
415                 strdup strerror strncasecmp strrchr strstr strtoul uname])
417 AC_ARG_ENABLE(crywrap,
418         AS_HELP_STRING([--disable-crywrap], [unconditionally disable the crywrap TLS proxy service]))
420  libidn=no
422  if test "x$enable_crywrap" != "xno" ; then
423         PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
424  fi
426  if test "x$libidn" != "xno" && test "$ac_cv_func_daemon" != "no";then
427   crywrap=yes
428  fi
432 AM_CONDITIONAL(ENABLE_CRYWRAP, test "x$crywrap" != "xno")
433 rm -f suppressions.valgrind
434 dnl end of crywrap requirements
436 AC_CONFIG_FILES([guile/pre-inst-guile], [chmod +x guile/pre-inst-guile])
437 AC_CONFIG_FILES([
438   Makefile
439   doc/Makefile
440   doc/credentials/Makefile
441   doc/credentials/openpgp/Makefile
442   doc/credentials/srp/Makefile
443   doc/credentials/x509/Makefile
444   doc/cyclo/Makefile
445   doc/doxygen/Doxyfile
446   doc/examples/Makefile
447   doc/latex/Makefile
448   doc/manpages/Makefile
449   doc/reference/Makefile
450   doc/reference/version.xml
451   doc/scripts/Makefile
452   extra/Makefile
453   extra/includes/Makefile
454   gl/Makefile
455   gl/tests/Makefile
456   guile/Makefile
457   guile/modules/Makefile
458   guile/src/Makefile
459   guile/tests/Makefile
460   lib/Makefile
461   lib/accelerated/Makefile
462   lib/accelerated/x86/Makefile
463   lib/algorithms/Makefile
464   lib/auth/Makefile
465   lib/ext/Makefile
466   lib/extras/Makefile
467   lib/gnutls.pc
468   lib/includes/Makefile
469   lib/includes/gnutls/gnutls.h
470   lib/minitasn1/Makefile
471   lib/nettle/Makefile
472   lib/opencdk/Makefile
473   lib/openpgp/Makefile
474   lib/x509/Makefile
475   po/Makefile.in
476   src/Makefile
477   src/crywrap/Makefile
478   tests/Makefile
479   tests/cert-tests/Makefile
480   tests/dsa/Makefile
481   tests/dtls/Makefile
482   tests/srp/Makefile
483   tests/ecdsa/Makefile
484   tests/key-id/Makefile
485   tests/openpgp-certs/Makefile
486   tests/pkcs1-padding/Makefile
487   tests/pkcs12-decode/Makefile
488   tests/pkcs8-decode/Makefile
489   tests/rsa-md5-collision/Makefile
490   tests/safe-renegotiation/Makefile
491   tests/scripts/Makefile
492   tests/sha2/Makefile
493   tests/slow/Makefile
494   tests/suite/Makefile
495   tests/userid/Makefile
498 AC_OUTPUT
500 AC_MSG_NOTICE([summary of build options:
502   version:          ${VERSION} shared $LT_CURRENT:$LT_REVISION:$LT_AGE
503   Host type:        ${host}
504   Install prefix:   ${prefix}
505   Compiler:         ${CC}
506   CFlags:           ${CFLAGS}
507   Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
508   Library types:    Shared=${enable_shared}, Static=${enable_static}
509   Valgrind:         $opt_valgrind_tests ${VALGRIND}
512 AC_MSG_NOTICE([Optional features:
513 (note that included applications might not compile properly
514 if features are disabled)
516   OCSP support:     $ac_enable_ocsp
517   OpenPGP support:  $ac_enable_openpgp
518   SRP support:      $ac_enable_srp
519   PSK support:      $ac_enable_psk
520   Anon auth support:$ac_enable_anon
523 AC_MSG_NOTICE([Optional applications:
525   crywrap app:      $libidn
526   local libopts:    $enable_local_libopts
529 AC_MSG_NOTICE([Optional libraries:
531   Guile wrappers:   $opt_guile_bindings
532   C++ library:      $use_cxx
533   OpenSSL compat:   $enable_openssl
536 AC_MSG_NOTICE([Hardware acceleration/support:
538   /dev/crypto:      $enable_cryptodev
539   Hardware accel:   $hw_accel
540   PKCS#11 support:  $with_p11_kit