diff -r 5616b2cbdcdb Makefile.am
--- a/Makefile.am	Wed Jul 20 08:14:49 2011 -0400
+++ b/Makefile.am	Sun Jul 24 16:21:59 2011 -0500
@@ -4,6 +4,7 @@
 LIB      := @LIB@
 INCLUDE  := @INCLUDE@
 SITELISP := @SITELISP@
+VERSION  := @VERSION@
 
 LIB_UR   := $(LIB)/ur
 LIB_C    := $(LIB)/c
@@ -99,7 +100,10 @@
 uninstall-local: uninstall-local-main uninstall-emacs
 
 package:
-	hg archive -t tgz -X tests /tmp/urweb.tgz
+if !IS_RELEASE
+	@echo "Note: creating package from unstable release."
+endif
+	hg archive -t tgz -X tests /tmp/urweb-$(VERSION).tgz
 
 reauto:
 	-autoreconf
diff -r 5616b2cbdcdb configure.ac
--- a/configure.ac	Wed Jul 20 08:14:49 2011 -0400
+++ b/configure.ac	Sun Jul 24 16:21:59 2011 -0500
@@ -10,6 +10,9 @@
 
 AC_CHECK_PROG(MLTON, mlton, yes, [])
 
+RELEASE=NO
+AM_CONDITIONAL(IS_RELEASE, test "x$RELEASE" = "xYES")
+
 if test [-z $MLTON]; then
     echo "You must install MLton."
     exit 1
@@ -79,6 +82,9 @@
    SQHEADER=sqlite3.h
 fi
 
+VERSION=`date '+%Y%m%d'`
+echo "Determining version date... $VERSION"
+
 AC_SUBST(CC)
 AC_SUBST(BIN)
 AC_SUBST(LIB)
@@ -88,6 +94,8 @@
 AC_SUBST(PGHEADER)
 AC_SUBST(MSHEADER)
 AC_SUBST(SQHEADER)
+AC_SUBST(RELEASE)
+AC_SUBST(VERSION)
 
 AC_CONFIG_FILES([
         Makefile
@@ -109,4 +117,7 @@
   Postgres C header:   PGHEADER       $PGHEADER
   MySQL C header:      MSHEADER       $MSHEADER
   SQLite C header:     SQHEADER       $SQHEADER
+
+  Version:             $VERSION
+  Stable release:      $RELEASE
 EOF
diff -r 5616b2cbdcdb src/config.sig
--- a/src/config.sig	Wed Jul 20 08:14:49 2011 -0400
+++ b/src/config.sig	Sun Jul 24 16:21:59 2011 -0500
@@ -15,4 +15,8 @@
     val pgheader : string
     val msheader : string
     val sqheader : string
+
+    val versionNumber : string
+    val releaseString : string
+    val versionString : string
 end
diff -r 5616b2cbdcdb src/config.sml.in
--- a/src/config.sml.in	Wed Jul 20 08:14:49 2011 -0400
+++ b/src/config.sml.in	Sun Jul 24 16:21:59 2011 -0500
@@ -20,4 +20,8 @@
 val msheader = "@MSHEADER@"
 val sqheader = "@SQHEADER@"
 
+val versionNumber  = "@VERSION@"
+val releaseString  = "stable release = @RELEASE@"
+val versionString  = "The Unbelievable Ur/Web compiler, version " ^ versionNumber ^" (" ^ releaseString ^ ")"
+
 end
diff -r 5616b2cbdcdb src/main.mlton.sml
--- a/src/main.mlton.sml	Wed Jul 20 08:14:49 2011 -0400
+++ b/src/main.mlton.sml	Sun Jul 24 16:21:59 2011 -0500
@@ -32,9 +32,18 @@
 val tutorial = ref false
 val css = ref false
 
+fun printVersion () = (print (Config.versionString ^ "\n");
+		       OS.Process.exit OS.Process.success)
+fun printNumericVersion () = (print (Config.versionNumber ^ "\n");
+			      OS.Process.exit OS.Process.success)
+
 fun doArgs args =
     case args of
         [] => ()
+      | "-version" :: rest => 
+	printVersion ()
+      | "-numeric-version" :: rest =>
+	printNumericVersion ()
       | "-css" :: rest =>
         (css := true;
          doArgs rest)
@@ -119,7 +128,7 @@
 val job =
     case !sources of
         [file] => file
-      | _ => raise Fail "Zero or multiple job files specified"
+      | _ => printVersion ()
 
 val () =
     case (!css, !demo, !tutorial) of
