This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tru64: the socket API defines must come early.
authorJarkko Hietaniemi <jhi@iki.fi>
Wed, 8 Oct 2014 06:40:21 +0000 (08:40 +0200)
committerJarkko Hietaniemi <jhi@iki.fi>
Wed, 8 Oct 2014 20:37:29 +0000 (22:37 +0200)
There seems to be no way around needing to select the socket API early.

hints/dec_osf.sh
perl.h

index 5a16806..1897d6b 100644 (file)
@@ -528,7 +528,6 @@ gcc)   ;;
        # -readonly_strings moves string constants into read-only section
        #  which hopefully means that modifying them leads into segmentation
        #  faults.
-       #
        for i in -trapuv -readonly_strings
        do
                case "$ccflags" in
@@ -539,8 +538,24 @@ gcc)   ;;
        ;;
 esac
 
-# Would need -D_SOCKADDR_LEN for the Configure test.
-d_sockaddr_sa_len='define'
+# In Tru64 several slightly incompatible socket APIs are supported,
+# which one applies is chosen with a set of defines:
+# -D_SOCKADDR_LEN enables 4.4BSD and IPv6 interfaces
+# -D_POSIX_PII_SOCKET enables socklen_t instead of size_t
+for i in -D_SOCKADDR_LEN -D_POSIX_PII_SOCKET
+do
+    case "$ccflags" in
+    *$i*) ;;
+    *) ccflags="$ccflags $i" ;;
+    esac
+done
+# For OSF/1 3.2, however, defining _SOCKADDR_LEN would be
+# a bad idea since it breaks send() and recv().
+case "$ccflags" in
+*DEC_OSF1_3_X*SOCKADDR_LEN*)
+ ccflags=`echo " $ccflags " | sed -e 's/ -D_SOCKADDR_LEN / /'`
+ ;;
+esac
 
 #
 # Unset temporary variables no more needed.
diff --git a/perl.h b/perl.h
index 091d2d1..f0f3192 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -1063,14 +1063,6 @@ EXTERN_C int usleep(unsigned int);
 #   endif
 #endif /* !HAS_BCMP */
 
-/* In Tru64 define _SOCKADDR_LEN to use 4.4BSD and IPv6 interfaces.
- * Define it before any network headers like netinet/in.h or sys/socket.h.
- * For OSF/1 3.2, however, defining _SOCKADDR_LEN would be
- * a bad idea since it breaks send() and recv(). */
-#if defined(__osf__) && defined(__alpha) && !defined(_SOCKADDR_LEN) && !defined(DEC_OSF1_3_X)
-#   define _SOCKADDR_LEN
-#endif
-
 #ifdef I_NETINET_IN
 #   include <netinet/in.h>
 #endif