Re: LDFLAGS overriding - Mailing list pgsql-patches

From Reini Urban
Subject Re: LDFLAGS overriding
Date
Msg-id 415E8B2F.7060808@x-ray.at
Whole thread Raw
In response to Re: LDFLAGS overriding  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: LDFLAGS overriding
List pgsql-patches
Peter Eisentraut schrieb:
> Reini Urban wrote:
>>I think that LDFLAGS overriding is in some situations bad for newer
>>libtool, as it is used with some postgresql contrib makefiles and
>>interfaces.
>
> We're not using libtool.

sorry. it conflicts with gnu ld.

>>LIBS are added to LDFLAGS where they really should be added to
>>LIBS, not LDFLAGS.
>>This causes incorrect order in the linker command-line, which fails
>>in building shared libs. A similar problem as with building php.
>
>
> Please point out where that happens so it can be corrected.

Something like this (against an older cvs snap), but I don't believe
that this is the best way to solve it. It just solved building under cygwin.

(sorry for the linewrap's)

--- postgresql-8.0.0cvs/src/Makefile.shlib.orig    2004-07-13
01:06:46.000000000 +0100
+++ postgresql-8.0.0cvs/src/Makefile.shlib    2004-09-03 14:44:14.436032500
+0100
@@ -212,6 +212,7 @@

  ifeq ($(PORTNAME), cygwin)
    shlib            = $(NAME)$(DLSUFFIX)
+  SHLIB_LINK         += $(LDFLAGS)
  endif

  ifeq ($(PORTNAME), win32)
@@ -224,9 +225,13 @@
    SHLIB_LINK        += -ltermcap -lstdc++.r4 -lbind -lsocket
-L/boot/develop/lib/x86
  endif

-SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
+ifeq ($(PORTNAME), cygwin)
+  SHLIB_LINK := $(LDFLAGS) $(LIBS) $(SHLIB_LINK)
+else
+  SHLIB_LINK := $(filter -L%, $(LDFLAGS)) $(SHLIB_LINK)
+endif
  ifeq ($(enable_rpath), yes)
-SHLIB_LINK += $(rpath)
+  SHLIB_LINK += $(rpath)
  endif

  endif # enable_shared
--- postgresql-8.0.0cvs/src/makefiles/pgxs.mk.orig    2004-07-30
13:26:40.000000000 +0100
+++ postgresql-8.0.0cvs/src/makefiles/pgxs.mk    2004-09-03
14:53:00.569922900 +0100
@@ -63,7 +63,11 @@

  ifdef MODULES
  override CFLAGS += $(CFLAGS_SL)
-SHLIB_LINK += $(BE_DLLLIBS)
+ifeq ($(PORTNAME), cygwin)
+  SHLIB_LINK += $(BE_DLLLIBS) $(LDFLAGS) $(LIBS)
+else
+  SHLIB_LINK += $(BE_DLLLIBS)
+endif
  endif

  ifdef PG_CPPFLAGS

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: FAQ in farsi (txt version)
Next
From: Tom Lane
Date:
Subject: Re: error report on slru.c