*** ./configure.orig	Fri Dec  3 23:24:53 2004
--- ./configure	Tue Dec 14 15:57:51 2004
***************
*** 14608,14614 ****
--- 14608,14616 ----
  int
  main ()
  {
+ #ifndef _AIX
  int strerror_r(int, char *, size_t);
+ #endif
    ;
    return 0;
  }
***************
*** 14758,14777 ****
    cat >conftest.$ac_ext <<_ACEOF
  #line $LINENO "configure"
  #include "confdefs.h"
! typedef long int int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! int64 a = 20000001;
! int64 b = 40000005;
  
  int does_int64_work()
  {
!   int64 c,d;
  
!   if (sizeof(int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
--- 14760,14779 ----
    cat >conftest.$ac_ext <<_ACEOF
  #line $LINENO "configure"
  #include "confdefs.h"
! typedef long int ac_int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! ac_int64 a = 20000001;
! ac_int64 b = 40000005;
  
  int does_int64_work()
  {
!   ac_int64 c,d;
  
!   if (sizeof(ac_int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
***************
*** 14872,14891 ****
    cat >conftest.$ac_ext <<_ACEOF
  #line $LINENO "configure"
  #include "confdefs.h"
! typedef long long int int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! int64 a = 20000001;
! int64 b = 40000005;
  
  int does_int64_work()
  {
!   int64 c,d;
  
!   if (sizeof(int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
--- 14874,14893 ----
    cat >conftest.$ac_ext <<_ACEOF
  #line $LINENO "configure"
  #include "confdefs.h"
! typedef long long int ac_int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! ac_int64 a = 20000001;
! ac_int64 b = 40000005;
  
  int does_int64_work()
  {
!   ac_int64 c,d;
  
!   if (sizeof(ac_int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
***************
*** 15004,15021 ****
  #line $LINENO "configure"
  #include "confdefs.h"
  #include <stdio.h>
! typedef long long int int64;
  #define INT64_FORMAT "$pgac_format"
  
! int64 a = 20000001;
! int64 b = 40000005;
  
  int does_int64_snprintf_work()
  {
!   int64 c;
    char buf[100];
  
!   if (sizeof(int64) != 8)
      return 0;			/* doesn't look like the right size */
  
    c = a * b;
--- 15006,15023 ----
  #line $LINENO "configure"
  #include "confdefs.h"
  #include <stdio.h>
! typedef long long int ac_int64;
  #define INT64_FORMAT "$pgac_format"
  
! ac_int64 a = 20000001;
! ac_int64 b = 40000005;
  
  int does_int64_snprintf_work()
  {
!   ac_int64 c;
    char buf[100];
  
!   if (sizeof(ac_int64) != 8)
      return 0;			/* doesn't look like the right size */
  
    c = a * b;
*** ./config/c-compiler.m4.orig	Wed Oct 20 04:12:07 2004
--- ./config/c-compiler.m4	Tue Dec 14 15:27:06 2004
***************
*** 26,45 ****
  define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
  AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
  [AC_TRY_RUN(
! [typedef $1 int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! int64 a = 20000001;
! int64 b = 40000005;
  
  int does_int64_work()
  {
!   int64 c,d;
  
!   if (sizeof(int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
--- 26,45 ----
  define([Ac_cachevar], [translit([pgac_cv_type_$1_64], [ *], [_p])])dnl
  AC_CACHE_CHECK([whether $1 is 64 bits], [Ac_cachevar],
  [AC_TRY_RUN(
! [typedef $1 ac_int64;
  
  /*
   * These are globals to discourage the compiler from folding all the
   * arithmetic tests down to compile-time constants.
   */
! ac_int64 a = 20000001;
! ac_int64 b = 40000005;
  
  int does_int64_work()
  {
!   ac_int64 c,d;
  
!   if (sizeof(ac_int64) != 8)
      return 0;			/* definitely not the right size */
  
    /* Do perfunctory checks to see if 64-bit arithmetic seems to work */
*** ./config/c-library.m4.orig	Mon Oct  4 20:14:18 2004
--- ./config/c-library.m4	Tue Dec 14 16:18:38 2004
***************
*** 108,114 ****
  [AC_CACHE_CHECK(whether strerror_r returns int,
  pgac_func_strerror_r_int,
  [AC_TRY_COMPILE([#include <string.h>],
! [int strerror_r(int, char *, size_t);],
  [pgac_func_strerror_r_int=yes],
  [pgac_func_strerror_r_int=no])])
  if test x"$pgac_func_strerror_r_int" = xyes ; then
--- 108,116 ----
  [AC_CACHE_CHECK(whether strerror_r returns int,
  pgac_func_strerror_r_int,
  [AC_TRY_COMPILE([#include <string.h>],
! [#ifndef _AIX
! int strerror_r(int, char *, size_t);
! #endif],
  [pgac_func_strerror_r_int=yes],
  [pgac_func_strerror_r_int=no])])
  if test x"$pgac_func_strerror_r_int" = xyes ; then
***************
*** 225,242 ****
  AC_CACHE_VAL(pgac_cv_snprintf_long_long_int_format,
  [for pgac_format in '%lld' '%qd' '%I64d'; do
  AC_TRY_RUN([#include <stdio.h>
! typedef long long int int64;
  #define INT64_FORMAT "$pgac_format"
  
! int64 a = 20000001;
! int64 b = 40000005;
  
  int does_int64_snprintf_work()
  {
!   int64 c;
    char buf[100];
  
!   if (sizeof(int64) != 8)
      return 0;			/* doesn't look like the right size */
  
    c = a * b;
--- 227,244 ----
  AC_CACHE_VAL(pgac_cv_snprintf_long_long_int_format,
  [for pgac_format in '%lld' '%qd' '%I64d'; do
  AC_TRY_RUN([#include <stdio.h>
! typedef long long int ac_int64;
  #define INT64_FORMAT "$pgac_format"
  
! ac_int64 a = 20000001;
! ac_int64 b = 40000005;
  
  int does_int64_snprintf_work()
  {
!   ac_int64 c;
    char buf[100];
  
!   if (sizeof(ac_int64) != 8)
      return 0;			/* doesn't look like the right size */
  
    c = a * b;
*** ./src/makefiles/Makefile.unixware.orig	Fri Nov 19 01:41:39 2004
--- ./src/makefiles/Makefile.unixware	Tue Dec 14 15:27:06 2004
***************
*** 33,37 ****
  
  # Unixware needs threads for everything that uses libpq
  CFLAGS += $(PTHREAD_CFLAGS)
- 
- 
--- 33,35 ----
*** ./src/Makefile.global.in.orig	Fri Nov 19 01:41:38 2004
--- ./src/Makefile.global.in	Tue Dec 14 15:27:06 2004
***************
*** 308,313 ****
--- 308,319 ----
  
  libpq = -L$(libpq_builddir) -lpq
  
+ # AIX libraries do not remember their required libs so we have to force
+ # thread dependent libraires in the link
+ ifeq ($(PORTNAME), aix)
+ libpq += $(PTHREAD_LIBS)
+ endif
+ 
  submake-libpq:
  	$(MAKE) -C $(libpq_builddir) all
  
