summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-12-03 18:27:17 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-12-03 18:27:17 +0000
commit0be45d00c3a4b81ccfab1223255d3438e0ceebe5 (patch)
tree7d39a4b83c69dafea60dce8eef00c397ce0676c1
parentacee01a194db501b72782602b600fb6f9a7476e3 (diff)
downloadeet-0be45d00c3a4b81ccfab1223255d3438e0ceebe5.tar.gz
* eet: improve detection of -Wl,--as-needed
SVN revision: 55214
-rw-r--r--configure.ac15
-rw-r--r--m4/efl_compiler_flag.m457
-rw-r--r--src/bin/Makefile.am2
3 files changed, 59 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 6e6e428..11bced3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -415,20 +415,7 @@ case "$host_os" in
esac
AC_SUBST(lt_enable_auto_import)
-# use --as-needed if supported
-
-LDFLAGS_SAVE=${LDFLAGS}
-LDFLAGS="${LDFLAGS} -Wl,--as-needed"
-
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[]], [])],
- [ld_as_needed="-Wl,--as-needed"],
- [ld_as_needed=""]
-)
-
-LDFLAGS=${LDFLAGS_SAVE}
-AC_SUBST(ld_as_needed)
-
+EFL_LINKER_FLAG([-Wl,--as-needed])
### Checks for library functions
AC_FUNC_ALLOCA
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])
+
+])
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 006bb3f..ba7d67e 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -18,4 +18,4 @@ EXTRA_PROGRAMS = eet
eet_SOURCES = eet_main.c
eet_CFLAGS = @EET_CFLAGS@
eet_LDADD = $(top_builddir)/src/lib/libeet.la @EINA_LIBS@ @EVIL_LIBS@
-eet_LDFLAGS = @lt_enable_auto_import@ @ld_as_needed@
+eet_LDFLAGS = @lt_enable_auto_import@