PostgreSQL 6.4 patches - portability related.

Started by Billy G. Allieover 27 years ago2 messages
#1Billy G. Allie
Bill.Allie@mug.org
1 attachment(s)

The attached patches affect the following areas:

1. The make file for 'bin/pgtclsh' was failing on my system because the tcl/tk
libraries could not be found. I have changed the make file so that it uses
the contents of tclConfig.sh and tkConfig.sh to obtain the information it
needs to link the programs.

Affected files (relative to the PGSQL source directory):

src/configure, src/configure.in, src/bin/pgtclsh/Makefile

New files (relative to the PGSQL source directory):

src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in

2. On my system, '/usr/lib' contains the information for tcl7.6 and tk4.2,
which is used for the SCO System Administration tool. '/opt/lib' contains
the information tcl8.0 and tk8.0, which I used for my development purposes.
Configure was finding the wrong one even if I used '--with-libs=/opt/lib'
to specifiy the directory to use. This patch corrects this by changing the
order in which directories are searched for the [tcl|tk]Config.sh files so
that '/usr/lib' is searched last. This change is in keeping with the help
message that states that '--with-libs' is used to specify the site library
directories for TCL/TK, etc.

Affected files (relative to the PGSQL source directory):

src/configure, src/configure.in

3. The file that creates the 'Makefile.tcldefs' file in 'pl/tcl' left unex-
panded variable references the created file. For example:

TCL_LIB_FILE = libtcl8.0${TCL_DBGX}.so

This patch corrects the problem.

4. The installation of 'libpgtcl.so' was failing because 'libpgtcl.so' already
existed as a symbolic link to a file. This patch corrects the problem by
explicitly removing libpgtcl.so from the destination directory.

Affected files (relative to the PGSQL source directory):

src/interfaces/libpgtcl/Makefile.in

With these changes, the only manual changes I make after running configure is
to add '-o' and '-g' options to the INST_EXE_OPTS, INSTL_LIB_OPTS, and
INSTL_SHLIB_OPTS variables in 'Makefile.global'. I do this so that the correct
owner and group are assigned when I install postgreSQL (as root).

Attachments:

uw7-1.patchapplication/x-patch; name=uw7-1.patchDownload
*** src/bin/pgtclsh/Makefile.orig	Sat Oct 10 13:09:56 1998
--- src/bin/pgtclsh/Makefile	Sat Oct 10 19:47:25 1998
***************
*** 14,21 ****
  SRCDIR= ../..
  include ../../Makefile.global
  
! CFLAGS+=  $(X_CFLAGS) -I$(SRCDIR)/interfaces/libpgtcl
  
  ifdef KRBVERS
  LDFLAGS+= $(KRBLIBS)
  CFLAGS+= $(KRBFLAGS)
--- 14,26 ----
  SRCDIR= ../..
  include ../../Makefile.global
  
! #
! # Include definitions from the tclConfig.sh file
! #
! include Makefile.tcltkdefs
  
+ CFLAGS+=  -I$(SRCDIR)/interfaces/libpgtcl 
+ 
  ifdef KRBVERS
  LDFLAGS+= $(KRBLIBS)
  CFLAGS+= $(KRBFLAGS)
***************
*** 27,40 ****
  
  all: pgtclsh pgtksh
  
  pgtclsh: pgtclAppInit.o
! 	$(CC) $(CFLAGS) -o $@ pgtclAppInit.o \
! 	  $(LIBPGTCL) $(LIBPQ) $(TCL_LIB) -lm $(LDFLAGS)
  
  pgtksh: pgtkAppInit.o
! 	$(CC) $(CFLAGS) -o $@ pgtkAppInit.o \
! 	  $(LIBPGTCL) $(LIBPQ) $(X_LIBS) $(TK_LIB) $(TCL_LIB) \
! 	  $(X11_LIBS) -lm $(LDFLAGS)
  
  install: pgtclsh pgtksh
  	$(INSTALL) $(INSTL_EXE_OPTS) pgtclsh $(BINDIR)/pgtclsh
--- 32,48 ----
  
  all: pgtclsh pgtksh
  
+ Makefile.tcltkdefs:
+ 	/bin/sh mkMakefile.tcltkdefs.sh
+ 
  pgtclsh: pgtclAppInit.o
! 	$(CC) $(CFLAGS) $(TCL_DEFS) -o $@ pgtclAppInit.o \
! 	  $(LIBPGTCL) $(LIBPQ) $(TCL_LIB_SPEC) $(TCL_LIBS) $(LDFLAGS)
  
  pgtksh: pgtkAppInit.o
