                 -----------------------------------------
                   bind-4.9.4-P1.ELF.shared.patch.new.gz
                 -----------------------------------------

      This is a corrected and revised release of the previous patch,
      which should make bind-4.9.4-P1 to compile under Linux with
      ELF/shared support.

      Mea Culpa! In the previous patch I simply forgot not to include
      my "/h/src/" directory structure. I am sorry.

      This is one change (well, should be a big one...), but there are
      others as well:

      Thanks to Manuel J. Galan Moreno (root@mgmux.step.es) some
      adjustments has been made to it:

        - bind's specific header files moved to /usr/include/4.9.4/
          so this does not produce incompatibilities with the standard
          (original) header files.
        - GCC now called with "-O2 -fno-strength-reduce" because of a
          known bug in gcc-2.7.2.
        - h_errno is no longer redifined
        - there is an explicit link for libresolv (for the new binutils)
        - man pages are installed _unformatted /usr/man

      bind-4.9.4-P1 is compiled and tested with this patch on
      Linux-2.0.12 with libc-5.2.18 and gcc-2.7.2. It is currently
      running on my machine and seems to good so far.

      Good luck!


      Tamas Nyitrai
      defiant@mail.datanet.hu

diff -urN bind-4.9.4-P1/Makefile bind-4.9.4-P1.ELF.shared.new/Makefile
--- bind-4.9.4-P1/Makefile	Fri Aug 16 15:14:48 1996
+++ bind-4.9.4-P1.ELF.shared.new/Makefile	Sun Aug 25 12:20:00 1996
@@ -56,13 +56,13 @@
 ## -
 ## --Copyright--
 
-VER = 4.9.4-P1
+VER = 4.9.4.2
 SHELL = /bin/sh
 MAKE = make
 DESTDIR =
 
 INCL = include
-RES = res/libresolv.a
+RES = res/libresolv.so.${VER}
 COMPLIB = compat/lib/lib44bsd.a
 
 # The default build parameters are given for 4.4 BSD.  They should
@@ -108,18 +108,22 @@
 #SHCC = cc
 #PIC = -fpic
 
-#(Linux - on modern systems, all you need to do is rename or remove
-# compat/include/sys/cdefs.h.  See doc/info/Linux for more information.)
-#CC = gcc $(CPPFLAGS)
-#CDEBUG = -g
-#CPPFLAGS = -DSYSV
-#LIBS = -lfl
-#DESTEXEC = /usr/sbin
-#DESTMAN = /usr/man
-#DESTHELP = /usr/lib
-#CATEXT = $$$$N
-#PS = ps -p
-#IOT = IOT
+#(Linux) Look at the end of this Makefile for further patches for Linux.
+CC = gcc -DSYSV
+CDEBUG=-O2 -fomit-frame-pointer -pipe -fno-strength-reduce
+LEX=flex -8 -I
+LIBS = -Wl,-rpath,${DESTDIR}${DESTLIB} -lfl
+PIDDIR = /var/run
+DESTEXEC = /usr/sbin
+DESTMAN = /usr/man
+MANDIR = man
+MANROFF = cat
+DESTHELP = /usr/lib
+CATEXT = $$$$N
+DESTINC = /usr/include/4.9.4
+INSTALL_COMPAT = install-compat
+PS = ps -p
+IOT = IOT
 
 #(CRAY)
 #CDEBUG = -g
@@ -781,3 +785,8 @@
 		2>&1 | grep '\.[ch]:[0-9]'
 
 FRC:
+	# Enable the following lines for Linux.
+	if [ -f compat/include/sys/cdefs.h ]; then \
+	mv compat/include/sys/cdefs.h compat/include/sys/cdefs.h.old; \
+	fi
+
diff -urN bind-4.9.4-P1/compat/Makefile bind-4.9.4-P1.ELF.shared.new/compat/Makefile
--- bind-4.9.4-P1/compat/Makefile	Tue Dec  5 23:31:10 1995
+++ bind-4.9.4-P1.ELF.shared.new/compat/Makefile	Sun Aug 25 12:20:00 1996
@@ -55,7 +55,7 @@
 
 SHELL= /bin/sh
 DESTDIR=
