4 # Author: Pekka Riikonen <priikone@silcnet.org>
6 # Copyright (C) 2000 - 2007 Pekka Riikonen
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.
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.
22 AC_CONFIG_HEADERS(silcdefs.h)
30 AC_PATH_PROG(sedpath, sed)
32 #ifdef SILC_DIST_COMPILER
33 # Put here any platform specific stuff
58 AC_DEFINE([SILC_I386], [], [SILC_I386])
59 AC_DEFINE([SILC_I486], [], [SILC_I486])
64 AC_DEFINE([SILC_I486], [], [SILC_I486])
68 AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
72 AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
76 AC_DEFINE([SILC_IA64], [], [SILC_IA64])
80 AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
81 AM_CONDITIONAL(SILC_I486, test x$cpu_ix86 = xtrue)
82 AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
83 AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
84 AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
86 # Control compiler optimizations
87 CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
93 __SILC_HAVE_PTHREAD=""
95 __SILC_ENABLE_DEBUG=""
98 #ifndef SILC_DIST_TOOLKIT
100 #endif SILC_DIST_TOOLKIT
101 #ifdef SILC_DIST_INPLACE
103 #endif SILC_DIST_INPLACE
112 # More header checking
114 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
115 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
116 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
117 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
118 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
119 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
129 AC_CHECK_SIZEOF(long long, 0)
130 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
131 AC_CHECK_SIZEOF(long, 0)
132 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
133 AC_CHECK_SIZEOF(int, 0)
134 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
135 AC_CHECK_SIZEOF(short, 0)
136 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
137 AC_CHECK_SIZEOF(char, 0)
138 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
139 AC_CHECK_SIZEOF(void *, 0)
140 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
141 AC_CHECK_TYPES(long long)
142 AC_CHECK_TYPES(long double)
144 # Function to check if compiler flag works
145 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
146 AC_DEFUN([SILC_ADD_CFLAGS],
147 [ tmp_CFLAGS="$CFLAGS"
149 AC_MSG_CHECKING(whether $CC accepts $1 flag)
150 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
156 # Function to check if compiler flag works, destination specifiable
157 # Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
158 AC_DEFUN([SILC_ADD_CC_FLAGS],
159 [ tmp_CFLAGS="$1_CFLAGS"
160 $1_CFLAGS="${$1_CFLAGS} $2"
161 AC_MSG_CHECKING(whether $CC accepts $2 flag)
162 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
163 $1_CFLAGS="$tmp_CFLAGS"
168 # Function and library checking
170 AC_CHECK_FUNC(gethostbyname, [],
172 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
173 AC_CHECK_FUNC(res_gethostbyname, [],
174 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
177 AC_CHECK_FUNC(socket, [],
178 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
180 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
181 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
182 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
183 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
184 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
185 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
186 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
188 # lib/contrib conditionals
190 AC_CHECK_HEADER(regex.h,
192 AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
196 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
198 AC_CHECK_FUNC(getopt_long,
200 AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
202 ], have_getopt_long=0
205 AC_CHECK_FUNC(getopt,
207 AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
213 ## Enable/disable checking
218 AC_MSG_CHECKING(whether to enable IPv6 support)
220 [ --enable-ipv6 enable IPv6 support],
222 case "${enableval}" in
227 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
241 if test x$check_ipv6 = xtrue; then
245 #ifdef HAVE_SYS_TYPES_H
246 #include <sys/types.h>
248 #ifdef HAVE_NETINET_TCP_H
249 #include <netinet/tcp.h>
254 #include <sys/socket.h>
255 #ifdef HAVE_NETINET_IN_H
256 #include <netinet/in.h>
260 struct sockaddr_in6 sin6;
261 int family = AF_INET6;
264 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
274 AC_MSG_CHECKING(whether to enable debugging)
276 __SILC_ENABLE_DEBUG=""
278 [ --enable-debug enable debugging],
280 case "${enableval}" in
283 AC_DEFINE([SILC_DEBUG], [], [enable-debug])
285 __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
296 # Disable all assembler optimizations
298 AC_MSG_CHECKING(whether to enable assembler optimizations)
301 [ --disable-asm do not use assembler optimizations],
304 AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
311 AM_CONDITIONAL(SILC_NO_ASM, test x$want_asm = xfalse)
313 # Check for assembler
317 if test x$want_asm = xtrue; then
318 AC_PATH_PROG([NASM], [nasm], [no])
319 if test "x$NASM" != "xno"; then
320 SILC_ASSEMBLER="$NASM -O2 -felf"
324 AC_PATH_PROG([YASM], [yasm], [no])
325 if test "x$YASM" != "xno"; then
326 SILC_ASSEMBLER="$YASM -Xgnu -felf"
330 AC_SUBST(SILC_ASSEMBLER)
336 AC_MSG_CHECKING(for va_copy)
348 if (va_arg(cp, int) != 0xff11)
360 AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
370 if test x$va_copy = xfalse; then
371 AC_MSG_CHECKING(for __va_copy)
383 if (va_arg(cp, int) != 0xff11)
395 AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
406 if test x$va_copy = xfalse; then
416 if (va_arg(cp, int) != 0xff11)
429 AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
436 ## Compiler and compiler flag checks
440 # GCC specific options
441 if test "x$summary_debug" = "xyes"; then
442 SILC_ADD_CFLAGS(-g -O)
444 SILC_ADD_CFLAGS(-g -O2)
446 SILC_ADD_CFLAGS(-Wall -finline-functions)
447 SILC_ADD_CFLAGS(-Wno-pointer-sign)
452 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
455 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
459 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
463 # Intel C++ Compiler needs -restrict
464 if test "x$CC" = "xicc"; then
465 SILC_ADD_CFLAGS(-restrict)
470 # Workaround a bug in GCC 2.x which causes memory exhaustion
471 # when compiling sha1 with optimizations on UltraSPARC.
474 if test "$GCC" -a "$host_cpu" = "sparc64"; then
475 AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
478 #if defined(__sparc64__) && (__GNUC__ == 2)
492 #endif SILC_DIST_COMPILER
498 # Default installation destination
500 AC_PREFIX_DEFAULT(/usr/local)
501 if test "x$prefix" != xNONE; then
502 silc_prefix="$prefix"
504 silc_prefix="$ac_default_prefix"
505 prefix="$silc_prefix"
508 #ifndef SILC_DIST_AUTODIST
509 ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
511 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
513 DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
515 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
516 #endif SILC_DIST_AUTODIST
518 #ifdef SILC_DIST_COMPILER
520 ## With/without checkings
524 # SILC library checking
528 #ifndef SILC_DIST_TOOLKIT
529 AC_ARG_WITH(silc-includes,
530 [ --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
531 [ac_silc_includes="$withval"], [ac_silc_includes="no"])
532 AC_ARG_WITH(silc-libs,
533 [ --with-silc-libs=DIR SILC Toolkit libraries [search in DIR]],
534 [ac_silc_libs="$withval"], [ac_silc_libs="no"])
536 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
538 # Manually provided libs
539 if test "$ac_silc_includes" != "no"; then
541 SILC_LIB_INCLUDES="-I$ac_silc_includes"
544 if test "$ac_silc_libs" != "no"; then
547 LDFLAGS="-L$ac_silc_libs $LDFLAGS"
549 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
552 # Check libs to link against
553 f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
554 if test -n "$f"; then
555 LIBS="$LIBS -lpthread"
559 f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
560 if test -n "$f"; then
566 PKG_CHECK_MODULES(SILC, [silc >= 1.1], compile_libs=false, compile_libs=true)
567 #ifdef SILC_DIST_CLIENTLIB
568 PKG_CHECK_MODULES(SILCCLIENT, [silcclient >= 1.1], compile_libs=false, compile_libs=true)
569 #endif SILC_DIST_CLIENTLIB
570 #ifdef SILC_DIST_SERVERLIB
571 PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
572 #endif SILC_DIST_SERVERLIB
574 if test x$compile_libs = xfalse; then
576 LIBS="$SILC_LIBS $LIBS"
577 CFLAGS="$CFLAGS $SILC_CFLAGS"
578 #ifdef SILC_DIST_CLIENTLIB
579 LIBS="$SILCCLIENT_LIBS $LIBS"
580 CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
581 #endif SILC_DIST_CLIENTLIB
582 #ifdef SILC_DIST_SERVERLIB
583 LIBS="$LIBS $SILCSERVER_LIBS"
584 CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
585 #endif SILC_DIST_SERVERLIB
587 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
590 #else SILC_DIST_TOOLKIT
591 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
592 #endif SILC_DIST_TOOLKIT
595 # SIM support checking
596 # XXX These needs to be changed as more supported platforms appear.
597 # XXX This probably needs to be made platform dependant check.
600 AC_MSG_CHECKING(for SIM support)
602 AC_CHECK_HEADERS(dlfcn.h,
604 AC_CHECK_LIB(dl, dlopen,
606 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
611 AC_CHECK_LIB(c, dlopen,
613 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
619 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
620 if test x$sim_support = xtrue; then
621 AC_MSG_RESULT(Enabled SIM support.)
622 __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
624 AC_MSG_RESULT(No SIM support found.)
628 # SOCKS4 support checking
631 SAVE_CFLAGS="$CFLAGS"
632 SAVE_LDFLAGS="$LDFLAGS"
633 AC_MSG_CHECKING(whether to support SOCKS4)
635 [[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
645 if test -d "$withval/include"; then
646 CFLAGS="$CFLAGS -I$withval/include"
648 if test -d "$withval/lib"; then
649 LDFLAGS="$LDFLAGS -L$withval/lib"
661 AC_MSG_ERROR(Could not find SOCKS4 library.)
663 CFLAGS="$SAVE_CFLAGS"
664 LDFLAGS="$SAVE_LDFLAGS"
670 # SOCKS5 support checking
673 SAVE_CFLAGS="$CFLAGS"
674 SAVE_LDFLAGS="$LDFLAGS"
675 AC_MSG_CHECKING(whether to support SOCKS5)
677 [[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
687 if test -d "$withval/include"; then
688 CFLAGS="$CFLAGS -I$withval/include"
690 if test -d "$withval/lib"; then
691 LDFLAGS="$LDFLAGS -L$withval/lib"
694 LIBS="-lsocks5 $LIBS"
703 AC_MSG_ERROR(Could not find SOCKS5 library.)
705 CFLAGS="$SAVE_CFLAGS"
706 LDFLAGS="$SAVE_LDFLAGS"
712 if test "x$socks" = "x4"; then
713 AC_DEFINE([SOCKS], [], [Socks])
714 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
717 if test "x$socks" = "x5"; then
718 AC_DEFINE([SOCKS], [], [Socks])
719 AC_DEFINE([SOCKS5], [], [Socks5])
720 AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
721 AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
722 AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
723 AC_DEFINE([Rbind], [SOCKSbind], [Socks])
724 AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
725 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
726 AC_DEFINE([Rselect], [SOCKSselect], [Socks])
727 AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
728 AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
729 AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
730 AC_DEFINE([Rsend], [SOCKSsend], [Socks])
731 AC_DEFINE([Rread], [SOCKSread], [Socks])
732 AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
733 AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
734 AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
735 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
736 AC_DEFINE([Rclose], [SOCKSclose], [Socks])
737 AC_DEFINE([Rdup], [SOCKSdup], [Socks])
738 AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
739 AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
740 AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
743 #ifdef SILC_DIST_MATH
744 # MP library checking. First check whether user wants to use GMP and use
745 # it if found. If not or not defined then compile the default library in the
750 SAVE_CFLAGS="$CFLAGS"
751 SAVE_LDFLAGS="$LDFLAGS"
752 AC_MSG_CHECKING(whether to search for GMP)
754 [[ --with-gmp[=DIR] use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
763 if test -d "$withval/include"; then
764 CFLAGS="$CFLAGS -I$withval/include"
766 if test -d "$withval/lib"; then
767 LDFLAGS="$LDFLAGS -L$withval/lib"
774 AC_CHECK_LIB(gmp, __gmpz_init,
777 AC_DEFINE([SILC_MP_GMP], [], [GMP])
778 AC_MSG_RESULT(Using GMP as a MP library.)
782 CFLAGS="$SAVE_CFLAGS"
783 LDFLAGS="$SAVE_LDFLAGS"
789 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
790 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
791 if test x$mp_gmp = xfalse; then
792 AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
793 AC_MSG_RESULT(Using SILC Math as a MP library.)
795 #endif SILC_DIST_MATH
802 SAVE_CFLAGS="$CFLAGS"
803 SAVE_LDFLAGS="$LDFLAGS"
804 SAVE_CPPFLAGS="$CPPFLAGS"
805 AC_MSG_CHECKING(whether to implicit search for libiconv)
807 [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
812 AC_CHECK_HEADERS(iconv.h,
814 AC_CHECK_FUNC(iconv, has_iconv=true)
820 if test -d $withval/include; then
821 CPPFLAGS="$CPPFLAGS -I$withval/include"
822 CFLAGS="$CFLAGS -I$withval/include"
824 if test -d $withval/lib; then
825 LDFLAGS="$LDFLAGS -L$withval/lib"
832 AC_CHECK_HEADERS(iconv.h,
834 AC_CHECK_FUNCS(iconv,
842 if test x$check_iconv = xtrue; then
843 AC_MSG_RESULT(Searching for iconv...)
846 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
848 AC_CHECK_HEADERS(iconv.h,
851 AC_MSG_CHECKING(for iconv in -liconv)
858 iconv_t cd = iconv_open("", "");
859 iconv(cd, NULL, NULL, NULL, NULL);
864 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
871 CFLAGS="$SAVE_CFLAGS"
872 LDFLAGS="$SAVE_LDFLAGS"
873 CPPFLAGS="$SAVE_CPPFLAGS"
878 if test x$check_iconv = xtrue; then
879 # search for iconv library..
881 SAVE_CFLAGS="$CFLAGS"
882 SAVE_LDFLAGS="$LDFLAGS"
883 SAVE_CPPFLAGS="$CPPFLAGS"
885 for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
886 if test x$has_iconv = xfalse; then
887 AC_MSG_RESULT(searching in $dir...)
889 if test -d $dir/include; then
890 CPPFLAGS="$CPPFLAGS -I$dir/include"
891 CFLAGS="$CFLAGS -I$dir/include"
893 if test -d $dir/lib; then
894 LDFLAGS="$LDFLAGS -L$dir/lib"
898 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
900 AC_CHECK_HEADERS(iconv.h,
903 AC_MSG_CHECKING(for iconv in -liconv)
910 iconv_t cd = iconv_open("", "");
911 iconv(cd, NULL, NULL, NULL, NULL);
917 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
924 CFLAGS="$SAVE_CFLAGS"
925 LDFLAGS="$SAVE_LDFLAGS"
926 CPPFLAGS="$SAVE_CPPFLAGS"
930 CFLAGS="$SAVE_CFLAGS"
931 LDFLAGS="$SAVE_LDFLAGS"
932 CPPFLAGS="$SAVE_CPPFLAGS"
938 if test x$has_iconv = xtrue; then
939 # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
940 # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
941 # obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
943 AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
954 ob = buf, obl = sizeof(buf);
955 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
956 (iconv(cd, 0, 0, &ob, &obl) ||
957 !(ob == buf && obl == sizeof(buf)) ||
972 if test x$ac_iconv_good = xno; then
973 AC_MSG_RESULT(Try using libiconv instead.)
977 # POSIX threads support
979 AC_MSG_CHECKING(whether to search for POSIX threads)
980 AC_ARG_WITH(pthreads,
981 [[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
988 if test -d $withval/include; then
989 CPPFLAGS="$CPPFLAGS -I$withval/include"
990 CFLAGS="$CFLAGS -I$withval/include"
992 if test -d $withval/lib; then
993 LDFLAGS="$LDFLAGS -L$withval/lib"
1001 if test x$check_threads = xtrue; then
1004 SAVE_CFLAGS="$CFLAGS"
1005 SAVE_LDFLAGS="$LDFLAGS"
1006 SAVE_CPPFLAGS="$CPPFLAGS"
1009 AC_CHECK_HEADERS(pthread.h,
1011 LIBS="$LIBS -lpthread"
1012 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1017 LIBS="$SAVE_LIBS -pthread"
1018 AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1027 # search for pthread library..
1028 for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1029 if test x$has_threads = xfalse; then
1030 AC_MSG_RESULT(searching in $dir...)
1032 if test -d $dir/include; then
1033 CPPFLAGS="$CPPFLAGS -I$dir/include"
1034 CFLAGS="$CFLAGS -I$dir/include"
1036 if test -d $dir/lib; then
1037 LDFLAGS="$LDFLAGS -L$dir/lib"
1041 unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1043 AC_CHECK_HEADERS(pthread.h,
1045 LIBS="$LIBS -lpthread"
1046 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1051 CFLAGS="$SAVE_CFLAGS"
1052 LDFLAGS="$SAVE_LDFLAGS"
1053 CPPFLAGS="$SAVE_CPPFLAGS"
1057 CFLAGS="$SAVE_CFLAGS"
1058 LDFLAGS="$SAVE_LDFLAGS"
1059 CPPFLAGS="$SAVE_CPPFLAGS"
1069 __SILC_HAVE_PTHREAD=""
1070 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1071 if test x$has_threads = xtrue; then
1072 CFLAGS="$CFLAGS -D_REENTRANT"
1074 # XXX possibly incomplete
1077 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1078 if test x"$GCC" = xyes; then
1079 CFLAGS="$CFLAGS -mthreads"
1083 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1085 *-*-sysv5uw7*) # UnixWare 7
1086 if test "$GCC" != "yes"; then
1087 CFLAGS="$CFLAGS -Kthread"
1089 CFLAGS="$CFLAGS -pthread"
1093 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1098 AC_CHECK_FUNC(pthread_create)
1100 # Check for read/write locks
1101 AC_CHECK_FUNC(pthread_rwlock_init,
1105 #include <pthread.h>
1108 pthread_rwlock_t rwlock;
1109 pthread_rwlock_init(&rwlock, NULL);
1110 pthread_rwlock_destroy(&rwlock);
1116 # Rwlock not defined
1117 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1122 # Rwlock not defined
1123 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1126 AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1127 AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1128 __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1132 # Check for timezone and tm_gmtoff for timezone information
1134 AC_MSG_CHECKING(whether system has timezone)
1145 [ AC_MSG_RESULT(yes)
1146 AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
1147 [ AC_MSG_RESULT(no) ],
1148 [ AC_MSG_RESULT(no) ]
1150 AC_MSG_CHECKING(whether system has tm_gmtoff)
1162 [ AC_MSG_RESULT(yes)
1163 AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
1164 [ AC_MSG_RESULT(no) ],
1165 [ AC_MSG_RESULT(no) ]
1167 AC_MSG_CHECKING(whether system has __tm_gmtoff)
1179 [ AC_MSG_RESULT(yes)
1180 AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
1181 [ AC_MSG_RESULT(no) ],
1182 [ AC_MSG_RESULT(no) ]
1184 AC_MSG_CHECKING(whether system has __tm_gmtoff__)
1192 tm.__tm_gmtoff__ = 0;
1196 [ AC_MSG_RESULT(yes)
1197 AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
1198 [ AC_MSG_RESULT(no) ],
1199 [ AC_MSG_RESULT(no) ]
1202 # Native WIN32 compilation under cygwin
1204 AC_MSG_CHECKING(whether to compile native WIN32 code)
1206 [ --with-win32 compile native WIN32 (MinGW) code (-mno-cygwin)],
1209 AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1211 CFLAGS="-mno-cygwin $CFLAGS"
1212 LIBS="$LIBS -lwsock32"
1217 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1219 # Native Symbian OS support (disabled by default)
1221 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
1223 # Native BeOS support (disabled by default)
1225 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1227 # Native OS2 support (disabled by default)
1229 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1231 #ifdef SILC_DIST_SERVER
1233 #endif SILC_DIST_SERVER
1234 #ifdef SILC_DIST_CLIENT
1235 AM_CONDITIONAL(with_irssi, true)
1236 #endif SILC_DIST_CLIENT
1237 #ifdef SILC_DIST_INPLACE
1240 #endif SILC_DIST_INPLACE
1243 AC_MSG_CHECKING(whether to do libtoolfix)
1244 AC_ARG_WITH(libtoolfix,
1245 [ --without-libtoolfix Do not fix libtool, for package builders],
1255 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1256 #endif SILC_DIST_COMPILER
1262 # Make enable-shared aware
1263 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1265 SILC_TOP_SRCDIR=`pwd`
1267 # Included configure scripts
1268 AD_INCLUDE_CONFIGURE
1270 #ifdef SILC_DIST_COMPILER
1275 AC_SUBST(SILC_TOP_SRCDIR)
1278 AC_SUBST(SILC_LIB_INCLUDES)
1279 AC_SUBST(__SILC_HAVE_PTHREAD)
1280 AC_SUBST(__SILC_HAVE_SIM)
1281 AC_SUBST(__SILC_ENABLE_DEBUG)
1284 # Fix the libtool to support run-time configuration. This allows us
1285 # to in run-time specify when to compile shared/static libraries without
1286 # need to reconfigure the entire libtool.
1288 if test x$libtoolfix = xtrue; then
1289 ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
1291 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
1293 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1294 AC_SUBST(INCLUDE_DEFINES_INT)
1296 #endif SILC_DIST_COMPILER
1303 #ifdef SILC_DIST_DOC
1305 #endif SILC_DIST_DOC
1306 #ifdef SILC_DIST_COMPILER
1308 Makefile.defines_int
1310 includes/silcversion.h
1312 #endif SILC_DIST_COMPILER
1313 #ifdef SILC_DIST_APPS
1315 #endif SILC_DIST_APPS
1318 #ifdef SILC_DIST_TOOLKIT
1321 win32/libsilc/Makefile
1322 win32/libsilcclient/Makefile
1324 tutorial/Makefile.defines
1325 tutorial/Makefile.defines_int
1327 #endif SILC_DIST_TOOLKIT
1331 #ifdef SILC_DIST_COMPILER
1332 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1333 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1334 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1335 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1338 echo "$PACKAGE Configuration Summary:"
1339 echo "---------------------------"
1340 echo " Target host ...................: $target"
1341 echo " Compiler ......................: $CC"
1342 echo " CFLAGS ........................: $CFLAGS"
1343 echo " LDFLAGS .......................: $LDFLAGS"
1344 echo " LIBS ..........................: $LIBS"
1346 echo " Installation prefix ...........: $prefix"
1347 echo " bin directory .................: $s_bindir"
1348 echo " sbin directory ................: $s_sbindir"
1349 echo " etc directory .................: $ETCDIR"
1350 echo " man directory .................: $s_mandir"
1351 echo " doc directory .................: $DOCDIR"
1352 #ifdef SILC_DIST_SIM
1353 echo " SIM directory .................: $MODULESDIR"
1354 #endif SILC_DIST_SIM
1355 #ifdef SILC_DIST_INCLUDES
1356 echo " include directory .............: $s_includedir"
1357 #endif SILC_DIST_INCLUDES
1360 #ifdef SILC_DIST_CLIENT
1361 if test x$without_irssi = xtrue; then
1364 echo " Compile SILC Client ...........: $irssi"
1365 #endif SILC_DIST_CLIENT
1367 #ifdef SILC_DIST_SERVER
1368 if test x$without_silcd = xtrue; then
1371 echo " Compile SILC Server ...........: $silcd"
1372 #endif SILC_DIST_SERVER
1374 #ifdef SILC_DIST_SIM
1375 if test x$sim_support = xfalse; then
1380 echo " SIM support ...................: $sim_support"
1381 #endif SILC_DIST_SIM
1383 echo " IPv6 support ..................: $summary_ipv6"
1385 if test x$has_iconv = xfalse; then
1390 echo " Iconv support .................: $iconv_support"
1392 if test x$want_asm = xfalse; then
1397 echo " Assembler optimizations .......: $summary_asm"
1399 #ifdef SILC_DIST_MATH
1400 if test x$mp_gmp = xtrue; then
1401 echo " Arithmetic library ............: GMP"
1403 #endif SILC_DIST_MATH
1406 if test x$has_threads = xtrue; then
1409 echo " Multi-threads support .........: $threads"
1410 echo " Debugging enabled .............: $summary_debug"
1412 echo "Compile the sources with 'make' or 'gmake' command."
1413 #endif SILC_DIST_COMPILER