4 # Author: Pekka Riikonen <priikone@silcnet.org>
6 # Copyright (C) 2000 - 2008 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(runtimedefs.h)
30 AC_PATH_PROG(sedpath, sed)
38 #ifdef SILC_DIST_INPLACE
40 #endif SILC_DIST_INPLACE
46 ## Library versioning.
49 # Do the releases and library versioning according to following rules:
51 # - If any code has changed in library, increment RUNTIME_REVISION
52 # - If API were added, removed or changed, set RUNTIME_REVISION to 0
53 # - If API were added, removed or changed, increment RUNTIME_CURRENT
54 # - If APi were added, increment RUNTIME_AGE
55 # - If API were removed, set RUNTIME_AGE to 0
58 # Base version for library.
59 RUNTIME_BASE_VERSION=1.2
62 RUNTIME_CURRENT=1 # prev = 0
63 RUNTIME_REVISION=0 # prev = 0
64 RUNTIME_AGE=0 # prev = 0
66 # Substitute the version numbers
67 AC_SUBST(RUNTIME_BASE_VERSION)
68 AC_SUBST(RUNTIME_CURRENT)
69 AC_SUBST(RUNTIME_REVISION)
77 # Default installation destination
78 AC_PREFIX_DEFAULT(/usr/local)
79 if test "x$prefix" != xNONE; then
82 silc_prefix="$ac_default_prefix"
91 # Disable all CPU feature optimizations
92 AC_MSG_CHECKING(whether to enable CPU feature optimizations)
93 AC_ARG_ENABLE(cpu-optimizations,
94 [ --disable-cpu-optimizations do not use any CPU feature optimizations],
97 AC_DEFINE([SILC_NO_CPU_OPTIMIZATIONS], [], [SILC_NO_CPU_OPTIMIZATIONS])
98 want_cpu_optimizations=false
102 want_cpu_optimizations=true
104 AM_CONDITIONAL(SILC_NO_CPU_OPTIMIZATIONS,
105 test x$want_cpu_optimizations = xfalse)
107 SILC_SYSTEM_IS_SMP(AC_DEFINE([SILC_SMP], [], [SILC_SMP]), [],
108 AC_DEFINE([SILC_SMP], [], [SILC_SMP]))
118 # All following Intels are considered 32-bit CPUs.
120 # All CPUs of today are considered i386 and i486 compatible */
121 AC_DEFINE([SILC_I386], [], [SILC_I386])
122 AC_DEFINE([SILC_I486], [], [SILC_I486])
126 if test "x$host_cpu" = "xi586"; then
127 AC_DEFINE([SILC_I586], [], [SILC_I586])
131 if test "x$host_cpu" = "xi686"; then
132 AC_DEFINE([SILC_I586], [], [SILC_I586])
133 AC_DEFINE([SILC_I686], [], [SILC_I686])
138 if test "x$host_cpu" = "xi786"; then
139 AC_DEFINE([SILC_I586], [], [SILC_I586])
140 AC_DEFINE([SILC_I686], [], [SILC_I686])
141 AC_DEFINE([SILC_I786], [], [SILC_I786])
147 # Check for specific CPU features
148 SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
149 SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
150 SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
151 SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
152 SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
155 # Intel IA-64, 64-bit CPU (not x86_64 compatible)
157 AC_DEFINE([SILC_IA64], [], [SILC_IA64])
160 # Check for specific CPU features
161 SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
162 SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
163 SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
164 SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
165 SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
168 # AMD/Intel x86_64, 64-bit CPU
170 AC_DEFINE([SILC_X86_64], [], [SILC_X86_64])
173 # Check for specific CPU features
174 SILC_CPU_FLAG(mmx, true, AC_DEFINE([SILC_CPU_MMX], [], [SILC_CPU_MMX]), [])
175 SILC_CPU_FLAG(sse2, true, AC_DEFINE([SILC_CPU_SSE2], [], [SILC_CPU_SSE2]), [])
176 SILC_CPU_FLAG(pni, true, AC_DEFINE([SILC_CPU_SSE3], [], [SILC_CPU_SSE3]), [])
177 SILC_CPU_FLAG(ssse3, true, AC_DEFINE([SILC_CPU_SSSE3], [], [SILC_CPU_SSSE3]), [])
178 SILC_CPU_FLAG(sse4, true, AC_DEFINE([SILC_CPU_SSE4], [], [SILC_CPU_SSE4]), [])
181 # PowerPC, 32-bit and 64-bit CPUs
183 AC_DEFINE([SILC_POWERPC], [], [SILC_POWERPC])
187 AM_CONDITIONAL(SILC_I386, test x$cpu_i386 = xtrue)
188 AM_CONDITIONAL(SILC_I486, test x$cpu_i486 = xtrue)
189 AM_CONDITIONAL(SILC_I586, test x$cpu_i586 = xtrue)
190 AM_CONDITIONAL(SILC_I686, test x$cpu_i686 = xtrue)
191 AM_CONDITIONAL(SILC_7686, test x$cpu_i786 = xtrue)
192 AM_CONDITIONAL(SILC_X86_64, test x$cpu_x86_64 = xtrue)
193 AM_CONDITIONAL(SILC_POWERPC, test x$cpu_ppc = xtrue)
194 AM_CONDITIONAL(SILC_IA64, test x$cpu_ia64 = xtrue)
196 if test x$want_cpu_optimizations = xtrue; then
197 # Set some compiler options based on CPU
198 if test "x$CC" = "xicc"; then
200 if test x$x_have_cpu_sse4 = xtrue; then
201 SILC_ADD_CFLAGS(-axS)
203 if test x$x_have_cpu_ssse3 = xtrue; then
204 SILC_ADD_CFLAGS(-axT)
205 elif test x$x_have_cpu_pni = xtrue; then
206 SILC_ADD_CFLAGS(-axP)
207 elif test x$x_have_cpu_sse2 = xtrue; then
208 SILC_ADD_CFLAGS(-axW)
212 if test x$x_have_cpu_sse2 = xtrue; then
213 SILC_ADD_CFLAGS(-msse2)
215 if test x$x_have_cpu_pni = xtrue; then
216 SILC_ADD_CFLAGS(-msse3)
218 if test x$x_have_cpu_ssse3 = xtrue; then
219 SILC_ADD_CFLAGS(-mssse3)
221 if test x$x_have_cpu_sse4 = xtrue; then
222 SILC_ADD_CFLAGS(-msse4)
229 ## Put here any platform specific stuff
235 CFLAGS=`echo $CFLAGS -D_GNU_SOURCE`
259 # More header checking
261 AC_CHECK_HEADERS(unistd.h string.h errno.h fcntl.h assert.h execinfo.h)
262 AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
263 AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
264 AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
265 AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h dirent.h)
266 AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
270 ## Data type checking
277 AC_CHECK_SIZEOF(long long, 0)
278 AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
279 AC_CHECK_SIZEOF(long, 0)
280 AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
281 AC_CHECK_SIZEOF(int, 0)
282 AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
283 AC_CHECK_SIZEOF(short, 0)
284 AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
285 AC_CHECK_SIZEOF(char, 0)
286 AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
287 AC_CHECK_SIZEOF(void *, 0)
288 AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
289 AC_CHECK_TYPES(long long)
290 AC_CHECK_TYPES(long double)
292 # Check for big-endian machines
297 ## Compiler and compiler flag checks
300 # Disable all compiler optimizations
301 AC_MSG_CHECKING(whether to enable compiler optimizations)
302 AC_ARG_ENABLE(optimizations,
303 [ --disable-optimizations do not use any compiler optimizations],
306 AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
307 want_cc_optimizations=false
311 want_cc_optimizations=true
313 AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
316 # GCC specific options
317 if test "x$summary_debug" = "xyes"; then
322 SILC_ADD_CFLAGS(-Wall -finline-functions)
323 SILC_ADD_CFLAGS(-Wno-pointer-sign)
338 # Intel C++ Compiler flags
339 if test "x$CC" = "xicc"; then
340 SILC_ADD_CFLAGS(-restrict)
341 SILC_ADD_CFLAGS(-finline-functions)
343 # Don't define __GNUC__ except for system includes
344 SILC_ADD_CFLAGS(-gcc-sys)
348 if test x$want_cc_optimizations = xtrue; then
350 # GCC specific options
351 if test "x$summary_debug" = "xyes"; then
360 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
363 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
366 SILC_ADD_CFLAGS(-O2, SILC_ADD_CFLAGS(-O))
374 ## Function and libary checking
376 AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
377 AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
378 AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
379 AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
380 AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
381 AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
382 AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
383 AC_CHECK_FUNCS(setenv getenv putenv unsetenv clearenv backtrace)
386 AC_CHECK_FUNC(getopt_long,
388 AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
390 ], have_getopt_long=0
393 # Check gethostbyname
394 AC_CHECK_FUNC(gethostbyname, [],
396 AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
397 AC_CHECK_FUNC(res_gethostbyname, [],
398 AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
403 AC_CHECK_FUNC(socket, [],
404 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
407 # Check clock_gettime
408 AC_CHECK_FUNC(clock_gettime, [],
410 AC_CHECK_LIB(rt, clock_gettime,
412 AC_DEFINE([HAVE_CLOCK_GETTIME], [], [HAVE_CLOCK_GETTIME])])
415 # Check for epoll_wait and verify that epoll_create works
416 AC_CHECK_FUNC(epoll_wait,
420 #include <sys/epoll.h>
423 int ret = epoll_create(5);
431 AC_DEFINE([HAVE_EPOLL_WAIT], [1], [HAVE_EPOLL_WAIT])
438 AC_MSG_CHECKING(for va_copy)
450 if (va_arg(cp, int) != 0xff11)
462 AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY])
472 if test x$va_copy = xfalse; then
473 AC_MSG_CHECKING(for __va_copy)
485 if (va_arg(cp, int) != 0xff11)
497 AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY])
508 if test x$va_copy = xfalse; then
518 if (va_arg(cp, int) != 0xff11)
531 AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY])
537 # Check for timezone and tm_gmtoff for timezone information
538 AC_MSG_CHECKING(whether system has timezone)
550 AC_DEFINE([HAVE_TIMEZONE], [], [HAVE_TIMEZONE]) ],
551 [ AC_MSG_RESULT(no) ],
552 [ AC_MSG_RESULT(no) ]
554 AC_MSG_CHECKING(whether system has tm_gmtoff)
567 AC_DEFINE([HAVE_TM_GMTOFF], [], [HAVE_TM_GMTOFF]) ],
568 [ AC_MSG_RESULT(no) ],
569 [ AC_MSG_RESULT(no) ]
571 AC_MSG_CHECKING(whether system has __tm_gmtoff)
584 AC_DEFINE([HAVE___TM_GMTOFF], [], [HAVE___TM_GMTOFF]) ],
585 [ AC_MSG_RESULT(no) ],
586 [ AC_MSG_RESULT(no) ]
588 AC_MSG_CHECKING(whether system has __tm_gmtoff__)
596 tm.__tm_gmtoff__ = 0;
601 AC_DEFINE([HAVE___TM_GMTOFF__], [], [HAVE___TM_GMTOFF__]) ],
602 [ AC_MSG_RESULT(no) ],
603 [ AC_MSG_RESULT(no) ]
606 # Check for dlopen() and friends
607 AC_CHECK_HEADERS(dlfcn.h,
609 AC_CHECK_LIB(dl, dlopen,
611 AC_DEFINE([HAVE_DLOPEN], [], [HAVE_DLOPEN])
615 AC_CHECK_LIB(c, dlopen,
617 AC_DEFINE([HAVE_DLOPEN], [], [HAVE_DLOPEN])
622 __SILC_ENABLE_DEBUG=""
624 runtimever=`echo $VERSION | sed 's/\./ /g'`
630 if test $maj -eq 0; then
634 if test $min -eq 0; then
638 if test $bld -eq 0; then
643 __RUNTIME_PACKAGE_VERSION="#define __SILC_RUNTIME_VERSION SILC_VERSION($maj,$min,$bld)"
647 ## Enable/disable checking
651 AC_MSG_CHECKING(whether to enable IPv6 support)
653 [ --enable-ipv6 enable IPv6 support],
655 case "${enableval}" in
660 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
674 if test x$check_ipv6 = xtrue; then
678 #ifdef HAVE_SYS_TYPES_H
679 #include <sys/types.h>
681 #ifdef HAVE_NETINET_TCP_H
682 #include <netinet/tcp.h>
687 #include <sys/socket.h>
688 #ifdef HAVE_NETINET_IN_H
689 #include <netinet/in.h>
693 struct sockaddr_in6 sin6;
694 int family = AF_INET6;
697 AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
705 # Memory alignment. User can specify what alignment memory allocation and
706 # SilcStack allocation use. Default is system default alignemnt.
707 AC_ARG_WITH(alignment,
708 [ --with-alignment=NUMBER Memory alignment in bytes],
710 AC_DEFINE_UNQUOTED([SILC_ALIGNMENT], [$withval], [SILC_ALIGNMENT])
711 AC_MSG_RESULT(Memory allocation alignment is $withval bytes)
714 AC_DEFINE([SILC_ALIGNMENT], SILC_SIZEOF_VOID_P, [SILC_ALIGNMENT])
717 # Stack trace checking
718 AC_MSG_CHECKING(whether to enable stack tracing)
719 AC_ARG_ENABLE(stack-trace,
720 [ --enable-stack-trace enable memory stack trace],
722 case "${enableval}" in
725 AC_DEFINE([SILC_STACKTRACE], [], [SILC_STACKTRACE])
726 CFLAGS="$CFLAGS -rdynamic"
736 #ifdef SILC_DIST_INPLACE
738 # Profiling options (never delivered to distributions)
740 AC_MSG_CHECKING(whether to enable gprof)
742 [ --enable-gprof enable gprof profiling],
744 case "${enableval}" in
759 AC_MSG_CHECKING(whether to enable gcov)
761 [ --enable-gcov enable gcov],
763 case "${enableval}" in
766 SILC_ADD_CFLAGS(-fprofile-arcs)
777 #endif SILC_DIST_INPLACE
780 AC_MSG_CHECKING(whether to enable debugging)
782 __SILC_ENABLE_DEBUG=""
784 [ --enable-debug enable debugging],
786 case "${enableval}" in
789 AC_DEFINE([SILC_DEBUG], [], [enable-debug])
791 __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
802 # Disable all assembler optimizations
803 AC_MSG_CHECKING(whether to enable assembler optimizations)
805 [ --disable-asm do not use assembler optimizations],
808 AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
815 AM_CONDITIONAL(SILC_NO_ASM, test x$want_asm = xfalse)
817 # Check for assembler
820 if test x$want_asm = xtrue; then
821 AC_PATH_PROG([NASM], [nasm], [no])
822 if test "x$NASM" != "xno"; then
823 if test x$cpu_x86_64 = xtrue; then
824 SILC_ASSEMBLER="$NASM -O2 -felf64"
826 SILC_ASSEMBLER="$NASM -O2 -felf"
831 AC_PATH_PROG([YASM], [yasm], [no])
832 if test "x$YASM" != "xno"; then
833 if test x$cpu_x86_64 = xtrue; then
834 SILC_ASSEMBLER="$YASM -Xgnu -felf64"
836 SILC_ASSEMBLER="$YASM -Xgnu -felf"
841 AC_SUBST(SILC_ASSEMBLER)
845 ## With/without checkings
849 LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
851 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/contrib"
852 SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcutil"
855 # Check for iconv support
859 SAVE_CFLAGS="$CFLAGS"
860 SAVE_LDFLAGS="$LDFLAGS"
861 SAVE_CPPFLAGS="$CPPFLAGS"
862 AC_MSG_CHECKING(whether to implicit search for libiconv)
864 [[ --with-iconv[=DIR] use libiconv [search in DIR/include and DIR/lib]]],
869 AC_CHECK_HEADERS(iconv.h,
871 AC_CHECK_FUNC(iconv, has_iconv=true)
877 if test -d $withval/include; then
878 CPPFLAGS="$CPPFLAGS -I$withval/include"
879 CFLAGS="$CFLAGS -I$withval/include"
881 if test -d $withval/lib; then
882 LDFLAGS="$LDFLAGS -L$withval/lib"
889 AC_CHECK_HEADERS(iconv.h,
891 AC_CHECK_FUNCS(iconv,
899 if test x$check_iconv = xtrue; then
900 AC_MSG_RESULT(Searching for iconv...)
903 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
905 AC_CHECK_HEADERS(iconv.h,
908 AC_MSG_CHECKING(for iconv in -liconv)
915 iconv_t cd = iconv_open("", "");
916 iconv(cd, NULL, NULL, NULL, NULL);
921 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
928 CFLAGS="$SAVE_CFLAGS"
929 LDFLAGS="$SAVE_LDFLAGS"
930 CPPFLAGS="$SAVE_CPPFLAGS"
935 if test x$check_iconv = xtrue; then
936 # search for iconv library..
938 SAVE_CFLAGS="$CFLAGS"
939 SAVE_LDFLAGS="$LDFLAGS"
940 SAVE_CPPFLAGS="$CPPFLAGS"
942 for dir in `echo "/usr/local /usr/pkg /usr/contrib"`; do
943 if test x$has_iconv = xfalse; then
944 AC_MSG_RESULT(searching in $dir...)
946 if test -d $dir/include; then
947 CPPFLAGS="$CPPFLAGS -I$dir/include"
948 CFLAGS="$CFLAGS -I$dir/include"
950 if test -d $dir/lib; then
951 LDFLAGS="$LDFLAGS -L$dir/lib"
955 unset ac_cv_header__iconv_h_ ac_cv_header_iconv_h || true
957 AC_CHECK_HEADERS(iconv.h,
960 AC_MSG_CHECKING(for iconv in -liconv)
967 iconv_t cd = iconv_open("", "");
968 iconv(cd, NULL, NULL, NULL, NULL);
974 AC_DEFINE([HAVE_ICONV], [], [Define if you have the iconv() function.])
981 CFLAGS="$SAVE_CFLAGS"
982 LDFLAGS="$SAVE_LDFLAGS"
983 CPPFLAGS="$SAVE_CPPFLAGS"
987 CFLAGS="$SAVE_CFLAGS"
988 LDFLAGS="$SAVE_LDFLAGS"
989 CPPFLAGS="$SAVE_CPPFLAGS"
995 if test x$has_iconv = xtrue; then
996 # (1) Some implementations of iconv won't convert from UTF-8 to UTF-8.
997 # (2) In glibc-2.1.2 and earlier there is a bug that messes up ob and
998 # obl when args 2 and 3 are 0 (fixed in glibc-2.1.3).
1000 AC_CACHE_CHECK([whether this iconv is good enough], ac_iconv_good,
1008 changequote([, ])dnl
1011 ob = buf, obl = sizeof(buf);
1012 return ((cd = iconv_open("UTF-8", "UTF-8")) != (iconv_t)(-1) &&
1013 (iconv(cd, 0, 0, &ob, &obl) ||
1014 !(ob == buf && obl == sizeof(buf)) ||
1029 if test x$ac_iconv_good = xno; then
1030 AC_MSG_RESULT(Try using libiconv instead.)
1034 # Check for POSIX threads support
1035 AC_MSG_CHECKING(whether to search for POSIX threads)
1036 AC_ARG_WITH(pthreads,
1037 [[ --with-pthreads[=DIR] use POSIX threads [search in DIR/include and DIR/lib]]],
1039 case "${withval}" in
1044 if test -d $withval/include; then
1045 CPPFLAGS="$CPPFLAGS -I$withval/include"
1046 CFLAGS="$CFLAGS -I$withval/include"
1048 if test -d $withval/lib; then
1049 LDFLAGS="$LDFLAGS -L$withval/lib"
1057 if test x$check_threads = xtrue; then
1060 SAVE_CFLAGS="$CFLAGS"
1061 SAVE_LDFLAGS="$LDFLAGS"
1062 SAVE_CPPFLAGS="$CPPFLAGS"
1065 AC_CHECK_HEADERS(pthread.h,
1067 LIBS="$LIBS -lpthread"
1068 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1073 LIBS="$SAVE_LIBS -pthread"
1074 AC_CHECK_LIB(c_r, pthread_attr_init, has_threads=true, LIBS="$SAVE_LIBS")
1083 # search for pthread library..
1084 for dir in `echo "/usr/local /usr/pkg /usr/contrib /usr/pkg/pthreads /usr/local/pthreads"`; do
1085 if test x$has_threads = xfalse; then
1086 AC_MSG_RESULT(searching in $dir...)
1088 if test -d $dir/include; then
1089 CPPFLAGS="$CPPFLAGS -I$dir/include"
1090 CFLAGS="$CFLAGS -I$dir/include"
1092 if test -d $dir/lib; then
1093 LDFLAGS="$LDFLAGS -L$dir/lib"
1097 unset ac_cv_header__pthread_h_ ac_cv_header_pthread_h || true
1099 AC_CHECK_HEADERS(pthread.h,
1101 LIBS="$LIBS -lpthread"
1102 AC_CHECK_LIB(pthread, pthread_attr_init, has_threads=true,
1107 CFLAGS="$SAVE_CFLAGS"
1108 LDFLAGS="$SAVE_LDFLAGS"
1109 CPPFLAGS="$SAVE_CPPFLAGS"
1113 CFLAGS="$SAVE_CFLAGS"
1114 LDFLAGS="$SAVE_LDFLAGS"
1115 CPPFLAGS="$SAVE_CPPFLAGS"
1125 __SILC_HAVE_PTHREAD=""
1126 AM_CONDITIONAL(SILC_THREADS, test x$has_threads = xtrue)
1127 if test x$has_threads = xtrue; then
1128 CFLAGS="$CFLAGS -D_REENTRANT"
1130 # XXX possibly incomplete
1133 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1134 if test x"$GCC" = xyes; then
1135 CFLAGS="$CFLAGS -mthreads"
1139 CFLAGS="$CFLAGS -D_THREAD_SAFE"
1141 *-*-sysv5uw7*) # UnixWare 7
1142 if test "$GCC" != "yes"; then
1143 CFLAGS="$CFLAGS -Kthread"
1145 CFLAGS="$CFLAGS -pthread"
1149 CFLAGS="$CFLAGS -D_POSIX4A_DRAFT10_SOURCE"
1154 AC_CHECK_FUNCS(pthread_create pthread_key_create pthread_once)
1156 # Check for read/write locks
1157 AC_CHECK_FUNC(pthread_rwlock_init,
1161 #include <pthread.h>
1164 pthread_rwlock_t rwlock;
1165 pthread_rwlock_init(&rwlock, NULL);
1166 pthread_rwlock_destroy(&rwlock);
1172 # Rwlock not defined
1173 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1178 # Rwlock not defined
1179 CFLAGS="$CFLAGS -D_XOPEN_SOURCE=600"
1182 AC_DEFINE([SILC_HAVE_PTHREAD], [], [HAVE_PTHREAD])
1183 AC_DEFINE([SILC_THREADS], [], [HAVE_THREAD])
1184 __SILC_HAVE_PTHREAD="#define __SILC_HAVE_PTHREAD 1"
1189 ## Native WIN32 compilation under cygwin
1191 AC_MSG_CHECKING(whether to compile native WIN32 code)
1193 [ --with-win32 compile native WIN32 (MinGW) code (-mno-cygwin)],
1196 AC_DEFINE([SILC_WIN32], [], [SILC_WIN32])
1198 CFLAGS="-mno-cygwin $CFLAGS"
1199 LIBS="$LIBS -lwsock32"
1205 AM_CONDITIONAL(SILC_WIN32, test x$win32_support = xtrue)
1209 ## Outputs and substitutions
1213 AC_SUBST(SILC_TOP_SRCDIR)
1216 AC_SUBST(SILC_LIB_INCLUDES)
1217 AC_SUBST(__SILC_ENABLE_DEBUG)
1218 AC_SUBST(__SILC_HAVE_PTHREAD)
1219 AC_SUBST(__RUNTIME_PACKAGE_VERSION)
1221 # Native Symbian OS support (disabled by default)
1222 AM_CONDITIONAL(SILC_SYMBIAN, test xfalse = xtrue)
1224 # Make enable-shared aware
1225 AM_CONDITIONAL(SILC_ENABLE_SHARED, test "$enable_shared" = yes)
1227 ETCDIR=`eval echo $sysconfdir`;ETCDIR=`eval echo $ETCDIR`
1229 AC_DEFINE_UNQUOTED([SILC_ETCDIR], "$ETCDIR", [SILC_ETCDIR])
1231 DOCDIR=`eval echo $docdir`;DOCDIR=`eval echo $DOCDIR`
1233 AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
1235 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
1236 AC_SUBST(INCLUDE_DEFINES_INT)
1248 doc/runtime.in/index.html
1250 Makefile.defines_int
1258 lib/contrib/Makefile
1259 lib/silcutil/silcruntime.h
1260 lib/silcutil/Makefile
1261 lib/silcutil/tests/Makefile
1262 lib/silcutil/unix/Makefile
1263 lib/silcutil/win32/Makefile
1264 lib/silcutil/symbian/Makefile
1275 s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
1276 s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
1277 s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
1278 s_includedir=`eval echo $includedir`;s_includedir=`eval echo $s_includedir`
1281 echo "SILC Runtime Toolkit configuration summary:"
1282 echo "------------------------------------------"
1283 echo " Target host ...................: $target"
1284 echo " Compiler ......................: $CC"
1285 echo " CFLAGS ........................: $CFLAGS"
1286 echo " LDFLAGS .......................: $LDFLAGS"
1287 echo " LIBS ..........................: $LIBS"
1289 echo " Installation prefix ...........: $prefix"
1290 echo " bin directory .................: $s_bindir"
1291 echo " sbin directory ................: $s_sbindir"
1292 echo " etc directory .................: $ETCDIR"
1293 echo " man directory .................: $s_mandir"
1294 echo " doc directory .................: $DOCDIR"
1295 echo " include directory .............: $s_includedir"
1297 echo " IPv6 support ..................: $summary_ipv6"
1299 if test x$has_iconv = xfalse; then
1304 echo " Iconv support .................: $iconv_support"
1306 if test x$want_asm = xfalse; then
1311 echo " Assembler optimizations .......: $summary_asm"
1313 if test x$want_cc_optimizations = xfalse; then
1316 summary_cc_opt="yes"
1318 echo " Compiler optimizations ........: $summary_cc_opt"
1320 if test x$want_cpu_optimizations = xfalse; then
1321 summary_cpu_opt="no"
1323 summary_cpu_opt="yes"
1325 echo " CPU feature optimizations .....: $summary_cpu_opt"
1328 if test x$has_threads = xtrue; then
1331 echo " Multi-threads support .........: $threads"
1332 echo " Debugging enabled .............: $summary_debug"
1334 echo "Compile the sources with 'make' or 'gmake' command."