xref: /netbsd-src/external/gpl3/binutils.old/dist/config/bitfields.m4 (revision 16dce51364ebe8aeafbae46bc5aa167b8115bc45)
1*16dce513Schristosdnl Copyright (C) 2015 Free Software Foundation, Inc.
2*16dce513Schristosdnl This file is free software, distributed under the terms of the GNU
3*16dce513Schristosdnl General Public License.  As a special exception to the GNU General
4*16dce513Schristosdnl Public License, this file may be distributed as part of a program
5*16dce513Schristosdnl that contains a configuration script generated by Autoconf, under
6*16dce513Schristosdnl the same distribution terms as the rest of that program.
7*16dce513Schristos
8*16dce513Schristos# Define HAVE_BITFIELD_TYPE_MATTERS if the type of bitfields effects their
9*16dce513Schristos# alignment.
10*16dce513Schristos
11*16dce513SchristosAC_DEFUN([gt_BITFIELD_TYPE_MATTERS],
12*16dce513Schristos[
13*16dce513Schristos  AC_CACHE_CHECK([if the type of bitfields matters], gt_cv_bitfield_type_matters,
14*16dce513Schristos  [
15*16dce513Schristos    AC_TRY_COMPILE(
16*16dce513Schristos      [struct foo1 { char x; char y:1; char z; };
17*16dce513Schristosstruct foo2 { char x; long long int y:1; char z; };
18*16dce513Schristosint foo1test[ sizeof (struct foo1) < sizeof (struct foo2) ? 1 : -1 ]; ],
19*16dce513Schristos      [], gt_cv_bitfield_type_matters=yes, gt_cv_bitfield_type_matters=no)
20*16dce513Schristos  ])
21*16dce513Schristos  if test $gt_cv_bitfield_type_matters = yes; then
22*16dce513Schristos    AC_DEFINE(HAVE_BITFIELD_TYPE_MATTERS, 1,
23*16dce513Schristos      [Define if the type of bitfields effects alignment.])
24*16dce513Schristos  fi
25*16dce513Schristos])
26