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