summaryrefslogtreecommitdiff
path: root/m4/efl_compiler.m4
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-09-11 16:04:21 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-09-11 16:04:21 +0000
commit59a9dfd11860888a35e96dfe51af63cea5cecfe1 (patch)
tree5577297b8bb6e1b299987c45eb0c0fa9a5669b0b /m4/efl_compiler.m4
parent0ca69d1f2d2f378223bed712c9cdcd7e6679e305 (diff)
merge: add infra for evil
SVN revision: 76463
Diffstat (limited to 'm4/efl_compiler.m4')
-rw-r--r--m4/efl_compiler.m456
1 files changed, 56 insertions, 0 deletions
diff --git a/m4/efl_compiler.m4 b/m4/efl_compiler.m4
new file mode 100644
index 0000000000..5f17be499d
--- /dev/null
+++ b/m4/efl_compiler.m4
@@ -0,0 +1,56 @@
1dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
2dnl This code is public domain and can be freely used or copied.
3
4dnl Macro that check if compiler of linker flags are available
5
6
7dnl Macro that checks for a compiler flag availability
8dnl
9dnl EFL_CHECK_COMPILER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
10dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
11dnl AM_CONDITIONAL : EFL_HAVE_FLAG (FLAG being replaced by its value)
12
13AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
14[
15m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
16m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
17
18dnl store in options -Wfoo if -Wno-foo is passed
19option=m4_bpatsubst([[$2]], [-Wno-], [-W])
20
21CFLAGS_save="${CFLAGS}"
22CFLAGS="${CFLAGS} ${option}"
23
24AC_LANG_PUSH([C])
25AC_MSG_CHECKING([whether the compiler supports $2])
26
27AC_COMPILE_IFELSE(
28 [AC_LANG_PROGRAM([[]])],
29 [have_flag="yes"],
30 [have_flag="no"])
31AC_MSG_RESULT([${have_flag}])
32
33CFLAGS="${CFLAGS_save}"
34AC_LANG_POP([C])
35
36if test "x${have_flag}" = "xyes" ; then
37 UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
38fi
39AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2])
40AC_SUBST(UPEFL[_CFLAGS])
41
42AM_CONDITIONAL([EFL_HAVE]UP, [test "x${have_flag}" = "xyes"])
43
44m4_popdef([UP])
45m4_popdef([UPEFL])
46])
47
48dnl Macro that iterates over a sequence of white separated flags
49dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags
50dnl
51dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
52
53AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
54[
55m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
56])