*** empty log message ***
[gnutls.git] / configure.in
blobd2e179359661d58e8a0301a0470c2be556ddc765
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.57)
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=1
14 GNUTLS_MINOR_VERSION=1
15 GNUTLS_MICRO_VERSION=8
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.1.94
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)
28 AM_MAINTAINER_MODE
30 dnl This is the library version
31 GNUTLS_MOST_RECENT_INTERFACE=13
32 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
33 GNUTLS_OLDEST_INTERFACE=12
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`
48 AC_SUBST(LT_CURRENT)
49 AC_SUBST(LT_REVISION)
50 AC_SUBST(LT_AGE)
52 case "${target}" in
53     *-*-mingw32*)
54         LIBS="$LIBS -lwsock32"
55         ;;
56     *)
57       ;;
58 esac
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"
64 opt_dmalloc_mode=no
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)
71 opt_efence_mode=no
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)
78 opt_developer_mode=no
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)
85 opt_profiler_mode=no
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)
92 AC_MSG_RESULT([***
93 *** Checking for compilation programs...
96 SAVED_CFLAGS="${CFLAGS}"
98 AC_PROG_CC
100 CFLAGS="${SAVED_CFLAGS}"
102 AC_PROG_LN_S
105 dnl Checks for programs.
106 AC_PROG_INSTALL
108 dnl AC_PROG_MAKE_SET
111 AC_MSG_RESULT([***
112 *** Detecting compiler options...
116 AC_C_CONST
117 AC_C_INLINE
119 AC_MSG_CHECKING([whether C99 macros are supported])
120 AC_TRY_COMPILE(,[ 
121 #define test_mac(...) 
122 int z,y,x;
123 test_mac(x,y,z);
124 return 0;
125 ], 
126 dnl ***** OK
127 AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
128 AC_MSG_RESULT(yes),
129 dnl ***** NOT FOUND
130 AC_MSG_RESULT(no)
131 AC_MSG_WARN([C99 macros are not supported by your compiler. This may
132 affect compiling.])
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"
139         else
140           CFLAGS="${CFLAGS} -O2 -finline-functions"
141         fi
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])
146         else
147                 if test x$opt_efence_mode = xyes; then
148                   AC_CHECK_LIB( efence, main)
149                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
150                 fi
151         fi
154         AC_MSG_CHECKING([whether we have GNU assembler])
156         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
157         if test "$GAS"; then
158           CFLAGS="${CFLAGS} -pipe"
159           AC_MSG_RESULT(yes)
160         else
161           AC_MSG_RESULT(no)
162         fi
166 AC_MSG_RESULT([***
167 *** Detecting C library capabilities...
170 AC_HEADER_STDC
171 AC_HEADER_TIME
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_HEADERS(math.h limits.h float.h stdarg.h)
176 AC_CHECK_FUNCS(isascii memmove strnstr mmap gmtime_r inet_ntop,,)
177 AC_FUNC_ALLOCA
180 AC_MSG_RESULT([***
181 *** Detecting system's parameters...
184 AC_CHECK_SIZEOF(unsigned long, 4)
185 AC_CHECK_SIZEOF(unsigned int, 4)
186 AC_CHECK_SIZEOF(unsigned short, 2)
187 AC_CHECK_SIZEOF(unsigned char, 1)
188 AC_CHECK_SIZEOF(unsigned char*, 4)
190 AC_CHECK_TYPES(ptrdiff_t,,, [
191 # include <sys/types.h>
192 # include <stddef.h>
195 AC_CHECK_TYPES(uint,,, [
196 # include <sys/types.h>
199 AC_CHECK_TYPE(size_t,
200 DEFINE_SIZE_T="#include <sys/types.h>"
201 AC_SUBST( DEFINE_SIZE_T)
203 AC_DEFINE(NO_SIZE_T, 1, [no size_t type was found])
204 DEFINE_SIZE_T="typedef unsigned int size_t;"
205 AC_SUBST( DEFINE_SIZE_T)
207 #ifdef HAVE_SYS_TYPES_H
208 # include <sys/types.h>
209 #endif
210 #ifdef HAVE_UNISTD_H
211 # include <unistd.h>
212 #endif
215 AC_CHECK_TYPE(ssize_t,
216 DEFINE_SIZE_T="#include <sys/types.h>"
217 AC_SUBST( DEFINE_SSIZE_T)
219 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
220 DEFINE_SSIZE_T="typedef int ssize_t;"
221 AC_SUBST( DEFINE_SSIZE_T)
223 #ifdef HAVE_SYS_TYPES_H
224 # include <sys/types.h>
225 #endif
226 #ifdef HAVE_UNISTD_H
227 # include <unistd.h>
228 #endif
231 AC_CHECK_TYPE(time_t,
232  DEFINE_TIME_T="#include <time.h>"
233  AC_SUBST( DEFINE_TIME_T)
235   AC_CHECK_TYPE(time_t,
236    DEFINE_TIME_T="#include <sys/time.h>"
237    AC_SUBST( DEFINE_TIME_T)
238    ,
239     DEFINE_TIME_T="typedef unsigned int time_t;"
240     AC_SUBST( DEFINE_TIME_T)
241     AC_DEFINE(NO_TIME_T, 1, [no time_t type was found]),
242   [
243    #include <sys/time.h>
244   ]
245   )
248  #include <time.h>
252 AC_C_BIGENDIAN
255 AC_MSG_RESULT([***
256 *** Checking for external libraries...
259 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
260         AC_MSG_ERROR([[
261 ***  
262 *** libgcrypt was not found. You may want to get it from
263 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
265 ]]))
266 dnl Can't disable - gnutls depends on gcrypt
267 AC_DEFINE(USE_GCRYPT, 1, [use gcrypt])
269 AC_MSG_CHECKING([whether to disable SRP authentication support])
270 AC_ARG_ENABLE( srp-authentication, [  --disable-srp-authentication     Disable the SRP authentication support],
271  ac_enable_srp=no
273 if test x$ac_enable_srp != xno; then
274  AC_MSG_RESULT(no)
275  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
276 else
277  AC_MSG_RESULT(yes)
280 AC_MSG_CHECKING([whether to disable anonymous authentication support])
281 AC_ARG_ENABLE( anon-authentication, [  --disable-anon-authentication    Disable the anonymous authentication support],
282  ac_enable_anon=no
284 if test x$ac_enable_anon != xno; then
285  AC_MSG_RESULT(no)
286  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
287 else
288  AC_MSG_RESULT(yes)
291 AC_MSG_CHECKING([whether to disable extra PKI stuff])
292 AC_ARG_ENABLE( extra-pki, [  --disable-extra-pki              only enable the basic PKI stuff],
293  ac_enable_pki=no
295 if test x$ac_enable_pki != xno; then
296  AC_MSG_RESULT(no)
297  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
298 else
299  AC_MSG_RESULT(yes)
303 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
304 AC_ARG_ENABLE( openpgp-authentication, [  --disable-openpgp-authentication Disable the OpenPGP authentication support],
305  ac_enable_openpgp=no
307 if test x$ac_enable_openpgp != xno; then
308  AC_MSG_RESULT(no)
309  AM_PATH_LIBOPENCDK( 0.5.2, AC_DEFINE(HAVE_LIBOPENCDK, 1, [have libopencdk]),
310  AC_MSG_ERROR([[
312 *** libopencdk 0.5.2 was not found. You may want to get it from
313 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
315 ]]))
316 else
317  AC_MSG_RESULT(yes)
320 ac_enable_openssl=yes
321 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
322 AC_ARG_ENABLE( openssl-compatibility, [  --disable-openssl-compatibility Disable the OpenSSL compatibility support],
323  ac_enable_openssl=no
325 if test x$ac_enable_openssl != xno; then
326  AC_MSG_RESULT(no)
327 else
328  AC_MSG_RESULT(yes)
331 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
334 AC_ARG_WITH(included-libtasn1,
335         [  --with-included-libtasn1 Use the included libtasn1],
336 minitasn1_enabled=$withval, 
337 minitasn1_enabled=no
339 dnl We now need libtasn1 0.2.x
341 AC_CHECK_LIB( tasn1, asn1_read_tag,:, 
342  minitasn1_enabled=yes
343 AC_MSG_WARN([[
344 *** 
345 *** LibtASN1 0.2.x was not found. Will use the included one.]])))
348 if test x$opt_developer_mode = xyes; then
349  minitasn1_enabled=yes
352 SAVED_LIBS=$LIBS
354 AC_MSG_CHECKING([whether to use the included minitasn1])
355 AC_MSG_RESULT($minitasn1_enabled)
357 AC_ARG_WITH(included-libcfg,
358         [  --with-included-libcfg   Use the included libcfg+],
359 libcfg_enabled=$withval, 
360 libcfg_enabled=no
362 dnl We search for libcfg+ which is used by certtool
364 AC_CHECK_LIB( cfg+, cfg_get_context,:, 
365  libcfg_enabled=yes
366 AC_MSG_WARN([[
367 *** 
368 *** Libcfg+ was not found. Will use the included one.]])))
370 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
371 LIBS=$SAVED_LIBS
373 if test x$opt_developer_mode = xyes; then
374  minitasn1_enabled=yes
377 AC_MSG_CHECKING([whether to use the included minitasn1])
378 AC_MSG_RESULT($minitasn1_enabled)
381 dnl CHECK FOR ZLIB SUPPORT
384 AC_MSG_CHECKING([whether to include zlib compression support])
386 AC_ARG_WITH( zlib, [  --without-zlib          disable zlib compression support],
387  ac_zlib=$withval,
388  ac_zlib=yes
391 if test x$ac_zlib != xno; then
392  AC_MSG_RESULT(yes)
393  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
394 *** 
395 *** ZLIB was not found. You will not be able to use ZLIB compression.))
396 else
397  AC_MSG_RESULT(no)
402 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
405 if test x$opt_developer_mode = xyes; then
406  minilzo_enabled=yes
409 AC_ARG_WITH(included-lzo,
410         [  --with-included-lzo     include minilzo in libgnutls-extra],
411  minilzo_enabled=$withval,
412  minilzo_enabled=no
415 AC_MSG_CHECKING([whether to use the included lzo compression library])
417 AC_MSG_RESULT($minilzo_enabled)
419 if test x$minilzo_enabled = xno; then
420 AC_CHECK_LIB( lzo, lzo1x_1_compress, minilzo_enabled=no, 
421  minilzo_enabled=yes
422  AC_MSG_WARN(
423 *** 
424 *** Liblzo was not found. Will use the included minilzo.))
427 if test x"$minilzo_enabled" = xyes; then
428  AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
429  LZO_OBJECTS="minilzo.lo"
430 else
431  LZO_LINK=-llzo
434 AC_SUBST(LZO_OBJECTS)
435 AC_SUBST(LZO_LINK)
437 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
440 if test x"$minitasn1_enabled" = xyes; then
441  MINITASN1_OBJECTS="minitasn1/coding.lo minitasn1/decoding.lo minitasn1/element.lo \
442         minitasn1/errors.lo minitasn1/gstr.lo minitasn1/parser_aux.lo minitasn1/structure.lo"
443  MINITASN1_DIR=minitasn1
444 else
445  LIBASN1_LINK=-ltasn1
448 AC_SUBST(MINITASN1_OBJECTS)
449 AC_SUBST(MINITASN1_DIR)
450 AC_SUBST(LIBASN1_LINK)
454 AC_MSG_RESULT([***
455 *** Detecting options for shared libraries...
457 AM_PROG_LIBTOOL
459 dnl This is after AM_PROG_LIBTOOL so that the LD variable
460 dnl has been set.
462 AC_MSG_CHECKING([whether we have GNU ld or compatible])
464 GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
465 if test "$GLD"; then
466 have_ld_version_script=yes
467   AC_MSG_RESULT(yes)
468 else
469 have_ld_version_script=no
470   AC_MSG_RESULT(no)
471 AC_MSG_WARN(***
472 *** You may want to rerun configure using --with-gnu-ld to enable versioned symbols.
476 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
479 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBASN1_LINK $LIBGCRYPT_LIBS"
480 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
482 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
484 AC_SUBST(LIBGNUTLS_LIBS)
485 AC_SUBST(LIBGNUTLS_CFLAGS)
487 SERV_LIBS="$LIBS $SERV_LIBS"
488 AC_SUBST(SERV_LIBS)
490 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra -lgnutls $LIBOPENCDK_LIBS $LZO_LINK"
491 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
493 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
494 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
496 if test $ac_cv_c_compiler_gnu != no; then
498         if test x$opt_profiler_mode = xyes; then
499           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
500           if test x$FC_OK = xyes; then
501                 CFLAGS="${CFLAGS} `fc-config --cflags`"
502                 LIBS="$LIBS `fc-config --libs`"
503           else
504 AC_MSG_WARN(***
505 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
507           fi
508         fi
512 AC_CONFIG_FILES(lib/gnutls.h.in)
514 AC_CONFIG_COMMANDS([includes/gnutls/gnutls.h],[[
515  test -f lib/gnutls.h.in || (echo "Could not generate includes/gnutls/gnutls.h" && exit 1)
516  cat lib/gnutls.h.in > includes/gnutls/gnutls.h
517  cat lib/gnutls_ui.h >> includes/gnutls/gnutls.h
518  echo "" >> includes/gnutls/gnutls.h
519  cat lib/gnutls_errors_int.h | grep -v _INT_ >> includes/gnutls/gnutls.h
520  echo "" >> includes/gnutls/gnutls.h
521  echo "#ifdef __cplusplus" >> includes/gnutls/gnutls.h
522  echo "}" >> includes/gnutls/gnutls.h
523  echo "#endif" >> includes/gnutls/gnutls.h
524  echo "#endif /* GNUTLS_H */" >> includes/gnutls/gnutls.h
525  echo "" >> includes/gnutls/gnutls.h
526  chmod +x lib/libgnutls-config
527  chmod +x libextra/libgnutls-extra-config
528 ]],[[]])
530 AC_CONFIG_FILES([Makefile src/Makefile libextra/Makefile lib/Makefile \
531 libextra/openpgp/Makefile lib/libgnutls-config libextra/libgnutls-extra-config \
532 doc/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
533 src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
534 doc/tex/Makefile doc/tex/cover.tex doc/scripts/Makefile \
535 doc/examples/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
536 includes/Makefile includes/gnutls/Makefile doc/manpages/Makefile])
538 AC_OUTPUT