From 04ca4caa81b02cf10600b1b265b70c54a3aa7ea8 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Wed, 19 Apr 2006 16:32:08 +0000
Subject: [PATCH] Remove use of lorder and tsort while building static
 libraries.  There's no evidence that any currently-supported platform needs
 this, and good reason to think that any platform that did need it couldn't
 use the static libraries anyway --- libpq, at least, has circular references.
  Removing the code shuts up tsort warnings about the circular references on
 some platforms.

---
 configure                      | 43 +---------------------------------
 configure.in                   |  3 +--
 src/Makefile.global.in         |  3 +--
 src/Makefile.shlib             | 10 +-------
 src/makefiles/Makefile.aix     |  1 -
 src/makefiles/Makefile.freebsd |  2 +-
 src/makefiles/Makefile.irix    |  1 -
 src/makefiles/Makefile.netbsd  |  2 +-
 src/makefiles/Makefile.openbsd |  2 +-
 9 files changed, 7 insertions(+), 60 deletions(-)

diff --git a/configure b/configure
index fd23419fe4f..4bfa4167ceb 100755
--- a/configure
+++ b/configure
@@ -314,7 +314,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_ldap with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB LORDER TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS configure_args build build_cpu build_vendor build_os host host_cpu host_vendor host_os PORTNAME docdir enable_nls WANTED_LANGUAGES default_port enable_shared enable_rpath enable_debug CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP GCC TAS autodepend INCLUDES enable_thread_safety with_tcl with_perl with_python with_krb5 krb_srvtab with_pam with_ldap with_bonjour with_openssl with_zlib EGREP ELF_SYS LDFLAGS_SL AWK FLEX FLEXFLAGS LN_S LD with_gnu_ld ld_R_works RANLIB ac_ct_RANLIB TAR STRIP ac_ct_STRIP STRIP_STATIC_LIB STRIP_SHARED_LIB YACC YFLAGS PERL perl_archlibexp perl_privlibexp perl_useshrplib perl_embed_ldflags PYTHON python_version python_configdir python_includespec python_libdir python_libspec python_additional_libs HAVE_IPV6 LIBOBJS acx_pthread_config PTHREAD_CC PTHREAD_LIBS PTHREAD_CFLAGS HAVE_POSIX_SIGNALS MSGFMT MSGMERGE XGETTEXT localedir TCLSH TCL_CONFIG_SH TCL_INCLUDE_SPEC TCL_LIB_FILE TCL_LIBS TCL_LIB_SPEC TCL_SHARED_BUILD TCL_SHLIB_LD_LIBS NSGMLS JADE have_docbook DOCBOOKSTYLE COLLATEINDEX SGMLSPL vpath_build LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -4349,46 +4349,6 @@ else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-for ac_prog in lorder
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_LORDER+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$LORDER"; then
-  ac_cv_prog_LORDER="$LORDER" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_LORDER="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-LORDER=$ac_cv_prog_LORDER
-if test -n "$LORDER"; then
-  echo "$as_me:$LINENO: result: $LORDER" >&5
-echo "${ECHO_T}$LORDER" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$LORDER" && break
-done
-
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
@@ -23314,7 +23274,6 @@ s,@with_gnu_ld@,$with_gnu_ld,;t t
 s,@ld_R_works@,$ld_R_works,;t t
 s,@RANLIB@,$RANLIB,;t t
 s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@LORDER@,$LORDER,;t t
 s,@TAR@,$TAR,;t t
 s,@STRIP@,$STRIP,;t t
 s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
diff --git a/configure.in b/configure.in
index 0b52f67c6be..8e627b9ce54 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.456 2006/04/07 17:50:03 adunstan Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.457 2006/04/19 16:32:08 tgl Exp $
 dnl
 dnl Developers, please strive to achieve this order:
 dnl
@@ -559,7 +559,6 @@ case $host_os in sysv5*)
   AC_SUBST(ld_R_works)
 esac
 AC_PROG_RANLIB
-AC_CHECK_PROGS(LORDER, lorder)
 AC_PATH_PROG(TAR, tar)
 PGAC_CHECK_STRIP
 
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 8a8094f1124..c935c4bf19b 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1,5 +1,5 @@
 # -*-makefile-*-
-# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.221 2006/02/12 07:29:36 momjian Exp $
+# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.222 2006/04/19 16:32:08 tgl Exp $
 
 #------------------------------------------------------------------------------
 # All PostgreSQL makefiles include this file and use the variables it sets,
@@ -222,7 +222,6 @@ LDFLAGS_SL = @LDFLAGS_SL@
 LDREL = -r
 LDOUT = -o
 RANLIB = @RANLIB@
-LORDER = @LORDER@
 X = @EXEEXT@
 
 # Perl 
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 6db29541975..732338caa43 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -6,7 +6,7 @@
 # Copyright (c) 1998, Regents of the University of California
 #
 # IDENTIFICATION
-#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.102 2006/01/05 03:01:34 momjian Exp $
+#    $PostgreSQL: pgsql/src/Makefile.shlib,v 1.103 2006/04/19 16:32:08 tgl Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -266,17 +266,9 @@ all-static-lib: lib$(NAME).a
 
 all-shared-lib: $(shlib)
 
-ifndef LORDER
-MK_NO_LORDER := true
-endif
-
 ifndef haslibarule
 lib$(NAME).a: $(OBJS)
-ifdef MK_NO_LORDER
 	$(LINK.static) $@ $^
-else
-	$(LINK.static) $@ `$(LORDER) $^ | tsort`
-endif
 	$(RANLIB) $@
 endif #haslibarule
 
diff --git a/src/makefiles/Makefile.aix b/src/makefiles/Makefile.aix
index a9c64d71c54..2a75a24aeac 100644
--- a/src/makefiles/Makefile.aix
+++ b/src/makefiles/Makefile.aix
@@ -3,7 +3,6 @@
 MAKE_EXPORTS= true
 
 RANLIB= touch
-MK_NO_LORDER= true
 AROPT = crs
 
 DLSUFFIX = .so
diff --git a/src/makefiles/Makefile.freebsd b/src/makefiles/Makefile.freebsd
index 131c8716d45..f6e57608064 100644
--- a/src/makefiles/Makefile.freebsd
+++ b/src/makefiles/Makefile.freebsd
@@ -21,7 +21,7 @@ else
 	$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
 	@echo building shared object $@
 	@rm -f $@.pic
-	@${AR} cq $@.pic `lorder $<.obj | tsort`
+	@${AR} cq $@.pic $<.obj
 	${RANLIB} $@.pic
 	@rm -f $@
 	$(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
diff --git a/src/makefiles/Makefile.irix b/src/makefiles/Makefile.irix
index 9a219aee5cc..2a23c5a8fd4 100644
--- a/src/makefiles/Makefile.irix
+++ b/src/makefiles/Makefile.irix
@@ -1,4 +1,3 @@
-MK_NO_LORDER= true
 AROPT = crs
 rpath = -Wl,-rpath,'$(rpathdir)'
 
diff --git a/src/makefiles/Makefile.netbsd b/src/makefiles/Makefile.netbsd
index 393511c48f3..db33ebff78e 100644
--- a/src/makefiles/Makefile.netbsd
+++ b/src/makefiles/Makefile.netbsd
@@ -23,7 +23,7 @@ else
 	$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
 	@echo building shared object $@
 	@rm -f $@.pic
-	@${AR} cq $@.pic `lorder $<.obj | tsort`
+	@${AR} cq $@.pic $<.obj
 	${RANLIB} $@.pic
 	@rm -f $@
 	$(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
diff --git a/src/makefiles/Makefile.openbsd b/src/makefiles/Makefile.openbsd
index a86c6e1619e..24e201836e9 100644
--- a/src/makefiles/Makefile.openbsd
+++ b/src/makefiles/Makefile.openbsd
@@ -21,7 +21,7 @@ else
 	$(LD) $(LDREL) $(LDOUT) $<.obj -x $<
 	@echo building shared object $@
 	@rm -f $@.pic
-	@${AR} cq $@.pic `lorder $<.obj | tsort`
+	@${AR} cq $@.pic $<.obj
 	${RANLIB} $@.pic
 	@rm -f $@
 	$(LD) -x -Bshareable -Bforcearchive -o $@ $@.pic
-- 
GitLab