Re: [HACKERS] Configure problem (and fix).

From: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
To: Bill(dot)Allie(at)mug(dot)org
Cc: pgsql-hackers(at)postgreSQL(dot)org, pgsql-patches(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Configure problem (and fix).
Date: 1998-10-24 18:54:03
Message-ID: 199810241854.MAA10833@trillium.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have come across a problem where the code generated by autoconf does not
subsitute correct values for the following variables:

bindir sbindir libexecdir
datadir sysconfdir sharedstatedir
localstatedir libdir includedir
oldincludedir infodir mandir

The normal usage is fine for things like Makefiles that know about
environment variables and do their own expansion (i.e., the vast
majority of the usage of these variables). In this one instance we
are constructing *.sql files that can't expand environment variables
and hence need to do that in advance during configuration.

It seems much cleaner to do the following:

- keep the unexpanded versions in the Makefiles (since it reduces
cluttered duplication and uses variables as they should be used for
indirect references), and

- introduce a new expanded variable for this purpose

The patches below replace Billie's and accomplish his intent of having
the *.sql files refer to the correct libraries without needlessly
expanding ALL the variables everywhere.

Note that the only difference from his patches for *.sql files is to
use @expanded_libdir@ instead of @libdir(at)(dot) The difference for
configure.in is to create the variable $expanded_libdir without
affecting the rest of the "normal" variables.

Please use this set of patches instead of his.

Cheers,
Brook

===========================================================================
--- configure.in.orig Fri Oct 23 01:00:15 1998
+++ configure.in Sat Oct 24 12:06:13 1998
@@ -905,6 +905,15 @@
AC_SUBST(USE_ODBC)
fi

+dnl expand some variables for use in files (e.g., *.sql)
+dnl without environment variables defined
+
+ice_save_exec_prefix=${exec_prefix}
+test "x$exec_prefix" = xNONE && eval exec_prefix=${prefix}
+eval expanded_libdir=${libdir}
+exec_prefix=${ice_save_exec_prefix}
+AC_SUBST(expanded_libdir)
+
AC_OUTPUT(
GNUmakefile
Makefile.global
===========================================================================
--- pl/plpgsql/src/mklang.sql.in.orig Sun Oct 11 22:55:03 1998
+++ pl/plpgsql/src/mklang.sql.in Sat Oct 24 11:34:16 1998
@@ -5,7 +5,7 @@
--

create function plpgsql_call_handler() returns opaque
- as '@libdir@/plpgsql.so'
+ as '@expanded_libdir@/plpgsql.so'
language 'C';

create trusted procedural language 'plpgsql'
===========================================================================
*** pl/plpgsql/test/mklang.sql.in.orig Fri Oct 23 23:44:39 1998
--- pl/plpgsql/test/mklang.sql.in Fri Oct 23 23:44:00 1998
***************
*** 0 ****
--- 1,14 ----
+ --
+ -- PL/pgSQL language declaration
+ --
+ -- $Header: /usr/local/cvsroot/pgsql/src/pl/plpgsql/src/mklang.sql.in,v 1.1 1998/10/12 04:55:03 momjian Exp $
+ --
+
+ create function plpgsql_call_handler() returns opaque
+ as '@expanded_libdir@/plpgsql.so'
+ language 'C';
+
+ create trusted procedural language 'plpgsql'
+ handler plpgsql_call_handler
+ lancompiler 'PL/pgSQL';
+
*** pl/tcl/test/test_mklang.sql.in.orig Fri Oct 23 23:46:14 1998
--- pl/tcl/test/test_mklang.sql.in Sat Oct 24 00:18:35 1998
***************
*** 0 ****
--- 1,9 ----
+
+ create function pltcl_call_handler() returns opaque
+ as '@expanded_libdir@/pltcl.so'
+ language 'C';
+
+ create trusted procedural language 'pltcl'
+ handler pltcl_call_handler
+ lancompiler 'PL/Tcl';
+
*** pl/tcl/mklang.sql.in.orig Sat Oct 24 00:20:31 1998
--- pl/tcl/mklang.sql.in Sat Oct 24 00:18:23 1998
***************
*** 0 ****
--- 1,14 ----
+ --
+ -- PL/TCL language declaration
+ --
+ -- ## Insert RCS Header Here ##
+ --
+
+ create function pltcl_call_handler() returns opaque
+ as '@expanded_libdir@/pltcl.so'
+ language 'C';
+
+ create trusted procedural language 'pltcl'
+ handler pltcl_call_handler
+ lancompiler 'PL/Tcl';
+
*** configure.in.orig Fri Oct 23 23:42:40 1998
--- configure.in Fri Oct 23 23:56:13 1998
***************
*** 954,958 ****
--- 954,961 ----
interfaces/odbc/Makefile.global
pl/plpgsql/src/Makefile
pl/plpgsql/src/mklang.sql
+ pl/plpgsql/test/mklang.sql
pl/tcl/mkMakefile.tcldefs.sh
+ pl/tcl/mklang.sql
+ pl/tcl/test/test_mklang.sql
)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1998-10-24 20:32:54 pg_upgrade bug report
Previous Message Gavin 1998-10-24 18:40:31 Regression Tests fail