Corrections for better 32bit systems support, and some minor fixes
diff --git a/CHANGES b/CHANGES
index 8034a75..69ad450 100644
--- a/CHANGES
+++ b/CHANGES
@@ -103,7 +103,7 @@
 	application to the getaddrinfo() function, when this flag is set while
 	no IP version is preferred by build, environment, option, or address
 	type, Socat chooses IPv6 because this might activate both versions (but
-	confirm option ipv6-v6only).
+	check option ipv6-v6only).
 	Added option ai-passive to control this flag explicitely.
 
 	New option ai-v4mapped (v4mapped) sets or unsets the AI_V4MAPPED flag
@@ -298,6 +298,8 @@
 	_FILE_OFFSET_BITS and _LARGE_FILES.
 	Thanks to Fergus Dall for sending a patch.
 
+	Some corrections for better 32bit systems support.
+
 Testing:
 	Removed obselete parts from test.sh
 
diff --git a/Makefile.in b/Makefile.in
index fdbcf67..c01b1a4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -131,7 +131,7 @@
 install: progs $(srcdir)/doc/socat.1
 	mkdir -p $(DESTDIR)$(BINDEST)
 	$(INSTALL) -m 755 socat $(DESTDIR)$(BINDEST)/socat1
-	ln -s socat1 $(DESTDIR)$(BINDEST)/socat
+	ln -sf socat1 $(DESTDIR)$(BINDEST)/socat
 	$(INSTALL) -m 755 socat-chain.sh  $(DESTDIR)$(BINDEST)
 	$(INSTALL) -m 755 socat-mux.sh    $(DESTDIR)$(BINDEST)
 	$(INSTALL) -m 755 socat-broker.sh $(DESTDIR)$(BINDEST)
@@ -139,7 +139,7 @@
 	$(INSTALL) -m 755 filan $(DESTDIR)$(BINDEST)
 	mkdir -p $(DESTDIR)$(MANDEST)/man1
 	$(INSTALL) -m 644 $(srcdir)/doc/socat.1 $(DESTDIR)$(MANDEST)/man1/socat1.1
-	ln -s socat1.1 $(DESTDIR)$(MANDEST)/man1/socat.1
+	ln -sf socat1.1 $(DESTDIR)$(MANDEST)/man1/socat.1
 
 uninstall:
 	rm -f $(DESTDIR)$(BINDEST)/socat
diff --git a/configure.ac b/configure.ac
index 009fd9c..f53e8e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -537,7 +537,7 @@
 	       [AC_DEFINE(WITH_SYSTEM) AC_MSG_RESULT(yes)])
 
 AC_MSG_CHECKING([whether to include shell invocation support])
-AC_ARG_ENABLE(system, [  --disable-shell         disable shell invocation support],
+AC_ARG_ENABLE(shell, [  --disable-shell         disable shell invocation support],
 	      [case "$enableval" in
 	       no) AC_MSG_RESULT(no);;
 	       *) AC_DEFINE(WITH_SHELL) AC_MSG_RESULT(yes);;
diff --git a/doc/socat.yo b/doc/socat.yo
index a9913b5..4c05fab 100644
--- a/doc/socat.yo
+++ b/doc/socat.yo
@@ -219,13 +219,14 @@
    creates it and continues, unlinks lockfile on exit.
 label(option_4)dit(bf(tt(-4)))
    Use IP version 4 in case the addresses do not implicitly or explicitly
-   specify a version; this is the default.
+   specify a version. Since version 1.8.0 the default is no preference.
 label(option_6)dit(bf(tt(-6)))
    Use IP version 6 in case the addresses do not implicitly or explicitly
    specify a version.
 label(option_statistics)dit(bf(tt(--statistics)))
+dit(bf(tt(-S)))
    Logs transfer statistics (bytes and blocks counters for both directions)
-   before terminating Socat.nl()
+   before terminating socat().nl()
    See also link(signal USR1)(signal_usr1).nl()
    This feature is experimental and might change in future versions.
 enddit()
@@ -1064,14 +1065,14 @@
    Expects a listening socket in <fdnum> and accepts one or (with option
    link(fork)(OPTION_FORK)) more connections. This address type is useful under
    systemd control with "inetd mode".nl()
-   Example: (link(example)(EXAMPLE_ADDRESS_ACCEPT_FD))
-   Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET)link(TCP)(GROUP_TCP),link(CHILD)(GROUP_CHILD),link(RETRY)(GROUP_RETRY) nl()
+   Example: (link(example)(EXAMPLE_ADDRESS_ACCEPT_FD))nl()
+   Option groups: link(FD)(GROUP_FD), link(SOCKET)(GROUP_SOCKET), link(TCP)(GROUP_TCP), link(CHILD)(GROUP_CHILD), link(RETRY)(GROUP_RETRY)nl()
    Useful options:
