samba4-0005-build-find-blkcnt_t-size-via-array.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. Status: Upstream.
  9. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  10. ---
  11. source3/wscript | 22 ++++++++++++----------
  12. 1 file changed, 12 insertions(+), 10 deletions(-)
  13. diff --git a/source3/wscript b/source3/wscript
  14. index aade503..6a5728f 100644
  15. --- a/source3/wscript
  16. +++ b/source3/wscript
  17. @@ -277,18 +277,20 @@ int main(int argc, char **argv)
  18. headers='sys/types.h sys/stat.h unistd.h')
  19. if "HAVE_BLKCNT_T" in conf.env:
  20. - conf.CHECK_CODE('''
  21. - return sizeof(blkcnt_t) == 4 ? 0 : 1''',
  22. - 'SIZEOF_BLKCNT_T_4', execute=True,
  23. - headers='replace.h sys/types.h sys/stat.h unistd.h',
  24. - msg="Checking whether blkcnt_t is 32 bit")
  25. + conf.CHECK_CODE('''
  26. + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 4)];''',
  27. + 'SIZEOF_BLKCNT_T_4',
  28. + headers='replace.h sys/types.h sys/stat.h unistd.h',
  29. + msg="Checking whether blkcnt_t is 32 bit")
  30. + # If sizeof is 4 it can't be 8
  31. if "HAVE_BLKCNT_T" in conf.env:
  32. - conf.CHECK_CODE('''
  33. - return sizeof(blkcnt_t) == 8 ? 0 : 1''',
  34. - 'SIZEOF_BLKCNT_T_8', execute=True,
  35. - headers='replace.h sys/types.h sys/stat.h unistd.h',
  36. - msg="Checking whether blkcnt_t is 64 bit")
  37. + if not conf.CONFIG_SET('SIZEOF_BLKCNT_T_4'):
  38. + conf.CHECK_CODE('''
  39. + static int test_array[1 - 2 * !(((long int)(sizeof(blkcnt_t))) <= 8)];''',
  40. + 'SIZEOF_BLKCNT_T_8',
  41. + headers='replace.h sys/types.h sys/stat.h unistd.h',
  42. + msg="Checking whether blkcnt_t is 64 bit")
  43. # Check for POSIX capability support
  44. conf.CHECK_FUNCS_IN('cap_get_proc', 'cap', headers='sys/capability.h')
  45. --
  46. 1.8.3.2