This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix perl build problems on Stratus VOS
authorPaul Green <Paul.Green@stratus.com>
Sun, 3 Oct 2010 21:18:17 +0000 (14:18 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 3 Oct 2010 21:18:17 +0000 (14:18 -0700)
The attached text files contain patches to correct build problems on the
Stratus VOS (recently renamed "OpenVOS") operating system. I have tested
these changes on OpenVOS Release 17.0, which is the most-current
customer release. None of these changes should affect any other OS.

Makefile.SH: This patch removes the "miniperl" dependency of the "all"
target. On an operating system that does not require an executable
suffix, the miniperl$(EXE_EXT) dependency evaluates to "miniperl", too.
But on an operating system like VOS that does have an executable suffix,
miniperl$(EXE_EXT) evaluates to (in our case) "miniperl.pm" and the
"miniperl" target is unresolved.

ext/Socket/Socket.xs: Sadly, OpenVOS does not yet support IPv6. I edited
the code to allow for this case, while retaining IPv6 support for
operating systems that do support it.

Makefile.SH
ext/Socket/Socket.xs

index 0a8a0ae..ab2f202 100755 (executable)
@@ -555,7 +555,7 @@ splintfiles = $(c1)
 .c.s:
        $(CCCMDSRC) -S $*.c
 
-all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) miniperl $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
+all: $(FIRSTMAKEFILE) $(MINIPERL_EXE) $(generated_pods) $(private) $(unidatafiles) $(public) $(dynamic_ext) $(nonxs_ext) extras.make
        @echo " ";
        @echo " Everything is up to date. Type '$(MAKE) test' to run test suite."
 
index af76554..e2f995b 100644 (file)
@@ -465,22 +465,34 @@ inet_ntop(af, ip_address_sv)
         CODE:
 #ifdef HAS_INETNTOP
        STRLEN addrlen, struct_size;
+#ifdef AF_INET6
        struct in6_addr addr;
        char str[INET6_ADDRSTRLEN];
+#else
+       struct in_addr addr;
+       char str[INET_ADDRSTRLEN];
+#endif
        char *ip_address = SvPV(ip_address_sv, addrlen);
 
-        if(af == AF_INET) {
-            struct_size = sizeof(struct in_addr);
-        } else if(af == AF_INET6) {
-            struct_size = sizeof(struct in6_addr);
-        } else {
-           croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6",
+       struct_size = sizeof(addr);
+
+       if(af != AF_INET
+#ifdef AF_INET6
+           && af != AF_INET6
+#endif
+         ) {
+           croak("Bad address family for %s, got %d, should be"
+#ifdef AF_INET6
+              " either AF_INET or AF_INET6",
+#else
+              " AF_INET",
+#endif
                "Socket::inet_ntop",
                af);
         }
 
        Copy( ip_address, &addr, sizeof addr, char );
-       inet_ntop(af, &addr, str, INET6_ADDRSTRLEN);
+       inet_ntop(af, &addr, str, sizeof str);
 
        ST(0) = newSVpvn_flags(str, strlen(str), SVs_TEMP);
 #else
@@ -494,9 +506,23 @@ inet_pton(af, host)
         CODE:
 #ifdef HAS_INETPTON
         int ok;
-        struct in6_addr ip_address;
-        if(af != AF_INET && af != AF_INET6) {
-           croak("Bad address family for %s, got %d, should be either AF_INET or AF_INET6",
+#ifdef AF_INET6
+       struct in6_addr ip_address;
+#else
+       struct in_addr ip_address;
+#endif
+
+       if(af != AF_INET
+#ifdef AF_INET6
+               && af != AF_INET6
+#endif
+         ) {
+               croak("Bad address family for %s, got %d, should be"
+#ifdef AF_INET6
+                       " either AF_INET or AF_INET6",
+#else
+                       " AF_INET",
+#endif
                         "Socket::inet_pton",
                         af);
         }
@@ -504,8 +530,7 @@ inet_pton(af, host)
 
         ST(0) = sv_newmortal();
         if (ok) {
-                sv_setpvn( ST(0), (char *)&ip_address,
-                           af == AF_INET6 ? sizeof(ip_address) : sizeof(struct in_addr) );
+                sv_setpvn( ST(0), (char *)&ip_address, sizeof(ip_address) );
         }
 #else
         ST(0) = (SV *)not_here("inet_pton");