From: "Blake Ramsdell" <blaker@gmail.com>
To: "Linus Torvalds" <torvalds@linux-foundation.org>
Cc: "Jakub Narebski" <jnareb@gmail.com>,
"Wincent Colaiuta" <win@wincent.com>,
git@vger.kernel.org
Subject: Re: [PATCH] Silence iconv warnings on Leopard
Date: Thu, 6 Dec 2007 16:41:24 -0800 [thread overview]
Message-ID: <985966520712061641y4eba054dj5dea1d0308d50b12@mail.gmail.com> (raw)
In-Reply-To: <alpine.LFD.0.9999.0712061628070.13796@woody.linux-foundation.org>
On Dec 6, 2007 4:30 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> Umm. Why not just make the test be whether the following compiles cleanly?
>
> #include <iconv.h>
>
> extern size_t iconv(iconv_t cd,
> char **inbuf, size_t *inbytesleft,
> char **outbuf, size_t *outbytesleft);
>
> because if the compiler has seen a "const char **inbuf", then it should
> error out with a "conflicting types for 'iconv'" style message..
Yeah, this is what I did:
diff --git a/configure.ac b/configure.ac
index 5f8a15b..675d3e0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -182,6 +182,29 @@ AC_SUBST(NEEDS_LIBICONV)
AC_SUBST(NO_ICONV)
test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
#
+# Define OLD_ICONV if the iconv function prototype uses const** (Darwin and
+# some FreeBSD installations).
+AC_DEFUN([OLDICONVTEST_SRC], [
+#include <iconv.h>
+
+int main(void)
+{
+ char* value = "test";
+
+ (void) iconv (NULL, &value, NULL, NULL, NULL);
+}
+])
+AC_MSG_CHECKING([for old iconv])
+old_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS -Werror"
+AC_COMPILE_IFELSE(OLDICONVTEST_SRC,
+ [AC_MSG_RESULT([no])
+ OLD_ICONV=],
+ [AC_MSG_RESULT([yes])
+ OLD_ICONV=UnfortunatelyYes])
+CFLAGS="$old_CFLAGS"
+AC_SUBST(OLD_ICONV)
+#
# Define NO_DEFLATE_BOUND if deflateBound is missing from zlib.
AC_DEFUN([ZLIBTEST_SRC], [
#include <zlib.h>
The problem is that AC_COMPILE_IFELSE doesn't barf on warnings, so I
had to put in the CFLAGS hack to do -Werror (this is what Jakub did
also, I think).
So if this isn't rude to use -Werror (which is probably gcc-specific
in one or more ways), then fine. If it is rude to use -Werror, then
yeah, there needs to be some check for the warning, which I confess in
my five minutes of learning autoconf I don't understand well enough to
say if it's possible.
Blake
--
Blake Ramsdell | http://www.blakeramsdell.com
next prev parent reply other threads:[~2007-12-07 0:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 19:07 [PATCH] Silence iconv warnings on Leopard Wincent Colaiuta
2007-12-06 23:04 ` Blake Ramsdell
2007-12-07 0:11 ` Jakub Narebski
2007-12-07 0:12 ` Blake Ramsdell
2007-12-07 0:30 ` Linus Torvalds
2007-12-07 0:41 ` Blake Ramsdell [this message]
2007-12-07 0:44 ` Blake Ramsdell
2007-12-07 1:27 ` [PATCH/RFC (take 3)] autoconf: Add test for OLD_ICONV (squelching compiler warning) Jakub Narebski
2007-12-07 7:26 ` Junio C Hamano
2007-12-07 8:25 ` Wincent Colaiuta
2007-12-07 8:22 ` Wincent Colaiuta
2007-12-07 8:29 ` Blake Ramsdell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=985966520712061641y4eba054dj5dea1d0308d50b12@mail.gmail.com \
--to=blaker@gmail.com \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=torvalds@linux-foundation.org \
--cc=win@wincent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).