Support LDFLAGS_SL on most ports

Started by Oliver Jowettalmost 22 years ago7 messagespatches
Jump to latest
#1Oliver Jowett
oliver@opencloud.com

This patch includes LDFLAGS_SL in SHLIB_LINK on most ports (previously
it was only used on AIX and BeOS), and adds support for specifying it in
configure.

This lets you do something like:

./configure LDFLAGS=-static-libgcc LDFLAGS_SL=-static-libgcc

to produce binaries that do not depend on libgcc_s.so at all.

I haven't touched the win32/cygwin section of Makefile.shlib as I'm not
sure exactly where it'd be useful to add LDFLAGS_SL.

-O

Attachments:

pgsql-ldflags-sl.txttext/plain; name=pgsql-ldflags-sl.txtDownload+5-2
#2Oliver Jowett
oliver@opencloud.com
In reply to: Oliver Jowett (#1)
Re: Support LDFLAGS_SL on most ports

Oliver Jowett wrote:

This patch includes LDFLAGS_SL in SHLIB_LINK on most ports (previously
it was only used on AIX and BeOS), and adds support for specifying it in
configure.

Any feedback on this patch? Can it get applied for 8.0?

-O

#3Bruce Momjian
bruce@momjian.us
In reply to: Oliver Jowett (#2)
Re: Support LDFLAGS_SL on most ports

I haven't reviewed it yet.

---------------------------------------------------------------------------

Oliver Jowett wrote:

Oliver Jowett wrote:

This patch includes LDFLAGS_SL in SHLIB_LINK on most ports (previously
it was only used on AIX and BeOS), and adds support for specifying it in
configure.

Any feedback on this patch? Can it get applied for 8.0?

-O

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: Support LDFLAGS_SL on most ports

Bruce Momjian <pgman@candle.pha.pa.us> writes:

Oliver Jowett wrote:

Any feedback on this patch? Can it get applied for 8.0?

I haven't reviewed it yet.

It looked alright to me, but probably Peter should have the last word.

regards, tom lane

#5Peter Eisentraut
peter_e@gmx.net
In reply to: Oliver Jowett (#1)
Re: Support LDFLAGS_SL on most ports

Oliver Jowett wrote:

This patch includes LDFLAGS_SL in SHLIB_LINK on most ports
(previously it was only used on AIX and BeOS), and adds support for
specifying it in configure.

This lets you do something like:

./configure LDFLAGS=-static-libgcc LDFLAGS_SL=-static-libgcc

to produce binaries that do not depend on libgcc_s.so at all.

Two comments: First, support for specifying it on configure requires you
to call AC_ARG_VAR ("require" as in it would prevent people from
shooting themselves in the foot). Please read up on it and add the
appropriate call. Second, the AC_MSG_NOTICE calls are there for some
variables because configure may modify them. But LDFLAGS_SL is just
taken as given, so there is no need to print a notice about it.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

#6Oliver Jowett
oliver@opencloud.com
In reply to: Peter Eisentraut (#5)
Re: Support LDFLAGS_SL on most ports

Peter Eisentraut wrote:

Two comments: First, support for specifying it on configure requires you
to call AC_ARG_VAR ("require" as in it would prevent people from
shooting themselves in the foot). Please read up on it and add the
appropriate call.

Ok, so that makes sure that the var is hooked into the
cache/autoreconfig/etc machinery. Fixed.

Second, the AC_MSG_NOTICE calls are there for some
variables because configure may modify them. But LDFLAGS_SL is just
taken as given, so there is no need to print a notice about it.

Personally I find it annoying when configure eats arguments without any
feedback at all -- did it actually use the parameter, or did I make a
typo? I've removed the AC_MSG_NOTICE anyway.

Updated patch attached.

-O

Attachments:

pgsql-ldflags-sl-v2.txttext/plain; name=pgsql-ldflags-sl-v2.txtDownload+4-2
#7Bruce Momjian
bruce@momjian.us
In reply to: Oliver Jowett (#1)
Re: Support LDFLAGS_SL on most ports

I have applied your newest version of this patch, which I have attached.
I also added code for Win32 and Cygwin.

Thanks.

---------------------------------------------------------------------------

Oliver Jowett wrote:

This patch includes LDFLAGS_SL in SHLIB_LINK on most ports (previously
it was only used on AIX and BeOS), and adds support for specifying it in
configure.

This lets you do something like:

./configure LDFLAGS=-static-libgcc LDFLAGS_SL=-static-libgcc

to produce binaries that do not depend on libgcc_s.so at all.

I haven't touched the win32/cygwin section of Makefile.shlib as I'm not
sure exactly where it'd be useful to add LDFLAGS_SL.

-O

Index: src/Makefile.global.in
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/Makefile.global.in,v
retrieving revision 1.195
diff -u -c -r1.195 Makefile.global.in
*** src/Makefile.global.in	18 Sep 2004 13:28:54 -0000	1.195
--- src/Makefile.global.in	24 Sep 2004 06:23:11 -0000
***************
*** 199,204 ****
--- 199,205 ----
with_gnu_ld = @with_gnu_ld@
ld_R_works = @ld_R_works@
LDFLAGS = @LDFLAGS@
+ LDFLAGS_SL = @LDFLAGS_SL@
LDREL = -r
LDOUT = -o
RANLIB = @RANLIB@
Index: src/Makefile.shlib
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/Makefile.shlib,v
retrieving revision 1.78
diff -u -c -r1.78 Makefile.shlib
*** src/Makefile.shlib	2 Sep 2004 23:06:43 -0000	1.78
--- src/Makefile.shlib	24 Sep 2004 06:23:12 -0000
***************
*** 276,282 ****
# Normal case
$(shlib): $(OBJS)
! 	$(LINK.shared) $(OBJS) $(SHLIB_LINK) -o $@
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), $(shlib_major))
rm -f $(shlib_major)
--- 276,282 ----
# Normal case
$(shlib): $(OBJS)
! 	$(LINK.shared) $(LDFLAGS_SL) $(OBJS) $(SHLIB_LINK) -o $@
# If we're using major and minor versions, then make a symlink to major-version-only.
ifneq ($(shlib), $(shlib_major))
rm -f $(shlib_major)
Index: configure.in
===================================================================
RCS file: /projects/cvsroot/pgsql-server/configure.in,v
retrieving revision 1.377
diff -u -c -r1.377 configure.in
*** configure.in	17 Sep 2004 22:31:59 -0000	1.377
--- configure.in	24 Sep 2004 06:23:12 -0000
***************
*** 531,536 ****
--- 531,538 ----
AC_MSG_NOTICE([using CPPFLAGS=$CPPFLAGS])
AC_MSG_NOTICE([using LDFLAGS=$LDFLAGS])
+ AC_MSG_NOTICE([using LDFLAGS_SL=$LDFLAGS_SL])
+ AC_SUBST(LDFLAGS_SL)

AC_PROG_AWK

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+15-6