NEWS-OS 4.x/6.x support patch for apache 1.2.4
==============================================

---- english (?) ----

* This patch is based on NEWS-OS 4.2.1R support patch for apache 1.1.1 by
  Isamu Wada <i-wada@SRA.CO.JP>.  Wada's patch was posted to fj.sys.news 
  newsgroup, message-id is: <I-WADA.96Aug24181702@tsrasv.SRA.CO.JP>.
  You can get Wada's patch from:

  ftp://ftp.st.ryukoku.ac.jp/pub/sony-news/netnews-digest/apache-1.1.1-newsos4

* Difftime() came from apache 1.3b2 source.  I done only cut-and-paste.

* For NEWS-OS 4.x, you need 'missing-func-news' (libmissing.a) library.  
  You can get it from:

  ftp://ftp.ics.es.osaka-u.ac.jp/pub/NEWS4aid/missing-func-news/
  ftp://ftp.st.ryukoku.ac.jp/pub/sony-news/missing-func-news/

  And, you may need GNU C Compiler (gcc) too.  NEWS-OS 4.x OS package
  has gcc as 'unsupported software', but I recommend you built gcc with 
  GNU binutils by hand.  Installation logs are available from:

  http://www-jkn.ee.uec.ac.jp/root/usr.local.src/ (very good documents)
  http://tethys.st.ryukoku.ac.jp/~kjm/changelog/

* Tested: 

  NWS-1750/NEWS-OS 4.2.1C/gcc 2.7.2.1/binutils 2.7/missing-func-news-960625
  NWS-3870/NEWS-OS 4.2.1a+R/gcc 2.7.2.1/binutils 2.7/missing-func-news-960625
  NWS-4000/NEWS-OS 6.1.2/cc -Xa

* ABSOLUTELY NO WARRANTY. 

---- japanese (?) ----