-   link(fork)(OPTION_FORK)),
+   link(fork)(OPTION_FORK),
    link(range)(OPTION_RANGE),
    link(sourceport)(OPTION_SOURCEPORT),
    link(lowport)(OPTION_LOWPORT),
-   link(tcpwrap)(OPTION_TCPWRAPPERS),
+   link(tcpwrap)(OPTION_TCPWRAPPERS)
 label(ADDRESS_SOCKS4)dit(bf(tt(SOCKS4:<socks-server>:<host>:<port>)))
    Connects via <socks-server> [link(IP address)(TYPE_IP_ADDRESS)]
    to <host> [link(IPv4 address)(TYPE_IPV4_ADDRESS)]
@@ -1507,6 +1508,7 @@
    Like link(UDP-RECV)(ADDRESS_UDP_RECV), but only supports IPv6 protocol.nl()
    Option groups: link(FD)(GROUP_FD),link(SOCKET)(GROUP_SOCKET),link(IP6)(GROUP_IP6),link(RANGE)(GROUP_RANGE)
 
+label(ADDRESS_UDPLITE)
 dit(bf(tt(UDPLITE-CONNECT:<host>:<port>)))
 dit(bf(tt(UDPLITE4-CONNECT:<host>:<port>)))
 dit(bf(tt(UDPLITE6-CONNECT:<host>:<port>)))
@@ -4120,7 +4122,7 @@
 
 htmlcommand(<hr><div class="shell">socat &#x5C;
     TCP-L:7777,reuseaddr,fork &#x5C;
-    SYSTEM:'filan -i 0 -s >&2',nofork</div>)
+    SYSTEM:'filan -i 0 -s >&amp;2',nofork</div>)
 
 listens for incoming TCP connections on port 7777. For each accepted
 connection, invokes a shell. This shell has its stdin and stdout directly
@@ -4212,7 +4214,7 @@
 mancommand(\.fi)
 
 htmlcommand(<hr><div class="shell">socat - &#x5C;
-    TCP:<server>:10021,reuseaddr,socktype=6,protocol=33,fork</div>)
+    TCP:&lt;server&gt;:10021,reuseaddr,socktype=6,protocol=33,fork</div>)
 
 is a simple DCCP client. DCCP is now directly provisioned in socat(),
 however this example shows how use socat()s TCP procedures, but changes the
diff --git a/test.sh b/test.sh
index c8e2529..f70ad89 100755
--- a/test.sh
+++ b/test.sh
@@ -146,7 +146,8 @@
 fi
 
 if type ss >/dev/null 2>&1; then
-    if ss -V |grep -q "^ss utility, iproute2-"; then
+    # on Ubuntu-10 ss has differing output format
+    if ss -V |grep -q "^ss utility, iproute2-[2-6]"; then
 	SS=$(type -p ss)
     else
 	unset SS
@@ -1050,13 +1051,13 @@
 		break;
 	    fi
 	done
