bitfields.m4 1.0 KB

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