From 6b598e34da6299260c7cd8e46d139611c5671a54 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <bussi@MBP-30680.homenet.telecomitalia.it>
Date: Sun, 13 May 2018 20:08:37 +0200
Subject: [PATCH] Add check astyle

Check first if astyle is present. In this way, when astyle is not compiled,
we get a single error instead of one error per file.
---
 src/maketools/plumedcheck | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/maketools/plumedcheck b/src/maketools/plumedcheck
index 126eb099e..3dd387304 100755
--- a/src/maketools/plumedcheck
+++ b/src/maketools/plumedcheck
@@ -145,6 +145,10 @@ BEGIN{
 
 # create tmp dir for future usage
   "mktemp -dt plumed.XXXXXX" | getline tmpdir
+
+# checking astyle presence
+  astyle_available=!system(astyle " --version > /dev/null 2> /dev/null") 
+  if(!astyle_available) error("astyle_not_available","astyle not available on this system, skipping astyle checks")
 }
 
 # for each input file
@@ -198,7 +202,7 @@ BEGINFILE{
 # checks that are done only on some modules will be skipped if the module name is not known
   if((filetype=="source" || filetype=="header") && !module) information("missing_module_name","module name is not know, some check will be skipped");
 
-  if(filetype=="source" || filetype=="header"){
+  if(astyle_available && (filetype=="source" || filetype=="header")){
     tempfile = tmpdir "/astyle"
     system(astyle " --options=" astyle_options " < " FILENAME " > " tempfile)
     s=system("diff -q " FILENAME " " tempfile ">/dev/null 2>/dev/null")
-- 
GitLab