-	[ "$i" ] && { echo "Only on (one of) $unames"; return -1; }
+	[ "$i" ] && { echo "Only on (one of) $unames"; return 255; }
     fi
 
     if [ "$root" = "root" ]; then
 	if [ $(id -u) -ne 0 -a "$withroot" -eq 0 ]; then
 	    echo "Must be root"
-	    return -1;
+	    return 255
 	fi
     fi
 
@@ -1064,7 +1065,7 @@
 	for i in $progs; do
 	    if ! type  >/dev/null 2>&1; then
 		echo "Program $i not available"
-		return -1
+		return 255
 	    fi
 	done
     fi
@@ -1072,21 +1073,21 @@
     if [ "$feats" ]; then
 	if ! F=$(testfeats $feats); then
 	    echo "Feature $F not configured in $SOCAT"
-	    return -1
+	    return 255
 	fi
     fi
 
     if [ "$addrs" ]; then
 	if ! A=$(testaddrs - $addrs); then
 	    echo "Address $A not available in $SOCAT"
-	    return -1
+	    return 255
 	fi
     fi
 
     if [ "$opts" ]; then
 	if ! o=$(testoptions $opts); then
 	    echo "Option $o not available in $SOCAT"
-	    return -1
+	    return 255
 	fi
     fi
 
@@ -1094,7 +1095,7 @@
 	for i in $runs; do
 	    if ! runs$i >/dev/null; then
 		echo "$i not available on host"
-		return -1;
+		return 255;
 	    fi
 	done
     fi
@@ -1102,7 +1103,7 @@
     if [ "$inet" ]; then
 	if [ -z "$NTERNET" ]; then
 	    echo "Use test.sh option --internet"
-	    return -1
+	    return 255
 	fi
     fi
     return 0
@@ -10045,6 +10046,7 @@
 if [ "$PORTMETHOD" == PORT ]; then
     newport $proto; tsp="$PORT"; 	# test server port
     tsa1="$tsp"; tsa2="$tsa"; tsa="$tsa:$tsp"	# tsa2 used for server bind=
+    TEST_SOCKPORT=$tsp
 else
     tsa1="$tsa"; tsa2=				# tsa1 used for addr parameter
 fi
@@ -10053,6 +10055,7 @@
 if [ $PORTMETHOD = PORT ]; then
     newport $proto; tcp="$PORT"; 	# test client port
     tca="$tca:$tcp"
+    TEST_PEERPORT=$tcp
 fi
 #CMD0="$TRACE $SOCAT $opts -u $KEYW-LISTEN:$tsa1 SYSTEM:\"export -p\""
 CMD0="$TRACE $SOCAT $opts -u -lpsocat $KEYW-LISTEN:$tsa1,$REUSEADDR SYSTEM:\"echo SOCAT_SOCKADDR=\\\$SOCAT_SOCKADDR; echo SOCAT_PEERADDR=\\\$SOCAT_PEERADDR; echo SOCAT_SOCKPORT=\\\$SOCAT_SOCKPORT; echo SOCAT_PEERPORT=\\\$SOCAT_PEERPORT; sleep 1\""
@@ -10076,8 +10079,8 @@
     listCANT="$listCANT $N"
 elif [ "$(grep SOCAT_SOCKADDR "${tf}" |sed -e 's/^[^=]*=//' |sed -e "s/[\"']//g")" = "$TEST_SOCKADDR" -a \
     "$(grep SOCAT_PEERADDR "${tf}" |sed -e 's/^[^=]*=//' -e "s/[\"']//g")" = "$TEST_PEERADDR" -a \
-    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_SOCKPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$tsp" \) -a \
-    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_PEERPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$tcp" \) \
+    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_SOCKPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$TEST_SOCKPORT" \) -a \
+    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_PEERPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$TEST_PEERPORT" \) \
     ]; then
     $PRINTF "$OK\n"
     if [ "$debug" ]; then
@@ -18589,6 +18592,7 @@
 if [ "$PORTMETHOD" = PORT ]; then
     newport $proto; tsp="$PORT"; 	# test server port
     tsa1="$tsp"; tsa2="$tsa"; tsa="$tsa:$tsp"	# tsa2 used for server bind=
