Building PgSQL 7.4.2 on SGI Irix 6.19

Started by David Turoverover 22 years ago5 messagespatches
Jump to latest
#1David Turover
dturover@student.santarosa.edu
note: gmake check had a few out-of-order errors like this:
*** 1732,1739 ****
       | 6 | 6 | six   |
       | 7 | 7 | seven |
       | 8 | 8 | eight |
-      |   |   | null  |
       |   | 0 | zero  |
  (13 rows)
--- 1732,1739 ----
       | 6 | 6 | six   |
       | 7 | 7 | seven |
       | 8 | 8 | eight |
       |   | 0 | zero  |
+      |   |   | null  |
  (13 rows)

I'm not sure how serious a problem this is.
My configure&etc patches are at the end of this message.

----------------

Installing PostGreSQL 7.4.2 on SGI Irix 6.19

Summary:
(install dependencies)
cp *.patch postgresql-7.4.2
cd postgresql-7.4.2
patch -p1 < _pg_config_programs_m4.patch
autoconf
export PATH=/usr/freeware/bin:$PATH
./configure --with-whatever
gmake
gmake check

Patches: Copy the patches you want (READ THE DESCRIPTIONS!)
to the postgres source directory, install them and run autoconf
to generate a new configure script:

patch -p1 < patchname.patch
autoconf

1) The configure.in patch just squelches a bunch of warnings
in the config.log. It's not necessary unless you think
you'll run into errors you'll need to debug.

2) The config/programs.m4 patch adds -lcurses to the command line.
If you don't use it, you'll get undefined symbol errors
trying to compile with readline support.

3) The template/irix5 patch adds the commands to turn on threading.
It is untested! Don't expect your server to work if you use this.

Generic problems: Using zsh 3.0.8, configure will often quit
at a random point in the middle of running, claiming it received
a sigint. This is probably a bug in zsh. Try opening a new shell
and re-running configure from there.

Readline support: SGI Freeware's readline 4.3 package installs
the libraries to the wrong directory. You will need to move
the N32 (mips-3) readline libs from /usr/lib to /usr/lib32
or else the linker won't detect -lreadline. Use the file command
to see what ABI the libraries are using.

You will also need the programs.m4 patch to add -lcurses to the
gcc command line, or else you will get errors like this:
189218:./conftest: rld: Error: unresolvable symbol
in /usr/lib32/libreadline.so.4: tgetent

Java support: You'll need to install Java and ant and ant's dependencies,
which is a difficult and sparsely documented task in itself. SGI has
a java inst package available for download, or you can grab the latest
version from Sun. As for ant's dependencies, I just grabbed everything
on Apache's website since the docs say ant needs just about all of them,
sorted it all into one directory except for a few packages that were
obviously standalone and unnecessary, moved this mess into java2
so I don't have to deal with setting classpath to two dozen different
directories, set all the java PACKAGE_HOME variables to $JAVA_HOME,
and prayed. It survives configure, but is otherwise not tested.

Notes on java support:
1) (important): Make sure that ant.jar is the full one from
the ant package, not a stripped-down version from one of its
dependencies which depends upon ant. You need the real thing,
otherwise you will get java.lang.InstantiationException:
org.apache.tools.ant.Main

2) Ant takes upwards of a minute just to load itself.
As far as I can tell, this is normal behaviour.
configure may /seem/ hung on ant, but just be patient.

Perl support: Irix has two versions of Perl. SGI uses perl 5.0
in the main tree, but the newer 5.6.1 is available from freeware.
Perl 5.0's libs do not define EXTERN_C, causing gmake to break
in src/pl/plperl/plperl.c. 5.6.1 has EXTERN_C defined, but 5.6.1's
Dynaloader.a breaks on "./ldtmpa01Ns3/DynaLoader.a(DynaLoader.o).B":
Error: Invalid format revision (WHIRL::0.31:) for intermediate compiler file

Temporary Solution 1 (using perl 5.0):
1: export CFLAGS="-DEXTERN_C=extern $CFLAGS"

