Skip to content
Snippets Groups Projects
  1. Feb 06, 2017
  2. Oct 24, 2016
  3. Sep 15, 2016
    • Heikki Linnakangas's avatar
      Fix building with LibreSSL. · 48e5ba61
      Heikki Linnakangas authored
      LibreSSL defines OPENSSL_VERSION_NUMBER to claim that it is version 2.0.0,
      but it doesn't have the functions added in OpenSSL 1.1.0. Add autoconf
      checks for the individual functions we need, and stop relying on
      OPENSSL_VERSION_NUMBER.
      
      Backport to 9.5 and 9.6, like the patch that broke this. In the
      back-branches, there are still a few OPENSSL_VERSION_NUMBER checks left,
      to check for OpenSSL 0.9.8 or 0.9.7. I left them as they were - LibreSSL
      has all those functions, so they work as intended.
      
      Per buildfarm member curculio.
      
      Discussion: <2442.1473957669@sss.pgh.pa.us>
      48e5ba61
    • Heikki Linnakangas's avatar
      Support OpenSSL 1.1.0. · e2838c58
      Heikki Linnakangas authored
      Changes needed to build at all:
      
      - Check for SSL_new in configure, now that SSL_library_init is a macro.
      - Do not access struct members directly. This includes some new code in
        pgcrypto, to use the resource owner mechanism to ensure that we don't
        leak OpenSSL handles, now that we can't embed them in other structs
        anymore.
      - RAND_SSLeay() -> RAND_OpenSSL()
      
      Changes that were needed to silence deprecation warnings, but were not
      strictly necessary:
      
      - RAND_pseudo_bytes() -> RAND_bytes().
      - SSL_library_init() and OpenSSL_config() -> OPENSSL_init_ssl()
      - ASN1_STRING_data() -> ASN1_STRING_get0_data()
      - DH_generate_parameters() -> DH_generate_parameters()
      - Locking callbacks are not needed with OpenSSL 1.1.0 anymore. (Good
        riddance!)
      
      Also change references to SSLEAY_VERSION_NUMBER with OPENSSL_VERSION_NUMBER,
      for the sake of consistency. OPENSSL_VERSION_NUMBER has existed since time
      immemorial.
      
      Fix SSL test suite to work with OpenSSL 1.1.0. CA certificates must have
      the "CA:true" basic constraint extension now, or OpenSSL will refuse them.
      Regenerate the test certificates with that. The "openssl" binary, used to
      generate the certificates, is also now more picky, and throws an error
      if an X509 extension is specified in "req_extensions", but that section
      is empty.
      
      Backpatch to 9.5 and 9.6, per popular demand. The file structure was
      somewhat different in earlier branches, so I didn't bother to go further
      than that. In back-branches, we still support OpenSSL 0.9.7 and above.
      OpenSSL 0.9.6 should still work too, but I didn't test it. In master, we
      only support 0.9.8 and above.
      
      Patch by Andreas Karlsson, with additional changes by me.
      
      Discussion: <20160627151604.GD1051@msg.df7cb.de>
      e2838c58
  4. Aug 08, 2016
  5. May 09, 2016
  6. Mar 28, 2016
  7. Mar 15, 2016
    • Tom Lane's avatar
      Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>. · b4ce97aa
      Tom Lane authored
      Previously, we included <xlocale.h> only if necessary to get the definition
      of type locale_t.  According to notes in PGAC_TYPE_LOCALE_T, this is
      important because on some versions of glibc that file supplies an
      incompatible declaration of locale_t.  (This info may be obsolete, because
      on my RHEL6 box that seems to be the *only* definition of locale_t; but
      there may still be glibc's in the wild for which it's a live concern.)
      
      It turns out though that on FreeBSD and maybe other BSDen, you can get
      locale_t from stdlib.h or locale.h but mbstowcs_l() and friends only from
      <xlocale.h>.  This was leaving us compiling calls to mbstowcs_l() and
      friends with no visible prototype, which causes a warning and could
      possibly cause actual trouble, since it's not declared to return int.
      
      Hence, adjust the configure checks so that we'll include <xlocale.h>
      either if it's necessary to get type locale_t or if it's necessary to
      get a declaration of mbstowcs_l().
      
      Report and patch by Aleksander Alekseev, somewhat whacked around by me.
      Back-patch to all supported branches, since we have been using
      mbstowcs_l() since 9.1.
      b4ce97aa
  8. Feb 08, 2016
  9. Jan 04, 2016
  10. Dec 16, 2015
    • Tom Lane's avatar
      Cope with Readline's failure to track SIGWINCH events outside of input. · f1c15286
      Tom Lane authored
      It emerges that libreadline doesn't notice terminal window size change
      events unless they occur while collecting input.  This is easy to stumble
      over if you resize the window while using a pager to look at query output,
      but it can be demonstrated without any pager involvement.  The symptom is
      that queries exceeding one line are misdisplayed during subsequent input
      cycles, because libreadline has the wrong idea of the screen dimensions.
      
      The safest, simplest way to fix this is to call rl_reset_screen_size()
      just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)
      for every command; but since it only happens when reading from a tty, the
      performance impact should be negligible.  A more valid objection is that
      this still leaves a tiny window during entry to readline() wherein delivery
      of SIGWINCH will be missed; but the practical consequences of that are
      probably negligible.  In any case, there doesn't seem to be any good way to
      avoid the race, since readline exposes no functions that seem safe to call
      from a generic signal handler --- rl_reset_screen_size() certainly isn't.
      
      It turns out that we also need an explicit rl_initialize() call, else
      rl_reset_screen_size() dumps core when called before the first readline()
      call.
      
      rl_reset_screen_size() is not present in old versions of libreadline,
      so we need a configure test for that.  (rl_initialize() is present at
      least back to readline 4.0, so we won't bother with a test for it.)
      We would need a configure test anyway since libedit's emulation of
      libreadline doesn't currently include such a function.  Fortunately,
      libedit seems not to have any corresponding bug.
      
      Merlin Moncure, adjusted a bit by me
      f1c15286
  11. Dec 15, 2015
  12. Nov 09, 2015
  13. Oct 05, 2015
  14. Aug 03, 2015
  15. Jul 17, 2015
    • Noah Misch's avatar
      AIX: Test the -qlonglong option before use. · eb3b93b5
      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).
      eb3b93b5
  16. Jul 09, 2015
  17. Jul 08, 2015
    • Heikki Linnakangas's avatar
      Move pthread-tests earlier in the autoconf script. · 080c4dab
      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.
      080c4dab
    • Heikki Linnakangas's avatar
      Replace our hacked version of ax_pthread.m4 with latest upstream version. · ce0da626
      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.
      ce0da626
  18. Jul 05, 2015
    • Tom Lane's avatar
      Make numeric form of PG version number readily available in Makefiles. · d1fec374
      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.
      
      Back-patch of commit a5d489cc, so that this
      variable is actually useful for its intended purpose sometime before 2020.
      
      Michael Paquier, reviewed by Pavel Stehule
      d1fec374
  19. Jun 30, 2015
  20. Jun 29, 2015
  21. 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
  22. Apr 14, 2015
    • 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
  23. 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
  24. 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
  25. Mar 15, 2015
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. Jan 06, 2015
  32. Nov 23, 2014
  33. Nov 02, 2014
  34. Oct 25, 2014
Loading