+    TEST_SOCKPORT=$tsp
 else
     tsa1="$tsa"; tsa2=				# tsa1 used for addr parameter
 fi
@@ -18597,6 +18601,7 @@
 if [ "$PORTMETHOD" = PORT ]; then
     newport $proto; tcp="$PORT"; 	# test client port
     tca="$tca:$tcp"
+    TEST_PEERPORT=$tcp
 fi
 #CMD0="$TRACE $SOCAT $opts -u $KEYW-LISTEN:$tsa1 SYSTEM:\"export -p\""
 CMD0="$TRACE $SOCAT $opts -u -lpsocat $KEYW-LISTEN:$tsa1,$REUSEADDR SYSTEM:\"echo SOCAT_SOCKADDR=\\\$SOCAT_SOCKADDR; echo SOCAT_PEERADDR=\\\$SOCAT_PEERADDR; echo SOCAT_SOCKPORT=\\\$SOCAT_SOCKPORT; echo SOCAT_PEERPORT=\\\$SOCAT_PEERPORT; sleep 1\""
@@ -18620,8 +18625,8 @@
     listCANT="$listCANT $N"
 elif [ "$(grep SOCAT_SOCKADDR "${tf}" |sed -e 's/^[^=]*=//' |sed -e "s/[\"']//g")" = "$TEST_SOCKADDR" -a \
     "$(grep SOCAT_PEERADDR "${tf}" |sed -e 's/^[^=]*=//' -e "s/[\"']//g")" = "$TEST_PEERADDR" -a \
-    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_SOCKPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$tsp" \) -a \
-    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_PEERPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$tcp" \) \
+    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_SOCKPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$TEST_SOCKPORT" \) -a \
+    \( "$PORTMETHOD" = ',' -o "$(grep SOCAT_PEERPORT "${tf}" |sed -e 's/^[^=]*=//' |sed -e 's/"//g')" = "$TEST_PEERPORT" \) \
     ]; then
     $PRINTF "$OK\n"
     if [ "$debug" ]; then
@@ -18866,7 +18871,7 @@
 # Test the socat-chain.sh script by driving SSL over serial
 NAME=SOCAT_CHAIN_SSL_PTY
 case "$TESTS" in
-*%$N%*|*%functions%*|*%scripts%*|*%socat-chain%*|*%listen%*|*%fork%*|*%ip4%*|*%tcp4%*|*%unix%*|*%socket%*|*%pty%*|*%$NAME%*)
+*%$N%*|*%functions%*|*%scripts%*|*%socat-chain%*|*%listen%*|*%fork%*|*%ip4%*|*%tcp4%*|*%openssl%*|*%unix%*|*%socket%*|*%pty%*|*%$NAME%*)
 TEST="$NAME: test socat-chain.sh with SSL over PTY"
 # Run a socat-chain.sh instance with SSL listening behind a PTY;
 # open the PTY with socat-chein.sh using SSL;
diff --git a/xio-openssl.c b/xio-openssl.c
index 2948cab..0205146 100644
--- a/xio-openssl.c
+++ b/xio-openssl.c
@@ -640,7 +640,11 @@
 
       /* this can fork() for us; it only returns on error or on
 	 successful establishment of connection */
