Small patch for SCO systems

From: Kean Johnston <jkj@dont-contact.us>
Date: Sun, 13 Nov 2005 12:51:20 -0800

Hi,

Attached is a small patch for getting things working on SCO OpenServer.

Here is a hand-typed (i.e not done in emacs) ChangeLog entry:

2005-11-13 Kean Johnston <jkj@sco.com)
        * configure.in: Only check for -lintl on old SCO systems.
        Dont remove -O for gcc 2.95.3 on SCO OpenServer.
        Add check fot setenv as not all systems have it.
        Include syslog.h when checking for the syslog function.
        Remove extraneous libraries for OpenServer 5.

        * lib/rfc1035: Include <string.h> if the system has it,
        as that is wher strtok is declared.

        * src/cache_cf: Only call setenv if the host has it.

        * src/pinger.c: SCO OpenServer provides in_cksum, so dont
        need local copy (it causes conflicts).

        * src/squid.h: Compare SQUID_MAXFD to FD_SETSIZE, not
        DEFAULT_FD_SETSIZE, as it is the former that is used during
        compilation, not the latter.

Hope this helps!

PS this was against 2.5STABLE12, out of my own cvs repo, so
please forgive the weird cvs version numbers and paths in the
patch. The Index: lines are all correct though.

Kean

Index: configure.in
===================================================================
RCS file: /cvs/opensrc/squid/squid/configure.in,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 configure.in
--- configure.in 13 Nov 2005 18:12:52 -0000 1.1.1.1
+++ configure.in 13 Nov 2005 20:41:14 -0000
@@ -1676,7 +1676,7 @@ dnl -lintl is needed on SCO version 3.2v
 dnl Robert Side <rside@aiinc.bc.ca>
 dnl Mon, 18 Jan 1999 17:48:00 GMT
 case "$host" in
- *-pc-sco3.2*)
+ *-pc-sco3.2v4*)
                 AC_CHECK_LIB(intl, strftime)
                 ;;
 esac
@@ -1737,7 +1737,10 @@ esac
 
 # Remove optimization for GCC 2.95.[123]
 # gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
-if test "$GCC" = "yes"; then
+case $host in
+ *-*-sco3.2v5*) ;;
+ *)
+ if test "$GCC" = "yes"; then
         GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
         case "$GCCVER" in
         [2.95.[123]])
@@ -1745,7 +1748,9 @@ if test "$GCC" = "yes"; then
                 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
                 ;;
         esac
-fi
+ fi
+ ;;
+esac
 
 # Recommended by Balint Nagy Endre <bne@CareNet.hu>
 case "$host" in
@@ -1833,6 +1838,7 @@ AC_CHECK_FUNCS(\
         rint \
         sbrk \
         seteuid \
+ setenv \
         setgroups \
         setpgrp \
         setrlimit \
@@ -1845,13 +1851,27 @@ AC_CHECK_FUNCS(\
         statfs \
         strtoll \
         sysconf \
- syslog \
         timegm \
         vsnprintf \
         bswap_16 \
         bswap_32 \
 )
 
+dnl
+dnl When checking for syslog make sure we include syslog.h because at
+dnl least on SCO, the header file maps its name to std_syslog, and
+dnl AC_CHECK_FUNCS will not catch that above.
+dnl
+AC_CACHE_CHECK(for syslog, ac_cv_func_syslog,
+ AC_TRY_COMPILE([#include <stdio.h>
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif], [syslog(0, "", "");], ac_cv_func_syslog="yes", ac_cv_func_syslog="no")
+)
+if test "$ac_cv_func_syslog" = "yes"; then
+ AC_DEFINE(HAVE_SYSLOG)
+fi
+
 dnl Yay! Another Linux brokenness. Its not good enough
 dnl to know that setresuid() exists, because RedHat 5.0 declares
 dnl setresuid() but doesn't implement it.
@@ -2429,6 +2449,16 @@ if test -z "$XTRA_LIBS"; then
 fi
 AC_SUBST(XTRA_LIBS)
 
+dnl jkj@sco.com:
+case "$host" in
+ *-sco3.2v5*)
+ XTRA_LIBS=`echo $XTRA_LIBS | sed -e 's/-lintl //' \
+ -e 's/-ldl //' -e 's/-lresolv //'`
+ CFLAGS="$CFLAGS -DFD_SETSIZE=$SQUID_MAXFD"
+ DEFAULT_FD_SETSIZE=$SQUID_MAXFD
+ ;;
+esac
+
 dnl Clean up after OSF/1 core dump bug
 rm -f core
 
