Release v2.5.91
[platform/core/uifw/at-spi2-atk.git] / acinclude.m4
1 #######################
2 # type alignment test #
3 #######################
4
5 AC_DEFUN([DBIND_CHECK_ALIGNOF],
6         [changequote(<<, >>)dnl
7         dnl The name to #define.
8         define(<<AC_TYPE_NAME>>,
9                 translit(dbind_alignof_$1, [a-z *], [A-Z_P]))dnl
10         dnl The cache variable name.
11         define(<<AC_CV_NAME>>,
12                 translit(ac_cv_alignof_$1, [ *], [_p]))dnl
13         changequote([, ])dnl
14         AC_MSG_CHECKING(alignment of $1)
15         AC_CACHE_VAL(AC_CV_NAME,
16                 [AC_TRY_RUN(
17                         [ #include <stdio.h>
18                           #include <stdlib.h>
19                           #define DBUS_API_SUBJECT_TO_CHANGE
20                           #include <dbus/dbus.h>
21                         typedef struct {char s1;} dbind_struct;
22                         typedef void *dbind_pointer;
23                         struct test {char s1; $1 s2;};
24                         main()
25                         {
26                         FILE *f=fopen("conftestval", "w");
27                         if (!f) exit(1);
28                         fprintf(f, "%d\n", &(((struct test*)0)->s2));
29                         exit(0);
30                         } ],
31                         AC_CV_NAME=`cat conftestval`,
32                         AC_CV_NAME=0, AC_CV_NAME=0)
33                 ])dnl
34         AC_MSG_RESULT($AC_CV_NAME)
35         if test "$AC_CV_NAME" = "0" ; then
36                 AC_MSG_ERROR([Failed to find alignment. Check config.log for details.])
37         fi
38         AC_TYPE_NAME=$AC_CV_NAME
39         AC_SUBST(AC_TYPE_NAME)
40         undefine([AC_TYPE_NAME])dnl
41         undefine([AC_CV_NAME])dnl
42 ])
43