diff.m4 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. dnl file : m4/diff.m4
  2. dnl copyright : Copyright (c) 2013-2014 Code Synthesis Tools CC
  3. dnl license : MIT; see accompanying LICENSE file
  4. dnl
  5. dnl DIFF_TOOL
  6. dnl
  7. AC_DEFUN([DIFF_TOOL], [
  8. diff_found=no
  9. AC_ARG_VAR([DIFF],[diff command])
  10. AC_ARG_VAR([DIFFFLAGS],[diff flags])
  11. AC_ARG_WITH(
  12. [diff],
  13. [AC_HELP_STRING([--with-diff=PATH],[path to the diff program])],
  14. [diff_path=${withval}],
  15. [diff_path=])
  16. AC_MSG_CHECKING([for diff])
  17. if test x"$DIFF" = x; then
  18. if test x"$diff_path" != x; then
  19. AS_SET_CATFILE([abs_diff_path], [$ac_pwd], [$diff_path])
  20. DIFF="$abs_diff_path"
  21. else
  22. DIFF=diff
  23. fi
  24. fi
  25. cat >conftest.txt
  26. $DIFF conftest.txt conftest.txt 2>/dev/null 1>&2
  27. if test x"$?" = x0; then
  28. AC_MSG_RESULT([$DIFF])
  29. else
  30. AC_MSG_RESULT([no])
  31. AC_MSG_ERROR([diff command is not found; consider setting the DIFF variable or using --with-diff=PATH])
  32. fi
  33. AC_MSG_CHECKING([whether $DIFF accepts -u])
  34. $DIFF -u conftest.txt conftest.txt 2>/dev/null 1>&2
  35. if test x"$?" = x0; then
  36. AC_MSG_RESULT([yes])
  37. DIFFFLAGS="$DIFFFLAGS -u"
  38. else
  39. AC_MSG_RESULT([no])
  40. fi
  41. rm -f conftest.txt
  42. ])dnl