*** empty log message ***
[gnutls.git] / configure.in
blob297b8c6193bd94aea59d7c015f36921e35082996
1 dnl Process this file with autoconf to produce a configure script.
2 # Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006
3 #    Free Software Foundation, Inc.
5 # Author: Nikos Mavroyanopoulos
7 # This file is part of GNUTLS.
9 # GNUTLS is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # GNUTLS is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNUTLS; if not, write to the Free Software Foundation,
21 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 AC_INIT(gnutls, [1.4.3], [bug-gnutls@gnu.org])
24 AC_PREREQ(2.59)
26 AC_CANONICAL_TARGET
28 AM_INIT_AUTOMAKE([1.9 gnits dist-bzip2])
29 AM_CONFIG_HEADER(config.h)
30 AB_INIT
32 # Library code modified:                              REVISION++
33 # Interfaces changed/added/removed:   CURRENT++       REVISION=0
34 # Interfaces added:                             AGE++
35 # Interfaces removed:                           AGE=0
36 AC_SUBST(LT_CURRENT, 13)
37 AC_SUBST(LT_REVISION, 8)
38 AC_SUBST(LT_AGE, 0)
39 ac_full=1
41 GNUTLS_GCRYPT_VERSION=1:1.2.2
42 GNUTLS_LIBTASN1_VERSION=0.3.4
43 AC_DEFINE_UNQUOTED(GNUTLS_GCRYPT_VERSION, "$GNUTLS_GCRYPT_VERSION", [version of gcrypt])
44 AC_DEFINE_UNQUOTED(GNUTLS_LIBTASN1_VERSION, "$GNUTLS_LIBTASN1_VERSION", [version of libtasn1])
46 # Compute numeric versions, used in 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`)
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         AS_HELP_STRING([--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         AS_HELP_STRING([--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 developer mode])
80 AC_ARG_ENABLE(developer-mode,
81         AS_HELP_STRING([--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         AS_HELP_STRING([--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 dnl Checks for programs.
97 AM_GNU_GETTEXT([external])
98 AM_GNU_GETTEXT_VERSION([0.14.5])
99 AC_PROG_CC
100 AC_PROG_LN_S
101 GTK_DOC_CHECK(1.1)
103 AC_MSG_RESULT([***
104 *** Detecting compiler options...
107 gl_EARLY
108 AC_C_CONST
109 AC_C_INLINE
111 AC_MSG_CHECKING([whether C99 macros are supported])
112 AC_TRY_COMPILE(,[ 
113 #define test_mac(...) 
114 int z,y,x;
115 test_mac(x,y,z);
116 return 0;
117 ], 
118         dnl ***** OK
119         AC_DEFINE(C99_MACROS, 1, [C99 macros are supported])
120         AC_MSG_RESULT(yes),
121         dnl ***** NOT FOUND
122         AC_MSG_RESULT(no)
123         AC_MSG_WARN([C99 macros not supported. This may affect compiling.]))
125 if test $ac_cv_c_compiler_gnu != no; then
126         if test x$opt_developer_mode = xyes; then
127           CFLAGS="${CFLAGS} -g -Wall -Wcast-align -W -Wpointer-arith -Wchar-subscripts -Wformat-security -Wno-format-y2k -Wmissing-braces -Winline -Wstrict-prototypes -Wno-unused-parameter"
128 #         CFLAGS="${CFLAGS} -g -W -Wall -Wcast-align -Wpointer-arith -Wchar-subscripts -Wformat-security -Wno-format-y2k -Wmissing-braces -Winline -Wstrict-prototypes -Wshadow -Wno-unused-parameter -Wimplicit -fno-common -Wno-sign-compare -Wbad-function-cast -Wendif-labels -Wmissing-declarations -Wno-missing-format-attribute -Wmissing-prototypes -Wnested-externs -Wpointer-arith -pedantic -Wlong-long -Wcast-qual -Wcast-align -Winline -Wredundant-decls -Wstrict-prototypes -Wwrite-strings -Wparentheses -Wsequence-point -Wpacked -Waggregate-return -Wfloat-equal -Wmultichar -Wunknown-pragmas -Wtrigraphs -Wswitch -Wreturn-type -Wmain -Wchar-subscripts -Wcomment -Wno-missing-noreturn"
129         fi
131         AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
132         _gcc_cflags_save=$CFLAGS
133         CFLAGS="-Wno-pointer-sign"
134         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
135         AC_MSG_RESULT($_gcc_psign)
136         CFLAGS=$_gcc_cflags_save;
137         if test x"$_gcc_psign" = xyes ; then
138           CFLAGS="$CFLAGS -Wno-pointer-sign"
139         fi
141         if test x$opt_dmalloc_mode = xyes; then
142           AC_CHECK_LIB(dmalloc, main)
143           AC_DEFINE(USE_DMALLOC, 1, [enable the use of dmalloc])
144         else
145                 if test x$opt_efence_mode = xyes; then
146                   AC_CHECK_LIB(efence, main)
147                   AC_DEFINE(USE_EFENCE, 1, [use electric fence])
148                 fi
149         fi
151         AC_MSG_CHECKING([whether we have GNU assembler])
152         GAS=`as --version < /dev/null 2>/dev/null | grep GNU`
153         if test "$GAS"; then
154           CFLAGS="${CFLAGS} -pipe"
155           AC_MSG_RESULT(yes)
156         else
157           AC_MSG_RESULT(no)
158         fi
162 AC_MSG_RESULT([***
163 *** Detecting C library capabilities...
166 AC_HEADER_STDC
167 AC_HEADER_TIME
168 AC_CHECK_HEADERS(unistd.h strings.h stddef.h alloca.h)
169 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
170 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
171 AC_CHECK_HEADERS(math.h limits.h float.h stdarg.h ctype.h)
172 dnl opencdk
173 AC_CHECK_HEADERS(netdb.h)
174 AC_CHECK_FUNCS(umask vasprintf isascii memmove memmem mmap gmtime_r,,)
175 AC_FUNC_ALLOCA
177 AC_MSG_RESULT([***
178 *** Detecting system's parameters...
181 # For minitasn1.
182 AC_CHECK_SIZEOF(unsigned long, 4)
183 AC_CHECK_SIZEOF(unsigned int, 4)
185 # For some systems we know that we have ld_version scripts.
186 # Use it then as default.
187 have_ld_version_script=no
188 case "${host}" in
189     *-*-linux*)
190         have_ld_version_script=yes
191         ;;
192     *-*-gnu*)
193         have_ld_version_script=yes
194         ;;
195 esac
196 AC_ARG_ENABLE([ld-version-script],
197               AC_HELP_STRING([--enable-ld-version-script],
198                              [enable/disable use of linker version script.
199                               (default is system dependent)]),
200               [have_ld_version_script=$enableval],
201               [ : ] )
202 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
204 AC_CHECK_TYPES(uint,,, [
205 # include <sys/types.h>
208 AC_CHECK_TYPE(ssize_t,
209 DEFINE_SSIZE_T="#include <sys/types.h>"
210 AC_SUBST(DEFINE_SSIZE_T)
212 AC_DEFINE(NO_SSIZE_T, 1, [no ssize_t type was found])
213 DEFINE_SSIZE_T="typedef int ssize_t;"
214 AC_SUBST(DEFINE_SSIZE_T)
216 #ifdef HAVE_SYS_TYPES_H
217 # include <sys/types.h>
218 #endif
219 #ifdef HAVE_UNISTD_H
220 # include <unistd.h>
221 #endif
224 AC_C_BIGENDIAN
226 AC_MSG_RESULT([***
227 *** Checking for external libraries...
230 AM_PATH_LIBGCRYPT($GNUTLS_GCRYPT_VERSION,,
231 dnl Can't disable - gnutls depends on gcrypt
232         AC_MSG_ERROR([[
233 ***  
234 *** libgcrypt was not found. You may want to get it from
235 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
237 ]]))
238 libgcrypt=yes
240 # Hard-wire the gl/m4/gc.m4 test.
241 AC_ARG_WITH(builtin-crypto,
242         AS_HELP_STRING([--with-builtin-crypto],
243                 [use internal crypto instead of libgcrypt (EXPERIMENTAL)]),
244         ac_cv_libgcrypt=no,
245         ac_cv_libgcrypt=yes)
247 AC_MSG_CHECKING([whether to disable SRP authentication support])
248 AC_ARG_ENABLE(srp-authentication,
249         AS_HELP_STRING([--disable-srp-authentication],
250                 [disable the SRP authentication support]),
251         ac_enable_srp=no)
252 if test x$ac_enable_srp != xno; then
253  AC_MSG_RESULT(no)
254  AC_DEFINE(ENABLE_SRP, 1, [enable SRP authentication])
255 else
256  ac_full=0
257  AC_MSG_RESULT(yes)
260 AC_MSG_CHECKING([whether to disable PSK authentication support])
261 AC_ARG_ENABLE(psk-authentication,
262        AS_HELP_STRING([--disable-psk-authentication],
263                [disable the PSK authentication support]),
264        ac_enable_srp=no)
265 if test x$ac_enable_srp != xno; then
266  AC_MSG_RESULT(no)
267  AC_DEFINE(ENABLE_PSK, 1, [enable PSK authentication])
268 else
269  ac_full=0
270  AC_MSG_RESULT(yes)
272 AM_CONDITIONAL(ENABLE_SRP, test "$ac_enable_srp" != "no")
274 AC_MSG_CHECKING([whether to disable anonymous authentication support])
275 AC_ARG_ENABLE(anon-authentication,
276         AS_HELP_STRING([--disable-anon-authentication],
277                 [disable the anonymous authentication support]),
278         ac_enable_anon=no)
279 if test x$ac_enable_anon != xno; then
280  AC_MSG_RESULT(no)
281  AC_DEFINE(ENABLE_ANON, 1, [enable anonymous authentication])
282 else
283  ac_full=0
284  AC_MSG_RESULT(yes)
287 AC_MSG_CHECKING([whether to disable extra PKI stuff])
288 AC_ARG_ENABLE(extra-pki,
289         AS_HELP_STRING([--disable-extra-pki],
290                 [only enable the basic PKI stuff]),
291         ac_enable_pki=no)
292 if test x$ac_enable_pki != xno; then
293  AC_MSG_RESULT(no)
294  AC_DEFINE(ENABLE_PKI, 1, [whether to include all the PKCS #x stuff and other PKI stuff])
295 else
296  ac_full=0
297  AC_MSG_RESULT(yes)
300 dnl Check whether to disable OpenPGP authentication completely
301 dnl from libgnutls-extra.
303 ac_enable_openpgp=yes
304 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
305 AC_ARG_ENABLE(openpgp-authentication,
306         AS_HELP_STRING([--disable-openpgp-authentication],
307                 [disable the OpenPGP authentication support]),
308         ac_enable_openpgp=no)
309 if test x$ac_enable_openpgp = xno; then
310  AC_MSG_RESULT(yes)
311  ac_full=0
312 else
313  AC_DEFINE(ENABLE_OPENPGP, 1, [use openpgp authentication])
314  AC_MSG_RESULT(no)
316 AM_CONDITIONAL(ENABLE_OPENPGP, test "$ac_enable_openpgp" = "yes")
318 dnl Test whether to use the included opencdk library
319 dnl 
320 if test x$ac_enable_openpgp = xyes; then
321  AC_ARG_WITH(included-opencdk,
322         AS_HELP_STRING([--with-included-opencdk], [use the included opencdk]),
323                 ac_enable_included_opencdk=$withval, 
324                 ac_enable_included_opencdk=no)
325 if test x$ac_enable_included_opencdk = xno;then 
326   AM_PATH_LIBOPENCDK(0.5.5, ,
327    ac_enable_included_opencdk=yes
328    AC_MSG_WARN([[
330 *** libopencdk 0.5.5 was not found. You may want to get it from
331 *** ftp://ftp.gnutls.org/pub/gnutls/opencdk/
333 *** Will use the included opencdk.
335 ]]))
337 AC_MSG_CHECKING([whether to use the included opencdk])
338 AC_MSG_RESULT($ac_enable_included_opencdk)
341 AM_CONDITIONAL(ENABLE_INCLUDED_OPENCDK, test "$ac_enable_included_opencdk" = "yes")
343 ac_enable_openssl=yes
344 AC_MSG_CHECKING([whether to disable OpenSSL compatibility layer])
345 AC_ARG_ENABLE(openssl-compatibility,
346         AS_HELP_STRING([--disable-openssl-compatibility],
347                 [disable the OpenSSL compatibility support]),
348         ac_enable_openssl=no)
349 if test x$ac_enable_openssl != xno; then
350  AC_MSG_RESULT(no)
351 else
352  AC_MSG_RESULT(yes)
355 AM_CONDITIONAL(ENABLE_OPENSSL, test "$ac_enable_openssl" = "yes")
358 AC_ARG_WITH(included-libtasn1,
359         AS_HELP_STRING([--with-included-libtasn1],
360                 [use the included libtasn1]),
361         minitasn1_enabled=$withval,
362         minitasn1_enabled=no)
364 if test x$minitasn1_enabled = xno; then
365 AM_PATH_LIBTASN1($GNUTLS_LIBTASN1_VERSION,,
366  minitasn1_enabled=yes
367  AC_MSG_WARN([[
368 *** 
369 *** LibtASN1 ${GNUTLS_LIBTASN1_VERSION} was not found. Will use the included one.
370 ]]))
373 SAVED_LIBS=$LIBS
375 AC_MSG_CHECKING([whether to use the included minitasn1])
376 AC_MSG_RESULT($minitasn1_enabled)
378 dnl CHECK FOR THE LIBTASN1 LIBRARY or use the included one
381 AM_CONDITIONAL(ENABLE_MINITASN1, test "$minitasn1_enabled" = "yes")
384 dnl Check for libcfg+
386 AC_ARG_WITH(included-libcfg,
387         AS_HELP_STRING([--with-included-libcfg],
388                 [use the included libcfg+ (certtool only)]),
389 libcfg_enabled=$withval, 
390 libcfg_enabled=no
392 dnl We search for libcfg+ which is used by certtool
394 AC_CHECK_LIB(cfg+, cfg_get_context,:, 
395  libcfg_enabled=yes
396 AC_MSG_WARN([[
397 *** 
398 *** Libcfg+ was not found. Will use the included one.]])))
400 AM_CONDITIONAL(HAVE_LIBCFG, test "$libcfg_enabled" = "no")
401 LIBS=$SAVED_LIBS
403 AC_MSG_CHECKING([whether to use the included libcfg])
404 AC_MSG_RESULT($libcfg_enabled)
407 dnl CHECK FOR ZLIB SUPPORT
410 AC_MSG_CHECKING([whether to include zlib compression support])
412 AC_ARG_WITH(zlib,
413         AS_HELP_STRING([--without-zlib], [disable zlib compression support]),
414         ac_zlib=$withval,
415         ac_zlib=yes)
417 if test x$ac_zlib != xno; then
418  AC_MSG_RESULT(yes)
419  AC_LIB_HAVE_LINKFLAGS(z,, [#include <zlib.h>], [compress (0, 0, 0, 0);])
420  if test "$ac_cv_libz" != yes; then
421    AC_MSG_WARN(
422 *** 
423 *** ZLIB was not found. You will not be able to use ZLIB compression.)
424  fi
425 else
426  AC_MSG_RESULT(no)
431 dnl CHECK FOR LZO SUPPORT (whether to use the included one)
434 minilzo_enabled=no
435 use_lzo=yes
436 AC_ARG_WITH(lzo,
437         AS_HELP_STRING([--without-lzo], [do not use lzo compression]),
438         use_lzo=$withval,
439         use_lzo=yes)
441 AC_MSG_CHECKING([whether to include lzo compression support])
442 AC_MSG_RESULT($use_lzo)
444 if test x$use_lzo = xyes; then
445   AC_DEFINE(USE_LZO, 1, [whether to use the lzo compression])
447   AC_ARG_WITH(included-lzo,
448         AS_HELP_STRING([--with-included-lzo],
449                 [include minilzo in libgnutls-extra]),
450         minilzo_enabled=$withval,
451         minilzo_enabled=no)
453   AC_MSG_CHECKING([whether to use the included lzo compression library])
454   AC_MSG_RESULT($minilzo_enabled)
456   LZO_LIBS=
457   if test "$minilzo_enabled" != "yes"; then
458     AC_CHECK_LIB(lzo2, lzo1x_1_compress, LZO_LIBS=-llzo2)
459     if test "$LZO_LIBS" = ""; then
460       AC_CHECK_LIB(lzo, lzo1x_1_compress, LZO_LIBS=-llzo, [
461         minilzo_enabled=yes
462         AC_MSG_WARN(
464 *** Could not find liblzo or liblzo2. Will use the included minilzo.
466       ])
467     fi
468   fi
469   AC_SUBST(LZO_LIBS)
471   if test "$LZO_LIBS" = "-llzo"; then
472     AC_CHECK_HEADERS(lzo1x.h)
473   elif test "$LZO_LIBS" = "-llzo2"; then
474     AC_CHECK_HEADERS(lzo/lzo1x.h)
475   fi
477   if test "$minilzo_enabled" = "yes"; then
478     AC_DEFINE(USE_MINILZO, 1, [whether to use the included minilzo])
479   fi
482 AM_CONDITIONAL(USE_LZO, test "$use_lzo" = "yes")
483 AM_CONDITIONAL(ENABLE_INCLUDED_LZO, test "$minilzo_enabled" = "yes")
485 AC_MSG_RESULT([***
486 *** Setting up gnulib compatibility files...
488 gl_INIT
490 AC_MSG_RESULT([***
491 *** Detecting options for shared libraries...
493 AC_LIBTOOL_WIN32_DLL
494 AM_PROG_LIBTOOL
496 LIBGNUTLS_LIBS="-L${libdir} -lgnutls $LIBTASN1_LIBS $LIBGCRYPT_LIBS $LIBS"
497 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS $LIBTASN1_CFLAGS -I${includedir}"
498 AC_SUBST(LIBGNUTLS_LIBS)
499 AC_SUBST(LIBGNUTLS_CFLAGS)
501 LIBGNUTLS_EXTRA_LIBS="-L${libdir} -lgnutls-extra $LIBOPENCDK_LIBS $LZO_LIBS $LIBGNUTLS_LIBS"
502 LIBGNUTLS_EXTRA_CFLAGS="$LIBOPENCDK_CFLAGS -I${includedir}"
503 AC_SUBST(LIBGNUTLS_EXTRA_LIBS)
504 AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
505 export ac_full
507 CFLAGS="${CFLAGS} ${LIBGCRYPT_CFLAGS}"
509 if test $ac_cv_c_compiler_gnu != no; then
510         if test x$opt_profiler_mode = xyes; then
511           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
512           if test x$FC_OK = xyes; then
513                 CFLAGS="${CFLAGS} `fc-config --cflags`"
514                 LIBS="$LIBS `fc-config --libs`"
515           else
516 AC_MSG_WARN(***
517 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
519           fi
520         fi
523 if test $ac_full -eq 0; then
524   AC_SUBST(POSSIBLY_WARN_ABOUT_MISSING_FEATURES, [[
525 #ifdef __GNUC__
526 #warning This is not the official GnuTLS library. Several features were disabled at compilation.
527 #endif /* __GNUC__ */]])
530 AC_CONFIG_COMMANDS([chmod-config],[[
531  chmod +x lib/libgnutls-config
532  chmod +x libextra/libgnutls-extra-config
533 ]],[[]])
535 AC_CONFIG_FILES([Makefile po/Makefile.in \
536         doc/Makefile doc/examples/Makefile doc/scripts/Makefile \
537         doc/manpages/Makefile doc/reference/Makefile \
538         gl/Makefile tests/Makefile \
539         includes/Makefile includes/gnutls/gnutls.h \
540         lib/Makefile lib/minitasn1/Makefile lib/x509/Makefile \
541         libextra/Makefile libextra/openpgp/Makefile libextra/opencdk/Makefile \
542         libextra/minilzo/Makefile \
543         src/Makefile src/x509/Makefile src/srp/Makefile src/openpgp/Makefile \
544         src/cfg/Makefile src/cfg/platon/Makefile src/cfg/platon/str/Makefile \
545         lib/libgnutls-config libextra/libgnutls-extra-config \
546         lib/gnutls.pc libextra/gnutls-extra.pc])
548 AC_OUTPUT