forked from zmr961006/AIMv6
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathacinclude.m4
More file actions
161 lines (149 loc) · 4.76 KB
/
acinclude.m4
File metadata and controls
161 lines (149 loc) · 4.76 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Copyright (C) 2016 Gan Quan <coin2028@hotmail.com>
# Copyright (C) 2016 David Gao <davidgao1001@gmail.com>
#
# This file is part of AIMv6.
#
# AIMv6 is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# AIMv6 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# AIM_SET_ARG([feature], [macro], [desc], [default-value])
AC_DEFUN([AIM_SET_ARG],
[
AC_MSG_CHECKING([$3])
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1=ARG],
[Set $3 (default=$4)])],
[],
[with_]m4_bpatsubst([$1], -, _)=$4)
AC_DEFINE_UNQUOTED([$2], [$with_]m4_bpatsubst([$1], -, _), [$3])
AC_MSG_RESULT([$with_]m4_bpatsubst([$1], -, _))
]
)
# AIM_SET_ARGSTR([feature], [macro], [desc], [default-value])
AC_DEFUN([AIM_SET_ARGSTR],
[
AC_MSG_CHECKING([$3])
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1=ARG],
[Set $3 (default=$4)])],
[],
[with_]m4_bpatsubst([$1], -, _)=$4)
AC_DEFINE_UNQUOTED([$2], "[$with_]m4_bpatsubst([$1], -, _)", [$3])
AC_MSG_RESULT([$with_]m4_bpatsubst([$1], -, _))
]
)
# AIM_SUBST_MULTILINE([var], [content])
AC_DEFUN([AIM_SUBST_MULTILINE],
[
AC_SUBST($1, $2)
AM_SUBST_NOTMAKE($1)
]
)
# AIM_FUNC_ATTRIBUTE([attribute])
AC_DEFUN([AIM_GCC_FUNC_ATTRIBUTE],
[
AS_VAR_PUSHDEF([aim_var], [ax_cv_have_func_attribute_$1])
AS_VAR_PUSHDEF([aim_defined_var], [aim_defined_attribute_$1])
AX_GCC_FUNC_ATTRIBUTE($1)
AS_IF(
[test xyes = [x]AS_VAR_GET([aim_defined_var])], [],
[test xyes = [x]AS_VAR_GET([aim_var])], [
AS_VAR_SET([aim_defined_var], [yes])
AC_DEFINE_UNQUOTED(
[__$1], [__attribute__(($1))],
[pseudo-keyword for attribute $1]
)
]
)
AS_VAR_POPDEF([aim_defined_var])
AS_VAR_POPDEF([aim_var])
]
)
# AIM_VAR_ATTRIBUTE([attribute])
AC_DEFUN([AIM_GCC_VAR_ATTRIBUTE],
[
AS_VAR_PUSHDEF([aim_var], [ax_cv_have_var_attribute_$1])
AS_VAR_PUSHDEF([aim_defined_var], [aim_defined_attribute_$1])
AX_GCC_VAR_ATTRIBUTE($1)
AS_IF(
[test xyes = [x]AS_VAR_GET([aim_defined_var])], [],
[test xyes = [x]AS_VAR_GET([aim_var])], [
AS_VAR_SET([aim_defined_var], [yes])
AC_DEFINE_UNQUOTED(
[__$1], [__attribute__(($1))],
[pseudo-keyword for attribute $1]
)
]
)
AS_VAR_POPDEF([aim_defined_var])
AS_VAR_POPDEF([aim_var])
]
)
# AIM_HELP_ENABLE([feature], [desc])
AC_DEFUN(
[AIM_HELP_ENABLE],[]dnl
[AS_HELP_STRING([--enable-$1], [enable $2])
AS_HELP_STRING([--disable-$1], [disable $2])[]dnl
])
dnl FIXME The indent above looks bad, but don't change it.
# AIM_ARG_VAR([variable], [desc])
AC_DEFUN([AIM_ARG_VAR], [
AC_ARG_VAR([$1], [set $2])
AC_SUBST([$1])
AC_DEFINE_UNQUOTED([$1], [$][$1], [$2])
])
# AIM_ARG_WITH([feature], [macro], [desc], [value_if_empty])
# serves a variable, a substitution, and a macro
AC_DEFUN([AIM_ARG_WITH], [
AS_VAR_PUSHDEF([default_var], [with_]m4_bpatsubst([$1], -, _))
AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1=ARG], [set $3])])
AS_VAR_IF([default_var], [], [AS_VAR_SET([default_var], [$4])])
AC_DEFINE_UNQUOTED([$2], [$default_var], [$3])
AC_SUBST([default_var])
AS_VAR_POPDEF([default_var])
])
# AIM_ARG_ENABLE([feature], [conditional], [desc])
# serves a variable, a substitution, and a conditional
AC_DEFUN([AIM_ARG_ENABLE], [
AS_VAR_PUSHDEF([default_var], [enable_]m4_bpatsubst([$1], -, _))
AC_ARG_ENABLE([$1], [AIM_HELP_ENABLE([$1], [$3])])
AS_VAR_IF([default_var], [], [AS_VAR_SET([default_var], [no])])
AC_SUBST([default_var])
AM_CONDITIONAL([$2], [test x$default_var = xyes])
AS_IF(
[test xyes = [x]AS_VAR_GET([default_var])], [
AC_DEFINE_UNQUOTED([$2], [], [$3])
]
)
AS_VAR_POPDEF([default_var])
])
# AIM_SUPPORT_ARCH([space_separated_list])
# E.g. if ARCH=armv7a, define an automake conditional ARCH_ARMV7A
AC_DEFUN([AIM_SUPPORT_ARCH], [
m4_foreach_w([var], [$1], [
AM_CONDITIONAL([ARCH_]m4_toupper(var), [test x$ARCH = x]var)
])
])
# AIM_SUPPORT_MACH([space_separated_list])
# E.g. if MACH=zynq, define an automake conditional MACH_ZYNQ
AC_DEFUN([AIM_SUPPORT_MACH], [
m4_foreach_w([var], [$1], [
AM_CONDITIONAL([MACH_]m4_toupper(var), [test x$MACH = x]var)
])
])
# AIM_REQUIRE_COMPILE_FLAG([cflags])
# Require compiler to support all of cflags, or fail immediately.
AC_DEFUN([AIM_REQUIRE_COMPILE_FLAG], [
AX_CHECK_COMPILE_FLAG(
$1,
[aim_cflags+=$1],
[echo "cc does not support $1" && exit 1]
)
])