mirror of
https://github.com/postgres/postgres.git
synced 2026-03-09 09:40:40 -04:00
For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit
|
||
|---|---|---|
| .. | ||
| po | ||
| t | ||
| test | ||
| .gitignore | ||
| exports.txt | ||
| fe-auth-sasl.h | ||
| fe-auth-scram.c | ||
| fe-auth.c | ||
| fe-auth.h | ||
| fe-cancel.c | ||
| fe-connect.c | ||
| fe-exec.c | ||
| fe-gssapi-common.c | ||
| fe-gssapi-common.h | ||
| fe-lobj.c | ||
| fe-misc.c | ||
| fe-print.c | ||
| fe-protocol3.c | ||
| fe-secure-common.c | ||
| fe-secure-common.h | ||
| fe-secure-gssapi.c | ||
| fe-secure-openssl.c | ||
| fe-secure.c | ||
| fe-trace.c | ||
| legacy-pqsignal.c | ||
| libpq-events.c | ||
| libpq-events.h | ||
| libpq-fe.h | ||
| libpq-int.h | ||
| Makefile | ||
| meson.build | ||
| nls.mk | ||
| pg_service.conf.sample | ||
| pqexpbuffer.c | ||
| pqexpbuffer.h | ||
| pthread-win32.c | ||
| README | ||
| win32.c | ||
| win32.h | ||
src/interfaces/libpq/README This directory contains the C version of Libpq, the POSTGRES frontend library.