From: tml@tik.vtt.fi (Tor Lillqvist)
Newsgroups: comp.mail.mh
Subject: HP-UX shared library and ANSI C patch for MH 6.8
Date: 30 Dec 1992 21:58:51 GMT
Organization: Technical Research Centre of Finland, Laboratory for Information
	Processing (VTT/TIK)
NNTP-Posting-Host: tik.vtt.fi

I patched MH 6.8 to compile with the ANSI C compiler and to use shared
libraries on HP-UX 8.07.  Here are the diffs.  Please apply with care,
you probably don't want to blindly apply the diff to MH and mtstailor.

If you use shared libraries on HP-UX, first do "make inst-lib", then "make".

Binary files /u3/tmp/mh-6.8/READ-ME and ./READ-ME differ
diff -rc1 /u3/tmp/mh-6.8/conf/MH ./conf/MH
*** /u3/tmp/mh-6.8/conf/MH	Tue Dec 15 18:52:42 1992
--- ./conf/MH	Wed Dec 30 14:00:21 1992
***************
*** 1,9 ****
! # @(#)$Id: MH,v 1.7 90/04/06 09:44:31 sources Exp $
! # a 4.2BSD VAX system running SendMail
! bin	/usr/local
! bboards	on
  etc	/usr/local/lib/mh
! mail	/usr/spool/mail
! manuals	local
! mts	sendmail
! options	BSD42
--- 1,36 ----
! # hp9000 machines at tik.vtt.fi running hp-ux 8.*
! bboards	off
! bin	/usr/local/bin/mh
! cc	cc -Aa -D_HPUX_SOURCE
! curses	-lcurses
  etc	/usr/local/lib/mh
! ldoptlibs	-ldbm
! mail	/usr/mail
! mailgroup	mail
! mandir	/usr/local/man
! manuals	standard
! mts	sendmail/smtp
! pop	off
! remove	rm -f
! signal	void
! sharedlib hpux8
! slflags	+z
! sprintf int
! options	BIND
! options	DUMB
! options	FOLDPROT='"700"'
! options	LOCKF
! options MHE
! options MHRC
! options MIME
! options MORE='"/usr/local/bin/less"'
! options	RENAME
! options	SOCKETS
! options	SVR4
! options	SYS5
! options	SYS5DIR
! options	TERMINFO
! options	TZNAME
! options	UNISTD
! options	VSPRINTF
! options NTOHLSWAP
diff -rc1 /u3/tmp/mh-6.8/conf/config/mtstailor ./conf/config/mtstailor
*** /u3/tmp/mh-6.8/conf/config/mtstailor	Tue Dec 15 18:52:44 1992
--- ./conf/config/mtstailor	Wed Dec 30 15:46:42 1992
***************
*** 2,4 ****
  mmdflfil:	@(MHDROPFIL)
  hostable:	@(MHETCPATH)/hosts
! servers:	localhost \01localnet
--- 2,13 ----
  mmdflfil:	@(MHDROPFIL)
+ uucpldir:	/usr/spool/mail
+ uucplfil:	
+ mmdelim1:	\001\001\001\001\n
+ mmdelim2:	\001\001\001\001\n
+ mmailid:	0
+ umincproc:
+ localname:	tik.vtt.fi
+ lockldir:
+ 
  hostable:	@(MHETCPATH)/hosts
! servers:	tik.vtt.fi
diff -rc1 /u3/tmp/mh-6.8/conf/makefiles/sbr ./conf/makefiles/sbr
*** /u3/tmp/mh-6.8/conf/makefiles/sbr	Tue Dec 15 18:53:12 1992
--- ./conf/makefiles/sbr	Wed Dec 30 13:18:55 1992
***************
*** 28,29 ****
--- 28,32 ----
  @END: SUN4SHLIB
+ @BEGIN: HPUX8SHLIB
+ # The shared library is renamed to libmh.sl when installed
+ @END: HPUX8SHLIB
  LIBS     =	shared libmh.a libmh.so $(LIBSA)
***************
*** 119,120 ****
--- 122,126 ----
  @END: SYS5SHLIB
+ @BEGIN: HPUX8SHLIB
+ 		(cd shared; ld -b -o ../$@ $(OFILES))
+ @END: HPUX8SHLIB
  		-@rm -f $@.$(SLIBVER)
***************
*** 147,149 ****
  @BEGIN: SHAREDLIB
! inst-lib:	libmh.so $(LIBSA)
  		-rm -f $(SLIBDIR)/libmh.so.$(SLIBVER)
--- 153,155 ----
  @BEGIN: SHAREDLIB
! inst-lib:	shared libmh.so $(LIBSA)
  		-rm -f $(SLIBDIR)/libmh.so.$(SLIBVER)
***************
*** 165,166 ****
--- 171,177 ----
  @END: SUN4SHLIB
+ @BEGIN: HPUX8SHLIB
+ 		mv $(SLIBDIR)/libmh.so.$(SLIBVER) $(SLIBDIR)/libmh.$(SLIBVER).sl
+ 		-@ls -l $(SLIBDIR)/libmh.$(SLIBVER).sl
+ 		-@echo "Shared library renamed as per HP-UX convention"
+ @END: HPUX8SHLIB
  @END: SHAREDLIB
