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.
12
AC_DEFUN([CL_SMALL_STRUCT_RETURN],
13
[AC_CACHE_CHECK([whether small structs are returned in registers], cl_cv_c_struct_return_small, [
14
AC_TRY_RUN(GL_NOCRASH[
15
typedef struct { long x; } foo; long y;
16
foo foofun () { foo f; f.x = y; return f; }
17
long (*fun) () = (long (*) ()) foofun;
20
y = 37; if ((*fun)() != 37) exit(1);
21
y = 55; if ((*fun)() != 55) exit(1);
23
}], cl_cv_c_struct_return_small=yes, cl_cv_c_struct_return_small=no,
24
dnl When cross-compiling, don't assume anything.
25
dnl There are even weirder return value passing conventions than pcc.
26
cl_cv_c_struct_return_small="guessing no")
28
case "$cl_cv_c_struct_return_small" in
29
*yes) AC_DEFINE(__SMALL_STRUCT_RETURN__) ;;