diff --git a/bin/install.pike b/bin/install.pike
index 6215c19ab44bd671bfd4701b6e61a5832c1204fe..0b475a2295a66a02ba09e77698d43484d920e6af 100644
--- a/bin/install.pike
+++ b/bin/install.pike
@@ -5,6 +5,8 @@ int redump_all;
 string pike;
 array(string) to_dump=({});
 
+#define MASTER_COOKIE "(#*&)@(*&$Master Cookie:"
+
 void fail(string fmt, mixed ... args)
 {
   if(last_len) write("\n");
@@ -176,7 +178,7 @@ void install_header_files(string from, string to)
   foreach(get_dir(from),string file)
     {
       if(file[..1]==".#") continue;
-      if(file[-1]!='h' && file[-2]!='.') continue;
+      if(file[-1]!='h' || file[-2]!='.') continue;
       install_file(combine_path(from,file),combine_path(to,file));
     }
 }
@@ -202,43 +204,105 @@ void dumpmodules(string dir)
 	    if(stat2 && stat2[3]>=stat[3])
 	      continue;
 	    
-	    Process.create_process( ({pike,combine_path(getenv("SRCDIR"),"dumpmodule.pike"),f}) )->wait();
+	    Process.create_process( ({pike,combine_path(vars->SRCDIR,"dumpmodule.pike"),f}) )->wait();
 	}
       }
     }
 }
 
+mapping vars=([]);
+
 
 int main(int argc, string *argv)
 {
+  int traditional;
+  string prefix;
+  string exec_prefix;
+  string lib_prefix;
+  string include_prefix;
+  string man_prefix;
+  string lnk;
+
+  foreach(argv[1..], string foo)
+    if(sscanf(foo,"%s=%s",string var, string value)==2)
+      vars[var]=value;
+
+  prefix=vars->prefix;
+  if(argc>1 && argv[1]=="--traditional")
+  {
+    exec_prefix=vars->exec_prefix;
+    lib_prefix=vars->lib_prefix;
+    include_prefix=combine_path(prefix,"include","pike");
+    man_prefix=vars->man_prefix;
+  }else{
+
+    if(!(lnk=vars->pike_name) || !strlen(lnk))
+      lnk=combine_path(vars->exec_prefix,"pike");
+
+    prefix=combine_path(prefix,"pike",replace(version()-"Pike v"," release ","."));
+    exec_prefix=combine_path(prefix);
+    lib_prefix=combine_path(prefix,"lib");
+    include_prefix=combine_path(prefix,"include","pike");
+    man_prefix=combine_path(prefix,"man");
+  }
+  pike=combine_path(exec_prefix,"pike");
+
   mixed err=catch {
-    pike=combine_path(getenv("exec_prefix"),"pike");
-    write("\nInstalling Pike... in %s\n\n",getenv("prefix"));
-    if(install_file("pike",pike))
+    write("\nInstalling Pike in %s...\n\n",prefix);
+
+    string pike_bin_file="pike";
+    status("Finalizing",pike_bin_file);
+    string pike_bin=Stdio.read_file(pike_bin_file);
+    int pos=search(pike_bin,MASTER_COOKIE);
+
+    if(pos<=0 && strlen(pike_bin) < 10000 && file_stat("pike.exe"))
     {
-      redump_all=1;
+      pike_bin_file="pike.exe";
+      status("Finalizing",pike_bin_file);
+      pike_bin=Stdio.read_file(pike_bin_file);
+      pos=search(pike_bin,MASTER_COOKIE);
+      pike+=".exe";
+    }
+
+    if(pos>=0)
+    {
+      status("Finalizing",pike_bin_file,"...");
+      Stdio.write_file(pike_bin_file="pike.tmp",pike_bin);
+      Stdio.File f=Stdio.File(pike_bin_file,"rw");
+      f->seek(pos+strlen(MASTER_COOKIE));
+      f->write(combine_path(lib_prefix,"master.pike"));
+      f->close();
+      status("Finalizing",pike_bin_file,"done");
+    }else{
+      write("Warning! Failed to finalize master location!\n");
     }
-    install_file("hilfe",combine_path(getenv("exec_prefix"),"hilfe"));
-    install_dir(getenv("TMP_LIBDIR"),getenv("lib_prefix"),1);
-    install_dir(getenv("LIBDIR_SRC"),getenv("lib_prefix"),1);
+    if(install_file(pike_bin_file,pike)) redump_all=1;
+
+    install_file("hilfe",combine_path(exec_prefix,"hilfe"));
+    string master=combine_path(vars->LIBDIR_SRC,"master.pike.in");
+
+//    werror("Making master with libdir=%s\n",lib_prefix);
+    status("Finalizing",master);
+    string master_data=Stdio.read_file(master);
+    master_data=replace(master_data,"�lib_prefix�",lib_prefix);
+    Stdio.write_file(combine_path(vars->TMP_LIBDIR,"master.pike"),master_data);
+    status("Finalizing",master,"done");
+		    
+    install_dir(vars->TMP_LIBDIR,lib_prefix,1);
+    install_dir(vars->LIBDIR_SRC,lib_prefix,1);
     
-    install_header_files(getenv("SRCDIR"),
-			 combine_path(getenv("prefix"),"include/pike"));
-    install_header_files(".",combine_path(getenv("prefix"),"include/pike"));
+    install_header_files(vars->SRCDIR,include_prefix);
+    install_header_files(".",include_prefix);
     
     install_file("modules/dynamic_module_makefile",
-		 combine_path(getenv("prefix"),"include/pike/dynamic_module_makefile"));
+		 combine_path(include_prefix,"dynamic_module_makefile"));
     install_file("./aclocal",
-		 combine_path(getenv("prefix"),"include/pike/aclocal.m4"));
+		 combine_path(include_prefix,"aclocal.m4"));
     
