diff --git a/.pre-commit b/.pre-commit
index 852ce2f126892c89f30001ca2ccb0ac66617e30e..7519d6fb4ce06539d598808a3a8407638d2d5bca 100755
--- a/.pre-commit
+++ b/.pre-commit
@@ -18,6 +18,7 @@
 # set path to uncrustify binary
 # UNCRUSTIFY="/usr/bin/uncrustify"
 UNCRUSTIFY="uncrustify"
+CLANGFORMAT="clang-format"
 
 # set uncrustify config location
 # CONFIG="/home/user/.config/uncrustify.cfg"
@@ -40,6 +41,15 @@ PARSE_EXTS=true
 # FILE_EXTS=".c .h .cpp .hpp"
 FILE_EXTS=".c .h .cpp .hpp .cxx"
 
+##################################################################
+# check if uncrustify and clang-format exist in PATH
+exec_in_path() {
+	type $1 >/dev/null 2>&1 || { echo >&2 "Require '$1' executable but it was not found in PATH. Aborting."; exit 1; }
+}
+
+exec_in_path "$UNCRUSTIFY"
+exec_in_path "$CLANGFORMAT"
+
 ##################################################################
 # There should be no need to change anything below this line.
 
@@ -92,7 +102,7 @@ do
     #    +++ - timestamp
     # to both lines working on the same file and having a a/ and b/ prefix.
     # Else it can not be applied with 'git apply'.
-    clang-format "$file" | \
+    "$CLANGFORMAT" "$file" | \
     "$UNCRUSTIFY" -c "$CONFIG" -l "$SOURCE_LANGUAGE" | \
         diff -u -- "$file" - | \
         sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"