diff -rc1 /u3/tmp/mh-6.8/conf/makefiles/uip ./conf/makefiles/uip
*** /u3/tmp/mh-6.8/conf/makefiles/uip	Tue Dec 15 18:53:14 1992
--- ./conf/makefiles/uip	Wed Dec 30 13:45:10 1992
***************
*** 124,125 ****
--- 124,129 ----
  @END: SHAREDLIB
+ @BEGIN: HPUX8SHLIB
+ # On HP-UX 8.0, no LD_LIBRARY_PATH
+ LD	=	@(MHCOMPILER)
+ @END: HPUX8SHLIB
  @BEGIN: OPTIM
***************
*** 145,146 ****
--- 149,154 ----
  LDLIBS	=	$(LDLIBES) ../config/version.o $(LDOPTLIB)
+ @BEGIN: HPUX8SHLIB
+ LDLIBES =	../config/config.o -L@(SLIBDIR) -lmh.@(SLIBVER) \
+ 		../mts/libmts.a  ../zotnet/libzot.a
+ @END: HPUX8SHLIB
  @END: SHAREDLIB
diff -rc1 /u3/tmp/mh-6.8/conf/mh-gen.8 ./conf/mh-gen.8
*** /u3/tmp/mh-6.8/conf/mh-gen.8	Tue Dec 15 18:53:15 1992
--- ./conf/mh-gen.8	Wed Dec 30 13:48:11 1992
***************
*** 511,512 ****
--- 511,516 ----
  If you enable this, be sure to also use \*(lqoptions SVR4\*(rq.
+ If \*(lqhpux8\*(rq,
+ makes libmh into a HP-UX 8 (and presumably later) shared library.
+ If you enable this, be sure to also use \*(lqslflags +z\*(rq, and to
+ do a \*(rqmake inst-lib\*(lq before you do the \*(rqmake\*(lq.
  
diff -rc1 /u3/tmp/mh-6.8/conf/mhconfig.c ./conf/mhconfig.c
*** /u3/tmp/mh-6.8/conf/mhconfig.c	Tue Dec 15 18:53:16 1992
--- ./conf/mhconfig.c	Wed Dec 30 12:37:07 1992
***************
*** 452,453 ****
--- 452,457 ----
  	fprintf (fp, "/^@BEGIN: SYS5SHLIB$/,/^@END: SYS5SHLIB$/d\n");
+     if (strcmp (sharedlib, "hpux8") == 0)
+ 	fprintf (fp, "/^@BEGIN: HPUX8SHLIB$/d\n/^@END: HPUX8SHLIB$/d\n");
+     else
+ 	fprintf (fp, "/^@BEGIN: HPUX8SHLIB$/,/^@END: HPUX8SHLIB$/d\n");
  
***************
*** 763,764 ****
--- 767,769 ----
  	    && strcmp (sharedlib, "sun4") && strcmp (sharedlib, "sys5")
+ 	    && strcmp (sharedlib, "hpux8")
  	    && strcmp (sharedlib, "secure"))
***************
*** 765,767 ****
  	adios (NULLCP,
! 	    "sharedlib should be either \"sun4\", \"sys5\", or \"off\", not %s",
  	    sharedlib);
--- 770,772 ----
  	adios (NULLCP,
! 	    "sharedlib should be either \"sun4\", \"sys5\", \"hpux8\" or \"off\", not %s",
  	    sharedlib);
diff -rc1 /u3/tmp/mh-6.8/config/version.sh ./config/version.sh
*** /u3/tmp/mh-6.8/config/version.sh	Tue Dec 15 18:53:19 1992
--- ./config/version.sh	Tue Dec 29 16:01:35 1992
***************
*** 42,44 ****
  cat version ${Patch} |\
! awk -F. '
  BEGIN	{ split ("'"${1}"'", ver, ".");\
--- 42,44 ----
  cat version ${Patch} |\
! gawk -F. '
  BEGIN	{ split ("'"${1}"'", ver, ".");\
diff -rc1 /u3/tmp/mh-6.8/uip/vmh.c ./uip/vmh.c
*** /u3/tmp/mh-6.8/uip/vmh.c	Tue Dec 15 18:56:08 1992
--- ./uip/vmh.c	Tue Dec 29 17:18:17 1992
***************
*** 57,59 ****
  #endif
! #ifdef	hpux
  #include <termio.h>
--- 57,59 ----
  #endif
! #ifdef	__hpux
  #include <termio.h>
diff -rc1 /u3/tmp/mh-6.8/zotnet/bboards/getbbent.c ./zotnet/bboards/getbbent.c
*** /u3/tmp/mh-6.8/zotnet/bboards/getbbent.c	Tue Dec 15 18:56:11 1992
--- ./zotnet/bboards/getbbent.c	Tue Dec 29 17:11:49 1992
***************
*** 82,84 ****
  
! #if	defined(__STDC__) && defined(SVR4)
  #include <crypt.h>
--- 82,84 ----
  
! #if	defined(__STDC__) && defined(SVR4) && !defined(__hpux)
  #include <crypt.h>
***************
*** 85,87 ****
  #endif
! #if	defined(UNISTD) || defined(_AIX)
  #include <unistd.h>
--- 85,87 ----
  #endif
! #if	defined(UNISTD) || defined(_AIX) || defined(__hpux)
  #include <unistd.h>
--
Tor Lillqvist,
working, but not speaking, for the Technical Research Centre of Finland,
Laboratory for Information Processing (VTT/TIK).
Newsgroups: comp.mail.mh