summaryrefslogtreecommitdiff
path: root/mcon
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-12-11 23:44:52 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2010-12-11 23:44:52 +0000
commit47e243141e71a76fbcc8b5729dbf31641f367689 (patch)
treebeee84198cd4f300b499a256f8df5be95bfba5d7 /mcon
parentef1ed4bd13e61d85426eba5e4bc6c6009fee6587 (diff)
Try to improve tests for socket-related functions on Windows.
git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@57 2592e710-e01b-42a5-8df0-11608a6cc53d
Diffstat (limited to 'mcon')
-rw-r--r--mcon/U/d_fd_set.U5
-rw-r--r--mcon/U/d_getaddrinfo.U23
-rw-r--r--mcon/U/d_iptos.U29
-rw-r--r--mcon/U/d_ipv6.U13
-rw-r--r--mcon/U/d_msg_flags.U17
-rw-r--r--mcon/U/d_select.U2
-rw-r--r--mcon/U/d_sockaddr_in_sin_len.U14
-rw-r--r--mcon/U/d_socket.U9
-rw-r--r--mcon/U/i_mswsock.U27
-rw-r--r--mcon/U/i_ws2tcpip.U27
-rw-r--r--mcon/U/selecttype.U5
11 files changed, 150 insertions, 21 deletions
diff --git a/mcon/U/d_fd_set.U b/mcon/U/d_fd_set.U
index 8e13de2..412ebd8 100644
--- a/mcon/U/d_fd_set.U
+++ b/mcon/U/d_fd_set.U
@@ -22,7 +22,7 @@
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_fd_set d_fd_macros d_fds_bits: cat +cc +ccflags rm Oldconfig \
- d_socket i_systime i_sysselct
+ d_socket i_systime i_sysselct i_syssock
?MAKE: -pick add $@ %<
?S:d_fd_set:
?S: This variable contains the eventual value of the HAS_FD_SET symbol,
@@ -72,10 +72,13 @@ $cat >fd_set.c <<EOCP
#$i_systime I_SYS_TIME
#$i_sysselct I_SYS_SELECT
#$d_socket HAS_SOCKET
+#$i_syssock I_SYS_SOCKET
#include <sys/types.h>
#ifdef HAS_SOCKET
+#ifdef I_SYS_SOCKET
#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
#endif
+#endif
#ifdef I_SYS_TIME
#include <sys/time.h>
#endif
diff --git a/mcon/U/d_getaddrinfo.U b/mcon/U/d_getaddrinfo.U
index 3f2f3f2..5e492fb 100644
--- a/mcon/U/d_getaddrinfo.U
+++ b/mcon/U/d_getaddrinfo.U
@@ -8,7 +8,8 @@
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
-?MAKE:d_getaddrinfo: Trylink cat i_arpainet i_netdb
+?MAKE:d_getaddrinfo: Trylink cat i_arpainet i_netdb i_syssock \
+ i_winsock2 i_ws2tcpip i_niin
?MAKE: -pick add $@ %<
?S:d_getaddrinfo:
?S: This variable conditionally defines the HAS_GETADDRINFO symbol, which
@@ -22,17 +23,31 @@
?LINT: set d_getaddrinfo
: can we use getaddrinfo?
$cat >try.c <<EOC
+#$i_syssock I_SYS_SOCKET
+#$i_winsock2 I_WINSOCK2
+#$i_ws2tcpip I_WS2TCPIP
+#$i_niin I_NETINET_IN
+#$i_arpainet I_ARPA_INET
+#$i_netdb I_NETDB
#include <sys/types.h>
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_NETINET_IN
#include <netinet/in.h>
-#$i_arpainet I_ARPA_INET
+#endif
#ifdef I_ARPA_INET
#include <arpa/inet.h>
#endif
-#$i_netdb I_NETDB
#ifdef I_NETDB
#include <netdb.h>
#endif
+#ifdef I_WINSOCK2
+#include <Winsock2.h>
+#endif
+#ifdef I_WS2TCPIP
+#include <Ws2tcpip.h>
+#endif
int main(void)
{
struct addrinfo hints, *res;
@@ -58,6 +73,6 @@ int main(void)
}
EOC
cyn=getaddrinfo
-set d_getaddrinfo
+set d_getaddrinfo '-lWs2_32'
eval $trylink
diff --git a/mcon/U/d_iptos.U b/mcon/U/d_iptos.U
index 73ff978..715c76e 100644
--- a/mcon/U/d_iptos.U
+++ b/mcon/U/d_iptos.U
@@ -9,7 +9,7 @@
?RCS: of the source tree for dist 4.0.
?RCS:
?MAKE:d_iptos: cat rm contains cppstdin cppflags cppminus \
- i_niin i_sysin i_niip test Setvar
+ i_niin i_sysin i_niip i_syssock i_winsock2 i_ws2tcpip test Setvar
?MAKE: -pick add $@ %<
?S:d_iptos:
?S: This variable conditionally defines the USE_IP_TOS symbol, which
@@ -35,11 +35,23 @@ case "$i_niin" in
*)
case "$i_sysin" in
"$define") inh=sys/in.h;;
+ *)
+ case "$i_ws2tcpip" in
+ "$define") inh=Ws2tcpip.h;;
+ esac
+ ;;
esac
;;
esac
$cat >iptos <<EOM
+#$i_syssock I_SYS_SOCKET
+#$i_winsock2 I_WINSOCK2
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_WINSOCK2
+#include <Winsock2.h>
+#endif
#include <$inh>
#if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT)
YES
@@ -52,12 +64,15 @@ if $contains 'YES' iptos.h >/dev/null 2>&1; then
echo "You have IP TOS support in <$inh>." >&4
elif $test "x$i_niip" = "x$define"; then
$cat >iptos <<EOM
- #include <sys/socket.h>
- #include <$inh>
- #include <netinet/ip.h>
- #if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT)
- YES
- #endif
+#$i_syssock I_SYS_SOCKET
+#ifdef I_SYS_SOCKET
+#include <sys/socket.h>
+#endif
+#include <$inh>
+#include <netinet/ip.h>
+#if defined(IP_TOS) && defined(IPTOS_LOWDELAY) && defined(IPTOS_THROUGHPUT)
+YES
+#endif
EOM
$cppstdin $cppflags $cppminus <iptos >iptos.h 2>/dev/null
if $contains 'YES' iptos.h >/dev/null 2>&1; then
diff --git a/mcon/U/d_ipv6.U b/mcon/U/d_ipv6.U
index d84f346..14020cd 100644
--- a/mcon/U/d_ipv6.U
+++ b/mcon/U/d_ipv6.U
@@ -8,7 +8,7 @@
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
-?MAKE:d_ipv6: Trylink cat i_arpainet i_netdb
+?MAKE:d_ipv6: Trylink cat i_arpainet i_netdb i_syssock i_niin i_winsock2
?MAKE: -pick add $@ %<
?S:d_ipv6:
?S: This variable conditionally defines HAS_IPV6.
@@ -26,14 +26,21 @@ case "$d_ipv6" in
;;
*)
$cat >try.c <<EOC
+#$i_syssock I_SYS_SOCKET
+#$i_winsock2 I_WINSOCK2
+#$i_niin I_NETINET_IN
+#$i_arpainet I_ARPA_INET
+#$i_netdb I_NETDB
#include <sys/types.h>
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_NETINET_IN
#include <netinet/in.h>
-#$i_arpainet I_ARPA_INET
+#endif
#ifdef I_ARPA_INET
#include <arpa/inet.h>
#endif
-#$i_netdb I_NETDB
#ifdef I_NETDB
#include <netdb.h>
#endif
diff --git a/mcon/U/d_msg_flags.U b/mcon/U/d_msg_flags.U
index 299d75f..77d8d63 100644
--- a/mcon/U/d_msg_flags.U
+++ b/mcon/U/d_msg_flags.U
@@ -8,7 +8,8 @@
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
-?MAKE:d_msghdr_msg_flags: Trylink cat
+?MAKE:d_msghdr_msg_flags: Trylink cat i_systypes i_sysselct \
+ i_winsock2 i_mswsock
?MAKE: -pick add $@ %<
?S:d_msghdr_msg_flags:
?S: This variable conditionally defines the HAS_MSGHDR_MSG_FLAGS symbol,
@@ -24,8 +25,22 @@
?LINT:set d_msghdr_msg_flags
: check for msg_flags in struct msghdr
$cat >try.c <<EOC
+#$i_systypes I_SYS_TYPES
+#$i_sysselct I_SYS_SELECT
+#$i_winsock2 I_WINSOCK2
+#$i_mswsock I_MSWSOCK
+#ifdef I_SYS_TYPES
#include <sys/types.h>
+#endif
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_WINSOCK2
+#include <Winsock2.h>
+#endif
+#ifdef I_MSWSOCK
+#include <Mswsock.h>
+#endif
int main(void)
{
struct msghdr msg;
diff --git a/mcon/U/d_select.U b/mcon/U/d_select.U
index 130998d..372379b 100644
--- a/mcon/U/d_select.U
+++ b/mcon/U/d_select.U
@@ -56,6 +56,6 @@ int main(void)
}
EOC
cyn=select
-set d_select '-lWs_32'
+set d_select '-lWs2_32'
eval $trylink
diff --git a/mcon/U/d_sockaddr_in_sin_len.U b/mcon/U/d_sockaddr_in_sin_len.U
index 443f97e..763cff7 100644
--- a/mcon/U/d_sockaddr_in_sin_len.U
+++ b/mcon/U/d_sockaddr_in_sin_len.U
@@ -8,7 +8,7 @@
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
-?MAKE:d_sockaddr_in_sin_len: Trylink cat i_arpainet
+?MAKE:d_sockaddr_in_sin_len: Trylink cat i_arpainet i_syssock i_winsock2 i_niin
?MAKE: -pick add $@ %<
?S:d_sockaddr_in_sin_len:
?S: This variable conditionally defines the HAS_SOCKADDR_IN_SIN_LEN symbol,
@@ -23,13 +23,23 @@
?LINT: set d_sockaddr_in_sin_len
: does struct sockaddr_in has sin_len
$cat >try.c <<EOC
+#$i_syssock I_SYS_SOCKET
+#$i_niin I_NETINET_IN
+#$i_winsock2 I_WINSOCK2
+#$i_arpainet I_ARPA_INET
#include <sys/types.h>
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_NETINET_IN
#include <netinet/in.h>
-#$i_arpainet I_ARPA_INET
+#endif
#ifdef I_ARPA_INET
#include <arpa/inet.h>
#endif
+#ifdef I_WINSOCK2
+#include <Winsock2.h>
+#endif
int main(void)
{
static struct sockaddr_in addr;
diff --git a/mcon/U/d_socket.U b/mcon/U/d_socket.U
index ff7993f..29082e3 100644
--- a/mcon/U/d_socket.U
+++ b/mcon/U/d_socket.U
@@ -19,7 +19,7 @@
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_socket d_oldsock d_sockpair socketlib sockethdr: contains libc \
- echo n c nm_opt nm_extract Trylink Csym _a cat
+ echo n c nm_opt nm_extract Trylink Csym _a cat i_syssock i_winsock2
?MAKE: -pick add $@ %<
?S:d_socket:
?S: This variable conditionally defines HAS_SOCKET, which indicates
@@ -118,7 +118,14 @@ fi
@if HAS_SOCKETPAIR || d_sockpair
: see if socketpair exists
$cat >try.c <<EOC
+#$i_syssock I_SYS_SOCKET
+#$i_winsock2 I_WINSOCK2
+#ifdef I_SYS_SOCKET
#include <sys/socket.h>
+#endif
+#ifdef I_WINSOCK2
+#include <Winsock2.h>
+#endif
int main(void)
{
static int ret, domain, type, protocol, sv[2];
diff --git a/mcon/U/i_mswsock.U b/mcon/U/i_mswsock.U
new file mode 100644
index 0000000..69e6c13
--- /dev/null
+++ b/mcon/U/i_mswsock.U
@@ -0,0 +1,27 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, 2010 Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:i_mswsock: Inhdr
+?MAKE: -pick add $@ %<
+?S:i_mswsock:
+?S: This variable conditionally defines the I_MSWSOCK symbol, and indicates
+?S: whether a C program may include <Mswsock.h>.
+?S:.
+?C:I_MSWSOCK:
+?C: This symbol, if defined, indicates to the C program that it should
+?C: include <Mswsock.h>.
+?C:.
+?H:#$i_mswsock I_MSWSOCK /**/
+?H:.
+?LINT:set i_mswsock
+: see if this is a mswsock.h system
+set mswsock.h i_mswsock
+eval $inhdr
+
diff --git a/mcon/U/i_ws2tcpip.U b/mcon/U/i_ws2tcpip.U
new file mode 100644
index 0000000..e09cd6e
--- /dev/null
+++ b/mcon/U/i_ws2tcpip.U
@@ -0,0 +1,27 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 1991-1997, 2004-2006, 2010, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?MAKE:i_ws2tcpip: Inhdr
+?MAKE: -pick add $@ %<
+?S:i_ws2tcpip:
+?S: This variable conditionally defines the I_WS2TCPIP symbol, and indicates
+?S: whether a C program may include <Ws2tcpip.h>.
+?S:.
+?C:I_WS2TCPIP:
+?C: This symbol, if defined, indicates to the C program that it should
+?C: include <Ws2tcpip.h>.
+?C:.
+?H:#$i_ws2tcpip I_WS2TCPIP /**/
+?H:.
+?LINT:set i_ws2tcpip
+: see if this is a ws2tcpip.h system
+set ws2tcpip.h i_ws2tcpip
+eval $inhdr
+
diff --git a/mcon/U/selecttype.U b/mcon/U/selecttype.U
index 1debbc1..9402dad 100644
--- a/mcon/U/selecttype.U
+++ b/mcon/U/selecttype.U
@@ -21,7 +21,7 @@
?RCS: patch30: created by ADO
?RCS:
?MAKE:selecttype: cat +cc +ccflags rm Oldconfig Myread \
- d_fd_set d_select d_socket i_systime i_sysselct i_winsock2
+ d_fd_set d_select d_socket i_systime i_sysselct i_winsock2 i_syssock
?MAKE: -pick add $@ %<
?S:selecttype:
?S: This variable holds the type used for the 2nd, 3rd, and 4th
@@ -67,12 +67,15 @@ EOM
$cat >try.c <<EOCP
#$i_systime I_SYS_TIME
#$i_sysselct I_SYS_SELECT
+#$i_syssock I_SYS_SOCKET
#$i_winsock2 I_WINSOCK2
#$d_socket HAS_SOCKET
#include <sys/types.h>
#ifdef HAS_SOCKET
+#ifdef I_SYS_SOCKET
#include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
#endif
+#endif
#ifdef I_SYS_TIME
#include <sys/time.h>
#endif