Commit Graph

34 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
Peter Eisentraut c72f9b9502 Remove support for non-ELF BSD systems
This is long obsolete.

Discussion: https://www.postgresql.org/message-id/8eacdc0d-123f-dbca-bacf-0a68766a4889@2ndquadrant.com
2019-07-01 23:56:20 +01:00
Andrew Gierth 54f5f887fd Move port-specific parts of with_temp_install to port makefile.
Rather than define ld_library_path_ver with a big nested $(if), just
put the overriding values in the makefiles for the relevant ports.

Also add a variable for port makefiles to append their own stuff to
with_temp_install, and use it to set LD_LIBRARY_PATH_RPATH=1 on
FreeBSD which is needed to make LD_LIBRARY_PATH override DT_RPATH
if DT_RUNPATH is not set (which seems to depend in unpredictable ways
on the choice of compiler, at least on my system).

Backpatch for the benefit of anyone doing regression tests on FreeBSD.
(For other platforms there should be no functional change.)
2019-02-04 18:54:56 +00: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
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
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
Tom Lane 04ca4caa81 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.
2006-04-19 16:32:08 +00:00
Peter Eisentraut a29c04a541 Allow installation into directories containing spaces in the name. 2005-12-09 21:19:36 +00:00
Tom Lane 41bb3cb7c9 Back off allow_nonpic_in_shlib for FreeBSD builds: only set it on i386.
This might be overly conservative, but we know it does not work on amd64.
Per buildfarm results.
2005-08-24 20:20:38 +00:00
Bruce Momjian 2c07d6bfa5 Cleanups for FreeBSD linking (PIC) and plpython compiles.
FreeBSD ports, supplied by Jim C. Nasby
2005-08-12 20:57:11 +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
Tom Lane d10a406fe8 Use -fPIC not -fpic for BSDen on Sparc. Also switch from
$(LD) -x -Bshareable to $(CC) -shared on OpenBSD (I suspect this
should be carried over to the other two as well, but will refrain
pending suggestions from people who actually use those platforms).
Per Stefan Kaltenbrunner.
2004-10-11 23:27:23 +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 90e2663313 Shared libraries should not be linked explicitly against -lc on FreeBSD
(see http://mail.gnu.org/pipermail/libtool/2000-July/001824.html).  But
apparently it should still be present with -Bsymbolic.
2001-06-20 20:25:11 +00:00
Bruce Momjian 00ab7b5896 Fix -Bsymbolic for FreeBSD and OpenBSD. NetBSD already had all these fixes. 2001-02-10 17:17:39 +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 289e6fd2a4 Do not use 'ar cq' to build library archives, use 'ar cr' instead. 2000-12-07 19:43:49 +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 a82f9ffde6 New LDOUT makefile variable for QNX os. 1999-12-13 22:35:27 +00:00
Bruce Momjian 3ffd3d82db Make LD -r as macros that can be changed for QNX. 1999-12-09 19:15:45 +00:00
Marc G. Fournier a0b7daa129 Apply freebsd specific patches dealign with ELF system from FreeBSD's
ports collection ...
1999-05-17 04:13:29 +00:00
Marc G. Fournier c200938343 slight mods required for freebsd (elf vs aout stuff) 1998-11-02 05:30:10 +00:00
Marc G. Fournier 15d61bb439 Minor FreeBSD fixes put in place
From: SHIOZAKI Takehiko <takehi-s@ascii.co.jp>

I tried snapshot(Oct30) and made some patches.
# I think that it is confused to manage both Makefile.shlib and
# makefiles/Makefile.*, don't you?

* configure
        Now FreeBSD 2.X is not supported..., so I added its entry.
        If ELF_SYSTEM is set, gmake treat it defined even though
        it is "false".  So nothing should be set to use "ifdef".
        BSD_SHLIB etc. may have same problems.

* Makefile.shlib
        As you said, FreeBSD entry is much like BSD's.
        I only added ELF_SYSTEM code.

* makefiles/Makefile.freebsd
        Ifdef/else/endif can not be indented with TABs.
1998-10-31 03:58:55 +00:00
Marc G. Fournier 4283089d07 Okay, this shoudl provide a fix for the freebsd problem...
Added a ELF_SYS variable and check to configure.in...
1998-10-30 04:54:06 +00:00
Marc G. Fournier 208cb8b279 Oops, don't forget to get rid ofthe -Bforcearchive option altogether... 1998-10-27 04:32:53 +00:00
Marc G. Fournier 949953060a Starting with v3.0 of FreeBSD, we are now an elf system, and dont' have a
-Bforcearchive flag for ld...

Give FreeBSD its own special Makefile to get around the "bug"
1998-10-27 04:32:02 +00:00