Re: How to properly check for -lresolv and resolv.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 13, 2021 at 4:53 PM Dan Mahoney (Gushi)
<danm@xxxxxxxxxxxxxxx> wrote:
>
> Hey there,
>
> I've just quelled a bunch of obselscence warnings for 2.70/2.71 in
> OpenDMARC, so now I'm looking at the rest of it.
>
> In our project, we're doing the following to detect if we need -lresolv
> (bottom of mail).
...
> So there seems to be a good way to quiesce the need for resolv.h but not
> -lresolv.  This feels disjoint.  Am I missing something?

There isn't a built-in macro for -lresolv/-lbind, but you could
express MTR's construct more concisely with AC_SEARCH_LIBS:

    AC_HEADER_RESOLV

    AC_SEARCH_LIBS([res_query], [-lresolv -lbind], [],
      [AC_SEARCH_LIBS([__res_query], [-lresolv -lbind], [],
        [AC_MSG_ERROR([No resolver library found])])])

    AC_SEARCH_LIBS([dn_expand], [-lresolv -lbind], [],
        [AC_MSG_ERROR([No resolver library found])])

And then you could follow that up with a single AC_COMPILE_IFELSE with
the test program you're using today, to verify that everything you
need is available.

I would hesitate to add a macro that did this, because I don't know if
programs consistently always need the same functions from libresolv.

zw




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux