mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix configure probe for sys/ucred.h.
The configure script's test for <sys/ucred.h> did not work on OpenBSD,
because on that platform <sys/param.h> has to be included first.
As a result, socket peer authentication was disabled on that platform.
Problem introduced in commit be4585b1c2.
Andres Freund, slightly simplified by me.
			
			
This commit is contained in:
		
							
								
								
									
										76
									
								
								configure
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								configure
									
									
									
									
										vendored
									
									
								
							@@ -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 <sys/param.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#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 <sys/socket.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#ifdef HAVE_SYS_UCRED_H
 | 
			
		||||
#include <sys/ucred.h>
 | 
			
		||||
#endif
 | 
			
		||||
@@ -17853,6 +17920,7 @@ cat confdefs.h >>conftest.$ac_ext
 | 
			
		||||
cat >>conftest.$ac_ext <<_ACEOF
 | 
			
		||||
/* end confdefs.h.  */
 | 
			
		||||
#include <sys/socket.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#ifdef HAVE_SYS_UCRED_H
 | 
			
		||||
#include <sys/ucred.h>
 | 
			
		||||
#endif
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										14
									
								
								configure.in
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								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 <sys/param.h>
 | 
			
		||||
])
 | 
			
		||||
 | 
			
		||||
# 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 <sys/socket.h>
 | 
			
		||||
#include <sys/param.h>
 | 
			
		||||
#ifdef HAVE_SYS_UCRED_H
 | 
			
		||||
#include <sys/ucred.h>
 | 
			
		||||
#endif])
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user