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

From: "R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
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:40:18
Message-ID: 5CBFB210D9870F40B9E5A0FBD31F3A770339148E@bgeexc01.asiapacific.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-patches

sorry. It is a macro.

so, would it be better to check for the macro
as suggested by Tom or go with this 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])

I guess, instead of adding seperate code for macro checking as suggested
by Tom, this might serve dual purpose.

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

-----Original Message-----
From: Martijn van Oosterhout [mailto:kleptog(at)svana(dot)org]
Sent: Tuesday, January 24, 2006 2:46 PM
To: R, Rajesh (STSD)
Cc: Tom Lane; pgsql-hackers(at)postgresql(dot)org; pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] [GENERAL] [PATCH] Better way to check for
getaddrinfo function.

On Tue, Jan 24, 2006 at 02:33:13PM +0530, R, Rajesh (STSD) wrote:
> 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.

But if it isn't a macro, why do you need the header file? In C it's
perfectly legal to declare the symbol yourself and try to link and it
should work *unless* it's normally a macro.

We're still missing some necessary understanding here...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is
> a tool for doing 5% of the work and then sitting around waiting for
> someone else to do the other 95% so you can sue them.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2006-01-24 09:45:16 Re: Updating rows (automatically) that are selected
Previous Message Dave Page 2006-01-24 09:25:42 Re: Does this look ethical to you?

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2006-01-24 09:57:44 Re: Surrogate keys (Was: enums)
Previous Message Joachim Wieland 2006-01-24 09:27:58 Re: [HACKERS] CIDR/INET improvements

Browse pgsql-patches by date

  From Date Subject
Next Message Gustavo Tonini 2006-01-24 10:17:22 Re: [PATCHES] postmaster/postgres merge for testing
Previous Message Joachim Wieland 2006-01-24 09:27:58 Re: [HACKERS] CIDR/INET improvements