1- # $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.4 2002/03/29 17:32 :53petere Exp $
1+ # $Header: /cvsroot/pgsql/config/ac_func_accept_argtypes.m4,v 1.5 2003/09/07 03:43 :53momjian 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.)
77dnl @synopsis AC_FUNC_ACCEPT_ARGTYPES
88dnl
99dnl Checks the data types of the three arguments to accept(). Results are
10- dnl placed into the symbols ACCEPT_TYPE_ARG[123],consistent with the
11- dnl following example:
10+ dnl placed into the symbolsACCEPT_TYPE_RETURN and ACCEPT_TYPE_ARG[123],
11+ dnl consistent with the following example:
1212dnl
13+ dnl #define ACCEPT_TYPE_RETURN int
1314dnl #define ACCEPT_TYPE_ARG1 int
1415dnl #define ACCEPT_TYPE_ARG2 struct sockaddr *
1516dnl #define ACCEPT_TYPE_ARG3 socklen_t
3637# Solaris 7 and 8 have arg3 as 'void *' (disguised as 'Psocklen_t'
3738# which is *not* 'socklen_t *'). If we detect that, then we assume
3839# 'int' as the result, because that ought to work best.
40+ #
41+ # On Win32, accept() returns 'unsigned int PASCAL'
3942
4043AC_DEFUN ( [ AC_FUNC_ACCEPT_ARGTYPES] ,
4144[ AC_MSG_CHECKING ( [ types of arguments for accept()] )
42- AC_CACHE_VAL ( ac_cv_func_accept_arg1 ,dnl
43- [ AC_CACHE_VAL ( ac_cv_func_accept_arg2 ,dnl
44- [ AC_CACHE_VAL ( ac_cv_func_accept_arg3 ,dnl
45- [ for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
46- for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
47- for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
48- AC_TRY_COMPILE (
45+ AC_CACHE_VAL ( ac_cv_func_accept_return ,dnl
46+ [ AC_CACHE_VAL ( ac_cv_func_accept_arg1 ,dnl
47+ [ AC_CACHE_VAL ( ac_cv_func_accept_arg2 ,dnl
48+ [ AC_CACHE_VAL ( ac_cv_func_accept_arg3 ,dnl
49+ [ for ac_cv_func_accept_return in 'int' 'unsigned int PASCAL'; do
50+ for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
51+ for ac_cv_func_accept_arg2 in 'struct sockaddr *' 'const struct sockaddr *' 'void *'; do
52+ for ac_cv_func_accept_arg3 in 'int' 'size_t' 'socklen_t' 'unsigned int' 'void'; do
53+ AC_TRY_COMPILE (
4954[ #ifdef HAVE_SYS_TYPES_H
5055#include <sys/types.h>
5156#endif
5257#ifdef HAVE_SYS_SOCKET_H
5358#include <sys/socket.h>
5459#endif
55- extern int accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);] ,
56- [ ] ,[ ac_not_found=no; break 3] ,[ ac_not_found=yes] )
60+ extern $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *);] ,
61+ [ ] ,[ ac_not_found=no; break 4] ,[ ac_not_found=yes] )
62+ done
5763 done
5864 done
5965 done
@@ -63,10 +69,13 @@ extern int accept ($ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func
6369 if test "$ac_cv_func_accept_arg3" = "void"; then
6470 ac_cv_func_accept_arg3=int
6571 fi
72+ ] ) dnl AC_CACHE_VAL
6673] ) dnl AC_CACHE_VAL
6774] ) dnl AC_CACHE_VAL
6875] ) dnl AC_CACHE_VAL
69- AC_MSG_RESULT ( [ $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *] )
76+ AC_MSG_RESULT ( [ $ac_cv_func_accept_return, $ac_cv_func_accept_arg1, $ac_cv_func_accept_arg2, $ac_cv_func_accept_arg3 *] )
77+ AC_DEFINE_UNQUOTED ( ACCEPT_TYPE_RETURN ,$ac_cv_func_accept_return ,
78+ [ Define to the return type of 'accept'] )
7079AC_DEFINE_UNQUOTED ( ACCEPT_TYPE_ARG1 ,$ac_cv_func_accept_arg1 ,
7180[ Define to the type of arg 1 of 'accept'] )
7281AC_DEFINE_UNQUOTED ( ACCEPT_TYPE_ARG2 ,$ac_cv_func_accept_arg2 ,