Makefile: increase level of compiler warnings

Change-Id: I3865e17cdede51681e64d1b7385725747b38fbaa
diff --git a/Makefile.in b/Makefile.in
index 3ead21d..bec7c8c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -41,7 +41,7 @@
 HEADERS:=dtls.h hmac.h dtls_debug.h dtls_config.h uthash.h numeric.h crypto.h global.h ccm.h \
  netq.h alert.h utlist.h prng.h peer.h state.h dtls_time.h session.h \
  tinydtls.h
-CFLAGS:=-Wall -pedantic -std=c99 @CFLAGS@
+CFLAGS:=-Wall -pedantic -std=c99 @CFLAGS@ @WARNING_CFLAGS@
 CPPFLAGS:=@CPPFLAGS@ -DDTLS_CHECK_CONTENTTYPE -I$(top_srcdir)
 SUBDIRS:=tests doc platform-specific sha2 aes ecc
 DISTSUBDIRS:=$(SUBDIRS)
diff --git a/configure.ac b/configure.ac
index ae6a3f9..8ec4d50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,28 @@
 
 AC_C_BIGENDIAN
 
+# Adding some default warning options for code QS
+# see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
+# and http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
+WARNING_CFLAGS="\
+-pedantic \
+-Wall \
+-Wextra \
+-Wformat-security \
+-Winline \
+-Wmissing-declarations \
+-Wmissing-prototypes \
+-Wnested-externs \
+-Wpointer-arith \
+-Wshadow \
+-Wstrict-prototypes \
+-Wswitch-default \
+-Wswitch-enum \
+-Wunused \
+"
+
+AC_SUBST([WARNING_CFLAGS])
+
 # Checks for libraries.
 AC_SEARCH_LIBS([gethostbyname], [nsl])
 AC_SEARCH_LIBS([socket], [socket])