-      if (ipproto == IPPROTO_TCP || ipproto == IPPROTO_DCCP) {
+      if (ipproto == IPPROTO_TCP
+#ifdef IPPROTO_DCCP
+	  || ipproto == IPPROTO_DCCP
+#endif
+	  ) {
 	 result = _xioopen_listen(sfd, xioflags,
 			       (struct sockaddr *)us, uslen,
 			       opts, pf, socktype, ipproto,
diff --git a/xio-progcall.c b/xio-progcall.c
index 9b302f0..202c554 100644
--- a/xio-progcall.c
+++ b/xio-progcall.c
@@ -52,9 +52,9 @@
 		   struct opt **optsp,	/* in: opts; out: opts for parent/child */
 		   int *duptostderr	/* out: redirect stderr to output fd */
 		) {
-   struct opt *opts;	/* common options */
-   struct opt *popts;	/* parent options */
-   struct opt *copts;	/* child options */
+   struct opt *opts;		/* common options */
+   struct opt *popts = NULL;	/* parent options */
+   struct opt *copts;		/* child options */
    int numleft;
    int d, sv[2], rdpip[2], wrpip[2];
    int rw = (xioflags & XIO_ACCMODE);
@@ -613,7 +613,9 @@
       Info("child process notified parent that it is ready");
    }
 
+#if HAVE_PTY
    applyopts(sfd, ptyfd, popts, PH_LATE);
+#endif /* HAVE_PTY */
    if (applyopts_single(sfd, popts, PH_LATE) < 0)
       return -1;
 
diff --git a/xio-proxy.c b/xio-proxy.c
index 07db8f8..da9fcea 100644
--- a/xio-proxy.c
+++ b/xio-proxy.c
@@ -253,7 +253,8 @@
 	 /* parent process */
 	 Close(sfd->fd);
 	 Nanosleep(&sfd->intervall, NULL);
-	 dropopts(opts, PH_ALL);  opts = copyopts(opts0, GROUP_ALL);
+	 dropopts(opts, PH_ALL);
+	 opts = copyopts(opts0, GROUP_ALL);
 	 continue;
       } else
 #endif /* WITH_RETRY */
diff --git a/xio-socket.c b/xio-socket.c
index c42ce11..c869b6d 100644
--- a/xio-socket.c
+++ b/xio-socket.c
@@ -1165,7 +1165,7 @@
    }
 
    applyopts(sfd, -1, opts, PH_PASTSOCKET);
-   //applyopts(sfd, -1, opts, PH_FD);
+   /*! applyopts(sfd, -1, opts, PH_FD); */
 
    applyopts_cloexec(sfd->fd, opts);
 
@@ -1389,7 +1389,7 @@
    }
 
    applyopts(sfd, -1, opts, PH_PASTSOCKET);
-   //applyopts(sfd, -1, opts, PH_FD);
+   /*! applyopts(sfd, -1, opts, PH_FD); */
 
    applyopts_cloexec(sfd->fd, opts);
 
diff --git a/xio-udp.c b/xio-udp.c
index 68743e6..b624281 100644
--- a/xio-udp.c
+++ b/xio-udp.c
@@ -6,7 +6,7 @@
 
 #include "xiosysincludes.h"
 
-#if WITH_UDP && (WITH_IP4 || WITH_IP6)
+#if _WITH_UDP && (WITH_IP4 || WITH_IP6)
 
 #include "xioopen.h"
 #include "xio-socket.h"
@@ -18,6 +18,7 @@
 
 #include "xio-udp.h"
 
+#if WITH_UDP
 
 const struct addrdesc xioaddr_udp_connect  = { "UDP-CONNECT",    1+XIO_RDWR,   xioopen_ipapp_connect, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_UDP, SOCK_DGRAM, IPPROTO_UDP, PF_UNSPEC HELP(":<host>:<port>") };
 #if WITH_LISTEN
@@ -50,6 +51,8 @@
 const struct addrdesc xioaddr_udp6_recv    = { "UDP6-RECV",      1+XIO_RDONLY, xioopen_udp_recv,     GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP6|GROUP_IP_UDP|GROUP_RANGE,             PF_INET6, SOCK_DGRAM, IPPROTO_UDP  HELP(":<port>") };
 #endif /* WITH_IP6 */
 
