1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
dnl Copyright (C) 2012 Vincent Torri <vincent dot torri at gmail dot com>
dnl This code is public domain and can be freely used or copied.
dnl Macro that check if compiler of linker flags are available
dnl Macro that checks for a compiler flag availability
dnl
dnl EFL_CHECK_COMPILER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
dnl AC_SUBST : EFL_CFLAGS (EFL being replaced by its value)
AC_DEFUN([EFL_CHECK_COMPILER_FLAG],
[
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
m4_pushdef([UP], m4_translit([[$2]], [-a-z], [_A-Z]))
dnl store in options -Wfoo if -Wno-foo is passed
option=m4_bpatsubst([[$2]], [-Wno-], [-W])
CFLAGS_save="${CFLAGS}"
CFLAGS="${CFLAGS} ${option}"
AC_LANG_PUSH([C])
AC_MSG_CHECKING([whether the compiler supports $2])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]])],
[have_flag="yes"],
[have_flag="no"])
AC_MSG_RESULT([${have_flag}])
CFLAGS="${CFLAGS_save}"
AC_LANG_POP([C])
if test "x${have_flag}" = "xyes" ; then
UPEFL[_CFLAGS]="${UPEFL[_CFLAGS]} [$2]"
fi
AC_ARG_VAR(UPEFL[_CFLAGS], [preprocessor flags for $2])
AC_SUBST(UPEFL[_CFLAGS])
m4_popdef([UP])
m4_popdef([UPEFL])
])
dnl Macro that iterates over a sequence of white separated flags
dnl and that call EFL_CHECK_COMPILER_FLAG() for each of these flags
dnl
dnl EFL_CHECK_COMPILER_FLAGS(EFL, FLAGS)
AC_DEFUN([EFL_CHECK_COMPILER_FLAGS],
[
m4_foreach_w([flag], [$2], [EFL_CHECK_COMPILER_FLAG([$1], m4_defn([flag]))])
])
dnl Macro that checks for a linker flag availability
dnl
dnl EFL_CHECK_LINKER_FLAG(EFL, FLAG[, ACTION-IF-FOUND[ ,ACTION-IF-NOT-FOUND]])
dnl AC_SUBST : EFL_LIBS (EFL being replaced by its value)
AC_DEFUN([EFL_CHECK_LINKER_FLAG],
[
m4_pushdef([UPEFL], m4_translit([[$1]], [-a-z], [_A-Z]))
m4_pushdef([UP], m4_translit([[$2]], [,-a-z], [__A-Z]))
LDFLAGS_save="${LDFLAGS}"
LDFLAGS="${LDFLAGS} $2"
AC_LANG_PUSH([C])
AC_MSG_CHECKING([whether the linker supports $2])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]])],
[have_flag="yes"],
[have_flag="no"])
AC_MSG_RESULT([${have_flag}])
LDFLAGS="${LDFLAGS_save}"
AC_LANG_POP([C])
if test "x${have_flag}" = "xyes" ; then
UPEFL[_LIBS]="${UPEFL[_LIBS]} [$2]"
fi
AC_ARG_VAR(UPEFL[_LIBS], [preprocessor flags for $2])
AC_SUBST(UPEFL[_LIBS])
m4_popdef([UP])
m4_popdef([UPEFL])
])
dnl Macro that iterates over a sequence of white separated flags
dnl and that call EFL_CHECK_LINKER_FLAG() for each of these flags
dnl
dnl EFL_CHECK_LINKER_FLAGS(EFL, FLAGS)
AC_DEFUN([EFL_CHECK_LINKER_FLAGS],
[
m4_foreach_w([flag], [$2], [EFL_CHECK_LINKER_FLAG([$1], m4_defn([flag]))])
])
|