Commit Graph

33 Commits

Author SHA1 Message Date
Andres Freund 9db49fc5bf autoconf: Move export_dynamic determination to configure
Previously export_dynamic was set in src/makefiles/Makefile.$port. For solaris
this required exporting with_gnu_ld. The determination of with_gnu_ld would be
nontrivial to copy for meson PGXS compatibility.  It's also nice to delete
libtool.m4.

This uses -Wl,--export-dynamic on all platforms, previously all platforms but
FreeBSD used -Wl,-E. The likelihood of a name conflict seems lower with the
longer spelling.

Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de
2022-12-06 18:55:28 -08:00
Andres Freund 2473cb9ff3 autoconf: Rely on ar supporting index creation
This way we don't need RANLIB anymore, making it a bit simpler for the meson
build to generate Makefile.global for PGXS compatibility.

FreeBSD, NetBSD, OpenBSD, the only platforms where we didn't use AROPT=crs,
all have supported the 's' option for a long time.

On macOS we ran ranlib after installing a static library. This was added a
long time ago, in 58ad65ec2d. I cannot reproduce an issue in more recent
macOS versions. This is removed now.

Based on discussion with Tom, I left the 'touch' at the end of static
libraries generation, added in 826eff57c4, in place. While it looks like
current versions of Apple's ar/ranlib don't need it, it was needed not too
long ago.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de
2022-10-07 11:53:39 -07:00
Peter Eisentraut 23119d51a1 Refactor DLSUFFIX handling
Move DLSUFFIX from makefiles into header files for all platforms.
Move the DLSUFFIX assignment from src/makefiles/ to src/templates/,
have configure read it, and then substitute it into Makefile.global
and pg_config.h.  This avoids the need for all makefile rules that
need it to locally set CPPFLAGS.  It also resolves an inconsistent
setup between the two Windows build systems.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/2f9861fb-8969-9005-7518-b8e60f2bead9@enterprisedb.com
2022-03-25 08:56:02 +01:00
Tom Lane 44273ce4f6 Select CFLAGS_SL at configure time, not in platform-specific Makefiles.
Move the platform-dependent logic that sets CFLAGS_SL from
src/makefiles/Makefile.foo to src/template/foo, so that the value
is determined at configure time and thus is available while running
configure's tests.

On a couple of platforms this might save a few microseconds of build
time by eliminating a test that make otherwise has to do over and over.
Otherwise it's pretty much a wash for build purposes; in particular,
this makes no difference to anyone who might be overriding CFLAGS_SL
via a make option.

This patch in itself does nothing with the value and thus should not
change any behavior, though you'll probably have to re-run configure
to get a correctly updated Makefile.global.  We'll use the new
configure variable in a follow-on patch.

Per gripe from Kyotaro Horiguchi.  Back-patch to all supported branches,
because the follow-on patch is a portability bug fix.

Discussion: https://postgr.es/m/20191010.144533.263180400.horikyota.ntt@gmail.com
2019-10-21 12:32:35 -04:00
Tom Lane 69ae9dcb44 Ensure link commands list *.o files before LDFLAGS.
It's important for link commands to list *.o input files before -l
switches for libraries, as library code may not get pulled into the link
unless referenced by an earlier command-line entry.  This is certainly
necessary for static libraries (.a style).  Apparently on some platforms
it is also necessary for shared libraries, as reported by Donald Dong.

We often put -l switches for within-tree libraries into LDFLAGS, meaning
that link commands that list *.o files after LDFLAGS are hazardous.
Most of our link commands got this right, but a few did not.  In
particular, places that relied on gmake's default implicit link rule
failed, because that puts LDFLAGS first.  Fix that by overriding the
built-in rule with our own.  The implicit link rules in
src/makefiles/Makefile.* for single-.o-file shared libraries mostly
got this wrong too, so fix them.  I also changed the link rules for the
backend and a couple of other places for consistency, even though they
are not (currently) at risk because they aren't adding any -l switches
to LDFLAGS.

Arguably, the real problem here is that we're abusing LDFLAGS by
putting -l switches in it and we should stop doing that.  But changing
that would be quite invasive, so I'm not eager to do so.

