From 155042a68fb596e6217d216b3535eb2ae9e33d89 Mon Sep 17 00:00:00 2001 From: mike_m Date: Fri, 8 Jul 2011 06:38:47 +0000 Subject: [PATCH] ecore: Build with -Wall -W by default Signed-off-by: Mike McCormack git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@61146 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- configure.ac | 6 ++++++ m4/efl_compiler_flag.m4 | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 m4/efl_compiler_flag.m4 diff --git a/configure.ac b/configure.ac index 4e91048..c5692f2 100644 --- a/configure.ac +++ b/configure.ac @@ -329,6 +329,12 @@ have_gnu_objc=${ac_cv_objc_compiler_gnu} EFL_CHECK_DOXYGEN([build_doc="yes"], [build_doc="no"]) +m4_ifdef([v_mic], + [ + EFL_COMPILER_FLAG([-Wall]) + EFL_COMPILER_FLAG([-W]) + ]) + # The first call to PKG_CHECK_MODULES is done conditionally, # so we should include this here: PKG_PROG_PKG_CONFIG diff --git a/m4/efl_compiler_flag.m4 b/m4/efl_compiler_flag.m4 new file mode 100644 index 0000000..25c285d --- /dev/null +++ b/m4/efl_compiler_flag.m4 @@ -0,0 +1,57 @@ +dnl Copyright (C) 2010 Vincent Torri +dnl and Albin Tonnerre +dnl That code is public domain and can be freely used or copied. + +dnl Macro that checks if a compiler flag is supported by the compiler. + +dnl Usage: EFL_COMPILER_FLAG(flag) +dnl flag is added to CFLAGS if supported. + +AC_DEFUN([EFL_COMPILER_FLAG], +[ + +CFLAGS_save="${CFLAGS}" +CFLAGS="${CFLAGS} $1" + +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([whether the compiler supports $1]) + +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]])], + [have_flag="yes"], + [have_flag="no"]) +AC_MSG_RESULT([${have_flag}]) + +if test "x${have_flag}" = "xno" ; then + CFLAGS="${CFLAGS_save}" +fi +AC_LANG_POP([C]) + +]) + +dnl Macro that checks if a linker flag is supported by the compiler. + +dnl Usage: EFL_LINKER_FLAG(flag) +dnl flag is added to LDFLAGS if supported (will be passed to ld anyway). + +AC_DEFUN([EFL_LINKER_FLAG], +[ + +LDFLAGS_save="${LDFLAGS}" +LDFLAGS="${LDFLAGS} $1" + +AC_LANG_PUSH([C]) +AC_MSG_CHECKING([whether the compiler supports $1]) + +AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[]])], + [have_flag="yes"], + [have_flag="no"]) +AC_MSG_RESULT([${have_flag}]) + +if test "x${have_flag}" = "xno" ; then + LDFLAGS="${LDFLAGS_save}" +fi +AC_LANG_POP([C]) + +]) -- 2.7.4