diff options
author | Cedric BAIL <cedric.bail@free.fr> | 2010-12-03 18:27:17 +0000 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2010-12-03 18:27:17 +0000 |
commit | 0be45d00c3a4b81ccfab1223255d3438e0ceebe5 (patch) | |
tree | 7d39a4b83c69dafea60dce8eef00c397ce0676c1 /m4 | |
parent | acee01a194db501b72782602b600fb6f9a7476e3 (diff) | |
download | eet-0be45d00c3a4b81ccfab1223255d3438e0ceebe5.tar.gz |
* eet: improve detection of -Wl,--as-needed
SVN revision: 55214
Diffstat (limited to 'm4')
-rw-r--r-- | m4/efl_compiler_flag.m4 | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/m4/efl_compiler_flag.m4 b/m4/efl_compiler_flag.m4 new file mode 100644 index 0000000..618c6a6 --- /dev/null +++ b/m4/efl_compiler_flag.m4 @@ -0,0 +1,57 @@ +dnl Copyright (C) 2010 Vincent Torri <vtorri at univ-evry dot fr> +dnl and Albin Tonnerre <albin dot tonnerre at gmail dot com> +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 CFLAGS if supported (will be passed to ld anyway). + +AC_DEFUN([EFL_LINKER_FLAG], +[ + +CFLAGS_save="${CFLAGS}" +CFLAGS="${CFLAGS} $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 + CFLAGS="${CFLAGS_save}" +fi +AC_LANG_POP([C]) + +]) |