1 dnl Process this file with autoconf to produce a configure script.
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])
13 GNUTLS_MAJOR_VERSION=1
14 GNUTLS_MINOR_VERSION=1
15 GNUTLS_MICRO_VERSION=6
16 GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
18 AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls])
20 GNUTLS_GCRYPT_VERSION=1.1.90
21 GNUTLS_LIBTASN1_VERSION=0.2.5
22 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
23 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
25 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION, [version of gnutls])
26 AM_CONFIG_HEADER(config.h)
30 dnl This is the library version
31 GNUTLS_MOST_RECENT_INTERFACE=12
32 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
33 GNUTLS_OLDEST_INTERFACE=11
36 AC_SUBST(GNUTLS_MAJOR_VERSION)
37 AC_SUBST(GNUTLS_MINOR_VERSION)
38 AC_SUBST(GNUTLS_MICRO_VERSION)
39 AC_SUBST(GNUTLS_VERSION)
41 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
42 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
43 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
45 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
46 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
47 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
54 LIBS="$LIBS -lwsock32"
60 dnl In order to use the reentrant libc functions.
61 dnl I hope it is portable enough.
62 CFLAGS="${CFLAGS} -D_REENTRANT -D_THREAD_SAFE"
65 AC_MSG_CHECKING([whether in dmalloc mode])
66 AC_ARG_ENABLE(dmalloc-mode,
67 [ --enable-dmalloc-mode enable dmalloc mode],
68 opt_dmalloc_mode=$enableval)
69 AC_MSG_RESULT($opt_dmalloc_mode)
72 AC_MSG_CHECKING([whether in electric fence mode])
73 AC_ARG_ENABLE(efence-mode,
74 [ --enable-efence-mode enable electric fence mode],
75 opt_efence_mode=$enableval)
76 AC_MSG_RESULT($opt_efence_mode)
79 AC_MSG_CHECKING([whether in maintanance mode])
80 AC_ARG_ENABLE(developer-mode,
81 [ --enable-developer-mode enable developer mode],
82 opt_developer_mode=$enableval)
83 AC_MSG_RESULT($opt_developer_mode)
86 AC_MSG_CHECKING([whether in profile mode])
87 AC_ARG_ENABLE(profile-mode,
88 [ --enable-profile-mode enable profiler],
89 opt_profiler_mode=$enableval)
90 AC_MSG_RESULT($opt_profiler_mode)
93 *** Checking for compilation programs...
96 SAVED_CFLAGS="${CFLAGS}"
100 CFLAGS="${SAVED_CFLAGS}"
105 dnl Checks for programs.
112 *** Detecting compiler options...
119 AC_MSG_CHECKING([whether C99 macros are supported])
121 #define test_mac(...)
127 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
131 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
135 if test $ac_cv_c_compiler_gnu != no; then
137 if test x$opt_developer_mode = xyes; then
138 CFLAGS="${CFLAGS} -g -Wno-format-y2k -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wmissing-braces -Winline -Wstrict-prototypes"
140 CFLAGS="${CFLAGS} -O2 -finline-functions"
143 if test x$opt_dmalloc_mode = xyes; then
144 AC_CHECK_LIB( dmalloc, main)
145 AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
147 if test x$opt_efence_mode = xyes; then
148 AC_CHECK_LIB( efence, main)
149 AC_DEFINE(USE_EFENCE, 1, [use electric fence])
154 AC_MSG_CHECKING([whether we have GNU assembler])
156 GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
158 CFLAGS="${CFLAGS} -pipe"
167 *** Detecting C library capabilities...
172 AC_CHECK_HEADERS(unistd.h strings.h stddef.h alloca.h)
173 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
174 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
175 AC_CHECK_FUNCS(isascii memmove strnstr mmap gmtime_r inet_ntop getpass,,)
180 *** Detecting system's parameters...
183 AC_CHECK_SIZEOF(unsigned long, 4)
184 AC_CHECK_SIZEOF(unsigned int, 4)
185 AC_CHECK_SIZEOF(unsigned short, 2)
186 AC_CHECK_SIZEOF(unsigned char, 1)
187 AC_CHECK_SIZEOF(unsigned char*, 4)
189 AC_CHECK_TYPES(ptrdiff_t,,, [
190 # include <sys/types.h>
194 AC_CHECK_TYPES(uint,,, [
195 # include <sys/types.h>
198 AC_CHECK_TYPE(size_t,
199 DEFINE_SIZE_T="#include <sys/types.h>"
200 AC_SUBST( DEFINE_SIZE_T)
202 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
203 DEFINE_SIZE_T="typedef unsigned int size_t;"
204 AC_SUBST( DEFINE_SIZE_T)
206 #ifdef HAVE_SYS_TYPES_H
207 # include <sys/types.h>
214 AC_CHECK_TYPE(ssize_t,
215 DEFINE_SIZE_T="#include <sys/types.h>"
216 AC_SUBST( DEFINE_SSIZE_T)
218 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
219 DEFINE_SSIZE_T="typedef int ssize_t;"
220 AC_SUBST( DEFINE_SSIZE_T)
222 #ifdef HAVE_SYS_TYPES_H
223 # include <sys/types.h>
230 AC_CHECK_TYPE(time_t,
231 DEFINE_TIME_T="#include <time.h>"
232 AC_SUBST( DEFINE_TIME_T)
234 AC_CHECK_TYPE(time_t,
235 DEFINE_TIME_T="#include <sys/time.h>"
236 AC_SUBST( DEFINE_TIME_T)
238 DEFINE_TIME_T="typedef unsigned int time_t;"
239 AC_SUBST( DEFINE_TIME_T)
240 AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
242 #include <sys/time.h>
255 *** Checking for external libraries...
258 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
261 *** libgcrypt was not found. You may want to get it from
262 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
265 dnl Can't disable - gnutls depends on gcrypt
266 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
268 AC_MSG_CHECKING([whether to disable SRP authentication support])
269 AC_ARG_ENABLE( srp-authentication, [ --disable-srp-authentication Disable the SRP authentication support],
272 if test x$ac_enable_srp != xno; then
274 AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
279 AC_MSG_CHECKING([whether to disable anonymous authentication support])
280 AC_ARG_ENABLE( anon-authentication, [ --disable-anon-authentication Disable the anonymous authentication support],
283 if test x$ac_enable_anon != xno; then
285 AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
290 AC_MSG_CHECKING([whether to disable extra PKI stuff])
291 AC_ARG_ENABLE( extra-pki, [ --disable-extra-pki only enable the basic PKI stuff],
294 if test x$ac_enable_pki != xno; then
296 AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
302 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
303 AC_ARG_ENABLE( openpgp-authentication, [ --disable-openpgp-authentication Disable the OpenPGP authentication support],
306 if test x$ac_enable_openpgp != xno; then
308 AM_PATH_LIBOPENCDK( 0.5.2, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
311 *** libopencdk 0.5.2 was not found. You may want to get it from
312 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
319 ac_enable_openssl=yes
320 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
321 AC_ARG_ENABLE( openssl-compatibility, [ --disable-openssl-compatibility Disable the OpenSSL compatibility support],
324 if test x$ac_enable_openssl != xno; then
330 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
333 AC_ARG_WITH(included-libtasn1,
334 [ --with-included-libtasn1 Use the included libtasn1],
335 minitasn1_enabled=$withval,
338 dnl We now need libtasn1 0.2.x
340 AC_CHECK_LIB( tasn1, asn1_read_tag,:,
341 minitasn1_enabled=yes
344 *** LibtASN1 0.2.x was not found. Will use the included one.]])))
347 if test x$opt_developer_mode = xyes; then
348 minitasn1_enabled=yes
351 AC_MSG_CHECKING([whether to use the included minitasn1])
352 AC_MSG_RESULT($minitasn1_enabled)
355 dnl CHECK FOR ZLIB SUPPORT
358 AC_MSG_CHECKING([whether to include zlib compression support])
360 AC_ARG_WITH( zlib, [ --without-zlib disable zlib compression support],
365 if test x$ac_zlib != xno; then
367 AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
369 *** ZLIB was not found. You will not be able to use ZLIB compression.))
376 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
379 if test x$opt_developer_mode = xyes; then
383 AC_ARG_WITH(included-lzo,
384 [ --with-included-lzo include minilzo in libgnutls-extra],
385 minilzo_enabled=$withval,
389 AC_MSG_CHECKING([whether to use the included lzo compression library])
391 AC_MSG_RESULT($minilzo_enabled)
393 if test x$minilzo_enabled = xno; then
394 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no,
398 *** Liblzo was not found. Will use the included minilzo.))
401 if test x"$minilzo_enabled" = xyes; then
402 AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
403 LZO_OBJECTS="minilzo.lo"
408 AC_SUBST(LZO_OBJECTS)
411 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
414 if test x"$minitasn1_enabled" = xyes; then
415 MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
416 minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
417 MINITASN1_DIR=minitasn1
422 AC_SUBST(MINITASN1_OBJECTS)
423 AC_SUBST(MINITASN1_DIR)
424 AC_SUBST(LIBASN1_LINK)
429 *** Detecting options for shared libraries...
433 dnl This is after AM_PROG_LIBTOOL so that the LD variable
436 AC_MSG_CHECKING([whether we have GNU ld or compatible])
438 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
440 have_ld_version_script=yes
443 have_ld_version_script=no
446 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
450 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
453 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
454 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
456 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
458 AC_SUBST(LIBGNUTLS_LIBS)
459 AC_SUBST(LIBGNUTLS_CFLAGS)
461 SERV_LIBS="$LIBS $SERV_LIBS"
464 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
465 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
467 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
468 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
470 if test $ac_cv_c_compiler_gnu != no; then
472 if test x$opt_profiler_mode = xyes; then
473 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
474 if test x$FC_OK = xyes; then
475 CFLAGS="${CFLAGS} `fc-config --cflags`"
476 LIBS="$LIBS `fc-config --libs`"
479 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
486 AC_CONFIG_FILES(lib/gnutls.h.in)
488 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
489 test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
490 cat lib/gnutls.h.in > includes/gnutls/gnutls.h
491 cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
492 echo "" >> includes/gnutls/gnutls.h
493 cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
494 echo "" >> includes/gnutls/gnutls.h
495 echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
496 echo "}" >> includes/gnutls/gnutls.h
497 echo "#endif" >> includes/gnutls/gnutls.h
498 echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
499 echo "" >> includes/gnutls/gnutls.h
500 chmod +x lib/libgnutls-config
501 chmod +x libextra/libgnutls-extra-config
504 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
505 libextra/openpgp/Makefile lib/libgnutls-config libextra/libgnutls-extra-config \
506 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
507 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
508 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
509 includes/Makefile includes/gnutls/Makefile doc/manpages/Makefile])