Commit Graph

38 Commits

Author SHA1 Message Date
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 60e612b602 Use ppoll(2), if available, to wait for input in pgbench.
Previously, pgbench always used select(2) for this purpose, but that's
problematic for very high client counts, because select() can't deal
with file descriptor numbers larger than FD_SETSIZE.  It's pretty common
for that to be only 1024 or so, whereas modern OSes can allow many more
open files than that.  Using poll(2) would surmount that problem, but it
creates another one: poll()'s timeout resolution is only 1ms, which is
poor enough to cause problems with --rate specifications approaching or
exceeding 1K TPS.

On platforms that have ppoll(2), which includes Linux and recent
FreeBSD, we can use that to avoid the FD_SETSIZE problem without any
loss of timeout resolution.  Hence, add configure logic to test for
ppoll(), and use it if available.

This patch introduces an abstraction layer into pgbench that could
be extended to support other kernel event-wait APIs such as kevents.
But actually adding such support is a matter for some future patch.

Doug Rady, reviewed by Robert Haas and Fabien Coelho, and whacked around
a good bit more by me

Discussion: https://postgr.es/m/23D017C9-81B7-484D-8490-FD94DEC4DF59@amazon.com
2018-09-24 14:40:58 -04:00
Tom Lane ecb0d20a9d Use unnamed POSIX semaphores, if available, on Linux and FreeBSD.
We've had support for using unnamed POSIX semaphores instead of System V
semaphores for quite some time, but it was not used by default on any
platform.  Since many systems have rather small limits on the number of
SysV semaphores allowed, it seems desirable to switch to POSIX semaphores
where they're available and don't create performance or kernel resource
problems.  Experimentation by me shows that unnamed POSIX semaphores
are at least as good as SysV semaphores on Linux, and we previously had
a report from Maksym Sobolyev that FreeBSD is significantly worse with
SysV semaphores than POSIX ones.  So adjust those two platforms to use
unnamed POSIX semaphores, if configure can find the necessary library
functions.  If this goes well, we may switch other platforms as well,
but it would be advisable to test them individually first.

It's not currently contemplated that we'd encourage users to select
a semaphore API for themselves, but anyone who wants to experiment
can add PREFERRED_SEMAPHORES=UNNAMED_POSIX (or NAMED_POSIX, or SYSV)
to their configure command line to do so.

I also tweaked configure to report which API it's selected, mainly
so that we can tell that from buildfarm reports.

I did not touch the user documentation's discussion about semaphores;
that will need some adjustment once the dust settles.

Discussion: <8536.1475704230@sss.pgh.pa.us>
2016-10-09 18:03:45 -04:00
Peter Eisentraut ab112068b6 Remove _FORTIFY_SOURCE
Apparently, on some glibc versions this causes warnings when
optimization is not enabled.

Altogether, there appear to be too many incompatibilities surrounding
this.
2012-10-10 21:42:38 -04:00
Peter Eisentraut 97ec962157 Disable _FORTIFY_SOURCE with ICC
There are apparently some incompatibilities, per buildfarm.
2012-09-29 20:07:36 -04:00
Peter Eisentraut 997fa75d6b Add _FORTIFY_SOURCE to default compiler options for linux template
Many distributors use this, so we might as well see the warnings as
well.
2012-09-29 13:22:59 -04:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Peter Eisentraut 79d306c84a Support for Sun Studio compiler on Linux
This basically takes some build system code that was previously labeled
"Solaris" and ties it to the compiler rather than the operating system.

Author: Julius Stroffek <Julius.Stroffek@Sun.COM>
2008-10-29 16:06:47 +00:00
Tom Lane 017daed0dd If we're gonna provide an --enable-profiling configure option, surely
it ought to know that you need -DLINUX_PROFILE on Linux.
2007-09-21 02:33:46 +00:00
Peter Eisentraut 9cf2706742 Allow augmenting CPPFLAGS from the configure command line. This generally
works, but some platform templates overwrote it without asking.
2006-12-12 19:43:19 +00:00
Bruce Momjian f3d99d160d Add CVS tag lines to files that were lacking them. 2006-03-11 04:38:42 +00:00
Bruce Momjian f7bae20d67 Don't bother adding to cflags/cppflags, just set them because configure
handles that, and make solaris debug use no optimization.
2004-12-02 18:11:40 +00:00
Bruce Momjian 3aa9776d95 Add to CPPFLAGS/CFLAGS in template files, don't over-ride them. 2004-11-27 05:03:26 +00:00
Bruce Momjian 30a06fe2c4 Unconditionally define:
-D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS

