From 7f0bc6b448e70f18b9ff35be3a90444542d09d08 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 25 Jul 2013 11:39:11 -0400 Subject: [PATCH] Fix configure probe for sys/ucred.h. The configure script's test for did not work on OpenBSD, because on that platform has to be included first. As a result, socket peer authentication was disabled on that platform. Problem introduced in commit be4585b1c27ac5dbdd0d61740d18f7ad9a00e268. Andres Freund, slightly simplified by me. --- configure | 76 +++++++++++++++++++++++++++++++++++++++++++++++++--- configure.in | 14 +++++++--- 2 files changed, 83 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 2dcce50f93..42b9072150 100755 --- a/configure +++ b/configure @@ -10351,8 +10351,7 @@ done - -for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h +for ac_header in crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h do as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then @@ -10503,7 +10502,7 @@ fi done -# On BSD, cpp test for net/if.h will fail unless sys/socket.h +# On BSD, test for net/if.h will fail unless sys/socket.h # is included first. for ac_header in net/if.h @@ -10572,7 +10571,74 @@ fi done -# At least on IRIX, cpp test for netinet/tcp.h will fail unless +# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h +# is included first. + +for ac_header in sys/ucred.h +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include + + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# At least on IRIX, test for netinet/tcp.h will fail unless # netinet/in.h is included first. for ac_header in netinet/in.h @@ -17815,6 +17881,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include +#include #ifdef HAVE_SYS_UCRED_H #include #endif @@ -17853,6 +17920,7 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include +#include #ifdef HAVE_SYS_UCRED_H #include #endif diff --git a/configure.in b/configure.in index 6d7a471a62..1baabd8550 100644 --- a/configure.in +++ b/configure.in @@ -982,9 +982,9 @@ AC_SUBST(OSSP_UUID_LIBS) ## dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES -AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/ucred.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) +AC_CHECK_HEADERS([crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) -# On BSD, cpp test for net/if.h will fail unless sys/socket.h +# On BSD, test for net/if.h will fail unless sys/socket.h # is included first. AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT @@ -993,7 +993,14 @@ AC_CHECK_HEADERS(net/if.h, [], [], #endif ]) -# At least on IRIX, cpp test for netinet/tcp.h will fail unless +# On OpenBSD, test for sys/ucred.h will fail unless sys/param.h +# is included first. +AC_CHECK_HEADERS(sys/ucred.h, [], [], +[AC_INCLUDES_DEFAULT +#include +]) + +# At least on IRIX, test for netinet/tcp.h will fail unless # netinet/in.h is included first. AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADERS(netinet/tcp.h, [], [], @@ -1133,6 +1140,7 @@ PGAC_TYPE_LOCALE_T AC_CHECK_TYPES([struct cmsgcred], [], [], [#include +#include #ifdef HAVE_SYS_UCRED_H #include #endif]) -- 2.40.0