Added function to extract the key usage extension from an X.509 certificate, and...
[gnutls.git] / configure.in
blob1155150b9ef88c4c4b9fdaaa665af6668e424130
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.50)
3 AC_INIT
5 AC_PREFIX_DEFAULT(/usr/local)
7 AC_CANONICAL_TARGET([])
8 AC_DEFINE_UNQUOTED(T_CPU, "$target_cpu", [CPU name])
9 AC_DEFINE_UNQUOTED(T_VENDOR, "$target_vendor", [Vendor name])
10 AC_DEFINE_UNQUOTED(T_OS, "$target_os", [OS name])
12 dnl Gnutls Version
13 GNUTLS_MAJOR_VERSION=0
14 GNUTLS_MINOR_VERSION=9
15 GNUTLS_MICRO_VERSION=0
16 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
18 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls])
20 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION, [version of gnutls])
21 AM_CONFIG_HEADER(config.h)
23 AM_MAINTAINER_MODE
25 dnl This is the library version
26 GNUTLS_MOST_RECENT_INTERFACE=6
27 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
28 GNUTLS_OLDEST_INTERFACE=6
31 AC_SUBST(GNUTLS_MAJOR_VERSION)
32 AC_SUBST(GNUTLS_MINOR_VERSION)
33 AC_SUBST(GNUTLS_MICRO_VERSION)
34 AC_SUBST(GNUTLS_VERSION)
36 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
37 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
38 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
40 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
41 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
42 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
43 AC_SUBST(LT_CURRENT)
44 AC_SUBST(LT_REVISION)
45 AC_SUBST(LT_AGE)
47 opt_dmalloc_mode=no
48 AC_MSG_CHECKING([whether in dmalloc mode])
49 AC_ARG_ENABLE(dmalloc-mode,
50 [  --enable-dmalloc-mode      enable dmalloc mode],
51 opt_dmalloc_mode=$enableval)
52 AC_MSG_RESULT($opt_dmalloc_mode)
54 opt_efence_mode=no
55 AC_MSG_CHECKING([whether in electric fence mode])
56 AC_ARG_ENABLE(efence-mode,
57 [  --enable-efence-mode       enable electric fence mode],
58 opt_efence_mode=$enableval)
59 AC_MSG_RESULT($opt_efence_mode)
61 opt_developer_mode=no
62 AC_MSG_CHECKING([whether in maintanance mode])
63 AC_ARG_ENABLE(developer-mode,
64 [  --enable-developer-mode   enable developer mode],
65 opt_developer_mode=$enableval)
66 AC_MSG_RESULT($opt_developer_mode)
68 opt_profiler_mode=no
69 AC_MSG_CHECKING([whether in profile mode])
70 AC_ARG_ENABLE(profile-mode,
71 [  --enable-profile-mode      enable profiler],
72 opt_profiler_mode=$enableval)
73 AC_MSG_RESULT($opt_profiler_mode)
75 AC_MSG_RESULT([***
76 *** Checking for compilation programs...
79 AC_PROG_CC
81 AC_PROG_LN_S
84 dnl Checks for programs.
85 AC_PROG_INSTALL
87 dnl AC_PROG_MAKE_SET
90 AC_MSG_RESULT([***
91 *** Detecting compiler options...
95 AC_C_CONST
96 AC_C_INLINE
98 AC_MSG_CHECKING([whether C99 macros are supported])
99 AC_TRY_COMPILE(,[ 
100 #define test_mac(...) 
101 int z,y,x;
102 test_mac(x,y,z);
103 return 0;
104 ], 
105 dnl ***** OK
106 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
107 AC_MSG_RESULT(yes),
108 dnl ***** NOT FOUND
109 AC_MSG_RESULT(no)
110 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
111 affect compiling.])
114 if test $ac_cv_c_compiler_gnu != no; then
116         if test x$opt_developer_mode = xyes; then
117           CFLAGS="${CFLAGS} -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wmissing-braces -Wsign-compare -Winline -Wstrict-prototypes"
118         else
119           CFLAGS="${CFLAGS} -O2 -finline-functions"
120         fi
122         if test x$opt_dmalloc_mode = xyes; then
123           AC_CHECK_LIB( dmalloc, main)
124           AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
125         else
126                 if test x$opt_efence_mode = xyes; then
127                   AC_CHECK_LIB( efence, main)
128                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
129                 fi
130         fi
133         AC_MSG_CHECKING([whether we have GNU assembler])
135         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
136         if test "$GAS"; then
137           CFLAGS="${CFLAGS} -pipe"
138           AC_MSG_RESULT(yes)
139         else
140           AC_MSG_RESULT(no)
141         fi
145 AC_MSG_RESULT([***
146 *** Detecting C library capabilities...
149 AC_HEADER_STDC
150 AC_HEADER_TIME
151 AC_CHECK_HEADERS(unistd.h pwd.h strings.h stdarg.h)
152 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
153 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
154 AC_CHECK_FUNCS(bzero memset memmove bcopy memcmp memcpy,,)
155 AC_FUNC_ALLOCA
158 AC_MSG_RESULT([***
159 *** Detecting system's parameters...
162 AC_CHECK_SIZEOF(unsigned long, 4)
163 AC_CHECK_SIZEOF(unsigned int, 4)
164 AC_CHECK_SIZEOF(unsigned short, 2)
165 AC_CHECK_SIZEOF(unsigned char, 1)
166 AC_CHECK_SIZEOF(unsigned char*, 4)
168 AC_CHECK_TYPES(ptrdiff_t,,, [
169 # include <sys/types.h>
172 AC_CHECK_TYPES(uint,,, [
173 # include <sys/types.h>
176 AC_CHECK_TYPE(size_t,
177 DEFINE_SIZE_T="#include <sys/types.h>"
178 AC_SUBST( DEFINE_SIZE_T)
180 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
181 DEFINE_SIZE_T="typedef unsigned int size_t; typedef int ssize_t;"
182 AC_SUBST( DEFINE_SIZE_T)
184 #ifdef HAVE_SYS_TYPES_H
185 # include <sys/types.h>
186 #endif
187 #ifdef HAVE_UNISTD_H
188 # include <unistd.h>
189 #endif
192 AC_CHECK_TYPE(time_t,
193  DEFINE_TIME_T="#include <time.h>"
194  AC_SUBST( DEFINE_TIME_T)
196   AC_CHECK_TYPE(time_t,
197    DEFINE_TIME_T="#include <sys/time.h>"
198    AC_SUBST( DEFINE_TIME_T)
199    ,
200     DEFINE_TIME_T="typedef unsigned int time_t;"
201     AC_SUBST( DEFINE_TIME_T)
202     AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
203   [
204    #include <sys/time.h>
205   ]
206   )
209  #include <time.h>
213 AC_C_BIGENDIAN
216 AC_MSG_RESULT([***
217 *** Checking for external libraries...
220 AM_PATH_LIBGCRYPT(1.1.12,,
221         AC_MSG_ERROR([[
222 ***  
223 *** libgcrypt was not found. You may want to get it from
224 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
226 ]]))
227 dnl Can't disable - gnutls depends on gcrypt
228 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
232 AC_MSG_CHECKING([whether to disable SRP authentication support])
233 AC_ARG_ENABLE( srp-authentication, [  --disable-srp-authentication     disable the SRP authentication support],
234  ac_enable_srp=no
236 if test x$ac_enable_srp != xno; then
237  AC_MSG_RESULT(no)
238  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
239 else
240  AC_MSG_RESULT(yes)
243 AC_MSG_CHECKING([whether to disable anonymous authentication support])
244 AC_ARG_ENABLE( anon-authentication, [  --disable-anon-authentication    disable the anonymous authentication support],
245  ac_enable_anon=no
247 if test x$ac_enable_anon != xno; then
248  AC_MSG_RESULT(no)
249  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
250 else
251  AC_MSG_RESULT(yes)
255 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
256 AC_ARG_ENABLE( openpgp-authentication, [  --disable-openpgp-authentication disable the OpenPGP authentication support],
257  ac_enable_openpgp=no
259 if test x$ac_enable_openpgp != xno; then
260  AC_MSG_RESULT(no)
261  AM_PATH_LIBOPENCDK( 0.4.0, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
262  AC_MSG_WARN([[
264 *** libopencdk 0.4.0 was not found. You will not be able to use OpenPGP keys with gnutls.
265 ]]))
266 else
267  AC_MSG_RESULT(yes)
270 AC_ARG_WITH(included-libtasn1,
271         [  --with-included-libtasn1 Use the included libtasn1],
272 minitasn1_enabled=$withval, 
273 minitasn1_enabled=no
275 AC_CHECK_LIB( tasn1, asn1_array2tree,:, 
276  minitasn1_enabled=yes
277 *** 
278 *** LibtASN1 was not found. Will use the included one.))
281 if test x$opt_developer_mode = xyes; then
282  minitasn1_enabled=yes
285 AC_MSG_CHECKING([whether to use the included minitasn1])
286 AC_MSG_RESULT($minitasn1_enabled)
289 dnl CHECK FOR ZLIB SUPPORT
292 AC_MSG_CHECKING([whether to include zlib compression support])
294 AC_ARG_WITH( zlib, [  --without-zlib          disable zlib compression support],
295  ac_zlib=$withval,
296  ac_zlib=yes
299 if test x$ac_zlib != xno; then
300  AC_MSG_RESULT(yes)
301  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
302 *** 
303 *** ZLIB was not found. You will not be able to use ZLIB compression.))
304 else
305  AC_MSG_RESULT(no)
309 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
312 if test x$opt_developer_mode = xyes; then
313  minilzo_enabled=yes
316 AC_ARG_WITH(included-lzo,
317         [  --with-included-lzo     include minilzo in libgnutls-extra],
318  minilzo_enabled=$withval,
319  minilzo_enabled=no
322 AC_MSG_CHECKING([whether to use the included lzo compression library])
324 AC_MSG_RESULT($minilzo_enabled)
326 if test x$minilzo_enabled = xno; then
327 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no, 
328  minilzo_enabled=yes
329  AC_MSG_WARN(
330 *** 
331 *** Liblzo was not found. Will use the included minilzo.))
334 if test x"$minilzo_enabled" = xyes; then
335  AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
336  LZO_OBJECTS="minilzo.lo"
337 else
338  LZO_LINK=-llzo
341 AC_SUBST(LZO_OBJECTS)
342 AC_SUBST(LZO_LINK)
344 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
347 if test x"$minitasn1_enabled" = xyes; then
348  MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
349         minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
350  MINITASN1_DIR=minitasn1
351 else
352  LIBASN1_LINK=-ltasn1
355 AC_SUBST(MINITASN1_OBJECTS)
356 AC_SUBST(MINITASN1_DIR)
357 AC_SUBST(LIBASN1_LINK)
361 AC_MSG_RESULT([***
362 *** Detecting options for shared libraries...
364 AM_PROG_LIBTOOL
367 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
368 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
370 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
372 AC_SUBST(LIBGNUTLS_LIBS)
373 AC_SUBST(LIBGNUTLS_CFLAGS)
375 SERV_LIBS="$LIBS $SERV_LIBS"
376 AC_SUBST(SERV_LIBS)
378 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
379 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
381 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
382 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
384 if test $ac_cv_c_compiler_gnu != no; then
386         if test x$opt_profiler_mode = xyes; then
387           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
388           if test x$FC_OK = xyes; then
389                 CFLAGS="${CFLAGS} `fc-config --cflags`"
390                 LIBS="$LIBS `fc-config --libs`"
391           else
392 AC_MSG_WARN(***
393 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
395           fi
396         fi
400 AC_CONFIG_FILES(lib/gnutls.h.in)
402 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
403  test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
404  cat lib/gnutls.h.in > includes/gnutls/gnutls.h
405  cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
406  echo "" >> includes/gnutls/gnutls.h
407  cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
408  echo "" >> includes/gnutls/gnutls.h
409  echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
410  echo "}" >> includes/gnutls/gnutls.h
411  echo "#endif" >> includes/gnutls/gnutls.h
412  echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
413  echo "" >> includes/gnutls/gnutls.h
414  chmod +x lib/libgnutls-config
415  chmod +x libextra/libgnutls-extra-config
416 ]],[[]])
418 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
419 lib/libgnutls-config libextra/libgnutls-extra-config \
420 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
421 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
422 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
423 includes/Makefile includes/gnutls/Makefile])
425 AC_OUTPUT