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

Lists: pgsql-generalpgsql-hackers
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: [PATCH] Better way to check for getaddrinfo function.
Date: 2006-01-17 07:07:17
Message-ID: 5CBFB210D9870F40B9E5A0FBD31F3A77032F72F7@bgeexc01.asiapacific.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-hackers


That was very much situation specific.
But the bottomline is the default test does not include <netdb.h> in the
test code.
So, pg uses getaddrinfo.c.And the getaddrinfo.c does not work for me.
Ipv6 client authenciation fails.

I have modified the patch.

$ 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])

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

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

"R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com> writes:
> Just thought that the following patch might improve checking for
> getaddrinfo function (in configure.in)

Since AC_TRY_RUN tests cannot work in cross-compilation scenarios, you
need an *extremely* good reason to put one in. "I thought this might
improve things" doesn't qualify. Exactly what problem are you trying to
solve and why is a run-time test necessary? Why doesn't the existing
coding work for you?

regards, tom lane <<configure-in.patch>>

Attachment Content-Type Size
configure-in.patch application/octet-stream 499 bytes

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

"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


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [PATCH] Better way to check for getaddrinfo function.
Date: 2006-01-19 21:56:17
Message-ID: 200601192156.k0JLuHe29360@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-hackers


Where are we on this? Rajesh, I think we are waiting for more
information from you.

---------------------------------------------------------------------------

R, Rajesh (STSD) wrote:
>
> That was very much situation specific.
> But the bottomline is the default test does not include <netdb.h> in the
> test code.
> So, pg uses getaddrinfo.c.And the getaddrinfo.c does not work for me.
> Ipv6 client authenciation fails.
>
> I have modified the patch.
>
> $ 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])
>
>
> Rajesh R
> --
> This space intentionally left non-blank.
>
> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Monday, January 16, 2006 11:28 PM
> To: R, Rajesh (STSD)
> Cc: pgsql-hackers(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] [PATCH] Better way to check for getaddrinfo
> function.
>
> "R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com> writes:
> > Just thought that the following patch might improve checking for
> > getaddrinfo function (in configure.in)
>
> Since AC_TRY_RUN tests cannot work in cross-compilation scenarios, you
> need an *extremely* good reason to put one in. "I thought this might
> improve things" doesn't qualify. Exactly what problem are you trying to
> solve and why is a run-time test necessary? Why doesn't the existing
> coding work for you?
>
> regards, tom lane <<configure-in.patch>>

Content-Description: configure-in.patch

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073