Perhaps this is a candidate for back-patching, but so far it seems
that problems can only be exhibited in test code we don't normally
build, and at least some of the problems are new in HEAD anyway.
So I'll refrain for now.

Donald Dong and Tom Lane

Discussion: https://postgr.es/m/CAKABAquXn-BF-vBeRZxhzvPyfMqgGuc74p8BmQZyCFDpyROBJQ@mail.gmail.com
2019-01-02 13:57:54 -05:00
Tom Lane e9a3c047a5 Always use -fPIC, not -fpic, when building shared libraries with gcc.
On some platforms, -fpic fails for sufficiently large shared libraries.
We've mostly not hit that boundary yet, but there are some extensions
such as Citus and pglogical where it's becoming a problem.  A bit of
research suggests that the penalty for -fPIC is small, in the
single-digit-percentage range --- and there's none at all on popular
platforms such as x86_64.  So let's just default to -fPIC everywhere
and provide one less thing for extension developers to worry about.

Per complaint from Christoph Berg.  Back-patch to all supported branches.
(I did not bother to touch the recently-removed Makefiles for sco and
unixware in the back branches, though.  We'd have no way to test that
it doesn't break anything on those platforms.)

Discussion: https://postgr.es/m/20170529155850.qojdfrwkkqnjb3ap@msg.df7cb.de
2017-06-01 13:32:55 -04:00
Peter Eisentraut 1a5f04dd7e Remove allow_nonpic_in_shlib
This was used in a time when a shared libperl or libpython was difficult
to come by.  That is obsolete, and the idea behind the flag was never
fully portable anyway and will likely fail on more modern CPU
architectures.
2012-12-18 01:13:59 -05:00
Tom Lane 291a957745 Split the LDFLAGS make variable into two parts: LDFLAGS is now used for
linking both executables and shared libraries, and we add on LDFLAGS_EX when
linking executables or LDFLAGS_SL when linking shared libraries.  This
provides a significantly cleaner way of dealing with link-time switches than
the former behavior.  Also, make sure that the various platform-specific
%.so: %.o rules incorporate LDFLAGS and LDFLAGS_SL; most of them missed that
before.  (I did not add these variables for the platforms that invoke $(LD)
directly, however.  It's not clear if we can do that safely, since for the
most part we assume these variables use CC command-line syntax.)

Per gripe from Aaron Swenson and subsequent investigation.
2010-07-05 18:54:38 +00:00
Tom Lane cd86869a9a On Linux, use --enable-new-dtags when specifying -rpath to linker.
This should allow LD_LIBRARY_PATH to work as desired.  Per trouble
report from Andy Colson.
2010-05-06 19:28:25 +00:00
Peter Eisentraut d129255077 Set SQL man pages to be section 7 by default, and only transform them to
another section if required by the platform (instead of the old way of
building them in section "l" and always transforming them to the
platform-specific section).

This speeds up the installation on common platforms, and it avoids some
funny business with the man page tools and build process.
2008-11-14 10:22:48 +00:00
Peter Eisentraut 86ec73b909 Synchronize the shared object build rules in Makefile.port with Makefile.shlib
somewhat by adding CFLAGS where the compiler is used and Makefile.shlib
already used CFLAGS.
2008-09-01 08:50:10 +00:00
Peter Eisentraut a29c04a541 Allow installation into directories containing spaces in the name. 2005-12-09 21:19:36 +00:00
Tom Lane 71d21577de Add '-Wl,' prefix to linker switches consistently. Remove shlib_symbolic
macros, which aren't used anywhere and haven't been for some time.
2004-12-21 18:47:42 +00:00
Tom Lane a9ddd649df Modify the platform-specific makefiles so that macro 'rpath' is defined
in terms of macro 'rpathdir', as I proposed a few weeks ago.  In itself
this commit shouldn't change the behavior at all, but it opens the door
to using special rpaths for the PL shared libraries, as seems to be
needed for plperl in particular.
2004-11-19 00:41:39 +00:00
Peter Eisentraut 1fed74f257 Support for Intel compiler on Linux 2003-06-05 16:07:25 +00:00
Tom Lane 9ecba0c2f8 Use -fPIC on Sparc, per Tom Callaway. 2003-05-19 17:51:01 +00:00
Peter Eisentraut b1a38a4380 Install the SQL command man pages into a section appropriate for each
system.  Some systems did not understand the 'l' section, and in general
it wasn't entirely appropriate.

On SCO OpenServer, the man pages won't be installed at all until someone
figures out their man system.
2001-08-29 19:14:40 +00:00
Peter Eisentraut 34fd50880f VPATH and DESTDIR support for PL/Perl, using the same techniques employed
in interfaces/perl5 a brief while ago.

Also, since building PL/Perl without a shared libperl actually works on
some platforms we can enable it there to get some development happening.
I've only checked off linux right now, but others should be added in the
future.
2001-08-26 23:54:41 +00:00
Peter Eisentraut 9cf0a82fc3 Fix linker options for ODBC driver. See comment in
src/interfaces/odbc/GNUmakefile.
2000-12-16 18:14:25 +00:00
Peter Eisentraut 6707ede813 Make use of system-specific linker option to embed shared library search
path into executables and shared libraries (-rpath or -R for most).  Can be
disabled with --disable-rpath, since some binary packaging standards do not
like this option.
2000-10-27 23:59:39 +00:00
Peter Eisentraut f8ff1ee5aa Move DLSUFFIX, AROPT, and CFLAGS_SL settings from template to
Makefile.port, since they are of no use to configure and much of the
library magic happens in Makefile.port anyway.

Use __alpha, not __alpha__, since the former is universally available.
Remove -DNOFIXADE from the compile command line and put it in the port
include file.
2000-10-21 22:36:14 +00:00
Peter Eisentraut a3578c13e6 Separate -Wl,-E or equivalent into separate make variable, since it's only
necessary for the postgres/postmaster link, not every link.
2000-10-07 18:43:23 +00:00
Bruce Momjian beac8c1c46 Fix for vacuum and cache use. Fix for BSDI 4.0. 1998-10-12 00:53:42 +00:00
Bruce Momjian 471dbbc223 DESTDIR removed, again. 1998-04-06 16:53:15 +00:00
Bruce Momjian 066ee9a2e9 Make DESTDIR consistent, and verious Linux cleanups. 1998-04-06 01:36:41 +00:00
Bruce Momjian 1e801a8f16 Hi,
Attached you'll find a (big) patch that fixes make dep and make
depend in all Makefiles where I found it to be appropriate.

It also removes the dependency in Makefile.global for NAMEDATALEN
and OIDNAMELEN by making backend/catalog/genbki.sh and bin/initdb/initdb.sh
a little smarter.

This no longer requires initdb.sh that is turned into initdb with
a sed script when installing Postgres, hence initdb.sh should be
renamed to initdb (after the patch has been applied :-) )

