Some versions of diff, notably the one that comes with HP-UX B.11.31,
do not support unified context diffs.
Detect which of unified or copied context diffs are supported.
Reported-by: Ian McNish <ian@ians.net>
Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
#!/bin/sh
+DIFF="@DIFF@"
+DIFF_OPTIONS="@DIFF_OPTIONS@"
EXEEXT=@EXEEXT@
srcdir=@srcdir@
@@ -17,7 +19,7 @@ for i in $srcdir/test_inputs/codegen/*.st \
dir=`dirname $i`
ref=$dir/$out
(./isl_codegen$EXEEXT < $i > $test &&
- diff -uw $ref $test && rm $test) || failed=1
+ "$DIFF" $DIFF_OPTIONS -w $ref $test && rm $test) || failed=1
done
test $failed -eq 0 || exit
@@ -40,6 +40,8 @@ AC_CHECK_PROG(PERL, perl, perl, [])
AC_CHECK_PROG(PDFLATEX, pdflatex, pdflatex, [])
AC_CHECK_PROG(POD2HTML, pod2html, pod2html, [])
+ISL_DETECT_DIFF_OPTIONS
+
AC_SUBST(OS_SRCDIR)
if test "$host_os" = "mingw32" -a -n "$CYGPATH"; then
OS_SRCDIR=`$CYGPATH -m "$srcdir"`
--- /dev/null
+AC_DEFUN([ISL_DETECT_DIFF_OPTIONS], [
+ AC_SUBST([DIFF_OPTIONS])
+ AC_PATH_PROG([DIFF], [diff])
+
+ AC_MSG_CHECKING([for $DIFF context option])
+ for opt in -u -c; do
+ if $DIFF $opt /dev/null /dev/null > /dev/null 2>&1; then
+ DIFF_OPTIONS=$opt
+ break
+ fi
+ done
+ AC_MSG_RESULT([$DIFF_OPTIONS])
+])