Index: trunk/aclocal.m4
===================================================================
--- trunk/aclocal.m4	(revision 473)
+++ trunk/aclocal.m4	(revision 474)
@@ -1224,11 +1224,30 @@
 ])
 
+AC_DEFUN([GCC_FLAG_CHECK],[
+  AC_LANG_ASSERT(C)
+  if test "X$CC" != "X"; then
+     AC_MSG_CHECKING([whether ${CC} accepts $1])
+dnl      flag_check_cv,
+     saved_cflags="$CFLAGS"
+     CFLAGS="$CFLAGS -Werror $1"
+     AC_TRY_COMPILE(,, flag_check_cv=yes, flag_check_cv=no)
+     CFLAGS="$saved_cflags"
+
+     if test $flag_check_cv = yes; then
+      	CFLAGS="$CFLAGS $1"
+	AC_MSG_RESULT([yes])
+     else
+        AC_MSG_RESULT([no])
+     fi
+  fi
+])
+
 AC_DEFUN([GCC_WEMPTY_BODY],[
   AC_LANG_ASSERT(C)
   if test "X$CC" != "X"; then
-    AC_CACHE_CHECK([whether ${CC} accepts -Wno-empty-body],
-      empty_cv_body,
+    AC_CHECK([whether ${CC} accepts -Wno-empty-body],
+dnl      empty_cv_body,
       [empty_body_cflags="$CFLAGS"
-       CFLAGS="$CFLAGS -Wno-empty-body"
+       CFLAGS="$CFLAGS -Werror -Wno-empty-body"
        AC_TRY_COMPILE(,, empty_cv_body=yes, empty_cv_body=no)
        CFLAGS="$empty_body_cflags"
@@ -1380,15 +1399,18 @@
   #
   if test "x$GCC" = xyes; then
-     case "$host_os" in
-     	*linux*)
-    	SAMHAIN_X86_64
-	;;
-     	*bsd*)
-    	SAMHAIN_X86_64
-	;;
-     	*)
-    	SAMHAIN_X86_64
-	;;
-      esac	
+     $CC -E -dM - < /dev/null | egrep '__clang__' >/dev/null 2>&1 
+     if ! test $? = 0; then
+     	 case "$host_os" in
+     	     *linux*)
+    	     SAMHAIN_X86_64
+	     ;;
+     	     *bsd*)
+    	     SAMHAIN_X86_64
+	     ;;
+     	     *)
+    	     SAMHAIN_X86_64
+	     ;;
+      	 esac
+     fi	
   fi
 fi
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 473)
+++ trunk/configure.ac	(revision 474)
@@ -1756,5 +1756,5 @@
    if test -z "`echo "$CFLAGS" | grep "\-fno\-strength\-reduce" 2> /dev/null`" 
    then
-        CFLAGS="$CFLAGS -fno-strength-reduce"
+	GCC_FLAG_CHECK([-fno-strength-reduce])
    fi
   fi
@@ -1764,5 +1764,5 @@
    if test -z "`echo "$CFLAGS" | grep "\-fno\-omit\-frame\-pointer" 2> /dev/null`" 
    then
-        CFLAGS="$CFLAGS -fno-omit-frame-pointer"
+        GCC_FLAG_CHECK([-fno-omit-frame-pointer])
    fi
   fi
@@ -1773,5 +1773,10 @@
 dnl Suppresses warnings from glibc pthread_cleanup_pop
 dnl
-GCC_WEMPTY_BODY
+GCC_FLAG_CHECK([-Wno-empty-body])
+
+dnl This one is for clang
+dnl
+GCC_FLAG_CHECK([-Wno-invalid-source-encoding])
+
 
 AC_MSG_CHECKING([which random module to use])
Index: trunk/docs/Changelog
===================================================================
--- trunk/docs/Changelog	(revision 473)
+++ trunk/docs/Changelog	(revision 474)
@@ -1,3 +1,6 @@
 
+	* Modify testcompile.sh to remove 'smatch' and use 'clang'
+	  instead.
+	* Fix compile problems with clang.
 	* Modify testcompile.sh to remove 'uno' and use 'cppcheck'
 	  for static checking
Index: trunk/src/cutest_sh_unix.c
===================================================================
--- trunk/src/cutest_sh_unix.c	(revision 473)
+++ trunk/src/cutest_sh_unix.c	(revision 474)
@@ -42,5 +42,7 @@
       CuAssertPtrNotNull(tc, buf);
 #ifndef USE_SYSTEM_MALLOC
