Here are patches needed to complie under AIX 4.2.
I changed configure.in, pqcomm.c, config.h.in, and fe-connect.c.
Also I had to install flex because lex did not want to translate pgc.l.

*** configure.in	Tue Oct 13 14:05:50 1998
--- configure.in.orig	Tue Oct 13 14:02:18 1998
***************
*** 444,458 ****
  AC_HEADER_TIME
  AC_STRUCT_TM
  
- AC_MSG_CHECKING(for type of last arg to accept)
- AC_TRY_COMPILE([#include <stdlib.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- ],
- [int a = accept(1, (struct sockaddr *) 0, (size_t *) 0);],
- [AC_DEFINE(SOCKET_SIZE_TYPE, size_t) AC_MSG_RESULT(size_t)],
- [AC_DEFINE(SOCKET_SIZE_TYPE, int) AC_MSG_RESULT(int)])
- 
  dnl Check for any "odd" conditions
  AC_MSG_CHECKING(for int timezone)
  AC_TRY_LINK([#include <time.h>],
--- 444,449 ----

*** pqcomm.c	Tue Oct 13 15:11:56 1998
--- pqcomm.c.orig	Tue Oct 13 14:48:44 1998
***************
*** 660,667 ****
  int
  StreamConnection(int server_fd, Port *port)
  {
! 	int			len;
! 	SOCKET_SIZE_TYPE	addrlen;
  	int			family = port->raddr.sa.sa_family;
  
  	/* accept connection (and fill in the client (remote) address) */
--- 660,667 ----
  int
  StreamConnection(int server_fd, Port *port)
  {
! 	int			len,
! 				addrlen;
  	int			family = port->raddr.sa.sa_family;
  
  	/* accept connection (and fill in the client (remote) address) */
***************
*** 732,739 ****
  int
  StreamOpen(char *hostName, short portName, Port *port)
  {
! 	SOCKET_SIZE_TYPE	len;
! 	int			err;
  	struct hostent *hp;
  	extern int	errno;
  
--- 732,739 ----
  int
  StreamOpen(char *hostName, short portName, Port *port)
  {
! 	int			len,
! 				err;
  	struct hostent *hp;
  	extern int	errno;
  

*** config.h.in	Tue Oct 13 14:32:40 1998
--- config.h.in.orig	Tue Oct 13 14:33:28 1998
***************
*** 210,218 ****
  /* Set to 1 if you want to Enable ASSERT CHECKING */
  #undef USE_ASSERT_CHECKING
  
- /* Define as the base type of the last arg to accept */
- #undef SOCKET_SIZE_TYPE
- 
  /*
   * Code below this point should not require changes
   */
--- 210,215 ----

*** fe-connect.c	Tue Oct 13 15:20:14 1998
--- fe-connect.c.orig	Tue Oct 13 15:19:10 1998
***************
*** 472,478 ****
  
  	StartupPacket sp;
  	AuthRequest areq;
! 	SOCKET_SIZE_TYPE	laddrlen = sizeof(SockAddr);
  	int			portno,
  				family,
  				len;
--- 472,478 ----
  
  	StartupPacket sp;
  	AuthRequest areq;
! 	int			laddrlen = sizeof(SockAddr);
  	int			portno,
  				family,
  				len;



-----Original Message-----
From:	Marc G. Fournier [SMTP:scrappy@hub.org]
Sent:	Monday, October 12, 1998 8:38 PM
To:	Peter Gucwa
Cc:	'hackers@postgresql.org'; 'andreas.zeugswetter@telecom.at'
Subject:	Re: [HACKERS] compilation problem on AIX

On Mon, 12 Oct 1998, Peter Gucwa wrote:

> Does somebody have solution for this problem that was discussed here a month ago?
> 
> >> 
> >> the stream functions on AIX need a size_t for addrlen's in fe-connect.c and pqcomm.c.
> >>This has come up before.  AIX wants size_t for certain structures like
> >getsockname().  I believe the third parameter on AIX is size_t, while it
> >used to be int on my machine, but is not socklen_t.  Is this correct? 
> >The 'int' code works fine for me, but I can see why AIX is having a
> >problem, and perhaps it is time for configure to check on the various
> >types.
> >
> >	getsockname(int s, struct sockaddr *name, socklen_t *namelen);
> 
> Ok, so this gets tricky. In 4.2.1 it is size_t and in 4.3.1 it is as
> above with socklen_t :-(

If someone can make me a *short* code stub that fails to compile depending
on which is used, I can add this to configure...

Marc G. Fournier                               scrappy@hub.org
Systems Administrator @ hub.org                    
scrappy@{postgresql|isc}.org                       ICQ#7615664


Tue, 13 Oct 1998 16:22:47 -0400
Peter Gucwa <pg@softcomputer.com>
RE: [HACKERS] compilation problem on AIX
> > >	getsockname(int s, struct sockaddr *name, socklen_t *namelen);
> >
> > Ok, so this gets tricky. In 4.2.1 it is size_t and in 4.3.1 it is as
> > above with socklen_t :-(
>
> If someone can make me a *short* code stub that fails to compile depending
> on which is used, I can add this to configure...

--- cut here ---
#include <sys/socket.h>

int getsockname(int, struct sockaddr *, socklen_t *);

int x() {return 0;}
--- cut here ---

If your compiler insists on size_t instead of socklen_t, this will fail with
an error.

My test (since linux doesn't care):

test.c:
extern int x(int);

extern int x(long);

% gcc -c test.c
~
test.c:3: conflicting types for `x'
test.c:1: previous declaration of `x'
% echo $?
~
1

Enjoy.

Taral


Tue, 13 Oct 1998 17:08:57 -0500
"Taral" <taral@mail.utexas.edu>
RE: [HACKERS] compilation problem on AIX