[distcc] distcc 2.12.1 patches
Albert Chin
distcc at mlists.thewrittenword.com
Thu Feb 19 04:05:44 GMT 2004
1. [src/exitcode.h]
IBM C compiler doesn't like trailing commas after last enum
constant.
2. [src/clinet.c]
Define h_errno for HP-UX 10.20.
3. [src/distcc.h]
Forward declaration of 'struct sockaddr' gives problems with IBM
C compiler. And, it's not needed.
4. [src/serve.c]
Forgot to include <sys/socket.h> Needed on HP-UX 10.20, 11.00, 11i.
5. [src/types.h]
Remove definition of socklen_t if unavailable. We not declare it
correctly via autoconf.
6. [configure.ac]
a) Better detection for socklen_t. This code is taken from curl but
we submitted it so we own the copyright. Feel free to use as you
please.
b) Existence of mmap() doesn't imply MAP_FAILED exists. So, test
and define it if unavailable.
c) Replace the AC_CHECK_FUNCS(connect) mess.
These patches were tested on:
AIX 4.3.2, 5.1; HP-UX 10.20, 11.00, 11i; IRIX 6.5;
Redhat Linux 7.1, 9; Solaris 2.5.1, 2.6, 7, 8, 9;
Tru64 UNIX 4.0D, 5.1
--
albert chin (china at thewrittenword.com)
-- snip snip
--- src/exitcode.h.orig 2004-02-18 16:49:13.000000000 -0600
+++ src/exitcode.h 2004-02-18 16:49:19.000000000 -0600
@@ -53,7 +53,7 @@
EXIT_BUSY = 114, /**< In use by another process. */
EXIT_NO_SUCH_FILE = 115,
EXIT_NO_HOSTS = 116,
- EXIT_GONE = 117, /**< No longer relevant */
+ EXIT_GONE = 117 /**< No longer relevant */
};
--- src/clinet.c.orig 2004-02-18 16:50:35.000000000 -0600
+++ src/clinet.c 2004-02-18 16:50:56.000000000 -0600
@@ -54,6 +54,10 @@
#include "util.h"
#include "netutil.h"
+#ifndef h_errno
+extern int h_errno;
+#endif
+
/**
* @file
--- src/distcc.h.orig 2004-02-18 16:48:18.000000000 -0600
+++ src/distcc.h 2004-02-18 16:48:27.000000000 -0600
@@ -142,8 +142,6 @@
#endif
-struct sockaddr;
-
/* If --enable-rfc2553 was given, then we will try to enable compile-time IPv6
* support. This means we must have a sockaddr_storage large enough to hold
* IPv6 addresses. If not, we'll just use a plain sockaddr, which is more
--- src/serve.c.orig 2004-02-18 17:11:25.000000000 -0600
+++ src/serve.c 2004-02-18 17:11:34.000000000 -0600
@@ -69,6 +69,7 @@
# include <sys/signal.h>
#endif /* HAVE_SYS_SIGNAL_H */
#include <sys/param.h>
+#include <sys/socket.h>
#include "distcc.h"
#include "trace.h"
--- src/types.h.orig 2004-02-18 16:54:07.000000000 -0600
+++ src/types.h 2004-02-18 16:54:13.000000000 -0600
@@ -20,11 +20,6 @@
* USA
*/
-#ifndef HAVE_SOCKLEN_T
-#define HAVE_SOCKLEN_T
-typedef size_t socklen_t;
-#endif
-
#ifndef HAVE_IN_PORT_T
#define HAVE_IN_PORT_T
typedef int in_port_t;
--- configure.ac.orig 2004-02-18 16:54:41.000000000 -0600
+++ configure.ac 2004-02-18 17:14:48.000000000 -0600
@@ -42,9 +42,41 @@
dnl Run the check for --with-docdir
DISTCC_WITH_DOCDIR
-# TODO: Check for socklen_t, and do something appropiate on systems
-# that don't have it. It could be size_t or int. I'm not sure how
-# we're supposed to tell.
+# Check for socklen_t, and do something appropiate on systems
+# that don't have it.
+AC_CHECK_TYPE([socklen_t], ,[
+ AC_MSG_CHECKING([for socklen_t equivalent])
+ AC_CACHE_VAL([dcc_cv_socklen_t_equiv],
+ [
+ # Systems have either "struct sockaddr *" or
+ # "void *" as the second argument to getpeername
+ dcc_cv_socklen_t_equiv=
+ for arg2 in "struct sockaddr" void; do
+ for t in int size_t unsigned long "unsigned long"; do
+ AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int getpeername (int, $arg2 *, $t *);
+],[
+$t len;
+getpeername(0,0,&len);
+],[
+ dcc_cv_socklen_t_equiv="$t"
+ break
+])
+ done
+ done
+
+ if test "x$dcc_cv_socklen_t_equiv" = x; then
+ AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
+ fi
+ ])
+ AC_MSG_RESULT($dcc_cv_socklen_t_equiv)
+ AC_DEFINE_UNQUOTED(socklen_t, $dcc_cv_socklen_t_equiv,
+ [type to use in place of socklen_t if not defined])],
+ [#include <sys/types.h>
+#include <sys/socket.h>])
# TODO: Handle program transform rules by autoconf.
@@ -198,7 +230,7 @@
######################################################################
dnl Checks for types
-AC_CHECK_TYPES([sa_family_t, socklen_t, in_port_t, in_addr_t], , ,
+AC_CHECK_TYPES([sa_family_t, in_port_t, in_addr_t], , ,
[
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
@@ -225,36 +257,10 @@
# libsocket.so which has a bad implementation of gethostbyname (it
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
-AC_CHECK_FUNCS(connect)
-if test x"$ac_cv_func_connect" = x"no"; then
- case "$LIBS" in
- *-lnsl*) ;;
- *) AC_CHECK_LIB(nsl_s, printf) ;;
- esac
- case "$LIBS" in
- *-lnsl*) ;;
- *) AC_CHECK_LIB(nsl, printf) ;;
- esac
- case "$LIBS" in
- *-lsocket*) ;;
- *) AC_CHECK_LIB(socket, connect) ;;
- esac
- case "$LIBS" in
- *-linet*) ;;
- *) AC_CHECK_LIB(inet, connect) ;;
- esac
- dnl We can't just call AC_CHECK_FUNCS(connect) here, because the value
- dnl has been cached.
- if test x"$ac_cv_lib_socket_connect" = x"yes" ||
- test x"$ac_cv_lib_inet_connect" = x"yes"; then
- # ac_cv_func_connect=yes
- # don't! it would cause AC_CHECK_FUNC to succeed next time configure is run
- AC_DEFINE(HAVE_CONNECT,1,[Whether the system has connect()])
- fi
-fi
-
-AC_CHECK_LIB(resolv, hstrerror, , , [-lnsl -lsocket])
-AC_CHECK_LIB(resolv, inet_aton, , , [-lnsl -lsocket])
+AC_SEARCH_LIBS(gethostent, [nsl])
+AC_SEARCH_LIBS(setsockopt, [socket])
+AC_SEARCH_LIBS(hstrerror, [resolv])
+AC_SEARCH_LIBS(inet_aton, [resolv])
if test x"$with_included_popt" != x"yes" && test x"$with_included_popt" != xno
then
@@ -293,6 +299,22 @@
AC_CHECK_DECLS([snprintf, vsnprintf, vasprintf, asprintf, strndup])
+AC_MSG_CHECKING([if mmap() supports MAP_FAILED])
+AC_TRY_COMPILE([
+#ifdef HAVE_SYS_MMAN_H
+# include <sys/mman.h>
+#endif],[
+#ifdef HAVE_MMAP
+if (mmap (NULL, 0, 0, 0, 0, 0) == MAP_FAILED)
+ return 0;
+#else
+#error mmap unavailable
+#endif], ,[
+ AC_DEFINE([MAP_FAILED], [(void *)-1L],
+ [Define if MAP_FAILED constant not available])
+])
+AC_MSG_RESULT()
+
dnl
dnl Test if the preprocessor understand vararg macros
More information about the distcc
mailing list