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