cvsimport
[findutils.git] / m4 / nullsort.m4
blob8173448290e5cd9f350a03f00a91638b473d4da6
1 AC_DEFUN([jy_SORTZ],
2   [AC_PATH_PROG([SORT], [sort], [sort])
3   AC_MSG_CHECKING([if $SORT supports the -z option])
4 # find out if the sort command has a working -z option.
5 if $SORT -z -c < "${srcdir:-.}/m4/order-good.bin" 2>/dev/null  >/dev/null
6 then
7         # sort has a -z option, but we have not yet established that 
8         # sort thinks there is more than one input line there.   We have 
9         # to make sort -c do its thing with the input lines in the wrong 
10         # order to determine that (we can't do it in one shot because 
11         # if sort returns nonzero we cant tell that it wasn't just 
12         # complaining about this unknown -z option.
13         if $SORT -z -c < "${srcdir:-.}/m4/order-bad.bin" 2>/dev/null >/dev/null
14         then
15                 # sort likes -z but it doesn't seem to make \0 
16                 # a delimiter.
17                 ac_sort_has_z=false
18         else
19                 ac_sort_has_z=true
20         fi
21 else
22         # Doesn't like the z option.
23         ac_sort_has_z=false
25 if $ac_sort_has_z
26 then
27         AC_MSG_RESULT([yes])
28         AC_SUBST(SORT_SUPPORTS_Z,[true])
29 else
30         AC_MSG_RESULT([no])
31         AC_SUBST(SORT_SUPPORTS_Z,[false])