Hi,

>
> > AC_CHECK_DECL would detect inet_pton etc., because it only looks for the
> > declaration in a header. The macro I submitted works almost exactly like
> > AC_CHECK_DECL but defines HAVE_symbol instead of HAVE_DECL_symbol.
>
> Not good enough.  I want to be sure that the symbol is there, and that
> we actually have the right libraries (so maybe a double check "the symbol
> is there, but we cannot link, so fail" might be even better).
>

Agree with the "not good enough" part. But every AC_CHECK_FUNC test is also
equally not good enough. Headers are not included (and cannot be included,
the way it works), so no guarantee that the  detected symbol is the right
one. But the purpose of autoconf is to only to get heuristics that may to
combined with other independent knowledge about the OS to make a decision.


> > > Which environments did you test this on?  It needs to work on mingw as
> > I use debian jessie, but it should work elsewhere.
> >
> > > shipped with ubuntu 12.04 (no inet_pton), mingw as shipped with 14.04
> > > (inet_pton, *and* the definition its using conflicts with our compat/
> > > libraries, so a false negative will fail later) and cygwin.
>
> Well, the reason why I pointed out these two is that they are different
> regarding header file brokenness - I'm not sure I remember the details,
> but stuff that broke for me on 12.04 worked for samuli on 14.04.
>

I don't think AC_FUNC_CHECK can detect intet_pton in any version of windows
API. It just tries to link

(all defines so far goes here)
char inet_pton();
int main()
{
  return inet_pton();
}

That will succeed on linux, fail on windows (cross compiled or otherwise).

This test is "not good enough" even on linux/unix --- the ultimate test is
building of the application which will fail if the detected inet_pton
symbol was something else.


>
> So it's building a test program that does this?
>
> #include <ws2tcpip.h>
> main()
> {
>   (void) inet_ntop;
> }
>
> ... which shouldn't compile at all...?
>

Make it "int main" , and add a return 0; (both provided by AC_COMPILE..)
That will compile for vista, but fail for winxp (which doesn't have
inet_ntop). The actual test will also include all defines so far, but
that's details.


> > If you prefer I can rewrite the macro completely in terms of
> AC_CHECK_DECL
>
> Convince me that it improves things :-)
>

I think the current macro already improves things :) Except that it shows
how the test is done.

Just as AC_CHECK_FUNC hides all the gory details (or absence of details),
use of .._DECL it will hide the program that will be tested :) I said that
just because one seldom questions macros included in autoconf distribution.


>
> Right now, it makes stuff *less* clear to the autoconf-non-enlightened,
> like me.  I do understand the check that we have


That opinion may change after looking through configure to see how any
function is checked for.


> no, I do not understand

your stuff (quite obvious from my dumb questions)...
>

The first time skimming through a configure script generated by autoconf is
kind of shocking. Over time one gets used to it, no enlightenment...

(I agree that we shouldn't force-define HAVE_POLL if we don't use that
> stuff on windows at all - so I'm happy to see such things just go out...)


Totally agree..

Selva

Reply via email to