Subject: bug#6811: [PATCH] emacs-23.2 on hpux

From: Dan Nicolaescu <[email-masked]>
Date: Mon, 09 Aug 2010 05:47:58 -0400

"Peter O'Gorman" <[email-masked]> writes:

> Hi,
>
> Attached is a patch that allows us to build emacs-23.2 on our HP-UX
> systems (10.20, 11.00 and 11.11 PA-RISC and 11.23, 11.31 both PA and
> IA64).

Thanks!

> Index: configure.in
> ===================================================================
> --- configure.in.orig	2010-08-02 22:49:24.298009472 +0000
> +++ configure.in	2010-08-06 16:01:20.204304769 +0000
> @@ -504,6 +504,10 @@
>      CFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CFLAGS"
>    ;;
>  
> +  ia64*-hp-hpux1[1-9]* )
> +    machine=hp800 opsys=hpux11

I think new ports need to be approved by the maintainers. 
This looks a bit odd.
Shouldn't the machine file be ia64?  Or a new file with ia64 in the name?

> Index: src/s/hpux10-20.h
> ===================================================================
> --- src/s/hpux10-20.h.orig	2010-08-02 22:49:24.309919775 +0000
> +++ src/s/hpux10-20.h	2010-08-06 15:37:50.432830578 +0000
> @@ -31,6 +31,8 @@
>  
>  #define HPUX
>  
> +#define ORDINARY_LINK
> +
>  /* SYSTEM_TYPE should indicate the kind of system you are using.
>   It sets the Lisp variable system-type.  */
>  
> @@ -46,7 +48,8 @@
>   *	for terminal control.
>   */
>  
> -#define HAVE_TERMIO
> +#define NO_TERMIO
> +#define HAVE_TERMIOS

I'll check these in.  The last hunk is especially interesting, as hpux
was the last platform to use HAVE_TERMIO, so that will allow for a lot
of simplifications in the code...

>  /* Tested in getloadavg.c.  */
> +#ifndef HAVE_PSTAT_GETDYNAMIC
>  #define HAVE_PSTAT_GETDYNAMIC
> +#endif

If autoconf sets HAVE_PSTAT_GETDYNAMIC, then it seems that it's better
to just remove the #define.

>  
>  /* Eric Backus <[email-masked]> says, HP-UX 9.x on HP 700 machines
>     has a broken `rint' in some library versions including math library
> Index: src/s/hpux11.h
> ===================================================================
> --- src/s/hpux11.h.orig	2010-08-02 22:49:24.302598951 +0000
> +++ src/s/hpux11.h	2010-08-03 04:21:16.274466073 +0000
> @@ -12,5 +12,9 @@
>     then close and reopen it in the child.  */
>  #define USG_SUBTTY_WORKS
>  
> +#if __ia64
> +#define CANNOT_DUMP 1
> +#endif

This looks bad, we don't have any port in the tree that does CANNOT_DUMP.
Does it work if you dump using unexelf.o?

> Index: src/lisp.h
> ===================================================================
> --- src/lisp.h.orig	2010-08-06 15:41:41.000000000 +0000
> +++ src/lisp.h	2010-08-06 15:41:54.344492292 +0000
> @@ -431,9 +431,12 @@
>  
>  #define XSET(var, type, ptr) \
>     ((var) = ((EMACS_INT)(type) << VALBITS) + ((EMACS_INT) (ptr) & VALMASK))
> +#ifdef DATA_SEG_BITS
>  
> +#define XPNTR(a) ((EMACS_UINT) (((a) & VALMASK) | DATA_SEG_BITS))
> +#else
>  #define XPNTR(a) ((EMACS_UINT) ((a) & VALMASK))
> -
> +#endif
>  #endif /* not USE_LSB_TAG */
>  
>  #else /* USE_LISP_UNION_TYPE */

There's some code that does DATA_SEG_BITS further down in the file,
maybe some untangling is needed in lisp.h...