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