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])
53 AC_DEFINE([SILC_I486], [], [SILC_I486])
56 AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
59 AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
62 AC_DEFINE([SILC_IA64], [], [SILC_IA64])
66 # Control compiler optimizations
67 CFLAGS=`echo $CFLAGS | sed 's/-O[ 0123456789s]*//g'`
73 __SILC_HAVE_PTHREAD=""
75 __SILC_ENABLE_DEBUG=""
78 #ifndef SILC_DIST_TOOLKIT
80 #endif SILC_DIST_TOOLKIT
81 #ifdef SILC_DIST_INPLACE
83 #endif SILC_DIST_INPLACE
92 # More header checking
94 AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
95 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
96 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
97 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
98 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
99 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
109 AC_CHECK_SIZEOF(long long, 0)
110 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
111 AC_CHECK_SIZEOF(long, 0)
112 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
113 AC_CHECK_SIZEOF(int, 0)
114 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
115 AC_CHECK_SIZEOF(short, 0)
116 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
117 AC_CHECK_SIZEOF(char, 0)
118 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
119 AC_CHECK_SIZEOF(void *, 0)
120 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
122 # Function and library checking
124 AC_CHECK_FUNC(gethostbyname, [],
126 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
127 AC_CHECK_FUNC(res_gethostbyname, [],
128 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
131 AC_CHECK_FUNC(socket, [],
132 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
134 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
135 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
136 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
137 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
138 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid)
139 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo)
140 AC_CHECK_FUNCS(strchr strstr strcpy strncpy memcpy memset memmove)
143 # SIM support checking
144 # XXX These needs to be changed as more supported platforms appear.
145 # XXX This probably needs to be made platform dependant check.
148 AC_MSG_CHECKING(for SIM support)
150 AC_CHECK_HEADERS(dlfcn.h,
152 AC_CHECK_LIB(dl, dlopen,
154 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
159 AC_CHECK_LIB(c, dlopen,
161 AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
167 AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
168 if test x$sim_support = xtrue; then
169 AC_MSG_RESULT(Enabled SIM support.)
170 __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
172 AC_MSG_RESULT(No SIM support found.)
176 # lib/contrib conditionals
178 AC_CHECK_HEADER(regex.h,
180 AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
184 AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
186 AC_CHECK_FUNC(getopt_long,
188 AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
190 ], have_getopt_long=0
193 AC_CHECK_FUNC(getopt,
195 AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
201 ## Enable/disable checking
206 AC_MSG_CHECKING(whether to enable IPv6 support)
208 [ --enable-ipv6 enable IPv6 support],
210 case "${enableval}" in
215 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
229 if test x$check_ipv6 = xtrue; then
233 #ifdef HAVE_SYS_TYPES_H
234 #include <sys/types.h>
236 #ifdef HAVE_NETINET_TCP_H
237 #include <netinet/tcp.h>
242 #include <sys/socket.h>
243 #ifdef HAVE_NETINET_IN_H
244 #include <netinet/in.h>
248 struct sockaddr_in6 sin6;
249 int family = AF_INET6;
252 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
262 AC_MSG_CHECKING(whether to enable debugging)
264 __SILC_ENABLE_DEBUG=""
266 [ --enable-debug enable debugging],
268 case "${enableval}" in
271 AC_DEFINE([SILC_DEBUG], [], [enable-debug])
273 __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
284 # Disable all assembler optimizations
286 AC_MSG_CHECKING(whether to enable assembler optimizations)
289 [ --disable-asm do not use assembler optimizations],
300 ## Compiler and compiler flag checks
303 # Function to check if compiler flag works
304 # Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
305 AC_DEFUN([SILC_ADD_CFLAGS],
306 [ tmp_CFLAGS="$CFLAGS"
308 AC_MSG_CHECKING(whether $CC accepts $1 flag)
309 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
315 # Function to check if compiler flag works, destination specifiable
316 # Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
317 AC_DEFUN([SILC_ADD_CC_FLAGS],
318 [ tmp_CFLAGS="$1_CFLAGS"
319 $1_CFLAGS="${$1_CFLAGS} $2"
320 AC_MSG_CHECKING(whether $CC accepts $2 flag)
321 AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
322 $1_CFLAGS="$tmp_CFLAGS"
328 # GCC specific options
329 if test "x$summary_debug" = "xyes"; then
330 SILC_ADD_CFLAGS(-g -O)
332 SILC_ADD_CFLAGS(-g -O2)
334 SILC_ADD_CFLAGS(-Wall -finline-functions)
335 SILC_ADD_CFLAGS(-Wno-pointer-sign)
340 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
343 SILC_ADD_CFLAGS(-g3 -O2, SILC_ADD_CFLAGS(-g3 -O, SILC_ADD_CFLAGS(-O)))
347 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
351 # Intel C++ Compiler needs -restrict
352 if test "x$CC" = "xicc"; then
353 SILC_ADD_CFLAGS(-restrict)
358 # Workaround a bug in GCC 2.x which causes memory exhaustion
359 # when compiling sha1 with optimizations on UltraSPARC.
362 if test "$GCC" -a "$host_cpu" = "sparc64"; then
363 AC_MSG_CHECKING(whether to enable GCC 2.x workaround for SHA1)
366 #if defined(__sparc64__) && (__GNUC__ == 2)
380 #endif SILC_DIST_COMPILER
386 # Default installation destination
388 #ifdef SILC_DIST_AUTODIST
389 AC_PREFIX_DEFAULT(/usr/local)
390 #else !SILC_DIST_AUTODIST
391 AC_PREFIX_DEFAULT(/usr/local/silc)
392 #endif SILC_DIST_AUTODIST
393 if test "x$prefix" != xNONE; then
394 silc_prefix="$prefix"
396 silc_prefix="$ac_default_prefix"
399 #ifndef SILC_DIST_AUTODIST
402 if test "x$sysconfdir" != 'x${prefix}/etc'; then
405 ETCDIR="$silc_prefix/etc"
409 [[ --with-etcdir=DIR directory for system files [/etc/silc]]],
420 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
424 DOCDIR="$silc_prefix/doc"
426 [[ --with-docdir=DIR directory for SILC documentation [PREFIX/doc]]],
437 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
438 #endif SILC_DIST_AUTODIST
440 #ifdef SILC_DIST_COMPILER
442 ## With/without checkings
446 # SILC library checking
450 #ifndef SILC_DIST_TOOLKIT
451 AC_ARG_WITH(silc-includes,
452 [ --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
453 [ac_silc_includes="$withval"], [ac_silc_includes="no"])
454 AC_ARG_WITH(silc-libs,
455 [ --with-silc-libs=DIR SILC Toolkit libraries [search in DIR]],
456 [ac_silc_libs="$withval"], [ac_silc_libs="no"])
458 if test -n "$with_silc_includes" || test -n "$with_silc_libs"; then
460 # Manually provided libs
461 if test "$ac_silc_includes" != "no"; then
463 SILC_LIB_INCLUDES="-I$ac_silc_includes"
466 if test "$ac_silc_libs" != "no"; then
469 LIBS="$LIBS -L$ac_silc_libs"
472 # Check libs to link against
473 f=`$EGREP __SILC_HAVE_PTHREAD $ac_silc_includes/silc.h`
474 if test -n "$f"; then
475 LIBS="$LIBS -lpthread"
479 f=`$EGREP __SILC_HAVE_SIM $ac_silc_includes/silc.h`
480 if test -n "$f"; then
486 PKG_CHECK_MODULES(SILC, silc, compile_libs=false, compile_libs=true)
487 #ifdef SILC_DIST_CLIENTLIB
488 PKG_CHECK_MODULES(SILCCLIENT, silcclient, compile_libs=false, compile_libs=true)
489 #endif SILC_DIST_CLIENTLIB
490 #ifdef SILC_DIST_SERVERLIB
491 PKG_CHECK_MODULES(SILCSERVER, silcserver, compile_libs=false, compile_libs=true)
492 #endif SILC_DIST_SERVERLIB
494 if test x$compile_libs = xfalse; then
496 LIBS="$LIBS $SILC_LIBS"
497 CFLAGS="$CFLAGS $SILC_CFLAGS"
498 #ifdef SILC_DIST_CLIENTLIB
499 LIBS="$LIBS $SILCCLIENT_LIBS"
500 CFLAGS="$CFLAGS $SILCCLIENT_CFLAGS"
501 #endif SILC_DIST_CLIENTLIB
502 #ifdef SILC_DIST_SERVERLIB
503 LIBS="$LIBS $SILCSERVER_LIBS"
504 CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
505 #endif SILC_DIST_SERVERLIB
508 #endif SILC_DIST_TOOLKIT
512 # SOCKS4 support checking
515 SAVE_CFLAGS="$CFLAGS"
516 SAVE_LDFLAGS="$LDFLAGS"
517 AC_MSG_CHECKING(whether to support SOCKS4)
519 [[ --with-socks4[=DIR] with SOCKS4 support [search in DIR/lib and DIR/include]]],
529 if test -d "$withval/include"; then
530 CFLAGS="$CFLAGS -I$withval/include"
532 if test -d "$withval/lib"; then
533 LDFLAGS="$LDFLAGS -L$withval/lib"
545 AC_MSG_ERROR(Could not find SOCKS4 library.)
547 CFLAGS="$SAVE_CFLAGS"
548 LDFLAGS="$SAVE_LDFLAGS"
554 # SOCKS5 support checking
557 SAVE_CFLAGS="$CFLAGS"
558 SAVE_LDFLAGS="$LDFLAGS"
559 AC_MSG_CHECKING(whether to support SOCKS5)
561 [[ --with-socks5[=DIR] with SOCKS5 support [search in DIR/lib and DIR/include]]],
571 if test -d "$withval/include"; then
572 CFLAGS="$CFLAGS -I$withval/include"
574 if test -d "$withval/lib"; then
575 LDFLAGS="$LDFLAGS -L$withval/lib"
578 LIBS="-lsocks5 $LIBS"
587 AC_MSG_ERROR(Could not find SOCKS5 library.)
589 CFLAGS="$SAVE_CFLAGS"
590 LDFLAGS="$SAVE_LDFLAGS"
596 if test "x$socks" = "x4"; then
597 AC_DEFINE([SOCKS], [], [Socks])
598 CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
601 if test "x$socks" = "x5"; then
602 AC_DEFINE([SOCKS], [], [Socks])
603 AC_DEFINE([SOCKS5], [], [Socks5])
604 AC_DEFINE([Rconnect], [SOCKSconnect], [Socks])
605 AC_DEFINE([Rgetsockname], [SOCKSgetsockname], [Socks])
606 AC_DEFINE([Rgetpeername], [SOCKSgetpeername], [Socks])
607 AC_DEFINE([Rbind], [SOCKSbind], [Socks])
608 AC_DEFINE([Raccept], [SOCKSaccept], [Socks])
609 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
610 AC_DEFINE([Rselect], [SOCKSselect], [Socks])
611 AC_DEFINE([Rrecvfrom], [SOCKSrecvfrom], [Socks])
612 AC_DEFINE([Rsendto], [SOCKSsendto], [Socks])
613 AC_DEFINE([Rrecv], [SOCKSrecv], [Socks])
614 AC_DEFINE([Rsend], [SOCKSsend], [Socks])
615 AC_DEFINE([Rread], [SOCKSread], [Socks])
616 AC_DEFINE([Rwrite], [SOCKSwrite], [Socks])
617 AC_DEFINE([Rrresvport], [SOCKSrresvport], [Socks])
618 AC_DEFINE([Rshutdown], [SOCKSshutdown], [Socks])
619 AC_DEFINE([Rlisten], [SOCKSlisten], [Socks])
620 AC_DEFINE([Rclose], [SOCKSclose], [Socks])
621 AC_DEFINE([Rdup], [SOCKSdup], [Socks])
622 AC_DEFINE([Rdup2], [SOCKSdup2], [Socks])
623 AC_DEFINE([Rfclose], [SOCKSfclose], [Socks])
624 AC_DEFINE([Rgethostbyname], [SOCKSgethostbyname], [Socks])
627 #ifdef SILC_DIST_MATH
628 # MP library checking. First check whether user wants to use GMP and use
629 # it if found. If not or not defined then compile the default library in the
634 SAVE_CFLAGS="$CFLAGS"
635 SAVE_LDFLAGS="$LDFLAGS"
636 AC_MSG_CHECKING(whether to search for GMP)
638 [[ --with-gmp[=DIR] use GMP instead of SILC Math [search in DIR/lib and DIR/include]]],
647 if test -d "$withval/include"; then
648 CFLAGS="$CFLAGS -I$withval/include"
650 if test -d "$withval/lib"; then
651 LDFLAGS="$LDFLAGS -L$withval/lib"
658 AC_CHECK_LIB(gmp, __gmpz_init,
661 AC_DEFINE([SILC_MP_GMP], [], [GMP])
662 AC_MSG_RESULT(Using GMP as a MP library.)
666 CFLAGS="$SAVE_CFLAGS"
667 LDFLAGS="$SAVE_LDFLAGS"
673 AM_CONDITIONAL(SILC_MP_GMP, test x$mp_gmp = xtrue)
674 AM_CONDITIONAL(SILC_MP_SILCMATH, test x$mp_gmp = xfalse)
675 if test x$mp_gmp = xfalse; then
676 AC_DEFINE([SILC_MP_SILCMATH], [], [SILCMATH])
677 AC_MSG_RESULT(Using SILC Math as a MP library.)
679 #endif SILC_DIST_MATH
686 SAVE_CFLAGS="$CFLAGS"
687 SAVE_LDFLAGS="$LDFLAGS"
688 SAVE_CPPFLAGS="$CPPFLAGS"
689 AC_MSG_CHECKING(whether to implicit search for libiconv)
691 [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
696 AC_CHECK_HEADERS(iconv.h,
698 AC_CHECK_FUNC(iconv, has_iconv=true)
704 if test -d $withval/include; then
705 CPPFLAGS="$CPPFLAGS -I$withval/include"
706 CFLAGS="$CFLAGS -I$withval/include"
708 if test -d $withval/lib; then
709 LDFLAGS="$LDFLAGS -L$withval/lib"
716 AC_CHECK_HEADERS(iconv.h,
718 AC_CHECK_FUNCS(iconv,
726 if test x$check_iconv = xtrue; then
727 AC_MSG_RESULT(Searching for iconv...)
730 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
732 AC_CHECK_HEADERS(iconv.h,
735 AC_MSG_CHECKING(for iconv in -liconv)
742 iconv_t cd = iconv_open("", "");
743 iconv(cd, NULL, NULL, NULL, NULL);
748 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
755 CFLAGS="$SAVE_CFLAGS"
756 LDFLAGS="$SAVE_LDFLAGS"
757 CPPFLAGS="$SAVE_CPPFLAGS"
762 if test x$check_iconv = xtrue; then
763 # search for iconv library..
765 SAVE_CFLAGS="$CFLAGS"
766 SAVE_LDFLAGS="$LDFLAGS"
767 SAVE_CPPFLAGS="$CPPFLAGS"
769 for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
770 if test x$has_iconv = xfalse; then
771 AC_MSG_RESULT(searching in $dir...)
773 if test -d $dir/include; then
774 CPPFLAGS="$CPPFLAGS -I$dir/include"
775 CFLAGS="$CFLAGS -I$dir/include"
777 if test -d $dir/lib; then
778 LDFLAGS="$LDFLAGS -L$dir/lib"
782 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
784 AC_CHECK_HEADERS(iconv.h,
787 AC_MSG_CHECKING(for iconv in -liconv)
794 iconv_t cd = iconv_open("", "");
795 iconv(cd, NULL, NULL, NULL, NULL);
801 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
808 CFLAGS="$SAVE_CFLAGS"
809 LDFLAGS="$SAVE_LDFLAGS"
810 CPPFLAGS="$SAVE_CPPFLAGS"
814 CFLAGS="$SAVE_CFLAGS"
815 LDFLAGS="$SAVE_LDFLAGS"
816 CPPFLAGS="$SAVE_CPPFLAGS"
822 if test x$has_iconv = xtrue; then
823 # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
824 # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
825 # obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
827 AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
838 ob = buf, obl = sizeof(buf);
839 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
840 (iconv(cd, 0, 0, &ob, &obl) ||
841 !(ob == buf && obl == sizeof(buf)) ||
856 if test x$ac_iconv_good = xno; then
857 AC_MSG_RESULT(Try using libiconv instead.)
861 # POSIX threads support
863 AC_MSG_CHECKING(whether to search for POSIX threads)
864 AC_ARG_WITH(pthreads,
865 [[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
872 if test -d $withval/include; then
873 CPPFLAGS="$CPPFLAGS -I$withval/include"
874 CFLAGS="$CFLAGS -I$withval/include"
876 if test -d $withval/lib; then
877 LDFLAGS="$LDFLAGS -L$withval/lib"
885 if test x$check_threads = xtrue; then
888 SAVE_CFLAGS="$CFLAGS"
889 SAVE_LDFLAGS="$LDFLAGS"
890 SAVE_CPPFLAGS="$CPPFLAGS"
893 AC_CHECK_HEADERS(pthread.h,
895 LIBS="$LIBS -lpthread"
896 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
901 LIBS="$SAVE_LIBS -pthread"
902 AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
911 # search for pthread library..
912 for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
913 if test x$has_threads = 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__pthread_h_ ac_cv_header_pthread_h || true
927 AC_CHECK_HEADERS(pthread.h,
929 LIBS="$LIBS -lpthread"
930 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
935 CFLAGS="$SAVE_CFLAGS"
936 LDFLAGS="$SAVE_LDFLAGS"
937 CPPFLAGS="$SAVE_CPPFLAGS"
941 CFLAGS="$SAVE_CFLAGS"
942 LDFLAGS="$SAVE_LDFLAGS"
943 CPPFLAGS="$SAVE_CPPFLAGS"
953 __SILC_HAVE_PTHREAD=""
954 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
955 if test x$has_threads = xtrue; then
956 CFLAGS="$CFLAGS -D_REENTRANT"
958 # XXX possibly incomplete
961 CFLAGS="$CFLAGS -D_THREAD_SAFE"
962 if test x"$GCC" = xyes; then
963 CFLAGS="$CFLAGS -mthreads"
967 CFLAGS="$CFLAGS -D_THREAD_SAFE"
969 *-*-sysv5uw7*) # UnixWare 7
970 if test "$GCC" != "yes"; then
971 CFLAGS="$CFLAGS -Kthread"
973 CFLAGS="$CFLAGS -pthread"
977 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
981 AC_CHECK_FUNC(pthread_create)
982 AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
983 AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
984 __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
987 # Native WIN32 compilation under cygwin
989 AC_MSG_CHECKING(whether to compile native WIN32 code)
991 [ --with-win32 compile native WIN32 (MinGW) code (-mno-cygwin)],
994 AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
996 CFLAGS="-mno-cygwin $CFLAGS"
997 LIBS="$LIBS -lwsock32"
1002 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1004 # Native EPOC support (disabled by default)
1006 AM_CONDITIONAL(SILC_EPOC, test xfalse = xtrue)
1008 # Native BeOS support (disabled by default)
1010 AM_CONDITIONAL(SILC_BEOS, test xfalse = xtrue)
1012 # Native OS2 support (disabled by default)
1014 AM_CONDITIONAL(SILC_OS2, test xfalse = xtrue)
1016 #ifdef SILC_DIST_TOOLKIT
1020 AC_MSG_CHECKING(whether to compile Irssi SILC Client)
1022 [ --with-irssi compile with Irssi SILC Client],
1031 AM_CONDITIONAL(with_irssi, test xwithout_irssi = xfalse)
1036 AC_MSG_CHECKING(whether to compile SILC Server)
1038 [ --with-silcd compile with SILC Server],
1047 #endif SILC_DIST_TOOLKIT
1048 #ifdef SILC_DIST_INPLACE
1051 #endif SILC_DIST_INPLACE
1054 AC_MSG_CHECKING(whether to do libtoolfix)
1055 AC_ARG_WITH(libtoolfix,
1056 [ --without-libtoolfix Do not fix libtool, for package builders],
1066 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1067 #endif SILC_DIST_COMPILER
1073 # Make enable-shared aware
1074 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1076 SILC_TOP_SRCDIR=`pwd`
1078 # Included configure scripts
1079 AD_INCLUDE_CONFIGURE
1081 #ifdef SILC_DIST_COMPILER
1085 AC_SUBST(SILC_TOP_SRCDIR)
1087 AC_SUBST(SILC_LIB_INCLUDES)
1088 AC_SUBST(__SILC_HAVE_PTHREAD)
1089 AC_SUBST(__SILC_HAVE_SIM)
1090 AC_SUBST(__SILC_ENABLE_DEBUG)
1093 # Fix the libtool to support run-time configuration. This allows us
1094 # to in run-time specify when to compile shared/static libraries without
1095 # need to reconfigure the entire libtool.
1097 if test x$libtoolfix = xtrue; then
1098 ./libtoolfix $SILC_TOP_SRCDIR/ltmain.sh
1100 AM_CONDITIONAL(SILC_LIBTOOLFIX, test x$libtoolfix = xtrue)
1102 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1103 AC_SUBST(INCLUDE_DEFINES_INT)
1105 #endif SILC_DIST_COMPILER
1112 #ifdef SILC_DIST_DOC
1114 #endif SILC_DIST_DOC
1115 #ifdef SILC_DIST_COMPILER
1117 Makefile.defines_int
1119 includes/silcversion.h
1121 #endif SILC_DIST_COMPILER
1122 #ifdef SILC_DIST_APPS
1124 #endif SILC_DIST_APPS
1127 #ifdef SILC_DIST_TOOLKIT
1130 win32/libsilc/Makefile
1131 win32/libsilcclient/Makefile
1133 tutorial/Makefile.defines
1134 tutorial/Makefile.defines_int
1136 #endif SILC_DIST_TOOLKIT
1140 #ifdef SILC_DIST_COMPILER
1141 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1142 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1143 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1144 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1147 echo "$PACKAGE Configuration Summary:"
1148 echo "---------------------------"
1149 echo " Target host ...................: $target"
1150 echo " Compiler ......................: $CC"
1151 echo " CFLAGS ........................: $CFLAGS"
1152 echo " LDFLAGS .......................: $LDFLAGS"
1153 echo " LIBS ..........................: $LIBS"
1155 echo " Installation prefix ...........: $prefix"
1156 echo " bin directory .................: $s_bindir"
1157 echo " sbin directory ................: $s_sbindir"
1158 echo " etc directory .................: $ETCDIR"
1159 echo " man directory .................: $s_mandir"
1160 echo " doc directory .................: $DOCDIR"
1161 #ifdef SILC_DIST_SIM
1162 echo " SIM directory .................: $MODULESDIR"
1163 #endif SILC_DIST_SIM
1164 #ifdef SILC_DIST_INCLUDES
1165 echo " include directory .............: $s_includedir"
1166 #endif SILC_DIST_INCLUDES
1169 #ifdef SILC_DIST_TOOLKIT
1170 if test x$without_irssi = xtrue; then
1173 if test x$without_silcd = xtrue; then
1176 #endif SILC_DIST_TOOLKIT
1178 #ifdef SILC_DIST_CLIENT
1179 echo " Compile SILC Client ...........: $irssi"
1180 #endif SILC_DIST_CLIENT
1182 #ifdef SILC_DIST_SERVER
1183 echo " Compile SILC Server ...........: $silcd"
1184 #endif SILC_DIST_SERVER
1186 #ifdef SILC_DIST_SIM
1187 if test x$sim_support = xfalse; then
1192 echo " SIM support ...................: $sim_support"
1193 #endif SILC_DIST_SIM
1195 echo " IPv6 support ..................: $summary_ipv6"
1197 if test x$has_iconv = xfalse; then
1202 echo " Iconv support .................: $iconv_support"
1204 if test x$want_asm = xfalse; then
1209 echo " Assembler optimizations .......: $summary_asm"
1211 #ifdef SILC_DIST_MATH
1212 if test x$mp_gmp = xtrue; then
1213 echo " Arithmetic library ............: GMP"
1215 #endif SILC_DIST_MATH
1218 if test x$has_threads = xtrue; then
1221 echo " Multi-threads support .........: $threads"
1222 echo " Debugging enabled .............: $summary_debug"
1224 echo "Compile the sources with 'make' or 'gmake' command."
1225 #endif SILC_DIST_COMPILER