Re: [HACKERS] [PATCH] Better way to check for getaddrinfo function.

From: "R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: [HACKERS] [PATCH] Better way to check for getaddrinfo function.
Date: 2006-01-24 09:03:13
Message-ID: 5CBFB210D9870F40B9E5A0FBD31F3A7703391442@bgeexc01.asiapacific.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Its not a macro.
I meant that the code generated by AC_REPLACE_FUNCS([getaddrinfo]) by
configure.in for "configure"
does not have "#include <netdb.h>". Hence function is not
detected(unresolved getaddrinfo).
Hence I thought AC_TRY_LINK could give test program instead of
AC_REPLACE_FUNCS taking one.

$ diff -r configure.in configure.in.new
918a919
> AC_MSG_CHECKING([for getaddrinfo])
920c921,926
< AC_REPLACE_FUNCS([getaddrinfo])
---
> AC_TRY_LINK([#include <netdb.h> #include <assert.h>],
> [char (*f)();f=getaddrinfo;],
> ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no)
> if test x"$ac_cv_func_getaddrinfo" = xyes; then
> AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo
function])
> fi
923a930
> AC_MSG_RESULT([$ac_cv_func_getaddrinfo])

Regards,
Rajesh R
--
This space intentionally left non-blank.

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Tuesday, January 17, 2006 8:34 PM
To: R, Rajesh (STSD)
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] [GENERAL] [PATCH] Better way to check for
getaddrinfo function.

"R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com> writes:
> But the bottomline is the default test does not include <netdb.h> in
> the test code.

That's odd. Is getaddrinfo a macro on Tru64? If so, the appropriate
patch would probably make the test look more like the tests for finite()
and friends:

dnl Cannot use AC_CHECK_FUNC because finite may be a macro
AC_MSG_CHECKING(for finite) AC_TRY_LINK([ #include <math.h> double
glob_double; ],
[return finite(glob_double) ? 0 : 1;],
[AC_DEFINE(HAVE_FINITE, 1, [Define to 1 if you have
finite().]) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])

regards, tom lane

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2006-01-24 09:04:43 Re: Does this look ethical to you?
Previous Message Agnes Bocchino 2006-01-24 08:31:26 Re: Initdb panic: invalid record offset at 0/0 creating

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-01-24 09:15:42 Re: [HACKERS] [PATCH] Better way to check for getaddrinfo function.
Previous Message Christopher Kings-Lynne 2006-01-24 09:03:02 Cache lookup failed error in tsearch2?