On Thu, Jan 27, 2011 at 7:31 AM, Xiaobo Gu <guxiaobo1...@gmail.com> wrote:
> 20:25 <jon_y>: please contact psql and ask for a list of accept()
> implementations checked

It looks like we check each argument and the return type for a couple
of possibilities:

argument 1 can be int or unsigned int
argument 2 can be struct sockaddr * or const struct sockaddr * or void *
argument 3 can be int * or size_t * or socklen_t * or unsigned int * or void *
the return type can be int or unsigned int PASCAL

Here's the code:

AC_DEFUN([AC_FUNC_ACCEPT_ARGTYPES],
[AC_MSG_CHECKING([types of arguments for accept()])
 AC_CACHE_VAL(ac_cv_func_accept_return,dnl
 [AC_CACHE_VAL(ac_cv_func_accept_arg1,dnl
[AC_CACHE_VAL(ac_cv_func_accept_arg2,dnl
   [AC_CACHE_VAL(ac_cv_func_accept_arg3,dnl    [for
ac_cv_func_accept_return in 'int' 'unsigned int PASCAL'; do
      for ac_cv_func_accept_arg1 in 'int' 'unsigned int'; do
       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'
'void'; 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 $ac_cv_func_accept_return accept ($ac_cv_func_accept_arg1, $ac_cv_func_ac
cept_arg2, $ac_cv_func_accept_arg3 *);],
         [], [ac_not_found=no; break 4], [ac_not_found=yes])
       done
      done
     done
    done
    if test "$ac_not_found" = yes; then
      AC_MSG_ERROR([could not determine argument types])
    fi
    if test "$ac_cv_func_accept_arg3" = "void"; then
      ac_cv_func_accept_arg3=int
    fi    ])dnl AC_CACHE_VAL
   ])dnl AC_CACHE_VAL
  ])dnl AC_CACHE_VAL
 ])dnl AC_CACHE_VAL

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to