+#endif /* WITH_UDP */
+
 
 int _xioopen_ipdgram_listen(struct single *sfd,
 	int xioflags, union sockaddr_union *us, socklen_t uslen,
@@ -469,13 +472,17 @@
 
    if (sfd->para.socket.ip.dosourceport) {
       switch (sfd->peersa.soa.sa_family) {
-      case PF_INET:
       default:
+#if WITH_IP4
+      case PF_INET:
 	 sfd->para.socket.ip.sourceport = ntohs(sfd->peersa.ip4.sin_port);
 	 break;
+#endif /* WITH_IP4 */
+#if WITH_IP6
       case PF_INET6:
 	 sfd->para.socket.ip.sourceport = ntohs(sfd->peersa.ip6.sin6_port);
 	 break;
+#endif /* WITH_IP6 */
       }
    }
 
@@ -708,4 +715,4 @@
    return result;
 }
 
-#endif /* WITH_UDP && (WITH_IP4 || WITH_IP6) */
+#endif /* _WITH_UDP && (WITH_IP4 || WITH_IP6) */
diff --git a/xio.h b/xio.h
index a7e6600..0724314 100644
--- a/xio.h
+++ b/xio.h
@@ -348,6 +348,7 @@
       enum xiotag tag;
       const struct addrdesc *addr;
       int         flags;
+      /* until here, keep consistent with struct single, and with .dual */
    } common; 	/* "bipipe.common" */
    struct single  stream;
    struct {
@@ -368,6 +369,7 @@
       bool      havelock;	/* we are happy owner of the above lock */
       int 	triggerfd; 	/* close this FD in child process to notify parent */
       bool      cool_write;	/* downlevel EPIPE, ECONNRESET to notice */
+      /* until here, keep consistent with struct single ! */
       struct single *stream[2];	/* input stream, output stream */
    } dual;
 } xiofile_t;
diff --git a/xioconfig.h b/xioconfig.h
index 1194a2f..1c12c1a 100644
--- a/xioconfig.h
+++ b/xioconfig.h
@@ -48,11 +48,15 @@
 #endif
 
 #if !WITH_IP4 && !WITH_IP6
-#  if WITH_TCP || WITH_UDP || WITH_RAWIP
+#  if WITH_TCP || WITH_UDP || WITH_SCTP || WITH_DCCP || WITH_UDPLITE || WITH_RAWIP
 #    define WITH_IP4 1
 #  endif
 #endif
 
+#if WITH_UDP || WITH_UDPLITE
+#  define _WITH_UDP 1
+#endif
+
 #if WITH_UNIX || WITH_IP4 || WITH_IP6 || WITH_SOCKS4 || WITH_RAWIP || WITH_GENERICSOCKET
 #  define _WITH_SOCKET 1
 #else
diff --git a/xioopen.c b/xioopen.c
index fdcb38d..be17e3b 100644
--- a/xioopen.c
+++ b/xioopen.c
@@ -735,10 +735,10 @@
       return -1;
 #endif /* WITH_NAMESPACES */
 
-#if HAVE_RESOLV_H
+#if WITH_RESOLVE && HAVE_RESOLV_H
    if ((do_res = xio_res_init(sfd, &save_res)) < 0)
       return STAT_NORETRY;
-#endif /* HAVE_RESOLV_H */
+#endif /* WITH_RESOLVE && HAVE_RESOLV_H */
 
    if (xio_chdir(sfd->opts, &orig_dir) < 0)
       return STAT_NORETRY;
diff --git a/xioopts.c b/xioopts.c
index d962f96..4b651aa 100644
--- a/xioopts.c
+++ b/xioopts.c
@@ -451,7 +451,7 @@
 #ifdef VDISCARD
 	IF_TERMIOS("discard",	&opt_vdiscard)
 #endif
-#if HAVE_RES_NSADDR_LIST
+#if WITH_RESOLVE && HAVE_RESOLV_H && HAVE_RES_NSADDR_LIST
 	IF_IP     ("dns",		&opt_res_nsaddr)
 #endif
 #if HAVE_RESOLV_H
@@ -566,7 +566,7 @@
 	IF_ANY 	  ("f-setlkw",	&opt_f_setlkw_wr)
 	IF_ANY 	  ("f-setlkw-rd",	&opt_f_setlkw_rd)
 	IF_ANY 	  ("f-setlkw-wr",	&opt_f_setlkw_wr)
