use m4 macro ti check compiler flag

patch by Lutin (who also wrote the m4 macro, i forgot that
in the previous commit)


SVN revision: 45518
This commit is contained in:
Vincent Torri 2010-01-24 11:13:23 +00:00
parent 8742a16770
commit 5dbf60bd8f
2 changed files with 28 additions and 24 deletions

View File

@ -294,32 +294,12 @@ case "${host_os}" in
esac
if ! test "x${VMIC}" = "x" ; then
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} -Wall -W"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[have_Wall="yes"],
[have_Wall="no"])
AC_MSG_CHECKING([whether the compiler supports -Wall])
AC_MSG_RESULT([${have_Wall}])
CFLAGS="${CFLAGS_save}"
if test "x${have_Wall}" = "xyes" ; then
EINA_CFLAGS="${EINA_CFLAGS} -Wall -W" # -Werror
fi
EFL_COMPILER_FLAG([-Wall])
EFL_COMPILER_FLAG([-W])
fi
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} -fno-strict-aliasing"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[have_no_strict_aliasing="yes"],
[have_no_strict_aliasing="no"])
AC_MSG_CHECKING([whether the compiler supports -fno-strict-aliasing])
AC_MSG_RESULT([${have_no_strict_aliasing}])
CFLAGS="${CFLAGS_save}"
if test "x${have_no_strict_aliasing}" = "xyes" ; then
EINA_CFLAGS="${EINA_CFLAGS} -fno-strict-aliasing"
fi
EFL_COMPILER_FLAG([-Wshadow])
EFL_COMPILER_FLAG([-fno-strict-aliasing])
AC_SUBST(EINA_CPPFLAGS)
AC_SUBST(EINA_CFLAGS)

View File

@ -0,0 +1,24 @@
dnl Checks if a given compiler switch is supported.
dnl If so, this macro adds the flag to the CFLAGS
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])
])