1
0

001-unix-configure-borrow-the-LFS-test-from-autotools.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. From fc392c939b9a18959482f588aff0afc29dd6d30a Mon Sep 17 00:00:00 2001
  2. From: Romain Naour <romain.naour at openwide.fr>
  3. Date: Fri, 23 Jan 2015 22:20:18 +0100
  4. Subject: [PATCH 6/6] unix/configure: borrow the LFS test from autotools.
  5. Infozip's LFS check can't work for cross-compilation
  6. since it try to run a target's binary on the host system.
  7. Instead, use to LFS test used by autotools which is a
  8. compilation test.
  9. (see autotools/lib/autoconf/specific.m4)
  10. Reported-by: Richard Genoud <richard.genoud at gmail.com>
  11. Signed-off-by: Romain Naour <romain.naour at openwide.fr>
  12. ---
  13. configure | 46 +++++++++++++++-------------------------------
  14. 1 file changed, 15 insertions(+), 31 deletions(-)
  15. diff --rupN a/unix/configure b/unix/configure
  16. --- a/unix/configure
  17. +++ b/unix/configure
  18. @@ -399,9 +399,8 @@ else
  19. fi
  20. -# Now we set the 64-bit file environment and check the size of off_t
  21. -# Added 11/4/2003 EG
  22. -# Revised 8/12/2004 EG
  23. +# LFS check borrowed from autotools sources
  24. +# lib/autoconf/specific.m4
  25. echo Check for Large File Support
  26. cat > conftest.c << _EOF_
  27. @@ -410,23 +409,19 @@ cat > conftest.c << _EOF_
  28. # define _FILE_OFFSET_BITS 64 /* select default interface as 64 bit */
  29. # define _LARGE_FILES /* some OSes need this for 64-bit off_t */
  30. #include <sys/types.h>
  31. -#include <sys/stat.h>
  32. -#include <unistd.h>
  33. -#include <stdio.h>
  34. +
  35. + /* Check that off_t can represent 2**63 - 1 correctly.
  36. + We can't simply define LARGE_OFF_T to be 9223372036854775807,
  37. + since some C++ compilers masquerading as C compilers
  38. + incorrectly reject 9223372036854775807. */
  39. +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  40. + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
  41. + && LARGE_OFF_T % 2147483647 == 1)
  42. + ? 1 : -1];
  43. +
  44. int main()
  45. {
  46. - off_t offset;
  47. - struct stat s;
  48. - /* see if have 64-bit off_t */
  49. - if (sizeof(offset) < 8)
  50. - return 1;
  51. - printf(" off_t is %d bytes\n", sizeof(off_t));
  52. - /* see if have 64-bit stat */
  53. - if (sizeof(s.st_size) < 8) {
  54. - printf(" s.st_size is %d bytes\n", sizeof(s.st_size));
  55. - return 2;
  56. - }
  57. - return 3;
  58. + return 0;
  59. }
  60. _EOF_
  61. # compile it
  62. @@ -434,19 +429,8 @@ $CC -o conftest conftest.c >/dev/null 2>
  63. if [ $? -ne 0 ]; then
  64. echo -- no Large File Support
  65. else
  66. -# run it
  67. - ./conftest
  68. - r=$?
  69. - if [ $r -eq 1 ]; then
  70. - echo -- no Large File Support - no 64-bit off_t
  71. - elif [ $r -eq 2 ]; then
  72. - echo -- no Large File Support - no 64-bit stat
  73. - elif [ $r -eq 3 ]; then
  74. - echo -- yes we have Large File Support!
  75. - CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
  76. - else
  77. - echo -- no Large File Support - conftest returned $r
  78. - fi
  79. + echo -- yes we have Large File Support!
  80. + CFLAGS="${CFLAGS} -DLARGE_FILE_SUPPORT"
  81. fi