mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Probe for preadv/pwritev in a more macOS-friendly way.
Apple's mechanism for dealing with functions that are available in only some OS versions confuses AC_CHECK_FUNCS, and therefore AC_REPLACE_FUNCS. We can use AC_CHECK_DECLS instead, so long as we enable -Werror=unguarded-availability-new. This allows people compiling for macOS to control whether or not preadv/pwritev are used by setting MACOSX_DEPLOYMENT_TARGET, rather than supplying a back-rev SDK. (Of course, the latter still works, too.) James Hilliard Discussion: https://postgr.es/m/20210122193230.25295-1-james.hilliard1@gmail.com
This commit is contained in:
11
configure.ac
11
configure.ac
@ -494,6 +494,9 @@ if test "$GCC" = yes -a "$ICC" = no; then
|
||||
AC_SUBST(PERMIT_DECLARATION_AFTER_STATEMENT)
|
||||
# Really don't want VLAs to be used in our dialect of C
|
||||
PGAC_PROG_CC_CFLAGS_OPT([-Werror=vla])
|
||||
# On macOS, complain about usage of symbols newer than the deployment target
|
||||
PGAC_PROG_CC_CFLAGS_OPT([-Werror=unguarded-availability-new])
|
||||
PGAC_PROG_CXX_CFLAGS_OPT([-Werror=unguarded-availability-new])
|
||||
# -Wvla is not applicable for C++
|
||||
PGAC_PROG_CC_CFLAGS_OPT([-Wendif-labels])
|
||||
PGAC_PROG_CXX_CFLAGS_OPT([-Wendif-labels])
|
||||
@ -1749,6 +1752,12 @@ AC_CHECK_DECLS(posix_fadvise, [], [], [#include <fcntl.h>])
|
||||
|
||||
AC_CHECK_DECLS(fdatasync, [], [], [#include <unistd.h>])
|
||||
AC_CHECK_DECLS([strlcat, strlcpy, strnlen])
|
||||
|
||||
# We can't use AC_REPLACE_FUNCS to replace these functions, because it
|
||||
# won't handle deployment target restrictions on macOS
|
||||
AC_CHECK_DECLS([preadv], [], [AC_LIBOBJ(preadv)], [#include <sys/uio.h>])
|
||||
AC_CHECK_DECLS([pwritev], [], [AC_LIBOBJ(pwritev)], [#include <sys/uio.h>])
|
||||
|
||||
# This is probably only present on macOS, but may as well check always
|
||||
AC_CHECK_DECLS(F_FULLFSYNC, [], [], [#include <fcntl.h>])
|
||||
|
||||
@ -1784,9 +1793,7 @@ AC_REPLACE_FUNCS(m4_normalize([
|
||||
link
|
||||
mkdtemp
|
||||
pread
|
||||
preadv
|
||||
pwrite
|
||||
pwritev
|
||||
random
|
||||
srandom
|
||||
strlcat
|
||||
|
Reference in New Issue
Block a user