Index: src/include/storage/s_lock.h
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/include/storage/s_lock.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 s_lock.h
*** src/include/storage/s_lock.h	23 Aug 2004 23:12:06 -0000	1.1.1.1
--- src/include/storage/s_lock.h	24 Aug 2004 02:09:30 -0000
***************
*** 540,545 ****
--- 540,557 ----
  
  #endif	 /* __hppa || __hppa__ */
  
+ #if defined(__hpux) && defined(__ia64)
+ #if !defined(__GNUC__)
+ 
+ #define HAS_TEST_AND_SET
+ 
+ typedef unsigned int slock_t;
+ 
+ #include <ia64/sys/inline.h>
+ #define TAS(lock) _Asm_xchg(_SZ_W, lock, 1, _LDHINT_NONE)
+ 
+ #endif        /* !defined(__GNUC__) */
+ #endif
  
  #if defined(__QNX__) && defined(__WATCOMC__)
  /*
Index: src/Makefile.shlib
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/Makefile.shlib,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.shlib
*** src/Makefile.shlib	23 Aug 2004 23:12:03 -0000	1.1.1.1
--- src/Makefile.shlib	24 Aug 2004 02:09:30 -0000
***************
*** 148,156 ****
  
  ifeq ($(PORTNAME), hpux)
    shlib			= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
-   LINK.shared		= $(LD) +h $(soname) -b +b $(libdir)
    ifeq ($(GCC), yes)
!     SHLIB_LINK		+= `$(CC) -print-libgcc-file-name`
    endif
  endif
  
--- 148,158 ----
  
  ifeq ($(PORTNAME), hpux)
    shlib			= lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
    ifeq ($(GCC), yes)
!     LINK.shared               = $(CC) $(LDFLAGS) -shared -Wl,+h -Wl,$(soname) -Wl,+b -Wl,$(libdir)
!     SHLIB_LINK                += `$(CC) $(LDFLAGS) -print-libgcc-file-name`
!   else
!     LINK.shared               = $(LD) +h $(soname) -b +b $(libdir)
    endif
  endif
  
Index: src/makefiles/Makefile.hpux
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/src/makefiles/Makefile.hpux,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 Makefile.hpux
*** src/makefiles/Makefile.hpux	23 Aug 2004 23:12:07 -0000	1.1.1.1
--- src/makefiles/Makefile.hpux	24 Aug 2004 02:09:30 -0000
***************
*** 11,16 ****
--- 11,21 ----
     LIBS := -lBSD $(LIBS)
  endif
  
+ # Using X/Open Networking Interfaces requires to link with libxnet.
+ # Without specifying this, bind(), getpeername() and so on don't work
+ # correctly in the LP64 data model.
+ LIBS := -lxnet $(LIBS)
+ 
  # Embed 'libdir' as the shared library search path so that the executables
  # don't need SHLIB_PATH to be set.  (We do not observe the --enable-rpath
  # switch here because you'd get rather bizarre behavior if you leave this
***************
*** 28,34 ****
--- 33,43 ----
  
  AROPT = crs
  
+ ifeq ($(host_cpu), ia64)
+ DLSUFFIX = .so
+ else
  DLSUFFIX = .sl
+ endif
  ifeq ($(GCC), yes)
  CFLAGS_SL = -fpic
  else
***************
*** 37,43 ****
  
  # Rule for building shared libs (currently used only for regression test
  # shlib ... should go away, since this is not really enough knowledge)
! %.sl: %.o
  	$(LD) -b -o $@ $<
  
  sqlmansect = 5
--- 46,56 ----
  
  # Rule for building shared libs (currently used only for regression test
  # shlib ... should go away, since this is not really enough knowledge)
! %$(DLSUFFIX): %.o
! ifeq ($(GCC), yes)
! 	$(CC) $(LDFLAGS) -shared -o $@ $<
! else
  	$(LD) -b -o $@ $<
+ endif
  
  sqlmansect = 5
Index: doc/FAQ_HPUX
===================================================================
RCS file: /home/shinji/oss/cvsroot/pgsql/pgsql/doc/FAQ_HPUX,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 FAQ_HPUX
*** doc/FAQ_HPUX	23 Aug 2004 23:12:01 -0000	1.1.1.1
--- doc/FAQ_HPUX	24 Aug 2004 02:09:30 -0000
***************
*** 33,48 ****
  
  I'd also recommend making sure you are fairly up-to-date on HP
  patches.  At a minimum, if you are building 64 bit binaries on on HPUX
! 11.11 you may need PHSS_26263 (11.11) or a successor patch otherwise
  initdb may hang:
  
!     PHSS_26263  s700_800 11.11 ld(1) and linker tools cumulative patch
  
  On general principles you should be current on libc and ld/dld
  patches, as well as compiler patches if you are using HP's C compiler.
  See HP's support sites such as http://itrc.hp.com and
  ftp://us-ffs.external.hp.com/ for free copies of their latest patches.
  
  
  1.2)	Anything special about the build/install procedure?
  
--- 33,59 ----
  
  I'd also recommend making sure you are fairly up-to-date on HP
  patches.  At a minimum, if you are building 64 bit binaries on on HPUX
! 11.11 you may need PHSS_30966 (11.11) or a successor patch otherwise
  initdb may hang:
  
!     PHSS_30966  s700_800 ld(1) and linker tools cumulative patch
  
  On general principles you should be current on libc and ld/dld
  patches, as well as compiler patches if you are using HP's C compiler.
  See HP's support sites such as http://itrc.hp.com and
  ftp://us-ffs.external.hp.com/ for free copies of their latest patches.
  
+ If you are building on a PA-RISC 2.0 machine and want to have 64-bit
+ binaries using GCC, you must use GCC 64-bit version. GCC binaries for
+ HP-UX PA-RISC and Itanium are available from http://www.hp.com/go/gcc.
+ Don't forget to get and install binutils at the same time.
+ 
+ If you are building on a HP-UX Itanium machine, you will need the
+ latest HP ANSI C compiler with its dependent patch or successor
+ patches:
+ 
+     PHSS_30848  s700_800 HP C Compiler (A.05.57)
+     PHSS_30849  s700_800 u2comp/be/plugin library Patch
  
  1.2)	Anything special about the build/install procedure?
  
***************
*** 75,84 ****
  Any other error is cause for suspicion.
  
  The parallel regression test script (gmake check) is known to lock up
! when run under HP's Bourne shells: /usr/bin/sh and /sbin/sh.  This is a
! known defect JAGad84609, the fix for which is not yet in any released
! HP-UX version or shell patches.  To work around it, use ksh to run the
! regression script:
  	gmake SHELL=/bin/ksh check
  
  If you see that the tests have stopped making progress and only a shell
--- 86,100 ----
  Any other error is cause for suspicion.
  
  The parallel regression test script (gmake check) is known to lock up
! on PA-RISC when run under HP's Bourne shells: /usr/bin/sh and
! /sbin/sh. To fix this problem, you will need PHCO_30269 with its
! dependent patch or successor patches:
! 
!     PHCO_30269  s700_800 cumulative sh-posix(1) patch
!     PHCO_29816  s700_800 rc(1M) scripts cumulative patch 
! 
! To work around this problem, use ksh to run the regression script:
! 
  	gmake SHELL=/bin/ksh check
  
  If you see that the tests have stopped making progress and only a shell