This patch is against the 6.3 sources, as it took a while to
complete.

Please review and apply,

Cheers,

Jeroen van Vianen
1998-04-06 00:32:26 +00:00
Bruce Momjian 2dfee93457 Remove DISTDIR. 1998-04-05 22:02:56 +00:00
Thomas G. Lockhart 38004ce57b Cancel last version which introduced unintended flags
for linux-alpha support.
1998-02-18 07:15:23 +00:00
Marc G. Fournier d1891c6fb3 Apparently there was a
compiler define that should have been enabled, but was not due to
different naming conventions for Linux/Alpha. Attached is the patch he
sent me, that I have not had a chance to test yet.

From: Ryan Kirkpatrick <rkirkpat@nag.cs.colorado.edu>
1998-02-14 18:06:20 +00:00
Thomas G. Lockhart e447a467fa Remove declaration for -DLINUX_ELF since testing for __ELF__ in code. 1998-01-01 05:59:24 +00:00
Bruce Momjian 8d25436d70 mkLinux patches from Tatsuo Ishii. 1997-07-29 14:09:11 +00:00
Thomas G. Lockhart 7bdf9ba35b Add flags to allow dynamic loader to find Postgres sharable libraries without
having to modify the system-wide library database.
1997-07-01 00:29:40 +00:00
Marc G. Fournier 09a5dabc30 Remove port specific Makefile 'targets' (ie. shared libraries) from
Makefile.global and move them to seperate 'include' makefiles

Over time, should become even more port specific:

	ie. Makefile.BSD44_derived should be broken down into netbsd/freebsd
specific ports
1997-04-12 10:33:10 +00:00