-#if defined(F_SETPIPE_SZ)
+#if WITH_PIPE && defined(F_SETPIPE_SZ)
 	IF_ANY    ("f-setpipe-sz",	&opt_f_setpipe_sz)
 #endif
 	IF_EXEC   ("fdin",	&opt_fdin)
@@ -1047,7 +1047,7 @@
 	IF_IP     ("multicast-ttl",	&opt_ip_multicast_ttl)
 	IF_IP     ("multicastloop",	&opt_ip_multicast_loop)
 	IF_IP     ("multicastttl",	&opt_ip_multicast_ttl)
-#if HAVE_RES_NSADDR_LIST
+#if WITH_RESOLVE && HAVE_RESOLV_H && HAVE_RES_NSADDR_LIST
 	IF_IP     ("nameserver",	&opt_res_nsaddr)
 #endif
 #if defined(O_NDELAY) && (!defined(O_NONBLOCK) || O_NDELAY != O_NONBLOCK)
@@ -1115,7 +1115,7 @@
 	IF_OPENSSL("nosni",		&opt_openssl_no_sni)
 #endif
 	IF_INTERFACE("notrailers",	&opt_iff_notrailers)
-#if HAVE_RES_NSADDR_LIST
+#if WITH_RESOLVE && HAVE_RESOLV_H && HAVE_RES_NSADDR_LIST
 	IF_IP     ("nsaddr",		&opt_res_nsaddr)
 #endif
 #ifdef O_NSHARE
@@ -1326,7 +1326,7 @@
 	IF_SOCKET ("pf",	&opt_protocol_family)
 	IF_EXEC   ("pgid",	&opt_setpgid)
 	IF_EXEC   ("pipes",	&opt_pipes)
-#if defined(F_SETPIPE_SZ)
+#if WITH_PIPE && defined(F_SETPIPE_SZ)
 	IF_ANY    ("pipesz",	&opt_f_setpipe_sz)
 #endif
 #ifdef IP_PKTINFO
@@ -1462,7 +1462,7 @@
 #  if HAVE_RES_RETRY
 	IF_RESOLVE("res-maxretry",	&opt_res_retry)
 #  endif
-#  if HAVE_RES_NSADDR_LIST
+#if WITH_RESOLVE && HAVE_RESOLV_H && HAVE_RES_NSADDR_LIST
 	IF_IP     ("res-nsaddr",	&opt_res_nsaddr)
 #  endif
 #  if WITH_RES_PRIMARY
diff --git a/xioopts.h b/xioopts.h
index d4dad86..4fd2287 100644
--- a/xioopts.h
+++ b/xioopts.h
@@ -192,11 +192,11 @@
 /* Keep condition consistent with xio.h:groups_t! */
 #if WITH_POSIXMQ || WITH_SCTP || WITH_DCCP || WITH_UDPLITE
 /* The following groups are not expected on systems without uint64_t */
-#define GROUP_POSIXMQ	0x0100000000U
-#define GROUP_IP_SCTP	0x0200000000U
-#define GROUP_IP_DCCP	0x0400000000U
-#define GROUP_IP_UDPLITE 0x0800000000U
-#define GROUP_ALL	0x0fffffffffU
+#define GROUP_POSIXMQ	((groups_t)0x0100000000ULL)
+#define GROUP_IP_SCTP	((groups_t)0x0200000000ULL)
+#define GROUP_IP_DCCP	((groups_t)0x0400000000ULL)
+#define GROUP_IP_UDPLITE ((groups_t)0x0800000000ULL)
+#define GROUP_ALL	((groups_t)0x0fffffffffULL) 	/* OMG... for 32bit systems */
 #else /* !(WITH_POSIXMQ || WITH_SCTP || WITH_DCCP || WITH_UDPLITE) */
 #define GROUP_POSIXMQ	0
 #define GROUP_IP_SCTP	0