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