Re: Is there a way to build PostgreSQL client libraries with MinGW - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Is there a way to build PostgreSQL client libraries with MinGW
Date
Msg-id AANLkTi=J2JNi7QZc=LuNCo4QZ=woQNvJw7mSYcY98a8e@mail.gmail.com
Whole thread Raw
In response to Re: Is there a way to build PostgreSQL client libraries with MinGW  (Xiaobo Gu <guxiaobo1982@gmail.com>)
Responses Re: Is there a way to build PostgreSQL client libraries with MinGW  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
On Thu, Jan 27, 2011 at 7:31 AM, Xiaobo Gu <guxiaobo1982@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


pgsql-hackers by date:

Previous
From: Dimitri Fontaine
Date:
Subject: Re: Extensions support for pg_dump, patch v27
Next
From: Andrew Dunstan
Date:
Subject: Re: Is there a way to build PostgreSQL client libraries with MinGW