AC_ARG_ENABLE(debug,
[ --disable-debug disable support for debugging output],
-DEBUG=$enableval, DEBUG=yes)
-test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG)
+ENABLE_DEBUG=$enableval, ENABLE_DEBUG=yes)
+test x"${ENABLE_DEBUG}" = xyes && AC_DEFINE(ENABLE_DEBUG)
wget_need_md5=no
AC_TYPE_PID_T
AC_C_BIGENDIAN
-# Check size of long.
+dnl
+dnl Check integral type sizes.
+dnl
+AC_CHECK_SIZEOF(short)
+AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
+AC_CHECK_TYPES(int32_t)
+AC_CHECK_TYPES(u_int32_t)
dnl
dnl Checks for headers
AC_TYPE_SIGNAL
dnl
-dnl Check for struct utimbuf
+dnl Call several of Wget's macros.
+dnl
WGET_STRUCT_UTIMBUF
+WGET_SOCKLEN_T
dnl
dnl Checks for library functions.
dnl Checks for IPv6
dnl **********************************************************************
-dnl
-dnl If --enable-ipv6 is specified, we try to use IPv6 (as long as
-dnl getaddrinfo is also present). If --disable-ipv6 is specified, we
-dnl don't use IPv6 or getaddrinfo. If neither are specified, we test
-dnl whether it's possible to create an AF_INET6 socket and if yes, use
-dnl IPv6.
-dnl
-
-AC_MSG_CHECKING([whether to enable ipv6])
+ipv6=
+check_for_ipv6=no
AC_ARG_ENABLE(ipv6,
-AC_HELP_STRING([--enable-ipv6],[Enable ipv6 support])
-AC_HELP_STRING([--disable-ipv6],[Disable ipv6 support]),
-[ case "$enableval" in
+ AC_HELP_STRING([--disable-ipv6],[disable IPv6 support]),
+ [case "${enable_ipv6}" in
no)
- AC_MSG_RESULT(no)
- ipv6=no
- ;;
- *) AC_MSG_RESULT(yes)
- ipv6=yes
- ;;
- esac ],
-
- AC_TRY_RUN([ /* is AF_INET6 available? */
-#include <sys/types.h>
-#include <sys/socket.h>
-main()
-{
- if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
- exit(1);
- else
- exit(0);
-}
-],
- AC_MSG_RESULT(yes)
- ipv6=yes,
- AC_MSG_RESULT(no)
- ipv6=no,
- AC_MSG_RESULT(no)
- ipv6=no
-))
-
-if test x"$ipv6" = xyes; then
- WGET_CHECK_WORKING_GETADDRINFO
+ AC_MSG_NOTICE([Disabling IPv6 at user request])
+ ipv6=no
+ ;;
+ *)
+ ipv6=yes
+ ;;
+ esac],
+ [check_for_ipv6=no]
+)
+
+if test "X$ipv6" = "Xyes" || test "X$check_for_ipv6" = "Xyes"; then
+ AC_CHECK_FUNCS(getaddrinfo,[
+ GETADDRINFO_AI_ADDRCONFIG(
+ AC_DEFINE(
+ [HAVE_GETADDRINFO_AI_ADDRCONFIG], 1,
+ [Define if the system headers support the AI_ADDRCONFIG flag.]
+ )
+ )
+ GETADDRINFO_AI_V4MAPPED(
+ AC_DEFINE(
+ [HAVE_GETADDRINFO_AI_V4MAPPED], 1,
+ [Define if the system headers support the AI_V4MAPPED flag.]
+ )
+ )
+ GETADDRINFO_AI_ALL(
+ AC_DEFINE(
+ [HAVE_GETADDRINFO_AI_ALL], 1,
+ [Define if the system headers support the AI_ALL flag.]
+ )
+ )
+ ],[
+ AC_MSG_NOTICE([Disabling IPv6 support: your system does not support getaddrinfo(3)])
+ ipv6=no
+ ])
+fi
+
+if test "X$ipv6" = "Xyes" || test "X$check_for_ipv6" = "Xyes"; then
+ PROTO_INET6(,[
+ AC_MSG_NOTICE([Disabling IPv6 support: your system does not support the PF_INET6 protocol family])
+ ipv6=no
+ ])
+fi
+
+if test "X$ipv6" = "Xyes" || test "X$check_for_ipv6" = "Xyes"; then
+ TYPE_STRUCT_SOCKADDR_IN6([
+ ipv6=yes
+ ],[
+ AC_MSG_NOTICE([Disabling IPv6 support: your system does not support 'struct sockaddr_in6'])
+ ipv6=no
+ ])
+ if test "X$ipv6" = "Xyes"; then
+ MEMBER_SIN6_SCOPE_ID
+ fi
+fi
+
+if test "X$ipv6" = "Xyes"; then
+ AC_DEFINE([ENABLE_IPV6], 1, [Define if IPv6 support is enabled.])
fi
+
dnl
dnl Set of available languages.
dnl