! 	$(CC) $(CFLAGS) $(TK_DEFS) -o $@ pgtkAppInit.o \
! 	  $(LIBPGTCL) $(LIBPQ) $(TK_LIB_SPEC) $(TK_LIBS) \
! 	  $(TCL_LIB_SPEC) $(TCL_LIB) $(LDFLAGS)
  
  install: pgtclsh pgtksh
  	$(INSTALL) $(INSTL_EXE_OPTS) pgtclsh $(BINDIR)/pgtclsh
*** src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in.orig	Sat Oct 10 01:17:02 1998
--- src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in	Sat Oct 10 19:23:21 1998
***************
*** 0 ****
--- 1,29 ----
+ 
+ if [ ! -f @TCL_CONFIG_SH@ ]; then
+     echo "@TCL_CONFIG_SH@ not found"
+     echo "I need this file! Please make a symbolic link to this file"
+     echo "and start make again."
+     exit 1
+ fi
+ 
+ if [ ! -f @TK_CONFIG_SH@ ]; then
+     echo "@TK_CONFIG_SH@ not found"
+     echo "I need this file! Please make a symbolic link to this file"
+     echo "and start make again."
+     exit 1
+ fi
+ 
+ . @TCL_CONFIG_SH@
+ . @TK_CONFIG_SH@
+ 
+ set									| 
+     egrep '^TCL_|^TK_'				|
+     sed -e 's/=/="/' -e 's/$/"/'	|
+     while read v
+     do
+ 		eval "$v"
+ 		v1=`echo $v | sed -e 's/=.*//'`
+ 		eval "echo $v1 = \"\$$v1\""
+     done >Makefile.tcltkdefs
+ 
+ exit 0
*** src/interfaces/libpgtcl/Makefile.orig	Sat Oct 10 19:12:50 1998
--- src/interfaces/libpgtcl/Makefile	Sat Oct 10 19:13:57 1998
***************
*** 133,138 ****
--- 133,139 ----
  install-shlib: $(shlib)
  	$(INSTALL) $(INSTL_SHLIB_OPTS) $(shlib) \
  		$(LIBDIR)/$(shlib)
+ 	rm -f $(LIBDIR)/libpgtcl.so
  	$(LN_S) -f $(shlib) $(LIBDIR)/libpgtcl.so
  
  .PHONY: clean
*** src/interfaces/libpgtcl/Makefile.in.orig	Sat Oct 10 19:14:02 1998
--- src/interfaces/libpgtcl/Makefile.in	Sat Oct 10 19:14:33 1998
***************
*** 132,137 ****
--- 132,138 ----
  install-shlib: $(shlib)
  	$(INSTALL) $(INSTL_SHLIB_OPTS) $(shlib) \
  		$(LIBDIR)/$(shlib)
+ 	rm -f $(LIBDIR)/libpgtcl.so
  	$(LN_S) -f $(shlib) $(LIBDIR)/libpgtcl.so
  
  .PHONY: clean
*** src/pl/tcl/mkMakefile.tcldefs.sh.in.orig	Sat Oct 10 18:32:44 1998
--- src/pl/tcl/mkMakefile.tcldefs.sh.in	Sat Oct 10 19:31:38 1998
***************
*** 1,7 ****
  
! if [ -f @TCL_CONFIG_SH@ ]; then
!     . @TCL_CONFIG_SH@
! else
      echo "@TCL_CONFIG_SH@ not found"
      echo "I need this file! Please make a symbolic link to this file"
      echo "and start make again."
--- 1,5 ----
  
! if [ ! -f @TCL_CONFIG_SH@ ]; then
      echo "@TCL_CONFIG_SH@ not found"
      echo "I need this file! Please make a symbolic link to this file"
      echo "and start make again."
***************
*** 8,15 ****
      exit 1
  fi
  
! for v in `set | grep '^TCL' | sed -e 's/=.*//'` ; do
!     echo $v = `eval "echo \\$$v"`
! done >Makefile.tcldefs
  
  exit 0
--- 6,21 ----
      exit 1
  fi
  
! . @TCL_CONFIG_SH@
! 
! set												| 
!     egrep '^TCL_|^TK_'							|
!     sed -e 's/=[ 	]*/="/' -e 's/[ 	]*$/"/'	|
!     while read v
!     do
! 		eval "$v"
! 		v1=`echo $v | sed -e 's/=.*//'`
! 		eval "echo $v1 = \"\$$v1\""
!     done >Makefile.tcldefs
  
  exit 0
*** src/configure.orig	Sat Oct 10 00:50:53 1998
--- src/configure	Sat Oct 10 19:21:08 1998
***************
*** 6118,6124 ****
  if test "$USE_TCL"; then
  	echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6
  echo "configure:6121: checking for tclConfig.sh" >&5
