diff --git a/generate-alberta-automakefiles.sh b/generate-alberta-automakefiles.sh
new file mode 100755
index 0000000000000000000000000000000000000000..80562fc6d7785dd0bb3d1b38cf503f9abadce44a
--- /dev/null
+++ b/generate-alberta-automakefiles.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# Generate all ALBERTA Makefile.am's form a template. I was just fed
+# up with changing 24 different files which looked essentially the
+# same.
+#
+
+for DEBUG in 0 1; do
+  for EL_INDEX in 0 1; do
+    for DIM in 1 2 3; do
+      DIM_OF_WORLD=${DIM}; while test ${DIM_OF_WORLD} -le 3; do
+	if test $EL_INDEX -eq 0; then
+	  LIBCODE=${DIM}${DIM_OF_WORLD}_${DEBUG} 
+	else
+	  LIBCODE=${DIM}${DIM_OF_WORLD}_${DEBUG}1 
+	fi
+	if test $DEBUG -eq 0; then
+	  EFLAGS=OPTIMISE 
+	else
+	  EFLAGS=DEBUG 
+	fi 
+	sed -e "s/%DIM%/$DIM/g" Makefile.am.template -e "s/%DIM_OF_WORLD%/$DIM_OF_WORLD/g" -e "s/%DEBUG%/$DEBUG/g" -e "s/%EL_INDEX%/$EL_INDEX/g" -e "s/%LIBCODE%/$LIBCODE/g" -e "s/%EFLAGS%/$EFLAGS/g" > ALBERTA/src/ALBERTA$LIBCODE/Makefile.am
+	DIM_OF_WORLD=$(( $DIM_OF_WORLD + 1 )) 
+      done
+    done
+  done
+done
diff --git a/m4/f77mangle.m4 b/m4/f77mangle.m4
new file mode 100644
index 0000000000000000000000000000000000000000..91804cce8420d647937bf2e53acfd067faca6b57
--- /dev/null
+++ b/m4/f77mangle.m4
@@ -0,0 +1,22 @@
+#
+# Define mangled versions of some blas functions
+#
+AC_DEFUN([MANGLE_AN_F77_FUNCTION],[
+AC_REQUIRE([AC_F77_WRAPPERS])
+m4_define([UPNAME],[F77_[]m4_toupper([$1])])
+AC_F77_FUNC($1,UPNAME)
+#
+# just the default so that things become not worse than before in case
+# configure fails
+#
+if test "$UPNAME" = unknown; then
+	UPNAME=m4_tolower([$1])_
+fi
+AC_DEFINE_UNQUOTED(UPNAME, $UPNAME, [Mangled version of F77 function $1])
+AC_SUBST(UPNAME)
+])
+AC_DEFUN([MANGLE_F77_FUNCTIONS],
+[
+	MANGLE_AN_F77_FUNCTION([$1])
+	m4_if($#,1,[],[MANGLE_F77_FUNCTIONS(m4_shift($@))])
+])
diff --git a/m4/frameworks.m4 b/m4/frameworks.m4
new file mode 100644
index 0000000000000000000000000000000000000000..700f219d5cf7ea6dd08d57468c3a35c5a5d5ec40
--- /dev/null
+++ b/m4/frameworks.m4
@@ -0,0 +1,79 @@
+# AC_SEARCH_FRAMEWORKS(FUNCTION, SEARCH-FRAMEWORKS,
+#                [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                [OTHER-LIBRARIES])
+# --------------------------------------------------------
+# Search for a library defining FUNC, if it's not already available.
+AC_DEFUN([AC_SEARCH_FRAMEWORKS],
+[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1],
+[ac_func_search_save_LIBS=$LIBS
+ac_cv_search_$1=no
+AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
+               [ac_cv_search_$1="none required"])
+if test "$ac_cv_search_$1" = no; then
+  for ac_lib in $2; do
+    LIBS="-framework $ac_lib $5 $ac_func_search_save_LIBS"
+    AC_LINK_IFELSE([AC_LANG_CALL([], [$1])],
+                   [ac_cv_search_$1="-framework $ac_lib"
+break])
+  done
+fi
+LIBS=$ac_func_search_save_LIBS])
+AS_IF([test "$ac_cv_search_$1" != no],
+  [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS"
+  $3],
+      [$4])dnl
+])
+
+
+
+# AC_CHECK_LIB(LIBRARY, FUNCTION,
+#              [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#              [OTHER-LIBRARIES])
+# ------------------------------------------------------
+#
+# Use a cache variable name containing both the library and function name,
+# because the test really is for library $1 defining function $2, not
+# just for library $1.  Separate tests with the same $1 and different $2s
+# may have different results.
+#
+# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])
+# is asking for troubles, since AC_CHECK_LIB($lib, fun) would give
+# ac_cv_lib_$lib_fun, which is definitely not what was meant.  Hence
+# the AS_LITERAL_IF indirection.
+#
+# FIXME: This macro is extremely suspicious.  It DEFINEs unconditionally,
+# whatever the FUNCTION, in addition to not being a *S macro.  Note
+# that the cache does depend upon the function we are looking for.
+#
+# It is on purpose we used `ac_check_lib_save_LIBS' and not just
+# `ac_save_LIBS': there are many macros which don't want to see `LIBS'
+# changed but still want to use AC_CHECK_LIB, so they save `LIBS'.
+# And ``ac_save_LIBS' is too tempting a name, so let's leave them some
+# freedom.
+AC_DEFUN([AC_CHECK_FRAMEWORK],
+[m4_ifval([$3], , [AH_CHECK_FRAMEWORK([$1])])dnl
+AS_LITERAL_IF([$1],
+              [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
+              [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl
+AC_CACHE_CHECK([for $2 in -framework $1], ac_Lib,
+[ac_check_lib_save_LIBS=$LIBS
+LIBS="-framework $1 $5 $LIBS"
+AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
+               [AS_VAR_SET(ac_Lib, yes)],
+               [AS_VAR_SET(ac_Lib, no)])
+LIBS=$ac_check_lib_save_LIBS])
+AS_IF([test AS_VAR_GET(ac_Lib) = yes],
+      [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1))
+  LIBS="-framework $1 $LIBS"
+])],
+      [$4])dnl
+AS_VAR_POPDEF([ac_Lib])dnl
+])# AC_CHECK_FRAMEWORK
+
+
+# AH_CHECK_FRAMEWORK(LIBNAME)
+# ---------------------
+m4_define([AH_CHECK_FRAMEWORK],
+[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1),
+             [Define to 1 if you have the `]$1[' library (-framework ]$1[).])])
+
diff --git a/m4/grapeiface.m4 b/m4/grapeiface.m4
new file mode 100644
index 0000000000000000000000000000000000000000..b679e061397835f6f75717a729964face58b4280
--- /dev/null
+++ b/m4/grapeiface.m4
@@ -0,0 +1,23 @@
+AC_DEFUN([ALBERTA_GRAPE_STUFF],[
+dnl
+dnl Some defines to enable building of alberta_movi. This is more
+dnl complicated than necessary so that it is easier to build a
+dnl stand-alone version of albert_movi.
+dnl
+ALBERTA_CHECK_PACKAGE(grape, gr, , ${OPENGL_LIB} ${X_ALL_LIBS}, grape.h,,, optional)
+AM_CONDITIONAL(GRAPE, test -n "${GRAPE_LIB}")
+ALBERTA_LIB_PATH=$prefix/lib
+ALBERTA_INCLUDE_PATH='$(top_srcdir)/ALBERTA/src/Common/ -I$(top_srcdir)/ALBERTA_UTIL'
+ALBERTA_LIBS_22='$(top_builddir)/ALBERTA/src/ALBERTA22_0/libALBERTA22_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la $(top_builddir)/PLOT_ANSI/src/libPLOTansi.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB)'
+ALBERTA_LIBS_33='$(top_builddir)/ALBERTA/src/ALBERTA33_0/libALBERTA33_0.la $(top_builddir)/SOLVER/src/libcsolver.la $(top_builddir)/ALBERTA_UTIL/libalberta_util.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB)'
+ALBERTA_DEBUG=
+AC_SUBST(ALBERTA_DEBUG)
+AC_SUBST(ALBERTA_LIB_PATH)
+AC_SUBST(ALBERTA_INCLUDE_PATH)
+AC_SUBST(ALBERTA_LIBS_22)
+AC_SUBST(ALBERTA_LIBS_33)
+dnl
+dnl end of alberta_movi
+dnl
+
+])
\ No newline at end of file
diff --git a/m4/plotansi.m4 b/m4/plotansi.m4
new file mode 100644
index 0000000000000000000000000000000000000000..de5a648775391210d6a100acd7e7934b47c45b6c
--- /dev/null
+++ b/m4/plotansi.m4
@@ -0,0 +1,84 @@
+AC_DEFUN([ALBERTA_PLOT_ANSI_STUFF],
+[MANGLE_F77_FUNCTIONS(plot_create_window,
+plot_destroy_window,
+plot_get_std_window,
+plot_set_std_window,
+plot_expose,
+plot_title,
+plot_alarm,
+plot_set_icolor,
+plot_get_icolor,
+plot_set_backgroundcolor,
+plot_get_backgroundcolor,
+plot_set_linecolor,
+plot_get_linecolor,
+plot_set_patchcolor,
+plot_get_patchcolor,
+plot_set_textcolor,
+plot_get_textcolor,
+plot_flush,
+plot_clear,
+plot_set_transform2d,
+plot_get_transform2d,
+plot_world2d,
+plot_move2d,
+plot_vmove2d,
+plot_draw2d,
+plot_vdraw2d,
+plot_line2d,
+plot_vline2d,
+plot_triangle2d,
+plot_vtriangle2d,
+plot_trianglergb2d,
+plot_vtrianglergb2d,
+plot_text2d,
+plot_vtext2d)
+
+AC_CONFIG_FILES([PLOT_ANSI/src/PLOT_for_all.c])
+
+plot_for_sun=true
+plot_for_all=false
+plot_for_ibm=false
+plot_for_tit=false
+
+if test "$G77" = yes; then
+	AC_MSG_RESULT([Using generic Fortran F77 interface for PLOT_ansi])
+	#
+	# just use both ...
+	#
+	plot_for_all=true
+	plot_for_sun=false
+else
+	#
+	# Actually, PLOT_for_STUFF should be chosen based on the Compiler
+	# in use, not the vendor. However, it isn't used anyway, so what.
+	#
+	case "$host_vendor" in
+	*sgi*)	AC_MSG_RESULT([Building for SGI system, affects PLOT_Ansi...])
+		;;
+	*ibm*)	AC_MSG_RESULT([Building for IBM system, affects PLOT_Ansi...])
+		plot_for_ibm=true
+		plot_for_sun=false
+		;;
+	*sun*)	AC_MSG_RESULT([Building fo a SUN system, affects PLOT_Ansi...])
+		;;
+	*) AC_MSG_RESULT([Using generic Fortran F77 interface for PLOT_ansi])
+		plot_for_all=true
+		plot_for_sun=false
+		;;
+	esac
+
+	case "$host" in
+	*titan*) AC_MSG_RESULT([Building for TITAN cpu/vendor/system?, affects PLOT_Ansi...])
+	       plot_for_tit=true
+	       plot_for_sun=false
+		;;
+	esac
+fi
+
+AM_CONDITIONAL(PLOT_FOR_ALL, test x$plot_for_all = xtrue)
+AM_CONDITIONAL(PLOT_FOR_SUN, test x$plot_for_sun = xtrue)
+AM_CONDITIONAL(PLOT_FOR_IBM, test x$plot_for_ibm = xtrue)
+AM_CONDITIONAL(PLOT_FOR_TIT, test x$plot_for_tit = xtrue)
+
+])