-    if(file_stat(getenv("MANDIR_SRC")))
+    if(file_stat(vars->MANDIR_SRC))
     {
-      install_dir(getenv("MANDIR_SRC"),combine_path(getenv("man_prefix"),"man1"),0);
+      install_dir(vars->MANDIR_SRC,combine_path(man_prefix,"man1"),0);
     }
-
-
-
-
   };
 
   if(last_len)
@@ -249,21 +313,37 @@ int main(int argc, string *argv)
 
   if(err) throw(err);
 
-  string master=combine_path(getenv("lib_prefix"),"master.pike");
+  string master=combine_path(lib_prefix,"master.pike");
   mixed s1=file_stat(master);
   mixed s2=file_stat(master+".o");
   if(!s1 || !s2 || s1[3]>=s2[3] || redump_all)
   {
-    Process.create_process( ({pike,"-m",combine_path(getenv("SRCDIR"),"dumpmaster.pike"),master}))->wait();
+    Process.create_process( ({pike,"-m",combine_path(vars->SRCDIR,"dumpmaster.pike"),master}))->wait();
   }
   
-//    dumpmodules(combine_path(getenv("lib_prefix"),"modules"));
+//    dumpmodules(combine_path(vars->lib_prefix,"modules"));
   if(sizeof(to_dump))
   {
     foreach(to_dump, string mod) rm(mod+".o");
-    Process.create_process( ({pike,combine_path(getenv("SRCDIR"),"dumpmodule.pike")}) + to_dump)->wait();
+    Process.create_process( ({pike,combine_path(vars->SRCDIR,"dumpmodule.pike")}) + to_dump)->wait();
   }
 
+#if constant(symlink)
+  if(lnk)
+  {
+    mixed s=file_stat(lnk,1);
+    if(s)
+    {
+      if(!mv(lnk,lnk+".old"))
+      {
+	werror("Failed to move %s\n",lnk);
+	exit(1);
+      }
+    }
+
+    symlink(pike,lnk);
+  }
+#endif
 
   return 0;
 }
diff --git a/src/Makefile.in b/src/Makefile.in
index 1224c99974cdbd4c234844278a774983e2b3c267..24c8af1207f373f1c8ca748ef7f46cb212189c58 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.135 1999/03/23 16:53:23 hubbe Exp $
+# $Id: Makefile.in,v 1.136 1999/03/26 19:27:26 hubbe Exp $
 #
 
 # This line is needed on some machines.
@@ -211,11 +211,11 @@ force :
 
 # install
 install: pike hilfe pike-module aclocal
