apache 1.1.3 NEWS-OS 4 support patch
====================================

* ABSOLUTELY NO WARRANTY
* Tested: NEWS-OS 4.2.1C with many un-official patch 
  (you can get them from ftp://ftp.sony.co.jp/),
  and GNU binutils 2.7 + gcc 2.7.2.1
* This patch is based on apache 1.1.1 patch for NEWS-OS 4.2.1R
  by Mr. Isamu Wada <i-wada@SRA.CO.JP>.  Mr. Wada's patch was posted
  to fj.sys.news newsgroup, message-id is: 
  <I-WADA.96Aug24181702@tsrasv.SRA.CO.JP>.

Have fun!

- KOJIMA Hajime <kjm@rins.ryukoku.ac.jp>

diff -ur /u/kjm/apache_1.1.3/src/Configuration apache_1.1.3/src/Configuration
--- /u/kjm/apache_1.1.3/src/Configuration	Tue Jan 14 13:17:38 1997
+++ apache_1.1.3/src/Configuration	Wed Feb 19 18:10:01 1997
@@ -65,7 +65,7 @@
 #  defaults in.  Note that this config file does not include DBM auth by
 #  default --- configure it in below if you need it].
 
-CFLAGS= -O2
+CFLAGS= -O -DMAXIMUM_DNS -DSTATUS -DNO_MMAP
 
 # Place here any flags you may need upon linking, such as a flag to
 # prevent dynamic linking (if desired)
@@ -73,7 +73,7 @@
 
 # Place here any extra libraries you may need to link to. 
 # -lndbm is commonly required for DBM auth, if that is configured in.
-EXTRA_LIBS=
+EXTRA_LIBS= -L/usr/local/lib -lgdbm
 
 # AUX_CFLAGS are system-specific control flags.
 # NOTE: IF YOU DO NOT CHOOSE ONE OF THESE, EDIT httpd.h AND CHOOSE
@@ -81,6 +81,12 @@
 
 # For SunOS 4
 #AUX_CFLAGS= -DSUNOS4
+# For NEWS-OS 4.  You must install libmissing before apache installation. 
+# You can get libmissing package from 
+#   ftp://ftp.hipecs.hokudai.ac.jp/pub/unix/misc/sony/missing-func-news/
+#   ftp://starbow.st.ryukoku.ac.jp/pub/sony-news/missing-func-news/
+AUX_CFLAGS= -DNEWSOS4 -DNO_MMAP
+AUX_LIBS= -L/usr/local/lib -lmissing
 # For Solaris 2.
 #AUX_CFLAGS= -DSOLARIS2
 #AUX_LIBS= -lsocket -lnsl
@@ -221,7 +227,7 @@
 ## -DSTATUS (see the CFLAGS section near the start of the 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.
@@ -240,7 +246,7 @@
 ## "gdbm" package if not.
 
 # 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,
@@ -255,7 +261,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
 
 ## Outright experiments --- mod_dld defines commands which
 ## allows other modules to be loaded in at runtime, and mod_cookies
diff -ur /u/kjm/apache_1.1.3/src/Configuration.tmpl apache_1.1.3/src/Configuration.tmpl
--- /u/kjm/apache_1.1.3/src/Configuration.tmpl	Sun Jun 30 04:59:25 1996
+++ apache_1.1.3/src/Configuration.tmpl	Wed Feb 19 18:10:52 1997
@@ -81,6 +81,12 @@
 
 # For SunOS 4
 #AUX_CFLAGS= -DSUNOS4
+# For NEWS-OS 4.  You must install libmissing before apache installation. 
+# You can get libmissing package from 
+#   ftp://ftp.hipecs.hokudai.ac.jp/pub/unix/misc/sony/missing-func-news/
+#   ftp://starbow.st.ryukoku.ac.jp/pub/sony-news/missing-func-news/
+#AUX_CFLAGS= -DNEWSOS4 -DNO_MMAP
+#AUX_LIBS= -L/usr/local/lib -lmissing
 # For Solaris 2.
 #AUX_CFLAGS= -DSOLARIS2
 #AUX_LIBS= -lsocket -lnsl
Only in apache_1.1.3/src: Makefile
Only in apache_1.1.3/src: Makefile.bak
diff -ur /u/kjm/apache_1.1.3/src/conf.h apache_1.1.3/src/conf.h
--- /u/kjm/apache_1.1.3/src/conf.h	Sun Jun 30 05:02:46 1996
+++ apache_1.1.3/src/conf.h	Wed Feb 19 17:55:38 1997
@@ -73,6 +73,16 @@
 #include <sys/time.h>     
 #define NEED_STRERROR
 
+#elif defined(NEWSOS4)
+#define        HAS_GMTOFF
+#define        JMP_BUF jmp_buf
+#define        NEED_WAITPID
+#define        NO_SETSID
+#define        NO_USE_SIGACTION
+#define        mode_t  int
+#define        pid_t   int
+#define        _LIBC_LIMITS_H_
+
 #elif defined(SOLARIS2)
 #undef HAS_GMTOFF
 #define NO_KILLPG
@@ -508,4 +518,6 @@
 #include <stdarg.h>
 long vfprintf (FILE *, char *, va_list);
      
+#elif defined(NEWSOS4)
+char *mktemp (char *);
 #endif
diff -ur /u/kjm/apache_1.1.3/src/http_main.c apache_1.1.3/src/http_main.c
--- /u/kjm/apache_1.1.3/src/http_main.c	Tue Jul  9 04:00:35 1996
+++ apache_1.1.3/src/http_main.c	Tue Feb 18 10:24:50 1997
@@ -307,7 +307,7 @@
     }
     
     if (!current_conn) {
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
 	longjmp(jmpbuffer,1);
 #else
 	siglongjmp(jmpbuffer,1);
@@ -348,7 +348,7 @@
 	bclose(timeout_req->connection->client);
     
 	if (!standalone) exit(0);
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
 	longjmp(jmpbuffer,1);
 #else
 	siglongjmp(jmpbuffer,1);
@@ -837,7 +837,7 @@
 static int wait_or_timeout_retval = -1;
 
 static void longjmp_out_of_alarm (int sig) {
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
     longjmp (wait_timeout_buf, 1);
 #else
     siglongjmp (wait_timeout_buf, 1);
@@ -848,7 +848,7 @@
 {
     wait_or_timeout_retval = -1;
     
-#if defined(NEXT)
+#if defined(NEXT) || defined(NEWSOS4)
     if (setjmp(wait_timeout_buf) != 0) {
 #else 
     if (sigsetjmp(wait_timeout_buf, 1) != 0) {
@@ -859,7 +859,7 @@
     
     signal (SIGALRM, longjmp_out_of_alarm);
     alarm(1);
-#if defined(NEXT)
+#if defined(NEXT) || defined(NEWSOS4)
     wait_or_timeout_retval = wait((union wait *)status);
 #else
     wait_or_timeout_retval = wait(status);
@@ -892,7 +892,7 @@
         exit(1);
     }
 #else
-#if defined(NEXT)
+#if defined(NEXT) || defined(NEWSOS4)
     if(setpgrp(0,getpid()) == -1 || (pgrp = getpgrp(0)) == -1) {
         fprintf(stderr,"httpd: setpgrp or getpgrp failed\n");
         perror("setpgrp");
@@ -997,7 +997,7 @@
 void restart() {
     signal (SIGALRM, SIG_IGN);
     alarm (0);
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
     longjmp(restart_buffer,1);
 #else
     siglongjmp(restart_buffer,1);
@@ -1155,7 +1155,7 @@
 	exit (1);
     }
 
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
     setjmp(jmpbuffer);
 #else
     sigsetjmp(jmpbuffer,1);
@@ -1368,7 +1368,7 @@
     
     if (!one_process) detach(); 
     
-#ifdef NEXT
+#if defined(NEXT) || defined(NEWSOS4)
     setjmp(restart_buffer);
 #else
     sigsetjmp(restart_buffer,1);
diff -ur /u/kjm/apache_1.1.3/src/mod_cgi.c apache_1.1.3/src/mod_cgi.c
--- /u/kjm/apache_1.1.3/src/mod_cgi.c	Tue Jun 18 05:43:47 1996
+++ apache_1.1.3/src/mod_cgi.c	Tue Feb 18 10:27:20 1997
@@ -297,7 +297,11 @@
 	int remaining = atoi (lenp);
 	
         hard_timeout ("copy script args", r);
+# if defined(NEWSOS4)
+        handler = (void *)signal (SIGPIPE, SIG_IGN);
+# else
         handler = signal (SIGPIPE, SIG_IGN);
+# endif
     
 	while ((remaining > 0))
 	{
Only in apache_1.1.3/src: mod_log_config.o
diff -ur /u/kjm/apache_1.1.3/src/mod_status.c apache_1.1.3/src/mod_status.c
--- /u/kjm/apache_1.1.3/src/mod_status.c	Sun Jun 30 07:23:25 1996
+++ apache_1.1.3/src/mod_status.c	Tue Feb 18 15:46:44 1997
@@ -93,6 +93,10 @@
 #ifdef NEXT
 #include <machine/param.h>
 #endif
+#if defined(NEWSOS4)
+#define  clock_t  int
+#include <machine/machparam.h>
+#endif
 
 #define STATUS_MAXLINE		50
 
@@ -140,7 +144,7 @@
 	rprintf(r," %ld second%s",secs,secs==1?"":"s");
 }
 
-#if defined(SUNOS4)
+#if defined(SUNOS4) || defined(NEWSOS4)
 double
 difftime(time1, time0)
         time_t time1, time0;
@@ -189,8 +193,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;
Only in apache_1.1.3/src: modules.c
Only in apache_1.1.3/src: modules.c.bak
diff -ur /u/kjm/apache_1.1.3/support/Makefile apache_1.1.3/support/Makefile
--- /u/kjm/apache_1.1.3/support/Makefile	Fri Jun 14 04:49:55 1996
+++ apache_1.1.3/support/Makefile	Wed Feb 19 18:22:16 1997
@@ -4,9 +4,9 @@
 #CC= cc
 
 #For Optimization
-#CFLAGS= -O2
+CFLAGS= -O2
 #For debugging
-CFLAGS= -g
+#CFLAGS= -g
 # For SCO ODT
 #EXTRA_LIBS= -lcrypt_i
 # For OS/2 port
@@ -48,6 +48,9 @@
 
 sco5:
 	make all CC=cc
+
+newsos4:
+	make all CC=gcc CFLAGS="-O -DNEWSOS4"
 
 sco3:
 	make all CC=cc EXTRA_LIBS=-lcrypt_i
diff -ur /u/kjm/apache_1.1.3/support/httpd_monitor.c apache_1.1.3/support/httpd_monitor.c
--- /u/kjm/apache_1.1.3/support/httpd_monitor.c	Thu Feb 22 20:47:38 1996
+++ apache_1.1.3/support/httpd_monitor.c	Wed Feb 19 18:24:35 1997
@@ -78,6 +78,7 @@
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include "conf.h"
 #include "scoreboard.h"
 #include "httpd.h"
 
diff -ur /u/kjm/apache_1.1.3/support/rotatelogs.c apache_1.1.3/support/rotatelogs.c
--- /u/kjm/apache_1.1.3/support/rotatelogs.c	Fri Jun 14 04:49:55 1996
+++ apache_1.1.3/support/rotatelogs.c	Wed Feb 19 18:25:18 1997
@@ -15,6 +15,7 @@
 #include <time.h>
 #include <errno.h>
 #include <fcntl.h>
+#include "conf.h"
 
 void main(int argc,char **argv)
     {
