cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Yet another minor patch

From: Yang Tse <yangsita_at_gmail.com>
Date: Mon, 28 Nov 2005 19:37:45 +0100

> Can't we use AC_CHECK_DECL() to have the configure script detect this lack of
> prototype?

Maybe something like this ?

diff -urp c:\f\curl-old/curl/configure.ac c:\f\curl-new/curl/configure.ac
--- c:\f\curl-old/curl/configure.ac 2005-11-25 10:52:19.000000000 +0100
+++ c:\f\curl-new/curl/configure.ac 2005-11-28 19:23:41.725848000 +0100
@@ -1603,6 +1603,15 @@ AC_CHECK_DECL(basename, ,
 #endif
 )

+AC_CHECK_DECL(inet_pton, ,
+ AC_DEFINE(NOT_HAVE_INET_PTON_PROTO),
+[
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+]
+)
+
 AC_MSG_CHECKING([if we are Mac OS X (to disable poll)])
 disable_poll=no
 case $host in
diff -urp c:\f\curl-old/curl/lib/inet_pton.h c:\f\curl-new/curl/lib/inet_pton.h
--- c:\f\curl-old/curl/lib/inet_pton.h 2005-11-25 23:20:02.000000000 +0100
+++ c:\f\curl-new/curl/lib/inet_pton.h 2005-11-28 19:23:09.309235200 +0100
@@ -27,6 +27,10 @@

 int Curl_inet_pton(int, const char *, void *);

+#if defined(HAVE_INET_PTON) && defined(NOT_HAVE_INET_PTON_PROTO)
+int inet_pton(int af, const char *src, void *dst);
+#endif
+
 #ifdef HAVE_INET_PTON
 #ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>

If instead of defining NOT_HAVE_INET_PTON_PROTO we defined
HAVE_INET_PTON_PROTO the check in curl/lib/inet_pton.h should be of
the following style.

#if defined(HAVE_INET_PTON) && !defined(HAVE_INET_PTON_PROTO)

Which would force the manual definition of HAVE_INET_PTON_PROTO for
all platforms that lack autoconf.

You can choose which option seems best.

Regards,
Yang
Received on 2005-11-28