Skip to content
Snippets Groups Projects
  1. Oct 07, 2016
    • Tom Lane's avatar
      Fix python shlib probe for Cygwin. · 17a3a1eb
      Tom Lane authored
      On buildfarm member cockatiel, that library is in /usr/bin.
      (Possibly we should look at $PATH on this platform?)
      Per off-list report from Andrew Dunstan.
      17a3a1eb
  2. Oct 06, 2016
    • Tom Lane's avatar
      Try to fix python shlib probe for MinGW. · 11c0e743
      Tom Lane authored
      Per discussion with Andrew Dunstan, it seems there are three peculiarities
      of the Python installation on MinGW (or at least, of the instance on
      buildfarm member frogmouth).  First, the library name doesn't contain
      "2.7" but just "27".  It looks like we can deal with that by consulting
      get_config_vars('VERSION') to see whether a dot should be used or not.
      Second, the library might be in c:/Windows/System32, analogously to it
      possibly being in /usr/lib on Unix-oid platforms.  Third, it's apparently
      not standard to use the prefix "lib" on the file name.  This patch will
      accept files with or without "lib", but the first part of that may well
      be dead code.
      11c0e743
  3. Oct 05, 2016
    • Tom Lane's avatar
      In python shlib probe, cater for OpenBSD, which omits the .so symlink. · ddd4f82c
      Tom Lane authored
      Most Unix-oid platforms provide a symlink "libfoo.so" -> "libfoo.so.n.n"
      to allow the linker to resolve a reference "-lfoo" to a version-numbered
      shared library.  OpenBSD has apparently hacked ld(1) to do this internally,
      because there are no such symlinks to be found in their library
      directories.  Tweak the new code in PGAC_CHECK_PYTHON_EMBED_SETUP to cope.
      Per buildfarm member curculio.
      ddd4f82c
  4. Oct 04, 2016
    • Tom Lane's avatar
      Huh, we do need to look in $python_configdir for the Python shlib. · fc76259f
      Tom Lane authored
      Debian does it that way, for no doubt what seems to them a good reason.
      Thanks to Aidan Van Dyk for confirmation.
      fc76259f
    • Tom Lane's avatar
      Improve (I hope) our autolocation of the Python shared library. · 46ddbbb1
      Tom Lane authored
      Older versions of Python produce garbage (or at least useless) values of
      get_config_vars('LDLIBRARY').  Newer versions produce garbage (or at least
      useless) values of get_config_vars('SO'), which was defeating our configure
      logic that attempted to identify where the Python shlib really is.  The net
      result, at least with a stock Python 3.5 installation on macOS, was that
      we were linking against a static library in the mistaken belief that it was
      a shared library.  This managed to work, if you count statically absorbing
      libpython into plpython.so as working.  But it no longer works as of commit
      d51924be, because now we get separate static copies of libpython in
      plpython.so and hstore_plpython.so, and those can't interoperate on the
      same data.  There are some other infelicities like assuming that nobody
      ever installs a private version of Python on a macOS machine.
      
      Hence, forget about looking in $python_configdir for the Python shlib;
      as far as I can tell no version of Python has ever put one there, and
      certainly no currently-supported version does.  Also, rather than relying
      on get_config_vars('SO'), just try all the possibilities for shlib
      extensions.  Also, rather than trusting Py_ENABLE_SHARED, believe we've
      found a shlib only if it has a recognized extension.  Last, explicitly
      cope with the possibility that the shlib is really in /usr/lib and
      $python_libdir is a red herring --- this is the actual situation on older
      macOS, but we were only accidentally working with it.
      
      Discussion: <5300.1475592228@sss.pgh.pa.us>
      46ddbbb1
  5. Sep 30, 2016
  6. Sep 25, 2016
    • Tom Lane's avatar
      Refer to OS X as "macOS", except for the port name which is still "darwin". · da6c4f6c
      Tom Lane authored
      We weren't terribly consistent about whether to call Apple's OS "OS X"
      or "Mac OS X", and the former is probably confusing to people who aren't
      Apple users.  Now that Apple has rebranded it "macOS", follow their lead
      to establish a consistent naming pattern.  Also, avoid the use of the
      ancient project name "Darwin", except as the port code name which does not
      seem desirable to change.  (In short, this patch touches documentation and
      comments, but no actual code.)
      
      I didn't touch contrib/start-scripts/osx/, either.  I suspect those are
      obsolete and due for a rewrite, anyway.
      
      I dithered about whether to apply this edit to old release notes, but
      those were responsible for quite a lot of the inconsistencies, so I ended
      up changing them too.  Anyway, Apple's being ahistorical about this,
      so why shouldn't we be?
      da6c4f6c
  7. May 06, 2016
  8. May 02, 2016
    • Tom Lane's avatar
      Fix configure's incorrect version tests for flex and perl. · 7d7b1292
      Tom Lane authored
      awk's equality-comparison operator is "==" not "=".  We got this right
      in many places, but not in configure's checks for supported version
      numbers of flex and perl.  It hadn't been noticed because unsupported
      versions are so old as to be basically extinct in the wild, and because
      the only consequence is whether or not a WARNING flies by during
      configure.
      
      Daniel Gustafsson noted the problem with respect to the test for flex,
      I found the other by reviewing other awk calls.
      7d7b1292
  9. Apr 02, 2016
  10. Mar 15, 2016
    • Tom Lane's avatar
      Cope if platform declares mbstowcs_l(), but not locale_t, in <xlocale.h>. · 0e9b8998
      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.
      0e9b8998
  11. Mar 13, 2016
    • Tom Lane's avatar
      Mop-up for setting minimum Tcl version to 8.4. · 9da70efc
      Tom Lane authored
      Commit e2609323 set the minimum Tcl version we support to 8.4, but
      I forgot to adjust the documentation to say the same.  Some nosing
      around for other consequences found that the configure script could
      be simplified slightly as well.
      9da70efc
  12. Dec 11, 2015
  13. Nov 18, 2015
    • Tom Lane's avatar
      Accept flex > 2.5.x in configure. · 32f15d05
      Tom Lane authored
      Per buildfarm member anchovy, 2.6.0 exists in the wild now.
      Hopefully it works with Postgres; if not, we'll have to do something
      about that, but in any case claiming it's "too old" is pretty silly.
      32f15d05
  14. Oct 08, 2015
    • Robert Haas's avatar
      Add BSWAP64 macro. · c171818b
      Robert Haas authored
      This is like BSWAP32, but for 64-bit values.  Since we've got two of
      them now and they have use cases (like sortsupport) beyond CRCs, move
      the definitions to their own header file.
      
      Peter Geoghegan
      c171818b
  15. Aug 31, 2015
    • Tom Lane's avatar
      Remove support for Unix systems without the POSIX signal APIs. · a65e0864
      Tom Lane authored
      Remove configure's checks for HAVE_POSIX_SIGNALS, HAVE_SIGPROCMASK, and
      HAVE_SIGSETJMP.  These APIs are required by the Single Unix Spec v2
      (POSIX 1997), which we generally consider to define our minimum required
      set of Unix APIs.  Moreover, no buildfarm member has reported not having
      them since 2012 or before, which means that even if the code is still live
      somewhere, it's untested --- and we've made plenty of signal-handling
      changes of late.  So just take these APIs as given and save the cycles for
      configure probes for them.
      
      However, we can't remove as much C code as I'd hoped, because the Windows
      port evidently still uses the non-POSIX code paths for signal masking.
      Since we're largely emulating these BSD-style APIs for Windows anyway, it
      might be a good thing to switch over to POSIX-like notation and thereby
      remove a few more #ifdefs.  But I'm not in a position to code or test that.
      In the meantime, we can at least make things a bit more transparent by
      testing for WIN32 explicitly in these places.
      a65e0864
  16. Aug 19, 2015
  17. Aug 17, 2015
    • Andres Freund's avatar
      Improve configure test for the sse4.2 crc instruction. · 6cf72879
      Andres Freund authored
      With optimizations enabled at least one compiler, clang 3.7, optimized
      away the crc intrinsics knowing that the result went on unused and has
      no side effects. That can trigger errors in code generation when the
      intrinsic is used, as we chose to use the intrinsics without any
      additional compiler flag. Return the computed value to prevent that.
      
      With some more pedantic warning flags (-Wold-style-definition) the
      configure test failed to recognize the existence of _mm_crc32_u*
      intrinsics due to an independent warning in the test because the test
      turned on -Werror, but that's not actually needed here.
      
      Discussion: 20150814092039.GH4955@awork2.anarazel.de
      Backpatch: 9.5, where the use of crc intrinsics was integrated.
      6cf72879
  18. 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
  19. 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
    • Noah Misch's avatar
      Blacklist xlc 32-bit inlining. · c53f7387
      Noah Misch authored
      Per a suggestion from Tom Lane.  Back-patch to 9.0 (all supported
      versions).  While only 9.4 and up have code known to elicit this
      compiler bug, we were disabling inlining by accident until commit
      43d89a23.
      c53f7387
  20. Jul 08, 2015
    • 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
  21. Jul 02, 2015
    • 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
  22. 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
  23. May 03, 2015
  24. May 02, 2015
    • 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
  25. 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
      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
  26. 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
  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 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
  29. Nov 23, 2014
  30. 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
  31. 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
  32. Aug 21, 2014
  33. Jul 26, 2014
  34. Jul 01, 2014
    • Tom Lane's avatar
      Remove some useless code in the configure script. · 2e8ce9ae
      Tom Lane authored
      Almost ten years ago, commit e48322a6 broke
      the logic in ACX_PTHREAD by looping through all the possible flags rather
      than stopping with the first one that would work.  This meant that
      $acx_pthread_ok was no longer meaningful after the loop; it would usually
      be "no", whether or not we'd found working thread flags.  The reason nobody
      noticed is that Postgres doesn't actually use any of the symbols set up
      by the code after the loop.  Rather than complicate things some more to
      make it work as designed, let's just remove all that dead code, and thereby
      save a few cycles in each configure run.
      2e8ce9ae
  35. Jun 04, 2014
    • Peter Eisentraut's avatar
      Silence Bison deprecation warnings · 55fb759a
      Peter Eisentraut authored
      Bison >=3.0 issues warnings about
      
          %name-prefix="base_yy"
      
      instead of the now preferred
      
          %name-prefix "base_yy"
      
      but the latter doesn't work with Bison 2.3 or less.  So for now we
      silence the deprecation warnings.
      55fb759a
Loading