summaryrefslogtreecommitdiff
path: root/configure.in
blob: 814c8fb689f24d3e94a3b95c224de847392d9eec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT
dnl AC_CONFIG_HEADER(config.h)

AC_PREFIX_DEFAULT(/usr/local)

AC_CANONICAL_TARGET([])
AC_DEFINE_UNQUOTED(T_CPU, "$target_cpu")
AC_DEFINE_UNQUOTED(T_VENDOR, "$target_vendor")
AC_DEFINE_UNQUOTED(T_OS, "$target_os")

GNUTLS_MAJOR_VERSION=0
GNUTLS_MINOR_VERSION=2
GNUTLS_MICRO_VERSION=90
GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION

AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION")

AM_INIT_AUTOMAKE(gnutls, $GNUTLS_VERSION)
AM_CONFIG_HEADER(config.h)


GNUTLS_MOST_RECENT_INTERFACE=$GNUTLS_MINOR_VERSION
GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER=$GNUTLS_MICRO_VERSION
GNUTLS_OLDEST_INTERFACE=0


AC_SUBST(GNUTLS_MAJOR_VERSION)
AC_SUBST(GNUTLS_MINOR_VERSION)
AC_SUBST(GNUTLS_MICRO_VERSION)
AC_SUBST(GNUTLS_VERSION)

AC_SUBST(GNUTLS_MOST_RECENT_INTERFACE)
AC_SUBST(GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER)
AC_SUBST(GNUTLS_OLDEST_INTERFACE)

LT_CURRENT=$GNUTLS_MOST_RECENT_INTERFACE
LT_REVISION=$GNUTLS_CURRENT_INTERFACE_IMPLEMENTATION_NUMBER
LT_AGE=`expr $GNUTLS_MOST_RECENT_INTERFACE - $GNUTLS_OLDEST_INTERFACE`
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)

opt_dmalloc_mode=no
AC_MSG_CHECKING([whether in dmalloc mode])
AC_ARG_ENABLE(dmalloc-mode,
[  --enable-dmalloc-mode enable dmalloc mode],
opt_dmalloc_mode=$enableval)
AC_MSG_RESULT($opt_dmalloc_mode)

opt_maintainer_mode=no
AC_MSG_CHECKING([whether in maintanance mode])
AC_ARG_ENABLE(maintainer-mode,
[  --enable-maintainer-mode enable maintainer mode],
opt_maintainer_mode=$enableval)
AC_MSG_RESULT($opt_maintainer_mode)

opt_profiler_mode=no
AC_MSG_CHECKING([whether in profile mode])
AC_ARG_ENABLE(profile-mode,
[  --enable-profile-mode enable profiler],
opt_profiler_mode=$enableval)
AC_MSG_RESULT($opt_profiler_mode)

AC_MSG_RESULT([***
*** Checking for required for compilation programs...
])

AC_PROG_CC

AC_PROG_YACC

AC_PROG_LN_S


dnl Checks for programs.
AC_PROG_INSTALL

dnl AC_PROG_MAKE_SET

AC_MSG_RESULT([***
*** Checking for external libraries...
])

AM_PATH_LIBGCRYPT(1.1.4,,
 	AC_MSG_ERROR([[
***  
*** libgcrypt was not found. You may want to get it from
*** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
***
]]))
dnl Can't disable - gnutls depends on gcrypt
AC_DEFINE(USE_GCRYPT)

dnl MCRYPT

