4 # Author: Pekka Riikonen <priikone@silcnet.org>
6 # Copyright (C) 2000 - 2006 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
50 AC_DEFINE([SILC_I386], [], [SILC_I386])
51 AC_DEFINE([SILC_I486], [], [SILC_I486])
54 AC_DEFINE([SILC_I486], [], [SILC_I486])
57 AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
60 AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
63 AC_DEFINE([SILC_IA64], [], [SILC_IA64])
67 # Control compiler optimizations
68 CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
74 __SILC_HAVE_PTHREAD=""
76 __SILC_ENABLE_DEBUG=""
79 #ifndef SILC_DIST_TOOLKIT
81 #endif SILC_DIST_TOOLKIT
82 #ifdef SILC_DIST_INPLACE
84 #endif SILC_DIST_INPLACE
93 # More header checking
95 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
96 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
97 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
98 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
99 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
100 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
110 AC_CHECK_SIZEOF(long long, 0)
111 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
112 AC_CHECK_SIZEOF(long, 0)
113 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
114 AC_CHECK_SIZEOF(int, 0)
115 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
116 AC_CHECK_SIZEOF(short, 0)
117 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
118 AC_CHECK_SIZEOF(char, 0)
119 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
120 AC_CHECK_SIZEOF(void *, 0)
121 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
123 # Function and library checking
125 AC_CHECK_FUNC(gethostbyname, [],
127 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
128 AC_CHECK_FUNC(res_gethostbyname, [],
129 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
132 AC_CHECK_FUNC(socket, [],
133 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
135 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
136 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
137 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
138 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
139 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
140 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo)
141 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
144 # SIM support checking
145 # XXX These needs to be changed as more supported platforms appear.
146 # XXX This probably needs to be made platform dependant check.
149 AC_MSG_CHECKING(for SIM support)
151 AC_CHECK_HEADERS(dlfcn.h,
153 AC_CHECK_LIB(dl, dlopen,
155 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
160 AC_CHECK_LIB(c, dlopen,
162 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
168 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
169 if test x$sim_support = xtrue; then
170 AC_MSG_RESULT(Enabled SIM support.)
171 __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
173 AC_MSG_RESULT(No SIM support found.)
177 # lib/contrib conditionals
179 AC_CHECK_HEADER(regex.h,
181 AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
185 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
187 AC_CHECK_FUNC(getopt_long,
189 AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
191 ], have_getopt_long=0
194 AC_CHECK_FUNC(getopt,
196 AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
202 ## Enable/disable checking
207 AC_MSG_CHECKING(whether to enable IPv6 support)
209 [ --enable-ipv6 enable IPv6 support],
211 case "${enableval}" in
216 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
230 if test x$check_ipv6 = xtrue; then
234 #ifdef HAVE_SYS_TYPES_H
235 #include <sys/types.h>
237 #ifdef HAVE_NETINET_TCP_H
238 #include <netinet/tcp.h>
243 #include <sys/socket.h>
244 #ifdef HAVE_NETINET_IN_H
245 #include <netinet/in.h>
249 struct sockaddr_in6 sin6;
250 int family = AF_INET6;
253 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
263 AC_MSG_CHECKING(whether to enable debugging)
265 __SILC_ENABLE_DEBUG=""
267 [ --enable-debug enable debugging],
269 case "${enableval}" in
272 AC_DEFINE([SILC_DEBUG], [], [enable-debug])
274 __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
285 # Disable all assembler optimizations
287 AC_MSG_CHECKING(whether to enable assembler optimizations)
290 [ --disable-asm do not use assembler optimizations],
304 AC_MSG_CHECKING(for va_copy)
316 if (va_arg(cp, int) != 0xff11)
328 AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
338 if test x$va_copy = xfalse; then
339 AC_MSG_CHECKING(for __va_copy)
351 if (va_arg(cp, int) != 0xff11)
363 AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
374 if test x$va_copy = xfalse; then
384 if (va_arg(cp, int) != 0xff11)
397 AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
404 ## Compiler and compiler flag checks
407 # Function to check if compiler flag works
408 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
409 AC_DEFUN([SILC_ADD_CFLAGS],
410 [ tmp_CFLAGS="$CFLAGS"
412 AC_MSG_CHECKING(whether $CC accepts $1 flag)
413 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
419 # Function to check if compiler flag works, destination specifiable
420 # Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
421 AC_DEFUN([SILC_ADD_CC_FLAGS],
422 [ tmp_CFLAGS="$1_CFLAGS"
423 $1_CFLAGS="${$1_CFLAGS} $2"
424 AC_MSG_CHECKING(whether $CC accepts $2 flag)
425 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
426 $1_CFLAGS="$tmp_CFLAGS"
432 # GCC specific options
433 if test "x$summary_debug" = "xyes"; then
434 SILC_ADD_CFLAGS(-g -O)
436 SILC_ADD_CFLAGS(-g -O2)
438 SILC_ADD_CFLAGS(-Wall -finline-functions)
439 SILC_ADD_CFLAGS(-Wno-pointer-sign)
444 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
447 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
451 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
455 # Intel C++ Compiler needs -restrict
456 if test "x$CC" = "xicc"; then
457 SILC_ADD_CFLAGS(-restrict)
462 # Workaround a bug in GCC 2.x which causes memory exhaustion
463 # when compiling sha1 with optimizations on UltraSPARC.
466 if test "$GCC" -a "$host_cpu" = "sparc64"; then
467 AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
470 #if defined(__sparc64__) && (__GNUC__ == 2)
484 #endif SILC_DIST_COMPILER
490 # Default installation destination
492 #ifdef SILC_DIST_AUTODIST
493 AC_PREFIX_DEFAULT(/usr/local)
494 #else !SILC_DIST_AUTODIST
495 AC_PREFIX_DEFAULT(/usr/local/silc)
496 #endif SILC_DIST_AUTODIST
497 if test "x$prefix" != xNONE; then
498 silc_prefix="$prefix"
500 silc_prefix="$ac_default_prefix"
503 #ifndef SILC_DIST_AUTODIST
506 if test "x$sysconfdir" != 'x${prefix}/etc'; then
509 ETCDIR="$silc_prefix/etc"
513 [[ --with-etcdir=DIR directory for system files [/etc/silc]]],
524 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
528 DOCDIR="$silc_prefix/doc"
530 [[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
541 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
542 #endif SILC_DIST_AUTODIST
544 #ifdef SILC_DIST_COMPILER
546 ## With/without checkings
550 # SILC library checking
554 #ifndef SILC_DIST_TOOLKIT
555 AC_ARG_WITH(silc-includes,
556 [ --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
557 [ac_silc_includes="$withval"], [ac_silc_includes="no"])
558 AC_ARG_WITH(silc-libs,
559 [ --with-silc-libs=DIR SILC Toolkit libraries [search in DIR]],
560 [ac_silc_libs="$withval"], [ac_silc_libs="no"])
562 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
564 # Manually provided libs
565 if test "$ac_silc_includes" != "no"; then
567 SILC_LIB_INCLUDES="-I$ac_silc_includes"
570 if test "$ac_silc_libs" != "no"; then
573 LIBS="$LIBS -L$ac_silc_libs"
576 # Check libs to link against
577 f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
578 if test -n "$f"; then
579 LIBS="$LIBS -lpthread"
583 f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
584 if test -n "$f"; then
590 PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
591 #ifdef SILC_DIST_CLIENTLIB
592 PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
593 #endif SILC_DIST_CLIENTLIB
594 #ifdef SILC_DIST_SERVERLIB
595 PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
596 #endif SILC_DIST_SERVERLIB
598 if test x$compile_libs = xfalse; then
600 LIBS="$LIBS $SILC_LIBS"
601 CFLAGS="$CFLAGS $SILC_CFLAGS"
602 #ifdef SILC_DIST_CLIENTLIB
603 LIBS="$LIBS $SILCCLIENT_LIBS"
604 CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
605 #endif SILC_DIST_CLIENTLIB
606 #ifdef SILC_DIST_SERVERLIB
607 LIBS="$LIBS $SILCSERVER_LIBS"
608 CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
609 #endif SILC_DIST_SERVERLIB
612 #endif SILC_DIST_TOOLKIT
616 # SOCKS4 support checking
619 SAVE_CFLAGS="$CFLAGS"
620 SAVE_LDFLAGS="$LDFLAGS"
621 AC_MSG_CHECKING(whether to support SOCKS4)
623 [[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
633 if test -d "$withval/include"; then
634 CFLAGS="$CFLAGS -I$withval/include"
636 if test -d "$withval/lib"; then
637 LDFLAGS="$LDFLAGS -L$withval/lib"
649 AC_MSG_ERROR(Could not find SOCKS4 library.)
651 CFLAGS="$SAVE_CFLAGS"
652 LDFLAGS="$SAVE_LDFLAGS"
658 # SOCKS5 support checking
661 SAVE_CFLAGS="$CFLAGS"
662 SAVE_LDFLAGS="$LDFLAGS"
663 AC_MSG_CHECKING(whether to support SOCKS5)
665 [[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
675 if test -d "$withval/include"; then
676 CFLAGS="$CFLAGS -I$withval/include"
678 if test -d "$withval/lib"; then
679 LDFLAGS="$LDFLAGS -L$withval/lib"
682 LIBS="-lsocks5 $LIBS"
691 AC_MSG_ERROR(Could not find SOCKS5 library.)
693 CFLAGS="$SAVE_CFLAGS"
694 LDFLAGS="$SAVE_LDFLAGS"
700 if test "x$socks" = "x4"; then
701 AC_DEFINE([SOCKS], [], [Socks])
702 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
705 if test "x$socks" = "x5"; then
706 AC_DEFINE([SOCKS], [], [Socks])
707 AC_DEFINE([SOCKS5], [], [Socks5])
708 AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
709 AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
710 AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
711 AC_DEFINE([Rbind], [SOCKSbind], [Socks])
712 AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
713 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
714 AC_DEFINE([Rselect], [SOCKSselect], [Socks])
715 AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
716 AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
717 AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
718 AC_DEFINE([Rsend], [SOCKSsend], [Socks])
719 AC_DEFINE([Rread], [SOCKSread], [Socks])
720 AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
721 AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
722 AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
723 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
724 AC_DEFINE([Rclose], [SOCKSclose], [Socks])
725 AC_DEFINE([Rdup], [SOCKSdup], [Socks])
726 AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
727 AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
728 AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
731 #ifdef SILC_DIST_MATH
732 # MP library checking. First check whether user wants to use GMP and use
733 # it if found. If not or not defined then compile the default library in the
738 SAVE_CFLAGS="$CFLAGS"
739 SAVE_LDFLAGS="$LDFLAGS"
740 AC_MSG_CHECKING(whether to search for GMP)
742 [[ --with-gmp[=DIR] use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
751 if test -d "$withval/include"; then
752 CFLAGS="$CFLAGS -I$withval/include"
754 if test -d "$withval/lib"; then
755 LDFLAGS="$LDFLAGS -L$withval/lib"
762 AC_CHECK_LIB(gmp, __gmpz_init,
765 AC_DEFINE([SILC_MP_GMP], [], [GMP])
766 AC_MSG_RESULT(Using GMP as a MP library.)
770 CFLAGS="$SAVE_CFLAGS"
771 LDFLAGS="$SAVE_LDFLAGS"
777 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
778 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
779 if test x$mp_gmp = xfalse; then
780 AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
781 AC_MSG_RESULT(Using SILC Math as a MP library.)
783 #endif SILC_DIST_MATH
790 SAVE_CFLAGS="$CFLAGS"
791 SAVE_LDFLAGS="$LDFLAGS"
792 SAVE_CPPFLAGS="$CPPFLAGS"
793 AC_MSG_CHECKING(whether to implicit search for libiconv)
795 [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
800 AC_CHECK_HEADERS(iconv.h,
802 AC_CHECK_FUNC(iconv, has_iconv=true)
808 if test -d $withval/include; then
809 CPPFLAGS="$CPPFLAGS -I$withval/include"
810 CFLAGS="$CFLAGS -I$withval/include"
812 if test -d $withval/lib; then
813 LDFLAGS="$LDFLAGS -L$withval/lib"
820 AC_CHECK_HEADERS(iconv.h,
822 AC_CHECK_FUNCS(iconv,
830 if test x$check_iconv = xtrue; then
831 AC_MSG_RESULT(Searching for iconv...)
834 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
836 AC_CHECK_HEADERS(iconv.h,
839 AC_MSG_CHECKING(for iconv in -liconv)
846 iconv_t cd = iconv_open("", "");
847 iconv(cd, NULL, NULL, NULL, NULL);
852 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
859 CFLAGS="$SAVE_CFLAGS"
860 LDFLAGS="$SAVE_LDFLAGS"
861 CPPFLAGS="$SAVE_CPPFLAGS"
866 if test x$check_iconv = xtrue; then
867 # search for iconv library..
869 SAVE_CFLAGS="$CFLAGS"
870 SAVE_LDFLAGS="$LDFLAGS"
871 SAVE_CPPFLAGS="$CPPFLAGS"
873 for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
874 if test x$has_iconv = xfalse; then
875 AC_MSG_RESULT(searching in $dir...)
877 if test -d $dir/include; then
878 CPPFLAGS="$CPPFLAGS -I$dir/include"
879 CFLAGS="$CFLAGS -I$dir/include"
881 if test -d $dir/lib; then
882 LDFLAGS="$LDFLAGS -L$dir/lib"
886 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
888 AC_CHECK_HEADERS(iconv.h,
891 AC_MSG_CHECKING(for iconv in -liconv)
898 iconv_t cd = iconv_open("", "");
899 iconv(cd, NULL, NULL, NULL, NULL);
905 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
912 CFLAGS="$SAVE_CFLAGS"
913 LDFLAGS="$SAVE_LDFLAGS"
914 CPPFLAGS="$SAVE_CPPFLAGS"
918 CFLAGS="$SAVE_CFLAGS"
919 LDFLAGS="$SAVE_LDFLAGS"
920 CPPFLAGS="$SAVE_CPPFLAGS"
926 if test x$has_iconv = xtrue; then
927 # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
928 # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
929 # obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
931 AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
942 ob = buf, obl = sizeof(buf);
943 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
944 (iconv(cd, 0, 0, &ob, &obl) ||
945 !(ob == buf && obl == sizeof(buf)) ||
960 if test x$ac_iconv_good = xno; then
961 AC_MSG_RESULT(Try using libiconv instead.)
965 # POSIX threads support
967 AC_MSG_CHECKING(whether to search for POSIX threads)
968 AC_ARG_WITH(pthreads,
969 [[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
976 if test -d $withval/include; then
977 CPPFLAGS="$CPPFLAGS -I$withval/include"
978 CFLAGS="$CFLAGS -I$withval/include"
980 if test -d $withval/lib; then
981 LDFLAGS="$LDFLAGS -L$withval/lib"
989 if test x$check_threads = xtrue; then
992 SAVE_CFLAGS="$CFLAGS"
993 SAVE_LDFLAGS="$LDFLAGS"
994 SAVE_CPPFLAGS="$CPPFLAGS"
997 AC_CHECK_HEADERS(pthread.h,
999 LIBS="$LIBS -lpthread"
1000 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1005 LIBS="$SAVE_LIBS -pthread"
1006 AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1015 # search for pthread library..
1016 for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1017 if test x$has_threads = xfalse; then
1018 AC_MSG_RESULT(searching in $dir...)
1020 if test -d $dir/include; then
1021 CPPFLAGS="$CPPFLAGS -I$dir/include"
1022 CFLAGS="$CFLAGS -I$dir/include"
1024 if test -d $dir/lib; then
1025 LDFLAGS="$LDFLAGS -L$dir/lib"
1029 unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1031 AC_CHECK_HEADERS(pthread.h,
1033 LIBS="$LIBS -lpthread"
1034 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1039 CFLAGS="$SAVE_CFLAGS"
1040 LDFLAGS="$SAVE_LDFLAGS"
1041 CPPFLAGS="$SAVE_CPPFLAGS"
1045 CFLAGS="$SAVE_CFLAGS"
1046 LDFLAGS="$SAVE_LDFLAGS"
1047 CPPFLAGS="$SAVE_CPPFLAGS"
1057 __SILC_HAVE_PTHREAD=""
1058 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1059 if test x$has_threads = xtrue; then
1060 CFLAGS="$CFLAGS -D_REENTRANT"
1062 # XXX possibly incomplete
1065 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1066 if test x"$GCC" = xyes; then
1067 CFLAGS="$CFLAGS -mthreads"
1071 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1073 *-*-sysv5uw7*) # UnixWare 7
1074 if test "$GCC" != "yes"; then
1075 CFLAGS="$CFLAGS -Kthread"
1077 CFLAGS="$CFLAGS -pthread"
1081 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1085 AC_CHECK_FUNC(pthread_create)
1086 AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1087 AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1088 __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1091 # Native WIN32 compilation under cygwin
1093 AC_MSG_CHECKING(whether to compile native WIN32 code)
1095 [ --with-win32 compile native WIN32 (MinGW) code (-mno-cygwin)],
1098 AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1100 CFLAGS="-mno-cygwin $CFLAGS"
1101 LIBS="$LIBS -lwsock32"
1106 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1108 # Native EPOC support (disabled by default)
1110 AM_CONDITIONAL(SILC_EPOC, test xfalse = xtrue)
1112 # Native BeOS support (disabled by default)
1114 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1116 # Native OS2 support (disabled by default)
1118 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1120 #ifdef SILC_DIST_TOOLKIT
1124 AC_MSG_CHECKING(whether to compile Irssi SILC Client)
1126 [ --with-irssi compile with Irssi SILC Client],
1135 AM_CONDITIONAL(with_irssi, test xwithout_irssi = xfalse)
1140 AC_MSG_CHECKING(whether to compile SILC Server)
1142 [ --with-silcd compile with SILC Server],
1151 #endif SILC_DIST_TOOLKIT
1152 #ifdef SILC_DIST_CLIENT
1153 AM_CONDITIONAL(with_irssi, true)
1154 #endif SILC_DIST_CLIENT
1155 #ifdef SILC_DIST_INPLACE
1158 #endif SILC_DIST_INPLACE
1161 AC_MSG_CHECKING(whether to do libtoolfix)
1162 AC_ARG_WITH(libtoolfix,
1163 [ --without-libtoolfix Do not fix libtool, for package builders],
1173 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1174 #endif SILC_DIST_COMPILER
1180 # Make enable-shared aware
1181 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1183 SILC_TOP_SRCDIR=`pwd`
1185 # Included configure scripts
1186 AD_INCLUDE_CONFIGURE
1188 #ifdef SILC_DIST_COMPILER
1192 AC_SUBST(SILC_TOP_SRCDIR)
1194 AC_SUBST(SILC_LIB_INCLUDES)
1195 AC_SUBST(__SILC_HAVE_PTHREAD)
1196 AC_SUBST(__SILC_HAVE_SIM)
1197 AC_SUBST(__SILC_ENABLE_DEBUG)
1200 # Fix the libtool to support run-time configuration. This allows us
1201 # to in run-time specify when to compile shared/static libraries without
1202 # need to reconfigure the entire libtool.
1204 if test x$libtoolfix = xtrue; then
1205 ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
1207 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
1209 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1210 AC_SUBST(INCLUDE_DEFINES_INT)
1212 #endif SILC_DIST_COMPILER
1219 #ifdef SILC_DIST_DOC
1221 #endif SILC_DIST_DOC
1222 #ifdef SILC_DIST_COMPILER
1224 Makefile.defines_int
1226 includes/silcversion.h
1228 #endif SILC_DIST_COMPILER
1229 #ifdef SILC_DIST_APPS
1231 #endif SILC_DIST_APPS
1234 #ifdef SILC_DIST_TOOLKIT
1237 win32/libsilc/Makefile
1238 win32/libsilcclient/Makefile
1240 tutorial/Makefile.defines
1241 tutorial/Makefile.defines_int
1243 #endif SILC_DIST_TOOLKIT
1247 #ifdef SILC_DIST_COMPILER
1248 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1249 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1250 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1251 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1254 echo "$PACKAGE Configuration Summary:"
1255 echo "---------------------------"
1256 echo " Target host ...................: $target"
1257 echo " Compiler ......................: $CC"
1258 echo " CFLAGS ........................: $CFLAGS"
1259 echo " LDFLAGS .......................: $LDFLAGS"
1260 echo " LIBS ..........................: $LIBS"
1262 echo " Installation prefix ...........: $prefix"
1263 echo " bin directory .................: $s_bindir"
1264 echo " sbin directory ................: $s_sbindir"
1265 echo " etc directory .................: $ETCDIR"
1266 echo " man directory .................: $s_mandir"
1267 echo " doc directory .................: $DOCDIR"
1268 #ifdef SILC_DIST_SIM
1269 echo " SIM directory .................: $MODULESDIR"
1270 #endif SILC_DIST_SIM
1271 #ifdef SILC_DIST_INCLUDES
1272 echo " include directory .............: $s_includedir"
1273 #endif SILC_DIST_INCLUDES
1276 #ifdef SILC_DIST_TOOLKIT
1277 if test x$without_irssi = xtrue; then
1280 if test x$without_silcd = xtrue; then
1283 #endif SILC_DIST_TOOLKIT
1285 #ifdef SILC_DIST_CLIENT
1286 echo " Compile SILC Client ...........: $irssi"
1287 #endif SILC_DIST_CLIENT
1289 #ifdef SILC_DIST_SERVER
1290 echo " Compile SILC Server ...........: $silcd"
1291 #endif SILC_DIST_SERVER
1293 #ifdef SILC_DIST_SIM
1294 if test x$sim_support = xfalse; then
1299 echo " SIM support ...................: $sim_support"
1300 #endif SILC_DIST_SIM
1302 echo " IPv6 support ..................: $summary_ipv6"
1304 if test x$has_iconv = xfalse; then
1309 echo " Iconv support .................: $iconv_support"
1311 if test x$want_asm = xfalse; then
1316 echo " Assembler optimizations .......: $summary_asm"
1318 #ifdef SILC_DIST_MATH
1319 if test x$mp_gmp = xtrue; then
1320 echo " Arithmetic library ............: GMP"
1322 #endif SILC_DIST_MATH
1325 if test x$has_threads = xtrue; then
1328 echo " Multi-threads support .........: $threads"
1329 echo " Debugging enabled .............: $summary_debug"
1331 echo "Compile the sources with 'make' or 'gmake' command."
1332 #endif SILC_DIST_COMPILER