endif
BUILD=build/
-WINDRES=windres
+WINDRES=@WINDRES@
LINT=splint
LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -Dglob64=glob -Dglobfree64=globfree
# compat with openssl linux edition.
# Copyright 2009, Wouter Wijngaards, NLnet Labs.
# BSD licensed.
#
-# Version 2
-# 2009-07-03
+# Version 4
# Changelog
-# - fixup LDFLAGS for empty ssl dir.
+# 2009-07-14 U_CHAR detection improved for windows crosscompile.
+# added ACX_FUNC_MALLOC
+# fixup some #if to #ifdef
+# NONBLOCKING test for mingw crosscompile.
+# 2009-07-13 added ACX_WITH_SSL_OPTIONAL
+# 2009-07-03 fixup LDFLAGS for empty ssl dir.
#
# Automates some of the checking constructs. Aims at portability for POSIX.
# Documentation for functions is below.
# ACX_TYPE_IN_PORT_T - in_port_t type.
# ACX_ARG_RPATH - add --disable-rpath option.
# ACX_WITH_SSL - add --with-ssl option, link -lcrypto.
+# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto,
+ where --without-ssl is also accepted
# ACX_LIB_SSL - setup to link -lssl.
# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files.
# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably.
# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work.
# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments.
# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably.
+# ACX_FUNC_MALLOC - check malloc, define replacement .
# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format.
# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused.
# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback.
dnl Detect if u_char type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_U_CHAR],
- [AC_CHECK_TYPE(u_char, unsigned char)])
+[AC_CHECK_TYPE([u_char], ,
+ [AC_DEFINE([u_char], [unsigned char], [Define to 'unsigned char if not defined])], [
+AC_INCLUDES_DEFAULT
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+]) ])
dnl Detect if rlim_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_RLIM_T],
[AC_CHECK_TYPE(rlim_t, ,
[AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
-#if HAVE_SYS_RESOURCE_H
+#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
]) ])
AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [
AC_INCLUDES_DEFAULT
-#if HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
+#ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
]) ])
-dnl Detect if socklen_t type is defined, otherwise define it.
+dnl Detect if in_addr_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_IN_ADDR_T],
[ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [
AC_INCLUDES_DEFAULT
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]) ])
-dnl Detect if socklen_t type is defined, otherwise define it.
+dnl Detect if in_port_t type is defined, otherwise define it.
AC_DEFUN([ACX_TYPE_IN_PORT_T],
[ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [
AC_INCLUDES_DEFAULT
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
]) ])
fi
])
-dnl Check for SSL.
-dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
-dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
-dnl Checks main header files of SSL.
-dnl
-AC_DEFUN([ACX_WITH_SSL],
-[
-AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
- [enable SSL (will check /usr/local/ssl
- /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
- ],[
- withval="yes"
- ])
- if test x_$withval = x_no; then
- AC_MSG_ERROR([Need SSL library to do digital signature cryptography])
- fi
+dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL
+dnl Takes one argument; the withval checked in those 2 functions
+dnl sets up the environment for the given openssl path
+AC_DEFUN([ACX_SSL_CHECKS], [
+ withval=$1
if test x_$withval != x_no; then
AC_MSG_CHECKING(for SSL)
if test x_$withval = x_ -o x_$withval = x_yes; then
if test -f "$dir/include/openssl/ssl.h"; then
found_ssl="yes"
AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.])
- dnl assume /usr/include is already in the include-path.
- if test "$ssldir" != "/usr"; then
- CPPFLAGS="$CPPFLAGS -I$ssldir/include"
- fi
+ dnl assume /usr/include is already in the include-path.
+ if test "$ssldir" != "/usr"; then
+ CPPFLAGS="$CPPFLAGS -I$ssldir/include"
+ fi
break;
fi
done
else
AC_MSG_RESULT(found in $ssldir)
HAVE_SSL=yes
- dnl assume /usr is already in the lib and dynlib paths.
- if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
+ dnl assume /usr is already in the lib and dynlib paths.
+ if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
LDFLAGS="$LDFLAGS -L$ssldir/lib"
- ACX_RUNTIME_PATH_ADD([$ssldir/lib])
- fi
-
- AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
- LIBS="$LIBS -lcrypto"
- AC_TRY_LINK(, [
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
- ], [
- AC_MSG_RESULT(yes)
- AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
- [If you have HMAC_CTX_init])
- ], [
- AC_MSG_RESULT(no)
- # check if -lwsock32 or -lgdi32 are needed.
- BAKLIBS="$LIBS"
- LIBS="$LIBS -lgdi32"
- AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
- AC_TRY_LINK([], [
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
- ],[
- AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
- [If you have HMAC_CTX_init])
- AC_MSG_RESULT(yes)
- ],[
- AC_MSG_RESULT(no)
- LIBS="$BAKLIBS"
- LIBS="$LIBS -ldl"
- AC_MSG_CHECKING([if -lcrypto needs -ldl])
- AC_TRY_LINK([], [
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
- ],[
- AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
- [If you have HMAC_CTX_init])
- AC_MSG_RESULT(yes)
- ],[
- AC_MSG_RESULT(no)
+ ACX_RUNTIME_PATH_ADD([$ssldir/lib])
+ fi
+
+ AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto])
+ LIBS="$LIBS -lcrypto"
+ AC_TRY_LINK(, [
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
+ ], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
+ [If you have HMAC_CTX_init])
+ ], [
+ AC_MSG_RESULT(no)
+ # check if -lwsock32 or -lgdi32 are needed.
+ BAKLIBS="$LIBS"
+ LIBS="$LIBS -lgdi32"
+ AC_MSG_CHECKING([if -lcrypto needs -lgdi32])
+ AC_TRY_LINK([], [
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
+ ],[
+ AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
+ [If you have HMAC_CTX_init])
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
+ LIBS="$BAKLIBS"
+ LIBS="$LIBS -ldl"
+ AC_MSG_CHECKING([if -lcrypto needs -ldl])
+ AC_TRY_LINK([], [
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
+ ],[
+ AC_DEFINE([HAVE_HMAC_CTX_INIT], 1,
+ [If you have HMAC_CTX_init])
+ AC_MSG_RESULT(yes)
+ ],[
+ AC_MSG_RESULT(no)
AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required])
- ])
- ])
+ ])
+ ])
])
fi
AC_SUBST(HAVE_SSL)
- AC_SUBST(RUNTIME_PATH)
+ AC_SUBST(RUNTIME_PATH)
fi
AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT])
AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT])
+])dnl End of ACX_SSL_CHECKS
+
+dnl Check for SSL, where SSL is mandatory
+dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
+dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
+dnl Checks main header files of SSL.
+dnl
+AC_DEFUN([ACX_WITH_SSL],
+[
+AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
+ [enable SSL (will check /usr/local/ssl
+ /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
+ ],[
+ withval="yes"
+ ])
+ if test x_$withval = x_no; then
+ AC_MSG_ERROR([Need SSL library to do digital signature cryptography])
+ fi
+ ACX_SSL_CHECKS($withval)
])dnl End of ACX_WITH_SSL
+dnl Check for SSL, where ssl is optional (--without-ssl is allowed)
+dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found
+dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS.
+dnl Checks main header files of SSL.
+dnl
+AC_DEFUN([ACX_WITH_SSL_OPTIONAL],
+[
+AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
+ [enable SSL (will check /usr/local/ssl
+ /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[
+ ],[
+ withval="yes"
+ ])
+ ACX_SSL_CHECKS($withval)
+])dnl End of ACX_WITH_SSL_OPTIONAL
+
dnl Setup to use -lssl
dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one).
AC_DEFUN([ACX_LIB_SSL],
AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN],
[
AC_MSG_CHECKING([if nonblocking sockets work])
+if echo $target | grep mingw32 >/dev/null; then
+ AC_MSG_RESULT([no (windows)])
+ AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).])
+else
AC_RUN_IFELSE(AC_LANG_PROGRAM([
#include <stdio.h>
#include <string.h>
], [
AC_MSG_RESULT([crosscompile(yes)])
])
+fi
])dnl End of ACX_CHECK_NONBLOCKING_BROKEN
dnl Check if mkdir has one or two arguments.
],[AC_MSG_RESULT(no)])
])dnl end of ACX_FUNC_IOCTLSOCKET
+dnl detect malloc and provide malloc compat prototype.
+dnl $1: unique name for compat code
+AC_DEFUN([ACX_FUNC_MALLOC],
+[
+ AC_FUNC_MALLOC
+ if test "$ac_cv_func_malloc_0_nonnull" = no; then
+ AC_DEFINE_UNQUOTED([malloc], [rpl_malloc_$1], [Define if replacement function should be used.])
+ fi
+])
+
dnl Define fallback for fseeko and ftello if needed.
AC_DEFUN([AHX_CONFIG_FSEEKO],
[
GNU-compliant. See autoconf documentation. */
#include "config.h"
-#undef malloc
-
#include <sys/types.h>
void *malloc ();
If N is zero, allocate a 1-byte block. */
void *
-rpl_malloc (size_t n)
+malloc (size_t n)
{
if (n == 0)
n = 1;
/* Define to `signed char' if <sys/types.h> does not define. */
#undef int8_t
-/* Define to rpl_malloc if the replacement function should be used. */
+/* Define if replacement function should be used. */
#undef malloc
/* Define to `long int' if <sys/types.h> does not define. */
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
-/* Define to `unsigned char' if <sys/types.h> does not define. */
+/* Define to 'unsigned char if not defined */
#undef u_char
/* Define to `int' if <sys/types.h> doesn't define. */
ac_subst_vars='LTLIBOBJS
subdirs
ldnsdir
+WINDRES
UB_ON_WINDOWS
LIBOBJS
CHECKLOCK_SRC
# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
-else on_mingw="no"; fi
+else
+ if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
+ else on_mingw="no"; fi
+fi
+echo "on mingw" $on_mingw
#
# Determine configuration file
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:7166: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:7171: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:7169: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:7174: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:7172: output\"" >&5)
+ (eval echo "\"\$as_me:7177: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 8377 "configure"' > conftest.$ac_ext
+ echo '#line 8382 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:9744: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:9749: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:9748: \$? = $ac_status" >&5
+ echo "$as_me:9753: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10083: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10088: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:10087: \$? = $ac_status" >&5
+ echo "$as_me:10092: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10188: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10193: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10192: \$? = $ac_status" >&5
+ echo "$as_me:10197: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:10243: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:10248: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:10247: \$? = $ac_status" >&5
+ echo "$as_me:10252: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13046 "configure"
+#line 13051 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 13142 "configure"
+#line 13147 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+
$ac_includes_default
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+
+
int
main ()
{
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+
$ac_includes_default
+#ifdef HAVE_WINSOCK2_H
+# include <winsock2.h>
+#endif
+
+
int
main ()
{
:
else
-cat >>confdefs.h <<_ACEOF
+cat >>confdefs.h <<\_ACEOF
#define u_char unsigned char
_ACEOF
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_RESOURCE_H
+#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_RESOURCE_H
+#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
+#ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
int
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_SOCKET_H
+#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
+#ifdef HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
int
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
/* end confdefs.h. */
$ac_includes_default
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#if HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h>
#endif
$as_echo "$as_me: error: Need SSL library to do digital signature cryptography" >&2;}
{ (exit 1); exit 1; }; }
fi
+
+ withval=$withval
if test x_$withval != x_no; then
{ $as_echo "$as_me:$LINENO: checking for SSL" >&5
$as_echo_n "checking for SSL... " >&6; }
#define HAVE_SSL /**/
_ACEOF
- if test "$ssldir" != "/usr"; then
- CPPFLAGS="$CPPFLAGS -I$ssldir/include"
- fi
+ if test "$ssldir" != "/usr"; then
+ CPPFLAGS="$CPPFLAGS -I$ssldir/include"
+ fi
break;
fi
done
{ $as_echo "$as_me:$LINENO: result: found in $ssldir" >&5
$as_echo "found in $ssldir" >&6; }
HAVE_SSL=yes
- if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
+ if test "$ssldir" != "/usr" -a "$ssldir" != ""; then
LDFLAGS="$LDFLAGS -L$ssldir/lib"
if test "x$enable_rpath" = xyes; then
fi
fi
- fi
+ fi
- { $as_echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
+ { $as_echo "$as_me:$LINENO: checking for HMAC_CTX_init in -lcrypto" >&5
$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; }
- LIBS="$LIBS -lcrypto"
- cat >conftest.$ac_ext <<_ACEOF
+ LIBS="$LIBS -lcrypto"
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
main ()
{
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
;
return 0;
$as_test_x conftest$ac_exeext
}; then
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
cat >>confdefs.h <<\_ACEOF
sed 's/^/| /' conftest.$ac_ext >&5
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
- # check if -lwsock32 or -lgdi32 are needed.
- BAKLIBS="$LIBS"
- LIBS="$LIBS -lgdi32"
- { $as_echo "$as_me:$LINENO: checking if -lcrypto needs -lgdi32" >&5
+ # check if -lwsock32 or -lgdi32 are needed.
+ BAKLIBS="$LIBS"
+ LIBS="$LIBS -lgdi32"
+ { $as_echo "$as_me:$LINENO: checking if -lcrypto needs -lgdi32" >&5
$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; }
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
main ()
{
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
;
return 0;
#define HAVE_HMAC_CTX_INIT 1
_ACEOF
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
else
sed 's/^/| /' conftest.$ac_ext >&5
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
- LIBS="$BAKLIBS"
- LIBS="$LIBS -ldl"
- { $as_echo "$as_me:$LINENO: checking if -lcrypto needs -ldl" >&5
+ LIBS="$BAKLIBS"
+ LIBS="$LIBS -ldl"
+ { $as_echo "$as_me:$LINENO: checking if -lcrypto needs -ldl" >&5
$as_echo_n "checking if -lcrypto needs -ldl... " >&6; }
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
main ()
{
- int HMAC_CTX_init(void);
- (void)HMAC_CTX_init();
+ int HMAC_CTX_init(void);
+ (void)HMAC_CTX_init();
;
return 0;
#define HAVE_HMAC_CTX_INIT 1
_ACEOF
- { $as_echo "$as_me:$LINENO: result: yes" >&5
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
$as_echo "yes" >&6; }
else
sed 's/^/| /' conftest.$ac_ext >&5
- { $as_echo "$as_me:$LINENO: result: no" >&5
+ { $as_echo "$as_me:$LINENO: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:$LINENO: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&5
$as_echo "$as_me: error: OpenSSL found in $ssldir, but version 0.9.7 or higher is required" >&2;}
+
# check if libssl needs libdl
BAKLIBS="$LIBS"
LIBS="-lssl $LIBS"
staticexe="-static"
if test "$on_mingw" = yes; then
staticexe="-all-static"
+ LIBS="$LIBS -lgdi32 -lz"
fi
fi
else
+
for ac_header in stdlib.h
do
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ if test "$ac_cv_func_malloc_0_nonnull" = no; then
+
+cat >>confdefs.h <<_ACEOF
+#define malloc rpl_malloc_unbound
+_ACEOF
+
+ fi
+
fi
UB_ON_WINDOWS=yes
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
+set dummy ${ac_tool_prefix}windres; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_WINDRES+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$WINDRES"; then
+ ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_WINDRES="${ac_tool_prefix}windres"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+WINDRES=$ac_cv_prog_WINDRES
+if test -n "$WINDRES"; then
+ { $as_echo "$as_me:$LINENO: result: $WINDRES" >&5
+$as_echo "$WINDRES" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_WINDRES"; then
+ ac_ct_WINDRES=$WINDRES
+ # Extract the first word of "windres", so it can be a program name with args.
+set dummy windres; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_WINDRES+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_WINDRES"; then
+ ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_WINDRES="windres"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES
+if test -n "$ac_ct_WINDRES"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_WINDRES" >&5
+$as_echo "$ac_ct_WINDRES" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_WINDRES" = x; then
+ WINDRES=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ WINDRES=$ac_ct_WINDRES
+ fi
+else
+ WINDRES="$ac_cv_prog_WINDRES"
+fi
+
fi
if test $ac_cv_func_getaddrinfo = no; then
case " $LIBOBJS " in
{ $as_echo "$as_me:$LINENO: checking if nonblocking sockets work" >&5
$as_echo_n "checking if nonblocking sockets work... " >&6; }
+if echo $target | grep mingw32 >/dev/null; then
+ { $as_echo "$as_me:$LINENO: result: no (windows)" >&5
+$as_echo "no (windows)" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define NONBLOCKING_IS_BROKEN 1
+_ACEOF
+
+else
if test "$cross_compiling" = yes; then
{ $as_echo "$as_me:$LINENO: result: crosscompile(yes)" >&5
fi
+fi
{ $as_echo "$as_me:$LINENO: checking whether mkdir has one arg" >&5
# are we on MinGW?
if uname -s 2>&1 | grep MINGW32 >/dev/null; then on_mingw="yes"
-else on_mingw="no"; fi
+else
+ if echo $target | grep mingw32 >/dev/null; then on_mingw="yes"
+ else on_mingw="no"; fi
+fi
+echo "on mingw" $on_mingw
#
# Determine configuration file
staticexe="-static"
if test "$on_mingw" = yes; then
staticexe="-all-static"
+ LIBS="$LIBS -lgdi32 -lz"
fi
fi
if test x_$enable_alloc_checks = x_yes; then
AC_DEFINE(UNBOUND_ALLOC_STATS, 1, [use statistics for allocs and frees, for debug use])
else
- AC_FUNC_MALLOC
+ ACX_FUNC_MALLOC([unbound])
fi
AC_FUNC_CHOWN
AC_DEFINE(UB_ON_WINDOWS, 1, [Use win32 resources and API])
UB_ON_WINDOWS=yes
AC_SUBST(UB_ON_WINDOWS)
+ AC_CHECK_TOOL(WINDRES, windres)
fi
if test $ac_cv_func_getaddrinfo = no; then
AC_LIBOBJ([fake-rfc2553])
- updated ldns tarball for solaris x64 compile assistance.
- no need to define RAND_MAX from config.h.
- iana portlist updated.
+ - configure changes and ldns update for mingw32 crosscompile.
13 July 2009: Wouter
- Fix for crash at start on windows.
(unsigned)tv.tv_sec, (unsigned)tv.tv_usec);
log_addr(1, "from client", &p->addr, p->addr_len);
/* send it */
- sent = sendto(p->s, ldns_buffer_begin(pkt),
+ sent = sendto(p->s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_limit(pkt), 0,
(struct sockaddr*)srv_addr, srv_len);
if(sent == -1) {
int i;
ssize_t r;
for(i=0; i<TRIES_PER_SELECT; i++) {
- r = recv(p->s, ldns_buffer_begin(pkt),
+ r = recv(p->s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0);
if(r == -1) {
#ifndef USE_WINSOCK
log_addr(1, "return reply to client", &p->addr, p->addr_len);
/* send reply back to the real client */
p->numreturn++;
- r = sendto(retsock, ldns_buffer_begin(pkt), (size_t)r, 0,
- (struct sockaddr*)&p->addr, p->addr_len);
+ r = sendto(retsock, (void*)ldns_buffer_begin(pkt), (size_t)r,
+ 0, (struct sockaddr*)&p->addr, p->addr_len);
if(r == -1) {
#ifndef USE_WINSOCK
log_err("sendto: %s", strerror(errno));
struct proxy* p;
for(i=0; i<TRIES_PER_SELECT; i++) {
from_len = (socklen_t)sizeof(from);
- len = recvfrom(s, ldns_buffer_begin(pkt),
+ len = recvfrom(s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0,
(struct sockaddr*)&from, &from_len);
if(len < 0) {
struct timeval* delay, ldns_buffer* pkt)
{
struct tcp_send_list* item;
- ssize_t r = recv(s, ldns_buffer_begin(pkt),
+ ssize_t r = recv(s, (void*)ldns_buffer_begin(pkt),
ldns_buffer_capacity(pkt), 0);
if(r == -1) {
#ifndef USE_WINSOCK
perfsend(struct perfinfo* info, size_t n, struct timeval* now)
{
ssize_t r;
- r = sendto(info->io[n].fd, info->qlist_data[info->qlist_idx],
+ r = sendto(info->io[n].fd, (void*)info->qlist_data[info->qlist_idx],
info->qlist_len[info->qlist_idx], 0,
(struct sockaddr*)&info->dest, info->destlen);
/*log_hex("send", info->qlist_data[info->qlist_idx],
perfreply(struct perfinfo* info, size_t n, struct timeval* now)
{
ssize_t r;
- r = recv(info->io[n].fd, ldns_buffer_begin(info->buf),
+ r = recv(info->io[n].fd, (void*)ldns_buffer_begin(info->buf),
ldns_buffer_capacity(info->buf), 0);
if(r == -1) {
#ifndef USE_WINSOCK
exit(1);
}
}
- if(send(fd, ldns_buffer_begin(buf), ldns_buffer_limit(buf), 0) <
+ if(send(fd, (void*)ldns_buffer_begin(buf), ldns_buffer_limit(buf), 0) <
(ssize_t)ldns_buffer_limit(buf)) {
#ifndef USE_WINSOCK
perror("send() data failed");
len = ntohs(len);
ldns_buffer_clear(buf);
ldns_buffer_set_limit(buf, len);
- if(recv(fd, ldns_buffer_begin(buf), len, 0) < (ssize_t)len) {
+ if(recv(fd, (void*)ldns_buffer_begin(buf), len, 0) <
+ (ssize_t)len) {
#ifndef USE_WINSOCK
perror("read() data failed");
#else
} else {
ssize_t l;
ldns_buffer_clear(buf);
- if((l=recv(fd, ldns_buffer_begin(buf),
+ if((l=recv(fd, (void*)ldns_buffer_begin(buf),
ldns_buffer_capacity(buf), 0)) < 0) {
#ifndef USE_WINSOCK
perror("read() data failed");
log_err("error: send empty UDP packet");
#endif
log_assert(addr && addrlen > 0);
- sent = sendto(c->fd, ldns_buffer_begin(packet),
+ sent = sendto(c->fd, (void*)ldns_buffer_begin(packet),
ldns_buffer_remaining(packet), 0,
addr, addrlen);
if(sent == -1) {
rep.addrlen = (socklen_t)sizeof(rep.addr);
log_assert(fd != -1);
log_assert(ldns_buffer_remaining(rep.c->buffer) > 0);
- recv = recvfrom(fd, ldns_buffer_begin(rep.c->buffer),
+ recv = recvfrom(fd, (void*)ldns_buffer_begin(rep.c->buffer),
ldns_buffer_remaining(rep.c->buffer), 0,
(struct sockaddr*)&rep.addr, &rep.addrlen);
if(recv == -1) {
log_assert(fd != -1);
if(c->tcp_byte_count < sizeof(uint16_t)) {
/* read length bytes */
- r = recv(fd, ldns_buffer_at(c->buffer, c->tcp_byte_count),
+ r = recv(fd,(void*)ldns_buffer_at(c->buffer,c->tcp_byte_count),
sizeof(uint16_t)-c->tcp_byte_count, 0);
if(r == 0)
return 0;
}
log_assert(ldns_buffer_remaining(c->buffer) > 0);
- r = recv(fd, ldns_buffer_current(c->buffer),
+ r = recv(fd, (void*)ldns_buffer_current(c->buffer),
ldns_buffer_remaining(c->buffer), 0);
if(r == 0) {
return 0;
}
}
log_assert(ldns_buffer_remaining(c->buffer) > 0);
- r = send(fd, ldns_buffer_current(c->buffer),
+ r = send(fd, (void*)ldns_buffer_current(c->buffer),
ldns_buffer_remaining(c->buffer), 0);
if(r == -1) {
#ifndef USE_WINSOCK
return 0;
}
+#ifdef UNBOUND_DEBUG
/**
* Find a fd in the list of items.
* Note that not all items have a fd associated (those are -1).
}
return -1;
}
+#endif
/** Find ptr in base array */
-static int
+static void
zero_waitfor(WSAEVENT waitfor[], WSAEVENT x)
{
int i;
you prefer.\r
\r
\r
++++ Cross compile\r
+\r
+You can crosscompile unbound. This results in .exe files.\r
+Install the packages: mingw32-binutils mingw32-cpp mingw32-filesystem \r
+mingw32-gcc mingw32-openssl mingw32-openssl-static mingw32-runtime\r
+mingw32-termcap mingw32-w32api mingw32-zlib mingw32-zlib-static\r
+(package names for fedora 11).\r
+\r
+Then run:\r
+$ mingw32-configure\r
+$ make\r
+\r
+It may be a good idea to pass --enable-static-exe --enable-debug to\r
+the mingw32-configure line. This enables statically linked executables\r
+so you do not need to pilfer dlls together, and debug has assertions.\r
+\r
+\r
+++ CREDITS\r
\r
Unbound was written in portable C by Wouter Wijngaards (NLnet Labs).\r
if(RegSetValueEx(hk, (LPCTSTR)"EventMessageFile",
0, /* reserved, mustbezero */
REG_EXPAND_SZ, /* value type (string w env subst) */
- pathname, /* data */
+ (BYTE*)pathname, /* data */
(DWORD)strlen(pathname)+1)) /* length of data */
{
RegCloseKey(hk);
/* category message file */
if(RegSetValueEx(hk, (LPCTSTR)"CategoryMessageFile", 0, REG_EXPAND_SZ,
- pathname, (DWORD)strlen(pathname)+1)) {
+ (BYTE*)pathname, (DWORD)strlen(pathname)+1)) {
RegCloseKey(hk);
fatal_win(out, "could not registry set CategoryMessageFile");
}
if(type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) {
buf[sizeof(buf)-1] = 0;
buf[sizeof(buf)-2] = 0; /* for multi_sz */
- result = strdup(buf);
+ result = strdup((char*)buf);
if(!result) reportev("out of memory");
}
return result;
if(type == REG_SZ || type == REG_MULTI_SZ || type == REG_EXPAND_SZ) {
buf[sizeof(buf)-1] = 0;
buf[sizeof(buf)-2] = 0; /* for multi_sz */
- result = atoi(buf);
+ result = atoi((char*)buf);
} else if(type == REG_DWORD) {
- result = *(DWORD*)buf;
+ DWORD r;
+ memmove(&r, buf, sizeof(r));
+ result = r;
}
return result;
}