*** empty log message ***
[gnutls.git] / configure.in
bloba84a21cbab04f288280f9f98256db2f37b0b57b9
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")
9 AC_DEFINE_UNQUOTED(T_VENDOR, "$target_vendor")
10 AC_DEFINE_UNQUOTED(T_OS, "$target_os")
12 dnl Gnutls Version
13 GNUTLS_MAJOR_VERSION=0
14 GNUTLS_MINOR_VERSION=4
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")
20 AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION)
21 AM_CONFIG_HEADER(config.h)
23 dnl This is the library version
24 GNUTLS_MOST_RECENT_INTERFACE=4
25 GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
26 GNUTLS_OLDEST_INTERFACE=4
29 AC_SUBST(GNUTLS_MAJOR_VERSION)
30 AC_SUBST(GNUTLS_MINOR_VERSION)
31 AC_SUBST(GNUTLS_MICRO_VERSION)
32 AC_SUBST(GNUTLS_VERSION)
34 AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
35 AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
36 AC_SUBST(GNUTLS_OLDEST_INTERFACE)
38 LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
39 LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
40 LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
41 AC_SUBST(LT_CURRENT)
42 AC_SUBST(LT_REVISION)
43 AC_SUBST(LT_AGE)
45 opt_dmalloc_mode=no
46 AC_MSG_CHECKING([whether in dmalloc mode])
47 AC_ARG_ENABLE(dmalloc-mode,
48 [  --enable-dmalloc-mode      enable dmalloc mode],
49 opt_dmalloc_mode=$enableval)
50 AC_MSG_RESULT($opt_dmalloc_mode)
52 opt_efence_mode=no
53 AC_MSG_CHECKING([whether in electric fence mode])
54 AC_ARG_ENABLE(efence-mode,
55 [  --enable-efence-mode       enable electric fence mode],
56 opt_efence_mode=$enableval)
57 AC_MSG_RESULT($opt_efence_mode)
59 opt_maintainer_mode=no
60 AC_MSG_CHECKING([whether in maintanance mode])
61 AC_ARG_ENABLE(maintainer-mode,
62 [  --enable-maintainer-mode   enable maintainer mode],
63 opt_maintainer_mode=$enableval)
64 AC_MSG_RESULT($opt_maintainer_mode)
66 opt_profiler_mode=no
67 AC_MSG_CHECKING([whether in profile mode])
68 AC_ARG_ENABLE(profile-mode,
69 [  --enable-profile-mode      enable profiler],
70 opt_profiler_mode=$enableval)
71 AC_MSG_RESULT($opt_profiler_mode)
73 AC_MSG_RESULT([***
74 *** Checking for compilation programs...
77 AC_PROG_CC
79 AC_PROG_YACC
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
99 if test $ac_cv_c_compiler_gnu != no; then
101         if test x$opt_maintainer_mode = xyes; then
103           CFLAGS="${CFLAGS} -O0 -ggdb3 -Wall -Wpointer-arith -Wstrict-prototypes" # -Werror
104         else
105           CFLAGS="${CFLAGS} -O2 -fexpensive-optimizations -fomit-frame-pointer"
106         fi
108         if test x$opt_dmalloc_mode = xyes; then
109           AC_CHECK_LIB( dmalloc, main)
110           AC_DEFINE(USE_DMALLOC)
111           AC_DEFINE(USE_LIBCALLOC)
112         else
113                 if test x$opt_efence_mode = xyes; then
114                   AC_CHECK_LIB( efence, main)
115                   AC_DEFINE(USE_EFENCE)
116                   AC_DEFINE(USE_LIBCALLOC)
117                 fi
118         fi
121         AC_MSG_CHECKING([whether we have GNU assembler])
122         
123         GAS=`as --version < /dev/null|grep GNU`
124         if test "$GAS"; then
125           CFLAGS="${CFLAGS} -pipe"
126           AC_MSG_RESULT(yes)
127         else
128           AC_MSG_RESULT(no)
129         fi
133 AC_MSG_RESULT([***
134 *** Detecting C library capabilities...
137 AC_HEADER_STDC
138 AC_CHECK_HEADERS(unistd.h pwd.h locale.h strings.h stdarg.h)
139 AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
140 AC_CHECK_HEADERS(errno.h sys/time.h time.h)
141 AC_CHECK_FUNCS(bzero memset memmove bcopy,,)
145 AC_MSG_RESULT([***
146 *** Detecting system's parameters...
149 AC_CHECK_SIZEOF(unsigned long long, 8)
150 AC_CHECK_SIZEOF(unsigned long int, 4)
151 AC_CHECK_SIZEOF(unsigned int, 4)
152 AC_CHECK_SIZEOF(unsigned short int, 2)
153 AC_CHECK_SIZEOF(unsigned char, 1)
155 AC_CHECK_TYPE(size_t,
156 DEFINE_SIZE_T="#include <sys/types.h>"
157 AC_SUBST( DEFINE_SIZE_T)
159 AC_DEFINE(NO_SIZE_T)
160 DEFINE_SIZE_T="typedef unsigned int size_t; typedef int ssize_t;"
161 AC_SUBST( DEFINE_SIZE_T)
163 #ifdef HAVE_SYS_TYPES_H
164 # include <sys/types.h>
165 #endif
166 #ifdef HAVE_UNISTD_H
167 # include <unistd.h>
168 #endif
172 AC_CHECK_TYPE(time_t,
173  DEFINE_TIME_T="#include <time.h>"
174  AC_SUBST( DEFINE_TIME_T)
176   AC_CHECK_TYPE(time_t,
177    DEFINE_TIME_T="#include <sys/time.h>"
178    AC_SUBST( DEFINE_TIME_T)
179    ,
180     DEFINE_TIME_T="typedef unsigned int time_t;"
181     AC_SUBST( DEFINE_TIME_T)
182     AC_DEFINE(NO_TIME_T),
183   [
184    #include <sys/time.h>
185   ]
186   )
189  #include <time.h>
193 AC_C_BIGENDIAN
196 AC_MSG_RESULT([***
197 *** Checking for external libraries...
200 AM_PATH_LIBGCRYPT(1.1.5,,
201         AC_MSG_ERROR([[
202 ***  
203 *** libgcrypt was not found. You may want to get it from
204 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
206 ]]))
207 dnl Can't disable - gnutls depends on gcrypt
208 AC_DEFINE(USE_GCRYPT)
210 dnl MCRYPT
212 AC_ARG_WITH( mcrypt, [  --with-mcrypt           enable libmcrypt support],
213  [AM_PATH_LIBMCRYPT( 2.4.0,, 
214         AC_MSG_ERROR([[*** libmcrypt was not found]])
215     AC_MSG_ERROR([[*** You need libmcrypt 2.4.x to compile this program. http://mcrypt.hellug.gr]])
220 LIBS="${LIBS} ${LIBMCRYPT_LIBS}"
222 AC_ARG_WITH( mhash, [  --with-mhash            enable libmhash support],
223  [AC_CHECK_LIB(mhash, mhash_init, AC_DEFINE(USE_MHASH) 
224 LIBS="${LIBS} -lmhash")])
226 AC_MSG_CHECKING([whether to check for external libraries])
228 dnl if used --without-ext-libraries then we will not check
229 dnl for any library (libz, libgdbm)
231 AC_ARG_WITH( ext-libraries, [  --without-ext-libraries disable external libraries support],
232  ac_ext_libraries=$withval
235 if test x$ac_ext_libraries != xno; then
236  AC_MSG_RESULT(yes)
237  AC_CHECK_LIB(gdbm, gdbm_open,, AC_MSG_WARN(
238 *** 
239 *** GDBM was not found. You will not be able to use the default gdbm session resumption backend.))
240  AC_CHECK_LIB(z, compress,,AC_MSG_WARN(
241 *** 
242 *** ZLIB was not found. You will not be able to use ZLIB compression.))
243 else
244  AC_MSG_RESULT()
247 AC_MSG_CHECKING([whether to disable SRP authentication support])
248 AC_ARG_ENABLE( srp, [  --disable-srp-authentication     disable the SRP authentication support],
249  ac_enable_srp=no
251 if test x$ac_enable_srp != xno; then
252  AC_MSG_RESULT(no)
253  AC_DEFINE(ENABLE_SRP)
254 else
255  AC_MSG_RESULT(yes)
258 AC_MSG_CHECKING([whether to disable anonymous authentication support])
259 AC_ARG_ENABLE( srp, [  --disable-anon-authentication    disable the anonymous authentication support],
260  ac_enable_anon=no
262 if test x$ac_enable_anon != xno; then
263  AC_MSG_RESULT(no)
264  AC_DEFINE(ENABLE_ANON)
265 else
266  AC_MSG_RESULT(yes)
270 AC_MSG_CHECKING([whether to disable OpenPGP Certificate authentication support])
271 AC_ARG_ENABLE( srp, [  --disable-openpgp-authentication disable the OpenPGP authentication support],
272  ac_enable_openpgp=no
274 if test x$ac_enable_openpgp != xno; then
275  AC_MSG_RESULT(no)
276  AC_CHECK_LIB(opencdk, cdk_iobuf_new,,AC_MSG_WARN(
278 *** OPENCDK was not found. You will not be able to use OpenPGP keys with gnutls.))
279 else
280  AC_MSG_RESULT(yes)
287 AC_MSG_RESULT([***
288 *** Detecting options for shared libraries...
290 AM_PROG_LIBTOOL
292 LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBGCRYPT_LIBS"
293 LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
294 AC_SUBST(LIBGNUTLS_LIBS)
295 AC_SUBST(LIBGNUTLS_CFLAGS)
297 if test $ac_cv_c_compiler_gnu != no; then
299         if test x$opt_profiler_mode = xyes; then
300           CFLAGS="${CFLAGS} -O0 `fc-config --cflags`"
301           AC_CHECK_PROG(FC_OK, fc-config, yes, no)
302           if test x$FC_OK = xyes; then
303                 LIBS="$LIBS `fc-config --libs`"
304           else
305 AC_MSG_WARN(***
306 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
308           fi
309         fi
312 AC_CONFIG_FILES(lib/gnutls.h.in)
314 AC_CONFIG_COMMANDS([lib/gnutls.h],[[
315  test -f lib/gnutls.h.in || (echo "Could not generate lib/gnutls.h" && exit 1)
316  cat lib/gnutls.h.in > lib/gnutls.h
317  cat lib/gnutls_ui.h >> lib/gnutls.h
318  echo "" >> lib/gnutls.h
319  cat lib/gnutls_errors_int.h | grep -v _INT_ >> lib/gnutls.h
320  echo "" >> lib/gnutls.h
321  cat lib/x509_asn1.h >> lib/gnutls.h
322  echo "" >> lib/gnutls.h
323  echo "#ifdef __cplusplus" >> lib/gnutls.h
324  echo "}" >> lib/gnutls.h
325  echo "#endif" >> lib/gnutls.h
326  echo "#endif /* GNUTLS_H */" >> lib/gnutls.h
327  echo "" >> lib/gnutls.h
328  chmod +x lib/libgnutls-config
329 ]],[[]])
331 AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile lib/libgnutls-config \
332 doc/Makefile src/x509/Makefile src/srp/Makefile doc/tex/Makefile \
333 doc/tex/cover.tex doc/scripts/Makefile src/openpgp/Makefile])
334 AC_OUTPUT