! 	library_dirs="/usr/lib $LIBRARY_DIRS"
  	TCL_CONFIG_SH=
  	for dir in $library_dirs; do
  		for tcl_dir in $tcl_dirs; do
--- 6118,6124 ----
  if test "$USE_TCL"; then
  	echo $ac_n "checking for tclConfig.sh""... $ac_c" 1>&6
  echo "configure:6121: checking for tclConfig.sh" >&5
! 	library_dirs="$LIBRARY_DIRS /usr/lib"
  	TCL_CONFIG_SH=
  	for dir in $library_dirs; do
  		for tcl_dir in $tcl_dirs; do
***************
*** 6268,6273 ****
--- 6268,6303 ----
  	LDFLAGS="$ice_save_LDFLAGS"
  fi
  
+ if test "$USE_TCL"; then
+ 	echo $ac_n "checking for tkConfig.sh""... $ac_c" 1>&6
+ echo "configure:6121: checking for tkConfig.sh" >&5
+ 	library_dirs="$LIBRARY_DIRS /usr/lib"
+ 	TK_CONFIG_SH=
+ 	for dir in $library_dirs; do
+ 		for tk_dir in $tk_dirs; do
+ 			if test -z "$TK_CONFIG_SH"; then
+ 				if test -d "$dir/$tk_dir" -a -r "$dir/$tk_dir/tkConfig.sh"; then
+ 					TK_CONFIG_SH=$dir/$tk_dir/tkConfig.sh
+ 				fi
+ 			fi
+ 		done
+ 		if test -z "$TK_CONFIG_SH"; then
+ 			if test -d "$dir" -a -r "$dir/tkConfig.sh"; then
+ 				TK_CONFIG_SH=$dir/tkConfig.sh
+ 			fi
+ 		fi
+ 	done
+ 	if test -z "$TK_CONFIG_SH"; then
+ 		echo "$ac_t""no" 1>&6
+ 		echo "configure: warning: tcl support disabled; Tk configuration script missing" 1>&2
+ 		USE_TCL=
+ 	else
+ 		echo "$ac_t""$TK_CONFIG_SH" 1>&6
+ 		
+ 	fi
+ fi
+ 
+ 
  #if test "X$USE_ODBC" = "Xtrue"
  #then
  #	AC_CONFIG_SUBDIRS(interfaces/odbc)
***************
*** 6424,6429 ****
--- 6454,6460 ----
  	bin/pg_dump/Makefile
  	bin/pg_version/Makefile
  	bin/psql/Makefile
+ 	bin/pgtclsh/mkMakefile.tcltkdefs.sh
  	include/version.h
  	interfaces/libpq/Makefile
  	interfaces/ecpg/lib/Makefile
***************
*** 6532,6537 ****
--- 6563,6569 ----
  s%@TCL_LIB@%$TCL_LIB%g
  s%@TCL_CONFIG_SH@%$TCL_CONFIG_SH%g
  s%@TK_LIB@%$TK_LIB%g
+ s%@TK_CONFIG_SH@%$TK_CONFIG_SH%g
  
  CEOF
  EOF
***************
*** 6580,6585 ****
--- 6612,6618 ----
  	bin/pg_dump/Makefile
  	bin/pg_version/Makefile
  	bin/psql/Makefile
+ 	bin/pgtclsh/mkMakefile.tcltkdefs.sh
  	include/version.h
  	interfaces/libpq/Makefile
  	interfaces/ecpg/lib/Makefile
*** src/configure.in.orig	Sat Oct 10 00:51:18 1998
--- src/configure.in	Sat Oct 10 19:20:38 1998
***************
*** 801,813 ****
  	else
  		TCL_LIB=-l$TCL_LIB
  	fi
- 	AC_SUBST(TCL_LIB)
  fi
  
  dnl Check for Tcl configuration script tclConfig.sh
  if test "$USE_TCL"; then
  	AC_MSG_CHECKING(for tclConfig.sh)
! 	library_dirs="/usr/lib $LIBRARY_DIRS"
  	TCL_CONFIG_SH=
  	for dir in $library_dirs; do
  		for tcl_dir in $tcl_dirs; do
--- 801,812 ----
  	else
  		TCL_LIB=-l$TCL_LIB
  	fi
  fi
  
  dnl Check for Tcl configuration script tclConfig.sh
  if test "$USE_TCL"; then
  	AC_MSG_CHECKING(for tclConfig.sh)
! 	library_dirs="$LIBRARY_DIRS /usr/lib"
  	TCL_CONFIG_SH=
  	for dir in $library_dirs; do
  		for tcl_dir in $tcl_dirs; do
