samba4-0007-build-find-blkcnt_t-size-via-array.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From 934f8c8e9439de4f15b2e61016d5d29233d8d5fa Mon Sep 17 00:00:00 2001
  2. From: Gustavo Zacarias <gustavo@zacarias.com.ar>
  3. Date: Wed, 16 Apr 2014 08:01:36 -0300
  4. Subject: [PATCH 5/5] build: find blkcnt_t size via array
  5. Using the same trick as commit 0d9bb86293c9d39298786df095c73a6251b08b7e
  6. find blkcnt_t size via an array so that it can be determined via build
  7. rather than running it.
  8. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  9. ---
  10. source3/wscript | 22 ++++++++++++----------
  11. 1 file changed, 12 insertions(+), 10 deletions(-)
  12. diff --git a/source3/wscript b/source3/wscript
  13. index aade503..6a5728f 100644
  14. --- a/source3/wscript
  15. +++ b/source3/wscript
  16. @@ -277,18 +277,20 @@ int main(int argc, char **argv)
  17. headers='sys/types.h sys/stat.h unistd.h')
  18. if "HAVE_BLKCNT_T" in conf.env:
  19. - conf.CHECK_CODE('''
  20. - return sizeof(blkcnt_t) == 4 ? 0 : 1''',
  21. - 'SIZEOF_BLKCNT_T_4', execute=True,
  22. - headers='replace.h sys/types.h sys/stat.h unistd.h',
  23. - msg="Checking whether blkcnt_t is 32 bit")
  24. + conf.CHECK_CODE('''
  25. + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
  26. + 'SIZEOF_BLKCNT_T_4',
  27. + headers='replace.h sys/types.h sys/stat.h unistd.h',
  28. + msg="Checking whether blkcnt_t is 32 bit")
  29. + # If sizeof is 4 it can't be 8
  30. if "HAVE_BLKCNT_T" in conf.env:
  31. - conf.CHECK_CODE('''
  32. - return sizeof(blkcnt_t) == 8 ? 0 : 1''',
  33. - 'SIZEOF_BLKCNT_T_8', execute=True,
  34. - headers='replace.h sys/types.h sys/stat.h unistd.h',
  35. - msg="Checking whether blkcnt_t is 64 bit")
  36. + if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
  37. + conf.CHECK_CODE('''
  38. + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
  39. + 'SIZEOF_BLKCNT_T_8',
  40. + headers='replace.h sys/types.h sys/stat.h unistd.h',
  41. + msg="Checking whether blkcnt_t is 64 bit")
  42. # Check for POSIX capability support
  43. conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
  44. --
  45. 1.8.3.2