1
dnl Copyright (C) 1993-2005 Free Software Foundation, Inc.
2
dnl This file is free software, distributed under the terms of the GNU
3
dnl General Public License. As a special exception to the GNU General
4
dnl Public License, this file may be distributed as part of a program
5
dnl that contains a configuration script generated by Autoconf, under
6
dnl the same distribution terms as the rest of that program.
8
dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
12
AC_DEFUN([CL_PCC_STRUCT_RETURN],
13
[AC_CACHE_CHECK([for pcc non-reentrant struct return convention], cl_cv_c_struct_return_static, [
15
test $CC_GCC = true && CFLAGS="$CFLAGS -O0"
16
AC_TRY_RUN(GL_NOCRASH[
17
typedef struct { int a; int b; int c; int d; int e; } foo;
18
foo foofun () { static foo foopi = {3141,5926,5358,9793,2385}; return foopi; }
19
foo* (*fun) () = (foo* (*) ()) foofun;
26
foo1 = foofun(); fooptr1 = (*fun)(&foo1);
27
foo2 = foofun(); fooptr2 = (*fun)(&foo2);
28
exit(!(fooptr1 == fooptr2 && fooptr1->c == 5358));
29
}}], cl_cv_c_struct_return_static=yes, cl_cv_c_struct_return_static=no,
30
dnl When cross-compiling, don't assume anything.
31
dnl There are even weirder return value passing conventions than pcc.
32
cl_cv_c_struct_return_static="guessing no")
35
case "$cl_cv_c_struct_return_static" in
36
*yes) AC_DEFINE(__PCC_STRUCT_RETURN__) ;;