On Fri, 10 Aug 2001, Sterling Hughes wrote:
> On Thu, 9 Aug 2001, Justin Erenkrantz wrote:
>
> > [ This message belongs at [email protected] not new-httpd ]
> >
> > On Thu, Aug 09, 2001 at 05:46:40AM -0500, [EMAIL PROTECTED] wrote:
> > > Between Solaris, HP-UX, AIX, Tru64 UNIX, and IRIX, there are three
> > > possibilities for the number of arguments to gethostbyname_r: 3, 5, 6.
> > >
> > > I think the test to determine the number of arguments in
> > > apr_network.m4 is inadequate. The ones used by the cURL program
> > > (http://curl.haxx.se) seem far more robust in that it uses AC_TRY_RUN
> > > to determine the correct number of arguments rather than a modified
> > > AC_TRY_COMPILE.
> >
> > I believe that AC_TRY_COMPILE_NO_WARNING is the correct test to use
> > here. We have already determined that the gethostbyname_r function
> > exists - we do not need to link or run a test program. If we have
> > the wrong arguments to the function, we will receive a compiler
> > warning and we will fail the test. I do not see what the additional
> > steps of the AC_TRY_RUN test will give us.
> >
> > You may be correct that the names are slightly misleading. However,
> > Sterling originally intended those values to be indicative of what
> > the style was rather than how many arguments. Personally, I don't
> > care much about names. No one is ever happy with our names anyway.
> > Feel free to submit a patch that changes the #defines names if you
> > want. -- justin
> >
>
> I've actually investigated cURL's solution, it was one of the
> bases for my research. You don't need to use AC_TRY_RUN in this
> case, its simple, if it compiles without warnings -- it works. Yes,
> there are cases where gethostbyname is broken, but there should be
> an extra check for that -- and AC_TRY_RUN() won't pick up this error
> anyway.
Sorry for replying to my own message, let me just clarify this:
curl's version of the gethostbyname_r() tries to resolve localhost
in AC_TRY_RUN(), on some systems, localhost doesn't resolve, thus
AC_TRY_RUN() will fail, even when the argument order is correct.
Therefore you need an additional check, to see whether localhost
resolvers.
> The approach in the apr_network.m4, shows the style of the
> arguments,not the number of arguments. I prefer specifying style,
> because it makes more sense to me that way ("ohh, ok, this is how its
> done on glibc2 systems". :)
>
> -Sterling
>
>