for all ports.  It can't hurt if they are not supported, but it makes
our job easier for porting.

Should fix Darwin compile and other platforms without mucking with the
thread detection code.
2004-04-26 04:04:42 +00:00
Bruce Momjian 7a66015e98 Add new auto-detection of thread flags.
Allow additional thread flags to be added via port templates.

Change thread flag names to PTHREAD_CFLAGS and PTHREAD_LIBS to match new
configure script.
2004-04-23 18:15:55 +00:00
Bruce Momjian 6e7a0f3550 Mark linux as thread-enabled with new 7.5 tests. 2004-03-14 15:06:13 +00:00
Bruce Momjian c6f0559371 Check and set thread-safe functions separately, rather than as a single
variable.

Remove thread locking for non-thread-safe functions, instead throw a
compile error.

Platforms will have to re-run tools/thread to record their thread
safety.
2004-02-11 21:44:06 +00:00
Bruce Momjian b1d955ea7b Remove -pipe on Linux, per reports from Peter. 2003-10-09 16:52:45 +00:00
Bruce Momjian 85bd172c45 Add -pipe compile for Linux. 2003-10-09 14:47:59 +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 74c8703031 Mark Linux for threads. 2003-09-27 22:23:35 +00:00
Bruce Momjian 391dceb462 Finalize configuration of thread_test program. 2003-09-27 16:24:45 +00:00
Bruce Momjian 227dd9b427 Rename thread compile flag. Move thread test program to tools/thread,
and improve tests.
2003-09-27 15:32:48 +00:00
Tom Lane 026f9c05d5 Move -D_GNU_SOURCE hack from port header to template, so that
configure's tests see the same compilation environment as the code.
Per discussion with Stephan Szabo.
2003-09-26 17:39:13 +00:00
Bruce Momjian b041d3e3a1 Attempt threading in this order:
*      use non-*_r function names if they are all thread-safe
 *          (NEED_REENTRANT_FUNCS=no)
 *      use *_r functions if they exist (configure test)
 *      do our own locking and copying of non-threadsafe functions

New to this patch is the last option.
2003-09-13 14:49:51 +00:00
Bruce Momjian 38eb18092c Tighten casting of function call pointers for threads. 2003-09-03 22:34:08 +00:00
Bruce Momjian edc999b09a Make NEED_REENTRANT_FUNC_NAMES _require_ *_r functions, and add tests to
configure to report if they are not found.
2003-08-16 15:35:51 +00:00
Bruce Momjian ffa3bfbc30 Move thread os defines into template files. 2003-06-14 19:21:42 +00:00
Peter Eisentraut 8c9c8ca2b5 Remove -mips2 flag, which breaks the build on some MIPS systems.
Report from Ryan Murray via Debian
2002-03-21 15:21:41 +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 6f64c2e54a New unified regression test driver, test/regress makefile cleanup,
add "check" and "installcheck" targets, straighten out make variable naming
of host_os, host_cpu, etc.
2000-09-29 17:17:41 +00:00
Peter Eisentraut 3eec6ee145 Rename templates to match names in makefiles/Makefile.* and include/port.
Read templates after compiler is detected. Convert all templates to real
shell scripts. Rename bsd->openbsd, alpha->osf.
2000-07-15 15:54:52 +00:00
Bruce Momjian 6a08857cc8 template changes 1998-06-12 22:26:24 +00:00
Marc G. Fournier ba697c8c0b Fix a problem with Linux where yacc is *really* bison -y 1997-04-16 14:13:51 +00:00
Marc G. Fournier bb0a17412d Change BACKEND to CFLAGS 1997-04-11 18:55:10 +00:00
Marc G. Fournier eda9d69d6c Move YACC and YFLAGS into the template files
Clean up the .sample files...comment out all sample entries except for
the localhost one
1997-04-04 11:23:15 +00:00
Marc G. Fournier e292a9d627 Got AROPT setting backwards...correct it 1997-04-04 09:02:34 +00:00
Marc G. Fournier f2eb14ad0d One helluva mess.
Further extended Makefile.global/build/configure so that we can
have a 'template' file for each OS (and each version of OS, as in BSDi)
which is used as much as possible to generate Makefile.global

	Any future ports should look at using the template file as a basis,
before moving over to Makefile.global.

	This will most probably break alot of the ports, atho I've tried to
be very neat about it...
1997-04-04 07:59:48 +00:00