+#!/bin/sh
+
+VERSION_TMP=.version
+VERSION_TARGET=version.h
+
+VERSION_STR=$(git show | grep ^commit | sed -e s.commit\ .. | cut -b -10)
+
+COMPILER_STR="$1"
+COMPILER_STR_TARGET=.compiler_check
+COMPILER_STR_TMP=$COMPILER_CHECK.tmp
+
+echo > $VERSION_TMP
+echo "#ifndef _VERSION_H_" >> $VERSION_TMP
+echo "#define _VERSION_H_" >> $VERSION_TMP
+echo >> $VERSION_TMP
+echo "/* Autogenerated version.h file */" >> $VERSION_TMP
+echo >> $VERSION_TMP
+echo "#define RRDD_VERSION \"$VERSION_STR\"" >> $VERSION_TMP
+echo >> $VERSION_TMP
+echo "#endif" >> $VERSION_TMP
+
+if [ -f $VERSION_TARGET ] ; then
+ cmp -s $VERSION_TMP $VERSION_TARGET || cp $VERSION_TMP $VERSION_TARGET
+else
+ cp $VERSION_TMP $VERSION_TARGET
+fi
+
+echo $COMPILER_STR > $COMPILER_STR_TMP
+
+if [ -f $COMPILER_STR_TARGET ] ; then
+ cmp -s $COMPILER_STR_TMP $COMPILER_STR_TARGET || \
+ cp $COMPILER_STR_TMP $COMPILER_STR_TARGET
+else
+ cp $COMPILER_STR_TMP $COMPILER_STR_TARGET
+fi
+