configure: check threads support in OpenBSD.
[silc.git] / configure.ad
1 #
2 #  configure.ad
3 #
4 #  Author: Pekka Riikonen <priikone@silcnet.org>
5 #
6 #  Copyright (C) 2000 - 2007, 2009 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 #ifdef SILC_DIST_COMPILER
33 # Put here any platform specific stuff
34 #
35 case "$target" in
36   *-*-linux*)
37     check_threads=true
38     CFLAGS=`echo $CFLAGS -D_GNU_SOURCE`
39     ;;
40   *-*-freebsd*)
41     check_threads=true
42     ;;
43   *-*-netbsd*)
44     check_threads=true
45     ;;
46   *-*-openbsd*)
47     check_threads=true
48     ;;
49   *-*-*bsd*)
50     check_threads=false
51     ;;
52   *)
53     check_threads=true
54     ;;
55 esac
56
57 # Get CPU
58 cpu_i386=false
59 cpu_ix86=false
60 cpu_x86_64=false
61 cpu_ppc=false
62 cpu_ia64=false
63 case "$host_cpu" in
64   i386)
65     AC_DEFINE([SILC_I386], [], [SILC_I386])
66     AC_DEFINE([SILC_I486], [], [SILC_I486])
67     cpu_i386=true
68     cpu_ix86=true
69     ;;
70   i?86)
71     AC_DEFINE([SILC_I486], [], [SILC_I486])
72     cpu_ix86=true
73     ;;
74   x86_64)
75     AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
76     cpu_x86_64=true
77     ;;
78   powerpc*)
79     AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
80     cpu_ppc=true
81     ;;
82   ia64)
83     AC_DEFINE([SILC_IA64], [], [SILC_IA64])
84     cpu_ia64=true
85     ;;
86 esac
87 AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
88 AM_CONDITIONAL(SILC_I486, test x$cpu_ix86 = xtrue)
89 AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
90 AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
91 AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
92
93 # Control compiler optimizations
94 CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
95
96 AC_PROG_CC
97 AC_C_INLINE
98 AC_C_CONST
99
100 __SILC_HAVE_PTHREAD=""
101 __SILC_HAVE_SIM=""
102 __SILC_ENABLE_DEBUG=""
103
104 #ifdef SILC_DIST_TOOLKIT
105 toolkitver=`echo $VERSION | sed 's/\./ /g'`
106 maj=0
107 min=0
108 bld=0
109 for v in $toolkitver
110 do
111   if test $maj -eq 0; then
112     maj=$v
113     continue
114   fi
115   if test $min -eq 0; then
116     min=$v
117     continue
118   fi
119   if test $bld -eq 0; then
120     bld=$v
121     continue
122   fi
123 done
124 __SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
125 #endif SILC_DIST_TOOLKIT
126
127 AC_PROG_LIBTOOL
128 AC_PROG_RANLIB
129 #ifndef SILC_DIST_TOOLKIT
130 AC_DISABLE_SHARED
131 #endif SILC_DIST_TOOLKIT
132 #ifdef SILC_DIST_INPLACE
133 AC_DISABLE_SHARED
134 #endif SILC_DIST_INPLACE
135
136 # Header checking
137 #
138 AC_HEADER_STDC
139 AC_HEADER_TIME
140 AC_HEADER_STAT
141
142 # More header checking
143 #
144 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
145 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
146 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
147 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
148 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
149 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
150
151 # Data type checking
152 #
153 AC_TYPE_SIGNAL
154 AC_TYPE_SIZE_T
155 AC_TYPE_MODE_T
156 AC_TYPE_UID_T
157 AC_TYPE_PID_T
158
159 AC_CHECK_SIZEOF(long long, 0)
160 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
161 AC_CHECK_SIZEOF(long, 0)
162 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
163 AC_CHECK_SIZEOF(int, 0)
164 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
165 AC_CHECK_SIZEOF(short, 0)
166 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
167 AC_CHECK_SIZEOF(char, 0)
168 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
169 AC_CHECK_SIZEOF(void *, 0)
170 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
171 AC_CHECK_TYPES(long long)
172 AC_CHECK_TYPES(long double)
173
174 # Function to check if compiler flag works
175 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
176 AC_DEFUN([SILC_ADD_CFLAGS],
177 [ tmp_CFLAGS="$CFLAGS"
178   CFLAGS="$CFLAGS $1"
179   AC_MSG_CHECKING(whether $CC accepts $1 flag)
180   AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
181                                        CFLAGS="$tmp_CFLAGS"
182                                        $2])
183   unset tmp_CFLAGS
184 ])
185
186 # Function to check if compiler flag works, destination specifiable
187 # Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
188 AC_DEFUN([SILC_ADD_CC_FLAGS],
189 [ tmp_CFLAGS="$1_CFLAGS"
190   $1_CFLAGS="${$1_CFLAGS} $2"
191   AC_MSG_CHECKING(whether $CC accepts $2 flag)
192   AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
193                                        $1_CFLAGS="$tmp_CFLAGS"
194                                        $3])
195   unset tmp_CFLAGS
196 ])
197
198 # Function and library checking
199 #
200 AC_CHECK_FUNC(gethostbyname, [],
201   [
202     AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
203     AC_CHECK_FUNC(res_gethostbyname, [],
204        AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
205     )
206   ])
207 AC_CHECK_FUNC(socket, [],
208   AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
209 )
210 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
211 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
212 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
213 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror posix_memalign)
214 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
215 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep backtrace)
216 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
217
218 # lib/contrib conditionals
219 #
220 AC_CHECK_HEADER(regex.h,
221   [
222     AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
223     have_regex=1
224   ], have_regex=0
225 )
226 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
227
228 AC_CHECK_FUNC(getopt_long,
229   [
230     AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
231     have_getopt_long=1
232   ], have_getopt_long=0
233 )
234
235 AC_CHECK_FUNC(getopt,
236   [
237     AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
238     have_getopt=1
239   ], have_getopt=0
240 )
241
242 ##
243 ##  Enable/disable checking
244 ##
245
246 # IPv6 support
247 #
248 AC_MSG_CHECKING(whether to enable IPv6 support)
249 AC_ARG_ENABLE(ipv6,
250   [  --enable-ipv6           enable IPv6 support],
251   [
252     case "${enableval}" in
253       yes)
254         want_ipv6=true
255         check_ipv6=false
256         summary_ipv6="yes"
257         AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
258         AC_MSG_RESULT(yes)
259         ;;
260       *)
261         want_ipv6=false
262         check_ipv6=false
263         summary_ipv6="no"
264         AC_MSG_RESULT(no)
265         ;;
266     esac
267   ],
268     check_ipv6=true
269   )
270
271 if test x$check_ipv6 = xtrue; then
272   summary_ipv6="no"
273   AC_TRY_COMPILE(
274     [
275       #ifdef HAVE_SYS_TYPES_H
276       #include <sys/types.h>
277       #endif
278       #ifdef HAVE_NETINET_TCP_H
279       #include <netinet/tcp.h>
280       #endif
281       #ifdef HAVE_NETDB_H
282       #include <netdb.h>
283       #endif
284       #include <sys/socket.h>
285       #ifdef HAVE_NETINET_IN_H
286       #include <netinet/in.h>
287       #endif
288     ],
289     [
290       struct sockaddr_in6 sin6;
291       int family = AF_INET6;
292     ],
293     [
294       AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
295       AC_MSG_RESULT(yes)
296       summary_ipv6="yes"
297     ],
298       AC_MSG_RESULT(no)
299     )
300 fi
301
302 # Debug checking
303 #
304 AC_MSG_CHECKING(whether to enable debugging)
305 summary_debug="no"
306 __SILC_ENABLE_DEBUG=""
307 AC_ARG_ENABLE(debug,
308   [  --enable-debug          enable debugging],
309   [
310     case "${enableval}" in
311       yes)
312         AC_MSG_RESULT(yes)
313         AC_DEFINE([SILC_DEBUG], [], [enable-debug])
314         summary_debug="yes"
315         __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
316         ;;
317       *)
318         AC_MSG_RESULT(no)
319         ;;
320     esac
321   ],
322   [
323     AC_MSG_RESULT(no)
324   ])
325
326 # Disable all compiler optimizations
327 #
328 AC_MSG_CHECKING(whether to enable compiler optimizations)
329 want_cc_optimizations=true
330 AC_ARG_ENABLE(optimizations,
331   [  --disable-optimizations do not use any compiler optimizations],
332   [
333     AC_MSG_RESULT(no)
334     AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
335     want_cc_optimizations=false
336   ],
337   [
338     AC_MSG_RESULT(yes)
339     want_cc_optimizations=true
340   ])
341 AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
342
343 # Disable all assembler optimizations
344 #
345 AC_MSG_CHECKING(whether to enable assembler optimizations)
346 want_asm=true
347 AC_ARG_ENABLE(asm,
348   [  --disable-asm           do not use assembler optimizations],
349   [
350     AC_MSG_RESULT(no)
351     AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
352     want_asm=false
353   ],
354   [
355     AC_MSG_RESULT(yes)
356     want_asm=true
357   ])
358 AM_CONDITIONAL(SILC_NO_ASM, test x$want_asm = xfalse)
359
360 # Check for assembler
361 #
362 SILC_ASSEMBLER=""
363 have_assembler=false
364 if test x$want_asm = xtrue; then
365   AC_PATH_PROG([NASM], [nasm], [no])
366   if test "x$NASM" != "xno"; then
367     if test x$cpu_x86_64 = xtrue; then
368       SILC_ASSEMBLER="$NASM -O2 -felf64"
369     else
370       SILC_ASSEMBLER="$NASM -O2 -felf"
371     fi
372     have_assembler=true
373   fi
374
375   AC_PATH_PROG([YASM], [yasm], [no])
376   if test "x$YASM" != "xno"; then
377     if test x$cpu_x86_64 = xtrue; then
378       SILC_ASSEMBLER="$YASM -Xgnu -felf64"
379     else
380       SILC_ASSEMBLER="$YASM -Xgnu -felf"
381     fi
382     have_assembler=true
383   fi
384 fi
385 AC_SUBST(SILC_ASSEMBLER)
386
387 ##
388 ## va_copy checks
389 ##
390 va_copy=false
391 AC_MSG_CHECKING(for va_copy)
392 AC_TRY_COMPILE(
393   [
394     #include <stdarg.h>
395     #include <stdlib.h>
396   ],
397   [
398     int t(int x, ...)
399     {
400       va_list va, cp;
401       va_start(va, x);
402       va_copy(cp, va);
403       if (va_arg(cp, int) != 0xff11)
404         return 1;
405       va_end(va);
406       va_end(cp);
407       return 0;
408     }
409     int main()
410     {
411       return t(0, 0xff11);
412     }
413   ],
414   [
415     AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
416     AC_MSG_RESULT(yes)
417     va_copy=true
418   ],
419   [
420     AC_MSG_RESULT(no)
421     va_copy=false
422   ]
423 )
424
425 if test x$va_copy = xfalse; then
426   AC_MSG_CHECKING(for __va_copy)
427   AC_TRY_COMPILE(
428   [
429     #include <stdarg.h>
430     #include <stdlib.h>
431   ],
432   [
433     int t(int x, ...)
434     {
435       va_list va, cp;
436       va_start(va, x);
437       __va_copy(cp, va);
438       if (va_arg(cp, int) != 0xff11)
439         return 1;
440       va_end(va);
441       va_end(cp);
442       return 0;
443     }
444     int main()
445     {
446       return t(0, 0xff11);
447     }
448   ],
449   [
450     AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
451     AC_MSG_RESULT(yes)
452     va_copy=true
453   ],
454   [
455     AC_MSG_RESULT(no)
456     va_copy=false
457   ]
458   )
459 fi
460
461 if test x$va_copy = xfalse; then
462   AC_RUN_IFELSE(
463     [
464       #include <stdarg.h>
465       #include <stdlib.h>
466       int t(int x, ...)
467       {
468         va_list va, cp;
469         va_start(va, x);
470         cp = va;
471         if (va_arg(cp, int) != 0xff11)
472           return 1;
473         va_end(va);
474         va_end(cp);
475         return 0;
476       }
477       int main()
478       {
479         return t(0, 0xff11);
480       }
481     ],
482     [va_copy=false],
483     [
484       AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
485     ],
486     [va=copy=false]
487   )
488 fi
489
490 ##
491 ## Compiler and compiler flag checks
492 ##
493
494 if test "$GCC"; then
495   # GCC specific options
496   if test "x$summary_debug" = "xyes"; then
497     SILC_ADD_CFLAGS(-g)
498   else
499     SILC_ADD_CFLAGS(-g)
500   fi
501   SILC_ADD_CFLAGS(-Wall -finline-functions)
502   SILC_ADD_CFLAGS(-Wno-pointer-sign)
503 else
504   # Other compilers
505   case "$target" in
506     alpha*-dec-osf*)
507       SILC_ADD_CFLAGS(-g3)
508       ;;
509     mips*-sgi-irix*)
510       SILC_ADD_CFLAGS(-g3)
511       ;;
512     *)
513       SILC_ADD_CFLAGS(-g)
514       ;;
515   esac
516
517   # Intel C++ Compiler needs -restrict
518   if test "x$CC" = "xicc"; then
519     SILC_ADD_CFLAGS(-restrict)
520   fi
521 fi
522
523 if test x$want_cc_optimizations = xtrue; then
524   if test "$GCC"; then
525     # GCC specific options
526     if test "x$summary_debug" = "xyes"; then
527       SILC_ADD_CFLAGS(-O)
528     else
529       SILC_ADD_CFLAGS(-O2)
530     fi
531   else
532     # Other compilers
533     case "$target" in
534       alpha*-dec-osf*)
535         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
536         ;;
537       mips*-sgi-irix*)
538         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
539         ;;
540       *)
541         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
542         ;;
543     esac
544   fi
545 fi
546
547 #
548 # Workaround a bug in GCC 2.x which causes memory exhaustion
549 # when compiling sha1 with optimizations on UltraSPARC.
550 #
551 FIX_SHA1='#'
552 if test "$GCC" -a "$host_cpu" = "sparc64"; then
553   AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
554   AC_TRY_COMPILE(
555     [
556       #if defined(__sparc64__) && (__GNUC__ == 2)
557       #else
558       choke me
559       #endif
560     ],
561     [],
562     [
563       FIX_SHA1=''
564       AC_MSG_RESULT(yes)
565     ],
566       AC_MSG_RESULT(no)
567     )
568 fi
569 AC_SUBST(FIX_SHA1)
570 #endif SILC_DIST_COMPILER
571
572 ##
573 ##  Installation
574 ##
575
576 # Default installation destination
577 #
578 AC_PREFIX_DEFAULT(/usr/local)
579 if test "x$prefix" != xNONE; then
580   silc_prefix="$prefix"
581 else
582   silc_prefix="$ac_default_prefix"
583   prefix="$silc_prefix"
584 fi
585
586 #ifndef SILC_DIST_AUTODIST
587 ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
588 AC_SUBST(ETCDIR)
589 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
590
591 DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
592 AC_SUBST(DOCDIR)
593 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
594 #endif SILC_DIST_AUTODIST
595
596 #ifdef SILC_DIST_COMPILER
597 ##
598 ##  With/without checkings
599 ##
600
601 #
602 # SILC library checking
603 compile_libs=true
604 LIBSUBDIR=lib
605
606 #ifndef SILC_DIST_TOOLKIT
607 AC_ARG_WITH(silc-includes,
608   [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
609   [ac_silc_includes="$withval"], [ac_silc_includes="no"])
610 AC_ARG_WITH(silc-libs,
611   [  --with-silc-libs=DIR     SILC Toolkit libraries [search in DIR]],
612   [ac_silc_libs="$withval"], [ac_silc_libs="no"])
613
614 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
615
616   # Manually provided libs
617   if test "$ac_silc_includes" != "no"; then
618     compile_libs=false
619     SILC_LIB_INCLUDES="-I$ac_silc_includes"
620     LIBSUBDIR=
621   fi
622   if test "$ac_silc_libs" != "no"; then
623     compile_libs=false
624     LIBSUBDIR=
625     LDFLAGS="-L$ac_silc_libs $LDFLAGS"
626   else
627     LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
628   fi
629
630   # Check libs to link against
631   f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
632   if test -n "$f"; then
633     LIBS="$LIBS -lpthread"
634     check_threads=false
635     has_threads=true
636   fi
637   f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
638   if test -n "$f"; then
639     LIBS="$LIBS -ldl"
640   fi
641
642 else
643   # pkg-config check
644   PKG_CHECK_MODULES(SILC, [silc >= 1.1], compile_libs=false, compile_libs=true)
645 #ifdef SILC_DIST_CLIENTLIB
646   PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.1.1], compile_libs=false, compile_libs=true)
647 #endif SILC_DIST_CLIENTLIB
648 #ifdef SILC_DIST_SERVERLIB
649   PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
650 #endif SILC_DIST_SERVERLIB
651
652   if test x$compile_libs = xfalse; then
653     LIBSUBDIR=
654     LIBS="$SILC_LIBS $LIBS"
655     CFLAGS="$CFLAGS $SILC_CFLAGS"
656 #ifdef SILC_DIST_CLIENTLIB
657     LIBS="$SILCCLIENT_LIBS $LIBS"
658     CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
659 #endif SILC_DIST_CLIENTLIB
660 #ifdef SILC_DIST_SERVERLIB
661     LIBS="$LIBS $SILCSERVER_LIBS"
662     CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
663 #endif SILC_DIST_SERVERLIB
664   else
665     LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
666   fi
667 fi
668 #else SILC_DIST_TOOLKIT
669 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
670 #endif SILC_DIST_TOOLKIT
671
672 #ifdef SILC_DIST_SIM
673 # SIM support checking
674 # XXX These needs to be changed as more supported platforms appear.
675 # XXX This probably needs to be made platform dependant check.
676 #
677 sim_support=false
678 AC_MSG_CHECKING(for SIM support)
679 AC_MSG_RESULT()
680 AC_CHECK_HEADERS(dlfcn.h,
681   [
682     AC_CHECK_LIB(dl, dlopen,
683       [
684         AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
685         sim_support=true
686         LIBS="$LIBS -ldl"
687       ],
688       [
689         AC_CHECK_LIB(c, dlopen,
690           [
691             AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
692             sim_support=true
693           ])
694       ])
695    ])
696
697 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
698 if test x$sim_support = xtrue; then
699   AC_MSG_RESULT(Enabled SIM support.)
700   __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
701 else
702   AC_MSG_RESULT(No SIM support found.)
703 fi
704 #endif SILC_DIST_SIM
705
706 # SOCKS4 support checking
707 #
708 SAVE_LIBS="$LIBS"
709 SAVE_CFLAGS="$CFLAGS"
710 SAVE_LDFLAGS="$LDFLAGS"
711 AC_MSG_CHECKING(whether to support SOCKS4)
712 AC_ARG_WITH(socks4,
713   [[  --with-socks4[=DIR]     with SOCKS4 support [search in DIR/lib and DIR/include]]],
714   [
715     case "$withval" in
716       no)
717         AC_MSG_RESULT(no)
718         ;;
719       *)
720         AC_MSG_RESULT(yes)
721         socks=4
722
723         if test -d "$withval/include"; then
724           CFLAGS="$CFLAGS -I$withval/include"
725         fi
726         if test -d "$withval/lib"; then
727           LDFLAGS="$LDFLAGS -L$withval/lib"
728         fi
729
730         LIBS="-lsocks $LIBS"
731         ;;
732     esac
733
734     AC_TRY_LINK([],
735       [
736         Rconnect();
737       ], [],
738       [
739         AC_MSG_ERROR(Could not find SOCKS4 library.)
740         LIBS="$SAVE_LIBS"
741         CFLAGS="$SAVE_CFLAGS"
742         LDFLAGS="$SAVE_LDFLAGS"
743       ])
744   ],
745     AC_MSG_RESULT(no)
746   )
747
748 # SOCKS5 support checking
749 #
750 SAVE_LIBS="$LIBS"
751 SAVE_CFLAGS="$CFLAGS"
752 SAVE_LDFLAGS="$LDFLAGS"
753 AC_MSG_CHECKING(whether to support SOCKS5)
754 AC_ARG_WITH(socks5,
755   [[  --with-socks5[=DIR]     with SOCKS5 support [search in DIR/lib and DIR/include]]],
756   [
757     case "$withval" in
758       no)
759         AC_MSG_RESULT(no)
760         ;;
761       *)
762         AC_MSG_RESULT(yes)
763         socks=5
764
765         if test -d "$withval/include"; then
766           CFLAGS="$CFLAGS -I$withval/include"
767         fi
768         if test -d "$withval/lib"; then
769           LDFLAGS="$LDFLAGS -L$withval/lib"
770         fi
771
772         LIBS="-lsocks5 $LIBS"
773         ;;
774     esac
775
776     AC_TRY_LINK([],
777       [
778         SOCKSconnect();
779       ], [],
780       [
781         AC_MSG_ERROR(Could not find SOCKS5 library.)
782         LIBS="$SAVE_LIBS"
783         CFLAGS="$SAVE_CFLAGS"
784         LDFLAGS="$SAVE_LDFLAGS"
785       ])
786   ],
787     AC_MSG_RESULT(no)
788   )
789
790 if test "x$socks" = "x4"; then
791   AC_DEFINE([SOCKS], [], [Socks])
792   CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
793 fi
794
795 if test "x$socks" = "x5"; then
796   AC_DEFINE([SOCKS], [], [Socks])
797   AC_DEFINE([SOCKS5], [], [Socks5])
798   AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
799   AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
800   AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
801   AC_DEFINE([Rbind], [SOCKSbind], [Socks])
802   AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
803   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
804   AC_DEFINE([Rselect], [SOCKSselect], [Socks])
805   AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
806   AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
807   AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
808   AC_DEFINE([Rsend], [SOCKSsend], [Socks])
809   AC_DEFINE([Rread], [SOCKSread], [Socks])
810   AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
811   AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
812   AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
813   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
814   AC_DEFINE([Rclose], [SOCKSclose], [Socks])
815   AC_DEFINE([Rdup], [SOCKSdup], [Socks])
816   AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
817   AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
818   AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
819 fi
820
821 #ifdef SILC_DIST_MATH
822 # MP library checking. First check whether user wants to use GMP and use
823 # it if found. If not or not defined then compile the default library in the
824 # source tree.
825 #
826 mp_gmp=false
827 SAVE_LIBS="$LIBS"
828 SAVE_CFLAGS="$CFLAGS"
829 SAVE_LDFLAGS="$LDFLAGS"
830 AC_MSG_CHECKING(whether to search for GMP)
831 AC_ARG_WITH(gmp,
832   [[  --with-gmp[=DIR]        use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
833   [
834     case "$withval" in
835       no)
836         AC_MSG_RESULT(no)
837         ;;
838       *)
839         AC_MSG_RESULT(yes)
840
841         if test -d "$withval/include"; then
842           CFLAGS="$CFLAGS -I$withval/include"
843         fi
844         if test -d "$withval/lib"; then
845           LDFLAGS="$LDFLAGS -L$withval/lib"
846         fi
847
848         LIBS="-lgmp $LIBS"
849         ;;
850     esac
851
852     AC_CHECK_LIB(gmp, __gmpz_init,
853       [
854         mp_gmp=true
855         AC_DEFINE([SILC_MP_GMP], [], [GMP])
856         AC_MSG_RESULT(Using GMP as a MP library.)
857       ],
858       [
859         LIBS="$SAVE_LIBS"
860         CFLAGS="$SAVE_CFLAGS"
861         LDFLAGS="$SAVE_LDFLAGS"
862       ])
863   ],
864     AC_MSG_RESULT(no)
865   )
866
867 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
868 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
869 if test x$mp_gmp = xfalse; then
870   AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
871   AC_MSG_RESULT(Using SILC Math as a MP library.)
872 fi
873 #endif SILC_DIST_MATH
874
875 # iconv support
876 #
877 check_iconv=true
878 has_iconv=false
879 SAVE_LIBS="$LIBS"
880 SAVE_CFLAGS="$CFLAGS"
881 SAVE_LDFLAGS="$LDFLAGS"
882 SAVE_CPPFLAGS="$CPPFLAGS"
883 AC_MSG_CHECKING(whether to implicit search for libiconv)
884 AC_ARG_WITH(iconv,
885   [[  --with-iconv[=DIR]      use libiconv [search in DIR/include and DIR/lib]]],
886   [
887     case "${withval}" in
888       no)
889         AC_MSG_RESULT(no)
890         AC_CHECK_HEADERS(iconv.h,
891           [
892             AC_CHECK_FUNC(iconv, has_iconv=true)
893           ])
894         check_iconv=false
895         ;;
896       *)
897         AC_MSG_RESULT(yes)
898         if test -d $withval/include; then
899           CPPFLAGS="$CPPFLAGS -I$withval/include"
900           CFLAGS="$CFLAGS -I$withval/include"
901         fi
902         if test -d $withval/lib; then
903           LDFLAGS="$LDFLAGS -L$withval/lib"
904         fi
905         ;;
906     esac
907   ],
908   [
909     AC_MSG_RESULT(no)
910     AC_CHECK_HEADERS(iconv.h,
911       [
912         AC_CHECK_FUNCS(iconv,
913           [
914             has_iconv=true
915             check_iconv=false
916           ])
917       ])
918   ])
919
920 if test x$check_iconv = xtrue; then
921   AC_MSG_RESULT(Searching for iconv...)
922
923   # XXX
924   unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
925
926   AC_CHECK_HEADERS(iconv.h,
927     [
928       LIBS="$LIBS -liconv"
929       AC_MSG_CHECKING(for iconv in -liconv)
930       AC_TRY_LINK(
931         [
932           #include <stdlib.h>
933           #include <iconv.h>
934         ],
935         [
936           iconv_t cd = iconv_open("", "");
937           iconv(cd, NULL, NULL, NULL, NULL);
938           iconv_close(cd);
939         ],
940         [
941           echo "yes"
942           AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
943           has_iconv=true
944           check_iconv=false
945         ],
946         [
947           echo "no"
948           LIBS="$SAVE_LIBS"
949           CFLAGS="$SAVE_CFLAGS"
950           LDFLAGS="$SAVE_LDFLAGS"
951           CPPFLAGS="$SAVE_CPPFLAGS"
952         ])
953      ])
954 fi
955
956 if test x$check_iconv = xtrue; then
957   # search for iconv library..
958   SAVE_LIBS="$LIBS"
959   SAVE_CFLAGS="$CFLAGS"
960   SAVE_LDFLAGS="$LDFLAGS"
961   SAVE_CPPFLAGS="$CPPFLAGS"
962
963   for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
964     if test x$has_iconv = xfalse; then
965       AC_MSG_RESULT(searching in $dir...)
966
967       if test -d $dir/include; then
968         CPPFLAGS="$CPPFLAGS -I$dir/include"
969         CFLAGS="$CFLAGS -I$dir/include"
970       fi
971       if test -d $dir/lib; then
972         LDFLAGS="$LDFLAGS -L$dir/lib"
973       fi
974
975       # XXX
976       unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
977
978       AC_CHECK_HEADERS(iconv.h,
979         [
980           LIBS="$LIBS -liconv"
981           AC_MSG_CHECKING(for iconv in -liconv)
982           AC_TRY_LINK(
983             [
984               #include <stdlib.h>
985               #include <iconv.h>
986             ],
987             [
988               iconv_t cd = iconv_open("", "");
989               iconv(cd, NULL, NULL, NULL, NULL);
990               iconv_close(cd);
991             ],
992             [
993               echo "yes"
994               has_iconv=true
995               AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
996             ],
997             [
998               echo "no"
999               has_iconv=false
1000
1001               LIBS="$SAVE_LIBS"
1002               CFLAGS="$SAVE_CFLAGS"
1003               LDFLAGS="$SAVE_LDFLAGS"
1004               CPPFLAGS="$SAVE_CPPFLAGS"
1005             ])
1006          ],
1007          [
1008            CFLAGS="$SAVE_CFLAGS"
1009            LDFLAGS="$SAVE_LDFLAGS"
1010            CPPFLAGS="$SAVE_CPPFLAGS"
1011          ])
1012       fi
1013     done
1014 fi
1015
1016 if test x$has_iconv = xtrue; then
1017   # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
1018   # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
1019   #     obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
1020   #
1021   AC_CACHE_CHECK([whether this iconv is good enough], ac_cv_iconv_good,
1022     AC_TRY_RUN(
1023       [
1024         #include <iconv.h>
1025         int main() {
1026           iconv_t cd;
1027         changequote(, )dnl
1028           char buf[4];
1029         changequote([, ])dnl
1030           char *ob;
1031           size_t obl;
1032           ob = buf, obl = sizeof(buf);
1033           return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
1034                  (iconv(cd, 0, 0, &ob, &obl) ||
1035                  !(ob == buf && obl == sizeof(buf)) ||
1036                  iconv_close(cd)));
1037         }
1038       ],
1039       [
1040         ac_cv_iconv_good=yes
1041       ],
1042       [
1043         ac_cv_iconv_good=no
1044       ],
1045       [
1046         ac_cv_iconv_good=yes
1047       ])
1048     )
1049
1050   if test x$ac_cv_iconv_good = xno; then
1051     AC_MSG_RESULT(Try using libiconv instead.)
1052   fi
1053 fi
1054
1055 # POSIX threads support
1056 #
1057 AC_MSG_CHECKING(whether to search for POSIX threads)
1058 AC_ARG_WITH(pthreads,
1059   [[  --with-pthreads[=DIR]   use POSIX threads [search in DIR/include and DIR/lib]]],
1060   [
1061     case "${withval}" in
1062       no)
1063         check_threads=false
1064         ;;
1065       *)
1066         if test -d $withval/include; then
1067           CPPFLAGS="$CPPFLAGS -I$withval/include"
1068           CFLAGS="$CFLAGS -I$withval/include"
1069         fi
1070         if test -d $withval/lib; then
1071           LDFLAGS="$LDFLAGS -L$withval/lib"
1072         fi
1073
1074         check_threads=true
1075         ;;
1076     esac
1077   ])
1078
1079 if test x$check_threads = xtrue; then
1080   has_threads=false
1081   SAVE_LIBS="$LIBS"
1082   SAVE_CFLAGS="$CFLAGS"
1083   SAVE_LDFLAGS="$LDFLAGS"
1084   SAVE_CPPFLAGS="$CPPFLAGS"
1085
1086   AC_MSG_RESULT(yes)
1087   AC_CHECK_HEADERS(pthread.h,
1088     [
1089       LIBS="$LIBS -lpthread"
1090       AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1091         [
1092           # FreeBSD
1093           case "${target}" in
1094             *-*-freebsd*)
1095               LIBS="$SAVE_LIBS -pthread"
1096               AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1097               ;;
1098             *)
1099               LIBS="$SAVE_LIBS"
1100               ;;
1101           esac
1102         ])
1103     ],
1104     [
1105       # search for pthread library..
1106       for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1107         if test x$has_threads = xfalse; then
1108           AC_MSG_RESULT(searching in $dir...)
1109
1110           if test -d $dir/include; then
1111             CPPFLAGS="$CPPFLAGS -I$dir/include"
1112             CFLAGS="$CFLAGS -I$dir/include"
1113           fi
1114           if test -d $dir/lib; then
1115             LDFLAGS="$LDFLAGS -L$dir/lib"
1116           fi
1117
1118           # XXX
1119           unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1120
1121           AC_CHECK_HEADERS(pthread.h,
1122             [
1123               LIBS="$LIBS -lpthread"
1124               AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1125                 [
1126                   has_threads=false
1127
1128                   LIBS="$SAVE_LIBS"
1129                   CFLAGS="$SAVE_CFLAGS"
1130                   LDFLAGS="$SAVE_LDFLAGS"
1131                   CPPFLAGS="$SAVE_CPPFLAGS"
1132                 ])
1133             ],
1134             [
1135               CFLAGS="$SAVE_CFLAGS"
1136               LDFLAGS="$SAVE_LDFLAGS"
1137               CPPFLAGS="$SAVE_CPPFLAGS"
1138             ])
1139         fi
1140       done
1141     ])
1142 else
1143   AC_MSG_RESULT(no)
1144   has_threads=false
1145 fi
1146
1147 __SILC_HAVE_PTHREAD=""
1148 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1149 if test x$has_threads = xtrue; then
1150   CFLAGS="$CFLAGS -D_REENTRANT"
1151
1152   # XXX possibly incomplete
1153   case "${target}" in
1154     *-*-aix*)
1155       CFLAGS="$CFLAGS -D_THREAD_SAFE"
1156       if test x"$GCC" = xyes; then
1157         CFLAGS="$CFLAGS -mthreads"
1158       fi
1159       ;;
1160     *-*-freebsd*)
1161       CFLAGS="$CFLAGS -D_THREAD_SAFE"
1162       ;;
1163     *-*-sysv5uw7*)  # UnixWare 7
1164       if test "$GCC" != "yes"; then
1165         CFLAGS="$CFLAGS -Kthread"
1166       else
1167         CFLAGS="$CFLAGS -pthread"
1168       fi
1169       ;;
1170     *-dg-dgux*)  # DG/UX
1171       CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1172       ;;
1173    esac
1174
1175   # Check for threads
1176   AC_CHECK_FUNC(pthread_create)
1177
1178   # Check for read/write locks
1179   AC_CHECK_FUNC(pthread_rwlock_init,
1180   [
1181     AC_RUN_IFELSE(
1182       [
1183         #include <pthread.h>
1184         int main()
1185         {
1186           pthread_rwlock_t rwlock;
1187           pthread_rwlock_init(&rwlock, NULL);
1188           pthread_rwlock_destroy(&rwlock);
1189           return 0;
1190         }
1191       ],
1192       [],
1193       [
1194         # Rwlock not defined
1195         CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1196       ]
1197     )
1198   ],
1199   [
1200     # Rwlock not defined
1201     CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1202   ])
1203
1204   AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1205   AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1206   __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1207 fi
1208
1209 #
1210 # Check for timezone and tm_gmtoff for timezone information
1211 #
1212 AC_MSG_CHECKING(whether system has timezone)
1213 AC_RUN_IFELSE(
1214   [
1215     #include <stdio.h>
1216     #include <time.h>
1217     int main()
1218     {
1219       timezone = 0;
1220       return 0;
1221     }
1222   ],
1223   [ AC_MSG_RESULT(yes)
1224     AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
1225   [ AC_MSG_RESULT(no) ],
1226   [ AC_MSG_RESULT(no) ]
1227 )
1228 AC_MSG_CHECKING(whether system has tm_gmtoff)
1229 AC_RUN_IFELSE(
1230   [
1231     #include <stdio.h>
1232     #include <time.h>
1233     int main()
1234     {
1235       struct tm tm;
1236       tm.tm_gmtoff = 0;
1237       return 0;
1238     }
1239   ],
1240   [ AC_MSG_RESULT(yes)
1241     AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
1242   [ AC_MSG_RESULT(no) ],
1243   [ AC_MSG_RESULT(no) ]
1244 )
1245 AC_MSG_CHECKING(whether system has __tm_gmtoff)
1246 AC_RUN_IFELSE(
1247   [
1248     #include <stdio.h>
1249     #include <time.h>
1250     int main()
1251     {
1252       struct tm tm;
1253       tm.__tm_gmtoff = 0;
1254       return 0;
1255     }
1256   ],
1257   [ AC_MSG_RESULT(yes)
1258     AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
1259   [ AC_MSG_RESULT(no) ],
1260   [ AC_MSG_RESULT(no) ]
1261 )
1262 AC_MSG_CHECKING(whether system has __tm_gmtoff__)
1263 AC_RUN_IFELSE(
1264   [
1265     #include <stdio.h>
1266     #include <time.h>
1267     int main()
1268     {
1269       struct tm tm;
1270       tm.__tm_gmtoff__ = 0;
1271       return 0;
1272     }
1273   ],
1274   [ AC_MSG_RESULT(yes)
1275     AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
1276   [ AC_MSG_RESULT(no) ],
1277   [ AC_MSG_RESULT(no) ]
1278 )
1279
1280 # Native WIN32 compilation under cygwin
1281 #
1282 AC_MSG_CHECKING(whether to compile native WIN32 code)
1283 AC_ARG_WITH(win32,
1284   [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
1285   [
1286     AC_MSG_RESULT(yes)
1287     AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1288     win32_support=true
1289     CFLAGS="-mno-cygwin $CFLAGS"
1290     LIBS="$LIBS -lwsock32"
1291   ],
1292   [
1293     AC_MSG_RESULT(no)
1294   ])
1295 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1296
1297 # Native Symbian OS support (disabled by default)
1298 #
1299 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
1300
1301 # Native BeOS support (disabled by default)
1302 #
1303 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1304
1305 # Native OS2 support (disabled by default)
1306 #
1307 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1308
1309 #ifdef SILC_DIST_SERVER
1310 without_silcd=false
1311 #endif SILC_DIST_SERVER
1312 #ifdef SILC_DIST_CLIENT
1313 AM_CONDITIONAL(with_irssi, true)
1314 #endif SILC_DIST_CLIENT
1315 #ifdef SILC_DIST_INPLACE
1316 without_irssi=false
1317 without_silcd=false
1318 #endif SILC_DIST_INPLACE
1319
1320 AC_SUBST(ETCDIR)
1321 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1322 #endif SILC_DIST_COMPILER
1323
1324 ##
1325 ##  Misc
1326 ##
1327
1328 # Make enable-shared aware
1329 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1330
1331 SILC_TOP_SRCDIR=`pwd`
1332
1333 # Included configure scripts
1334 AD_INCLUDE_CONFIGURE
1335
1336 #ifdef SILC_DIST_COMPILER
1337 #
1338 # Substitutions
1339 #
1340 AC_SUBST(LIBSUBDIR)
1341 AC_SUBST(SILC_TOP_SRCDIR)
1342 AC_SUBST(LDFLAGS)
1343 AC_SUBST(LIBS)
1344 AC_SUBST(SILC_LIB_INCLUDES)
1345 AC_SUBST(__SILC_HAVE_PTHREAD)
1346 AC_SUBST(__SILC_HAVE_SIM)
1347 AC_SUBST(__SILC_ENABLE_DEBUG)
1348 AC_SUBST(__SILC_PACKAGE_VERSION)
1349
1350 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1351 AC_SUBST(INCLUDE_DEFINES_INT)
1352
1353 #endif SILC_DIST_COMPILER
1354
1355 #
1356 # Makefile outputs
1357 #
1358 AC_CONFIG_FILES(
1359 Makefile
1360 #ifdef SILC_DIST_DOC
1361 doc/Makefile
1362 #endif SILC_DIST_DOC
1363 #ifdef SILC_DIST_COMPILER
1364 Makefile.defines
1365 Makefile.defines_int
1366 includes/Makefile
1367 includes/silcversion.h
1368 includes/silc.h
1369 #endif SILC_DIST_COMPILER
1370 #ifdef SILC_DIST_APPS
1371 apps/Makefile
1372 #endif SILC_DIST_APPS
1373 )
1374
1375 #ifdef SILC_DIST_TOOLKIT
1376 AC_CONFIG_FILES(
1377 win32/Makefile
1378 win32/libsilc/Makefile
1379 win32/libsilcclient/Makefile
1380 tutorial/Makefile
1381 tutorial/Makefile.defines
1382 tutorial/Makefile.defines_int
1383 )
1384 #endif SILC_DIST_TOOLKIT
1385
1386 AC_OUTPUT
1387
1388 #ifdef SILC_DIST_COMPILER
1389
1390 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1391 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1392 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1393 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1394
1395 echo ""
1396 echo "$PACKAGE Configuration Summary:"
1397 echo "---------------------------"
1398 echo " Target host ...................: $target"
1399 echo " Compiler ......................: $CC"
1400 echo " CFLAGS ........................: $CFLAGS"
1401 echo " LDFLAGS .......................: $LDFLAGS"
1402 echo " LIBS ..........................: $LIBS"
1403 echo ""
1404 echo " Installation prefix ...........: $prefix"
1405 echo " bin directory .................: $s_bindir"
1406 echo " sbin directory ................: $s_sbindir"
1407 echo " etc directory .................: $ETCDIR"
1408 echo " man directory .................: $s_mandir"
1409 echo " doc directory .................: $DOCDIR"
1410 #ifdef SILC_DIST_SIM
1411 echo " SIM directory .................: $MODULESDIR"
1412 #endif SILC_DIST_SIM
1413 #ifdef SILC_DIST_INCLUDES
1414 echo " include directory .............: $s_includedir"
1415 #endif SILC_DIST_INCLUDES
1416 echo ""
1417
1418 #ifdef SILC_DIST_CLIENT
1419 if test x$without_irssi = xtrue; then
1420   irssi="no"
1421 fi
1422 echo " Compile SILC Client ...........: $irssi"
1423 #endif SILC_DIST_CLIENT
1424
1425 #ifdef SILC_DIST_SERVER
1426 if test x$without_silcd = xtrue; then
1427   silcd="no"
1428 fi
1429 echo " Compile SILC Server ...........: $silcd"
1430 #endif SILC_DIST_SERVER
1431
1432 #ifdef SILC_DIST_SIM
1433 if test x$sim_support = xfalse; then
1434   sim_support="no"
1435 else
1436   sim_support="yes"
1437 fi
1438 echo " SIM support ...................: $sim_support"
1439 #endif SILC_DIST_SIM
1440
1441 echo " IPv6 support ..................: $summary_ipv6"
1442
1443 if test x$has_iconv = xfalse; then
1444   iconv_support="no"
1445 else
1446   iconv_support="yes"
1447 fi
1448 echo " Iconv support .................: $iconv_support"
1449
1450 if test x$want_asm = xfalse; then
1451   summary_asm="no"
1452 else
1453   summary_asm="yes"
1454 fi
1455 echo " Assembler optimizations .......: $summary_asm"
1456
1457 #ifdef SILC_DIST_MATH
1458 if test x$mp_gmp = xtrue; then
1459   echo " Arithmetic library ............: GMP"
1460 fi
1461 #endif SILC_DIST_MATH
1462
1463 threads="no"
1464 if test x$has_threads = xtrue; then
1465   threads="yes"
1466 fi
1467 echo " Multi-threads support .........: $threads"
1468 echo " Debugging enabled .............: $summary_debug"
1469 echo ""
1470 echo "Compile the sources with 'make' or 'gmake' command."
1471 #endif SILC_DIST_COMPILER