nullsort.m4 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. AC_DEFUN([jy_SORTZ],
  2. [AC_PATH_PROG([SORT], [sort], [sort])
  3. AC_MSG_CHECKING([if $SORT supports the -z option])
  4. if test "x$cross_compiling" = xyes
  5. then
  6. # We are cross-compiling, so cannot test the target's "sort".
  7. ac_sort_has_z=false
  8. else
  9. # find out if the sort command has a working -z option.
  10. if $SORT -z -c < "${srcdir:-.}/m4/order-good.bin" 2>/dev/null >/dev/null
  11. then
  12. # sort has a -z option, but we have not yet established that
  13. # sort thinks there is more than one input line there. We have
  14. # to make sort -c do its thing with the input lines in the wrong
  15. # order to determine that (we can't do it in one shot because
  16. # if sort returns nonzero we can't tell that it wasn't just
  17. # complaining about this unknown -z option.
  18. if $SORT -z -c < "${srcdir:-.}/m4/order-bad.bin" 2>/dev/null >/dev/null
  19. then
  20. # sort likes -z but it doesn't seem to make \0
  21. # a delimiter.
  22. ac_sort_has_z=false
  23. else
  24. ac_sort_has_z=true
  25. fi
  26. else
  27. # Doesn't like the z option.
  28. ac_sort_has_z=false
  29. fi
  30. fi
  31. if test "x$cross_compiling" = xyes
  32. then
  33. AC_MSG_RESULT([assume no, since we are cross compiling])
  34. AC_SUBST(SORT_SUPPORTS_Z,[false])
  35. elif $ac_sort_has_z
  36. then
  37. AC_MSG_RESULT([yes])
  38. AC_SUBST(SORT_SUPPORTS_Z,[true])
  39. else
  40. AC_MSG_RESULT([no])
  41. AC_SUBST(SORT_SUPPORTS_Z,[false])
  42. fi
  43. ])