]> git.ipfire.org Git - thirdparty/lldpd.git/commit
configure: check for `res_init()` before trying other forms.
authorVincent Bernat <bernat@luffy.cx>
Fri, 12 Jul 2013 22:07:16 +0000 (00:07 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sat, 13 Jul 2013 00:21:18 +0000 (02:21 +0200)
commitd0a033727caad9731e4d7628eaba3c02b9ba8b47
tree5cee5c0f75adc92c11a600305e654ceda7a8f118
parentba09084d47643b630f3705242c1e6761d0412c46
configure: check for `res_init()` before trying other forms.

On OSX, `res_init()` is a symbol of `libsystem_info` (a dependency of
`libSystem`). So, AC_SEARCH_LIBS directly finds this symbol without an
additional library. However, once you include `resolv.h`, this becomes
a macro to `res_9_init` which is a symbol of `libresolv`. So you need
to link to `libresolv`. This is why we test first for `res_9_init` and
only after for `res_init`.

See more info about this here:
 http://blog.achernya.com/2013/03/os-x-has-silly-libsystem.html

However, on other systems, this will link to libbind while this is not
needed because `res_9_init` is a symbol of libbind while `res_init` is
correctly defined in `libc` and no odd redefinition.

So, the solution is to force `AC_SEARCH_LIBS` to include `resolv.h`
and only test for `res_init` (as a symbol or a macro, we don't
care). This is done by redefining `AC_LANG_CALL(C)` to include
`resolv.h`.
configure.ac
src/daemon/priv.c