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