-DESTINC= /usr/include
+DESTINC= /usr/include/4.9.4
 INCL= ../include
 COMPINCL= include
 DESTLIB= /usr/lib
@@ -74,8 +74,7 @@
 	"CPPFLAGS=${CPPFLAGS}"
 
 install:
-	@-echo compat/ is not installed by default
-	@-echo make install-compat if you really need this
+	@-echo compat/ is not installed in Linux
 
 all depend clean::
 	@for x in ${SUBDIRS}; do \
diff -urN bind-4.9.4-P1/compat/include/Makefile bind-4.9.4-P1.ELF.shared.new/compat/include/Makefile
--- bind-4.9.4-P1/compat/include/Makefile	Tue Dec  5 23:32:02 1995
+++ bind-4.9.4-P1.ELF.shared.new/compat/include/Makefile	Sun Aug 25 12:20:01 1996
@@ -55,7 +55,7 @@
 HFILES =
 
 DESTDIR=
-DESTINC= /usr/include
+DESTINC= /usr/include/4.9.4
 
 MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}"
 
@@ -68,6 +68,7 @@
 	rm -f *~ *.BAK *.CKP *.orig
 
 install::
+	-mkdir -p ${DESTDIR}${DESTINC}
 	-for x in "" ${HFILES}; do \
 	    if [ -n "$$x" ]; then \
 		${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/$$x; \
diff -urN bind-4.9.4-P1/compat/include/sys/Makefile bind-4.9.4-P1.ELF.shared.new/compat/include/sys/Makefile
--- bind-4.9.4-P1/compat/include/sys/Makefile	Thu Dec 15 07:23:50 1994
+++ bind-4.9.4-P1.ELF.shared.new/compat/include/sys/Makefile	Sun Aug 25 12:20:01 1996
@@ -53,10 +53,10 @@
 # -
 # --Copyright--
 
-HFILES = cdefs.h bitypes.h
+HFILES = bitypes.h
 
 DESTDIR=
-DESTINC= /usr/include
+DESTINC= /usr/include/4.9.4
 
 all depend:
 
@@ -64,6 +64,7 @@
 	rm -f *~ *.BAK *.CKP *.orig
 
 install:
+	-mkdir -p ${DESTDIR}${DESTINC}/sys
 	for x in ${HFILES}; do \
 		${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/sys/$$x; \
 	done
diff -urN bind-4.9.4-P1/compat/include/sys/bitypes.h bind-4.9.4-P1.ELF.shared.new/compat/include/sys/bitypes.h
--- bind-4.9.4-P1/compat/include/sys/bitypes.h	Thu Dec 15 07:23:50 1994
+++ bind-4.9.4-P1.ELF.shared.new/compat/include/sys/bitypes.h	Sun Aug 25 12:20:01 1996
@@ -67,6 +67,11 @@
 #ifndef __BIT_TYPES_DEFINED__
 #define __BIT_TYPES_DEFINED__
 
+#ifdef __linux__
+#include <linux/types.h>
+#endif
+
+
 	/*
 	 * Basic integral types.  Omit the typedef if
 	 * not possible for a machine/compiler combination.
diff -urN bind-4.9.4-P1/compat/lib/Makefile bind-4.9.4-P1.ELF.shared.new/compat/lib/Makefile
--- bind-4.9.4-P1/compat/lib/Makefile	Sun Jun  2 10:20:33 1996
+++ bind-4.9.4-P1.ELF.shared.new/compat/lib/Makefile	Sun Aug 25 12:20:01 1996
@@ -75,8 +75,7 @@
 SRCS=	mktemp.c strcasecmp.c strerror.c strpbrk.c strtoul.c strdup.c \
 	putenv.c setenv.c setitimer.c writev.c ftruncate.c gettimeofday.c
 
-OBJS=	mktemp.o strcasecmp.o strerror.o strpbrk.o strtoul.o strdup.o \
-	putenv.o setenv.o setitimer.o writev.o ftruncate.o gettimeofday.o
+OBJS=	foo.o
 
 all: lib44bsd.a
 
diff -urN bind-4.9.4-P1/compat/lib/foo.c bind-4.9.4-P1.ELF.shared.new/compat/lib/foo.c
--- bind-4.9.4-P1/compat/lib/foo.c	Thu Jan  1 01:00:00 1970
+++ bind-4.9.4-P1.ELF.shared.new/compat/lib/foo.c	Sun Aug 25 12:20:01 1996
@@ -0,0 +1 @@
+foo(){}
diff -urN bind-4.9.4-P1/doc/bog/Makefile bind-4.9.4-P1.ELF.shared.new/doc/bog/Makefile
--- bind-4.9.4-P1/doc/bog/Makefile	Mon Aug 21 00:22:28 1995
+++ bind-4.9.4-P1.ELF.shared.new/doc/bog/Makefile	Sun Aug 25 12:20:01 1996
@@ -60,8 +60,8 @@
 	setup.me manage.me build.me ack.me
 ME=	-me
 NROFF=	nroff -rb3
-PRINTER= -Pdp
-TBL=	dtbl $(PRINTER)
+PRINTER=
+TBL=   tbl $(PRINTER)
 TROFF= ditroff $(PRINTER)
 GROFF= groff -Tps -t $(ME)
 
diff -urN bind-4.9.4-P1/include/Makefile bind-4.9.4-P1.ELF.shared.new/include/Makefile
--- bind-4.9.4-P1/include/Makefile	Mon Aug 21 00:17:44 1995
+++ bind-4.9.4-P1.ELF.shared.new/include/Makefile	Sun Aug 25 12:20:01 1996
@@ -55,7 +55,7 @@
 HFILES = netdb.h resolv.h
 
 DESTDIR=
-DESTINC= /usr/include
+DESTINC= /usr/include/4.9.4
 
 MARGS= DESTDIR="${DESTDIR}" DESTINC="${DESTINC}" INSTALL="${INSTALL}" \
 	MAKE="${MAKE}"
@@ -69,6 +69,7 @@
 	rm -f *~ *.BAK *.CKP *.orig
 
 install::
+	-mkdir -p ${DESTDIR}${DESTINC}
 	@set -x; for x in ${HFILES}; do \
 		${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/$$x; \
 	done
diff -urN bind-4.9.4-P1/include/arpa/Makefile bind-4.9.4-P1.ELF.shared.new/include/arpa/Makefile
--- bind-4.9.4-P1/include/arpa/Makefile	Thu Jan 12 23:59:24 1995
+++ bind-4.9.4-P1.ELF.shared.new/include/arpa/Makefile	Sun Aug 25 12:20:01 1996
@@ -54,7 +54,7 @@
 HFILES = inet.h nameser.h
 
 DESTDIR =
-DESTINC = /usr/include
+DESTINC = /usr/include/4.9.4
 
 all depend:
 
@@ -62,6 +62,7 @@
 	rm -f *~ *.BAK *.CKP *.orig
 
 install:
+	-mkdir -p ${DESTDIR}${DESTINC}/arpa
 	set -x; for x in ${HFILES}; do \
 		${INSTALL} -c -m 444 $$x ${DESTDIR}${DESTINC}/arpa/$$x; \
 	done
diff -urN bind-4.9.4-P1/man/Makefile bind-4.9.4-P1.ELF.shared.new/man/Makefile
--- bind-4.9.4-P1/man/Makefile	Tue Jun 20 22:27:20 1995
+++ bind-4.9.4-P1.ELF.shared.new/man/Makefile	Sun Aug 25 12:20:01 1996
@@ -31,7 +31,7 @@
 # entries on the fly, use
 #	MANDIR = man
 #
-MANDIR = cat
+MANDIR = man
 
 #
 # Default extension for manual entries. To install the manual entries under
@@ -298,7 +298,7 @@
 #
 # Command used to produce manual entries
 #
-MK_MANFILE = ( ${EXT_SED_CMD} | ${MANROFF} )
+MK_MANFILE = ( ${EXT_SED_CMD} )
 
 #
 # Extensions for the generated manual entries
diff -urN bind-4.9.4-P1/res/Makefile bind-4.9.4-P1.ELF.shared.new/res/Makefile
--- bind-4.9.4-P1/res/Makefile	Fri Aug 16 15:14:51 1996
+++ bind-4.9.4-P1.ELF.shared.new/res/Makefile	Sun Aug 25 12:20:01 1996
@@ -56,22 +56,23 @@
 ## -
 ## --Copyright--
 
+VER= 4.9.4.2
 DESTDIR =
 DESTLIB = /usr/lib
 CC= cc
 SHELL= /bin/sh
-CDEBUG= -g
+CDEBUG= -O2 -fno-strength-reduce
 INCL = ../include
 COMPINCL = ../compat/include
-AR= ar cru
-RANLIB= ranlib
+AR_SH= gcc -shared -o
+RANLIB= :
 DEFS=	
 LOCDEFS= -DUSE_OPTIONS_H
 INSTALL= install
 
 AROBJS= ${ARPREF} ${OBJS} ${ARSUFF}
 
-CFLAGS=	${CDEBUG} -I${INCL} -I${COMPINCL} ${DEFS} ${LOCDEFS}
+CFLAGS=	-fPIC ${CDEBUG} -I${INCL} -I${COMPINCL} ${DEFS} ${LOCDEFS}
 
 SRCS=	herror.c res_debug.c res_data.c \
 	res_comp.c res_init.c res_mkquery.c res_query.c res_send.c \
@@ -85,17 +86,18 @@
 	gethnamaddr.o sethostent.o nsap_addr.o hostnamelen.o \
 	inet_addr.o inet_ntop.o inet_pton.o
 
-all: libresolv.a
+all:	libresolv.so.${VER}
 
-libresolv.a: ${OBJS}
-	${AR} libresolv.a ${AROBJS}
-	$(RANLIB) libresolv.a
+libresolv.so.${VER}: ${OBJS}
+	${AR_SH} libresolv.so.${VER} -Wl,-soname,libresolv.so.4 ${AROBJS}
 
-install: ${DESTDIR}${DESTLIB}/libresolv.a
 
-${DESTDIR}${DESTLIB}/libresolv.a: libresolv.a
-	${INSTALL} -c -o bin -g bin -m 644 libresolv.a ${DESTDIR}${DESTLIB}/
-	( cd ${DESTDIR}${DESTLIB} ; $(RANLIB) libresolv.a )
+install: ${DESTDIR}${DESTLIB}/libresolv.so.${VER}
+
+${DESTDIR}${DESTLIB}/libresolv.so.${VER}: libresolv.so.${VER}
+	${INSTALL} -c -o bin -g bin -m 755 libresolv.so.${VER} ${DESTDIR}${DESTLIB}/
+	-(cd ${DESTDIR}${DESTLIB}; ln -sf libresolv.so.${VER} libresolv.so )
+	-ldconfig
 
 .c.o:
 	${CC} ${CPPFLAGS} ${CFLAGS} -c $*.c
@@ -103,7 +105,7 @@
 	${LDS} mv a.out $*.o
 
 clean: FRC
-	rm -f errs a.out core libresolv.a tags .depend
+	rm -f errs a.out core libresolv.* tags
 	rm -f *.o *.BAK *.CKP *~ *.orig
 
 depend: FRC
diff -urN bind-4.9.4-P1/tools/dig.c bind-4.9.4-P1.ELF.shared.new/tools/dig.c
--- bind-4.9.4-P1/tools/dig.c	Tue May 21 09:32:40 1996
+++ bind-4.9.4-P1.ELF.shared.new/tools/dig.c	Sun Aug 25 12:20:01 1996
@@ -630,7 +630,7 @@
 					       inet_ntoa(_res.nsaddr_list[i]
 							 .sin_addr));
 					printf(";; WHEN: %s",
-					       ctime(&(exectime.tv_sec)));
+					       ctime((time_t *)(&(exectime.tv_sec))));
 				}
 				if (!x)
 					break;	/* success */
@@ -685,7 +685,7 @@
 			printf(";; FROM: %s to SERVER: %s\n",
 			       myhostname, srvmsg);
 			printf(";; WHEN: %s",
-			       ctime(&(exectime.tv_sec)));
+			       ctime((time_t *)(&(exectime.tv_sec))));
 			printf(";; MSG SIZE  sent: %d  rcvd: %d\n",
 			       bytes_out, bytes_in);
 		}