AC_ARG_WITH( mcrypt, [  --with-mcrypt           enable libmcrypt support],
 [AM_PATH_LIBMCRYPT( 2.4.0,, 
 	AC_MSG_ERROR([[*** libmcrypt was not found]])
    AC_MSG_ERROR([[*** You need libmcrypt 2.4.x to compile this program. http://mcrypt.hellug.gr]])
 )
 ]
)

LIBS="${LIBS} ${LIBMCRYPT_LIBS}"

AC_ARG_WITH( mhash, [  --with-mhash            enable libmhash support],
 [AC_CHECK_LIB(mhash, mhash_init, AC_DEFINE(USE_MHASH) 
LIBS="${LIBS} -lmhash")])

AC_MSG_CHECKING([whether to check for external libraries])

dnl if used --with-ext-libraries then we will not check
dnl for any library (libz, libgdbm)

AC_ARG_WITH( ext-libraries, [  --without-ext-libraries disable external libraries support],
 ac_ext_libraries=$withval
)

if test x$ac_ext_libraries != xno; then
 AC_MSG_RESULT(yes)
 AC_CHECK_LIB(gdbm, gdbm_open,, AC_MSG_WARN("GDBM was not found. You will not be able to use Server side session resuming."))
 AC_CHECK_LIB(z, compress,,AC_MSG_WARN("ZLIB was not found. You will not be able to use ZLIB compression."))
else
 AC_MSG_RESULT()


fi


AC_MSG_RESULT([***
*** Detecting compiler options...
])


AC_C_CONST
AC_C_INLINE

if test $ac_cv_c_compiler_gnu != no; then
	CFLAGS=""


	if test x$opt_profiler_mode = xyes; then
	  CFLAGS="${CFLAGS} -O0 -fprofile-arcs -finstrument-functions -ftest-coverage"
	  AC_CHECK_LIB(fnccheck, main,
		LIBS="$LIBS -lfnccheck",
		AC_MSG_ERROR("You must install libfnccheck in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html")
	  )
	fi

	if test x$opt_maintainer_mode = xyes; then

	  CFLAGS="${CFLAGS} -O0 -ggdb3 -Wall -Wpointer-arith"
	else
	  CFLAGS="${CFLAGS} -O2"
	fi

	if test x$opt_dmalloc_mode = xyes; then
	  AC_CHECK_LIB( dmalloc, main)
	  AC_DEFINE(USE_DMALLOC)
	fi

	AC_MSG_CHECKING([whether we have GNU assembler])
	
	GAS=`as --version|grep GNU`
	if test "$GAS"; then
	  CFLAGS="${CFLAGS} -pipe"
	  AC_MSG_RESULT(yes)
	else
	  AC_MSG_RESULT(no)
	fi
fi

AC_MSG_RESULT([***
*** Detecting library capabilities...
])

AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h pwd.h locale.h strings.h stdarg.h)
AC_CHECK_HEADERS(sys/stat.h sys/types.h sys/socket.h)
AC_CHECK_HEADERS(utime.h errno.h sys/time.h time.h)
AC_CHECK_FUNCS(bzero memset utime memmove bcopy,,)


dnl Defines USE_VA_COPY
AC_MSG_CHECKING([whether we have va_copy or __va_copy])
AC_TRY_RUN( 
changequote(<<, >>)dnl
<<
#ifdef HAVE_STDARG_H
# include <stdarg.h> 
#endif
int main() {
va_list a,b;
va_copy(a, b);  
return 0;
}
>>
changequote([, ])dnl
,
dnl	************ HAVE_VA_COPY
AC_DEFINE(HAVE_VA_COPY)
AC_DEFINE(USE_VA_COPY)
AC_MSG_RESULT(va_copy)
,
dnl	 ************ NO VA_COPY
 dnl Defines USE_VA_COPY
 AC_TRY_RUN(
 changequote(<<, >>)dnl
 <<#ifdef HAVE_STDARG_H
   # include <stdarg.h> 
   #endif
 int main() {
 va_list a,b;
 __va_copy(a, b);  
 return 0;
 }
 >>
 changequote([, ])dnl
 ,
 dnl	************ HAVE___VA_COPY
 AC_DEFINE(HAVE___VA_COPY)
 AC_DEFINE(USE_VA_COPY)
 AC_MSG_RESULT(__va_copy)
 ,
 dnl	 ************ NO __VA_COPY
 AC_MSG_RESULT(none)
 )
,
dnl **** CROSS COMPILING
AC_MSG_RESULT(none)
)



AC_MSG_RESULT([***
*** Detecting system's parameters...
])

AC_CHECK_SIZEOF(unsigned long long, 8)
AC_CHECK_SIZEOF(unsigned long int, 4)
AC_CHECK_SIZEOF(unsigned int, 4)
AC_CHECK_SIZEOF(unsigned short int, 2)
AC_CHECK_SIZEOF(unsigned char, 1)

AC_CHECK_TYPE(size_t,,
AC_DEFINE(NO_SIZE_T)
,[
#ifdef HAVE_TIME_H
# include <time.h>
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
])


AC_CHECK_TYPE(time_t,,
AC_DEFINE(NO_TIME_T),
[
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
]
)


AC_C_BIGENDIAN

AC_MSG_RESULT([***
*** Detecting options for shared libraries...
])
AM_PROG_LIBTOOL

LIBGNUTLS_LIBS="$LIBS -L${libdir} -lgnutls $LIBGCRYPT_LIBS"
LIBGNUTLS_CFLAGS="$LIBGCRYPT_CFLAGS -I${includedir}"
AC_SUBST(LIBGNUTLS_LIBS)
AC_SUBST(LIBGNUTLS_CFLAGS)

AC_CONFIG_COMMANDS([default],[[
 cat lib/gnutls_ui.h >> lib/gnutls.h
 echo "" >> lib/gnutls.h
 cat lib/gnutls_errors_int.h >> lib/gnutls.h
 echo "" >> lib/gnutls.h
 cat lib/x509_asn1.h >> lib/gnutls.h
 echo "" >> lib/gnutls.h
 echo "#ifdef __cplusplus" >> lib/gnutls.h
 echo "}" >> lib/gnutls.h
 echo "#endif" >> lib/gnutls.h
 echo "#endif /* GNUTLS_H */" >> lib/gnutls.h
 echo "" >> lib/gnutls.h
 chmod -w lib/gnutls.h 
 chmod +x lib/libgnutls-config
]],[[]])

AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile lib/libgnutls-config \
lib/gnutls.h doc/Makefile src/x509/Makefile src/srp/Makefile doc/tex/Makefile \
doc/tex/cover.tex doc/scripts/Makefile])
AC_OUTPUT