Skip to content

Commit 5963c9a

Browse files
committed
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> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
1 parent 2b1f580 commit 5963c9a

File tree

7 files changed

+15
-27
lines changed

7 files changed

+15
-27
lines changed

configure

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16715,19 +16715,6 @@ esac
1671516715

1671616716
fi
1671716717

16718-
ac_fn_c_check_func "$LINENO" "link" "ac_cv_func_link"
16719-
if test "x$ac_cv_func_link" = xyes; then :
16720-
$as_echo "#define HAVE_LINK 1" >>confdefs.h
16721-
16722-
else
16723-
case " $LIBOBJS " in
16724-
*" link.$ac_objext "* ) ;;
16725-
*) LIBOBJS="$LIBOBJS link.$ac_objext"
16726-
;;
16727-
esac
16728-
16729-
fi
16730-
1673116718
ac_fn_c_check_func "$LINENO" "mkdtemp" "ac_cv_func_mkdtemp"
1673216719
if test "x$ac_cv_func_mkdtemp" = xyes; then :
1673316720
$as_echo "#define HAVE_MKDTEMP 1" >>confdefs.h
@@ -17059,6 +17046,12 @@ esac
1705917046
;;
1706017047
esac
1706117048

17049+
case " $LIBOBJS " in
17050+
*" win32link.$ac_objext "* ) ;;
17051+
*) LIBOBJS="$LIBOBJS win32link.$ac_objext"
17052+
;;
17053+
esac
17054+
1706217055
case " $LIBOBJS " in
1706317056
*" win32ntdll.$ac_objext "* ) ;;
1706417057
*) LIBOBJS="$LIBOBJS win32ntdll.$ac_objext"

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,6 @@ AC_REPLACE_FUNCS(m4_normalize([
18771877
getopt
18781878
getpeereid
18791879
inet_aton
1880-
link
18811880
mkdtemp
18821881
pread
18831882
pwrite
@@ -1957,6 +1956,7 @@ if test "$PORTNAME" = "win32"; then
19571956
AC_LIBOBJ(win32dlopen)
19581957
AC_LIBOBJ(win32env)
19591958
AC_LIBOBJ(win32error)
1959+
AC_LIBOBJ(win32link)
19601960
AC_LIBOBJ(win32ntdll)
19611961
AC_LIBOBJ(win32security)
19621962
AC_LIBOBJ(win32setlocale)

src/include/pg_config.h.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,6 @@
334334
/* Define to 1 if you have the `zstd' library (-lzstd). */
335335
#undef HAVE_LIBZSTD
336336

337-
/* Define to 1 if you have the `link' function. */
338-
#undef HAVE_LINK
339-
340337
/* Define to 1 if the system has the type `locale_t'. */
341338
#undef HAVE_LOCALE_T
342339

src/include/port.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ extern float pg_strtof(const char *nptr, char **endptr);
402402
#define strtof(a,b) (pg_strtof((a),(b)))
403403
#endif
404404

405-
#ifndef HAVE_LINK
405+
#ifdef WIN32
406+
/* src/port/win32link.c */
406407
extern int link(const char *src, const char *dst);
407408
#endif
408409

src/port/link.c renamed to src/port/win32link.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
/*-------------------------------------------------------------------------
22
*
3-
* link.c
3+
* win32link.c
44
*
55
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
66
* Portions Copyright (c) 1994, Regents of the University of California
77
*
88
*
99
* IDENTIFICATION
10-
* src/port/link.c
10+
* src/port/win32link.c
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
1414

1515
#include "c.h"
1616

17-
#ifdef WIN32
18-
1917
int
2018
link(const char *src, const char *dst)
2119
{
@@ -31,5 +29,3 @@ link(const char *src, const char *dst)
3129
else
3230
return 0;
3331
}
34-
35-
#endif

src/tools/msvc/Mkvcbuild.pm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,15 @@ sub mkvcbuild
103103
getpeereid.c getrusage.c inet_aton.c
104104
getaddrinfo.c gettimeofday.c inet_net_ntop.c kill.c open.c
105105
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
106-
dirent.c getopt.c getopt_long.c link.c
106+
dirent.c getopt.c getopt_long.c
107107
pread.c preadv.c pwrite.c pwritev.c pg_bitutils.c
108108
pg_strong_random.c pgcheckdir.c pgmkdirp.c pgsleep.c pgstrcasecmp.c
109109
pqsignal.c mkdtemp.c qsort.c qsort_arg.c bsearch_arg.c quotes.c system.c
110110
strerror.c tar.c
111111
win32dlopen.c
112-
win32env.c win32error.c win32ntdll.c
112+
win32env.c win32error.c
113+
win32link.c
114+
win32ntdll.c
113115
win32security.c win32setlocale.c win32stat.c);
114116

115117
push(@pgportfiles, 'strtof.c') if ($vsVersion < '14.00');

src/tools/msvc/Solution.pm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ sub GenerateFiles
306306
HAVE_LIBXSLT => undef,
307307
HAVE_LIBZ => $self->{options}->{zlib} ? 1 : undef,
308308
HAVE_LIBZSTD => undef,
309-
HAVE_LINK => undef,
310309
HAVE_LOCALE_T => 1,
311310
HAVE_LONG_INT_64 => undef,
312311
HAVE_LONG_LONG_INT_64 => 1,

0 commit comments

Comments
 (0)