Configure problem (and fix).

Поиск
Список
Период
Сортировка
Искать

Configure problem (and fix).

От:
"Billy G. Allie" <Bill.Allie@mug.org>
Дата:
Вложения:
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 problem is that they reference the variables, 'prefix' and 'exec_prefix' 
but those variables are not expanded in the subsitutions.  For example, 
referencing 'libdir' in an *.in file will have "${exec_prefix}/lib" placed in 
the resulting output file.  It should be "/usr/local/pgsql/lib" (if the 
default exec_prefix (and prefix) value is used).  The first patch 
(uw7-1.patch) will correct the problem, which causes an incorrect 
src/pl/plpgsql/src/mklang.sql file to be generated.

The second patch:

    1.  Adds a file (mklang.sql) that can be used to add the language
        definitions for PL/TCL to a database.

    2.  Generalizes the mklang.sql in src/pl/plpgsql/test so that it will
        reference the correct location for the plpgsql.so shared library.

    3.  Generalizes the test_mklang.sql file in src/pl/tcl/test so that is will
        reference the correct localtion for the pltcl.so shared library.

IMPORTANT: Do not apply the second patch without applying the first patch!

____       | Billy G. Allie    | Domain....: Bill.Allie@mug.org
|  /|      | 7436 Hartwell     | Compuserve: 76337,2061
|-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com
|/  |LLIE  | (313) 582-1540    | 

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

От:
Brook Milligan <brook@trillium.NMSU.Edu>
Дата:
   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@.  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 )

FAQ