* $B$3$N%Q%C%A$O!"OBED(B@SRA <i-wada@SRA.CO.JP> $B$5$s:n$N!"(Bapache 1.1.1
  $B$G(B NEWS-OS 4.2.1R $B$r%5%]!<%H$9$k%Q%C%A$r85$K$7$F$$$^$9!#OBED$5$s$N%Q%C(B
  $B%A$O%K%e!<%9%0%k!<%W(B fj.sys.news $B$KEj9F$5$l$F$*$j!"(BMessage-Id $B$O(B 
  <I-WADA.96Aug24181702@tsrasv.SRA.CO.JP> $B$G$9!#<!$N>l=j$+$i$bF~<j$G$-(B
  $B$^$9(B: 

  ftp://ftp.st.ryukoku.ac.jp/pub/sony-news/netnews-digest/apache-1.1.1-newsos4

* Difftime() $B%k!<%A%s$O(B apache 1.3b2 $B%=!<%9$+$i;}$C$FMh$^$7$?!#C1$K%+%C(B
  $B%H(B & $B%Z!<%9%H$7$?$@$1$G$9!#(B

* NEWS-OS 4.x $B$G$OJLES(B 'missing-func-news' (libmissing.a) $B%i%$%V%i%j$,(B
  $BI,MW$H$J$j$^$9!#<!$N>l=j$+$iF~<j$G$-$^$9(B:

  ftp://ftp.ics.es.osaka-u.ac.jp/pub/NEWS4aid/missing-func-news/
  ftp://ftp.st.ryukoku.ac.jp/pub/sony-news/missing-func-news/

  $B$^$?!"(BGNU C $B%3%s%Q%$%i(B (gcc) $B$bI,MW$H$J$k$+$b$7$l$^$;$s!#(BNEWS-OS 4.x
  OS $B%Q%C%1!<%8$K$O(B 'unsupported software' $B$H$7$F(B gcc $B$,4^$^$l$F$$$^$9(B
  $B$,!"8D?ME*$K$O(B GNU binutils $B$H6&$K<+J,$N<j$G(B gcc $B$r:n@.$9$k$3$H$r$*(B
  $B4+$a$7$^$9!#(Bgcc $B$N%$%s%9%H!<%k%m%0$,<!$N>l=j$K$"$j$^$9(B: 

  http://www-jkn.ee.uec.ac.jp/root/usr.local.src/ ($B$9$4$/;29M$K$J$j$^$9(B)
  http://tethys.st.ryukoku.ac.jp/~kjm/changelog/

* $B%F%9%H$7$?4D6-(B:

  NWS-1750/NEWS-OS 4.2.1C/gcc 2.7.2.1/binutils 2.7/missing-func-news-960625
  NWS-3870/NEWS-OS 4.2.1a+R/gcc 2.7.2.1/binutils 2.7/missing-func-news-960625
  NWS-4000/NEWS-OS 6.1.2/cc -Xa

* $B40A4L5J]>Z$G$9!#(B

----

Have fun!

- KOJIMA Hajime <kjm@rins.ryukoku.ac.jp>
  Ryukoku University, Facilty of Science and Technology

diff -ur ../apache_1.2.4/src/Configuration apache_1.2.4/src/Configuration
--- ../apache_1.2.4/src/Configuration	Fri Aug 22 16:18:30 1997
+++ apache_1.2.4/src/Configuration	Wed Nov 19 17:48:42 1997
@@ -41,13 +41,13 @@
 # Settings here have priority; If not set, Configure will attempt to guess
 # the C compiler, and set OPTIM to '-O2'
 #
-EXTRA_CFLAGS=
+EXTRA_CFLAGS= -Xa
 EXTRA_LFLAGS=
-EXTRA_LIBS=
+EXTRA_LIBS= 
 EXTRA_INCLUDES=
 
-#CC=
-#OPTIM=-O2
+CC=cc 
+OPTIM=-O2
 #RANLIB=
 
 ################################################################
@@ -162,7 +162,7 @@
 ## STATUS=yes (see the Rules section near the start of this file) to allow
 ## full status information.  Check conf/access.conf on how to enable this.
 
-# Module status_module       mod_status.o
+Module status_module       mod_status.o
 
 ## The Info module displays configuration information for the server and 
 ## all included modules. It's very useful for debugging.
@@ -200,7 +200,7 @@
 ## NOTE: You do not want this module UNLESS you are running a proxy;
 ##       it is not needed for normal (origin server) operation.
 
-# Module proxy_module        modules/proxy/libproxy.a
+Module proxy_module        modules/proxy/libproxy.a
 
 ## The Alias module provides simple URL translation and redirection.
 
@@ -220,7 +220,7 @@
 ## The anon_auth module allows for anonymous-FTP-style username/ 
 ## password authentication.
 
-# Module anon_auth_module    mod_auth_anon.o
+Module anon_auth_module    mod_auth_anon.o
 
 ## db_auth and dbm_auth work with Berkeley DB files - make sure there
 ## is support for DBM files on your system.  You may need to grab the GNU
@@ -228,7 +228,7 @@
 ## done by Configure at a later date)
 
 # Module db_auth_module      mod_auth_db.o
-# Module dbm_auth_module     mod_auth_dbm.o
+Module dbm_auth_module     mod_auth_dbm.o
 
 ## msql_auth checks against an mSQL database.  You must have mSQL installed
 ## and an "msql.h" available for this to even compile.  Additionally,
@@ -244,7 +244,7 @@
 ## "digest" implements HTTP Digest Authentication rather than the less 
 ## secure Basic Auth used by the other modules.
 
-# Module digest_module       mod_digest.o
+Module digest_module       mod_digest.o
 
 ## Optional response header manipulation modules. 
 ##
diff -ur ../apache_1.2.4/src/Configure apache_1.2.4/src/Configure
--- ../apache_1.2.4/src/Configure	Fri Aug 22 07:56:20 1997
+++ apache_1.2.4/src/Configure	Tue Nov 25 10:36:38 1997
@@ -480,6 +480,19 @@
 	OS='Paragon OSF/1'
 	CFLAGS="$CFLAGS -DPARAGON"
 	;;
+    *-sony-newsos6)
+	DEF_WANTHSREGEX=yes
+	OS='SONY NEWS-OS6'
+	CFLAGS="$CFLAGS -DNEWSOS6"
+	LIBS="$LIBS -lsocket -lnsl"
+	DBM_LIB="-lndbm"
+	;;
+    *-sony-newsos4)
+	DEF_WANTHSREGEX=yes
+	OS='SONY NEWS-OS4'
+	CFLAGS="$CFLAGS -DNEWSOS4"
+	LIBS="$LIBS -L/usr/local/lib -lmissing"
+	;;
     *) # default: Catch systems we don't know about
     	echo Sorry, but we cannot grok \"$PLAT\"
 	echo uname -m
Only in apache_1.2.4/src: Makefile
Only in apache_1.2.4/src: Makefile.bak
Only in apache_1.2.4/src: Makefile.config
diff -ur ../apache_1.2.4/src/PORTING apache_1.2.4/src/PORTING
--- ../apache_1.2.4/src/PORTING	Fri Jun 27 10:47:44 1997
+++ apache_1.2.4/src/PORTING	Thu Nov 20 09:45:34 1997
@@ -156,6 +156,7 @@
     NEED_INITGROUPS:
     NEED_WAITPID:
     NEED_STRERROR:
+    NEED_DIFFTIME:
 --
 
  HAVE_*:
@@ -220,6 +221,7 @@
    we should not use it.
 
       NO_UNISTD_H:
+      NO_UTIME_H:
       NO_KILLPG:
       NO_SETSID:
       NO_USE_SIGACTION:
@@ -241,6 +243,9 @@
       MOVEBREAK:
        Amount to move sbrk() breakpoint, if required, before attaching
        shared-memory segment.
+
+      GETTIMEOFDAY_1ARG:
+       Gettimeofday() has only 1 argument. 
 
 -----------
 Conclusion:
diff -ur ../apache_1.2.4/src/conf.h apache_1.2.4/src/conf.h
--- ../apache_1.2.4/src/conf.h	Sat Aug 16 02:29:49 1997
+++ apache_1.2.4/src/conf.h	Thu Nov 20 09:39:53 1997
@@ -508,6 +508,37 @@
 #define JMP_BUF sigjmp_buf
 #define USE_FCNTL_SERIALIZED_ACCEPT
 
+#elif defined(NEWSOS4)
+#define HAVE_GMTOFF
+#define HAVE_SYS_RESOURCE_H
+#define USE_LONGJMP
+#define JMP_BUF jmp_buf
+#define NO_UTIME_H
+#define NO_SETSID
+#define NO_USE_SIGACTION
+#define NEED_DIFFTIME
+#include <sys/time.h>
+#include <stdlib.h>
+#include <sys/types.h>
+typedef int pid_t;
+typedef int rlim_t;
+typedef int mode_t;
+#define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
+
+#elif defined(NEWSOS6)
+#undef HAVE_GMTOFF
+#define HAVE_RESOURCE
+#define HAVE_MMAP
+#define HAVE_SHMGET
+#define HAVE_CRYPT_H
+#define HAVE_SYS_SELECT_H
+#define HAVE_SYS_RESOURCE_H
+#define USE_FCNTL_SERIALIZED_ACCEPT
+#define NO_KILLPG
+#undef NO_SETSID
+#define JMP_BUF sigjmp_buf
+#define GETTIMEOFDAY_1ARG
+
 /* Unknown system - Edit these to match */
 #else
 #ifdef BSD
diff -ur ../apache_1.2.4/src/helpers/GuessOS apache_1.2.4/src/helpers/GuessOS
--- ../apache_1.2.4/src/helpers/GuessOS	Tue Jul  1 10:38:16 1997
+++ apache_1.2.4/src/helpers/GuessOS	Wed Nov 19 14:16:37 1997
@@ -204,6 +204,13 @@
 	echo "${MACHINE}-tandem-sysv4"; exit 0;
 	;;
 
+    NEWS-OS:6*:*:*)
+	echo "${MACHINE}-sony-newsos6"; exit 0;
+	;;
+
+    NEWS-OS:4*:*:*)
+	echo "${MACHINE}-sony-newsos4"; exit 0;
+	;;
 esac
 
 #
@@ -226,6 +233,14 @@
 	echo "whatever-next-nextstep"; exit 0
 	;;
 esac
+
+# Now SONY NEWS
+if [ -d /usr/sony ]; then
+    MACHINE=`machine`;
+    VERSION=""
+    grep 4 /etc/osversion > /dev/null && VERSION=4
+    echo "${MACHINE}-sony-newsos$VERSION"; exit 0
+fi
 
 # At this point we gone through all the one's
 # we know of: Punt
diff -ur ../apache_1.2.4/src/http_main.c apache_1.2.4/src/http_main.c
--- ../apache_1.2.4/src/http_main.c	Sat Aug 16 02:29:50 1997
+++ apache_1.2.4/src/http_main.c	Wed Nov 19 14:25:42 1997
@@ -1384,7 +1384,7 @@
         fprintf(stderr,"httpd: setsid failed\n");
         exit(1);
     }
-#elif defined(NEXT)
+#elif defined(NEXT) || defined(NEWSOS4)
     if(setpgrp(0,getpid()) == -1 || (pgrp = getpgrp(0)) == -1) {
         perror("setpgrp");
         fprintf(stderr,"httpd: setpgrp or getpgrp failed\n");
diff -ur ../apache_1.2.4/src/mod_status.c apache_1.2.4/src/mod_status.c
--- ../apache_1.2.4/src/mod_status.c	Sun Jul  6 02:42:12 1997
+++ apache_1.2.4/src/mod_status.c	Wed Nov 19 15:04:01 1997
@@ -100,6 +100,10 @@
 #ifdef NEXT
 #include <machine/param.h>
 #endif
+#if defined(NEWSOS4)
+#define  clock_t  int
+#include <machine/machparam.h>
+#endif
 
 #define STATUS_MAXLINE		64
 
@@ -207,8 +211,12 @@
 #ifdef NEXT
     float tick=HZ;
 #else
+#if defined(NEWSOS4)
+    float tick=CLK_TCK;
+#else
     float tick=sysconf(_SC_CLK_TCK);
-#endif
+#endif /* NEWSOS4 */
+#endif /* NEXT */
 #endif /* STATUS */
     int short_report=0;
     int no_table_report=0;
diff -ur ../apache_1.2.4/src/mod_usertrack.c apache_1.2.4/src/mod_usertrack.c
--- ../apache_1.2.4/src/mod_usertrack.c	Fri Mar  7 23:15:45 1997
+++ apache_1.2.4/src/mod_usertrack.c	Wed Nov 19 17:48:01 1997
@@ -147,7 +147,11 @@
     ap_snprintf(cookiebuf, 1024, "%s%d%ld%ld", rname, (int)getpid(),
               (long)time(NULL), (long)mpe_tms.tms_utime);
 #else
+#ifdef GETTIMEOFDAY_1ARG
+    gettimeofday(&tv);
+#else
     gettimeofday(&tv, &tz);
+#endif
 
     ap_snprintf(cookiebuf, 1024, "%s%d%ld%d", rname, (int)getpid(),
 	      (long)tv.tv_sec, (int)tv.tv_usec/1000);	    
Only in apache_1.2.4/src/modules: Makefile
diff -ur ../apache_1.2.4/src/modules/proxy/proxy_cache.c apache_1.2.4/src/modules/proxy/proxy_cache.c
--- ../apache_1.2.4/src/modules/proxy/proxy_cache.c	Sat Aug 16 02:08:55 1997
+++ apache_1.2.4/src/modules/proxy/proxy_cache.c	Thu Nov 20 09:39:12 1997
@@ -58,7 +58,9 @@
 #include "http_log.h"
 #include "http_main.h"
 #include "util_date.h"
+#ifndef NO_UTIME_H
 #include <utime.h>
+#endif
 
 #define	abs(c)	((c) >= 0 ? (c) : -(c))
 
Only in apache_1.2.4/src: modules.c
Only in apache_1.2.4/src: modules.c.bak
diff -ur ../apache_1.2.4/src/util.c apache_1.2.4/src/util.c
--- ../apache_1.2.4/src/util.c	Fri Jun 27 10:47:47 1997
+++ apache_1.2.4/src/util.c	Wed Nov 19 15:54:01 1997
@@ -1353,3 +1353,11 @@
     return new_fd;
 #endif
 }
+
+#if defined(NEED_DIFFTIME)
+double difftime(time_t time1, time_t time0)
+{
+    return (time1 - time0);
+}
+#endif
+
diff -ur ../apache_1.2.4/src/util_date.h apache_1.2.4/src/util_date.h
--- ../apache_1.2.4/src/util_date.h	Thu Jan  2 03:10:45 1997
+++ apache_1.2.4/src/util_date.h	Wed Nov 19 15:35:25 1997
@@ -54,6 +54,10 @@
  * util_date.h: prototypes for date parsing utility routines
  */
 
+#ifdef NEWSOS4
+#include <stdio.h>
+#include <sys/types.h>
+#endif
 #include <time.h>
 
 #define BAD_DATE (time_t)0
Only in apache_1.2.4/support: Makefile
