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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
#---------------------------------------------------------------------------
#
# xc-val-flgs.m4
#
# Copyright (c) 2013 Daniel Stenberg <daniel@haxx.se>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#---------------------------------------------------------------------------
# serial 1
dnl _XC_CHECK_VAR_LIBS
dnl -------------------------------------------------
dnl Private macro.
AC_DEFUN([_XC_CHECK_VAR_LIBS], [
xc_bad_var_libs=no
for xc_word in $LIBS; do
case "$xc_word" in
-l* | --library=*)
:
;;
*)
xc_bad_var_libs=yes
;;
esac
done
if test $xc_bad_var_libs = yes; then
AC_MSG_NOTICE([using LIBS: $LIBS])
AC_MSG_NOTICE([LIBS note: LIBS should only be used to specify libraries (-lname).])
fi
])
dnl _XC_CHECK_VAR_LDFLAGS
dnl -------------------------------------------------
dnl Private macro.
AC_DEFUN([_XC_CHECK_VAR_LDFLAGS], [
xc_bad_var_ldflags=no
for xc_word in $LDFLAGS; do
case "$xc_word" in
-D*)
xc_bad_var_ldflags=yes
;;
-U*)
xc_bad_var_ldflags=yes
;;
-I*)
xc_bad_var_ldflags=yes
;;
-l* | --library=*)
xc_bad_var_ldflags=yes
;;
esac
done
if test $xc_bad_var_ldflags = yes; then
AC_MSG_NOTICE([using LDFLAGS: $LDFLAGS])
xc_bad_var_msg="LDFLAGS note: LDFLAGS should only be used to specify linker flags, not"
for xc_word in $LDFLAGS; do
case "$xc_word" in
-D*)
AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word])
;;
-U*)
AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word])
;;
-I*)
AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word])
;;
-l* | --library=*)
AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
;;
esac
done
fi
])
dnl _XC_CHECK_VAR_CPPFLAGS
dnl -------------------------------------------------
dnl Private macro.
AC_DEFUN([_XC_CHECK_VAR_CPPFLAGS], [
xc_bad_var_cppflags=no
for xc_word in $CPPFLAGS; do
case "$xc_word" in
-rpath*)
xc_bad_var_cppflags=yes
;;
-L* | --library-path=*)
xc_bad_var_cppflags=yes
;;
-l* | --library=*)
xc_bad_var_cppflags=yes
;;
esac
done
if test $xc_bad_var_cppflags = yes; then
AC_MSG_NOTICE([using CPPFLAGS: $CPPFLAGS])
xc_bad_var_msg="CPPFLAGS note: CPPFLAGS should only be used to specify C preprocessor flags, not"
for xc_word in $CPPFLAGS; do
case "$xc_word" in
-rpath*)
AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word])
;;
-L* | --library-path=*)
AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word])
;;
-l* | --library=*)
AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
;;
esac
done
fi
])
dnl _XC_CHECK_VAR_CFLAGS
dnl -------------------------------------------------
dnl Private macro.
AC_DEFUN([_XC_CHECK_VAR_CFLAGS], [
xc_bad_var_cflags=no
for xc_word in $CFLAGS; do
case "$xc_word" in
-D*)
xc_bad_var_cflags=yes
;;
-U*)
xc_bad_var_cflags=yes
;;
-I*)
xc_bad_var_cflags=yes
;;
-rpath*)
xc_bad_var_cflags=yes
;;
-L* | --library-path=*)
xc_bad_var_cflags=yes
;;
-l* | --library=*)
xc_bad_var_cflags=yes
;;
esac
done
if test $xc_bad_var_cflags = yes; then
AC_MSG_NOTICE([using CFLAGS: $CFLAGS])
xc_bad_var_msg="CFLAGS note: CFLAGS should only be used to specify C compiler flags, not"
for xc_word in $CFLAGS; do
case "$xc_word" in
-D*)
AC_MSG_NOTICE([$xc_bad_var_msg macro definitions. Use CPPFLAGS for: $xc_word])
;;
-U*)
AC_MSG_NOTICE([$xc_bad_var_msg macro suppressions. Use CPPFLAGS for: $xc_word])
;;
-I*)
AC_MSG_NOTICE([$xc_bad_var_msg include directories. Use CPPFLAGS for: $xc_word])
;;
-rpath*)
AC_MSG_NOTICE([$xc_bad_var_msg library runtime directories. Use LDFLAGS for: $xc_word])
;;
-L* | --library-path=*)
AC_MSG_NOTICE([$xc_bad_var_msg library directories. Use LDFLAGS for: $xc_word])
;;
-l* | --library=*)
AC_MSG_NOTICE([$xc_bad_var_msg libraries. Use LIBS for: $xc_word])
;;
esac
done
fi
])
dnl XC_CHECK_USER_FLAGS
dnl -------------------------------------------------
dnl Public macro.
dnl
dnl Performs some sanity checks for LIBS, LDFLAGS,
dnl CPPFLAGS and CFLAGS values that the user might
dnl have set. When checks fails, user is noticed
dnl about errors detected in all of them and script
dnl execution is halted.
dnl
dnl Intended to be used early in configure script.
AC_DEFUN([XC_CHECK_USER_FLAGS], [
AC_PREREQ([2.50])dnl
AC_BEFORE([$0],[XC_CHECK_PROG_CC])dnl
dnl check order below matters
_XC_CHECK_VAR_LIBS
_XC_CHECK_VAR_LDFLAGS
_XC_CHECK_VAR_CPPFLAGS
_XC_CHECK_VAR_CFLAGS
if test $xc_bad_var_libs = yes ||
test $xc_bad_var_cflags = yes ||
test $xc_bad_var_ldflags = yes ||
test $xc_bad_var_cppflags = yes; then
AC_MSG_WARN([One or more of these variables may cause build problems!])
fi
])
dnl XC_CHECK_BUILD_FLAGS
dnl -------------------------------------------------
dnl Public macro.
dnl
dnl Performs some sanity checks for LIBS, LDFLAGS,
dnl CPPFLAGS and CFLAGS values that the configure
dnl script might have set. When checks fails, user
dnl is noticed about errors detected in all of them
dnl but script continues execution.
dnl
dnl Intended to be used very late in configure script.
AC_DEFUN([XC_CHECK_BUILD_FLAGS], [
AC_PREREQ([2.50])dnl
dnl check order below matters
_XC_CHECK_VAR_LIBS
_XC_CHECK_VAR_LDFLAGS
_XC_CHECK_VAR_CPPFLAGS
_XC_CHECK_VAR_CFLAGS
if test $xc_bad_var_libs = yes ||
test $xc_bad_var_cflags = yes ||
test $xc_bad_var_ldflags = yes ||
test $xc_bad_var_cppflags = yes; then
AC_MSG_WARN([Continuing even with errors mentioned immediately above this line.])
fi
])
|