Commit Graph

8 Commits

Author SHA1 Message Date
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
Noah Misch 4d92b15855 Have configuration templates augment, not replace, LDFLAGS.
This preserves user-specified LDFLAGS; we already kept user-specified
CFLAGS and CPPFLAGS.  Given the shortage of complaints and the fact that
any problem caused is likely to appear at build time, no back-patch.

Dag-Erling Smørgrav and Noah Misch
2014-06-11 19:50:57 -04:00
Tom Lane 1c9acd5c86 Use --disable-auto-import linker switch in Mingw builds, too.
This is evidently the default on buildfarm member narwhal, but that
is a pretty ancient Mingw version, and there is reason to think that
more recent versions of GNU ld have this feature turned on by default.
Since we are trying to achieve consistency of link behavior across
all Windows toolchains, let's just make sure here.
2014-02-12 12:03:53 -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
Bruce Momjian 0d3b8e9a50 Allow win32/cygwin link against the first matching library symbol rather
than erroring out.  This is the Unix behavior.
2004-11-08 05:23:26 +00:00
Bruce Momjian 0e22cb1232 This centralizes the optimization defaults into configure.in, rather
than having CFLAGS= in the template files.

It uses -O2 for gcc (generated by autoconf), and -O for non-gcc, unless
the template overrides it.
2003-10-09 03:20:34 +00:00
Bruce Momjian 12c9423832 Allow Win32 to compile under MinGW. Major changes are:
Win32 port is now called 'win32' rather than 'win'
        add -lwsock32 on Win32
        make gethostname() be only used when kerberos4 is enabled
        use /port/getopt.c
        new /port/opendir.c routines
        disable GUC unix_socket_group on Win32
        convert some keywords.c symbols to KEYWORD_P to prevent conflict
        create new FCNTL_NONBLOCK macro to turn off socket blocking
        create new /include/port.h file that has /port prototypes, move
          out of c.h
        new /include/port/win32_include dir to hold missing include files
        work around ERROR being defined in Win32 includes
2003-05-15 16:35:30 +00:00