Fixed leaks in key generation and other cleanups. Patch by Tomas Mraz.
[gnutls.git] / lib / configure.ac
blob0cccf1fed332a63e343022b75f6db6f7c2a47eaa
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
3 # 2009, 2010 Free Software Foundation, Inc.
5 # Author: Nikos Mavrogiannopoulos, Simon Josefsson
7 # This file is part of GnuTLS.
9 # The GnuTLS is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public License
11 # as published by the Free Software Foundation; either version 2.1 of
12 # the License, or (at your option) any later version.
14 # The GnuTLS is distributed in the hope that it will be
15 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # Lesser General Public License for more details.
19 # You should have received a copy of the GNU Lesser General Public
20 # License along with GnuTLS; if not, write to the Free
21 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22 # MA 02110-1301, USA
24 AC_PREREQ(2.61)
25 AC_INIT([libgnutls], [2.12.17], [bug-gnutls@gnu.org])
26 AC_CONFIG_AUX_DIR([build-aux])
27 AC_CONFIG_MACRO_DIR([m4])
29 AM_INIT_AUTOMAKE([1.10 -Wall -Werror -Wno-override])
30 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 AM_CONFIG_HEADER(config.h)
33 AC_PROG_CC
34 lgl_EARLY
36 AC_LIBTOOL_WIN32_DLL
37 AC_PROG_LIBTOOL
39 LIBGNUTLS_HOOKS
41 AM_GNU_GETTEXT([external])
42 AM_GNU_GETTEXT_VERSION([0.17])
44 AC_C_BIGENDIAN
46 # For includes/gnutls/gnutls.h.in.
47 AC_SUBST(MAJOR_VERSION, `echo $PACKAGE_VERSION | sed 's/\(.*\)\..*\..*/\1/g'`)
48 AC_SUBST(MINOR_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\.\(.*\)\..*/\1/g'`)
49 AC_SUBST(PATCH_VERSION, `echo $PACKAGE_VERSION | sed 's/.*\..*\.\(.*\)/\1/g'`)
50 AC_SUBST(NUMBER_VERSION, `printf "0x%02x%02x%02x" $MAJOR_VERSION $MINOR_VERSION $PATCH_VERSION`)
51 AC_CHECK_TYPE(ssize_t,
52   [
53     DEFINE_SSIZE_T="#include <sys/types.h>"
54     AC_SUBST(DEFINE_SSIZE_T)
55   ], [
56     AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
57     DEFINE_SSIZE_T="typedef int ssize_t;"
58     AC_SUBST(DEFINE_SSIZE_T)
59   ], [
60     #include <sys/types.h>
61   ])
63 # For minitasn1.
64 AC_CHECK_SIZEOF(unsigned long int, 4)
65 AC_CHECK_SIZEOF(unsigned int, 4)
67 AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
68                                  [disable zlib compression support]),
69             ac_zlib=$withval, ac_zlib=yes)
70 AC_MSG_CHECKING([whether to include zlib compression support])
71 if test x$ac_zlib != xno; then
72  AC_MSG_RESULT(yes)
73  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
74  if test "$ac_cv_libz" != yes; then
75    AC_MSG_WARN(
76 *** 
77 *** ZLIB was not found. You will not be able to use ZLIB compression.)
78  fi
79 else
80  AC_MSG_RESULT(no)
83 PKG_CHECK_EXISTS(zlib, ZLIB_HAS_PKGCONFIG=y, ZLIB_HAS_PKGCONFIG=n)
85 if test x$ac_zlib != xno; then
86   if test "$ZLIB_HAS_PKGCONFIG" = "y" ; then
87     if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
88       GNUTLS_REQUIRES_PRIVATE="Requires.private: zlib"
89     else
90       GNUTLS_REQUIRES_PRIVATE="$GNUTLS_REQUIRES_PRIVATE , zlib"
91     fi
92   else
93     GNUTLS_ZLIB_LIBS_PRIVATE="$LTLIBZ"
94   fi
96 AC_SUBST(GNUTLS_REQUIRES_PRIVATE)
97 AC_SUBST(GNUTLS_ZLIB_LIBS_PRIVATE)
99 dnl Check for p11-kit
100 AC_ARG_WITH(p11-kit,
101         AS_HELP_STRING([--without-p11-kit],
102                 [Build without p11-kit and PKCS#11 support]))
103 AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
104 if test "$with_p11_kit" != "no"; then
105         PKG_CHECK_MODULES(P11_KIT, [p11-kit-1 >= 0.4], [with_p11_kit=yes], [with_p11_kit=no])
106         if test "$with_p11_kit" != "no";then
107                 AC_DEFINE([ENABLE_PKCS11], 1, [Build PKCS#11 support])
108                 CFLAGS="$CFLAGS $P11_KIT_CFLAGS"
109                 LIBS="$LIBS $P11_KIT_LIBS"
110                 if test "x$GNUTLS_REQUIRES_PRIVATE" = "x"; then
111                         GNUTLS_REQUIRES_PRIVATE="Requires.private: p11-kit-1"
112                 else
113                         GNUTLS_REQUIRES_PRIVATE="${GNUTLS_REQUIRES_PRIVATE}, p11-kit-1"
114                 fi
115         else
116                 AC_MSG_WARN([[
117 *** 
118 *** p11-kit was not found. PKCS #11 support will be disabled.
119 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
120 *** ]])
121         fi
124 lgl_INIT
126 AC_CHECK_FUNCS(getrusage,,)
127 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
129 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
130 LIBGNUTLS_CFLAGS="-I${includedir}"
131 AC_SUBST(LIBGNUTLS_LIBS)
132 AC_SUBST(LIBGNUTLS_CFLAGS)
134 # Finish things from ../configure.ac.
135 AC_SUBST([WERROR_CFLAGS])
136 AC_SUBST([WSTACK_CFLAGS])
137 AC_SUBST([WARN_CFLAGS])
138 AC_PROG_CXX
139 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
141 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
143 AC_CONFIG_FILES([
144   Makefile
145   gnutls.pc
146   gl/Makefile
147   gl/tests/Makefile
148   includes/Makefile
149   includes/gnutls/gnutls.h
150   minitasn1/Makefile
151   opencdk/Makefile
152   openpgp/Makefile
153   po/Makefile.in
154   x509/Makefile
155   gcrypt/Makefile
156   nettle/Makefile
158 AC_OUTPUT