gst-indent: Use the same logic to find gnuindent as the git hook
authorJan Schmidt <thaytan@noraisin.net>
Wed, 4 Nov 2009 01:54:36 +0000 (01:54 +0000)
committerJan Schmidt <thaytan@noraisin.net>
Wed, 4 Nov 2009 11:36:19 +0000 (11:36 +0000)
tools/gst-indent

index 1d088f19c3a7c4e004808bb68800ac1d781e36f4..b3cff4793cbcc9592c0183f5a7487543df6ff769 100755 (executable)
@@ -1,5 +1,29 @@
 #!/bin/sh
-indent \
+
+version=`gnuindent --version 2>/dev/null`
+if test "x$version" = "x"; then
+  version=`indent --version 2>/dev/null`
+  if test "x$version" = "x"; then
+    echo "GStreamer git pre-commit hook:"
+    echo "Did not find GNU indent, please install it before continuing."
+    exit 1
+  fi
+  INDENT=indent
+else
+  INDENT=gnuindent
+fi
+
+case `$INDENT --version` in
+  GNU*)
+      ;;
+  default)
+      echo "Did not find GNU indent, please install it before continuing."
+      echo "(Found $INDENT, but it doesn't seem to be GNU indent)"
+      exit 1
+      ;;
+esac
+
+$INDENT \
   --braces-on-if-line \
   --case-brace-indentation0 \
   --case-indentation2 \