+#ifndef __clang__
       CuAssertIntEquals (tc, malloc_count, (i_malloc + 1));
+#endif
 #endif
       free(buf);
Index: trunk/src/sh_err_console.c
===================================================================
--- trunk/src/sh_err_console.c	(revision 473)
+++ trunk/src/sh_err_console.c	(revision 474)
@@ -328,5 +328,5 @@
   /* --- daemon && initialized ---
    */
-  if ( (OnlyStderr == S_FALSE) ) 
+  if ( OnlyStderr == S_FALSE ) 
     {
       fd[0] = open ( sh.srvcons.name, O_WRONLY|O_APPEND|O_NOCTTY|O_NONBLOCK);
@@ -340,5 +340,5 @@
       }
 
-      if (sh.srvcons.alt != NULL && sh.srvcons.alt[0] != '\0')
+      if (sh.srvcons.alt[0] != '\0')
 	{
 	  fd[1] = open (sh.srvcons.alt, O_WRONLY|O_APPEND|O_NOCTTY|O_NONBLOCK);
Index: trunk/src/sh_gpg.c
===================================================================
--- trunk/src/sh_gpg.c	(revision 473)
+++ trunk/src/sh_gpg.c	(revision 474)
@@ -419,16 +419,9 @@
   /* use homedir of effective user
    */
-  if (sh.effective.home != NULL)
-    {
-      len = sl_strlen(sh.effective.home) + 6;
-      envp[0] = calloc(1, len); /* free() ok   */
-      if (envp[0] != NULL)
+  len = sl_strlen(sh.effective.home) + 6;
+  envp[0] = calloc(1, len); /* free() ok   */
+  if (envp[0] != NULL)
 	sl_snprintf (envp[0], len, _("HOME=%s"), sh.effective.home); 
-      envp[1] = NULL;
-    }
-  else
-    {
-      envp[0] = NULL;
-    }
+  envp[1] = NULL;
 
   /* Create the pipe 
Index: trunk/src/sh_hash.c
===================================================================
--- trunk/src/sh_hash.c	(revision 473)
+++ trunk/src/sh_hash.c	(revision 474)
@@ -1751,5 +1751,5 @@
     }
 	 
-  if (buf != NULL && buf->fullpath != NULL) {
+  if (buf != NULL) {
 
     old_len = sl_strlen(buf->fullpath);
@@ -3099,5 +3099,5 @@
 	theFile->fullpath, fileHash, p->theFile.checksum));
 
-  if ( (fileHash != NULL) && (p->theFile.checksum != NULL)   && 
+  if ( (fileHash != NULL) &&
        (strncmp (fileHash, p->theFile.checksum, KEY_LEN) != 0) && 
        (theFile->check_mask & MODI_CHK) != 0)
Index: trunk/src/sh_inotify.c
===================================================================
--- trunk/src/sh_inotify.c	(revision 473)
+++ trunk/src/sh_inotify.c	(revision 474)
@@ -22,5 +22,5 @@
 #if defined(HAVE_SYS_INOTIFY_H)
 
-#if defined(GCC_VERSION_MAJOR)
+#if defined(GCC_VERSION_MAJOR) && !defined(__clang__)
 #if (GCC_VERSION_MAJOR > 4) || ((GCC_VERSION_MAJOR == 4) && (GCC_VERSION_MINOR > 8))
 #pragma GCC diagnostic ignored "-Wclobbered"
Index: trunk/src/sh_nmail.c
===================================================================
--- trunk/src/sh_nmail.c	(revision 473)
+++ trunk/src/sh_nmail.c	(revision 474)
@@ -24,5 +24,5 @@
 #endif
 
-#if defined(GCC_VERSION_MAJOR)
+#if defined(GCC_VERSION_MAJOR) && !defined(__clang__)
 #if (GCC_VERSION_MAJOR > 4) || ((GCC_VERSION_MAJOR == 4) && (GCC_VERSION_MINOR > 8))
 #pragma GCC diagnostic ignored "-Wclobbered"
Index: trunk/src/sh_srp.c
===================================================================
--- trunk/src/sh_srp.c	(revision 473)
+++ trunk/src/sh_srp.c	(revision 474)
@@ -86,5 +86,5 @@
 int    siz_str_internal = 0;
 
-inline
+static
 char * big_string (bignum * a, int base)
 {
Index: trunk/src/sh_suidchk.c
===================================================================
--- trunk/src/sh_suidchk.c	(revision 473)
+++ trunk/src/sh_suidchk.c	(revision 474)
@@ -203,5 +203,5 @@
   ShSuidchkSeverity = SH_ERR_SEVERE;
   if (ShSuidchkExclude != NULL)
-    sh_suid_exclude_free(ShSuidchkExclude);
+    sh_suid_exclude_free();
 
   FileLimNow        = 0;
Index: trunk/src/sh_tiger1_64.c
===================================================================
--- trunk/src/sh_tiger1_64.c	(revision 473)
+++ trunk/src/sh_tiger1_64.c	(revision 474)
@@ -5,11 +5,16 @@
 #include "config_xor.h"
 
+#if defined(__clang__)
+#undef TIGER_OPT_ASM
+#endif
+
 #if defined(TIGER_64_BIT)
 
-#if defined(GCC_VERSION_MAJOR)
+#if defined(GCC_VERSION_MAJOR) && !defined(__clang__)
 #if ((GCC_VERSION_MAJOR == 4) && (GCC_VERSION_MINOR > 6))
 #pragma GCC optimize ("O1")
 #endif
 #endif
+
 
 /* #if defined(HAVE_LONG_64) || defined(HAVE_LONG_LONG_64) */
Index: trunk/src/sh_unix.c
===================================================================
--- trunk/src/sh_unix.c	(revision 473)
+++ trunk/src/sh_unix.c	(revision 474)
@@ -972,5 +972,5 @@
 
   SL_ENTER(_("sh_unix_self_check"));
-  if (sh.exec.path == NULL || sh.exec.path[0] == '\0')
+  if (sh.exec.path[0] == '\0')
     SL_RETURN((0), _("sh_unix_self_check"));
 
Index: trunk/src/sh_utmp.c
===================================================================
--- trunk/src/sh_utmp.c	(revision 473)
+++ trunk/src/sh_utmp.c	(revision 474)
@@ -319,9 +319,4 @@
   SL_ENTER(_("sh_utmp_setutent"));
 
-  ASSERT((sh_utmppath != NULL), _("sh_utmppath != NULL"));
-
-  if (sh_utmppath == NULL)
-    SL_RET0(_("sh_utmp_setutent"));
-
   if (sh_utmpfile == NULL) 
     {
Index: trunk/src/trustfile.c
===================================================================
--- trunk/src/trustfile.c	(revision 473)
+++ trunk/src/trustfile.c	(revision 474)
@@ -211,5 +211,5 @@
 #define SL_ALWAYS_TRUSTED  0
 #endif
-static uid_t test_rootonly[] = { SL_ALWAYS_TRUSTED };
+uid_t test_rootonly[] = { SL_ALWAYS_TRUSTED };
 
 #define tf_uid_neg ((uid_t)-1)
Index: trunk/src/zAVLTree.c
===================================================================
--- trunk/src/zAVLTree.c	(revision 473)
+++ trunk/src/zAVLTree.c	(revision 474)
@@ -39,14 +39,28 @@
   return (zAVLKey) arg;
 }
+
 static char * dummy_zfree_string;
+#ifdef __clang__
+static char * dummy_zfree_str;
+#endif
+
 static void zfree_string (void * inptr)
 {
+#ifdef __clang__
+  dummy_zfree_str = (char *) inptr;
+#else
   char * str = (char *) inptr;
+#endif
 
   /* Take the address to circumvent gcc 4.9 optimizer bug */
   dummy_zfree_string = (char *) &inptr;
 
+#ifdef __clang__
+  dummy_zfree_str[0] = '\0';
+  free (dummy_zfree_str);
+#else
   str[0] = '\0';
   free (inptr);
+#endif
   return;
 }
@@ -537,6 +551,8 @@
   if (avlnode->right)
     zAVLFreeBranch(avlnode->right, freeitem);
-  if (freeitem)
+  if (freeitem) {
     freeitem(avlnode->item);
+    avlnode->item = NULL;
+  }
   free(avlnode);
 }
