bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compilation failure on Mac OS X 10.4, socklen_t needs <sys/socket.h>


From: Claes Wallin
Subject: Compilation failure on Mac OS X 10.4, socklen_t needs <sys/socket.h>
Date: Tue, 18 Jul 2006 20:23:21 +0200
User-agent: Thunderbird 1.5.0.4 (Macintosh/20060516)

On Mac OS X 10.4, socklen_t is only defined if <sys/socket.h> is
included. The config script doesn't do this, so socklen_t is #define:d
to int, which creates a conflict in <sys/socket.h> when compiling
libguile/socket.c.

The attached diff patches this and also changes the #define to a
typedef, which feels cleaner but is not necessary for the patch to work.
Simply changing the default includes of AC_CHECK_TYPE(socklen_t) would
also work.

With this patch applied, guile compiles for me, but does not yet work
due to other problems. Not tested on any other platform.

   /c
diff -ur ../guile-1.8.0.orig/ChangeLog ./ChangeLog
--- ../guile-1.8.0.orig/ChangeLog       2006-02-20 22:18:40.000000000 +0100
+++ ./ChangeLog 2006-07-18 20:12:27.000000000 +0200
@@ -1,3 +1,15 @@
+2006-07-18  Claes Wallin    <address@hidden>
+
+       Now compiles on Mac OS X 10.4.
+
+       * configure.in: Added sys/socket.h test
+                       Added sys/socket.h to socklen_t test
+                       Changed AC_CHECK_TYPE -> AC_CHECK_TYPES
+
+       * config.h.in:  Changed socklen_t -> HAVE_SOCKLEN_T
+
+       * libguile/socket.c: typedef if not HAVE_SOCKLEN_T
+
 2006-02-20  Marius Vollmer  <address@hidden>
 
        Released 1.8.0.
diff -ur ../guile-1.8.0.orig/config.h.in ./config.h.in
--- ../guile-1.8.0.orig/config.h.in     2006-02-20 22:32:48.000000000 +0100
+++ ./config.h.in       2006-07-18 20:03:57.000000000 +0200
@@ -817,8 +817,8 @@
 /* Define to `int' if <sys/types.h> does not define. */
 #undef mode_t
 
-/* Define to `int' if <sys/types.h> does not define. */
-#undef socklen_t
+/* Needs to be typedef'd if <sys/types.h> or <sys/socket.h> does not define. */
+#undef HAVE_SOCKLEN_T
 
 /* Define to `int' if <sys/types.h> doesn't define. */
 #undef uid_t
diff -ur ../guile-1.8.0.orig/configure.in ./configure.in
--- ../guile-1.8.0.orig/configure.in    2006-02-12 14:29:08.000000000 +0100
+++ ./configure.in      2006-07-18 20:03:57.000000000 +0200
@@ -515,7 +515,19 @@
 AC_SUBST([SCM_I_GSC_NEEDS_STDINT_H])
 AC_SUBST([SCM_I_GSC_NEEDS_INTTYPES_H])
 
-AC_CHECK_TYPE(socklen_t, int)
+AC_CHECK_HEADERS(sys/socket.h,,,[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+])
+AC_CHECK_TYPES(socklen_t,,,[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+])
 AC_CHECK_TYPE(struct ip_mreq)
 
 AC_HEADER_STDC
diff -ur ../guile-1.8.0.orig/libguile/socket.c ./libguile/socket.c
--- ../guile-1.8.0.orig/libguile/socket.c       2006-02-12 14:29:12.000000000 
+0100
+++ ./libguile/socket.c 2006-07-18 20:03:57.000000000 +0200
@@ -62,6 +62,10 @@
 #include <arpa/inet.h>
 #endif
 
+#ifndef HAVE_SOCKLEN_T
+typedef socklen_t int;
+#endif
+
 #if defined (HAVE_UNIX_DOMAIN_SOCKETS) && !defined (SUN_LEN)
 #define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
                      + strlen ((ptr)->sun_path))

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]