Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / cyassl / configure.in
blobef38cf2f284949da8dd7ec90593da5784e75749f
1 AC_INIT
2 AC_CANONICAL_SYSTEM
3 AM_INIT_AUTOMAKE(cyassl,1.9.0) # !!! also change in ssl.h !!!
4 AM_CONFIG_HEADER(ctaocrypt/include/config.h)
7 #dnl Include m4
8 #sinclude(lib_socket_nsl.m4)
9 #sinclude(acx_pthread.m4)
10 AC_CONFIG_MACRO_DIR([m4])
13 # make sure configure doesn't add to CFLAGS
14 CFLAGS="$CFLAGS $C_EXTRA_FLAGS"    
16 AC_PROG_CC
17 AC_PROG_CC_C_O
18 AM_PROG_AS
19 AC_PROG_INSTALL
20 AC_LIBTOOL_WIN32_DLL
21 AC_PROG_LIBTOOL
23 AC_PREFIX_DEFAULT(/usr/local/cyassl)
25 AC_C_BIGENDIAN
27 AC_CHECK_SIZEOF(long, 4)
28 AC_CHECK_SIZEOF(long long, 8)
30 AC_CHECK_LIB(network,socket)
31 AC_CHECK_LIBM
33 AC_CHECK_HEADERS(errno.h)
35 OPTIMIZE_CFLAGS="-Os -fomit-frame-pointer"
36 OPTIMIZE_FAST_CFLAGS="-O3 -fomit-frame-pointer"
37 OPTIMIZE_HUGE_CFLAGS="-funroll-loops -DTFM_SMALL_SET"
38 DEBUG_CFLAGS="-g -DDEBUG -DDEBUG_CYASSL"
41 # DEBUG
42 AC_ARG_ENABLE(debug,
43     [  --enable-debug          Enable CyaSSL debugging support (default: disabled)],
44     [ ENABLED_DEBUG=$enableval ],
45     [ ENABLED_DEBUG=no ]
46     )
47 if test "$ENABLED_DEBUG" = "yes"
48 then
49   # Full debug. Very slow in some cases
50   CFLAGS="$DEBUG_CFLAGS $CFLAGS"
51 else
52   # Optimized version. No debug
53   CFLAGS="$CFLAGS -DNDEBUG"
57 # SMALL BUILD
58 AC_ARG_ENABLE(small,
59     [  --enable-small          Enable smallest build (default: disabled)],
60     [ ENABLED_SMALL=$enableval ],
61     [ ENABLED_SMALL=no ]
62     )
63 if test "$ENABLED_SMALL" = "yes"
64 then
65   # make small no tls build with smallest cipher
66   # if you only want server or client you can define NO_CYASSL_SERVER or
67   # NO_CYASSL_CLIENT but then some of the examples and testsuite won't build
68   # note that TLS needs HMAC
69   CFLAGS="-DNO_TLS -DNO_HMAC -DNO_AES -DNO_DES3 -DNO_SHA256 -DNO_ERROR_STRINGS -DNO_HC128 -DNO_RABBIT -DNO_PSK -DNO_DSA -DNO_DH $CFLAGS"
73 # SINGLE THREADED
74 AC_ARG_ENABLE(singleThreaded,
75     [  --enable-singleThreaded Enable CyaSSL single threaded (default: disabled)],
76     [ ENABLED_SINGLETHREADED=$enableval ],
77     [ ENABLED_SINGLETHREADED=no ]
78     )
79 if test "$ENABLED_SINGLETHREADED" = "yes"
80 then
81   CFLAGS="-DSINGLE_THREADED $CFLAGS"
85 # DTLS
86 AC_ARG_ENABLE(dtls,
87     [  --enable-dtls           Enable CyaSSL DTLS (default: disabled)],
88     [ ENABLED_DTLS=$enableval ],
89     [ ENABLED_DTLS=no ]
90     )
91 if test "$ENABLED_DTLS" = "yes"
92 then
93   CFLAGS="-DCYASSL_DTLS $CFLAGS"
97 # OPENSSL Extra Compatibility
98 AC_ARG_ENABLE(opensslExtra,
99     [  --enable-opensslExtra   Enable extra OpenSSL API, size+ (default: disabled)],
100     [ ENABLED_OPENSSLEXTRA=$enableval ],
101     [ ENABLED_OPENSSLEXTRA=no ]
102     )
103 if test "$ENABLED_OPENSSLEXTRA" = "yes"
104 then
105   CFLAGS="-DOPENSSL_EXTRA $CFLAGS"
109 # IPv6 Test Apps
110 AC_ARG_ENABLE(ipv6,
111     [  --enable-ipv6           Enable testing of IPV6 (default: disabled)],
112     [ ENABLED_IPV6=$enableval ],
113     [ ENABLED_IPV6=no ]
114     )
116 if test "$ENABLED_IPV6" = "yes"
117 then
118     CFLAGS="$CFLAGS -DTEST_IPV6"
122 # fastmath
123 AC_ARG_ENABLE(fastmath,
124     [  --enable-fastmath       Enable fast math for BigInts(default: disabled)],
125     [ ENABLED_FASTMATH=$enableval ],
126     [ ENABLED_FASTMATH=no ]
127     )
129 if test "$ENABLED_FASTMATH" = "yes"
130 then
131     CFLAGS="$CFLAGS -DUSE_FAST_MATH"
135 # fast HUGE math
136 AC_ARG_ENABLE(fasthugemath,
137     [  --enable-fasthugemath   Enable fast math + huge code for BigInts(def: off)],
138     [ ENABLED_FASTHUGEMATH=$enableval ],
139     [ ENABLED_FASTHUGEMATH=no ]
140     )
142 if test "$ENABLED_FASTHUGEMATH" = "yes"
143 then
144     ENABLED_FASTMATH="yes"
145     CFLAGS="$CFLAGS -DUSE_FAST_MATH"
148 AM_CONDITIONAL([BUILD_FASTMATH], [test "x$ENABLED_FASTMATH" = "xyes"])
151 # big cache
152 AC_ARG_ENABLE(bigcache,
153     [  --enable-bigcache       Enable big session cache (default: disabled)],
154     [ ENABLED_BIGCACHE=$enableval ],
155     [ ENABLED_BIGCACHE=no ]
156     )
158 if test "$ENABLED_BIGCACHE" = "yes"
159 then
160     CFLAGS="$CFLAGS -DBIG_SESSION_CACHE"
164 # HUGE cache
165 AC_ARG_ENABLE(hugecache,
166     [  --enable-hugecache      Enable huge session cache (default: disabled)],
167     [ ENABLED_HUGECACHE=$enableval ],
168     [ ENABLED_HUGECACHE=no ]
169     )
171 if test "$ENABLED_HUGECACHE" = "yes"
172 then
173     CFLAGS="$CFLAGS -DHUGE_SESSION_CACHE"
177 # SNIFFER
178 AC_ARG_ENABLE(sniffer,
179     [  --enable-sniffer        Enable CyaSSL sniffer support (default: disabled)],
180     [ ENABLED_SNIFFER=$enableval ],
181     [ ENABLED_SNIFFER=no ]
182     )
184 if test "$ENABLED_SNIFFER" = "yes"
185 then
186     CFLAGS="$CFLAGS -DCYASSL_SNIFFER -DOPENSSL_EXTRA"
189 AM_CONDITIONAL([BUILD_SNIFFER], [test "x$ENABLED_SNIFFER" = "xyes"])
191 # AES-NI
192 AC_ARG_ENABLE(aesni,
193     [  --enable-aesni          Enable CyaSSL AES-NI support (default: disabled)],
194     [ ENABLED_AESNI=$enableval ],
195     [ ENABLED_AESNI=no ]
196     )
198 if test "$ENABLED_AESNI" = "yes"
199 then
200     CFLAGS="$CFLAGS -DCYASSL_AESNI"
201     if test "$GCC" = "yes"
202     then
203         # GCC needs these flags, icc doesn't
204         CFLAGS="$CFLAGS -maes -msse4"
205     fi
208 AM_CONDITIONAL([BUILD_AESNI], [test "x$ENABLED_AESNI" = "xyes"])
211 # RIPEMD
212 AC_ARG_ENABLE(ripemd,
213     [  --enable-ripemd         Enable CyaSSL RIPEMD-160 support (default: disabled)],
214     [ ENABLED_RIPEMD=$enableval ],
215     [ ENABLED_RIPEMD=no ]
216     )
218 if test "$ENABLED_RIPEMD" = "yes"
219 then
220     CFLAGS="$CFLAGS -DCYASSL_RIPEMD"
223 AM_CONDITIONAL([BUILD_RIPEMD], [test "x$ENABLED_RIPEMD" = "xyes"])
226 # SHA512
227 AC_ARG_ENABLE(sha512,
228     [  --enable-sha512         Enable CyaSSL SHA-160 support (default: disabled)],
229     [ ENABLED_SHA512=$enableval ],
230     [ ENABLED_SHA512=no ]
231     )
233 if test "$ENABLED_SHA512" = "yes"
234 then
235     CFLAGS="$CFLAGS -DCYASSL_SHA512"
238 AM_CONDITIONAL([BUILD_SHA512], [test "x$ENABLED_SHA512" = "xyes"])
241 # SESSION CERTS
242 AC_ARG_ENABLE(sessioncerts,
243     [  --enable-sessioncerts   Enable session cert storing (default: disabled)],
244     [ ENABLED_SESSIONCERTS=$enableval ],
245     [ ENABLED_SESSIONCERTS=no ]
246     )
248 if test "$ENABLED_SESSIONCERTS" = "yes"
249 then
250     CFLAGS="$CFLAGS -DSESSION_CERTS"
254 # KEY GENERATION
255 AC_ARG_ENABLE(keygen,
256     [  --enable-keygen         Enable key generation (default: disabled)],
257     [ ENABLED_KEYGEN=$enableval ],
258     [ ENABLED_KEYGEN=no ]
259     )
261 if test "$ENABLED_KEYGEN" = "yes"
262 then
263     CFLAGS="$CFLAGS -DCYASSL_KEY_GEN"
267 # CERT GENERATION
268 AC_ARG_ENABLE(certgen,
269     [  --enable-certgen        Enable cert generation (default: disabled)],
270     [ ENABLED_CERTGEN=$enableval ],
271     [ ENABLED_CERTGEN=no ]
272     )
274 if test "$ENABLED_CERTGEN" = "yes"
275 then
276     CFLAGS="$CFLAGS -DCYASSL_CERT_GEN"
280 # HC128
281 AC_ARG_ENABLE(hc128,
282     [  --enable-hc128          Enable HC-128 (default: disabled)],
283     [ ENABLED_HC128=$enableval ],
284     [ ENABLED_HC128=no ]
285     )
287 if test "$ENABLED_HC128" = "no"
288 then
289     CFLAGS="$CFLAGS -DNO_HC128"
292 AM_CONDITIONAL([BUILD_HC128], [test "x$ENABLED_HC128" = "xyes"])
295 # PSK 
296 AC_ARG_ENABLE(psk,
297     [  --enable-psk            Enable PSK (default: disabled)],
298     [ ENABLED_PSK=$enableval ],
299     [ ENABLED_PSK=no ]
300     )
302 if test "$ENABLED_PSK" = "no"
303 then
304     CFLAGS="$CFLAGS -DNO_PSK"
308 # Web Server Build 
309 AC_ARG_ENABLE(webServer,
310     [  --enable-webServer      Enable Web Server (default: disabled)],
311     [ ENABLED_WEBSERVER=$enableval ],
312     [ ENABLED_WEBSERVER=no ]
313     )
315 if test "$ENABLED_WEBSERVER" = "yes"
316 then
317     CFLAGS="$CFLAGS -DHAVE_WEBSERVER"
321 # ECC 
322 AC_ARG_ENABLE(ecc,
323     [  --enable-ecc            Enable ECC (default: disabled)],
324     [ ENABLED_ECC=$enableval ],
325     [ ENABLED_ECC=no ]
326     )
328 if test "$ENABLED_ECC" = "yes"
329 then
330     CFLAGS="$CFLAGS -DHAVE_ECC"
333 AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
336 # NTRU
337 ntruHome=`pwd`/NTRU_algorithm
338 ntruInclude=$ntruHome/cryptolib
339 ntruLib=$ntruHome
340 AC_ARG_ENABLE(ntru,
341     [  --enable-ntru           Enable NTRU (default: disabled)],
342     [ ENABLED_NTRU=$enableval ],
343     [ ENABLED_NTRU=no ]
344     )
346 if test "$ENABLED_NTRU" = "yes"
347 then
348     CFLAGS="$CFLAGS -DHAVE_NTRU -I$ntruInclude"
349     LDFLAGS="$LDFLAGS -L$ntruLib"
350     LIBS="$LIBS -lntru_encrypt"
353 AM_CONDITIONAL([BUILD_NTRU], [test "x$ENABLED_NTRU" = "xyes"])
356 # LIBZ
357 trylibzdir=""
358 AC_ARG_WITH(libz,
359     [  --with-libz=PATH        PATH to libz install (default /usr/) ],
360     [
361       AC_MSG_CHECKING([for libz])
362       if test "x$withval" == "xno" ; then
363         AC_MSG_RESULT([no])
364       else
365         CPPFLAGS="$CPPFLAGS -DHAVE_LIBZ"
366         LIBS="$LIBS -lz"
368         AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
369             [ libz_linked=yes ], [ libz_linked=no ])
371         if test "x$libz_linked" == "xno" ; then
372             if test "x$withval" != "xno" ; then
373                 trylibzdir=$withval
374             fi
375             if test "x$withval" == "xyes" ; then
376                 trylibzdir="/usr"
377             fi
379             LDFLAGS="$LDFLAGS -L$trylibzdir/lib"
380             CPPFLAGS="$CPPFLAGS -I$trylibzdir/include"
382             AC_TRY_LINK([#include <zlib.h>], [ deflateInit(NULL, 8); ],
383                 [ libz_linked=yes ], [ libz_linked=no ])
385             if test "x$libz_linked" == "xno" ; then
386                 AC_MSG_ERROR([libz isn't found.
387                 If it's already installed, specify its path using --with-libz=/dir/])
388             fi
389             AC_MSG_RESULT([yes])
390         else
391             AC_MSG_RESULT([yes])
392         fi
394       fi
395     ]
399 # OPTIMIZE FLAGS
400 if test "$GCC" = "yes"
401 then
402     CFLAGS="$CFLAGS -Wall -Wno-unused"
403     if test "$ENABLED_DEBUG" = "no"
404     then
405         if test "$ENABLED_FASTMATH" = "yes"
406         then
407             CFLAGS="$CFLAGS $OPTIMIZE_FAST_CFLAGS"
408             if test "$ENABLED_FASTHUGEMATH" = "yes"
409             then
410                 CFLAGS="$CFLAGS $OPTIMIZE_HUGE_CFLAGS"
411             fi
412         else
413             CFLAGS="$CFLAGS $OPTIMIZE_CFLAGS"
414         fi
415     fi
421 ACX_PTHREAD
423 LIBS="$PTHREAD_LIBS $LIBM $LIBS"
424 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
426 LIB_SOCKET_NSL
428 AC_SUBST(CFLAGS)
429 AC_SUBST(LIBS)
433 # FINAL
434 AC_CONFIG_FILES(Makefile dnl
435         ctaocrypt/Makefile dnl
436         ctaocrypt/src/Makefile dnl
437         ctaocrypt/test/Makefile dnl
438         ctaocrypt/benchmark/Makefile dnl
439         src/Makefile dnl
440         examples/Makefile dnl
441         examples/client/Makefile dnl
442         examples/server/Makefile dnl
443         examples/echoclient/Makefile dnl
444         examples/echoserver/Makefile dnl
445         testsuite/Makefile dnl
446         sslSniffer/Makefile dnl
447         sslSniffer/sslSnifferTest/Makefile)
448 AC_OUTPUT