Index: include/autoconf.h.in
===================================================================
RCS file: /cvs/opensrc/squid/squid/include/autoconf.h.in,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 autoconf.h.in
--- include/autoconf.h.in 13 Nov 2005 18:12:53 -0000 1.1.1.1
+++ include/autoconf.h.in 13 Nov 2005 20:41:14 -0000
@@ -545,6 +545,9 @@
 /* Define if you have the sbrk function. */
 #undef HAVE_SBRK
 
+/* Define if you have the setenv function. */
+#undef HAVE_SETENV
+
 /* Define if you have the seteuid function. */
 #undef HAVE_SETEUID
 
Index: lib/rfc1035.c
===================================================================
RCS file: /cvs/opensrc/squid/squid/lib/rfc1035.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 rfc1035.c
--- lib/rfc1035.c 13 Nov 2005 18:12:54 -0000 1.1.1.1
+++ lib/rfc1035.c 13 Nov 2005 20:41:15 -0000
@@ -66,6 +66,9 @@
 #if HAVE_ARPA_INET_H
 #include <arpa/inet.h>
 #endif
+#if HAVE_STRING_H
+#include <string.h>
+#endif
 #if HAVE_STRINGS_H
 #include <strings.h>
 #endif
Index: src/cache_cf.c
===================================================================
RCS file: /cvs/opensrc/squid/squid/src/cache_cf.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 cache_cf.c
--- src/cache_cf.c 13 Nov 2005 18:12:56 -0000 1.1.1.1
+++ src/cache_cf.c 13 Nov 2005 20:41:15 -0000
@@ -440,8 +440,10 @@ configDoConfigure(void)
                     Config.effectiveUser);
             Config2.effectiveUserID = pwd->pw_uid;
             Config2.effectiveGroupID = pwd->pw_gid;
+#if HAVE_SETENV
             if (pwd->pw_dir && *pwd->pw_dir)
                 setenv("HOME", pwd->pw_dir, 1);
+#endif
         }
     } else {
         Config2.effectiveUserID = geteuid();
Index: src/pinger.c
===================================================================
RCS file: /cvs/opensrc/squid/squid/src/pinger.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 pinger.c
--- src/pinger.c 13 Nov 2005 18:12:56 -0000 1.1.1.1
+++ src/pinger.c 13 Nov 2005 20:41:15 -0000
@@ -113,7 +113,10 @@ static const char *icmpPktStr[] =
     "Out of Range Type"
 };
 
+#if (_SCO_DS - 0 != 1)
 static int in_cksum(unsigned short *ptr, int size);
+#endif
+
 static void pingerRecv(void);
 static void pingerLog(struct icmphdr *, struct in_addr, int, int);
 static int ipHops(int ttl);
@@ -249,6 +252,7 @@ pingerRecv(void)
 }
 
 
+#if (_SCO_DS - 0 != 1)
 static int
 in_cksum(unsigned short *ptr, int size)
 {
@@ -270,6 +274,7 @@ in_cksum(unsigned short *ptr, int size)
     answer = ~sum;
     return (answer);
 }
+#endif
 
 static void
 pingerLog(struct icmphdr *icmp, struct in_addr addr, int rtt, int hops)
Index: src/squid.h
===================================================================
RCS file: /cvs/opensrc/squid/squid/src/squid.h,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 squid.h
--- src/squid.h 13 Nov 2005 18:13:00 -0000 1.1.1.1
+++ src/squid.h 13 Nov 2005 20:41:15 -0000
@@ -89,7 +89,7 @@
 #endif
 
 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
-#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
+#if CHANGE_FD_SETSIZE && SQUID_MAXFD > FD_SETSIZE
 #define FD_SETSIZE SQUID_MAXFD
 #endif
 
Received on Mon Nov 14 2005 - 07:05:42 MST

This archive was generated by hypermail pre-2.1.9 : Thu Dec 01 2005 - 12:00:15 MST