-	@exec_prefix="$(exec_prefix)" lib_prefix="$(lib_prefix)" \
+	@$(RUNPIKE) $(TMP_BINDIR)/install.pike \
+	exec_prefix="$(exec_prefix)" lib_prefix="$(lib_prefix)" \
 	TMP_LIBDIR="$(TMP_LIBDIR)" LIBDIR_SRC="$(LIBDIR_SRC)" \
 	SRCDIR="$(SRCDIR)" prefix="$(prefix)" MANDIR_SRC="$(MANDIR_SRC)" \
-	man_prefix="$(man_prefix)" \
-	$(RUNPIKE) $(TMP_BINDIR)/install.pike
+	man_prefix="$(man_prefix)" pike_name=$(pike_name)
 
 old-install: pike hilfe pike-module aclocal
 	@echo
@@ -445,11 +445,6 @@ lib: $(LIBDIR_SRC)/master.pike.in Makefile
 	  else : ; fi; \
 	  ln -s "$(LIBDIR_SRC)" ./share || exit 1; \
 	fi
-	@echo "Creating lib/master.pike"; \
-	( sed -e 's!�lib_prefix�!$(lib_prefix)!'  \
-	      -e 's!�share_prefix�!$(share_prefix)!'  \
-	      <$(LIBDIR_SRC)/master.pike.in \
-	  >./lib/master.pike && chmod 644 ./lib/master.pike) || exit 1
 	@echo "Done."
 	-@touch ./lib 2>/dev/null || (touch lib/.broken_gnu_touch && rm lib/.broken_gnu_touch)
 
@@ -492,7 +487,7 @@ bin_export:
 
 new_peep_engine:
 	$(RUNPIKE) $(TMP_BINDIR)/mkpeep.pike $(SRCDIR)/peep.in >$(SRCDIR)/peep_engine.c
-	$(RUNPIKE) $(TMP_BINDIR)/make_ci.pike <$(SRCDIR)/UnicodeData.txt
+	$(RUNPIKE) $(TMP_BINDIR)/make_ci.pike <$(SRCDIR)/UnicodeData.txt >$(SRCDIR)/case_info.h
 
 $(SRCDIR)/peep_engine.c: $(SRCDIR)/peep.in $(TMP_BINDIR)/mkpeep.pike
 	echo "" >$(SRCDIR)/peep_engine.c
