v2-0006-Remove-configure-probe-for-link.patch
text/x-patch
Filename: v2-0006-Remove-configure-probe-for-link.patch
Type: text/x-patch
Part: 5
Patch
Format: format-patch
Series: patch v2-0006
Subject: Remove configure probe for link.
| File | + | − |
|---|---|---|
| configure | 6 | 13 |
| configure.ac | 1 | 1 |
| src/include/pg_config.h.in | 0 | 3 |
| src/include/port.h | 2 | 1 |
| src/port/win32link.c | 1 | 5 |
| src/tools/msvc/Mkvcbuild.pm | 4 | 2 |
| src/tools/msvc/Solution.pm | 0 | 1 |
From 196ba828c4b63b8c79cbb2546ab0c08a1f1b82db Mon Sep 17 00:00:00 2001
From: Thomas Munro <thomas.munro@gmail.com>
Date: Sun, 24 Jul 2022 01:19:05 +1200
Subject: [PATCH v2 06/13] Remove configure probe for link.
link() is in SUSv2 and all targeted Unix systems have it. We have
replacement code for Windows that doesn't require a configure probe.
Since only Windows needs it, rename src/port/link.c to win32link.c like
other similar things.
There is no need for a vestigial HAVE_LINK macro, because we expect all
Unix and, with our replacement function, Windows systems to have it, so
we didn't have any tests around link() usage.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
---
configure | 19 ++++++-------------
configure.ac | 2 +-
src/include/pg_config.h.in | 3 ---
src/include/port.h | 3 ++-
src/port/{link.c => win32link.c} | 6 +-----
src/tools/msvc/Mkvcbuild.pm | 6 ++++--
src/tools/msvc/Solution.pm | 1 -
7 files changed, 14 insertions(+), 26 deletions(-)
rename src/port/{link.c => win32link.c} (93%)
diff --git a/configure b/configure
index 88189754c3..d86a8db1ff 100755
--- a/configure
+++ b/configure
@@ -16739,19 +16739,6 @@ esac
fi
-ac_fn_c_check_func "$LINENO" "link" "ac_cv_func_link"
-if test "x$ac_cv_func_link" = xyes; then :
- $as_echo "#define HAVE_LINK 1" >>confdefs.h
-
-else
- case " $LIBOBJS " in
- *" link.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS link.$ac_objext"
- ;;
-esac
-
-fi
-
ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"
if test "x$ac_cv_func_mkdtemp" = xyes; then :
$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h
@@ -17083,6 +17070,12 @@ esac
;;
esac
+ case " $LIBOBJS " in
+ *" win32link.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS win32link.$ac_objext"
+ ;;
+esac
+
case " $LIBOBJS " in
*" win32ntdll.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32ntdll.$ac_objext"
diff --git a/configure.ac b/configure.ac
index 0ad072f092..9d2d338a65 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1879,7 +1879,6 @@ AC_REPLACE_FUNCS(m4_normalize([
getopt
getpeereid
inet_aton
- link
mkdtemp
pread
pwrite
@@ -1959,6 +1958,7 @@ if test "$PORTNAME" = "win32"; then
AC_LIBOBJ(win32dlopen)
AC_LIBOBJ(win32env)
AC_LIBOBJ(win32error)
+ AC_LIBOBJ(win32link)
AC_LIBOBJ(win32ntdll)
AC_LIBOBJ(win32security)
AC_LIBOBJ(win32setlocale)
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index 61634347d5..ba9d702101 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -342,9 +342,6 @@
/* Define to 1 if you have the `zstd' library (-lzstd). */
#undef HAVE_LIBZSTD
-/* Define to 1 if you have the `link' function. */
-#undef HAVE_LINK
-
/* Define to 1 if the system has the type `locale_t'. */
#undef HAVE_LOCALE_T
diff --git a/src/include/port.h b/src/include/port.h
index f3eece40f3..090f34ed60 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -402,7 +402,8 @@ extern float pg_strtof(const char *nptr, char **endptr);
#define strtof(a,b) (pg_strtof((a),(b)))
#endif
-#ifndef HAVE_LINK
+#ifdef WIN32
+/* src/port/win32link.c */
extern int link(const char *src, const char *dst);
#endif
diff --git a/src/port/link.c b/src/port/win32link.c
similarity index 93%
rename from src/port/link.c
rename to src/port/win32link.c
index 1e0ccd4648..e8556bbfad 100644
--- a/src/port/link.c
+++ b/src/port/win32link.c
@@ -7,15 +7,13 @@
*
*
* IDENTIFICATION
- * src/port/link.c
+ * src/port/win32link.c
*
*-------------------------------------------------------------------------
*/
#include "c.h"
-#ifdef WIN32
-
int
link(const char *src, const char *dst)
{
@@ -31,5 +29,3 @@ link(const char *src, const char *dst)
else
return 0;
}
-
-#endif
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
index 266f98e2ed..1ffe6e66d5 100644
--- a/src/tools/msvc/Mkvcbuild.pm
+++ b/src/tools/msvc/Mkvcbuild.pm
@@ -103,13 +103,15 @@ sub mkvcbuild
getpeereid.c getrusage.c inet_aton.c
getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
- dirent.c getopt.c getopt_long.c link.c
+ dirent.c getopt.c getopt_long.c
pread.c preadv.c pwrite.c pwritev.c pg_bitutils.c
pg_strong_random.c pgcheckdir.c pgmkdirp.c pgsleep.c pgstrcasecmp.c
pqsignal.c mkdtemp.c qsort.c qsort_arg.c bsearch_arg.c quotes.c system.c
strerror.c tar.c
win32dlopen.c
- win32env.c win32error.c win32ntdll.c
+ win32env.c win32error.c
+ win32link.c
+ win32ntdll.c
win32security.c win32setlocale.c win32stat.c);
push(@pgportfiles, 'strtof.c') if ($vsVersion < '14.00');
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 5030f63e9a..d904f42d53 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -308,7 +308,6 @@ sub GenerateFiles
HAVE_LIBXSLT => undef,
HAVE_LIBZ => $self->{options}->{zlib} ? 1 : undef,
HAVE_LIBZSTD => undef,
- HAVE_LINK => undef,
HAVE_LOCALE_T => 1,
HAVE_LONG_INT_64 => undef,
HAVE_LONG_LONG_INT_64 => 1,
--
2.35.1