Removed HTTP server libary, it's available in SRT now
[silc.git] / configure.ad
1 #
2 #  configure.ad
3 #
4 #  Author: Pekka Riikonen <priikone@silcnet.org>
5 #
6 #  Copyright (C) 2000 - 2008 Pekka Riikonen
7 #
8 #  This program is free software; you can redistribute it and/or modify
9 #  it under the terms of the GNU General Public License as published by
10 #  the Free Software Foundation; version 2 of the License.
11 #
12 #  This program is distributed in the hope that it will be useful,
13 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #  GNU General Public License for more details.
16 #
17
18 AD_INIT
19 AC_CANONICAL_SYSTEM
20 AM_INIT_AUTOMAKE
21 AC_PREREQ(2.52)
22 AC_CONFIG_HEADERS(silcdefs.h)
23
24 AC_PROG_INSTALL
25 AC_PROG_MAKE_SET
26
27 AC_PROG_LN_S
28 AC_PROG_EGREP
29 AC_SUBST(LN_S)
30 AC_PATH_PROG(sedpath, sed)
31
32 AC_PROG_CC
33 AM_PROG_AS
34 AC_C_INLINE
35 AC_C_CONST
36
37 AC_PROG_RANLIB
38 #ifndef SILC_DIST_TOOLKIT
39 AC_DISABLE_SHARED
40 #endif SILC_DIST_TOOLKIT
41 #ifdef SILC_DIST_INPLACE
42 AC_DISABLE_SHARED
43 #endif SILC_DIST_INPLACE
44 AC_PROG_LIBTOOL
45
46 SILC_TOP_SRCDIR=`pwd`
47
48
49 ##
50 ## Library versioning.
51 ##
52
53 # Do the releases and library versioning according to following rules:
54 #
55 #  - If any code has changed in library, increment [LIB]_REVISION
56 #  - If functions were added, removed or changed, set [LIB]_REVISION to 0
57 #  - If functions were added, removed or changed, increment [LIB]_CURRENT
58 #  - If functions were added, increment [LIB]_AGE
59 #  - If functions were removed, set [LIB]_AGE to 0
60 #
61 # where [LIB] is LIBSILC, LIBSILCCLIENT or LIBSILCSERVER, and where
62 # "functions" means functions public interfaces (API).
63 #
64 # The LIB_BASE_VERSION defines the SILC software major.minor version and
65 # it is increment only when these version numbers actually change.
66 #
67
68 # Base version for libraries.  Do not change this unless SILC version
69 # changes too.
70 LIB_BASE_VERSION=1.2
71
72 # libsilc versions
73 LIBSILC_CURRENT=1               # prev = 0
74 LIBSILC_REVISION=0              # prev = 0
75 LIBSILC_AGE=0                   # prev = 0
76
77 # libsilcclient versions
78 LIBSILCCLIENT_CURRENT=1         # prev = 0
79 LIBSILCCLIENT_REVISION=0        # prev = 0
80 LIBSILCCLIENT_AGE=0             # prev = 0
81
82 # libsilcserver versions
83 LIBSILCSERVER_CURRENT=1         # prev = 0
84 LIBSILCSERVER_REVISION=0        # prev = 0
85 LIBSILCSERVER_AGE=0             # prev = 0
86
87 # Substitute the version numbers
88 AC_SUBST(LIB_BASE_VERSION)
89 AC_SUBST(LIBSILC_CURRENT)
90 AC_SUBST(LIBSILC_REVISION)
91 AC_SUBST(LIBSILC_AGE)
92 AC_SUBST(LIBSILCCLIENT_CURRENT)
93 AC_SUBST(LIBSILCCLIENT_REVISION)
94 AC_SUBST(LIBSILCCLIENT_AGE)
95 AC_SUBST(LIBSILCSERVER_CURRENT)
96 AC_SUBST(LIBSILCSERVER_REVISION)
97 AC_SUBST(LIBSILCSERVER_AGE)
98
99
100 ##
101 ##  Installation
102 ##
103
104 # Default installation destination
105 AC_PREFIX_DEFAULT(/usr/local)
106 if test "x$prefix" != xNONE; then
107   silc_prefix="$prefix"
108 else
109   silc_prefix="$ac_default_prefix"
110   prefix="$silc_prefix"
111 fi
112
113 #ifdef SILC_DIST_TOOLKIT
114 toolkitver=`echo $VERSION | sed 's/\./ /g'`
115 maj=0
116 min=0
117 bld=0
118 for v in $toolkitver
119 do
120   if test $maj -eq 0; then
121     maj=$v
122     continue
123   fi
124   if test $min -eq 0; then
125     min=$v
126     continue
127   fi
128   if test $bld -eq 0; then
129     bld=$v
130     continue
131   fi
132 done
133 __SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
134 #endif SILC_DIST_TOOLKIT
135
136
137 ##
138 ## Detect CPU
139 ##
140
141 # Disable all CPU feature optimizations
142 AC_MSG_CHECKING(whether to enable CPU feature optimizations)
143 AC_ARG_ENABLE(cpu-optimizations,
144   [  --disable-cpu-optimizations  do not use any CPU feature optimizations],
145   [
146     AC_MSG_RESULT(no)
147     AC_DEFINE([SILC_NO_CPU_OPTIMIZATIONS], [], [SILC_NO_CPU_OPTIMIZATIONS])
148     want_cpu_optimizations=false
149   ],
150   [
151     AC_MSG_RESULT(yes)
152     want_cpu_optimizations=true
153   ])
154 AM_CONDITIONAL(SILC_NO_CPU_OPTIMIZATIONS,
155                test x$want_cpu_optimizations = xfalse)
156
157 SILC_SYSTEM_IS_SMP(AC_DEFINE([SILC_SMP], [], [SILC_SMP]), [],
158                    AC_DEFINE([SILC_SMP], [], [SILC_SMP]))
159 cpu_i386=false
160 cpu_i486=false
161 cpu_i586=false
162 cpu_i686=false
163 cpu_i786=false
164 cpu_x86_64=false
165 cpu_ppc=false
166 cpu_ia64=false
167 case "$host_cpu" in
168   # All following Intels are considered 32-bit CPUs.
169   i?86)
170     # All CPUs of today are considered i386 and i486 compatible */
171     cpu_i386=true
172     cpu_i486=true
173
174     if test "x$host_cpu" = "xi586"; then
175       cpu_i586=true
176     fi
177
178     if test "x$host_cpu" = "xi686"; then
179       cpu_i586=true
180       cpu_i686=true
181     fi
182
183     if test "x$host_cpu" = "xi786"; then
184       cpu_i586=true
185       cpu_i686=true
186       cpu_i786=true
187     fi
188
189     # Check for specific CPU features
190     SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
191     SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
192     SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
193     SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
194     SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
195     ;;
196
197   # Intel IA-64, 64-bit CPU (not x86_64 compatible)
198   ia64)
199     AC_DEFINE([SILC_IA64], [], [SILC_IA64])
200     cpu_ia64=true
201     ;;
202
203   # AMD/Intel x86_64, 64-bit CPU
204   x86_64)
205     cpu_x86_64=true
206
207     # Check for specific CPU features
208     SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
209     SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
210     SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
211     SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
212     SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
213     ;;
214
215   # PowerPC, 32-bit and 64-bit CPUs
216   powerpc*)
217     cpu_ppc=true
218     ;;
219 esac
220 AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
221 AM_CONDITIONAL(SILC_I486, test x$cpu_i486 = xtrue)
222 AM_CONDITIONAL(SILC_I586, test x$cpu_i586 = xtrue)
223 AM_CONDITIONAL(SILC_I686, test x$cpu_i686 = xtrue)
224 AM_CONDITIONAL(SILC_7686, test x$cpu_i786 = xtrue)
225 AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
226 AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
227 AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
228
229 if test x$want_cpu_optimizations = xtrue; then
230   # Set some compiler options based on CPU
231   if test "x$CC" = "xicc"; then
232     # ICC flags
233     if test x$x_have_cpu_sse4 = xtrue; then
234       SILC_ADD_CFLAGS(-axS)
235     fi
236     if test x$x_have_cpu_ssse3 = xtrue; then
237       SILC_ADD_CFLAGS(-axT)
238     elif test x$x_have_cpu_pni = xtrue; then
239       SILC_ADD_CFLAGS(-axP)
240     elif test x$x_have_cpu_sse2 = xtrue; then
241       SILC_ADD_CFLAGS(-axW)
242     fi
243   else
244     # Other compilers
245     if test x$x_have_cpu_sse2 = xtrue; then
246       SILC_ADD_CFLAGS(-msse2)
247     fi
248     if test x$x_have_cpu_pni = xtrue; then
249       SILC_ADD_CFLAGS(-msse3)
250     fi
251     if test x$x_have_cpu_ssse3 = xtrue; then
252       SILC_ADD_CFLAGS(-mssse3)
253     fi
254     if test x$x_have_cpu_sse4 = xtrue; then
255       SILC_ADD_CFLAGS(-msse4)
256     fi
257   fi
258 fi
259
260
261 ##
262 ## Put here any platform specific stuff
263 ##
264
265 case "$target" in
266   *-*-linux*)
267     CFLAGS=`echo $CFLAGS -D_GNU_SOURCE`
268     ;;
269   *-*-freebsd*)
270     ;;
271   *-*-netbsd*)
272     ;;
273   *-*-*bsd*)
274     ;;
275   *)
276     ;;
277 esac
278
279
280 ##
281 ## Header checking
282 ##
283 AC_HEADER_STDC
284
285 # More header checking
286 #
287 AC_CHECK_HEADERS(unistd.h assert.h time.h fcntl.h stdarg.h)
288 AC_CHECK_HEADERS(sys/types.h sys/times.h sys/time.h)
289
290 # Check for big-endian machines
291 AC_C_BIGENDIAN
292
293
294 ##
295 ## Compiler and compiler flag checks
296 ##
297
298 # Disable all compiler optimizations
299 AC_MSG_CHECKING(whether to enable compiler optimizations)
300 AC_ARG_ENABLE(optimizations,
301   [  --disable-optimizations do not use any compiler optimizations],
302   [
303     AC_MSG_RESULT(no)
304     AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
305     want_cc_optimizations=false
306   ],
307   [
308     AC_MSG_RESULT(yes)
309     want_cc_optimizations=true
310   ])
311 AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
312
313 if test "$GCC"; then
314   # GCC specific options
315   if test "x$summary_debug" = "xyes"; then
316     SILC_ADD_CFLAGS(-g)
317   else
318     SILC_ADD_CFLAGS(-g)
319   fi
320   SILC_ADD_CFLAGS(-Wall -finline-functions)
321   SILC_ADD_CFLAGS(-Wno-pointer-sign)
322 else
323   # Other compilers
324   case "$target" in
325     alpha*-dec-osf*)
326       SILC_ADD_CFLAGS(-g3)
327       ;;
328     mips*-sgi-irix*)
329       SILC_ADD_CFLAGS(-g3)
330       ;;
331     *)
332       SILC_ADD_CFLAGS(-g)
333       ;;
334   esac
335
336   # Intel C++ Compiler flags
337   if test "x$CC" = "xicc"; then
338     SILC_ADD_CFLAGS(-restrict)
339     SILC_ADD_CFLAGS(-finline-functions)
340
341     # Don't define __GNUC__ except for system includes
342     SILC_ADD_CFLAGS(-gcc-sys)
343   fi
344 fi
345
346 if test x$want_cc_optimizations = xtrue; then
347   if test "$GCC"; then
348     # GCC specific options
349     if test "x$summary_debug" = "xyes"; then
350       SILC_ADD_CFLAGS(-O)
351     else
352       SILC_ADD_CFLAGS(-O2)
353     fi
354   else
355     # Other compilers
356     case "$target" in
357       alpha*-dec-osf*)
358         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
359         ;;
360       mips*-sgi-irix*)
361         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
362         ;;
363       *)
364         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
365         ;;
366     esac
367   fi
368 fi
369
370
371 ##
372 ## Function and libary checking
373 ##
374
375
376 ##
377 ##  Enable/disable checking
378 ##
379
380 #ifdef SILC_DIST_INPLACE
381 #
382 # Profiling options (never delivered to distributions)
383 #
384 AC_MSG_CHECKING(whether to enable gprof)
385 AC_ARG_ENABLE(gprof,
386   [  --enable-gprof          enable gprof profiling],
387   [
388     case "${enableval}" in
389       yes)
390         AC_MSG_RESULT(yes)
391         SILC_ADD_CFLAGS(-pg)
392         LIBS="$LIBS -pg"
393         ;;
394       *)
395         AC_MSG_RESULT(no)
396         ;;
397     esac
398   ],
399   [
400     AC_MSG_RESULT(no)
401   ])
402
403 AC_MSG_CHECKING(whether to enable gcov)
404 AC_ARG_ENABLE(gcov,
405   [  --enable-gcov           enable gcov],
406   [
407     case "${enableval}" in
408       yes)
409         AC_MSG_RESULT(yes)
410         SILC_ADD_CFLAGS(-fprofile-arcs)
411         LIBS="$LIBS -lgcov"
412         ;;
413       *)
414         AC_MSG_RESULT(no)
415         ;;
416     esac
417   ],
418   [
419     AC_MSG_RESULT(no)
420   ])
421 #endif SILC_DIST_INPLACE
422
423 # Debug checking
424 AC_MSG_CHECKING(whether to enable debugging)
425 summary_debug="no"
426 AC_ARG_ENABLE(debug,
427   [  --enable-debug          enable debugging],
428   [
429     case "${enableval}" in
430       yes)
431         AC_MSG_RESULT(yes)
432         summary_debug="yes"
433         ;;
434       *)
435         AC_MSG_RESULT(no)
436         ;;
437     esac
438   ],
439   [
440     AC_MSG_RESULT(no)
441   ])
442
443 # Disable all assembler optimizations
444 AC_MSG_CHECKING(whether to enable assembler optimizations)
445 want_asm=true
446 AC_ARG_ENABLE(asm,
447   [  --disable-asm           do not use assembler optimizations],
448   [
449     AC_MSG_RESULT(no)
450     AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
451     want_asm=false
452   ],
453   [
454     AC_MSG_RESULT(yes)
455     want_asm=true
456   ])
457 AM_CONDITIONAL(SILC_NO_ASM, test x$want_asm = xfalse)
458
459
460 ##
461 ##  With/without checkings
462 ##
463
464 compile_libs=true
465 LIBSUBDIR=lib
466 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
467
468 # SILC Runtime Toolkit checking
469 AC_ARG_WITH(srt-includes,
470   [  --with-srt-includes=DIR  SILC Runtime Toolkit includes [search in DIR]],
471   [ac_srt_includes="$withval"], [ac_srt_includes="no"])
472 AC_ARG_WITH(srt-libs,
473   [  --with-srt-libs=DIR      SILC Runtime Toolkit libraries [search in DIR]],
474   [ac_srt_libs="$withval"], [ac_srt_libs="no"])
475
476 if test -n "$with_srt_includes" || test -n "$with_srt_libs"; then
477   # Manually provided libs
478   if test "$ac_srt_includes" != "no"; then
479     SILC_LIB_INCLUDES="-I$ac_srt_includes"
480   fi
481   if test "$ac_srt_libs" != "no"; then
482     LDFLAGS="-L$ac_srt_libs $LDFLAGS"
483   fi
484
485   # Check libs to link against
486   f=`$EGREP __SILC_HAVE_PTHREAD $ac_srt_includes/silc.h`
487   if test -n "$f"; then
488     LIBS="$LIBS -lpthread"
489     has_threads=true
490   fi
491 else
492   # pkg-config check
493   PKG_CHECK_MODULES(SRT, [srt >= 1.2])
494   LIBS="$SRT_LIBS $LIBS"
495   CFLAGS="$CFLAGS $SRT_CFLAGS"
496 fi
497
498 # SILC Crypto Toolkit checking
499 AC_ARG_WITH(sct-includes,
500   [  --with-sct-includes=DIR  SILC Crypto Toolkit includes [search in DIR]],
501   [ac_sct_includes="$withval"], [ac_sct_includes="no"])
502 AC_ARG_WITH(sct-libs,
503   [  --with-sct-libs=DIR      SILC Crypto Toolkit libraries [search in DIR]],
504   [ac_sct_libs="$withval"], [ac_sct_libs="no"])
505
506 if test -n "$with_sct_includes" || test -n "$with_sct_libs"; then
507   # Manually provided libs
508   if test "$ac_sct_includes" != "no"; then
509     SILC_LIB_INCLUDES="-I$ac_sct_includes"
510   fi
511   if test "$ac_sct_libs" != "no"; then
512     LDFLAGS="-L$ac_sct_libs $LDFLAGS"
513   fi
514
515   # Check libs to link against
516   f=`$EGREP __SILC_HAVE_PTHREAD $ac_sct_includes/silc.h`
517   if test -n "$f"; then
518     LIBS="$LIBS -lpthread"
519     has_threads=true
520   fi
521 else
522   # pkg-config check
523   PKG_CHECK_MODULES(SCT, [sct >= 1.2])
524   LIBS="$SCT_LIBS $LIBS"
525   CFLAGS="$CFLAGS $SCT_CFLAGS"
526 fi
527
528 #ifndef SILC_DIST_TOOLKIT
529 # SILC Protocol Toolkit checking
530 AC_ARG_WITH(silc-includes,
531   [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
532   [ac_silc_includes="$withval"], [ac_silc_includes="no"])
533 AC_ARG_WITH(silc-libs,
534   [  --with-silc-libs=DIR     SILC Toolkit libraries [search in DIR]],
535   [ac_silc_libs="$withval"], [ac_silc_libs="no"])
536
537 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
538
539   # Manually provided libs
540   if test "$ac_silc_includes" != "no"; then
541     compile_libs=false
542     SILC_LIB_INCLUDES="-I$ac_silc_includes"
543     LIBSUBDIR=
544   fi
545   if test "$ac_silc_libs" != "no"; then
546     compile_libs=false
547     LIBSUBDIR=
548     LDFLAGS="-L$ac_silc_libs $LDFLAGS"
549   fi
550
551   # Check libs to link against
552   f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
553   if test -n "$f"; then
554     LIBS="$LIBS -lpthread"
555     check_threads=false
556     has_threads=true
557   fi
558   f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
559   if test -n "$f"; then
560     LIBS="$LIBS -ldl"
561   fi
562
563 else
564   # pkg-config check
565   PKG_CHECK_MODULES(SILC, [silc >= 1.2], compile_libs=false, compile_libs=true)
566 #ifdef SILC_DIST_CLIENTLIB
567   PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.2], compile_libs=false, compile_libs=true)
568 #endif SILC_DIST_CLIENTLIB
569 #ifdef SILC_DIST_SERVERLIB
570   PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
571 #endif SILC_DIST_SERVERLIB
572
573   if test x$compile_libs = xfalse; then
574     LIBSUBDIR=
575     LIBS="$SILC_LIBS $LIBS"
576     CFLAGS="$CFLAGS $SILC_CFLAGS"
577 #ifdef SILC_DIST_CLIENTLIB
578     LIBS="$SILCCLIENT_LIBS $LIBS"
579     CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
580 #endif SILC_DIST_CLIENTLIB
581 #ifdef SILC_DIST_SERVERLIB
582     LIBS="$LIBS $SILCSERVER_LIBS"
583     CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
584 #endif SILC_DIST_SERVERLIB
585   fi
586 fi
587 #endif SILC_DIST_TOOLKIT
588
589 if test x$compile_libs = xtrue; then
590 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silccore"
591 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcapputil"
592 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
593 #ifdef SILC_DIST_SFTP
594 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
595 #endif SILC_DIST_SFTP
596 #ifdef SILC_DIST_CLIENTLIB
597 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
598 #endif SILC_DIST_CLIENTLIB
599 #ifdef SILC_DIST_SERVERLIB
600 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcserver"
601 #endif SILC_DIST_SERVERLIB
602 #ifdef SILC_DIST_HTTP
603 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silchttp"
604 #endif SILC_DIST_HTTP
605 #ifdef SILC_DIST_VCARD
606 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcvcard"
607 #endif SILC_DIST_VCARD
608 fi
609
610 # SOCKS4 support checking
611 SAVE_LIBS="$LIBS"
612 SAVE_CFLAGS="$CFLAGS"
613 SAVE_LDFLAGS="$LDFLAGS"
614 AC_MSG_CHECKING(whether to support SOCKS4)
615 AC_ARG_WITH(socks4,
616   [[  --with-socks4[=DIR]     with SOCKS4 support [search in DIR/lib and DIR/include]]],
617   [
618     case "$withval" in
619       no)
620         AC_MSG_RESULT(no)
621         ;;
622       *)
623         AC_MSG_RESULT(yes)
624         socks=4
625
626         if test -d "$withval/include"; then
627           CFLAGS="$CFLAGS -I$withval/include"
628         fi
629         if test -d "$withval/lib"; then
630           LDFLAGS="$LDFLAGS -L$withval/lib"
631         fi
632
633         LIBS="-lsocks $LIBS"
634         ;;
635     esac
636
637     AC_TRY_LINK([],
638       [
639         Rconnect();
640       ], [],
641       [
642         AC_MSG_ERROR(Could not find SOCKS4 library.)
643         LIBS="$SAVE_LIBS"
644         CFLAGS="$SAVE_CFLAGS"
645         LDFLAGS="$SAVE_LDFLAGS"
646       ])
647   ],
648     AC_MSG_RESULT(no)
649   )
650
651 # SOCKS5 support checking
652 SAVE_LIBS="$LIBS"
653 SAVE_CFLAGS="$CFLAGS"
654 SAVE_LDFLAGS="$LDFLAGS"
655 AC_MSG_CHECKING(whether to support SOCKS5)
656 AC_ARG_WITH(socks5,
657   [[  --with-socks5[=DIR]     with SOCKS5 support [search in DIR/lib and DIR/include]]],
658   [
659     case "$withval" in
660       no)
661         AC_MSG_RESULT(no)
662         ;;
663       *)
664         AC_MSG_RESULT(yes)
665         socks=5
666
667         if test -d "$withval/include"; then
668           CFLAGS="$CFLAGS -I$withval/include"
669         fi
670         if test -d "$withval/lib"; then
671           LDFLAGS="$LDFLAGS -L$withval/lib"
672         fi
673
674         LIBS="-lsocks5 $LIBS"
675         ;;
676     esac
677
678     AC_TRY_LINK([],
679       [
680         SOCKSconnect();
681       ], [],
682       [
683         AC_MSG_ERROR(Could not find SOCKS5 library.)
684         LIBS="$SAVE_LIBS"
685         CFLAGS="$SAVE_CFLAGS"
686         LDFLAGS="$SAVE_LDFLAGS"
687       ])
688   ],
689     AC_MSG_RESULT(no)
690   )
691
692 if test "x$socks" = "x4"; then
693   AC_DEFINE([SOCKS], [], [Socks])
694   CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
695 fi
696
697 if test "x$socks" = "x5"; then
698   AC_DEFINE([SOCKS], [], [Socks])
699   AC_DEFINE([SOCKS5], [], [Socks5])
700   AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
701   AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
702   AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
703   AC_DEFINE([Rbind], [SOCKSbind], [Socks])
704   AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
705   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
706   AC_DEFINE([Rselect], [SOCKSselect], [Socks])
707   AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
708   AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
709   AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
710   AC_DEFINE([Rsend], [SOCKSsend], [Socks])
711   AC_DEFINE([Rread], [SOCKSread], [Socks])
712   AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
713   AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
714   AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
715   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
716   AC_DEFINE([Rclose], [SOCKSclose], [Socks])
717   AC_DEFINE([Rdup], [SOCKSdup], [Socks])
718   AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
719   AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
720   AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
721 fi
722
723
724 ##
725 ## Native WIN32 compilation under cygwin
726 ##
727 AC_MSG_CHECKING(whether to compile native WIN32 code)
728 AC_ARG_WITH(win32,
729   [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
730   [
731     AC_MSG_RESULT(yes)
732     AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
733     win32_support=true
734     CFLAGS="-mno-cygwin $CFLAGS"
735     LIBS="$LIBS -lwsock32"
736   ],
737   [
738     AC_MSG_RESULT(no)
739   ])
740 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
741
742
743 #ifdef SILC_DIST_SERVER
744 without_silcd=false
745 #endif SILC_DIST_SERVER
746 #ifdef SILC_DIST_CLIENT
747 AM_CONDITIONAL(with_irssi, true)
748 #endif SILC_DIST_CLIENT
749 #ifdef SILC_DIST_INPLACE
750 without_irssi=false
751 without_silcd=false
752 #endif SILC_DIST_INPLACE
753
754
755 ##
756 ## Include configure fragments
757 ##
758 AD_INCLUDE_CONFIGURE
759
760
761 ##
762 ## Outputs and substitutions
763 ##
764
765 AC_SUBST(LIBSUBDIR)
766 AC_SUBST(SILC_TOP_SRCDIR)
767 AC_SUBST(LDFLAGS)
768 AC_SUBST(LIBS)
769 AC_SUBST(SILC_LIB_INCLUDES)
770 AC_SUBST(__SILC_PACKAGE_VERSION)
771
772 AC_SUBST(ETCDIR)
773 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
774
775 #ifndef SILC_DIST_AUTODIST
776 ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
777 AC_SUBST(ETCDIR)
778 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
779
780 DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
781 AC_SUBST(DOCDIR)
782 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
783 #endif SILC_DIST_AUTODIST
784
785 # Native Symbian OS support (disabled by default)
786 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
787
788 # Make enable-shared aware
789 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
790
791 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
792 AC_SUBST(INCLUDE_DEFINES_INT)
793
794 DATE=`date`
795 AC_SUBST(DATE)
796
797
798 #
799 # Makefile outputs
800 #
801 AC_CONFIG_FILES(
802 Makefile
803 #ifdef SILC_DIST_DOC
804 doc/Makefile
805 #endif SILC_DIST_DOC
806 Makefile.defines
807 Makefile.defines_int
808 includes/Makefile
809 includes/silcversion.h
810 includes/silc.h
811 #ifdef SILC_DIST_APPS
812 apps/Makefile
813 #endif SILC_DIST_APPS
814 )
815
816 #ifdef SILC_DIST_TOOLKIT
817 AC_CONFIG_FILES(
818 win32/Makefile
819 win32/libsilc/Makefile
820 win32/libsilcclient/Makefile
821 tutorial/Makefile
822 tutorial/Makefile.defines
823 tutorial/Makefile.defines_int
824 )
825 #endif SILC_DIST_TOOLKIT
826
827 if test x$compile_libs = xtrue; then
828
829 AC_CONFIG_FILES(
830 lib/Makefile
831 lib/silccore/Makefile
832 lib/silcske/Makefile
833 lib/silcapputil/Makefile
834 #ifdef SILC_DIST_SFTP
835 lib/silcsftp/Makefile
836 lib/silcsftp/tests/Makefile
837 #endif SILC_DIST_SFTP
838 )
839
840 #ifdef SILC_DIST_TOOLKIT
841 AC_CONFIG_FILES(
842 lib/silc.pc
843 lib/silcclient.pc
844 lib/silcserver.pc
845 )
846 #endif SILC_DIST_TOOLKIT
847
848 #ifdef SILC_DIST_CLIENTLIB
849 AC_CONFIG_FILES(
850 lib/silcclient/Makefile
851 lib/silcclient/tests/Makefile
852 )
853 #endif SILC_DIST_CLIENTLIB
854
855 #ifdef SILC_DIST_SERVERLIB
856 AC_CONFIG_FILES(
857 lib/silcserver/Makefile
858 lib/silcserver/tests/Makefile
859 )
860 #endif SILC_DIST_SERVERLIB
861
862 #ifdef SILC_DIST_HTTP
863 AC_CONFIG_FILES(
864 lib/silchttp/Makefile
865 #ifdef SILC_DIST_INPLACE
866 lib/silchttp/tests/Makefile
867 #endif SILC_DIST_INPLACE
868 )
869 #endif SILC_DIST_HTTP
870
871 #ifdef SILC_DIST_VCARD
872 AC_CONFIG_FILES(
873 lib/silcvcard/Makefile
874 )
875 #endif SILC_DIST_VCARD
876
877 fi      # compile_libs
878
879 AC_OUTPUT
880
881 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
882 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
883 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
884 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
885
886 echo ""
887 echo "$PACKAGE Configuration Summary:"
888 echo "---------------------------"
889 echo " Target host ...................: $target"
890 echo " Compiler ......................: $CC"
891 echo " CFLAGS ........................: $CFLAGS"
892 echo " LDFLAGS .......................: $LDFLAGS"
893 echo " LIBS ..........................: $LIBS"
894 echo ""
895 echo " Installation prefix ...........: $prefix"
896 echo " bin directory .................: $s_bindir"
897 echo " sbin directory ................: $s_sbindir"
898 echo " etc directory .................: $ETCDIR"
899 echo " man directory .................: $s_mandir"
900 echo " doc directory .................: $DOCDIR"
901 #ifdef SILC_DIST_INCLUDES
902 echo " include directory .............: $s_includedir"
903 #endif SILC_DIST_INCLUDES
904 echo ""
905
906 #ifdef SILC_DIST_CLIENT
907 if test x$without_irssi = xtrue; then
908   irssi="no"
909 fi
910 echo " Compile SILC Client ...........: $irssi"
911 #endif SILC_DIST_CLIENT
912
913 #ifdef SILC_DIST_SERVER
914 if test x$without_silcd = xtrue; then
915   silcd="no"
916 fi
917 echo " Compile SILC Server ...........: $silcd"
918 #endif SILC_DIST_SERVER
919
920 echo " Debugging enabled .............: $summary_debug"
921 echo ""
922 echo "Compile the sources with 'make' or 'gmake' command."