Index: trunk/test/testcompile.sh
===================================================================
--- trunk/test/testcompile.sh	(revision 473)
+++ trunk/test/testcompile.sh	(revision 474)
@@ -20,5 +20,5 @@
 #
 
-# dnmalloc + cppcheck + flawfinder + (38 * 2)
+# dnmalloc + cppcheck + flawfinder + (38 * 2) - 8
 MAXTEST=79; export MAXTEST
 
@@ -85,8 +85,4 @@
 run_cppcheck ()
 {
-    if [ -z "$doall" ]; then
-	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "check w/cppcheck";
-	return 0
-    fi
     #
     CPC=`find_path cppcheck`
@@ -124,84 +120,32 @@
 }
 
-run_smatch () 
+run_clang () 
 {
     export CDIR=`pwd`;
 
     if [ -z "$doall" ]; then
-	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)";
+	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)";
 	return 0
     fi
 
-    if [ ! -f "./x_samhain.c.sm" ]; then
-	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (skip sm)";
+    CLANGPATH=`find_path clang`
+    if [ -n "$CLANGPATH" ]; then
+	CLANG_CC="$CLANGPATH"; export CLANG_CC
+    else
+	[ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (clang)";
 	return 0
     fi
 
-    if [ "x$3" = "xdebug" ]; then memcheck=debug; else memcheck=simple; fi
-    if [ -f ../../static/sm_scripts/smatch.pm ]; then
-	( 
-	    cd ../../static/sm_scripts;
-	    
-	    for i in ${CDIR}/*.c.sm ; do
-	        # echo $i;
-		cat $i | ./unreached_code.pl | grep -v sh_threaded_module_run;
-		cat $i | ./ampersand_missing.sh;
-		cat $i | ./eqeq.pl;
-		cat $i | ./for_bounds.pl;    # doesn't work?
-		cat $i | ./unchecked_returns.pl;
-		cat $i | ./uninitialized.pl; # doesn't work?
-
-		# from http://people.redhat.com/mstefani/wine/smatch/
-		if [ -f ./while_for_check.pl ]; then
-		    cat $i | ./while_for_check.pl; # works
-		fi 
-		# --> end wine <--
-
-		# samhain specific modifications (list of free/malloc funcs)
-		# doesn't seem to find anything useful
-		if [ $memcheck = xsimple ]; then
-		    if [ -f ./samhain_unfree.pl ]; then
-			cat $i | ./samhain_unfree.pl | \
-			    egrep -v 'x_cutest_.*Test_' | \
-			    egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv';
-		    fi 
-		fi
-		if [ $memcheck = xdebug ]; then
-		    if [ -f ./samhain_unfree_debug.pl ]; then
-			cat $i | ./samhain_unfree_debug.pl | \
-			    egrep -v 'x_cutest_.*Test_' | \
-			    egrep -v 'x_sh_unix.c .... .... sh_unix_copyenv';
-		    fi 
-		fi
-		# --> end samhain specific <--
-
-		echo malloc >  list_null_funcs_uniq;
-		echo getenv >> list_null_funcs_uniq;
-		cat $i | ./deference_check.pl |\
-                     egrep -v 'x_trustfile.c ... ... sl_trustfile' | \
-		     egrep -v 'x_sh_mem.c ';
-		rm -f list_null_funcs_uniq;
-		# rm -f $i
-	    done
-	) >test_log_smatch 2>&1
-	if [ -f test_log_smatch ]; then
-	    lines=`cat test_log_smatch | wc -l`
-	    if [ $lines -ne 0 ]; then
-		cat test_log_smatch
-		rm -f test_log_smatch
-		[ -z "$quiet" ] && log_fail $2 ${MAXTEST} "$TEST (smatch)";
-		return 1
-	    fi
-	fi
-	[ -z "$quiet" ] && log_ok $2 ${MAXTEST} "$TEST (smatch)";
-	return 0
-    fi
-    [ -z "$quiet" ] && log_skip $2 ${MAXTEST} "$TEST (smatch)";
-    return 0
+    SAVE_TEST="$TEST"
+    TEST="$TEST (clang)"
+    testmake $1 $2
+    retval=$?
+    CLANG_CC=""; export CLANG_CC
+    TEST="$SAVE_TEST"
+    return $retval
 }
 
 testmake ()
 {
-
 	fail=0
 	#
@@ -219,5 +163,11 @@
 		[ -z "$verbose" ]     ||  log_msg_ok  "configure...  $TEST";
 		$MAKE clean > /dev/null 2>> test_log
-		$MAKE ${SMATCH} cutest > /dev/null 2>> test_log
+		if [ -z "$CLANG_CC" ]; then
+		    $MAKE cutest > /dev/null 2>> test_log
+		else
+		    sed --in-place 's/-Wno-empty-body/-Wno-empty-body -Wno-invalid-source-encoding/g' Makefile
+		    sed --in-place 's/-fno-strength-reduce//g' Makefile
+		    $MAKE -e CC=$CLANG_CC -e BUILD_CC=$CLANG_CC cutest > /dev/null 2>> test_log
+		fi
 		if test x$? = x0; then
 		    [ -z "$verbose" ] || log_msg_ok   "make cutest... $TEST";
@@ -247,17 +197,4 @@
 {
 	log_start "COMPILE"
-
-	if [ "x$doall" = xon ]; then
-	    uname -a | grep x86_64 >/dev/null 
-	    if [ $? -ne 0 ]; then
-		if [ -f /usr/local/gcc-smatch/bin/gcc ]; then  # FIXME
-		    SAVE_CC="${CC}"
-		    SMATCH="DBGDEF=--smatch"; export SMATCH
-		    SAVE_SMATCH="${SMATCH}"; export SAVE_SMATCH
-		    CC="/usr/local/gcc-smatch/bin/gcc"; export CC
-		    SMATCH_CC="${CC}"
-		fi
-	    fi
-	fi
 
 	num=0
@@ -342,5 +279,5 @@
 	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -353,6 +290,4 @@
 	fi
 	#
-	[ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }
-	#
 	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-static --enable-suidcheck --enable-process-check ${C_LOGFILE} > /dev/null 2>> test_log
 	#
@@ -360,7 +295,5 @@
 	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	[ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; }
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	# test standalone compilation
@@ -377,5 +310,5 @@
 	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -388,6 +321,4 @@
 	fi
 	#
-	[ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }
-	#
 	${TOP_SRCDIR}/configure --quiet  --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test  --enable-process-check --enable-port-check --enable-static > /dev/null 2>> test_log
 	#
@@ -395,7 +326,5 @@
 	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	[ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; }
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	# test standalone compilation
@@ -412,5 +341,5 @@
 	testmake $? $num || let "numfail = numfail + 1"  >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -428,5 +357,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 
@@ -445,5 +374,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -461,5 +390,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -477,5 +406,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -500,5 +429,5 @@
 	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	    let "num = num + 1" >/dev/null
-	    run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	fi
 
@@ -517,5 +446,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -533,5 +462,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -549,5 +478,5 @@
 	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -565,5 +494,5 @@
 	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -581,5 +510,5 @@
 	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -597,5 +526,5 @@
 	testmake $? $num "skip" || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -613,5 +542,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -629,5 +558,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	# echo; echo "${S}__ TEST CLIENT/SERVER __${E}"; echo;
@@ -647,5 +576,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	
 	if test -r "Makefile"; then
@@ -658,5 +587,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -685,5 +614,5 @@
 	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	    let "num = num + 1" >/dev/null
-	    run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	    
 	    if test -r "Makefile"; then
@@ -696,5 +625,5 @@
 	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	    let "num = num + 1" >/dev/null
-	    run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	    #
 	fi
@@ -709,6 +638,4 @@
 	fi
 	#
-	[ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; SMATCH=""; export SMATCH; }
-	#
 	${TOP_SRCDIR}/configure --quiet --enable-network=client  --enable-static --enable-srp --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$PW_DIR/samhainrc.test   --with-timeserver=127.0.0.1 ${C_LOGFILE} > /dev/null 2>> test_log   
 	#
@@ -716,5 +643,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	
 	if test -r "Makefile"; then
@@ -727,7 +654,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
-	#
-	[ -z "${SMATCH_CC}" ] || { CC="${SMATCH_CC}"; export CC; SMATCH="${SAVE_SMATCH}"; export SMATCH; }
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	# test c/s compilation w/ gpg
@@ -755,5 +680,5 @@
 	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	    let "num = num + 1" >/dev/null
-	    run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	    #
 	    if test -r "Makefile"; then
@@ -766,5 +691,5 @@
 	    testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	    let "num = num + 1" >/dev/null
-	    run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	    run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	fi
 
@@ -784,5 +709,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -795,5 +720,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -811,5 +736,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -822,5 +747,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -838,5 +763,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -849,5 +774,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -865,5 +790,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -876,5 +801,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -892,5 +817,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -903,5 +828,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num debug || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num debug || let "numfail = numfail + 1"  >/dev/null
 
 	#
@@ -919,5 +844,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 	#
 	if test -r "Makefile"; then
@@ -930,7 +855,5 @@
 	testmake $? $num || let "numfail = numfail + 1" >/dev/null
 	let "num = num + 1" >/dev/null
-	run_smatch $? $num || let "numfail = numfail + 1"  >/dev/null
-
-	[ -z "${SMATCH}" ] || { CC="${SAVE_CC}"; export CC; }
+	run_clang $? $num || let "numfail = numfail + 1"  >/dev/null
 
 	log_end "COMPILE"
