diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1a8ed4c39dbd9f64e5545e577589402c5be81439..2b0e93a052e00759dc3bde0e5ff578d7752042ab 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,6 +1,14 @@
+EXTRALIBS = easydialog tools
+dist_pkglib_DATA = $(EXTRALIBS)
+EXTRA_DIST = easydialog.in tools.in
 
-EXTRALIBRARIES = easydialog.sh
+edit = sed \
+    -e "s,@BASH\@,$(BASH),g"
 
-EXTRA_DIST = Makefile.am $(EXTRALIBRARIES)
+easydialog: easydialog.in
+	rm -f easydialog
+	$(edit) easydialog.in > easydialog
 
-dist_pkglib_DATA = $(EXTRALIBRARIES)
+tools: tools.in
+	rm -f tools
+	$(edit) tools.in > tools
diff --git a/lib/Makefile.in b/lib/Makefile.in
index d462ea81a8d319a19086cfecde4a6a634d7bc1da..67a1df5a64c433b7daa5bf96a797dd4d9d558866 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -111,9 +111,12 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-EXTRALIBRARIES = easydialog.sh
-EXTRA_DIST = Makefile.am $(EXTRALIBRARIES)
-dist_pkglib_DATA = $(EXTRALIBRARIES)
+EXTRALIBS = easydialog tools
+dist_pkglib_DATA = $(EXTRALIBS)
+EXTRA_DIST = easydialog.in tools.in
+edit = sed \
+    -e "s,@BASH\@,$(BASH),g"
+
 all: all-am
 
 .SUFFIXES:
@@ -285,6 +288,14 @@ uninstall-am: uninstall-dist_pkglibDATA uninstall-info-am
 	pdf-am ps ps-am uninstall uninstall-am \
 	uninstall-dist_pkglibDATA uninstall-info-am
 
+
+easydialog: easydialog.in
+	rm -f easydialog
+	$(edit) easydialog.in > easydialog
+
+tools: tools.in
+	rm -f tools
+	$(edit) tools.in > tools
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/lib/easydialog.sh b/lib/easydialog.in
similarity index 99%
rename from lib/easydialog.sh
rename to lib/easydialog.in
index 0113d9cb18885b997916996245d14d67064318df..59b0efa296522fab1c1b15d4d479cfc825ce7a85 100644
--- a/lib/easydialog.sh
+++ b/lib/easydialog.in
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!@BASH@
 
 # copyright 2002 lmoore@tump.com under the terms of the GNU LGPL.
 # additions 2005 collective@riseup.net
diff --git a/lib/tools.in b/lib/tools.in
new file mode 100644
index 0000000000000000000000000000000000000000..89f2ff733918e888fc79a2f927252ee63e8bd346
--- /dev/null
+++ b/lib/tools.in
@@ -0,0 +1,19 @@
+#!@BASH@
+
+
+#
+# create a temporary file in a secure way.
+#
+function maketemp() {
+	if [ -x /bin/mktemp ]
+	then
+		local tempfile=`mktemp /tmp/$1.XXXXXXXX`
+	else
+		DATE=`date`
+		sectmp=`echo $DATE | /usr/bin/md5sum | cut -d- -f1`
+		local tempfile=/tmp/$1.$sectmp
+	fi
+	echo $tempfile
+}
+
+
diff --git a/src/ninjahelper.in b/src/ninjahelper.in
index 7497b69e6337714d5f618ddb1dba3736db3d0ab5..f0ad45a9685cc6d28fbafe883fefcaf35cee2638 100755
--- a/src/ninjahelper.in
+++ b/src/ninjahelper.in
@@ -215,7 +215,7 @@ if [ ! -d "$configdirectory" ]; then
 	exit 1
 fi
 
-. $libdir/easydialog.sh
+. $libdir/easydialog
 
 if [ "$UID" != "0" ]; then
 	msgBox "warning" "ninjahelper must be run by root!"