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