290 |
AC_MSG_ERROR([neither end nor _end is defined]) |
AC_MSG_ERROR([neither end nor _end is defined]) |
291 |
fi |
fi |
292 |
]) |
]) |
293 |
|
|
294 |
|
dnl Check if the C compiler has a bug while using nested functions when |
295 |
|
dnl mregparm is used on the i386. Some gcc versions do not pass the third |
296 |
|
dnl parameter correctly to the nested function. |
297 |
|
dnl Written by Marco Gerards. |
298 |
|
AC_DEFUN(pupa_I386_CHECK_REGPARM_BUG, |
299 |
|
[AC_REQUIRE([AC_PROG_CC]) |
300 |
|
AC_MSG_CHECKING([if GCC has the regparm=3 bug]) |
301 |
|
AC_CACHE_VAL(pupa_cv_i386_check_nested_functions, |
302 |
|
[AC_RUN_IFELSE([AC_LANG_SOURCE( |
303 |
|
[[int *p; |
304 |
|
|
305 |
|
int |
306 |
|
main () |
307 |
|
{ |
308 |
|
int test; |
309 |
|
|
310 |
|
int __attribute__ ((__regparm__ (3))) nestedfunc (int a, int b, int c) |
311 |
|
{ |
312 |
|
return (&test == p); |
313 |
|
} |
314 |
|
|
315 |
|
p = &test; |
316 |
|
return nestedfunc (0, 0, 0); |
317 |
|
} |
318 |
|
]])], |
319 |
|
[pupa_cv_i386_check_nested_functions=yes], |
320 |
|
[pupa_cv_i386_check_nested_functions=no])]) |
321 |
|
|
322 |
|
AC_MSG_RESULT([$pupa_cv_i386_check_nested_functions]) |
323 |
|
|
324 |
|
if test "x$pupa_cv_i386_check_nested_functions" = xyes; then |
325 |
|
AC_DEFINE([NESTED_FUNC_ATTR], |
326 |
|
[__attribute__ ((__regparm__ (2)))], |
327 |
|
[Catch gcc bug]) |
328 |
|
else |
329 |
|
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug]) |
330 |
|
fi |
331 |
|
]) |