@@ -7194,6 +7194,12 @@ $as_echo "#define PROFILE_PID_DIR 1" >>confdefs.h
71947194 fi
71957195fi
71967196
7197+ # On Solaris, we need this #define to get POSIX-conforming versions
7198+ # of many interfaces (sigwait, getpwuid_r, ...).
7199+ if test "$PORTNAME" = "solaris"; then
7200+ CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
7201+ fi
7202+
71977203# We already have this in Makefile.win32, but configure needs it too
71987204if test "$PORTNAME" = "win32"; then
71997205 CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
@@ -11296,9 +11302,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
1129611302 # set thread flags
1129711303
1129811304# Some platforms use these, so just define them. They can't hurt if they
11299- # are not supported. For example, on Solaris -D_POSIX_PTHREAD_SEMANTICS
11300- # enables 5-arg getpwuid_r, among other things.
11301- PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
11305+ # are not supported.
11306+ PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE"
1130211307
1130311308# Check for *_r functions
1130411309_CFLAGS="$CFLAGS"
@@ -15861,9 +15866,11 @@ $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
1586115866fi
1586215867
1586315868
15864- # posix_fadvise() is a no-op on Solaris, so don't incur function overhead
15865- # by calling it, 2009-04-02
15866- # http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
15869+ # Make sure there's a declaration for sigwait(), then make sure
15870+ # that it conforms to the POSIX standard (there seem to still be
15871+ # some platforms out there with pre-POSIX sigwait()). On Solaris,
15872+ # _POSIX_PTHREAD_SEMANTICS affects the result, but we already
15873+ # added that to CPPFLAGS.
1586715874# The Clang compiler raises a warning for an undeclared identifier that matches
1586815875# a compiler builtin function. All extant Clang versions are affected, as of
1586915876# Clang 3.6.0. Test a builtin known to every version. This problem affects the
@@ -15952,6 +15959,62 @@ case $ac_cv_c_decl_report in
1595215959 *) ac_c_decl_warn_flag= ;;
1595315960esac
1595415961
15962+ ac_fn_c_check_decl "$LINENO" "sigwait" "ac_cv_have_decl_sigwait" "#include <signal.h>
15963+ "
15964+ if test "x$ac_cv_have_decl_sigwait" = xyes; then :
15965+ ac_have_decl=1
15966+ else
15967+ ac_have_decl=0
15968+ fi
15969+
15970+ cat >>confdefs.h <<_ACEOF
15971+ #define HAVE_DECL_SIGWAIT $ac_have_decl
15972+ _ACEOF
15973+
15974+ if test "x$ac_cv_have_decl_sigwait" = xyes; then
15975+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX-conforming sigwait declaration" >&5
15976+ $as_echo_n "checking for POSIX-conforming sigwait declaration... " >&6; }
15977+ if ${pgac_cv_have_posix_decl_sigwait+:} false; then :
15978+ $as_echo_n "(cached) " >&6
15979+ else
15980+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
15981+ /* end confdefs.h. */
15982+
15983+ #include <signal.h>
15984+ int sigwait(const sigset_t *set, int *sig);
15985+
15986+ int
15987+ main ()
15988+ {
15989+
15990+ ;
15991+ return 0;
15992+ }
15993+ _ACEOF
15994+ if ac_fn_c_try_compile "$LINENO"; then :
15995+ pgac_cv_have_posix_decl_sigwait=yes
15996+ else
15997+ pgac_cv_have_posix_decl_sigwait=no
15998+ fi
15999+ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
16000+ fi
16001+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_have_posix_decl_sigwait" >&5
16002+ $as_echo "$pgac_cv_have_posix_decl_sigwait" >&6; }
16003+ fi
16004+ if test "x$pgac_cv_have_posix_decl_sigwait" = xyes; then
16005+
16006+ $as_echo "#define HAVE_POSIX_DECL_SIGWAIT 1" >>confdefs.h
16007+
16008+ else
16009+ # On non-Windows, libpq requires POSIX sigwait() for thread safety.
16010+ if test "$enable_thread_safety" = yes -a "$PORTNAME" != "win32"; then
16011+ as_fn_error $? "POSIX-conforming sigwait is required to enable thread safety." "$LINENO" 5
16012+ fi
16013+ fi
16014+
16015+ # posix_fadvise() is a no-op on Solaris, so don't incur function overhead
16016+ # by calling it, 2009-04-02
16017+ # http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
1595516018if test "$PORTNAME" != "solaris"; then :
1595616019
1595716020for ac_func in posix_fadvise
0 commit comments