Temporary solution 2 (using perl 5.6.1) (theoretical, haven't tried):
1: Rebuild perl 5.6.1 from source, without -IPA
2: Copy over the Dynaloader.a
3: Put /usr/freeware/bin before /usr/sbin in path
and export it before running configure. Easiest way,
in zsh: export PATH=/usr/freeware/bin:$PATH
4: Add to your configure command:
--with-libraries=/usr/freeware/lib/perl5/5.6.1/irix-n32/CORE/libperl.so
--with-includes=/usr/freeware/lib/perl5/5.6.1/CORE

Python support: As long as the freeware python packages do not install
shared libraries, you cannot get python support without compiling
python yourself. I haven't tried this, so I'm not sure if it will work.

GNU Tar support:

Irix uses an old, b0rked version of tar which breaks on long pathnames.
If you have GNU Tar installed, you need to put /usr/freeware/bin
at the front of your path before running configure. I don't know
when or where Postgres uses tar, but it's in the Makefile.global file,
so it's worth mentioning.

XML Support:

First, install libxml2 from freeware. Then in contrib/xml/Makefile:
CFLAGS := -I/usr/freeware/include/libxml2 -L/usr/freeware/lib32
gmake, su, gmake install.

where "test" is the name of your database:
psql -f ~pgsql/share/contrib/pgxml_dom.sql test

PostGIS Support (as of .8.1):

Find and install Geos and Proj from source. Find and untar PostGIS source
in contrib. In Makefile, set USE_PROJ=1 and USE_GEOS=1 if they aren't already.

*important!* manually run, since the makefile doesn't catch this:
gcc -c postgis_geos_wrapper.cpp -I/usr/local/include/geos

gmake, su, gmake install.

where "test" is the name of your database:
~pgsql/bin/createlang plpgsql test
psql -f ~pgsql/share/contrib/postgis.sql -d test
psql -f ~pgsql/share/contrib/spatial_ref_sys.sql -d test

PostGIS JDBC:

Add your postgres installation's share/java directory to $CLASSPATH,
or add the files therein to an existing $CLASSPATH directory.
Find your postgres's share/java/postgis.jar file and unzip it.
cd contrib/postgis/jdbc. Edit Makefile, change $CLASSPATH
to the location of the unzipped jar file plus the current directory:
On my system, this is: CLASSPATH = /usr/java2/lib:.

in jdbc/examples/TestServer.java, find these lines:
((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
and replace them with:
((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");

then find these lines:
String dbname = "tb";
String dbuser = "dblasby";
String dbpass = "";
String dbhost = "ox";
String dbport = "5555";
And replace this with the correct information to your server.
Make sure that you have created a test database and a user for this,
that you are using the correct port (usually 5432, not 5555),
that postmaster is running with -i to allow TCP connections,
and that your host-based authentication (data/pg_hba.conf) is set
to allow connections from your system.

gmake, gmake test, gmake jtest

You'll have to install postgis-jdbc manually by copying it to your $CLASSPATH:
cd org, su, cp -R postgis /usr/java2/lib/org

-------------
Appendix 1: dmt's configure script (It compiles, ship it):
./configure --with-ssl=/usr/freeware/lib/openssl --enable-thread-safety \
--enable-integer-datetimes --enable-debug --enable-depend --enable-cassert \
--with-tcl --with-perl --with-java \
--with-tclconfig=/usr/freeware/lib --with-tkconfig=/usr/freeware/lib

-------------
Appendix 2: dmt's patches to PostgreSQL 7.4.2

--- a/config/programs.m4      Tue Mar 16 08:04:54 2004
+++ b/config/programs.m4        Thu Mar 11 11:11:02 2004
@@ -87,9 +87,9 @@
     pgac_save_LIBS=$LIBS
     LIBS="${pgac_rllib}${pgac_lib} $LIBS"
     AC_TRY_LINK_FUNC([readline], [[
-      # NetBSD and OpenBSD have a broken linker that does not
+      # Irix, NetBSD, and OpenBSD have a broken linker that does not
       # recognize dependent libraries
-      case $host_os in netbsd* | openbsd* )
+      case $host_os in netbsd* | openbsd* | irix* )
         case $pgac_lib in
           *curses*) ;;
           *) pgac_lib=" -lcurses" ;;
--- a/configure.in      Thu Mar 11 08:42:19 2004
+++ b/configure.in      Thu Mar 18 09:04:46 2004
@@ -651,11 +651,21 @@
 then
        AC_CHECK_LIB(bsd,      main)
 fi
+# Irix has nsl, socket, gen, and sun in its libc, but also
+# keeps separate libs around for backwords compatibility.
+# Using them creates warnings in config.log. This test quiets that.
+# See also: http://freeware.sgi.com/howto.html
+# Also consider changing the portname, since I'm doing this on irix 6.19
+if test "$PORTNAME" != "irix5"
+then
+AC_CHECK_LIB(nsl,      main)
+AC_CHECK_LIB(socket,   main)
+AC_CHECK_LIB(gen,      main)
+fi
+
 AC_CHECK_LIB(util,     setproctitle)
 AC_CHECK_LIB(m,        main)
 AC_CHECK_LIB(dl,       main)
-AC_CHECK_LIB(nsl,      main)
-AC_CHECK_LIB(socket,   main)
 AC_CHECK_LIB(ipc,      main)
 AC_CHECK_LIB(IPC,      main)
 AC_CHECK_LIB(lc,       main)
@@ -663,7 +673,6 @@
 AC_CHECK_LIB(ld,       main)
 AC_CHECK_LIB(compat,   main)
 AC_CHECK_LIB(BSD,      main)
-AC_CHECK_LIB(gen,      main)
 AC_CHECK_LIB(PW,       main)
 AC_CHECK_LIB(resolv,   main)
 AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
--- a/src/template/irix5        Thu Mar 18 09:06:08 2004
+++ b/src/template/irix5        Tue Mar 16 10:49:22 2004
@@ -0,0 +1,3 @@
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
+THREAD_LIBS="-lpthread"
-------------
Appendix 3: dmt's patches to PostGIS 0.8.1
--- a/jdbc/examples/TestServer.java     Fri Apr 19 08:14:17 2002
+++ b/jdbc/examples/TestServer.java     Thu Mar 25 10:55:00 2004
@@ -32,8 +32,8 @@
			String url = "jdbc:postgresql://" + dbhost + ":" + dbport + "/" + dbname;
			conn = DriverManager.getConnection(url, dbuser, dbpass);
			System.out.println("Adding geometric type entries...");
-			((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
-			((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
+			((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
+			((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");
			Statement s = conn.createStatement();
			System.out.println("Creating table with geometric types...");
			//table might not yet exist
#2Bruce Momjian
bruce@momjian.us
In reply to: David Turover (#1)
Re: [PORTS] Building PgSQL 7.4.2 on SGI Irix 6.19

I have made your configure-related changes for Irix, and renamed the
port from irix5 to irix. Patch attached.

For your other comments, would you please send a new version or diff
against FAQ_IRIX. I am unsure how much of the current content to
change.

Thanks.

---------------------------------------------------------------------------

David Turover wrote:

note: gmake check had a few out-of-order errors like this:
*** 1732,1739 ****
| 6 | 6 | six   |
| 7 | 7 | seven |
| 8 | 8 | eight |
-      |   |   | null  |
|   | 0 | zero  |
(13 rows)
--- 1732,1739 ----
| 6 | 6 | six   |
| 7 | 7 | seven |
| 8 | 8 | eight |
|   | 0 | zero  |
+      |   |   | null  |
(13 rows)

I'm not sure how serious a problem this is.
My configure&etc patches are at the end of this message.

----------------

Installing PostGreSQL 7.4.2 on SGI Irix 6.19

Summary:
(install dependencies)
cp *.patch postgresql-7.4.2
cd postgresql-7.4.2
patch -p1 < _pg_config_programs_m4.patch
autoconf
export PATH=/usr/freeware/bin:$PATH
./configure --with-whatever
gmake
gmake check

Patches: Copy the patches you want (READ THE DESCRIPTIONS!)
to the postgres source directory, install them and run autoconf
to generate a new configure script:

patch -p1 < patchname.patch
autoconf

1) The configure.in patch just squelches a bunch of warnings
in the config.log. It's not necessary unless you think
you'll run into errors you'll need to debug.

2) The config/programs.m4 patch adds -lcurses to the command line.
If you don't use it, you'll get undefined symbol errors
trying to compile with readline support.

3) The template/irix5 patch adds the commands to turn on threading.
It is untested! Don't expect your server to work if you use this.

Generic problems: Using zsh 3.0.8, configure will often quit
at a random point in the middle of running, claiming it received
a sigint. This is probably a bug in zsh. Try opening a new shell
and re-running configure from there.

Readline support: SGI Freeware's readline 4.3 package installs
the libraries to the wrong directory. You will need to move
the N32 (mips-3) readline libs from /usr/lib to /usr/lib32
or else the linker won't detect -lreadline. Use the file command
to see what ABI the libraries are using.

You will also need the programs.m4 patch to add -lcurses to the
gcc command line, or else you will get errors like this:
189218:./conftest: rld: Error: unresolvable symbol
in /usr/lib32/libreadline.so.4: tgetent

Java support: You'll need to install Java and ant and ant's dependencies,
which is a difficult and sparsely documented task in itself. SGI has
a java inst package available for download, or you can grab the latest
version from Sun. As for ant's dependencies, I just grabbed everything
on Apache's website since the docs say ant needs just about all of them,
sorted it all into one directory except for a few packages that were
obviously standalone and unnecessary, moved this mess into java2
so I don't have to deal with setting classpath to two dozen different
directories, set all the java PACKAGE_HOME variables to $JAVA_HOME,
and prayed. It survives configure, but is otherwise not tested.

Notes on java support:
1) (important): Make sure that ant.jar is the full one from
the ant package, not a stripped-down version from one of its
dependencies which depends upon ant. You need the real thing,
otherwise you will get java.lang.InstantiationException:
org.apache.tools.ant.Main

2) Ant takes upwards of a minute just to load itself.
As far as I can tell, this is normal behaviour.
configure may /seem/ hung on ant, but just be patient.

Perl support: Irix has two versions of Perl. SGI uses perl 5.0
in the main tree, but the newer 5.6.1 is available from freeware.
Perl 5.0's libs do not define EXTERN_C, causing gmake to break
in src/pl/plperl/plperl.c. 5.6.1 has EXTERN_C defined, but 5.6.1's
Dynaloader.a breaks on "./ldtmpa01Ns3/DynaLoader.a(DynaLoader.o).B":
Error: Invalid format revision (WHIRL::0.31:) for intermediate compiler file

Temporary Solution 1 (using perl 5.0):
1: export CFLAGS="-DEXTERN_C=extern $CFLAGS"

Temporary solution 2 (using perl 5.6.1) (theoretical, haven't tried):
1: Rebuild perl 5.6.1 from source, without -IPA
2: Copy over the Dynaloader.a
3: Put /usr/freeware/bin before /usr/sbin in path
and export it before running configure. Easiest way,
in zsh: export PATH=/usr/freeware/bin:$PATH
4: Add to your configure command:
--with-libraries=/usr/freeware/lib/perl5/5.6.1/irix-n32/CORE/libperl.so
--with-includes=/usr/freeware/lib/perl5/5.6.1/CORE

Python support: As long as the freeware python packages do not install
shared libraries, you cannot get python support without compiling
python yourself. I haven't tried this, so I'm not sure if it will work.

GNU Tar support:

Irix uses an old, b0rked version of tar which breaks on long pathnames.
If you have GNU Tar installed, you need to put /usr/freeware/bin
at the front of your path before running configure. I don't know
when or where Postgres uses tar, but it's in the Makefile.global file,
so it's worth mentioning.

XML Support:

First, install libxml2 from freeware. Then in contrib/xml/Makefile:
CFLAGS := -I/usr/freeware/include/libxml2 -L/usr/freeware/lib32
gmake, su, gmake install.

where "test" is the name of your database:
psql -f ~pgsql/share/contrib/pgxml_dom.sql test

PostGIS Support (as of .8.1):

Find and install Geos and Proj from source. Find and untar PostGIS source
in contrib. In Makefile, set USE_PROJ=1 and USE_GEOS=1 if they aren't already.

*important!* manually run, since the makefile doesn't catch this:
gcc -c postgis_geos_wrapper.cpp -I/usr/local/include/geos

gmake, su, gmake install.

where "test" is the name of your database:
~pgsql/bin/createlang plpgsql test
psql -f ~pgsql/share/contrib/postgis.sql -d test
psql -f ~pgsql/share/contrib/spatial_ref_sys.sql -d test

PostGIS JDBC:

Add your postgres installation's share/java directory to $CLASSPATH,
or add the files therein to an existing $CLASSPATH directory.
Find your postgres's share/java/postgis.jar file and unzip it.
cd contrib/postgis/jdbc. Edit Makefile, change $CLASSPATH
to the location of the unzipped jar file plus the current directory:
On my system, this is: CLASSPATH = /usr/java2/lib:.

in jdbc/examples/TestServer.java, find these lines:
((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
and replace them with:
((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");

then find these lines:
String dbname = "tb";
String dbuser = "dblasby";
String dbpass = "";
String dbhost = "ox";
String dbport = "5555";
And replace this with the correct information to your server.
Make sure that you have created a test database and a user for this,
that you are using the correct port (usually 5432, not 5555),
that postmaster is running with -i to allow TCP connections,
and that your host-based authentication (data/pg_hba.conf) is set
to allow connections from your system.

gmake, gmake test, gmake jtest

You'll have to install postgis-jdbc manually by copying it to your $CLASSPATH:
cd org, su, cp -R postgis /usr/java2/lib/org

-------------
Appendix 1: dmt's configure script (It compiles, ship it):
./configure --with-ssl=/usr/freeware/lib/openssl --enable-thread-safety \
--enable-integer-datetimes --enable-debug --enable-depend --enable-cassert \
--with-tcl --with-perl --with-java \
--with-tclconfig=/usr/freeware/lib --with-tkconfig=/usr/freeware/lib

-------------
Appendix 2: dmt's patches to PostgreSQL 7.4.2

--- a/config/programs.m4      Tue Mar 16 08:04:54 2004
+++ b/config/programs.m4        Thu Mar 11 11:11:02 2004
@@ -87,9 +87,9 @@
pgac_save_LIBS=$LIBS
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
AC_TRY_LINK_FUNC([readline], [[
-      # NetBSD and OpenBSD have a broken linker that does not
+      # Irix, NetBSD, and OpenBSD have a broken linker that does not
# recognize dependent libraries
-      case $host_os in netbsd* | openbsd* )
+      case $host_os in netbsd* | openbsd* | irix* )
case $pgac_lib in
*curses*) ;;
*) pgac_lib=" -lcurses" ;;
--- a/configure.in      Thu Mar 11 08:42:19 2004
+++ b/configure.in      Thu Mar 18 09:04:46 2004
@@ -651,11 +651,21 @@
then
AC_CHECK_LIB(bsd,      main)
fi
+# Irix has nsl, socket, gen, and sun in its libc, but also
+# keeps separate libs around for backwords compatibility.
+# Using them creates warnings in config.log. This test quiets that.
+# See also: http://freeware.sgi.com/howto.html
+# Also consider changing the portname, since I'm doing this on irix 6.19
+if test "$PORTNAME" != "irix5"
+then
+AC_CHECK_LIB(nsl,      main)
+AC_CHECK_LIB(socket,   main)
+AC_CHECK_LIB(gen,      main)
+fi
+
AC_CHECK_LIB(util,     setproctitle)
AC_CHECK_LIB(m,        main)
AC_CHECK_LIB(dl,       main)
-AC_CHECK_LIB(nsl,      main)
-AC_CHECK_LIB(socket,   main)
AC_CHECK_LIB(ipc,      main)
AC_CHECK_LIB(IPC,      main)
AC_CHECK_LIB(lc,       main)
@@ -663,7 +673,6 @@
AC_CHECK_LIB(ld,       main)
AC_CHECK_LIB(compat,   main)
AC_CHECK_LIB(BSD,      main)
-AC_CHECK_LIB(gen,      main)
AC_CHECK_LIB(PW,       main)
AC_CHECK_LIB(resolv,   main)
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
--- a/src/template/irix5        Thu Mar 18 09:06:08 2004
+++ b/src/template/irix5        Tue Mar 16 10:49:22 2004
@@ -0,0 +1,3 @@
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
+THREAD_LIBS="-lpthread"
-------------
Appendix 3: dmt's patches to PostGIS 0.8.1
--- a/jdbc/examples/TestServer.java     Fri Apr 19 08:14:17 2002
+++ b/jdbc/examples/TestServer.java     Thu Mar 25 10:55:00 2004
@@ -32,8 +32,8 @@
String url = "jdbc:postgresql://" + dbhost + ":" + dbport + "/" + dbname;
conn = DriverManager.getConnection(url, dbuser, dbpass);
System.out.println("Adding geometric type entries...");
-			((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
-			((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
+			((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
+			((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");
Statement s = conn.createStatement();
System.out.println("Creating table with geometric types...");
//table might not yet exist

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+208-252
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: [PORTS] Building PgSQL 7.4.2 on SGI Irix 6.19

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I have made your configure-related changes for Irix,

Please revert the configure.in changes (the programs.m4 one may be ok).
Adding port-specific code to configure.in in order to suppress warnings
in config.log is the mark of someone who hasn't a clue what autoconf is
used for. I also wonder whether the arbitrary reordering of the library
probes won't break some other platforms where those libraries depend on
others.

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: [PORTS] Building PgSQL 7.4.2 on SGI Irix 6.19

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I have made your configure-related changes for Irix,

Please revert the configure.in changes (the programs.m4 one may be ok).
Adding port-specific code to configure.in in order to suppress warnings
in config.log is the mark of someone who hasn't a clue what autoconf is
used for. I also wonder whether the arbitrary reordering of the library
probes won't break some other platforms where those libraries depend on
others.

Really? Just remove it. I could add it for each library line and keep
the ordering. Is a configure warning harmless? I have never seen them.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#4)
Re: [PORTS] Building PgSQL 7.4.2 on SGI Irix 6.19

David, let me also mention that your thread changes will not be needed
for 7.5. That is all auto-detected in 7.5.

---------------------------------------------------------------------------

pgman wrote:

I have made your configure-related changes for Irix, and renamed the
port from irix5 to irix. Patch attached.

For your other comments, would you please send a new version or diff
against FAQ_IRIX. I am unsure how much of the current content to
change.

Thanks.

---------------------------------------------------------------------------

David Turover wrote:

note: gmake check had a few out-of-order errors like this:
*** 1732,1739 ****
| 6 | 6 | six   |
| 7 | 7 | seven |
| 8 | 8 | eight |
-      |   |   | null  |
|   | 0 | zero  |
(13 rows)
--- 1732,1739 ----
| 6 | 6 | six   |
| 7 | 7 | seven |
| 8 | 8 | eight |
|   | 0 | zero  |
+      |   |   | null  |
(13 rows)

I'm not sure how serious a problem this is.
My configure&etc patches are at the end of this message.

----------------

Installing PostGreSQL 7.4.2 on SGI Irix 6.19

Summary:
(install dependencies)
cp *.patch postgresql-7.4.2
cd postgresql-7.4.2
patch -p1 < _pg_config_programs_m4.patch
autoconf
export PATH=/usr/freeware/bin:$PATH
./configure --with-whatever
gmake
gmake check

Patches: Copy the patches you want (READ THE DESCRIPTIONS!)
to the postgres source directory, install them and run autoconf
to generate a new configure script:

patch -p1 < patchname.patch
autoconf

1) The configure.in patch just squelches a bunch of warnings
in the config.log. It's not necessary unless you think
you'll run into errors you'll need to debug.

2) The config/programs.m4 patch adds -lcurses to the command line.
If you don't use it, you'll get undefined symbol errors
trying to compile with readline support.

3) The template/irix5 patch adds the commands to turn on threading.
It is untested! Don't expect your server to work if you use this.

Generic problems: Using zsh 3.0.8, configure will often quit
at a random point in the middle of running, claiming it received
a sigint. This is probably a bug in zsh. Try opening a new shell
and re-running configure from there.

Readline support: SGI Freeware's readline 4.3 package installs
the libraries to the wrong directory. You will need to move
the N32 (mips-3) readline libs from /usr/lib to /usr/lib32
or else the linker won't detect -lreadline. Use the file command
to see what ABI the libraries are using.

You will also need the programs.m4 patch to add -lcurses to the
gcc command line, or else you will get errors like this:
189218:./conftest: rld: Error: unresolvable symbol
in /usr/lib32/libreadline.so.4: tgetent

Java support: You'll need to install Java and ant and ant's dependencies,
which is a difficult and sparsely documented task in itself. SGI has
a java inst package available for download, or you can grab the latest
version from Sun. As for ant's dependencies, I just grabbed everything
on Apache's website since the docs say ant needs just about all of them,
sorted it all into one directory except for a few packages that were
obviously standalone and unnecessary, moved this mess into java2
so I don't have to deal with setting classpath to two dozen different
directories, set all the java PACKAGE_HOME variables to $JAVA_HOME,
and prayed. It survives configure, but is otherwise not tested.

Notes on java support:
1) (important): Make sure that ant.jar is the full one from
the ant package, not a stripped-down version from one of its
dependencies which depends upon ant. You need the real thing,
otherwise you will get java.lang.InstantiationException:
org.apache.tools.ant.Main

2) Ant takes upwards of a minute just to load itself.
As far as I can tell, this is normal behaviour.
configure may /seem/ hung on ant, but just be patient.

Perl support: Irix has two versions of Perl. SGI uses perl 5.0
in the main tree, but the newer 5.6.1 is available from freeware.
Perl 5.0's libs do not define EXTERN_C, causing gmake to break
in src/pl/plperl/plperl.c. 5.6.1 has EXTERN_C defined, but 5.6.1's
Dynaloader.a breaks on "./ldtmpa01Ns3/DynaLoader.a(DynaLoader.o).B":
Error: Invalid format revision (WHIRL::0.31:) for intermediate compiler file

Temporary Solution 1 (using perl 5.0):
1: export CFLAGS="-DEXTERN_C=extern $CFLAGS"

Temporary solution 2 (using perl 5.6.1) (theoretical, haven't tried):
1: Rebuild perl 5.6.1 from source, without -IPA
2: Copy over the Dynaloader.a
3: Put /usr/freeware/bin before /usr/sbin in path
and export it before running configure. Easiest way,
in zsh: export PATH=/usr/freeware/bin:$PATH
4: Add to your configure command:
--with-libraries=/usr/freeware/lib/perl5/5.6.1/irix-n32/CORE/libperl.so
--with-includes=/usr/freeware/lib/perl5/5.6.1/CORE

Python support: As long as the freeware python packages do not install
shared libraries, you cannot get python support without compiling
python yourself. I haven't tried this, so I'm not sure if it will work.

GNU Tar support:

Irix uses an old, b0rked version of tar which breaks on long pathnames.
If you have GNU Tar installed, you need to put /usr/freeware/bin
at the front of your path before running configure. I don't know
when or where Postgres uses tar, but it's in the Makefile.global file,
so it's worth mentioning.

XML Support:

First, install libxml2 from freeware. Then in contrib/xml/Makefile:
CFLAGS := -I/usr/freeware/include/libxml2 -L/usr/freeware/lib32
gmake, su, gmake install.

where "test" is the name of your database:
psql -f ~pgsql/share/contrib/pgxml_dom.sql test

PostGIS Support (as of .8.1):

Find and install Geos and Proj from source. Find and untar PostGIS source
in contrib. In Makefile, set USE_PROJ=1 and USE_GEOS=1 if they aren't already.

*important!* manually run, since the makefile doesn't catch this:
gcc -c postgis_geos_wrapper.cpp -I/usr/local/include/geos

gmake, su, gmake install.

where "test" is the name of your database:
~pgsql/bin/createlang plpgsql test
psql -f ~pgsql/share/contrib/postgis.sql -d test
psql -f ~pgsql/share/contrib/spatial_ref_sys.sql -d test

PostGIS JDBC:

Add your postgres installation's share/java directory to $CLASSPATH,
or add the files therein to an existing $CLASSPATH directory.
Find your postgres's share/java/postgis.jar file and unzip it.
cd contrib/postgis/jdbc. Edit Makefile, change $CLASSPATH
to the location of the unzipped jar file plus the current directory:
On my system, this is: CLASSPATH = /usr/java2/lib:.

in jdbc/examples/TestServer.java, find these lines:
((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
and replace them with:
((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");

then find these lines:
String dbname = "tb";
String dbuser = "dblasby";
String dbpass = "";
String dbhost = "ox";
String dbport = "5555";
And replace this with the correct information to your server.
Make sure that you have created a test database and a user for this,
that you are using the correct port (usually 5432, not 5555),
that postmaster is running with -i to allow TCP connections,
and that your host-based authentication (data/pg_hba.conf) is set
to allow connections from your system.

gmake, gmake test, gmake jtest

You'll have to install postgis-jdbc manually by copying it to your $CLASSPATH:
cd org, su, cp -R postgis /usr/java2/lib/org

-------------
Appendix 1: dmt's configure script (It compiles, ship it):
./configure --with-ssl=/usr/freeware/lib/openssl --enable-thread-safety \
--enable-integer-datetimes --enable-debug --enable-depend --enable-cassert \
--with-tcl --with-perl --with-java \
--with-tclconfig=/usr/freeware/lib --with-tkconfig=/usr/freeware/lib

-------------
Appendix 2: dmt's patches to PostgreSQL 7.4.2

--- a/config/programs.m4      Tue Mar 16 08:04:54 2004
+++ b/config/programs.m4        Thu Mar 11 11:11:02 2004
@@ -87,9 +87,9 @@
pgac_save_LIBS=$LIBS
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
AC_TRY_LINK_FUNC([readline], [[
-      # NetBSD and OpenBSD have a broken linker that does not
+      # Irix, NetBSD, and OpenBSD have a broken linker that does not
# recognize dependent libraries
-      case $host_os in netbsd* | openbsd* )
+      case $host_os in netbsd* | openbsd* | irix* )
case $pgac_lib in
*curses*) ;;
*) pgac_lib=" -lcurses" ;;
--- a/configure.in      Thu Mar 11 08:42:19 2004
+++ b/configure.in      Thu Mar 18 09:04:46 2004
@@ -651,11 +651,21 @@
then
AC_CHECK_LIB(bsd,      main)
fi
+# Irix has nsl, socket, gen, and sun in its libc, but also
+# keeps separate libs around for backwords compatibility.
+# Using them creates warnings in config.log. This test quiets that.
+# See also: http://freeware.sgi.com/howto.html
+# Also consider changing the portname, since I'm doing this on irix 6.19
+if test "$PORTNAME" != "irix5"
+then
+AC_CHECK_LIB(nsl,      main)
+AC_CHECK_LIB(socket,   main)
+AC_CHECK_LIB(gen,      main)
+fi
+
AC_CHECK_LIB(util,     setproctitle)
AC_CHECK_LIB(m,        main)
AC_CHECK_LIB(dl,       main)
-AC_CHECK_LIB(nsl,      main)
-AC_CHECK_LIB(socket,   main)
AC_CHECK_LIB(ipc,      main)
AC_CHECK_LIB(IPC,      main)
AC_CHECK_LIB(lc,       main)
@@ -663,7 +673,6 @@
AC_CHECK_LIB(ld,       main)
AC_CHECK_LIB(compat,   main)
AC_CHECK_LIB(BSD,      main)
-AC_CHECK_LIB(gen,      main)
AC_CHECK_LIB(PW,       main)
AC_CHECK_LIB(resolv,   main)
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
--- a/src/template/irix5        Thu Mar 18 09:06:08 2004
+++ b/src/template/irix5        Tue Mar 16 10:49:22 2004
@@ -0,0 +1,3 @@
+THREAD_SUPPORT=yes
+NEED_REENTRANT_FUNCS=yes
+THREAD_LIBS="-lpthread"
-------------
Appendix 3: dmt's patches to PostGIS 0.8.1
--- a/jdbc/examples/TestServer.java     Fri Apr 19 08:14:17 2002
+++ b/jdbc/examples/TestServer.java     Thu Mar 25 10:55:00 2004
@@ -32,8 +32,8 @@
String url = "jdbc:postgresql://" + dbhost + ":" + dbport + "/" + dbname;
conn = DriverManager.getConnection(url, dbuser, dbpass);
System.out.println("Adding geometric type entries...");
-			((org.postgresql.Connection)conn).addDataType("geometry","org.postgis.PGgeometry");
-			((org.postgresql.Connection)conn).addDataType("box3d","org.postgis.PGbox3d");
+			((org.postgresql.PGConnection)conn).addDataType("geometry","org.postgis.PGgeometry");
+			((org.postgresql.PGConnection)conn).addDataType("box3d","org.postgis.PGbox3d");
Statement s = conn.createStatement();
System.out.println("Creating table with geometric types...");
//table might not yet exist

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
Bruce Momjian                        |  http://candle.pha.pa.us
pgman@candle.pha.pa.us               |  (610) 359-1001
+  If your life is a hard drive,     |  13 Roberts Road
+  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.364
diff -c -c -r1.364 configure
*** configure	19 May 2004 21:37:42 -0000	1.364
--- configure	19 May 2004 22:06:21 -0000
***************
*** 4293,4317 ****
fi

fi

! echo "$as_me:$LINENO: checking for setproctitle in -lutil" >&5
! echo $ECHO_N "checking for setproctitle in -lutil... $ECHO_C" >&6
! if test "${ac_cv_lib_util_setproctitle+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lutil $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"

! /* Override any gcc2 internal prototype to avoid an error.  */
! #ifdef __cplusplus
! extern "C"
! #endif
! /* We use char because int might match the return type of a gcc2
!    builtin and then its argument prototype would still apply.  */
! char setproctitle ();
#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
extern "C"
--- 4293,4317 ----
fi
fi
+ # Irix has nsl, socket, gen, and sun in its libc, but also
+ # keeps separate libs around for backwords compatibility.
+ # Using them creates warnings in config.log. This test quiets that.
+ # See also: http://freeware.sgi.com/howto.html
+ if test "$PORTNAME" != "irix"
+ then

! echo "$as_me:$LINENO: checking for main in -lnsl" >&5
! echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6
! if test "${ac_cv_lib_nsl_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lnsl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"

! 
#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
extern "C"
***************
*** 4321,4327 ****
int
main ()
{
! setproctitle ();
;
return 0;
}
--- 4321,4327 ----
int
main ()
{
! main ();
;
return 0;
}
***************
*** 4338,4371 ****
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_util_setproctitle=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_util_setproctitle=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_util_setproctitle" >&5
! echo "${ECHO_T}$ac_cv_lib_util_setproctitle" >&6
! if test $ac_cv_lib_util_setproctitle = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBUTIL 1
_ACEOF

! LIBS="-lutil $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -lm" >&5
! echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
! if test "${ac_cv_lib_m_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lm  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
--- 4338,4371 ----
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_nsl_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_nsl_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5
! echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6
! if test $ac_cv_lib_nsl_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBNSL 1
_ACEOF

! LIBS="-lnsl $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -lsocket" >&5
! echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6
! if test "${ac_cv_lib_socket_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lsocket $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
***************
*** 4397,4430 ****
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
! ac_cv_lib_m_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_m_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
! echo "${ECHO_T}$ac_cv_lib_m_main" >&6
! if test $ac_cv_lib_m_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBM 1
_ACEOF

! LIBS="-lm $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -ldl" >&5
! echo $ECHO_N "checking for main in -ldl... $ECHO_C" >&6
! if test "${ac_cv_lib_dl_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-ldl  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
--- 4397,4430 ----
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_socket_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_socket_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
! echo "${ECHO_T}$ac_cv_lib_socket_main" >&6
! if test $ac_cv_lib_socket_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBSOCKET 1
_ACEOF

! LIBS="-lsocket $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -lgen" >&5
! echo $ECHO_N "checking for main in -lgen... $ECHO_C" >&6
! if test "${ac_cv_lib_gen_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lgen $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
***************
*** 4456,4489 ****
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
! ac_cv_lib_dl_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_dl_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_dl_main" >&5
! echo "${ECHO_T}$ac_cv_lib_dl_main" >&6
! if test $ac_cv_lib_dl_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBDL 1
_ACEOF

! LIBS="-ldl $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -lnsl" >&5
! echo $ECHO_N "checking for main in -lnsl... $ECHO_C" >&6
! if test "${ac_cv_lib_nsl_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lnsl  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
--- 4456,4556 ----
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_gen_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_gen_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_gen_main" >&5
! echo "${ECHO_T}$ac_cv_lib_gen_main" >&6
! if test $ac_cv_lib_gen_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBGEN 1
_ACEOF

! LIBS="-lgen $LIBS"

fi

+ fi

!
! echo "$as_me:$LINENO: checking for setproctitle in -lutil" >&5
! echo $ECHO_N "checking for setproctitle in -lutil... $ECHO_C" >&6
! if test "${ac_cv_lib_util_setproctitle+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lutil $LIBS"
! cat >conftest.$ac_ext <<_ACEOF
! #line $LINENO "configure"
! #include "confdefs.h"
!
! /* Override any gcc2 internal prototype to avoid an error. */
! #ifdef __cplusplus
! extern "C"
! #endif
! /* We use char because int might match the return type of a gcc2
! builtin and then its argument prototype would still apply. */
! char setproctitle ();
! #ifdef F77_DUMMY_MAIN
! # ifdef __cplusplus
! extern "C"
! # endif
! int F77_DUMMY_MAIN() { return 1; }
! #endif
! int
! main ()
! {
! setproctitle ();
! ;
! return 0;
! }
! _ACEOF
! rm -f conftest.$ac_objext conftest$ac_exeext
! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
! (eval $ac_link) 2>&5
! ac_status=$?
! echo "$as_me:$LINENO: \$? = $ac_status" >&5
! (exit $ac_status); } &&
! { ac_try='test -s conftest$ac_exeext'
! { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
! (eval $ac_try) 2>&5
! ac_status=$?
! echo "$as_me:$LINENO: \$? = $ac_status" >&5
! (exit $ac_status); }; }; then
! ac_cv_lib_util_setproctitle=yes
! else
! echo "$as_me: failed program was:" >&5
! cat conftest.$ac_ext >&5
! ac_cv_lib_util_setproctitle=no
! fi
! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
! LIBS=$ac_check_lib_save_LIBS
! fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_util_setproctitle" >&5
! echo "${ECHO_T}$ac_cv_lib_util_setproctitle" >&6
! if test $ac_cv_lib_util_setproctitle = yes; then
! cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBUTIL 1
! _ACEOF
!
! LIBS="-lutil $LIBS"
!
! fi
!
!
! echo "$as_me:$LINENO: checking for main in -lm" >&5
! echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
! if test "${ac_cv_lib_m_main+set}" = set; then
! echo $ECHO_N "(cached) $ECHO_C" >&6
! else
! ac_check_lib_save_LIBS=$LIBS
! LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
***************
*** 4515,4548 ****
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
! ac_cv_lib_nsl_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_nsl_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_main" >&5
! echo "${ECHO_T}$ac_cv_lib_nsl_main" >&6
! if test $ac_cv_lib_nsl_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBNSL 1
_ACEOF

! LIBS="-lnsl $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -lsocket" >&5
! echo $ECHO_N "checking for main in -lsocket... $ECHO_C" >&6
! if test "${ac_cv_lib_socket_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-lsocket  $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
--- 4582,4615 ----
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_m_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_m_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
! echo "${ECHO_T}$ac_cv_lib_m_main" >&6
! if test $ac_cv_lib_m_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBM 1
_ACEOF

! LIBS="-lm $LIBS"

fi

! echo "$as_me:$LINENO: checking for main in -ldl" >&5
! echo $ECHO_N "checking for main in -ldl... $ECHO_C" >&6
! if test "${ac_cv_lib_dl_main+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
! LIBS="-ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
***************
*** 4574,4596 ****
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
! ac_cv_lib_socket_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_socket_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_socket_main" >&5
! echo "${ECHO_T}$ac_cv_lib_socket_main" >&6
! if test $ac_cv_lib_socket_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBSOCKET 1
_ACEOF

! LIBS="-lsocket $LIBS"

fi

--- 4641,4663 ----
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
!   ac_cv_lib_dl_main=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
! ac_cv_lib_dl_main=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
! echo "$as_me:$LINENO: result: $ac_cv_lib_dl_main" >&5
! echo "${ECHO_T}$ac_cv_lib_dl_main" >&6
! if test $ac_cv_lib_dl_main = yes; then
cat >>confdefs.h <<_ACEOF
! #define HAVE_LIBDL 1
_ACEOF

! LIBS="-ldl $LIBS"

fi

***************
*** 5004,5068 ****
_ACEOF

LIBS="-lBSD $LIBS"
-
- fi
-
-
- echo "$as_me:$LINENO: checking for main in -lgen" >&5
- echo $ECHO_N "checking for main in -lgen... $ECHO_C" >&6
- if test "${ac_cv_lib_gen_main+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
- else
- ac_check_lib_save_LIBS=$LIBS
- LIBS="-lgen $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- #line $LINENO "configure"
- #include "confdefs.h"
-
-
- #ifdef F77_DUMMY_MAIN
- # ifdef __cplusplus
- extern "C"
- # endif
- int F77_DUMMY_MAIN() { return 1; }
- #endif
- int
- main ()
- {
- main ();
- ;
- return 0;
- }
- _ACEOF
- rm -f conftest.$ac_objext conftest$ac_exeext
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_lib_gen_main=yes
- else
- echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_lib_gen_main=no
- fi
- rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
- LIBS=$ac_check_lib_save_LIBS
- fi
- echo "$as_me:$LINENO: result: $ac_cv_lib_gen_main" >&5
- echo "${ECHO_T}$ac_cv_lib_gen_main" >&6
- if test $ac_cv_lib_gen_main = yes; then
- cat >>confdefs.h <<_ACEOF
- #define HAVE_LIBGEN 1
- _ACEOF
-
- LIBS="-lgen $LIBS"

fi

--- 5071,5076 ----
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.352
diff -c -c -r1.352 configure.in
*** configure.in	19 May 2004 21:37:42 -0000	1.352
--- configure.in	19 May 2004 22:06:22 -0000
***************
*** 580,590 ****
then
AC_CHECK_LIB(bsd,      main)
fi
AC_CHECK_LIB(util,     setproctitle)
AC_CHECK_LIB(m,        main)
AC_CHECK_LIB(dl,       main)
- AC_CHECK_LIB(nsl,      main)
- AC_CHECK_LIB(socket,   main)
AC_CHECK_LIB(ipc,      main)
AC_CHECK_LIB(IPC,      main)
AC_CHECK_LIB(lc,       main)
--- 580,599 ----
then
AC_CHECK_LIB(bsd,      main)
fi
+ # Irix has nsl, socket, gen, and sun in its libc, but also
+ # keeps separate libs around for backwords compatibility.
+ # Using them creates warnings in config.log. This test quiets that.
+ # See also: http://freeware.sgi.com/howto.html
+ if test "$PORTNAME" != "irix"
+ then
+ AC_CHECK_LIB(nsl,      main)
+ AC_CHECK_LIB(socket,   main)
+ AC_CHECK_LIB(gen,      main)
+ fi
+ 
AC_CHECK_LIB(util,     setproctitle)
AC_CHECK_LIB(m,        main)
AC_CHECK_LIB(dl,       main)
AC_CHECK_LIB(ipc,      main)
AC_CHECK_LIB(IPC,      main)
AC_CHECK_LIB(lc,       main)
***************
*** 592,598 ****
AC_CHECK_LIB(ld,       main)
AC_CHECK_LIB(compat,   main)
AC_CHECK_LIB(BSD,      main)
- AC_CHECK_LIB(gen,      main)
AC_CHECK_LIB(PW,       main)
AC_CHECK_LIB(resolv,   main)
AC_SEARCH_LIBS(getopt_long, [getopt gnugetopt])
--- 601,606 ----
Index: config/programs.m4
===================================================================
RCS file: /cvsroot/pgsql-server/config/programs.m4,v
retrieving revision 1.13
diff -c -c -r1.13 programs.m4
*** config/programs.m4	29 Nov 2003 19:51:17 -0000	1.13
--- config/programs.m4	19 May 2004 22:06:22 -0000
***************
*** 87,95 ****
pgac_save_LIBS=$LIBS
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
AC_TRY_LINK_FUNC([readline], [[
!       # NetBSD and OpenBSD have a broken linker that does not
# recognize dependent libraries
!       case $host_os in netbsd* | openbsd* )
case $pgac_lib in
*curses*) ;;
*) pgac_lib=" -lcurses" ;;
--- 87,95 ----
pgac_save_LIBS=$LIBS
LIBS="${pgac_rllib}${pgac_lib} $LIBS"
AC_TRY_LINK_FUNC([readline], [[
!       # NetBSD, OpenBSD, and Irix have a broken linker that does not
# recognize dependent libraries
!       case $host_os in netbsd* | openbsd* | irix*)
case $pgac_lib in
*curses*) ;;
*) pgac_lib=" -lcurses" ;;
-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073