1 #######################
2 # type alignment test #
3 #######################
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
14 AC_MSG_CHECKING(alignment of $1)
15 AC_CACHE_VAL(AC_CV_NAME,
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;};
26 FILE *f=fopen("conftestval", "w");
28 fprintf(f, "%d\n", &(((struct test*)0)->s2));
31 AC_CV_NAME=`cat conftestval`,
32 AC_CV_NAME=0, AC_CV_NAME=0)
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.])
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