From 498d92d0286a0fc92d8cec2758d449f18e042bc4 Mon Sep 17 00:00:00 2001
From: Michal Ludvig <mludvig@logix.net.nz>
Date: Wed, 4 Nov 2009 23:42:16 +0000
Subject: [PATCH] * configure.ac, Makefile.am: Test if GCC accepts
 -Wno-pointer-sign

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk@878 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 avrdude/ChangeLog    |  4 ++++
 avrdude/Makefile.am  |  2 +-
 avrdude/configure.ac | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/avrdude/ChangeLog b/avrdude/ChangeLog
index 761d01d9..ec87efad 100644
--- a/avrdude/ChangeLog
+++ b/avrdude/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-04  Michal Ludvig  <mludvig@logix.net.nz>
+
+	* configure.ac, Makefile.am: Test if GCC accepts -Wno-pointer-sign
+
 2009-11-04  Michal Ludvig  <mludvig@logix.net.nz>
 
 	* buspirate.c: Implemented 'BinMode' support for
diff --git a/avrdude/Makefile.am b/avrdude/Makefile.am
index e51a4c8d..9a68852d 100644
--- a/avrdude/Makefile.am
+++ b/avrdude/Makefile.am
@@ -51,7 +51,7 @@ libavrdude_a_CPPFLAGS = -DCONFIG_DIR=\"$(sysconfdir)\"
 
 avrdude_CFLAGS   = @ENABLE_WARNINGS@
 
-libavrdude_a_CFLAGS   = @ENABLE_WARNINGS@ -Wno-sign-compare -Wno-sign-conversion -Wno-pointer-sign
+libavrdude_a_CFLAGS   = @ENABLE_WARNINGS@
 
 avrdude_LDADD  = $(top_builddir)/$(noinst_LIBRARIES) @LIBUSB@ @LIBHID@ -lm
 
diff --git a/avrdude/configure.ac b/avrdude/configure.ac
index d082c95d..6e80342d 100644
--- a/avrdude/configure.ac
+++ b/avrdude/configure.ac
@@ -254,6 +254,25 @@ AC_SUBST(WINDOWS_DIRS,$WINDOWS_DIRS)
 # If we are compiling with gcc, enable all warning and make warnings errors.
 if test "$GCC" = yes; then
     ENABLE_WARNINGS="-Wall"
+
+	# does this compiler support -Wno-pointer-sign ?
+	AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
+
+	safe_CFLAGS=$CFLAGS
+	CFLAGS="$ENABLE_WARNINGS -Wno-pointer-sign"
+
+	AC_TRY_COMPILE(, [ int main () { return 0 ; } ], [
+		no_pointer_sign=yes
+		AC_MSG_RESULT([yes]) 
+		], [
+		no_pointer_sign=no
+		AC_MSG_RESULT([no]) 
+		])
+	CFLAGS=$safe_CFLAGS
+
+	if test x$no_pointer_sign = xyes; then
+		ENABLE_WARNINGS="$ENABLE_WARNINGS -Wno-pointer-sign"
+	fi
 fi
 AC_SUBST(ENABLE_WARNINGS,$ENABLE_WARNINGS)