Use _GNU_SOURCE on Linux systems.
[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     SILC_ASSEMBLER="$NASM -O2 -felf"
365     have_assembler=true
366   fi
367
368   AC_PATH_PROG([YASM], [yasm], [no])
369   if test "x$YASM" != "xno"; then
370     SILC_ASSEMBLER="$YASM -Xgnu -felf"
371     have_assembler=true
372   fi
373 fi
374 AC_SUBST(SILC_ASSEMBLER)
375
376 ##
377 ## va_copy checks
378 ##
379 va_copy=false
380 AC_MSG_CHECKING(for va_copy)
381 AC_TRY_COMPILE(
382   [
383     #include <stdarg.h>
384     #include <stdlib.h>
385   ],
386   [
387     int t(int x, ...)
388     {
389       va_list va, cp;
390       va_start(va, x);
391       va_copy(cp, va);
392       if (va_arg(cp, int) != 0xff11)
393         return 1;
394       va_end(va);
395       va_end(cp);
396       return 0;
397     }
398     int main()
399     {
400       return t(0, 0xff11);
401     }
402   ],
403   [
404     AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
405     AC_MSG_RESULT(yes)
406     va_copy=true
407   ],
408   [
409     AC_MSG_RESULT(no)
410     va_copy=false
411   ]
412 )
413
414 if test x$va_copy = xfalse; then
415   AC_MSG_CHECKING(for __va_copy)
416   AC_TRY_COMPILE(
417   [
418     #include <stdarg.h>
419     #include <stdlib.h>
420   ],
421   [
422     int t(int x, ...)
423     {
424       va_list va, cp;
425       va_start(va, x);
426       __va_copy(cp, va);
427       if (va_arg(cp, int) != 0xff11)
428         return 1;
429       va_end(va);
430       va_end(cp);
431       return 0;
432     }
433     int main()
434     {
435       return t(0, 0xff11);
436     }
437   ],
438   [
439     AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
440     AC_MSG_RESULT(yes)
441     va_copy=true
442   ],
443   [
444     AC_MSG_RESULT(no)
445     va_copy=false
446   ]
447   )
448 fi
449
450 if test x$va_copy = xfalse; then
451   AC_RUN_IFELSE(
452     [
453       #include <stdarg.h>
454       #include <stdlib.h>
455       int t(int x, ...)
456       {
457         va_list va, cp;
458         va_start(va, x);
459         cp = va;
460         if (va_arg(cp, int) != 0xff11)
461           return 1;
462         va_end(va);
463         va_end(cp);
464         return 0;
465       }
466       int main()
467       {
468         return t(0, 0xff11);
469       }
470     ],
471     [va_copy=false],
472     [
473       AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
474     ],
475     [va=copy=false]
476   )
477 fi
478
479 ##
480 ## Compiler and compiler flag checks
481 ##
482
483 if test "$GCC"; then
484   # GCC specific options
485   if test "x$summary_debug" = "xyes"; then
486     SILC_ADD_CFLAGS(-g)
487   else
488     SILC_ADD_CFLAGS(-g)
489   fi
490   SILC_ADD_CFLAGS(-Wall -finline-functions)
491   SILC_ADD_CFLAGS(-Wno-pointer-sign)
492 else
493   # Other compilers
494   case "$target" in
495     alpha*-dec-osf*)
496       SILC_ADD_CFLAGS(-g3)
497       ;;
498     mips*-sgi-irix*)
499       SILC_ADD_CFLAGS(-g3)
500       ;;
501     *)
502       SILC_ADD_CFLAGS(-g)
503       ;;
504   esac
505
506   # Intel C++ Compiler needs -restrict
507   if test "x$CC" = "xicc"; then
508     SILC_ADD_CFLAGS(-restrict)
509   fi
510 fi
511
512 if test x$want_cc_optimizations = xtrue; then
513   if test "$GCC"; then
514     # GCC specific options
515     if test "x$summary_debug" = "xyes"; then
516       SILC_ADD_CFLAGS(-O)
517     else
518       SILC_ADD_CFLAGS(-O2)
519     fi
520   else
521     # Other compilers
522     case "$target" in
523       alpha*-dec-osf*)
524         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
525         ;;
526       mips*-sgi-irix*)
527         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
528         ;;
529       *)
530         SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
531         ;;
532     esac
533   fi
534 fi
535
536 #
537 # Workaround a bug in GCC 2.x which causes memory exhaustion
538 # when compiling sha1 with optimizations on UltraSPARC.
539 #
540 FIX_SHA1='#'
541 if test "$GCC" -a "$host_cpu" = "sparc64"; then
542   AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
543   AC_TRY_COMPILE(
544     [
545       #if defined(__sparc64__) && (__GNUC__ == 2)
546       #else
547       choke me
548       #endif
549     ],
550     [],
551     [
552       FIX_SHA1=''
553       AC_MSG_RESULT(yes)
554     ],
555       AC_MSG_RESULT(no)
556     )
557 fi
558 AC_SUBST(FIX_SHA1)
559 #endif SILC_DIST_COMPILER
560
561 ##
562 ##  Installation
563 ##
564
565 # Default installation destination
566 #
567 AC_PREFIX_DEFAULT(/usr/local)
568 if test "x$prefix" != xNONE; then
569   silc_prefix="$prefix"
570 else
571   silc_prefix="$ac_default_prefix"
572   prefix="$silc_prefix"
573 fi
574
575 #ifndef SILC_DIST_AUTODIST
576 ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
577 AC_SUBST(ETCDIR)
578 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
579
580 DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
581 AC_SUBST(DOCDIR)
582 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
583 #endif SILC_DIST_AUTODIST
584
585 #ifdef SILC_DIST_COMPILER
586 ##
587 ##  With/without checkings
588 ##
589
590 #
591 # SILC library checking
592 compile_libs=true
593 LIBSUBDIR=lib
594
595 #ifndef SILC_DIST_TOOLKIT
596 AC_ARG_WITH(silc-includes,
597   [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
598   [ac_silc_includes="$withval"], [ac_silc_includes="no"])
599 AC_ARG_WITH(silc-libs,
600   [  --with-silc-libs=DIR     SILC Toolkit libraries [search in DIR]],
601   [ac_silc_libs="$withval"], [ac_silc_libs="no"])
602
603 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
604
605   # Manually provided libs
606   if test "$ac_silc_includes" != "no"; then
607     compile_libs=false
608     SILC_LIB_INCLUDES="-I$ac_silc_includes"
609     LIBSUBDIR=
610   fi
611   if test "$ac_silc_libs" != "no"; then
612     compile_libs=false
613     LIBSUBDIR=
614     LDFLAGS="-L$ac_silc_libs $LDFLAGS"
615   else
616     LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
617   fi
618
619   # Check libs to link against
620   f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
621   if test -n "$f"; then
622     LIBS="$LIBS -lpthread"
623     check_threads=false
624     has_threads=true
625   fi
626   f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
627   if test -n "$f"; then
628     LIBS="$LIBS -ldl"
629   fi
630
631 else
632   # pkg-config check
633   PKG_CHECK_MODULES(SILC, [silc >= 1.1], compile_libs=false, compile_libs=true)
634 #ifdef SILC_DIST_CLIENTLIB
635   PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.1.1], compile_libs=false, compile_libs=true)
636 #endif SILC_DIST_CLIENTLIB
637 #ifdef SILC_DIST_SERVERLIB
638   PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
639 #endif SILC_DIST_SERVERLIB
640
641   if test x$compile_libs = xfalse; then
642     LIBSUBDIR=
643     LIBS="$SILC_LIBS $LIBS"
644     CFLAGS="$CFLAGS $SILC_CFLAGS"
645 #ifdef SILC_DIST_CLIENTLIB
646     LIBS="$SILCCLIENT_LIBS $LIBS"
647     CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
648 #endif SILC_DIST_CLIENTLIB
649 #ifdef SILC_DIST_SERVERLIB
650     LIBS="$LIBS $SILCSERVER_LIBS"
651     CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
652 #endif SILC_DIST_SERVERLIB
653   else
654     LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
655   fi
656 fi
657 #else SILC_DIST_TOOLKIT
658 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
659 #endif SILC_DIST_TOOLKIT
660
661 #ifdef SILC_DIST_SIM
662 # SIM support checking
663 # XXX These needs to be changed as more supported platforms appear.
664 # XXX This probably needs to be made platform dependant check.
665 #
666 sim_support=false
667 AC_MSG_CHECKING(for SIM support)
668 AC_MSG_RESULT()
669 AC_CHECK_HEADERS(dlfcn.h,
670   [
671     AC_CHECK_LIB(dl, dlopen,
672       [
673         AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
674         sim_support=true
675         LIBS="$LIBS -ldl"
676       ],
677       [
678         AC_CHECK_LIB(c, dlopen,
679           [
680             AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
681             sim_support=true
682           ])
683       ])
684    ])
685
686 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
687 if test x$sim_support = xtrue; then
688   AC_MSG_RESULT(Enabled SIM support.)
689   __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
690 else
691   AC_MSG_RESULT(No SIM support found.)
692 fi
693 #endif SILC_DIST_SIM
694
695 # SOCKS4 support checking
696 #
697 SAVE_LIBS="$LIBS"
698 SAVE_CFLAGS="$CFLAGS"
699 SAVE_LDFLAGS="$LDFLAGS"
700 AC_MSG_CHECKING(whether to support SOCKS4)
701 AC_ARG_WITH(socks4,
702   [[  --with-socks4[=DIR]     with SOCKS4 support [search in DIR/lib and DIR/include]]],
703   [
704     case "$withval" in
705       no)
706         AC_MSG_RESULT(no)
707         ;;
708       *)
709         AC_MSG_RESULT(yes)
710         socks=4
711
712         if test -d "$withval/include"; then
713           CFLAGS="$CFLAGS -I$withval/include"
714         fi
715         if test -d "$withval/lib"; then
716           LDFLAGS="$LDFLAGS -L$withval/lib"
717         fi
718
719         LIBS="-lsocks $LIBS"
720         ;;
721     esac
722
723     AC_TRY_LINK([],
724       [
725         Rconnect();
726       ], [],
727       [
728         AC_MSG_ERROR(Could not find SOCKS4 library.)
729         LIBS="$SAVE_LIBS"
730         CFLAGS="$SAVE_CFLAGS"
731         LDFLAGS="$SAVE_LDFLAGS"
732       ])
733   ],
734     AC_MSG_RESULT(no)
735   )
736
737 # SOCKS5 support checking
738 #
739 SAVE_LIBS="$LIBS"
740 SAVE_CFLAGS="$CFLAGS"
741 SAVE_LDFLAGS="$LDFLAGS"
742 AC_MSG_CHECKING(whether to support SOCKS5)
743 AC_ARG_WITH(socks5,
744   [[  --with-socks5[=DIR]     with SOCKS5 support [search in DIR/lib and DIR/include]]],
745   [
746     case "$withval" in
747       no)
748         AC_MSG_RESULT(no)
749         ;;
750       *)
751         AC_MSG_RESULT(yes)
752         socks=5
753
754         if test -d "$withval/include"; then
755           CFLAGS="$CFLAGS -I$withval/include"
756         fi
757         if test -d "$withval/lib"; then
758           LDFLAGS="$LDFLAGS -L$withval/lib"
759         fi
760
761         LIBS="-lsocks5 $LIBS"
762         ;;
763     esac
764
765     AC_TRY_LINK([],
766       [
767         SOCKSconnect();
768       ], [],
769       [
770         AC_MSG_ERROR(Could not find SOCKS5 library.)
771         LIBS="$SAVE_LIBS"
772         CFLAGS="$SAVE_CFLAGS"
773         LDFLAGS="$SAVE_LDFLAGS"
774       ])
775   ],
776     AC_MSG_RESULT(no)
777   )
778
779 if test "x$socks" = "x4"; then
780   AC_DEFINE([SOCKS], [], [Socks])
781   CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
782 fi
783
784 if test "x$socks" = "x5"; then
785   AC_DEFINE([SOCKS], [], [Socks])
786   AC_DEFINE([SOCKS5], [], [Socks5])
787   AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
788   AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
789   AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
790   AC_DEFINE([Rbind], [SOCKSbind], [Socks])
791   AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
792   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
793   AC_DEFINE([Rselect], [SOCKSselect], [Socks])
794   AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
795   AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
796   AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
797   AC_DEFINE([Rsend], [SOCKSsend], [Socks])
798   AC_DEFINE([Rread], [SOCKSread], [Socks])
799   AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
800   AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
801   AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
802   AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
803   AC_DEFINE([Rclose], [SOCKSclose], [Socks])
804   AC_DEFINE([Rdup], [SOCKSdup], [Socks])
805   AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
806   AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
807   AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
808 fi
809
810 #ifdef SILC_DIST_MATH
811 # MP library checking. First check whether user wants to use GMP and use
812 # it if found. If not or not defined then compile the default library in the
813 # source tree.
814 #
815 mp_gmp=false
816 SAVE_LIBS="$LIBS"
817 SAVE_CFLAGS="$CFLAGS"
818 SAVE_LDFLAGS="$LDFLAGS"
819 AC_MSG_CHECKING(whether to search for GMP)
820 AC_ARG_WITH(gmp,
821   [[  --with-gmp[=DIR]        use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
822   [
823     case "$withval" in
824       no)
825         AC_MSG_RESULT(no)
826         ;;
827       *)
828         AC_MSG_RESULT(yes)
829
830         if test -d "$withval/include"; then
831           CFLAGS="$CFLAGS -I$withval/include"
832         fi
833         if test -d "$withval/lib"; then
834           LDFLAGS="$LDFLAGS -L$withval/lib"
835         fi
836
837         LIBS="-lgmp $LIBS"
838         ;;
839     esac
840
841     AC_CHECK_LIB(gmp, __gmpz_init,
842       [
843         mp_gmp=true
844         AC_DEFINE([SILC_MP_GMP], [], [GMP])
845         AC_MSG_RESULT(Using GMP as a MP library.)
846       ],
847       [
848         LIBS="$SAVE_LIBS"
849         CFLAGS="$SAVE_CFLAGS"
850         LDFLAGS="$SAVE_LDFLAGS"
851       ])
852   ],
853     AC_MSG_RESULT(no)
854   )
855
856 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
857 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
858 if test x$mp_gmp = xfalse; then
859   AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
860   AC_MSG_RESULT(Using SILC Math as a MP library.)
861 fi
862 #endif SILC_DIST_MATH
863
864 # iconv support
865 #
866 check_iconv=true
867 has_iconv=false
868 SAVE_LIBS="$LIBS"
869 SAVE_CFLAGS="$CFLAGS"
870 SAVE_LDFLAGS="$LDFLAGS"
871 SAVE_CPPFLAGS="$CPPFLAGS"
872 AC_MSG_CHECKING(whether to implicit search for libiconv)
873 AC_ARG_WITH(iconv,
874   [[  --with-iconv[=DIR]      use libiconv [search in DIR/include and DIR/lib]]],
875   [
876     case "${withval}" in
877       no)
878         AC_MSG_RESULT(no)
879         AC_CHECK_HEADERS(iconv.h,
880           [
881             AC_CHECK_FUNC(iconv, has_iconv=true)
882           ])
883         check_iconv=false
884         ;;
885       *)
886         AC_MSG_RESULT(yes)
887         if test -d $withval/include; then
888           CPPFLAGS="$CPPFLAGS -I$withval/include"
889           CFLAGS="$CFLAGS -I$withval/include"
890         fi
891         if test -d $withval/lib; then
892           LDFLAGS="$LDFLAGS -L$withval/lib"
893         fi
894         ;;
895     esac
896   ],
897   [
898     AC_MSG_RESULT(no)
899     AC_CHECK_HEADERS(iconv.h,
900       [
901         AC_CHECK_FUNCS(iconv,
902           [
903             has_iconv=true
904             check_iconv=false
905           ])
906       ])
907   ])
908
909 if test x$check_iconv = xtrue; then
910   AC_MSG_RESULT(Searching for iconv...)
911
912   # XXX
913   unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
914
915   AC_CHECK_HEADERS(iconv.h,
916     [
917       LIBS="$LIBS -liconv"
918       AC_MSG_CHECKING(for iconv in -liconv)
919       AC_TRY_LINK(
920         [
921           #include <stdlib.h>
922           #include <iconv.h>
923         ],
924         [
925           iconv_t cd = iconv_open("", "");
926           iconv(cd, NULL, NULL, NULL, NULL);
927           iconv_close(cd);
928         ],
929         [
930           echo "yes"
931           AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
932           has_iconv=true
933           check_iconv=false
934         ],
935         [
936           echo "no"
937           LIBS="$SAVE_LIBS"
938           CFLAGS="$SAVE_CFLAGS"
939           LDFLAGS="$SAVE_LDFLAGS"
940           CPPFLAGS="$SAVE_CPPFLAGS"
941         ])
942      ])
943 fi
944
945 if test x$check_iconv = xtrue; then
946   # search for iconv library..
947   SAVE_LIBS="$LIBS"
948   SAVE_CFLAGS="$CFLAGS"
949   SAVE_LDFLAGS="$LDFLAGS"
950   SAVE_CPPFLAGS="$CPPFLAGS"
951
952   for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
953     if test x$has_iconv = xfalse; then
954       AC_MSG_RESULT(searching in $dir...)
955
956       if test -d $dir/include; then
957         CPPFLAGS="$CPPFLAGS -I$dir/include"
958         CFLAGS="$CFLAGS -I$dir/include"
959       fi
960       if test -d $dir/lib; then
961         LDFLAGS="$LDFLAGS -L$dir/lib"
962       fi
963
964       # XXX
965       unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
966
967       AC_CHECK_HEADERS(iconv.h,
968         [
969           LIBS="$LIBS -liconv"
970           AC_MSG_CHECKING(for iconv in -liconv)
971           AC_TRY_LINK(
972             [
973               #include <stdlib.h>
974               #include <iconv.h>
975             ],
976             [
977               iconv_t cd = iconv_open("", "");
978               iconv(cd, NULL, NULL, NULL, NULL);
979               iconv_close(cd);
980             ],
981             [
982               echo "yes"
983               has_iconv=true
984               AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
985             ],
986             [
987               echo "no"
988               has_iconv=false
989
990               LIBS="$SAVE_LIBS"
991               CFLAGS="$SAVE_CFLAGS"
992               LDFLAGS="$SAVE_LDFLAGS"
993               CPPFLAGS="$SAVE_CPPFLAGS"
994             ])
995          ],
996          [
997            CFLAGS="$SAVE_CFLAGS"
998            LDFLAGS="$SAVE_LDFLAGS"
999            CPPFLAGS="$SAVE_CPPFLAGS"
1000          ])
1001       fi
1002     done
1003 fi
1004
1005 if test x$has_iconv = xtrue; then
1006   # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
1007   # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
1008   #     obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
1009   #
1010   AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
1011     AC_TRY_RUN(
1012       [
1013         #include <iconv.h>
1014         int main() {
1015           iconv_t cd;
1016         changequote(, )dnl
1017           char buf[4];
1018         changequote([, ])dnl
1019           char *ob;
1020           size_t obl;
1021           ob = buf, obl = sizeof(buf);
1022           return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
1023                  (iconv(cd, 0, 0, &ob, &obl) ||
1024                  !(ob == buf && obl == sizeof(buf)) ||
1025                  iconv_close(cd)));
1026         }
1027       ],
1028       [
1029         ac_iconv_good=yes
1030       ],
1031       [
1032         ac_iconv_good=no
1033       ],
1034       [
1035         ac_iconv_good=yes
1036       ])
1037     )
1038
1039   if test x$ac_iconv_good = xno; then
1040     AC_MSG_RESULT(Try using libiconv instead.)
1041   fi
1042 fi
1043
1044 # POSIX threads support
1045 #
1046 AC_MSG_CHECKING(whether to search for POSIX threads)
1047 AC_ARG_WITH(pthreads,
1048   [[  --with-pthreads[=DIR]   use POSIX threads [search in DIR/include and DIR/lib]]],
1049   [
1050     case "${withval}" in
1051       no)
1052         check_threads=false
1053         ;;
1054       *)
1055         if test -d $withval/include; then
1056           CPPFLAGS="$CPPFLAGS -I$withval/include"
1057           CFLAGS="$CFLAGS -I$withval/include"
1058         fi
1059         if test -d $withval/lib; then
1060           LDFLAGS="$LDFLAGS -L$withval/lib"
1061         fi
1062
1063         check_threads=true
1064         ;;
1065     esac
1066   ])
1067
1068 if test x$check_threads = xtrue; then
1069   has_threads=false
1070   SAVE_LIBS="$LIBS"
1071   SAVE_CFLAGS="$CFLAGS"
1072   SAVE_LDFLAGS="$LDFLAGS"
1073   SAVE_CPPFLAGS="$CPPFLAGS"
1074
1075   AC_MSG_RESULT(yes)
1076   AC_CHECK_HEADERS(pthread.h,
1077     [
1078       LIBS="$LIBS -lpthread"
1079       AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1080         [
1081           # FreeBSD
1082           case "${target}" in
1083             *-*-freebsd*)
1084               LIBS="$SAVE_LIBS -pthread"
1085               AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1086               ;;
1087             *)
1088               LIBS="$SAVE_LIBS"
1089               ;;
1090           esac
1091         ])
1092     ],
1093     [
1094       # search for pthread library..
1095       for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1096         if test x$has_threads = xfalse; then
1097           AC_MSG_RESULT(searching in $dir...)
1098
1099           if test -d $dir/include; then
1100             CPPFLAGS="$CPPFLAGS -I$dir/include"
1101             CFLAGS="$CFLAGS -I$dir/include"
1102           fi
1103           if test -d $dir/lib; then
1104             LDFLAGS="$LDFLAGS -L$dir/lib"
1105           fi
1106
1107           # XXX
1108           unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1109
1110           AC_CHECK_HEADERS(pthread.h,
1111             [
1112               LIBS="$LIBS -lpthread"
1113               AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1114                 [
1115                   has_threads=false
1116
1117                   LIBS="$SAVE_LIBS"
1118                   CFLAGS="$SAVE_CFLAGS"
1119                   LDFLAGS="$SAVE_LDFLAGS"
1120                   CPPFLAGS="$SAVE_CPPFLAGS"
1121                 ])
1122             ],
1123             [
1124               CFLAGS="$SAVE_CFLAGS"
1125               LDFLAGS="$SAVE_LDFLAGS"
1126               CPPFLAGS="$SAVE_CPPFLAGS"
1127             ])
1128         fi
1129       done
1130     ])
1131 else
1132   AC_MSG_RESULT(no)
1133   has_threads=false
1134 fi
1135
1136 __SILC_HAVE_PTHREAD=""
1137 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1138 if test x$has_threads = xtrue; then
1139   CFLAGS="$CFLAGS -D_REENTRANT"
1140
1141   # XXX possibly incomplete
1142   case "${target}" in
1143     *-*-aix*)
1144       CFLAGS="$CFLAGS -D_THREAD_SAFE"
1145       if test x"$GCC" = xyes; then
1146         CFLAGS="$CFLAGS -mthreads"
1147       fi
1148       ;;
1149     *-*-freebsd*)
1150       CFLAGS="$CFLAGS -D_THREAD_SAFE"
1151       ;;
1152     *-*-sysv5uw7*)  # UnixWare 7
1153       if test "$GCC" != "yes"; then
1154         CFLAGS="$CFLAGS -Kthread"
1155       else
1156         CFLAGS="$CFLAGS -pthread"
1157       fi
1158       ;;
1159     *-dg-dgux*)  # DG/UX
1160       CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1161       ;;
1162    esac
1163
1164   # Check for threads
1165   AC_CHECK_FUNC(pthread_create)
1166
1167   # Check for read/write locks
1168   AC_CHECK_FUNC(pthread_rwlock_init,
1169   [
1170     AC_RUN_IFELSE(
1171       [
1172         #include <pthread.h>
1173         int main()
1174         {
1175           pthread_rwlock_t rwlock;
1176           pthread_rwlock_init(&rwlock, NULL);
1177           pthread_rwlock_destroy(&rwlock);
1178           return 0;
1179         }
1180       ],
1181       [],
1182       [
1183         # Rwlock not defined
1184         CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1185       ]
1186     )
1187   ],
1188   [
1189     # Rwlock not defined
1190     CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1191   ])
1192
1193   AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1194   AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1195   __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1196 fi
1197
1198 #
1199 # Check for timezone and tm_gmtoff for timezone information
1200 #
1201 AC_MSG_CHECKING(whether system has timezone)
1202 AC_RUN_IFELSE(
1203   [
1204     #include <stdio.h>
1205     #include <time.h>
1206     int main()
1207     {
1208       timezone = 0;
1209       return 0;
1210     }
1211   ],
1212   [ AC_MSG_RESULT(yes)
1213     AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
1214   [ AC_MSG_RESULT(no) ],
1215   [ AC_MSG_RESULT(no) ]
1216 )
1217 AC_MSG_CHECKING(whether system has tm_gmtoff)
1218 AC_RUN_IFELSE(
1219   [
1220     #include <stdio.h>
1221     #include <time.h>
1222     int main()
1223     {
1224       struct tm tm;
1225       tm.tm_gmtoff = 0;
1226       return 0;
1227     }
1228   ],
1229   [ AC_MSG_RESULT(yes)
1230     AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
1231   [ AC_MSG_RESULT(no) ],
1232   [ AC_MSG_RESULT(no) ]
1233 )
1234 AC_MSG_CHECKING(whether system has __tm_gmtoff)
1235 AC_RUN_IFELSE(
1236   [
1237     #include <stdio.h>
1238     #include <time.h>
1239     int main()
1240     {
1241       struct tm tm;
1242       tm.__tm_gmtoff = 0;
1243       return 0;
1244     }
1245   ],
1246   [ AC_MSG_RESULT(yes)
1247     AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
1248   [ AC_MSG_RESULT(no) ],
1249   [ AC_MSG_RESULT(no) ]
1250 )
1251 AC_MSG_CHECKING(whether system has __tm_gmtoff__)
1252 AC_RUN_IFELSE(
1253   [
1254     #include <stdio.h>
1255     #include <time.h>
1256     int main()
1257     {
1258       struct tm tm;
1259       tm.__tm_gmtoff__ = 0;
1260       return 0;
1261     }
1262   ],
1263   [ AC_MSG_RESULT(yes)
1264     AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
1265   [ AC_MSG_RESULT(no) ],
1266   [ AC_MSG_RESULT(no) ]
1267 )
1268
1269 # Native WIN32 compilation under cygwin
1270 #
1271 AC_MSG_CHECKING(whether to compile native WIN32 code)
1272 AC_ARG_WITH(win32,
1273   [  --with-win32            compile native WIN32 (MinGW) code (-mno-cygwin)],
1274   [
1275     AC_MSG_RESULT(yes)
1276     AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1277     win32_support=true
1278     CFLAGS="-mno-cygwin $CFLAGS"
1279     LIBS="$LIBS -lwsock32"
1280   ],
1281   [
1282     AC_MSG_RESULT(no)
1283   ])
1284 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1285
1286 # Native Symbian OS support (disabled by default)
1287 #
1288 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
1289
1290 # Native BeOS support (disabled by default)
1291 #
1292 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1293
1294 # Native OS2 support (disabled by default)
1295 #
1296 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1297
1298 #ifdef SILC_DIST_SERVER
1299 without_silcd=false
1300 #endif SILC_DIST_SERVER
1301 #ifdef SILC_DIST_CLIENT
1302 AM_CONDITIONAL(with_irssi, true)
1303 #endif SILC_DIST_CLIENT
1304 #ifdef SILC_DIST_INPLACE
1305 without_irssi=false
1306 without_silcd=false
1307 #endif SILC_DIST_INPLACE
1308
1309 libtoolfix=true
1310 AC_MSG_CHECKING(whether to do libtoolfix)
1311 AC_ARG_WITH(libtoolfix,
1312   [  --without-libtoolfix    Do not fix libtool, for package builders],
1313   [
1314     AC_MSG_RESULT(no)
1315     libtoolfix=false
1316   ],
1317   [
1318     AC_MSG_RESULT(yes)
1319   ])
1320
1321 AC_SUBST(ETCDIR)
1322 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1323 #endif SILC_DIST_COMPILER
1324
1325 ##
1326 ##  Misc
1327 ##
1328
1329 # Make enable-shared aware
1330 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1331
1332 SILC_TOP_SRCDIR=`pwd`
1333
1334 # Included configure scripts
1335 AD_INCLUDE_CONFIGURE
1336
1337 #ifdef SILC_DIST_COMPILER
1338 #
1339 # Substitutions
1340 #
1341 AC_SUBST(LIBSUBDIR)
1342 AC_SUBST(SILC_TOP_SRCDIR)
1343 AC_SUBST(LDFLAGS)
1344 AC_SUBST(LIBS)
1345 AC_SUBST(SILC_LIB_INCLUDES)
1346 AC_SUBST(__SILC_HAVE_PTHREAD)
1347 AC_SUBST(__SILC_HAVE_SIM)
1348 AC_SUBST(__SILC_ENABLE_DEBUG)
1349 AC_SUBST(__SILC_PACKAGE_VERSION)
1350
1351 #
1352 # Fix the libtool to support run-time configuration.  This allows us
1353 # to in run-time specify when to compile shared/static libraries without
1354 # need to reconfigure the entire libtool.
1355 #
1356 if test x$libtoolfix = xtrue; then
1357   ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
1358 fi
1359 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
1360
1361 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1362 AC_SUBST(INCLUDE_DEFINES_INT)
1363
1364 #endif SILC_DIST_COMPILER
1365
1366 #
1367 # Makefile outputs
1368 #
1369 AC_CONFIG_FILES(
1370 Makefile
1371 #ifdef SILC_DIST_DOC
1372 doc/Makefile
1373 #endif SILC_DIST_DOC
1374 #ifdef SILC_DIST_COMPILER
1375 Makefile.defines
1376 Makefile.defines_int
1377 includes/Makefile
1378 includes/silcversion.h
1379 includes/silc.h
1380 #endif SILC_DIST_COMPILER
1381 #ifdef SILC_DIST_APPS
1382 apps/Makefile
1383 #endif SILC_DIST_APPS
1384 )
1385
1386 #ifdef SILC_DIST_TOOLKIT
1387 AC_CONFIG_FILES(
1388 win32/Makefile
1389 win32/libsilc/Makefile
1390 win32/libsilcclient/Makefile
1391 tutorial/Makefile
1392 tutorial/Makefile.defines
1393 tutorial/Makefile.defines_int
1394 )
1395 #endif SILC_DIST_TOOLKIT
1396
1397 AC_OUTPUT
1398
1399 #ifdef SILC_DIST_COMPILER
1400 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1401 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1402 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1403 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1404
1405 echo ""
1406 echo "$PACKAGE Configuration Summary:"
1407 echo "---------------------------"
1408 echo " Target host ...................: $target"
1409 echo " Compiler ......................: $CC"
1410 echo " CFLAGS ........................: $CFLAGS"
1411 echo " LDFLAGS .......................: $LDFLAGS"
1412 echo " LIBS ..........................: $LIBS"
1413 echo ""
1414 echo " Installation prefix ...........: $prefix"
1415 echo " bin directory .................: $s_bindir"
1416 echo " sbin directory ................: $s_sbindir"
1417 echo " etc directory .................: $ETCDIR"
1418 echo " man directory .................: $s_mandir"
1419 echo " doc directory .................: $DOCDIR"
1420 #ifdef SILC_DIST_SIM
1421 echo " SIM directory .................: $MODULESDIR"
1422 #endif SILC_DIST_SIM
1423 #ifdef SILC_DIST_INCLUDES
1424 echo " include directory .............: $s_includedir"
1425 #endif SILC_DIST_INCLUDES
1426 echo ""
1427
1428 #ifdef SILC_DIST_CLIENT
1429 if test x$without_irssi = xtrue; then
1430   irssi="no"
1431 fi
1432 echo " Compile SILC Client ...........: $irssi"
1433 #endif SILC_DIST_CLIENT
1434
1435 #ifdef SILC_DIST_SERVER
1436 if test x$without_silcd = xtrue; then
1437   silcd="no"
1438 fi
1439 echo " Compile SILC Server ...........: $silcd"
1440 #endif SILC_DIST_SERVER
1441
1442 #ifdef SILC_DIST_SIM
1443 if test x$sim_support = xfalse; then
1444   sim_support="no"
1445 else
1446   sim_support="yes"
1447 fi
1448 echo " SIM support ...................: $sim_support"
1449 #endif SILC_DIST_SIM
1450
1451 echo " IPv6 support ..................: $summary_ipv6"
1452
1453 if test x$has_iconv = xfalse; then
1454   iconv_support="no"
1455 else
1456   iconv_support="yes"
1457 fi
1458 echo " Iconv support .................: $iconv_support"
1459
1460 if test x$want_asm = xfalse; then
1461   summary_asm="no"
1462 else
1463   summary_asm="yes"
1464 fi
1465 echo " Assembler optimizations .......: $summary_asm"
1466
1467 #ifdef SILC_DIST_MATH
1468 if test x$mp_gmp = xtrue; then
1469   echo " Arithmetic library ............: GMP"
1470 fi
1471 #endif SILC_DIST_MATH
1472
1473 threads="no"
1474 if test x$has_threads = xtrue; then
1475   threads="yes"
1476 fi
1477 echo " Multi-threads support .........: $threads"
1478 echo " Debugging enabled .............: $summary_debug"
1479 echo ""
1480 echo "Compile the sources with 'make' or 'gmake' command."
1481 #endif SILC_DIST_COMPILER