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
55 AC_DEFINE([SILC_I386], [], [SILC_I386])
56 AC_DEFINE([SILC_I486], [], [SILC_I486])
61 AC_DEFINE([SILC_I486], [], [SILC_I486])
65 AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
69 AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
73 AC_DEFINE([SILC_IA64], [], [SILC_IA64])
77 AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
78 AM_CONDITIONAL(SILC_I486, test x$cpu_ix86 = xtrue)
79 AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
80 AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
81 AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
83 # Control compiler optimizations
84 CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
90 __SILC_HAVE_PTHREAD=""
92 __SILC_ENABLE_DEBUG=""
95 #ifndef SILC_DIST_TOOLKIT
97 #endif SILC_DIST_TOOLKIT
98 #ifdef SILC_DIST_INPLACE
100 #endif SILC_DIST_INPLACE
109 # More header checking
111 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
112 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
113 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
114 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
115 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
116 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
126 AC_CHECK_SIZEOF(long long, 0)
127 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
128 AC_CHECK_SIZEOF(long, 0)
129 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
130 AC_CHECK_SIZEOF(int, 0)
131 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
132 AC_CHECK_SIZEOF(short, 0)
133 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
134 AC_CHECK_SIZEOF(char, 0)
135 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
136 AC_CHECK_SIZEOF(void *, 0)
137 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
138 AC_CHECK_TYPES(long long)
139 AC_CHECK_TYPES(long double)
141 # Function to check if compiler flag works
142 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
143 AC_DEFUN([SILC_ADD_CFLAGS],
144 [ tmp_CFLAGS="$CFLAGS"
146 AC_MSG_CHECKING(whether $CC accepts $1 flag)
147 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
153 # Function to check if compiler flag works, destination specifiable
154 # Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
155 AC_DEFUN([SILC_ADD_CC_FLAGS],
156 [ tmp_CFLAGS="$1_CFLAGS"
157 $1_CFLAGS="${$1_CFLAGS} $2"
158 AC_MSG_CHECKING(whether $CC accepts $2 flag)
159 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
160 $1_CFLAGS="$tmp_CFLAGS"
165 # Function and library checking
167 AC_CHECK_FUNC(gethostbyname, [],
169 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
170 AC_CHECK_FUNC(res_gethostbyname, [],
171 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
174 AC_CHECK_FUNC(socket, [],
175 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
177 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
178 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
179 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
180 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
181 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
182 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo epoll_wait nanosleep)
183 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
186 # SIM support checking
187 # XXX These needs to be changed as more supported platforms appear.
188 # XXX This probably needs to be made platform dependant check.
191 AC_MSG_CHECKING(for SIM support)
193 AC_CHECK_HEADERS(dlfcn.h,
195 AC_CHECK_LIB(dl, dlopen,
197 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
202 AC_CHECK_LIB(c, dlopen,
204 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
210 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
211 if test x$sim_support = xtrue; then
212 AC_MSG_RESULT(Enabled SIM support.)
213 __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
215 AC_MSG_RESULT(No SIM support found.)
219 # lib/contrib conditionals
221 AC_CHECK_HEADER(regex.h,
223 AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
227 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
229 AC_CHECK_FUNC(getopt_long,
231 AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
233 ], have_getopt_long=0
236 AC_CHECK_FUNC(getopt,
238 AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
244 ## Enable/disable checking
249 AC_MSG_CHECKING(whether to enable IPv6 support)
251 [ --enable-ipv6 enable IPv6 support],
253 case "${enableval}" in
258 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
272 if test x$check_ipv6 = xtrue; then
276 #ifdef HAVE_SYS_TYPES_H
277 #include <sys/types.h>
279 #ifdef HAVE_NETINET_TCP_H
280 #include <netinet/tcp.h>
285 #include <sys/socket.h>
286 #ifdef HAVE_NETINET_IN_H
287 #include <netinet/in.h>
291 struct sockaddr_in6 sin6;
292 int family = AF_INET6;
295 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
305 AC_MSG_CHECKING(whether to enable debugging)
307 __SILC_ENABLE_DEBUG=""
309 [ --enable-debug enable debugging],
311 case "${enableval}" in
314 AC_DEFINE([SILC_DEBUG], [], [enable-debug])
316 __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
327 # Disable all assembler optimizations
329 AC_MSG_CHECKING(whether to enable assembler optimizations)
332 [ --disable-asm do not use assembler optimizations],
335 AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
342 AM_CONDITIONAL(SILC_NO_ASM, test x$want_asm = xfalse)
344 # Check for assembler
348 if test x$want_asm = xtrue; then
349 AC_PATH_PROG([NASM], [nasm], [no])
350 if test "x$NASM" != "xno"; then
351 SILC_ASSEMBLER="$NASM -O2 -felf"
355 AC_PATH_PROG([YASM], [yasm], [no])
356 if test "x$YASM" != "xno"; then
357 SILC_ASSEMBLER="$YASM -Xgnu -felf"
361 AC_SUBST(SILC_ASSEMBLER)
367 AC_MSG_CHECKING(for va_copy)
379 if (va_arg(cp, int) != 0xff11)
391 AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
401 if test x$va_copy = xfalse; then
402 AC_MSG_CHECKING(for __va_copy)
414 if (va_arg(cp, int) != 0xff11)
426 AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
437 if test x$va_copy = xfalse; then
447 if (va_arg(cp, int) != 0xff11)
460 AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
467 ## Compiler and compiler flag checks
471 # GCC specific options
472 if test "x$summary_debug" = "xyes"; then
473 SILC_ADD_CFLAGS(-g -O)
475 SILC_ADD_CFLAGS(-g -O2)
477 SILC_ADD_CFLAGS(-Wall -finline-functions)
478 SILC_ADD_CFLAGS(-Wno-pointer-sign)
483 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
486 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
490 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
494 # Intel C++ Compiler needs -restrict
495 if test "x$CC" = "xicc"; then
496 SILC_ADD_CFLAGS(-restrict)
501 # Workaround a bug in GCC 2.x which causes memory exhaustion
502 # when compiling sha1 with optimizations on UltraSPARC.
505 if test "$GCC" -a "$host_cpu" = "sparc64"; then
506 AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
509 #if defined(__sparc64__) && (__GNUC__ == 2)
523 #endif SILC_DIST_COMPILER
529 # Default installation destination
531 #ifdef SILC_DIST_AUTODIST
532 AC_PREFIX_DEFAULT(/usr/local)
533 #else !SILC_DIST_AUTODIST
534 AC_PREFIX_DEFAULT(/usr/local/silc)
535 #endif SILC_DIST_AUTODIST
536 if test "x$prefix" != xNONE; then
537 silc_prefix="$prefix"
539 silc_prefix="$ac_default_prefix"
542 #ifndef SILC_DIST_AUTODIST
545 if test "x$sysconfdir" != 'x${prefix}/etc'; then
548 ETCDIR="$silc_prefix/etc"
552 [[ --with-etcdir=DIR directory for system files [/etc/silc]]],
563 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
567 DOCDIR="$silc_prefix/doc"
569 [[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
580 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
581 #endif SILC_DIST_AUTODIST
583 #ifdef SILC_DIST_COMPILER
585 ## With/without checkings
589 # SILC library checking
593 #ifndef SILC_DIST_TOOLKIT
594 AC_ARG_WITH(silc-includes,
595 [ --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
596 [ac_silc_includes="$withval"], [ac_silc_includes="no"])
597 AC_ARG_WITH(silc-libs,
598 [ --with-silc-libs=DIR SILC Toolkit libraries [search in DIR]],
599 [ac_silc_libs="$withval"], [ac_silc_libs="no"])
601 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
603 # Manually provided libs
604 if test "$ac_silc_includes" != "no"; then
606 SILC_LIB_INCLUDES="-I$ac_silc_includes"
609 if test "$ac_silc_libs" != "no"; then
612 LIBS="$LIBS -L$ac_silc_libs"
615 # Check libs to link against
616 f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
617 if test -n "$f"; then
618 LIBS="$LIBS -lpthread"
622 f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
623 if test -n "$f"; then
629 PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
630 #ifdef SILC_DIST_CLIENTLIB
631 PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
632 #endif SILC_DIST_CLIENTLIB
633 #ifdef SILC_DIST_SERVERLIB
634 PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
635 #endif SILC_DIST_SERVERLIB
637 if test x$compile_libs = xfalse; then
639 LIBS="$LIBS $SILC_LIBS"
640 CFLAGS="$CFLAGS $SILC_CFLAGS"
641 #ifdef SILC_DIST_CLIENTLIB
642 LIBS="$LIBS $SILCCLIENT_LIBS"
643 CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
644 #endif SILC_DIST_CLIENTLIB
645 #ifdef SILC_DIST_SERVERLIB
646 LIBS="$LIBS $SILCSERVER_LIBS"
647 CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
648 #endif SILC_DIST_SERVERLIB
651 #endif SILC_DIST_TOOLKIT
655 # SOCKS4 support checking
658 SAVE_CFLAGS="$CFLAGS"
659 SAVE_LDFLAGS="$LDFLAGS"
660 AC_MSG_CHECKING(whether to support SOCKS4)
662 [[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
672 if test -d "$withval/include"; then
673 CFLAGS="$CFLAGS -I$withval/include"
675 if test -d "$withval/lib"; then
676 LDFLAGS="$LDFLAGS -L$withval/lib"
688 AC_MSG_ERROR(Could not find SOCKS4 library.)
690 CFLAGS="$SAVE_CFLAGS"
691 LDFLAGS="$SAVE_LDFLAGS"
697 # SOCKS5 support checking
700 SAVE_CFLAGS="$CFLAGS"
701 SAVE_LDFLAGS="$LDFLAGS"
702 AC_MSG_CHECKING(whether to support SOCKS5)
704 [[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
714 if test -d "$withval/include"; then
715 CFLAGS="$CFLAGS -I$withval/include"
717 if test -d "$withval/lib"; then
718 LDFLAGS="$LDFLAGS -L$withval/lib"
721 LIBS="-lsocks5 $LIBS"
730 AC_MSG_ERROR(Could not find SOCKS5 library.)
732 CFLAGS="$SAVE_CFLAGS"
733 LDFLAGS="$SAVE_LDFLAGS"
739 if test "x$socks" = "x4"; then
740 AC_DEFINE([SOCKS], [], [Socks])
741 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
744 if test "x$socks" = "x5"; then
745 AC_DEFINE([SOCKS], [], [Socks])
746 AC_DEFINE([SOCKS5], [], [Socks5])
747 AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
748 AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
749 AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
750 AC_DEFINE([Rbind], [SOCKSbind], [Socks])
751 AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
752 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
753 AC_DEFINE([Rselect], [SOCKSselect], [Socks])
754 AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
755 AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
756 AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
757 AC_DEFINE([Rsend], [SOCKSsend], [Socks])
758 AC_DEFINE([Rread], [SOCKSread], [Socks])
759 AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
760 AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
761 AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
762 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
763 AC_DEFINE([Rclose], [SOCKSclose], [Socks])
764 AC_DEFINE([Rdup], [SOCKSdup], [Socks])
765 AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
766 AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
767 AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
770 #ifdef SILC_DIST_MATH
771 # MP library checking. First check whether user wants to use GMP and use
772 # it if found. If not or not defined then compile the default library in the
777 SAVE_CFLAGS="$CFLAGS"
778 SAVE_LDFLAGS="$LDFLAGS"
779 AC_MSG_CHECKING(whether to search for GMP)
781 [[ --with-gmp[=DIR] use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
790 if test -d "$withval/include"; then
791 CFLAGS="$CFLAGS -I$withval/include"
793 if test -d "$withval/lib"; then
794 LDFLAGS="$LDFLAGS -L$withval/lib"
801 AC_CHECK_LIB(gmp, __gmpz_init,
804 AC_DEFINE([SILC_MP_GMP], [], [GMP])
805 AC_MSG_RESULT(Using GMP as a MP library.)
809 CFLAGS="$SAVE_CFLAGS"
810 LDFLAGS="$SAVE_LDFLAGS"
816 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
817 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
818 if test x$mp_gmp = xfalse; then
819 AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
820 AC_MSG_RESULT(Using SILC Math as a MP library.)
822 #endif SILC_DIST_MATH
829 SAVE_CFLAGS="$CFLAGS"
830 SAVE_LDFLAGS="$LDFLAGS"
831 SAVE_CPPFLAGS="$CPPFLAGS"
832 AC_MSG_CHECKING(whether to implicit search for libiconv)
834 [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
839 AC_CHECK_HEADERS(iconv.h,
841 AC_CHECK_FUNC(iconv, has_iconv=true)
847 if test -d $withval/include; then
848 CPPFLAGS="$CPPFLAGS -I$withval/include"
849 CFLAGS="$CFLAGS -I$withval/include"
851 if test -d $withval/lib; then
852 LDFLAGS="$LDFLAGS -L$withval/lib"
859 AC_CHECK_HEADERS(iconv.h,
861 AC_CHECK_FUNCS(iconv,
869 if test x$check_iconv = xtrue; then
870 AC_MSG_RESULT(Searching for iconv...)
873 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
875 AC_CHECK_HEADERS(iconv.h,
878 AC_MSG_CHECKING(for iconv in -liconv)
885 iconv_t cd = iconv_open("", "");
886 iconv(cd, NULL, NULL, NULL, NULL);
891 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
898 CFLAGS="$SAVE_CFLAGS"
899 LDFLAGS="$SAVE_LDFLAGS"
900 CPPFLAGS="$SAVE_CPPFLAGS"
905 if test x$check_iconv = xtrue; then
906 # search for iconv library..
908 SAVE_CFLAGS="$CFLAGS"
909 SAVE_LDFLAGS="$LDFLAGS"
910 SAVE_CPPFLAGS="$CPPFLAGS"
912 for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
913 if test x$has_iconv = xfalse; then
914 AC_MSG_RESULT(searching in $dir...)
916 if test -d $dir/include; then
917 CPPFLAGS="$CPPFLAGS -I$dir/include"
918 CFLAGS="$CFLAGS -I$dir/include"
920 if test -d $dir/lib; then
921 LDFLAGS="$LDFLAGS -L$dir/lib"
925 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
927 AC_CHECK_HEADERS(iconv.h,
930 AC_MSG_CHECKING(for iconv in -liconv)
937 iconv_t cd = iconv_open("", "");
938 iconv(cd, NULL, NULL, NULL, NULL);
944 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
951 CFLAGS="$SAVE_CFLAGS"
952 LDFLAGS="$SAVE_LDFLAGS"
953 CPPFLAGS="$SAVE_CPPFLAGS"
957 CFLAGS="$SAVE_CFLAGS"
958 LDFLAGS="$SAVE_LDFLAGS"
959 CPPFLAGS="$SAVE_CPPFLAGS"
965 if test x$has_iconv = xtrue; then
966 # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
967 # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
968 # obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
970 AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
981 ob = buf, obl = sizeof(buf);
982 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
983 (iconv(cd, 0, 0, &ob, &obl) ||
984 !(ob == buf && obl == sizeof(buf)) ||
999 if test x$ac_iconv_good = xno; then
1000 AC_MSG_RESULT(Try using libiconv instead.)
1004 # POSIX threads support
1006 AC_MSG_CHECKING(whether to search for POSIX threads)
1007 AC_ARG_WITH(pthreads,
1008 [[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
1010 case "${withval}" in
1015 if test -d $withval/include; then
1016 CPPFLAGS="$CPPFLAGS -I$withval/include"
1017 CFLAGS="$CFLAGS -I$withval/include"
1019 if test -d $withval/lib; then
1020 LDFLAGS="$LDFLAGS -L$withval/lib"
1028 if test x$check_threads = xtrue; then
1031 SAVE_CFLAGS="$CFLAGS"
1032 SAVE_LDFLAGS="$LDFLAGS"
1033 SAVE_CPPFLAGS="$CPPFLAGS"
1036 AC_CHECK_HEADERS(pthread.h,
1038 LIBS="$LIBS -lpthread"
1039 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1044 LIBS="$SAVE_LIBS -pthread"
1045 AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1054 # search for pthread library..
1055 for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1056 if test x$has_threads = xfalse; then
1057 AC_MSG_RESULT(searching in $dir...)
1059 if test -d $dir/include; then
1060 CPPFLAGS="$CPPFLAGS -I$dir/include"
1061 CFLAGS="$CFLAGS -I$dir/include"
1063 if test -d $dir/lib; then
1064 LDFLAGS="$LDFLAGS -L$dir/lib"
1068 unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1070 AC_CHECK_HEADERS(pthread.h,
1072 LIBS="$LIBS -lpthread"
1073 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1078 CFLAGS="$SAVE_CFLAGS"
1079 LDFLAGS="$SAVE_LDFLAGS"
1080 CPPFLAGS="$SAVE_CPPFLAGS"
1084 CFLAGS="$SAVE_CFLAGS"
1085 LDFLAGS="$SAVE_LDFLAGS"
1086 CPPFLAGS="$SAVE_CPPFLAGS"
1096 __SILC_HAVE_PTHREAD=""
1097 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1098 if test x$has_threads = xtrue; then
1099 CFLAGS="$CFLAGS -D_REENTRANT"
1101 # XXX possibly incomplete
1104 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1105 if test x"$GCC" = xyes; then
1106 CFLAGS="$CFLAGS -mthreads"
1110 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1112 *-*-sysv5uw7*) # UnixWare 7
1113 if test "$GCC" != "yes"; then
1114 CFLAGS="$CFLAGS -Kthread"
1116 CFLAGS="$CFLAGS -pthread"
1120 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1124 AC_CHECK_FUNC(pthread_create)
1125 AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1126 AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1127 __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1130 # Native WIN32 compilation under cygwin
1132 AC_MSG_CHECKING(whether to compile native WIN32 code)
1134 [ --with-win32 compile native WIN32 (MinGW) code (-mno-cygwin)],
1137 AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1139 CFLAGS="-mno-cygwin $CFLAGS"
1140 LIBS="$LIBS -lwsock32"
1145 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1147 # Native Symbian OS support (disabled by default)
1149 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
1151 # Native BeOS support (disabled by default)
1153 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1155 # Native OS2 support (disabled by default)
1157 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1159 #ifdef SILC_DIST_TOOLKIT
1163 AC_MSG_CHECKING(whether to compile Irssi SILC Client)
1165 [ --with-irssi compile with Irssi SILC Client],
1174 AM_CONDITIONAL(with_irssi, test xwithout_irssi = xfalse)
1179 AC_MSG_CHECKING(whether to compile SILC Server)
1181 [ --with-silcd compile with SILC Server],
1190 #endif SILC_DIST_TOOLKIT
1191 #ifdef SILC_DIST_CLIENT
1192 AM_CONDITIONAL(with_irssi, true)
1193 #endif SILC_DIST_CLIENT
1194 #ifdef SILC_DIST_INPLACE
1197 #endif SILC_DIST_INPLACE
1200 AC_MSG_CHECKING(whether to do libtoolfix)
1201 AC_ARG_WITH(libtoolfix,
1202 [ --without-libtoolfix Do not fix libtool, for package builders],
1212 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1213 #endif SILC_DIST_COMPILER
1219 # Make enable-shared aware
1220 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1222 SILC_TOP_SRCDIR=`pwd`
1224 # Included configure scripts
1225 AD_INCLUDE_CONFIGURE
1227 #ifdef SILC_DIST_COMPILER
1231 AC_SUBST(SILC_TOP_SRCDIR)
1233 AC_SUBST(SILC_LIB_INCLUDES)
1234 AC_SUBST(__SILC_HAVE_PTHREAD)
1235 AC_SUBST(__SILC_HAVE_SIM)
1236 AC_SUBST(__SILC_ENABLE_DEBUG)
1239 # Fix the libtool to support run-time configuration. This allows us
1240 # to in run-time specify when to compile shared/static libraries without
1241 # need to reconfigure the entire libtool.
1243 if test x$libtoolfix = xtrue; then
1244 ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
1246 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
1248 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1249 AC_SUBST(INCLUDE_DEFINES_INT)
1251 #endif SILC_DIST_COMPILER
1258 #ifdef SILC_DIST_DOC
1260 #endif SILC_DIST_DOC
1261 #ifdef SILC_DIST_COMPILER
1263 Makefile.defines_int
1265 includes/silcversion.h
1267 #endif SILC_DIST_COMPILER
1268 #ifdef SILC_DIST_APPS
1270 #endif SILC_DIST_APPS
1273 #ifdef SILC_DIST_TOOLKIT
1276 win32/libsilc/Makefile
1277 win32/libsilcclient/Makefile
1279 tutorial/Makefile.defines
1280 tutorial/Makefile.defines_int
1282 #endif SILC_DIST_TOOLKIT
1286 #ifdef SILC_DIST_COMPILER
1287 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1288 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1289 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1290 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1293 echo "$PACKAGE Configuration Summary:"
1294 echo "---------------------------"
1295 echo " Target host ...................: $target"
1296 echo " Compiler ......................: $CC"
1297 echo " CFLAGS ........................: $CFLAGS"
1298 echo " LDFLAGS .......................: $LDFLAGS"
1299 echo " LIBS ..........................: $LIBS"
1301 echo " Installation prefix ...........: $prefix"
1302 echo " bin directory .................: $s_bindir"
1303 echo " sbin directory ................: $s_sbindir"
1304 echo " etc directory .................: $ETCDIR"
1305 echo " man directory .................: $s_mandir"
1306 echo " doc directory .................: $DOCDIR"
1307 #ifdef SILC_DIST_SIM
1308 echo " SIM directory .................: $MODULESDIR"
1309 #endif SILC_DIST_SIM
1310 #ifdef SILC_DIST_INCLUDES
1311 echo " include directory .............: $s_includedir"
1312 #endif SILC_DIST_INCLUDES
1315 #ifdef SILC_DIST_TOOLKIT
1316 if test x$without_irssi = xtrue; then
1319 if test x$without_silcd = xtrue; then
1322 #endif SILC_DIST_TOOLKIT
1324 #ifdef SILC_DIST_CLIENT
1325 echo " Compile SILC Client ...........: $irssi"
1326 #endif SILC_DIST_CLIENT
1328 #ifdef SILC_DIST_SERVER
1329 echo " Compile SILC Server ...........: $silcd"
1330 #endif SILC_DIST_SERVER
1332 #ifdef SILC_DIST_SIM
1333 if test x$sim_support = xfalse; then
1338 echo " SIM support ...................: $sim_support"
1339 #endif SILC_DIST_SIM
1341 echo " IPv6 support ..................: $summary_ipv6"
1343 if test x$has_iconv = xfalse; then
1348 echo " Iconv support .................: $iconv_support"
1350 if test x$want_asm = xfalse; then
1355 echo " Assembler optimizations .......: $summary_asm"
1357 #ifdef SILC_DIST_MATH
1358 if test x$mp_gmp = xtrue; then
1359 echo " Arithmetic library ............: GMP"
1361 #endif SILC_DIST_MATH
1364 if test x$has_threads = xtrue; then
1367 echo " Multi-threads support .........: $threads"
1368 echo " Debugging enabled .............: $summary_debug"
1370 echo "Compile the sources with 'make' or 'gmake' command."
1371 #endif SILC_DIST_COMPILER