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)