--- texk/tetex/Makefile.in.orig	2011-06-16 10:01:09.000000000 -0400
+++ texk/tetex/Makefile.in	2011-07-14 01:15:34.000000000 -0400
@@ -220,12 +220,12 @@
 	texconfig-sys \
 	texlinks
 
-scriptsdir = texmf/scripts/tetex
+scriptsdir = scripts/tetex
 nodist_bin_SCRIPTS = $(am__append_1)
 all_scripts = $(lua_scripts) $(perl_scripts) $(shell_scripts)
 @WIN32_TRUE@@WIN32_WRAP_TRUE@wrappers = $(all_scripts:=.exe)
 @WIN32_TRUE@@WIN32_WRAP_TRUE@runscript = $(top_srcdir)/../../texk/texlive/w32_wrapper/runscript.exe
-texmfdir = ${prefix}/$(scriptsdir)
+texmfdir = @@TEXMFMAIN@@/$(scriptsdir)
 dist_texmf_SCRIPTS = $(perl_scripts:=.pl) $(shell_scripts:=.sh)
 @WIN32_FALSE@dist_bin_SCRIPTS = $(sh_scripts)
 CLEANFILES = $(nodist_bin_SCRIPTS)
@@ -254,7 +254,7 @@
 	fmtutil.cnf.5 \
 	updmap.cfg.5
 
-texconfdir = ${prefix}
+texconfdir = @@TEXMFMAIN@@
 nobase_dist_texconf_DATA = \
 	texmf/texconfig/README \
 	texmf/texconfig/g/generic \
@@ -262,10 +262,10 @@
 	texmf/texconfig/v/vt100 \
 	texmf/texconfig/x/xterm
 
-texconfigdir = ${prefix}/texmf/texconfig
+texconfigdir = @@TEXMFMAIN@@/texconfig
 dist_texconfig_SCRIPTS = tcfmgr
 dist_texconfig_DATA = tcfmgr.map
-web2cdir = ${prefix}/texmf/web2c
+web2cdir = @@TEXMFMAIN@@/web2c
 dist_web2c_DATA = fmtutil.cnf
 bin_links = \
 	allcm:allec \
@@ -574,10 +574,11 @@
 	    else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
 	  test -z "$$xfiles" || { \
 	    test "x$$dir" = x. || { \
-	      echo "$(MKDIR_P) '$(DESTDIR)$(texconfdir)/$$dir'"; \
-	      $(MKDIR_P) "$(DESTDIR)$(texconfdir)/$$dir"; }; \
-	    echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(texconfdir)/$$dir'"; \
-	    $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(texconfdir)/$$dir" || exit $$?; }; \
+	      sdir=`echo $$dir | sed -e 's,^[^/]*/,,'`; \
+	      echo "$(MKDIR_P) '$(DESTDIR)$(texconfdir)/$$sdir'"; \
+	      $(MKDIR_P) "$(DESTDIR)$(texconfdir)/$$sdir"; }; \
+	    echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(texconfdir)/$$sdir'"; \
+	    $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(texconfdir)/$$sdir" || exit $$?; }; \
 	done
 
 uninstall-nobase_dist_texconfDATA:
@@ -910,19 +911,14 @@
 
 # We support both multiplatform and non-multiplatform builds.
 install-links:
-	case "$(bindir)" in \
-	  */bin) $(MAKE) $(AM_MAKEFLAGS) REL=.. TYPE=$(TYPE) EXT=$(EXT) make-links;; \
-	  */bin/*) $(MAKE) $(AM_MAKEFLAGS) REL=../.. TYPE=$(TYPE) EXT=$(EXT) make-links;; \
-	  *) echo "strange directory '$(bindir)' for linked $(TYPE) scripts" >&2; \
-	     exit 1;; \
-	esac
+	$(MAKE) $(AM_MAKEFLAGS) TYPE=$(TYPE) EXT=$(EXT) make-links
 
 make-links:
 	@cd $(DESTDIR)$(bindir) && \
 	  for f in $($(TYPE)_scripts); do \
 	    rm -f $$f; \
-	    echo "creating link '$$f' -> '$(REL)/$(scriptsdir)/$$f.$(EXT)'"; \
-	    $(LN_S) $(REL)/$(scriptsdir)/$$f.$(EXT) $$f || exit 1; \
+	    echo "creating link '$$f' -> '$(texmfdir)/$$f.$(EXT)'"; \
+	    $(LN_S) $(texmfdir)/$$f.$(EXT) $$f || exit 1; \
 	  done  
 
 uninstall-links:
