summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2020-03-28 13:01:42 +0100
committerPeter Eisentraut <peter@eisentraut.org>2020-03-28 15:01:01 +0100
commit8f3ec75de4060d86176ad4ac998eeb87a39748c2 (patch)
treee24395a83963db1716ce89da7c75e150f439edfb /config
parent87779aa47463d0fb3b4743a7d5c9534994bf7c98 (diff)
downloadpostgresql-8f3ec75de4060d86176ad4ac998eeb87a39748c2.tar.gz
Enable Unix-domain sockets support on Windows
As of Windows 10 version 1803, Unix-domain sockets are supported on Windows. But it's not automatically detected by configure because it looks for struct sockaddr_un and Windows doesn't define that. So we just make our own definition on Windows and override the configure result. Set DEFAULT_PGSOCKET_DIR to empty on Windows so by default no Unix-domain socket is used, because there is no good standard location. In pg_upgrade, we have to do some extra tweaking to preserve the existing behavior of not using Unix-domain sockets on Windows. Adding support would be desirable, but it needs further work, in particular a way to select whether to use Unix-domain sockets from the command-line or with a run-time test. The pg_upgrade test script needs a fix. The previous code passed "localhost" to postgres -k, which only happened to work because Windows used to ignore the -k argument value altogether. We instead need to pass an empty string to get the desired effect. The test suites will continue to not use Unix-domain sockets on Windows. This requires a small tweak in pg_regress.c. The TAP tests don't need to be changed because they decide by the operating system rather than HAVE_UNIX_SOCKETS. Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
Diffstat (limited to 'config')
-rw-r--r--config/c-library.m45
1 files changed, 3 insertions, 2 deletions
diff --git a/config/c-library.m4 b/config/c-library.m4
index d9a31d7664..163ad5742d 100644
--- a/config/c-library.m4
+++ b/config/c-library.m4
@@ -102,10 +102,11 @@ AC_DEFUN([PGAC_UNION_SEMUN],
# PGAC_STRUCT_SOCKADDR_UN
# -----------------------
-# If `struct sockaddr_un' exists, define HAVE_UNIX_SOCKETS.
+# If `struct sockaddr_un' exists, define HAVE_STRUCT_SOCKADDR_UN.
+# If it is missing then one could define it.
# (Requires test for <sys/un.h>!)
AC_DEFUN([PGAC_STRUCT_SOCKADDR_UN],
-[AC_CHECK_TYPE([struct sockaddr_un], [AC_DEFINE(HAVE_UNIX_SOCKETS, 1, [Define to 1 if you have unix sockets.])], [],
+[AC_CHECK_TYPES([struct sockaddr_un], [], [],
[#include <sys/types.h>
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>