summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2000-08-26 21:11:45 +0000
committerPeter Eisentraut <peter_e@gmx.net>2000-08-26 21:11:45 +0000
commit662f6a557cbcaf977cdd8b58bc627ac2a8aa82d5 (patch)
treecfa6c7b0ceda09880d3f623ef71fc010fed58da2 /config
parentc42f82d428173c4b293551d8d25eee4d9e9c8792 (diff)
downloadpostgresql-662f6a557cbcaf977cdd8b58bc627ac2a8aa82d5.tar.gz
Fix AC_FUNC_ACCEPT_ARGTYPES to accept `const struct sockaddr *' as second
argument, change the order of tests for the third argument to be safe against missing prototypes, and make it fail hard if none of the combinations succeed.
Diffstat (limited to 'config')
-rw-r--r--config/ac_func_accept_argtypes.m423
1 files changed, 12 insertions, 11 deletions
diff --git a/config/ac_func_accept_argtypes.m4 b/config/ac_func_accept_argtypes.m4
index f6b2a9ae1b..049d9e254d 100644
--- a/config/ac_func_accept_argtypes.m4
+++ b/config/ac_func_accept_argtypes.m4
@@ -1,4 +1,4 @@
-# $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
+# $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.2 2000/08/26 21:11:45 petere Exp $
# This comes from the official Autoconf macro archive at
# <http://research.cys.de/autoconf-archive/>
# (I removed the $ before the Id CVS keyword below.)
@@ -29,6 +29,9 @@ dnl
# use the macro to define a corresponding variable. We also make the
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
# as well (i.e., anywhere POSIX.2 has socklen_t).
+#
+# arg2 can also be `const' (e.g., RH 4.2). Change the order of tests
+# for arg3 so that `int' is first, in case there is no prototype at all.
AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
[AC_MSG_CHECKING([types of arguments for accept()])
@@ -36,28 +39,26 @@ AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
[for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
- for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
- for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
- AC_TRY_COMPILE(dnl
+ for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
+ for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int'; do
+ AC_TRY_COMPILE(
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
-extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
- [ac_not_found=no ; break 3], ac_not_found=yes)
+extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],
+ [], [ac_not_found=no; break 3], [ac_not_found=yes])
done
done
done
+ if test "$ac_not_found" = yes; then
+ AC_MSG_ERROR([could not determine argument types])
+ fi
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
])dnl AC_CACHE_VAL
- if test "$ac_not_found" = yes; then
- ac_cv_func_accept_arg1=int
- ac_cv_func_accept_arg2='struct sockaddr *'
- ac_cv_func_accept_arg3='socklen_t'
- fi
AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)