Add support for <xti.h>

From: Pete Forman <gsez020(at)kryten(dot)bedford(dot)waii(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Add support for <xti.h>
Date: 2000-10-13 09:32:06
Message-ID: 14822.54934.469674.683766@kryten.bedford.waii.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Pete Forman
Your email address : pete(dot)forman(at)westgeo(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : SGI MIPS 8000

Operating System (example: Linux 2.0.26 ELF) : IRIX 6.5.5m

PostgreSQL version (example: PostgreSQL-7.1): PostgreSQL-7.1

Compiler used (example: gcc 2.8.0) : MIPSPro 7.3

NB: I expect that the same problem would arise on AIX and Solaris.

Please enter a FULL description of your problem:
------------------------------------------------

The configure script fails to find <netinet/tcp.h>.
As a result, backend/libpq/pqcomm.c and interfaces/libpq/fe-connect.c
fail to compile.

The <netinet/tcp.h> header needs to be preceded by <netinet/in.h>, at
least on IRIX, Solaris and AIX. The simple configure test fails.
(That header on Linux is idempotent.)

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

$ configure
...
checking for netinet/tcp.h... no
...

$ make
...
cc-1020 cc: ERROR File = pqcomm.c, Line = 346
The identifier "TCP_NODELAY" is undefined.

if (setsockopt(port->sock, IPPROTO_TCP, TCP_NODELAY,
^

1 error detected in the compilation of "pqcomm.c".
...

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

The basic problem is that <netinet/tcp.h> is a BSD header. The
correct header for TCP internals such as TCP_NODELAY on a UNIX system
is <xti.h>. By UNIX I mean UNIX95 (aka XPG4v2 or SUSv1) or later.
The current UNIX standard (UNIX98 aka SUSv2) is available online at
<http://www.opengroup.org/onlinepubs/7908799/>.

The fix is to add header support for <xti.h> into configure.in and
config.h.in.

The 2 files which conditionally include <netinet/tcp.h> need also to
conditionally include <xti.h>.

Patches follow.

*** configure.in.orig Mon Oct 9 20:15:39 2000
--- configure.in Fri Oct 13 08:50:15 2000
***************
*** 658,664 ****
## Header files
##
dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
! AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h netinet/tcp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/types.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])

AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
AC_CHECK_HEADERS([readline/history.h history.h], [break])
--- 658,664 ----
## Header files
##
dnl sys/socket.h and sys/types.h are required by AC_FUNC_ACCEPT_ARGTYPES
! AC_CHECK_HEADERS([crypt.h dld.h endian.h fp_class.h getopt.h ieeefp.h xti.h netinet/tcp.h pwd.h sys/ipc.h sys/pstat.h sys/select.h sys/sem.h sys/socket.h sys/shm.h sys/types.h sys/un.h termios.h kernel/OS.h kernel/image.h SupportDefs.h])

AC_CHECK_HEADERS([readline/readline.h readline.h], [break])
AC_CHECK_HEADERS([readline/history.h history.h], [break])
*** src/include/config.h.in.orig Sun Oct 8 08:00:18 2000
--- src/include/config.h.in Fri Oct 13 09:57:13 2000
***************
*** 330,335 ****
--- 330,338 ----
/* Set to 1 if you have <ieeefp.h> */
#undef HAVE_IEEEFP_H

+ /* Set to 1 if you have <xti.h> */
+ #undef HAVE_XTI_H
+
/* Set to 1 if you have <netinet/tcp.h> */
#undef HAVE_NETINET_TCP_H

*** src/backend/libpq/pqcomm.c.orig Fri Oct 6 08:00:14 2000
--- src/backend/libpq/pqcomm.c Fri Oct 13 08:48:47 2000
***************
*** 69,74 ****
--- 69,77 ----
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
+ #ifdef HAVE_XTI_H
+ # include <xti.h>
+ #endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif
*** src/interfaces/libpq/fe-connect.c.orig Wed Oct 4 08:00:15 2000
--- src/interfaces/libpq/fe-connect.c Fri Oct 13 09:01:17 2000
***************
*** 31,36 ****
--- 31,39 ----
#include <unistd.h>
#include <netdb.h>
#include <netinet/in.h>
+ #ifdef HAVE_XTI_H
+ # include <xti.h>
+ #endif
#ifdef HAVE_NETINET_TCP_H
# include <netinet/tcp.h>
#endif

--
Pete Forman -./\.- Disclaimer: This post is originated
Western Geophysical -./\.- by myself and does not represent
pete(dot)forman(at)westgeo(dot)com -./\.- the opinion of Baker Hughes or
http://www.crosswinds.net/~petef -./\.- its divisions.

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Pete Forman 2000-10-13 11:11:06 Regression tests - expected file for IRIX geometry test
Previous Message Philip Warner 2000-10-13 01:59:09 Re: Small patch to replace 'idle' by 'trans' if transaction is still open