Compile with -Wall if the compiler supports it.
authorStefan Westerfeld <stefan@space.twc.de>
Thu, 5 Aug 2010 09:03:03 +0000 (11:03 +0200)
committerStefan Westerfeld <stefan@space.twc.de>
Thu, 5 Aug 2010 09:03:03 +0000 (11:03 +0200)
configure.ac

index f4427e2..97a477c 100644 (file)
@@ -22,6 +22,22 @@ AC_DEFUN([AC_JACK_REQUIREMENTS],
     AC_SUBST(JACK_LIBS)
 ])
 
+dnl ----------------------------- from acbirnet.m4 -------------------------------
+dnl Check whether cc accepts a certain option
+dnl MC_PROG_CC_SUPPORTS_OPTION(OPTIONS, ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND])
+AC_DEFUN([MC_PROG_CC_SUPPORTS_OPTION], [
+AC_MSG_CHECKING([whether ${CC-cc} supports $1])
+echo >conftest.c;
+if ${CC-cc} [$1] -c $CFLAGS conftest.c >/dev/null 2>&1 ; then
+    AC_MSG_RESULT(yes)
+    [$2]
+else
+    AC_MSG_RESULT(no)
+    [$3]
+fi
+rm -fr conftest*
+])dnl
+
 # We need pkg-config
 AC_CHECK_PROG(HAVE_PKG_CONFIG,pkg-config,yes,no)
 if test "$HAVE_PKG_CONFIG" = "no"; then
@@ -33,5 +49,10 @@ fi
 AC_BSE_REQUIREMENTS
 AC_JACK_REQUIREMENTS
 
+MC_PROG_CC_SUPPORTS_OPTION([-Wall], [
+  CFLAGS="$CFLAGS -Wall"
+  CXXFLAGS="$CXXFLAGS -Wall"
+])
+
 AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile])
 AC_OUTPUT