File: ax_c___alignof__.m4

package info (click to toggle)
sigscheme 0.8.5-4.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,752 kB
  • ctags: 7,396
  • sloc: lisp: 37,498; ansic: 30,976; sh: 10,329; makefile: 746; asm: 333; ruby: 288
file content (56 lines) | stat: -rw-r--r-- 1,482 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
dnl Copyright (C) 2006 YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
dnl
dnl Copying and distribution of this file, with or without modification,
dnl are permitted in any medium without royalty provided the copyright
dnl notice and this notice are preserved.
dnl
dnl
dnl @synopsis AX_C___ALIGNOF__
dnl
dnl Checks if __alignof__ operator is available.
dnl
dnl @category C
dnl @author YAMAMOTO Kengo <yamaken AT bp.iij4u.or.jp>
dnl @version 2006-12-12
dnl @license AllPermissive

AC_DEFUN([AX_C___ALIGNOF__], [
  AC_CACHE_CHECK([for __alignof__],
    [ax_cv_c___alignof__],
    [AC_COMPILE_IFELSE([[
struct _st {
  int i;
  char c;
  void *p;
};

int  c[__alignof__(char)];
int  s[__alignof__(short)];
int  i[__alignof__(int)];
int  l[__alignof__(long)];
int vp[__alignof__(void *)];
int st[__alignof__(struct _st)];

/* test whether ((__alignof__(type)) != 0) */
int  c2[((__alignof__(char))       > 0) ? 1 : -1];
int  s2[((__alignof__(short))      > 0) ? 1 : -1];
int  i2[((__alignof__(int))        > 0) ? 1 : -1];
int  l2[((__alignof__(long))       > 0) ? 1 : -1];
int vp2[((__alignof__(void *))     > 0) ? 1 : -1];
int st2[((__alignof__(struct _st)) > 0) ? 1 : -1];

int
f(void)
{
  short sv;

  return (__alignof__(sv) >= __alignof__(char));
}
      ]],
      [ax_cv_c___alignof__=yes],
      [ax_cv_c___alignof__=no])])
  if test "x$ax_cv_c___alignof__" = xyes; then
    AC_DEFINE([HAVE___ALIGNOF__], [1],
              [Define to 1 if __alignof__ operator is available.])
  fi
])