~ubuntu-branches/debian/squeeze/ffcall/squeeze

« back to all changes in this revision

Viewing changes to src/m4/ffcall-pccstruct.m4

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2010-06-26 15:29:30 UTC
  • mfrom: (5.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20100626152930-c09y01gk3szcnykn
Tags: 1.10+cvs20100619-2
Ship to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
7
 
 
8
 
dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
9
 
 
10
 
AC_PREREQ(2.13)
11
 
 
12
 
AC_DEFUN([CL_PCC_STRUCT_RETURN],
13
 
[AC_CACHE_CHECK([for pcc non-reentrant struct return convention], cl_cv_c_struct_return_static, [
14
 
save_CFLAGS="$CFLAGS"
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;
20
 
int main()
21
 
{ nocrash_init();
22
 
 {foo foo1;
23
 
  foo* fooptr1;
24
 
  foo foo2;
25
 
  foo* fooptr2;
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")
33
 
CFLAGS="$save_CFLAGS"
34
 
])
35
 
case "$cl_cv_c_struct_return_static" in
36
 
  *yes) AC_DEFINE(__PCC_STRUCT_RETURN__) ;;
37
 
  *no) ;;
38
 
esac
39
 
])