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