1
dnl Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
3
dnl Copying and distribution of this file, with or without modification,
4
dnl are permitted in any medium without royalty provided the copyright
5
dnl notice and this notice are preserved.
8
dnl @synopsis AX_C___ALIGNOF__
10
dnl Checks if __alignof__ operator is available.
13
dnl @author YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
14
dnl @version 2006-12-12
15
dnl @license AllPermissive
17
AC_DEFUN([AX_C___ALIGNOF__], [
18
AC_CACHE_CHECK([for __alignof__],
19
[ax_cv_c___alignof__],
27
int c[__alignof__(char)];
28
int s[__alignof__(short)];
29
int i[__alignof__(int)];
30
int l[__alignof__(long)];
31
int vp[__alignof__(void *)];
32
int st[__alignof__(struct _st)];
34
/* test whether ((__alignof__(type)) != 0) */
35
int c2[((__alignof__(char)) > 0) ? 1 : -1];
36
int s2[((__alignof__(short)) > 0) ? 1 : -1];
37
int i2[((__alignof__(int)) > 0) ? 1 : -1];
38
int l2[((__alignof__(long)) > 0) ? 1 : -1];
39
int vp2[((__alignof__(void *)) > 0) ? 1 : -1];
40
int st2[((__alignof__(struct _st)) > 0) ? 1 : -1];
47
return (__alignof__(sv) >= __alignof__(char));
50
[ax_cv_c___alignof__=yes],
51
[ax_cv_c___alignof__=no])])
52
if test "x$ax_cv_c___alignof__" = xyes; then
53
AC_DEFINE([HAVE___ALIGNOF__], [1],
54
[Define to 1 if __alignof__ operator is available.])