Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 662f6a5

Browse files
committed
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.
1 parent c42f82d commit 662f6a5

File tree

3 files changed

+199
-199
lines changed

3 files changed

+199
-199
lines changed

aclocal.m4

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.3 2000/06/14 18:17:24 petere Exp $
1+
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.4 2000/08/26 21:11:44 petere Exp $
22
# This comes from the official Autoconf macro archive at
33
# <http://research.cys.de/autoconf-archive/>
44
# (I removed the $ before the Id CVS keyword below.)
@@ -29,42 +29,43 @@ dnl
2929
# use the macro to define a corresponding variable. We also make the
3030
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
3131
# as well (i.e., anywhere POSIX.2 has socklen_t).
32+
#
33+
# arg2 can also be `const' (e.g., RH 4.2). Change the order of tests
34+
# for arg3 so that `int' is first, in case there is no prototype at all.
3235

3336
AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
3437
[AC_MSG_CHECKING([types of arguments for accept()])
3538
AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
3639
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
3740
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
3841
[for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
39-
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
40-
for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
41-
AC_TRY_COMPILE(dnl
42+
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
43+
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int'; do
44+
AC_TRY_COMPILE(
4245
[#ifdef HAVE_SYS_TYPES_H
4346
#include <sys/types.h>
4447
#endif
4548
#ifdef HAVE_SYS_SOCKET_H
4649
#include <sys/socket.h>
4750
#endif
48-
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
49-
[ac_not_found=no ; break 3], ac_not_found=yes)
51+
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],
52+
[], [ac_not_found=no; break 3], [ac_not_found=yes])
5053
done
5154
done
5255
done
56+
if test "$ac_not_found" = yes; then
57+
AC_MSG_ERROR([could not determine argument types])
58+
fi
5359
])dnl AC_CACHE_VAL
5460
])dnl AC_CACHE_VAL
5561
])dnl AC_CACHE_VAL
56-
if test "$ac_not_found" = yes; then
57-
ac_cv_func_accept_arg1=int
58-
ac_cv_func_accept_arg2='struct sockaddr *'
59-
ac_cv_func_accept_arg3='socklen_t'
60-
fi
6162
AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
6263
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
6364
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)
6465
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG3,$ac_cv_func_accept_arg3)
6566
])
6667
# Macros to detect C compiler features
67-
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.3 2000/06/14 18:17:24 petere Exp $
68+
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.4 2000/08/26 21:11:44 petere Exp $
6869

6970

7071
# PGAC_C_SIGNED
@@ -184,7 +185,7 @@ undefine([AC_TYPE_NAME])dnl
184185
undefine([AC_CV_NAME])dnl
185186
])# PGAC_CHECK_ALIGNOF
186187
# Macros that test various C library quirks
187-
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.3 2000/06/14 18:17:24 petere Exp $
188+
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.4 2000/08/26 21:11:44 petere Exp $
188189

189190

190191
# PGAC_VAR_INT_TIMEZONE
@@ -263,7 +264,7 @@ fi
263264
HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
264265
AC_SUBST(HAVE_POSIX_SIGNALS)])# PGAC_FUNC_POSIX_SIGNALS
265266
# Macros to detect certain C++ features
266-
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.3 2000/06/14 18:17:24 petere Exp $
267+
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.4 2000/08/26 21:11:44 petere Exp $
267268

268269

269270
# PGAC_CLASS_STRING
@@ -332,7 +333,7 @@ fi])# PGAC_CXX_NAMESPACE_STD
332333
#
333334
# Autoconf macros for configuring the build of Python extension modules
334335
#
335-
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.3 2000/06/14 18:17:24 petere Exp $
336+
# $Header: /cvsroot/pgsql/aclocal.m4,v 1.4 2000/08/26 21:11:44 petere Exp $
336337
#
337338

338339
# PGAC_PROG_PYTHON

config/ac_func_accept_argtypes.m4

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.1 2000/06/11 11:39:46 petere Exp $
1+
# $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.2 2000/08/26 21:11:45 petere Exp $
22
# This comes from the official Autoconf macro archive at
33
# <http://research.cys.de/autoconf-archive/>
44
# (I removed the $ before the Id CVS keyword below.)
@@ -29,35 +29,36 @@ dnl
2929
# use the macro to define a corresponding variable. We also make the
3030
# reasonable(?) assumption that you can use arg3 for getsocktype etc.
3131
# as well (i.e., anywhere POSIX.2 has socklen_t).
32+
#
33+
# arg2 can also be `const' (e.g., RH 4.2). Change the order of tests
34+
# for arg3 so that `int' is first, in case there is no prototype at all.
3235

3336
AC_DEFUN(AC_FUNC_ACCEPT_ARGTYPES,
3437
[AC_MSG_CHECKING([types of arguments for accept()])
3538
AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
3639
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
3740
[AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl
3841
[for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
39-
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'void *'; do
40-
for ac_cv_func_accept_arg3 in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
41-
AC_TRY_COMPILE(dnl
42+
for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
43+
for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int'; do
44+
AC_TRY_COMPILE(
4245
[#ifdef HAVE_SYS_TYPES_H
4346
#include <sys/types.h>
4447
#endif
4548
#ifdef HAVE_SYS_SOCKET_H
4649
#include <sys/socket.h>
4750
#endif
48-
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],,dnl
49-
[ac_not_found=no ; break 3], ac_not_found=yes)
51+
extern accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);],
52+
[], [ac_not_found=no; break 3], [ac_not_found=yes])
5053
done
5154
done
5255
done
56+
if test "$ac_not_found" = yes; then
57+
AC_MSG_ERROR([could not determine argument types])
58+
fi
5359
])dnl AC_CACHE_VAL
5460
])dnl AC_CACHE_VAL
5561
])dnl AC_CACHE_VAL
56-
if test "$ac_not_found" = yes; then
57-
ac_cv_func_accept_arg1=int
58-
ac_cv_func_accept_arg2='struct sockaddr *'
59-
ac_cv_func_accept_arg3='socklen_t'
60-
fi
6162
AC_MSG_RESULT([$ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *])
6263
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG1,$ac_cv_func_accept_arg1)
6364
AC_DEFINE_UNQUOTED(ACCEPT_TYPE_ARG2,$ac_cv_func_accept_arg2)

0 commit comments

Comments
 (0)