1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
1 |
dnl Redefine AC_LANG_PROGRAM with a "-Wstrict-prototypes -Werror"-friendly |
2 |
dnl version. Patch submitted to bug-autoconf in 2009-09-16. |
|
3 |
m4_define([AC_LANG_PROGRAM(C)], |
|
4 |
[$1 |
|
5 |
int
|
|
6 |
main (void)
|
|
7 |
{
|
|
8 |
dnl Do *not* indent the following line: there may be CPP directives.
|
|
9 |
dnl Don't move the `;' right after for the same reason.
|
|
10 |
$2
|
|
11 |
;
|
|
12 |
return 0;
|
|
13 |
}]) |
|
14 |
||
15 |
||
16 |
dnl Check whether target compiler is working |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
17 |
AC_DEFUN([grub_PROG_TARGET_CC], |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
18 |
[AC_MSG_CHECKING([whether target compiler is working]) |
19 |
AC_CACHE_VAL(grub_cv_prog_target_cc, |
|
20 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[ |
|
17.3.15
by Robert Millan, Robert Millan
* New Bazaar snapshot. |
21 |
asm (".globl start; start:");
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
22 |
int main (void);
|
23 |
]], [[]])], |
|
24 |
[grub_cv_prog_target_cc=yes], |
|
25 |
[grub_cv_prog_target_cc=no]) |
|
26 |
]) |
|
27 |
AC_MSG_RESULT([$grub_cv_prog_target_cc]) |
|
28 |
||
29 |
if test "x$grub_cv_prog_target_cc" = xno; then |
|
30 |
AC_MSG_ERROR([cannot compile for the target]) |
|
31 |
fi
|
|
32 |
]) |
|
33 |
||
34 |
||
35 |
dnl grub_ASM_USCORE checks if C symbols get an underscore after |
|
36 |
dnl compiling to assembler. |
|
37 |
dnl Written by Pavel Roskin. Based on grub_ASM_EXT_C written by |
|
38 |
dnl Erich Boleyn and modified by Yoshinori K. Okuji. |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
39 |
AC_DEFUN([grub_ASM_USCORE], |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
40 |
[AC_REQUIRE([AC_PROG_CC]) |
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
41 |
AC_REQUIRE([AC_PROG_EGREP]) |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
42 |
AC_MSG_CHECKING([if C symbols get an underscore after compilation]) |
43 |
AC_CACHE_VAL(grub_cv_asm_uscore, |
|
44 |
[cat > conftest.c <<\EOF |
|
45 |
int func (int *);
|
|
46 |
int
|
|
47 |
func (int *list)
|
|
48 |
{
|
|
49 |
*list = 0;
|
|
50 |
return *list;
|
|
51 |
}
|
|
52 |
EOF
|
|
53 |
||
54 |
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then |
|
55 |
true |
|
56 |
else
|
|
57 |
AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) |
|
58 |
fi
|
|
59 |
||
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
60 |
if $EGREP '(^|[^_[:alnum]])_func' conftest.s >/dev/null 2>&1; then |
61 |
HAVE_ASM_USCORE=1 |
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
62 |
grub_cv_asm_uscore=yes |
63 |
else
|
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
64 |
HAVE_ASM_USCORE=0 |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
65 |
grub_cv_asm_uscore=no |
66 |
fi
|
|
67 |
||
68 |
rm -f conftest*]) |
|
69 |
||
70 |
AC_MSG_RESULT([$grub_cv_asm_uscore]) |
|
71 |
]) |
|
72 |
||
73 |
||
74 |
dnl Some versions of `objcopy -O binary' vary their output depending |
|
75 |
dnl on the link address.
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
76 |
AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
77 |
[AC_MSG_CHECKING([whether ${OBJCOPY} works for absolute addresses])
|
78 |
AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
|
|
79 |
[cat > conftest.c <<\EOF
|
|
80 |
void cmain (void);
|
|
81 |
void
|
|
82 |
cmain (void)
|
|
83 |
{
|
|
84 |
*((int *) 0x1000) = 2;
|
|
85 |
}
|
|
86 |
EOF
|
|
87 |
||
88 |
if AC_TRY_EVAL(ac_compile) && test -s conftest.o; then :
|
|
89 |
else
|
|
90 |
AC_MSG_ERROR([${CC-cc} cannot compile C source code])
|
|
91 |
fi
|
|
92 |
grub_cv_prog_objcopy_absolute=yes
|
|
93 |
for link_addr in 0x2000 0x8000 0x7C00; do
|
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
94 |
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib ${TARGET_IMG_LDFLAGS_AC} ${TARGET_IMG_BASE_LDOPT},$link_addr conftest.o -o conftest.exec]); then :
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
95 |
else
|
96 |
AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
|
|
97 |
fi
|
|
98 |
if AC_TRY_COMMAND([${OBJCOPY-objcopy} --only-section=.text -O binary conftest.exec conftest]); then :
|
|
99 |
else
|
|
100 |
AC_MSG_ERROR([${OBJCOPY-objcopy} cannot create binary files])
|
|
101 |
fi
|
|
102 |
if test ! -f conftest.old || AC_TRY_COMMAND([cmp -s conftest.old conftest]); then
|
|
103 |
mv -f conftest conftest.old
|
|
104 |
else
|
|
105 |
grub_cv_prog_objcopy_absolute=no
|
|
106 |
break
|
|
107 |
fi
|
|
108 |
done
|
|
109 |
rm -f conftest*])
|
|
110 |
AC_MSG_RESULT([$grub_cv_prog_objcopy_absolute])
|
|
111 |
||
112 |
if test "x$grub_cv_prog_objcopy_absolute" = xno; then
|
|
113 |
AC_MSG_ERROR([GRUB requires a working absolute objcopy; upgrade your binutils])
|
|
114 |
fi
|
|
115 |
])
|
|
116 |
||
117 |
||
118 |
dnl Supply --build-id=none to ld if building modules.
|
|
119 |
dnl This suppresses warnings from ld on some systems
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
120 |
AC_DEFUN([grub_PROG_LD_BUILD_ID_NONE],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
121 |
[AC_MSG_CHECKING([whether linker accepts --build-id=none])
|
122 |
AC_CACHE_VAL(grub_cv_prog_ld_build_id_none,
|
|
123 |
[save_LDFLAGS="$LDFLAGS"
|
|
124 |
LDFLAGS="$LDFLAGS -Wl,--build-id=none"
|
|
125 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
|
126 |
[grub_cv_prog_ld_build_id_none=yes],
|
|
127 |
[grub_cv_prog_ld_build_id_none=no])
|
|
128 |
LDFLAGS="$save_LDFLAGS"
|
|
129 |
])
|
|
130 |
AC_MSG_RESULT([$grub_cv_prog_ld_build_id_none])
|
|
131 |
||
132 |
if test "x$grub_cv_prog_ld_build_id_none" = xyes; then
|
|
133 |
TARGET_LDFLAGS="$TARGET_LDFLAGS -Wl,--build-id=none"
|
|
134 |
fi
|
|
135 |
])
|
|
136 |
||
137 |
||
138 |
dnl Mass confusion!
|
|
139 |
dnl Older versions of GAS interpret `.code16' to mean ``generate 32-bit |
|
140 |
dnl instructions, but implicitly insert addr32 and data32 bytes so |
|
141 |
dnl that the code works in real mode''. |
|
142 |
dnl
|
|
143 |
dnl Newer versions of GAS interpret `.code16' to mean ``generate 16-bit |
|
144 |
dnl instructions,'' which seems right. This requires the programmer
|
|
145 |
dnl to explicitly insert addr32 and data32 instructions when they want
|
|
146 |
dnl them.
|
|
147 |
dnl
|
|
148 |
dnl We only support the newer versions, because the old versions cause
|
|
149 |
dnl major pain, by requiring manual assembly to get 16-bit instructions into
|
|
150 |
dnl asm files.
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
151 |
AC_DEFUN([grub_I386_ASM_ADDR32],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
152 |
[AC_REQUIRE([AC_PROG_CC])
|
153 |
AC_REQUIRE([grub_I386_ASM_PREFIX_REQUIREMENT])
|
|
154 |
AC_MSG_CHECKING([for .code16 addr32 assembler support])
|
|
155 |
AC_CACHE_VAL(grub_cv_i386_asm_addr32,
|
|
156 |
[cat > conftest.s.in <<\EOF
|
|
157 |
.code16
|
|
158 |
l1: @ADDR32@ movb %al, l1
|
|
159 |
EOF
|
|
160 |
||
161 |
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
|
|
162 |
sed -e s/@ADDR32@/addr32/ < conftest.s.in > conftest.s
|
|
163 |
else
|
|
164 |
sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s
|
|
165 |
fi
|
|
166 |
||
167 |
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
|
168 |
grub_cv_i386_asm_addr32=yes
|
|
169 |
else
|
|
170 |
grub_cv_i386_asm_addr32=no
|
|
171 |
fi
|
|
172 |
||
173 |
rm -f conftest*])
|
|
174 |
||
175 |
AC_MSG_RESULT([$grub_cv_i386_asm_addr32])])
|
|
176 |
||
177 |
dnl check if our compiler is apple cc
|
|
178 |
dnl because it requires numerous workarounds
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
179 |
AC_DEFUN([grub_apple_cc],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
180 |
[AC_REQUIRE([AC_PROG_CC])
|
181 |
AC_MSG_CHECKING([whether our compiler is apple cc])
|
|
182 |
AC_CACHE_VAL(grub_cv_apple_cc,
|
|
183 |
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
184 |
grub_cv_apple_cc=yes
|
|
185 |
else
|
|
186 |
grub_cv_apple_cc=no
|
|
187 |
fi
|
|
188 |
])
|
|
189 |
||
190 |
AC_MSG_RESULT([$grub_cv_apple_cc])])
|
|
191 |
||
192 |
dnl check if our target compiler is apple cc
|
|
193 |
dnl because it requires numerous workarounds
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
194 |
AC_DEFUN([grub_apple_target_cc],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
195 |
[AC_REQUIRE([AC_PROG_CC])
|
196 |
AC_MSG_CHECKING([whether our target compiler is apple cc])
|
|
197 |
AC_CACHE_VAL(grub_cv_apple_target_cc,
|
|
198 |
[if $CC -v 2>&1 | grep "Apple Inc." > /dev/null; then
|
|
199 |
grub_cv_apple_target_cc=yes
|
|
200 |
else
|
|
201 |
grub_cv_apple_target_cc=no
|
|
202 |
fi
|
|
203 |
])
|
|
204 |
||
205 |
AC_MSG_RESULT([$grub_cv_apple_target_cc])])
|
|
206 |
||
207 |
||
208 |
dnl Later versions of GAS requires that addr32 and data32 prefixes
|
|
209 |
dnl appear in the same lines as the instructions they modify, while
|
|
210 |
dnl earlier versions requires that they appear in separate lines.
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
211 |
AC_DEFUN([grub_I386_ASM_PREFIX_REQUIREMENT],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
212 |
[AC_REQUIRE([AC_PROG_CC])
|
213 |
AC_MSG_CHECKING(dnl
|
|
214 |
[whether addr32 must be in the same line as the instruction])
|
|
215 |
AC_CACHE_VAL(grub_cv_i386_asm_prefix_requirement,
|
|
216 |
[cat > conftest.s <<\EOF
|
|
217 |
.code16
|
|
218 |
l1: addr32 movb %al, l1
|
|
219 |
EOF
|
|
220 |
||
221 |
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
|
222 |
grub_cv_i386_asm_prefix_requirement=yes
|
|
223 |
else
|
|
224 |
grub_cv_i386_asm_prefix_requirement=no
|
|
225 |
fi
|
|
226 |
||
227 |
rm -f conftest*])
|
|
228 |
||
229 |
if test "x$grub_cv_i386_asm_prefix_requirement" = xyes; then
|
|
230 |
grub_tmp_addr32="addr32"
|
|
231 |
grub_tmp_data32="data32"
|
|
232 |
else
|
|
233 |
grub_tmp_addr32="addr32;"
|
|
234 |
grub_tmp_data32="data32;"
|
|
235 |
fi
|
|
236 |
||
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
237 |
ADDR32=$grub_tmp_addr32
|
238 |
DATA32=$grub_tmp_data32
|
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
239 |
|
240 |
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
|
241 |
||
242 |
||
243 |
dnl Check what symbol is defined as a bss start symbol.
|
|
244 |
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
245 |
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
246 |
[AC_REQUIRE([AC_PROG_CC])
|
247 |
AC_MSG_CHECKING([if __bss_start is defined by the compiler])
|
|
248 |
AC_CACHE_VAL(grub_cv_check_uscore_uscore_bss_start_symbol,
|
|
249 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
250 |
[[asm ("incl __bss_start")]])],
|
|
251 |
[grub_cv_check_uscore_uscore_bss_start_symbol=yes],
|
|
252 |
[grub_cv_check_uscore_uscore_bss_start_symbol=no])])
|
|
253 |
||
254 |
AC_MSG_RESULT([$grub_cv_check_uscore_uscore_bss_start_symbol])
|
|
255 |
||
256 |
AC_MSG_CHECKING([if edata is defined by the compiler])
|
|
257 |
AC_CACHE_VAL(grub_cv_check_edata_symbol,
|
|
258 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
259 |
[[asm ("incl edata")]])],
|
|
260 |
[grub_cv_check_edata_symbol=yes],
|
|
261 |
[grub_cv_check_edata_symbol=no])])
|
|
262 |
||
263 |
AC_MSG_RESULT([$grub_cv_check_edata_symbol])
|
|
264 |
||
265 |
AC_MSG_CHECKING([if _edata is defined by the compiler])
|
|
266 |
AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol,
|
|
267 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
268 |
[[asm ("incl _edata")]])],
|
|
269 |
[grub_cv_check_uscore_edata_symbol=yes],
|
|
270 |
[grub_cv_check_uscore_edata_symbol=no])])
|
|
271 |
||
272 |
AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol])
|
|
273 |
||
274 |
if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then
|
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
275 |
BSS_START_SYMBOL=__bss_start
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
276 |
elif test "x$grub_cv_check_edata_symbol" = xyes; then
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
277 |
BSS_START_SYMBOL=edata
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
278 |
elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
279 |
BSS_START_SYMBOL=_edata
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
280 |
else
|
281 |
AC_MSG_ERROR([none of __bss_start, edata or _edata is defined])
|
|
282 |
fi
|
|
283 |
])
|
|
284 |
||
285 |
dnl Check what symbol is defined as an end symbol.
|
|
286 |
dnl Written by Yoshinori K. Okuji.
|
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
287 |
AC_DEFUN([grub_CHECK_END_SYMBOL],
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
288 |
[AC_REQUIRE([AC_PROG_CC])
|
289 |
AC_MSG_CHECKING([if end is defined by the compiler])
|
|
290 |
AC_CACHE_VAL(grub_cv_check_end_symbol,
|
|
291 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
292 |
[[asm ("incl end")]])],
|
|
293 |
[grub_cv_check_end_symbol=yes],
|
|
294 |
[grub_cv_check_end_symbol=no])])
|
|
295 |
||
296 |
AC_MSG_RESULT([$grub_cv_check_end_symbol])
|
|
297 |
||
298 |
AC_MSG_CHECKING([if _end is defined by the compiler])
|
|
299 |
AC_CACHE_VAL(grub_cv_check_uscore_end_symbol,
|
|
300 |
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
|
|
301 |
[[asm ("incl _end")]])],
|
|
302 |
[grub_cv_check_uscore_end_symbol=yes],
|
|
303 |
[grub_cv_check_uscore_end_symbol=no])])
|
|
304 |
||
305 |
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
|
|
306 |
||
307 |
if test "x$grub_cv_check_end_symbol" = xyes; then
|
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
308 |
END_SYMBOL=end
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
309 |
elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
310 |
END_SYMBOL=_end
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
311 |
else
|
312 |
AC_MSG_ERROR([neither end nor _end is defined])
|
|
313 |
fi
|
|
314 |
])
|
|
315 |
||
316 |
dnl Check if the C compiler generates calls to `__enable_execute_stack()'. |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
317 |
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[ |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
318 |
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()']) |
1.15.16
by Colin Watson
Import upstream version 2.00 |
319 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[ |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
320 |
void f (int (*p) (void));
|
321 |
void g (int i)
|
|
322 |
{
|
|
323 |
int nestedfunc (void) { return i; }
|
|
324 |
f (nestedfunc);
|
|
325 |
}
|
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
326 |
]])]) |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
327 |
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then |
328 |
true |
|
329 |
else
|
|
330 |
AC_MSG_ERROR([${CC-cc} failed to produce assembly code]) |
|
331 |
fi
|
|
332 |
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then |
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
333 |
NEED_ENABLE_EXECUTE_STACK=1 |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
334 |
AC_MSG_RESULT([yes]) |
335 |
else
|
|
1.26.4
by Colin Watson
Import upstream version 1.99~20101122 |
336 |
NEED_ENABLE_EXECUTE_STACK=0 |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
337 |
AC_MSG_RESULT([no]) |
338 |
fi
|
|
339 |
rm -f conftest* |
|
340 |
]) |
|
341 |
||
342 |
||
343 |
dnl Check if the C compiler supports `-fstack-protector'. |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
344 |
AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
345 |
[# Smashing stack protector.
|
346 |
ssp_possible=yes]
|
|
347 |
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector']) |
|
348 |
# Is this a reliable test case?
|
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
349 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
350 |
void foo (void) { volatile char a[8]; a[3]; }
|
|
351 |
]])])
|
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
352 |
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling |
353 |
# `ac_compile' like this correct, after all? |
|
354 |
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
|
355 |
AC_MSG_RESULT([yes])
|
|
356 |
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'? |
|
357 |
rm -f conftest.s |
|
358 |
else
|
|
359 |
ssp_possible=no] |
|
360 |
AC_MSG_RESULT([no]) |
|
361 |
[fi] |
|
362 |
]) |
|
363 |
||
364 |
dnl Check if the C compiler supports `-mstack-arg-probe' (Cygwin). |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
365 |
AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
366 |
[# Smashing stack arg probe.
|
367 |
sap_possible=yes]
|
|
368 |
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe']) |
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
369 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
370 |
void foo (void) { volatile char a[8]; a[3]; }
|
|
371 |
]])])
|
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
372 |
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
373 |
AC_MSG_RESULT([yes])
|
|
374 |
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'? |
|
375 |
rm -f conftest.s |
|
376 |
else
|
|
377 |
sap_possible=no] |
|
378 |
AC_MSG_RESULT([no]) |
|
379 |
[fi] |
|
380 |
]) |
|
381 |
||
382 |
dnl Check if ln can handle directories properly (mingw). |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
383 |
AC_DEFUN([grub_CHECK_LINK_DIR],[ |
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
384 |
AC_MSG_CHECKING([whether ln can handle directories properly]) |
385 |
[mkdir testdir 2>/dev/null |
|
386 |
case $srcdir in
|
|
387 |
[\\/$]* | ?:[\\/]* ) reldir=$srcdir/include/grub/util ;; |
|
388 |
*) reldir=../$srcdir/include/grub/util ;; |
|
389 |
esac
|
|
390 |
if ln -s $reldir testdir/util 2>/dev/null ; then] |
|
391 |
AC_MSG_RESULT([yes]) |
|
392 |
[link_dir=yes |
|
393 |
else
|
|
394 |
link_dir=no] |
|
395 |
AC_MSG_RESULT([no]) |
|
396 |
[fi |
|
397 |
rm -rf testdir] |
|
398 |
]) |
|
399 |
||
400 |
dnl Check if the C compiler supports `-fPIE'. |
|
1.13.8
by Felix Zielcke
Import upstream version 1.98~20100126 |
401 |
AC_DEFUN([grub_CHECK_PIE],[
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
402 |
[# Position independent executable.
|
403 |
pie_possible=yes]
|
|
404 |
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default]) |
|
405 |
# Is this a reliable test case?
|
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
406 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
407 |
#ifdef __PIE__
|
408 |
int main() {
|
|
409 |
return 0;
|
|
410 |
}
|
|
411 |
#else
|
|
412 |
#error NO __PIE__ DEFINED
|
|
413 |
#endif
|
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
414 |
]])])
|
1.10.2
by Felix Zielcke
Import upstream version 1.97+20091125 |
415 |
|
416 |
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling |
|
417 |
# `ac_compile' like this correct, after all? |
|
418 |
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
|
|
419 |
AC_MSG_RESULT([yes])
|
|
420 |
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'? |
|
421 |
rm -f conftest.s |
|
422 |
else
|
|
423 |
pie_possible=no] |
|
424 |
AC_MSG_RESULT([no]) |
|
425 |
[fi] |
|
426 |
]) |
|
1.15.16
by Colin Watson
Import upstream version 2.00 |
427 |
|
428 |
dnl Check if the C compiler supports `-fPIC'. |
|
429 |
AC_DEFUN([grub_CHECK_PIC],[
|
|
430 |
[# Position independent executable.
|
|
431 |
pic_possible=yes]
|
|
432 |
AC_MSG_CHECKING([whether `$CC' has `-fPIC' as default]) |
|
433 |
# Is this a reliable test case?
|
|
434 |
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
|
435 |
#ifdef __PIC__
|
|
436 |
int main() {
|
|
437 |
return 0;
|
|
438 |
}
|
|
439 |
#else
|
|
440 |
#error NO __PIC__ DEFINED
|
|
441 |
#endif
|
|
442 |
]])])
|
|
443 |
||
444 |
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling |
|
445 |
# `ac_compile' like this correct, after all? |
|
446 |
if eval "$ac_compile -S -o conftest.s" 2> /dev/null; then]
|
|
447 |
AC_MSG_RESULT([yes])
|
|
448 |
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'? |
|
449 |
rm -f conftest.s |
|
450 |
else
|
|
451 |
pic_possible=no] |
|
452 |
AC_MSG_RESULT([no]) |
|
453 |
[fi] |
|
454 |
]) |