Re: Is there a way to build PostgreSQL client libraries with MinGW

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Xiaobo Gu <guxiaobo1982(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Is there a way to build PostgreSQL client libraries with MinGW
Date: 2011-01-27 13:51:16
Message-ID: AANLkTi=J2JNi7QZc=LuNCo4QZ=woQNvJw7mSYcY98a8e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thu, Jan 27, 2011 at 7:31 AM, Xiaobo Gu <guxiaobo1982(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Dunstan 2011-01-27 14:01:25 Re: Is there a way to build PostgreSQL client libraries with MinGW
Previous Message moa 2011-01-27 13:38:52 Re: BUG #5807: psql fails to launch with "Cannot read termcap database; using dumb terminal settings. Aborted"

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-01-27 14:01:25 Re: Is there a way to build PostgreSQL client libraries with MinGW
Previous Message Dimitri Fontaine 2011-01-27 13:48:08 Re: Extensions support for pg_dump, patch v27