***************
*** 886,893 ****
  		TK_LIB=-l$TK_LIB
  	fi
  
- 	AC_SUBST(TK_LIB)
- 
  	LIBS="$ice_save_LIBS"
  	CFLAGS="$ice_save_CFLAGS"
  	CPPFLAGS="$ice_save_CPPFLAGS"
--- 885,890 ----
***************
*** 894,899 ****
--- 891,925 ----
  	LDFLAGS="$ice_save_LDFLAGS"
  fi
  
+ dnl Check for Tk configuration script tkConfig.sh
+ if test "$USE_TCL"; then
+ 	AC_MSG_CHECKING(for tkConfig.sh)
+ 	library_dirs="$LIBRARY_DIRS /usr/lib"
+ 	TK_CONFIG_SH=
+ 	for dir in $library_dirs; do
+ 		for tk_dir in $tk_dirs; do
+ 			if test -z "$TK_CONFIG_SH"; then
+ 				if test -d "$dir/$tk_dir" -a -r "$dir/$tk_dir/tkConfig.sh"; then
+ 					TK_CONFIG_SH=$dir/$tk_dir/tkConfig.sh
+ 				fi
+ 			fi
+ 		done
+ 		if test -z "$TK_CONFIG_SH"; then
+ 			if test -d "$dir" -a -r "$dir/tkConfig.sh"; then
+ 				TK_CONFIG_SH=$dir/tkConfig.sh
+ 			fi
+ 		fi
+ 	done
+ 	if test -z "$TK_CONFIG_SH"; then
+ 		AC_MSG_RESULT(no)
+ 		AC_MSG_WARN(tcl support disabled; Tk configuration script missing)
+ 		USE_TCL=
+ 	else
+ 		AC_MSG_RESULT($TK_CONFIG_SH)
+ 		AC_SUBST(TK_CONFIG_SH)
+ 	fi
+ fi
+ 
  dnl cause configure to recurse into subdirectories with their own configure
  dnl Darn, setting AC_CONFIG_SUBDIRS sets a list $subdirs$ in the configure output
  dnl  file, but then configure doesn't bother using that list. Probably a bug in
***************
*** 925,930 ****
--- 951,957 ----
  	bin/pg_dump/Makefile
  	bin/pg_version/Makefile
  	bin/psql/Makefile
+ 	bin/pgtclsh/mkMakefile.tcltkdefs.sh
  	include/version.h
  	interfaces/libpq/Makefile
  	interfaces/ecpg/lib/Makefile
#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Billy G. Allie (#1)
Re: [PATCHES] PostgreSQL 6.4 patches - portability related.

Applied.

The attached patches affect the following areas:

1. The make file for 'bin/pgtclsh' was failing on my system because the tcl/tk
libraries could not be found. I have changed the make file so that it uses
the contents of tclConfig.sh and tkConfig.sh to obtain the information it
needs to link the programs.

Affected files (relative to the PGSQL source directory):

src/configure, src/configure.in, src/bin/pgtclsh/Makefile

New files (relative to the PGSQL source directory):

src/bin/pgtclsh/mkMakefile.tcltkdefs.sh.in

2. On my system, '/usr/lib' contains the information for tcl7.6 and tk4.2,
which is used for the SCO System Administration tool. '/opt/lib' contains
the information tcl8.0 and tk8.0, which I used for my development purposes.
Configure was finding the wrong one even if I used '--with-libs=/opt/lib'
to specifiy the directory to use. This patch corrects this by changing the
order in which directories are searched for the [tcl|tk]Config.sh files so
that '/usr/lib' is searched last. This change is in keeping with the help
message that states that '--with-libs' is used to specify the site library
directories for TCL/TK, etc.

Affected files (relative to the PGSQL source directory):

src/configure, src/configure.in

3. The file that creates the 'Makefile.tcldefs' file in 'pl/tcl' left unex-
panded variable references the created file. For example:

TCL_LIB_FILE = libtcl8.0${TCL_DBGX}.so

This patch corrects the problem.

4. The installation of 'libpgtcl.so' was failing because 'libpgtcl.so' already
existed as a symbolic link to a file. This patch corrects the problem by
explicitly removing libpgtcl.so from the destination directory.

Affected files (relative to the PGSQL source directory):

src/interfaces/libpgtcl/Makefile.in

With these changes, the only manual changes I make after running configure is
to add '-o' and '-g' options to the INST_EXE_OPTS, INSTL_LIB_OPTS, and
INSTL_SHLIB_OPTS variables in 'Makefile.global'. I do this so that the correct
owner and group are assigned when I install postgreSQL (as root).

Content-Description: uw7-1.patch

[Attachment, skipping...]

____ | 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 |

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026