Skip to content
Snippets Groups Projects
  1. Aug 05, 2015
    • Andres Freund's avatar
      Rely on inline functions even if that causes warnings in older compilers. · de6fd1c8
      Andres Freund authored
      So far we have worked around the fact that some very old compilers do
      not support 'inline' functions by only using inline functions
      conditionally (or not at all). Since such compilers are very rare by
      now, we have decided to rely on inline functions from 9.6 onwards.
      
      To avoid breaking these old compilers inline is defined away when not
      supported. That'll cause "function x defined but not used" type of
      warnings, but since nobody develops on such compilers anymore that's
      ok.
      
      This change in policy will allow us to more easily employ inline
      functions.
      
      I chose to remove code previously conditional on PG_USE_INLINE as it
      seemed confusing to have code dependent on a define that's always
      defined.
      
      Blacklisting of compilers, like in c53f7387, now has to be done
      differently. A platform template can define PG_FORCE_DISABLE_INLINE to
      force inline to be defined empty.
      
      Discussion: 20150701161447.GB30708@awork2.anarazel.de
      de6fd1c8
  2. Jul 30, 2015
    • Heikki Linnakangas's avatar
      Update ax_pthread.m4 to an experimental draft version from upstream. · a2932283
      Heikki Linnakangas authored
      The current version is adding a spurious -pthread option on some Darwin
      systems that don't need it, which leads to a bunch of "unrecognized option
      '-pthread'" warnings. There is a proposed fix for that in the upstream
      autoconf archive's bug tracker, see https://savannah.gnu.org/patch/?8186.
      This commit updates our version of ax_pthread.m4 to the "draft2" version
      proposed there by Daniel Richard G. I'm using our buildfarm to help Daniel
      to test this, before he commits this to the upstream repository.
      a2932283
  3. Jul 17, 2015
    • Noah Misch's avatar
      AIX: Test the -qlonglong option before use. · 43d89a23
      Noah Misch authored
      xlc provides "long long" unconditionally at C99-compatible language
      levels, and this option provokes a warning.  The warning interferes with
      "configure" tests that fail in response to any warning.  Notably, before
      commit 85a2a890, it interfered with the
      test for -qnoansialias.  Back-patch to 9.0 (all supported versions).
      43d89a23
  4. Jul 09, 2015
    • Heikki Linnakangas's avatar
      Use AS_IF rather than plain shell "if" in pthread-check. · 01051a98
      Heikki Linnakangas authored
      Autoconf generates additional code for the first AC_CHECK_HEADERS call in
      the script. If the first call is within an if-block, the additional code is
      put inside the if-block too, even though it is needed by subsequent
      AC_CHECK_HEADERS checks and should always be executed. When I moved the
      pthread-related checks earlier in the script, the pthread.h test inside
      the block became the very first AC_CHECK_HEADERS call in the script,
      triggering that problem.
      
      To fix, use AS_IF instead of plain shell if. AS_IF knows about that issue,
      and makes sure the additional code is always executed. To be completely
      safe from this issue (and others), we should always be using AS_IF instead
      of plain if, but that seems like excessive caution given that this is the
      first time we have trouble like this. Plain if-then is more readable than
      AS_IF.
      
      This should fix compilation with --disable-thread-safety, and hopefully the
      buildfarm failure on forgmouth, related to mingw standard headers, too.
      I backpatched the previous fixes to 9.5, but it's starting to look like
      these changes are too fiddly to backpatch, so commit this to master only,
      and revert all the pthread-related configure changes in 9.5.
      01051a98
  5. Jul 08, 2015
    • Heikki Linnakangas's avatar
      Move pthread-tests earlier in the autoconf script. · 3b14a17c
      Heikki Linnakangas authored
      On some Linux systems, "-lrt" exposed pthread-functions, so that linking
      with -lrt was seemingly enough to make a program that uses pthreads to
      work. However, when linking libpq, the dependency to libpthread was not
      marked correctly, so that when an executable was linked with -lpq but
      without -pthread, you got errors about undefined pthread_* functions from
      libpq.
      
      To fix, test for the flags required to use pthreads earlier in the autoconf
      script, before checking any other libraries.
      
      This should fix the failure on buildfarm member shearwater. gharial is also
      failing; hopefully this fixes that too although the failure looks somewhat
      different.
      3b14a17c
    • Heikki Linnakangas's avatar
      Replace our hacked version of ax_pthread.m4 with latest upstream version. · e97af6c8
      Heikki Linnakangas authored
      Our version was different from the upstream version in that we tried to use
      all possible pthread-related flags that the compiler accepts, rather than
      just the first one that works. That change was made in commit
      e48322a6, to work-around a bug affecting GCC
      versions 3.2 and below (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=8888),
      although we didn't realize that it was a GCC bug at the time. We hardly care
      about that old GCC versions anymore, so we no longer need that workaround.
      
      This fixes the macro for compilers that print warnings with the chosen
      flags. That's pretty annoying on its own right, but it also inconspicuously
      disabled thread-safety, because we refused to use any pthread-related flags
      if the compiler produced warnings. Max Filippov reported that problem when
      linking with uClibc and OpenSSL. The warnings-check was added because the
      workaround for the GCC bug caused warnings otherwise, so it's no longer
      needed either. We can just use the upstream version as is.
      
      If you really want to compile with GCC version 3.2 or older, you can still
      work-around it manually by setting PTHREAD_CFLAGS="-pthread -lpthread"
      manually on the configure command line.
      
      Backpatch to 9.5. I don't want to unnecessarily rock the boat on stable
      branches, but 9.5 seems like fair game.
      e97af6c8
  6. Jul 02, 2015
    • Tom Lane's avatar
      Make numeric form of PG version number readily available in Makefiles. · a5d489cc
      Tom Lane authored
      Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for
      consistency with the other Make variables holding similar info,
      call the variable just VERSION_NUM not PG_VERSION_NUM.
      
      There was some discussion of making this value available as a pg_config
      value as well.  However, that would entail substantially more work than
      this two-line patch.  Given that there was not exactly universal consensus
      that we need this at all, let's just do a minimal amount of work for now.
      
      Michael Paquier, reviewed by Pavel Stehule
      a5d489cc
    • Heikki Linnakangas's avatar
      Replace obsolete autoconf macros with their modern replacements. · a2edb023
      Heikki Linnakangas authored
      AC_TRY_COMPILE(...) -> AC_COMPILE_IFELSE([AC_LANG_PROGRAM(...)])
      AC_TRY_LINK(...) -> AC_LINK_IFELSE([AC_LANG_PROGRAM(...)])
      AC_TRY_RUN(...) -> AC_RUN_IFELSE([AC_LANG_PROGRAM(...)])
      AC_LANG_SAVE/RESTORE -> AC_LANG_PUSH/POP
      AC_DECL_SYS_SIGLIST -> AC_CHECK_DECLS(...) (per snippet in autoconf manual)
      
      Also use AC_LANG_SOURCE instead of AC_LANG_PROGRAM, where the main()
      function is not needed.
      
      With these changes, autoconf -Wall doesn't complain anymore.
      
      Andreas Karlsson
      a2edb023
  7. Jun 30, 2015
  8. Jun 29, 2015
  9. May 27, 2015
    • Tom Lane's avatar
      Remove configure check prohibiting threaded libpython on OpenBSD. · 86832eb8
      Tom Lane authored
      According to recent tests, this case now works fine, so there's no reason
      to reject it anymore.  (Even if there are still some OpenBSD platforms
      in the wild where it doesn't work, removing the check won't break any case
      that worked before.)
      
      We can actually remove the entire test that discovers whether libpython
      is threaded, since without the OpenBSD case there's no need to know that
      at all.
      
      Per report from Davin Potts.  Back-patch to all active branches.
      86832eb8
  10. May 03, 2015
  11. May 02, 2015
    • Peter Eisentraut's avatar
    • Peter Eisentraut's avatar
      Fix shared libpython detection on OS X · 010aa420
      Peter Eisentraut authored
      Apparently, looking for an appropriately named file doesn't work on some
      older versions, so put the back the explicit platform detection.
      010aa420
    • Peter Eisentraut's avatar
      Move interpreter shared library detection to configure · d664a10f
      Peter Eisentraut authored
      For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of
      libperl, libpython, and libtcl, respectively.  Previously, this was
      checked in the makefiles, skipping the PL build with a warning if no
      shared library was available.  Now this is checked in configure, with an
      error if no shared library is available.
      
      The previous situation arose because in the olden days, the configure
      options --with-perl, --with-python, and --with-tcl controlled whether
      frontend interfaces for those languages would be built.  The procedural
      languages were added later, and shared libraries were often not
      available in the beginning.  So it was decided skip the builds of the
      procedural languages in those cases.  The frontend interfaces have since
      been removed from the tree, and shared libraries are now available most
      of the time, so that setup makes much less sense now.
      
      Also, the new setup allows contrib modules and pgxs users to rely on the
      respective PLs being available based on configure flags.
      d664a10f
  12. Apr 14, 2015
    • Heikki Linnakangas's avatar
      Optimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86. · 936546dc
      Heikki Linnakangas authored
      Eliminate the separate 'len' variable from the loops, and also use the 4
      byte instruction. This shaves off a few more cycles. Even though this
      routine that uses the special SSE 4.2 instructions is much faster than a
      generic routine, it's still a hot spot, so let's make it as fast as
      possible.
      
      Change the configure test to not test _mm_crc32_u64. That variant is only
      available in the 64-bit x86-64 architecture, not in 32-bit x86. Modify
      pg_comp_crc32c_sse42 so that it only uses _mm_crc32_u64 on x86-64. With
      these changes, the SSE accelerated CRC-32C implementation can also be used
      on 32-bit x86 systems.
      
      This also fixes the 32-bit MSVC build.
      936546dc
    • Heikki Linnakangas's avatar
      Try to fix the CRC-32C autoconf magic for icc compiler. · b4eb2d16
      Heikki Linnakangas authored
      On gcc and clang, the _mm_crc32_u8 and _mm_crc32_u64 intrinsics are not
      defined at all, when not building with -msse4.2. But on icc, they are.
      So we cannot assume that if those intrinsics are defined, we can always use
      them safely, we might still need the runtime check.
      
      To fix, check if the __SSE_4_2__ preprocessor symbol is defined. That's
      supposed to be defined only when the compiler is targeting a processor that
      has SSE 4.2 support.
      
      Per buildfarm members fulmar and okapi.
      b4eb2d16
    • Heikki Linnakangas's avatar
      Use Intel SSE 4.2 CRC instructions where available. · 3dc2d62d
      Heikki Linnakangas authored
      Modern x86 and x86-64 processors with SSE 4.2 support have special
      instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
      speed up CRC calculation.
      
      Whether the instructions can be used or not depends on the compiler and the
      target architecture. If generation of SSE 4.2 instructions is allowed for
      the target (-msse4.2 flag on gcc and clang), use them. If they are not
      allowed by default, but the compiler supports the -msse4.2 flag to enable
      them, compile just the CRC-32C function with -msse4.2 flag, and check at
      runtime whether the processor we're running on supports it. If it doesn't,
      fall back to the slicing-by-8 algorithm. (With the common defaults on
      current operating systems, the runtime-check variant is what you get in
      practice.)
      
      Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.
      3dc2d62d
  13. Apr 05, 2015
    • Tom Lane's avatar
      Suppress clang's unhelpful gripes about -pthread switch being unused. · 73b416b2
      Tom Lane authored
      Considering the number of cases in which "unused" command line arguments
      are silently ignored by compilers, it's fairly astonishing that anybody
      thought this warning was useful; it's certainly nothing but an annoyance
      when building Postgres.  One such case is that neither gcc nor clang
      complain about unrecognized -Wno-foo switches, making it more difficult
      to figure out whether the switch does anything than one could wish.
      
      Back-patch to 9.3, which is as far back as the patch applies conveniently
      (we'd have to back-patch PGAC_PROG_CC_VAR_OPT to go further, and it doesn't
      seem worth that).
      73b416b2
  14. Mar 20, 2015
    • Andres Freund's avatar
      Add, optional, support for 128bit integers. · 8122e143
      Andres Freund authored
      We will, for the foreseeable future, not expose 128 bit datatypes to
      SQL. But being able to use 128bit math will allow us, in a later patch,
      to use 128bit accumulators for some aggregates; leading to noticeable
      speedups over using numeric.
      
      So far we only detect a gcc/clang extension that supports 128bit math,
      but no 128bit literals, and no *printf support. We might want to expand
      this in the future to further compilers; if there are any that that
      provide similar support.
      
      Discussion: 544BB5F1.50709@proxel.se
      Author: Andreas Karlsson, with significant editorializing by me
      Reviewed-By: Peter Geoghegan, Oskari Saarenmaa
      8122e143
  15. Mar 15, 2015
  16. Mar 14, 2015
    • Tom Lane's avatar
      Build src/port/dirmod.c only on Windows. · 91f4a5a9
      Tom Lane authored
      Since commit ba7c5975, port/dirmod.c
      has contained only Windows-specific functions.  Most platforms don't
      seem to mind uselessly building an empty file, but OS X for one issues
      warnings.  Hence, treat dirmod.c as a Windows-specific file selected
      by configure rather than one that's always built.  We can revert this
      change if dirmod.c ever gains any non-Windows functionality again.
      
      Back-patch to 9.4 where the mentioned commit appeared.
      91f4a5a9
  17. Feb 10, 2015
    • Heikki Linnakangas's avatar
      Speed up CRC calculation using slicing-by-8 algorithm. · 025c0242
      Heikki Linnakangas authored
      This speeds up WAL generation and replay. The new algorithm is
      significantly faster with large inputs, like full-page images or when
      inserting wide rows. It is slower with tiny inputs, i.e. less than 10 bytes
      or so, but the speedup with longer inputs more than make up for that. Even
      small WAL records at least have 24 byte header in the front.
      
      The output is identical to the current byte-at-a-time computation, so this
      does not affect compatibility. The new algorithm is only used for the
      CRC-32C variant, not the legacy version used in tsquery or the
      "traditional" CRC-32 used in hstore and ltree. Those are not as performance
      critical, and are usually only applied over small inputs, so it seems
      better to not carry around the extra lookup tables to speed up those rare
      cases.
      
      Abhijit Menon-Sen
      025c0242
  18. Jan 14, 2015
    • Tom Lane's avatar
      Allow CFLAGS from configure's environment to override automatic CFLAGS. · 85a2a890
      Tom Lane authored
      Previously, configure would add any switches that it chose of its own
      accord to the end of the user-specified CFLAGS string.  Since most
      compilers process these left-to-right, this meant that configure's choices
      would override the user-specified flags in case of conflicts.  We'd rather
      that worked the other way around, so adjust the logic to put the user's
      string at the end not the beginning.
      
      There does not seem to be a need for a similar behavior change for CPPFLAGS
      or LDFLAGS: in those, the earlier switches tend to win (think -I or -L
      behavior) so putting the user's string at the front is fine.
      
      Backpatch to 9.4 but not earlier.  I'm not planning to run buildfarm member
      guar on older branches, and it seems a bit risky to change this behavior
      in long-stable branches.
      85a2a890
  19. Jan 11, 2015
    • Tom Lane's avatar
      Remove configure test for nonstandard variants of getpwuid_r(). · 8883bae3
      Tom Lane authored
      We had code that supposed that some platforms might offer a nonstandard
      version of getpwuid_r() with only four arguments.  However, the 5-argument
      definition has been standardized at least since the Single Unix Spec v2,
      which is our normal reference for what's portable across all Unix-oid
      platforms.  (What's more, this wasn't the only pre-standardization version
      of getpwuid_r(); my old HPUX 10.20 box has still another signature.)
      So let's just get rid of the now-useless configure step.
      8883bae3
  20. Jan 08, 2015
    • Noah Misch's avatar
      On Darwin, detect and report a multithreaded postmaster. · 894459e5
      Noah Misch authored
      Darwin --enable-nls builds use a substitute setlocale() that may start a
      thread.  Buildfarm member orangutan experienced BackendList corruption
      on account of different postmaster threads executing signal handlers
      simultaneously.  Furthermore, a multithreaded postmaster risks undefined
      behavior from sigprocmask() and fork().  Emit LOG messages about the
      problem and its workaround.  Back-patch to 9.0 (all supported versions).
      894459e5
  21. Jan 06, 2015
  22. Nov 23, 2014
  23. Nov 02, 2014
  24. Oct 25, 2014
  25. Oct 21, 2014
    • Peter Eisentraut's avatar
      doc: Check DocBook XML validity during the build · 5d93ce2d
      Peter Eisentraut authored
      
      Building the documentation with XSLT does not check the DTD, like a
      DSSSL build would.  One can often get away with having invalid XML, but
      the stylesheets might then create incorrect output, as they are not
      designed to handle that.  Therefore, check the validity of the XML
      against the DTD, using xmllint, during the build.
      
      Add xmllint detection to configure, and add some documentation.
      
      xmllint comes with libxml2, which is already in use, but it might be in
      a separate package, such as libxml2-utils on Debian.
      
      Reviewed-by: default avatarFabien COELHO <coelho@cri.ensmp.fr>
      5d93ce2d
  26. Sep 25, 2014
    • Andres Freund's avatar
      Add a basic atomic ops API abstracting away platform/architecture details. · b64d92f1
      Andres Freund authored
      Several upcoming performance/scalability improvements require atomic
      operations. This new API avoids the need to splatter compiler and
      architecture dependent code over all the locations employing atomic
      ops.
      
      For several of the potential usages it'd be problematic to maintain
      both, a atomics using implementation and one using spinlocks or
      similar. In all likelihood one of the implementations would not get
      tested regularly under concurrency. To avoid that scenario the new API
      provides a automatic fallback of atomic operations to spinlocks. All
      properties of atomic operations are maintained. This fallback -
      obviously - isn't as fast as just using atomic ops, but it's not bad
      either. For one of the future users the atomics ontop spinlocks
      implementation was actually slightly faster than the old purely
      spinlock using implementation. That's important because it reduces the
      fear of regressing older platforms when improving the scalability for
      new ones.
      
      The API, loosely modeled after the C11 atomics support, currently
      provides 'atomic flags' and 32 bit unsigned integers. If the platform
      efficiently supports atomic 64 bit unsigned integers those are also
      provided.
      
      To implement atomics support for a platform/architecture/compiler for
      a type of atomics 32bit compare and exchange needs to be
      implemented. If available and more efficient native support for flags,
      32 bit atomic addition, and corresponding 64 bit operations may also
      be provided. Additional useful atomic operations are implemented
      generically ontop of these.
      
      The implementation for various versions of gcc, msvc and sun studio have
      been tested. Additional existing stub implementations for
      * Intel icc
      * HUPX acc
      * IBM xlc
      are included but have never been tested. These will likely require
      fixes based on buildfarm and user feedback.
      
      As atomic operations also require barriers for some operations the
      existing barrier support has been moved into the atomics code.
      
      Author: Andres Freund with contributions from Oskari Saarenmaa
      Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera
      Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,
          20131015123303.GH5300@awork2.anarazel.de,
          20131028205522.GI20248@awork2.anarazel.de
      b64d92f1
  27. Sep 18, 2014
    • Andres Freund's avatar
      Fix configure check for %z printf support after INT64_MODIFIER changes. · 7e3f7283
      Andres Freund authored
      The PGAC_FUNC_SNPRINTF_SIZE_T_SUPPORT test was broken by
      ce486056. Among others it made the UINT64_FORMAT macro to be
      defined in c.h, instead of directly being defined by configure.
      
      This lead to the replacement printf being used on all platforms for a
      while. Which seems to work, because this was only used due to
      different profiles ;)
      
      Fix by relying on INT64_MODIFIER instead.
      7e3f7283
  28. Sep 14, 2014
  29. Aug 29, 2014
    • Noah Misch's avatar
      Always use our getaddrinfo.c on Windows. · ec544a65
      Noah Misch authored
      Commit a16bac36 let "configure" detect
      the system getaddrinfo() when building under 64-bit MinGW-w64.  However,
      src/include/port/win32/sys/socket.h assumes all native Windows
      configurations use our replacement.  This change placates buildfarm
      member jacana until we establish a plan for getaddrinfo() on Windows.
      ec544a65
  30. Aug 21, 2014
  31. Aug 11, 2014
    • Heikki Linnakangas's avatar
      Break out OpenSSL-specific code to separate files. · 680513ab
      Heikki Linnakangas authored
      This refactoring is in preparation for adding support for other SSL
      implementations, with no user-visible effects. There are now two #defines,
      USE_OPENSSL which is defined when building with OpenSSL, and USE_SSL which
      is defined when building with any SSL implementation. Currently, OpenSSL is
      the only implementation so the two #defines go together, but USE_SSL is
      supposed to be used for implementation-independent code.
      
      The libpq SSL code is changed to use a custom BIO, which does all the raw
      I/O, like we've been doing in the backend for a long time. That makes it
      possible to use MSG_NOSIGNAL to block SIGPIPE when using SSL, which avoids
      a couple of syscall for each send(). Probably doesn't make much performance
      difference in practice - the SSL encryption is expensive enough to mask the
      effect - but it was a natural result of this refactoring.
      
      Based on a patch by Martijn van Oosterhout from 2006. Briefly reviewed by
      Alvaro Herrera, Andreas Karlsson, Jeff Janes.
      680513ab
  32. Jul 26, 2014
Loading