<p>Jaco Kroon has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17703">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix misdetection of gethostbyname_r() on NetBSD<br><br>NetBSD includes gethostbyname_r() as an internal libc symbol that<br>is not exposed in system headers and that is incompatible with other<br>implementations.  Perform the symbol check only if the declaration<br>is found in the public header.<br><br>MichaƂ supplied me with this patch to submit.<br><br>Change-Id: Iafa359b09908251bcd299ff54be003ea129b9eda<br>Signed-off-by: Jaco Kroon <jaco@uls.co.za><br>---<br>M configure.ac<br>1 file changed, 30 insertions(+), 20 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/17703/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/configure.ac b/configure.ac</span><br><span>index 9bae413..d6aa306 100644</span><br><span>--- a/configure.ac</span><br><span>+++ b/configure.ac</span><br><span>@@ -943,28 +943,38 @@</span><br><span>              AC_MSG_RESULT(no)</span><br><span> )</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# some systems already have gethostbyname_r so we don't need to build ours in main/utils.c</span><br><span style="color: hsl(0, 100%, 40%);">-AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)</span><br><span style="color: hsl(0, 100%, 40%);">-AC_LINK_IFELSE(</span><br><span style="color: hsl(0, 100%, 40%);">-        [AC_LANG_PROGRAM([#include <stdlib.h></span><br><span style="color: hsl(0, 100%, 40%);">-                         #include <netdb.h>],</span><br><span style="color: hsl(0, 100%, 40%);">-                        [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])],</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_MSG_RESULT(yes)</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_MSG_RESULT(no)</span><br><span style="color: hsl(120, 100%, 40%);">+# NetBSD libc ships with an internal-only incompatible symbol gethostbyname_r</span><br><span style="color: hsl(120, 100%, 40%);">+AC_CHECK_DECLS(gethostbyname_r,</span><br><span style="color: hsl(120, 100%, 40%);">+        [have_gethostbyname_r_public_declaration=yes],</span><br><span style="color: hsl(120, 100%, 40%);">+        [have_gethostbyname_r_public_declaration=no],</span><br><span style="color: hsl(120, 100%, 40%);">+        [#include <stdlib.h></span><br><span style="color: hsl(120, 100%, 40%);">+         #include <netdb.h>]</span><br><span> )</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)</span><br><span style="color: hsl(0, 100%, 40%);">-AC_LINK_IFELSE(</span><br><span style="color: hsl(0, 100%, 40%);">-        [AC_LANG_PROGRAM([#include <stdlib.h></span><br><span style="color: hsl(0, 100%, 40%);">-                   #include <netdb.h>],</span><br><span style="color: hsl(0, 100%, 40%);">-                        [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])],</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_MSG_RESULT(yes)</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),</span><br><span style="color: hsl(0, 100%, 40%);">-        AC_MSG_RESULT(no)</span><br><span style="color: hsl(0, 100%, 40%);">-)</span><br><span style="color: hsl(120, 100%, 40%);">+if test "x$have_gethostbyname_r_public_declaration" = "xyes"; then</span><br><span style="color: hsl(120, 100%, 40%);">+        # some systems already have gethostbyname_r so we don't need to build ours in main/utils.c</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_SEARCH_LIBS(gethostbyname_r, [socket nsl])</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_MSG_CHECKING(for gethostbyname_r with 6 arguments)</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_LINK_IFELSE(</span><br><span style="color: hsl(120, 100%, 40%);">+                [AC_LANG_PROGRAM([#include <stdlib.h></span><br><span style="color: hsl(120, 100%, 40%);">+                                 #include <netdb.h>],</span><br><span style="color: hsl(120, 100%, 40%);">+                                [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (struct hostent **)NULL, (int *)NULL);])],</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_MSG_RESULT(yes)</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_DEFINE([HAVE_GETHOSTBYNAME_R_6], 1, [Define to 1 if your system has gethostbyname_r with 6 arguments.]),</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_MSG_RESULT(no)</span><br><span style="color: hsl(120, 100%, 40%);">+        )</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_MSG_CHECKING(for gethostbyname_r with 5 arguments)</span><br><span style="color: hsl(120, 100%, 40%);">+        AC_LINK_IFELSE(</span><br><span style="color: hsl(120, 100%, 40%);">+                [AC_LANG_PROGRAM([#include <stdlib.h></span><br><span style="color: hsl(120, 100%, 40%);">+                               #include <netdb.h>],</span><br><span style="color: hsl(120, 100%, 40%);">+                                [struct hostent *he = gethostbyname_r((const char *)NULL, (struct hostent *)NULL, (char *)NULL, (int)0, (int *)NULL);])],</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_MSG_RESULT(yes)</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_DEFINE([HAVE_GETHOSTBYNAME_R_5], 1, [Define to 1 if your system has gethostbyname_r with 5 arguments.]),</span><br><span style="color: hsl(120, 100%, 40%);">+                AC_MSG_RESULT(no)</span><br><span style="color: hsl(120, 100%, 40%);">+        )</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span> </span><br><span> AC_CHECK_HEADER([byteswap.h], [AC_DEFINE_UNQUOTED([HAVE_BYTESWAP_H], 1, [Define to 1 if byteswap.h macros are available.])])</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17703">change 17703</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17703"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Iafa359b09908251bcd299ff54be003ea129b9eda </div>
<div style="display:none"> Gerrit-Change-Number: 17703 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Jaco Kroon <jaco@uls.co.za> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>