diff --git a/src/configure.in b/src/configure.in
index 099b97ab7233b67286a3ea6f30e71dc4a8e70a0a..64eee0a829a80b2fcb0f9bf125c4bf39fbdc0091 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.271 1999/03/13 02:15:06 marcus Exp $")
+AC_REVISION("$Id: configure.in,v 1.272 1999/03/26 19:29:50 hubbe Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -2925,8 +2925,7 @@ export LDFLAGS CFLAGS CPPFLAGS LIBS
 
 AC_CONFIG_SUBDIRS(modules)
 
-my_libdir=`echo $prefix | sed "s@^NONE@$ac_default_prefix@g"`
-default_master=$my_libdir/lib/pike/master.pike
+default_master=$prefix/pike/%d.%d.%d/lib/master.pike
 AC_DEFINE_UNQUOTED(DEFAULT_MASTER,"$default_master")
 
 AC_SUBST_FILE(dependencies)
diff --git a/src/main.c b/src/main.c
index 9fb44ee1b78c6d20fbc9feb6a6d8e51ca0a54cc6..e793c4e10f2ae1b3664d4ab0ec741597d8501800 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: main.c,v 1.66 1999/03/19 11:42:38 hubbe Exp $");
+RCSID("$Id: main.c,v 1.67 1999/03/26 19:29:51 hubbe Exp $");
 #include "fdlib.h"
 #include "backend.h"
 #include "module.h"
@@ -30,6 +30,7 @@ RCSID("$Id: main.c,v 1.66 1999/03/19 11:42:38 hubbe Exp $");
 #include "main.h"
 #include "operators.h"
 #include "security.h"
+#include "version.h"
 
 #include <errno.h>
 
@@ -60,6 +61,14 @@ extern int yydebug;
 #endif /* YYDEBUG */
 static long instructions_left;
 
+#define MASTER_COOKIE "(#*&)@(*&$Master Cookie:"
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN 32768
+#endif
+
+char master_location[MAXPATHLEN * 2] = MASTER_COOKIE;
+
 static void time_to_exit(struct callback *cb,void *tmp,void *ignored)
 {
   if(instructions_left-- < 0)
@@ -146,16 +155,28 @@ int dbm_main(int argc, char **argv)
 #endif  
   init_backend();
   master_file = 0;
-#if __NT__
-  if(!master_file) get_master_key(HKEY_CURRENT_USER);
-  if(!master_file) get_master_key(HKEY_LOCAL_MACHINE);
-#endif
+
 #ifdef HAVE_GETENV
   if(getenv("PIKE_MASTER"))
     master_file = getenv("PIKE_MASTER");
 #endif
 
-  if(!master_file) master_file = DEFAULT_MASTER;
+  if(master_location[CONSTANT_STRLEN(MASTER_COOKIE)])
+    master_file=master_location + CONSTANT_STRLEN(MASTER_COOKIE);
+
+#if __NT__
+  if(!master_file) get_master_key(HKEY_CURRENT_USER);
+  if(!master_file) get_master_key(HKEY_LOCAL_MACHINE);
+#endif
+
+  if(!master_file)
+  {
+    sprintf(master_location,DEFAULT_MASTER,
+	    PIKE_MAJOR_VERSION,
+	    PIKE_MINOR_VERSION,
+	    PIKE_BUILD_VERSION);
+    master_file=master_location;
+  }
 
   for(e=1; e<argc; e++)
   {
diff --git a/src/object.c b/src/object.c
index 0e0ba2971acb6a79d348536543e6a4ebcb10d71e..2378eeef3e082031966463ebe52ccb49ba087ef2 100644
--- a/src/object.c
+++ b/src/object.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: object.c,v 1.64 1999/03/19 11:42:50 hubbe Exp $");
+RCSID("$Id: object.c,v 1.65 1999/03/26 19:29:53 hubbe Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -219,6 +219,7 @@ struct object *parent_clone_object(struct program *p,
   return o;
 }
 
+/* FIXME: use open/read/close instead */
 static struct pike_string *low_read_file(char *file)
 {
   struct pike_string *s;
@@ -957,7 +958,6 @@ void cleanup_objects(void)
     next=o->next;
     free_object(o);
   }
-
   free_object(master_object);
   master_object=0;
   free_program(master_program);
diff --git a/src/version.c b/src/version.c
index e6bbf05a5f28a51b77744a356e9ec8a743c12536..b534b0d0f4d5f4f86200f843107e9453e4361574 100644
--- a/src/version.c
+++ b/src/version.c
@@ -8,11 +8,18 @@
 #include "svalue.h"
 #include "interpret.h"
 #include "stralloc.h"
+#include "version.h"
 
-RCSID("$Id: version.c,v 1.131 1999/01/06 00:39:26 hubbe Exp $");
+RCSID("$Id: version.c,v 1.132 1999/03/26 19:29:54 hubbe Exp $");
 
+#define STR(X) #X
 void f_version(INT32 args)
 {
+  char buffer[128];
+  sprintf(buffer,"Pike v%d.%d release %d",
+	  PIKE_MAJOR_VERSION,
+	  PIKE_MINOR_VERSION,
+	  PIKE_BUILD_VERSION);
   pop_n_elems(args);
-  push_text("Pike v0.7 release 0");
+  push_text(buffer);
 }
diff --git a/src/version.h b/src/version.h
index d219448e5063f4f66a4d9af58c801708da3eba26..b22515639de331daa2e51ca7dd57ddcd2b4d3cef 100644
--- a/src/version.h
+++ b/src/version.h
@@ -4,7 +4,11 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 
-/* $Id: version.h,v 1.3 1998/03/28 14:56:05 grubba Exp $ */
+/* $Id: version.h,v 1.4 1999/03/26 19:29:55 hubbe Exp $ */
+
+#define PIKE_MAJOR_VERSION 0
+#define PIKE_MINOR_VERSION 7
+#define PIKE_BUILD_VERSION 1
 
 /* Prototypes begin here */
 void f_version(INT32 args);