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