do not exit configure if p11-kit is not found.
[gnutls.git] / lib / configure.ac
blob63164ce375ad0eb11de379114ad9514f4f3be53e
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.9], [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         else
111                 AC_MSG_WARN([[
112 *** 
113 *** p11-kit was not found. PKCS #11 support will be disabled.
114 *** You may get it from http://p11-glue.freedesktop.org/p11-kit.html
115 *** ]])
116         fi
119 lgl_INIT
121 AC_CHECK_FUNCS(getrusage,,)
122 AC_LIB_HAVE_LINKFLAGS(pthread,, [#include <pthread.h>], [pthread_mutex_lock (0);])
124 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBS"
125 LIBGNUTLS_CFLAGS="-I${includedir}"
126 AC_SUBST(LIBGNUTLS_LIBS)
127 AC_SUBST(LIBGNUTLS_CFLAGS)
129 # Finish things from ../configure.ac.
130 AC_SUBST([WERROR_CFLAGS])
131 AC_SUBST([WSTACK_CFLAGS])
132 AC_SUBST([WARN_CFLAGS])
133 AC_PROG_CXX
134 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
136 AC_DEFINE([GNUTLS_INTERNAL_BUILD], 1, [We allow temporarily usage of deprecated functions - until they are removed.])
138 AC_CONFIG_FILES([
139   Makefile
140   gnutls.pc
141   gl/Makefile
142   gl/tests/Makefile
143   includes/Makefile
144   includes/gnutls/gnutls.h
145   minitasn1/Makefile
146   opencdk/Makefile
147   openpgp/Makefile
148   po/Makefile.in
149   x509/Makefile
150   gcrypt/Makefile
151   nettle/Makefile
153 AC_OUTPUT