diff --git a/System/Time.hsc b/System/Time.hsc
--- a/System/Time.hsc
+++ b/System/Time.hsc
@@ -1,3 +1,7 @@
+{-# OPTIONS_GHC -fno-warn-unused-binds #-}
+-- XXX with some combinations of #defines we get warnings, e.g.
+-- Warning: Defined but not used: `throwAwayReturnPointer'
+
 -----------------------------------------------------------------------------
 -- |
 -- Module      :  System.Time
@@ -8,10 +12,15 @@
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- The standard Time library, providing standard functionality for clock
--- times, including timezone information (i.e, the functionality of
--- \"@time.h@\", adapted to the Haskell environment).  It follows RFC
--- 1129 in its use of Coordinated Universal Time (UTC).
+-- The standard time library from Haskell 98.  This library is
+-- deprecated, please look at "Data.Time" in the @time@ package
+-- instead.
+--
+-- "System.Time" provides functionality for clock times, including
+-- timezone information (i.e, the functionality of \"@time.h@\",
+-- adapted to the Haskell environment).  It follows RFC 1129 in its
+-- use of Coordinated Universal Time (UTC).
+--
 -----------------------------------------------------------------------------
 
 {-
@@ -116,12 +125,11 @@
 
 import Data.Ix
 import System.Locale
-import System.IO.Unsafe
+import Foreign
 
 #ifdef __HUGS__
 import Hugs.Time ( getClockTimePrim, toCalTimePrim, toClockTimePrim )
 #else
-import Foreign
 import Foreign.C
 #endif
 
@@ -263,11 +271,11 @@
 -- may be either positive or negative.
 
 addToClockTime  :: TimeDiff  -> ClockTime -> ClockTime
-addToClockTime (TimeDiff year mon day hour min sec psec) 
+addToClockTime (TimeDiff year mon day hour minute sec psec)
 	       (TOD c_sec c_psec) = 
 	let
 	  sec_diff = toInteger sec +
-                     60 * toInteger min +
+                     60 * toInteger minute +
                      3600 * toInteger hour +
                      24 * 3600 * toInteger day
           (d_sec, d_psec) = (c_psec + psec) `quotRem` 1000000000000
@@ -477,7 +485,7 @@
 clockToCalendarTime_aux :: Bool -> Ptr CTm -> Integer -> IO CalendarTime
 clockToCalendarTime_aux is_utc p_tm psec = do
     sec   <-  (#peek struct tm,tm_sec  ) p_tm :: IO CInt
-    min   <-  (#peek struct tm,tm_min  ) p_tm :: IO CInt
+    minute <-  (#peek struct tm,tm_min  ) p_tm :: IO CInt
     hour  <-  (#peek struct tm,tm_hour ) p_tm :: IO CInt
     mday  <-  (#peek struct tm,tm_mday ) p_tm :: IO CInt
     mon   <-  (#peek struct tm,tm_mon  ) p_tm :: IO CInt
@@ -485,10 +493,10 @@
     wday  <-  (#peek struct tm,tm_wday ) p_tm :: IO CInt
     yday  <-  (#peek struct tm,tm_yday ) p_tm :: IO CInt
     isdst <-  (#peek struct tm,tm_isdst) p_tm :: IO CInt
-    zone  <-  zone p_tm
+    zone' <-  zone p_tm
     tz    <-  gmtoff p_tm
     
-    tzname <- peekCString zone
+    tzname' <- peekCString zone'
     
     let month  | mon >= 0 && mon <= 11 = toEnum (fromIntegral mon)
     	       | otherwise             = error ("toCalendarTime: illegal month value: " ++ show mon)
@@ -498,12 +506,12 @@
 		month
 		(fromIntegral mday)
 		(fromIntegral hour)
-		(fromIntegral min)
+		(fromIntegral minute)
 		(fromIntegral sec)
 		psec
             	(toEnum (fromIntegral wday))
 		(fromIntegral yday)
-		(if is_utc then "UTC" else tzname)
+		(if is_utc then "UTC" else tzname')
 		(if is_utc then 0     else fromIntegral tz)
 		(if is_utc then False else isdst /= 0))
 #endif /* ! __HUGS__ */
@@ -520,15 +528,15 @@
     s <- toClockTimePrim (yr-1900) (fromEnum mon) mday hour min sec tz
     return (TOD (fromIntegral s) psec)
 #else /* ! __HUGS__ */
-toClockTime (CalendarTime year mon mday hour min sec psec 
-			  _wday _yday _tzname tz isdst) =
+toClockTime (CalendarTime year mon mday hour minute sec psec
+			  _wday _yday _tzname tz _isdst) =
 
      -- `isDst' causes the date to be wrong by one hour...
      -- FIXME: check, whether this works on other arch's than Linux, too...
      -- 
      -- so we set it to (-1) (means `unknown') and let `mktime' determine
      -- the real value...
-    let isDst = -1 :: CInt in   -- if isdst then (1::Int) else 0
+    let isDst = -1 :: CInt in   -- if _isdst then (1::Int) else 0
 
     if psec < 0 || psec > 999999999999 then
         error "Time.toClockTime: picoseconds out of range"
@@ -538,7 +546,7 @@
       unsafePerformIO $ do
       allocaBytes (#const sizeof(struct tm)) $ \ p_tm -> do
         (#poke struct tm,tm_sec  ) p_tm	(fromIntegral sec  :: CInt)
-        (#poke struct tm,tm_min  ) p_tm	(fromIntegral min  :: CInt)
+        (#poke struct tm,tm_min  ) p_tm	(fromIntegral minute :: CInt)
         (#poke struct tm,tm_hour ) p_tm	(fromIntegral hour :: CInt)
         (#poke struct tm,tm_mday ) p_tm	(fromIntegral mday :: CInt)
         (#poke struct tm,tm_mon  ) p_tm	(fromIntegral (fromEnum mon) :: CInt)
@@ -558,9 +566,9 @@
         -- to compensate, we add the timezone difference to mktime's
         -- result.
         -- 
-        gmtoff <- gmtoff p_tm
+        gmtoffset <- gmtoff p_tm
         let realToInteger = round . realToFrac :: Real a => a -> Integer
-	    res = realToInteger t - fromIntegral tz + fromIntegral gmtoff
+	    res = realToInteger t - fromIntegral tz + fromIntegral gmtoffset
 	return (TOD res psec)
 #endif /* ! __HUGS__ */
 
@@ -577,8 +585,8 @@
 -- function.
 
 formatCalendarTime :: TimeLocale -> String -> CalendarTime -> String
-formatCalendarTime l fmt (CalendarTime year mon day hour min sec _
-                                       wday yday tzname _ _) =
+formatCalendarTime l fmt cal@(CalendarTime year mon day hour minute sec _
+                                       wday yday tzname' _ _) =
         doFmt fmt
   where doFmt ('%':'-':cs) = doFmt ('%':cs) -- padding not implemented
         doFmt ('%':'_':cs) = doFmt ('%':cs) -- padding not implemented
@@ -601,7 +609,7 @@
         decode 'j' = show3 yday                      -- day of the year
         decode 'k' = show2' hour                     -- hours, 24-hour clock, no padding
         decode 'l' = show2' (to12 hour)              -- hours, 12-hour clock, no padding
-        decode 'M' = show2 min                       -- minutes
+        decode 'M' = show2 minute                    -- minutes
         decode 'm' = show2 (fromEnum mon+1)          -- numeric month
         decode 'n' = "\n"
         decode 'p' = (if hour < 12 then fst else snd) (amPm l) -- am or pm
@@ -610,7 +618,8 @@
         decode 'T' = doFmt "%H:%M:%S"
         decode 't' = "\t"
         decode 'S' = show2 sec			     -- seconds
-        decode 's' = show2 sec			     -- number of secs since Epoch. (ToDo.)
+        decode 's' = let TOD esecs _ = toClockTime cal in show esecs
+                                                     -- number of secs since Epoch.
         decode 'U' = show2 ((yday + 7 - fromEnum wday) `div` 7) -- week number, starting on Sunday.
         decode 'u' = show (let n = fromEnum wday in  -- numeric day of the week (1=Monday, 7=Sunday)
                            if n == 0 then 7 else n)
@@ -630,7 +639,7 @@
         decode 'x' = doFmt (dateFmt l)               -- locale's preferred way of printing dates.
         decode 'Y' = show year                       -- year, including century.
         decode 'y' = show2 (year `rem` 100)          -- year, within century.
-        decode 'Z' = tzname                          -- timezone name
+        decode 'Z' = tzname'                         -- timezone name
         decode '%' = "%"
         decode c   = [c]
 
@@ -663,7 +672,7 @@
 -- function.
 
 formatTimeDiff :: TimeLocale -> String -> TimeDiff -> String
-formatTimeDiff l fmt td@(TimeDiff year month day hour min sec _)
+formatTimeDiff l fmt (TimeDiff year month day hour minute sec _)
  = doFmt fmt
   where 
    doFmt ""         = ""
@@ -677,7 +686,7 @@
       'B' -> fst (months l !! fromEnum month)
       'b' -> snd (months l !! fromEnum month)
       'h' -> snd (months l !! fromEnum month)
-      'c' -> defaultTimeDiffFmt td
+      'c' -> defaultTimeDiffFmt
       'C' -> show2 (year `quot` 100)
       'D' -> doFmt "%m/%d/%y"
       'd' -> show2 day
@@ -686,7 +695,7 @@
       'I' -> show2 (to12 hour)
       'k' -> show2' hour
       'l' -> show2' (to12 hour)
-      'M' -> show2 min
+      'M' -> show2 minute
       'm' -> show2 (fromEnum month + 1)
       'n' -> "\n"
       'p' -> (if hour < 12 then fst else snd) (amPm l)
@@ -703,7 +712,7 @@
       '%' -> "%"
       c   -> [c]
 
-   defaultTimeDiffFmt (TimeDiff year month day hour min sec _) =
+   defaultTimeDiffFmt =
        foldr (\ (v,s) rest -> 
                   (if v /= 0 
                      then show v ++ ' ':(addS v s)
@@ -711,7 +720,7 @@
                      else "") ++ rest
              )
              ""
-             (zip [year, month, day, hour, min, sec] (intervals l))
+             (zip [year, month, day, hour, minute, sec] (intervals l))
 
    addS v s = if abs v == 1 then fst s else snd s
 
diff --git a/config.guess b/config.guess
--- a/config.guess
+++ b/config.guess
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2006-02-23'
+timestamp='2006-07-02'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -210,7 +211,7 @@
 	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
 	exit ;;
     macppc:MirBSD:*:*)
-	echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
@@ -770,6 +771,8 @@
 	case ${UNAME_MACHINE} in
 	    pc98)
 		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	    *)
 		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
 	esac
@@ -780,9 +783,6 @@
     i*:MINGW*:*)
 	echo ${UNAME_MACHINE}-pc-mingw32
 	exit ;;
-    i*:MSYS_NT-*:*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
     i*:windows32*:*)
     	# uname -m includes "-pc" on this system.
     	echo ${UNAME_MACHINE}-mingw32
@@ -790,10 +790,10 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit ;;
-    x86:Interix*:[345]*)
+    x86:Interix*:[3456]*)
 	echo i586-pc-interix${UNAME_RELEASE}
 	exit ;;
-    EM64T:Interix*:[345]*)
+    EM64T:Interix*:[3456]*)
 	echo x86_64-unknown-interix${UNAME_RELEASE}
 	exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
@@ -831,6 +831,9 @@
     arm*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
     cris:Linux:*:*)
 	echo cris-axis-linux-gnu
 	exit ;;
@@ -989,7 +992,7 @@
 	LIBC=gnulibc1
 	# endif
 	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 	LIBC=gnu
 	#else
 	LIBC=gnuaout
diff --git a/config.sub b/config.sub
--- a/config.sub
+++ b/config.sub
@@ -1,9 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
 
-timestamp='2006-02-23'
+timestamp='2006-07-02'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -240,7 +241,7 @@
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
-	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
 	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
@@ -248,7 +249,8 @@
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -274,11 +276,11 @@
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b \
-	| strongarm \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
 	| we32k \
@@ -286,9 +288,6 @@
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
-	m32c)
-		basic_machine=$basic_machine-unknown
-		;;
 	m6811 | m68hc11 | m6812 | m68hc12)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
@@ -318,7 +317,7 @@
 	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-	| avr-* \
+	| avr-* | avr32-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
@@ -329,7 +328,7 @@
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
 	| ip2k-* | iq2000-* \
-	| m32r-* | m32rle-* \
+	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
@@ -358,11 +357,11 @@
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tron-* \
@@ -373,8 +372,6 @@
 	| ymp-* \
 	| z8k-*)
 		;;
-	m32c-*)
-		;;
 	# Recognize the various machine names and aliases which stand
 	# for a CPU type and a company and sometimes even an OS.
 	386bsd)
@@ -1128,7 +1125,7 @@
 	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
 		basic_machine=sh-unknown
 		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b)
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
 		basic_machine=sparc-sun
 		;;
 	cydra)
@@ -1217,7 +1214,7 @@
 	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
 	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
 	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos*)
+	      | -skyos* | -haiku* | -rdos* | -toppers*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1369,6 +1366,9 @@
 # system, and we'll never get to this point.
 
 case $basic_machine in
+        spu-*)
+		os=-elf
+		;;
 	*-acorn)
 		os=-riscix1.2
 		;;
@@ -1378,9 +1378,9 @@
 	arm*-semi)
 		os=-aout
 		;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
 	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
diff --git a/install-sh b/install-sh
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2003-09-24.23
+scriptversion=2006-10-14.15
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,15 +39,24 @@
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
+# from scratch.
 
+nl='
+'
+IFS=" ""	$nl"
+
 # set DOITPROG to echo to test this script
 
 # Don't use :- since 4.3BSD and earlier shells don't like it.
 doit="${DOITPROG-}"
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
 
-# put in absolute paths if you don't have them in your path; or use env. vars.
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
 
 mvprog="${MVPROG-mv}"
 cpprog="${CPPROG-cp}"
@@ -58,10 +67,13 @@
 rmprog="${RMPROG-rm}"
 mkdirprog="${MKDIRPROG-mkdir}"
 
-transformbasename=
-transform_arg=
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
+posix_glob=
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chmodcmd=$chmodprog
 chowncmd=
 chgrpcmd=
 stripcmd=
@@ -70,22 +82,27 @@
 src=
 dst=
 dir_arg=
+dstarg=
+no_target_directory=
 
-usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
-   or: $0 -d DIR1 DIR2...
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
 
-In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
-In the second, create the directory path DIR.
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
 
 Options:
--b=TRANSFORMBASENAME
--c         copy source (using $cpprog) instead of moving (using $mvprog).
+-c         (ignored)
 -d         create directories instead of installing files.
--g GROUP   $chgrp installed files to GROUP.
--m MODE    $chmod installed files to MODE.
--o USER    $chown installed files to USER.
--s         strip installed files (using $stripprog).
--t=TRANSFORM
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
 --help     display this help and exit.
 --version  display version info and exit.
 
@@ -93,14 +110,9 @@
   CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
 "
 
-while test -n "$1"; do
+while test $# -ne 0; do
   case $1 in
-    -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
-        shift
-        continue;;
-
-    -c) instcmd=$cpprog
-        shift
+    -c) shift
         continue;;
 
     -d) dir_arg=true
@@ -112,11 +124,17 @@
         shift
         continue;;
 
-    --help) echo "$usage"; exit 0;;
+    --help) echo "$usage"; exit $?;;
 
-    -m) chmodcmd="$chmodprog $2"
+    -m) mode=$2
         shift
         shift
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
         continue;;
 
     -o) chowncmd="$chownprog $2"
@@ -128,164 +146,358 @@
         shift
         continue;;
 
-    -t=*) transformarg=`echo $1 | sed 's/-t=//'`
-        shift
-        continue;;
+    -t) dstarg=$2
+	shift
+	shift
+	continue;;
 
-    --version) echo "$0 $scriptversion"; exit 0;;
+    -T) no_target_directory=true
+	shift
+	continue;;
 
-    *)  if test -z "$src"; then
-          src=$1
-        else
-          # this colon is to work around a 386BSD /bin/sh bug
-          :
-          dst=$1
-        fi
-        shift
-        continue;;
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
   esac
 done
 
-if test -z "$src"; then
-  echo "$0: no input file specified." >&2
-  exit 1
+if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dstarg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dstarg"
+      shift # fnord
+    fi
+    shift # arg
+    dstarg=$arg
+  done
 fi
 
-# Protect names starting with `-'.
-case $src in
-  -*) src=./$src ;;
-esac
-
-if test -n "$dir_arg"; then
-  dst=$src
-  src=
-
-  if test -d "$dst"; then
-    instcmd=:
-    chmodcmd=
-  else
-    instcmd=$mkdirprog
-  fi
-else
-  # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-  # might cause directories to be created, which would be especially bad
-  # if $src (and thus $dsttmp) contains '*'.
-  if test ! -f "$src" && test ! -d "$src"; then
-    echo "$0: $src does not exist." >&2
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
     exit 1
   fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
 
-  if test -z "$dst"; then
-    echo "$0: no destination specified." >&2
-    exit 1
-  fi
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
 
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
   # Protect names starting with `-'.
-  case $dst in
-    -*) dst=./$dst ;;
+  case $src in
+    -*) src=./$src ;;
   esac
 
-  # If destination is a directory, append the input filename; won't work
-  # if double slashes aren't ignored.
-  if test -d "$dst"; then
-    dst=$dst/`basename "$src"`
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dstarg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
   fi
-fi
 
-# This sed command emulates the dirname command.
-dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+  obsolete_mkdir_used=false
 
-# Make sure that the destination directory exists.
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
 
-# Skip lots of stat calls in the usual case.
-if test ! -d "$dstdir"; then
-  defaultIFS='
-	'
-  IFS="${IFS-$defaultIFS}"
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
 
-  oIFS=$IFS
-  # Some sh's can't handle IFS=/ for some reason.
-  IFS='%'
-  set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-  IFS=$oIFS
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
 
-  pathcomp=
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
 
-  while test $# -ne 0 ; do
-    pathcomp=$pathcomp$1
-    shift
-    test -d "$pathcomp" || $mkdirprog "$pathcomp"
-    pathcomp=$pathcomp/
-  done
-fi
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
 
-if test -n "$dir_arg"; then
-  $doit $instcmd "$dst" \
-    && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-    && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-    && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-    && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
 
-else
-  # If we're going to rename the final executable, determine the name now.
-  if test -z "$transformarg"; then
-    dstfile=`basename "$dst"`
-  else
-    dstfile=`basename "$dst" $transformbasename \
-             | sed $transformarg`$transformbasename
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix=/ ;;
+	-*) prefix=./ ;;
+	*)  prefix= ;;
+      esac
+
+      case $posix_glob in
+        '')
+	  if (set -f) 2>/dev/null; then
+	    posix_glob=true
+	  else
+	    posix_glob=false
+	  fi ;;
+      esac
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob && set -f
+      set fnord $dstdir
+      shift
+      $posix_glob && set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
   fi
 
-  # don't allow the sed command to completely eliminate the filename.
-  test -z "$dstfile" && dstfile=`basename "$dst"`
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
 
-  # Make a couple of temp file names in the proper directory.
-  dsttmp=$dstdir/_inst.$$_
-  rmtmp=$dstdir/_rm.$$_
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
 
-  # Trap to clean up those temp files at exit.
-  trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
-  trap '(exit $?); exit' 1 2 13 15
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 
-  # Move or copy the file name to the temp name
-  $doit $instcmd "$src" "$dsttmp" &&
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 
-  # and set any options; do chmod last to preserve setuid bits.
-  #
-  # If any of these fail, we abort the whole thing.  If we want to
-  # ignore errors from any of these, just make sure not to ignore
-  # errors from the above "$doit $instcmd $src $dsttmp" command.
-  #
-  { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-    && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-    && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-    && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 
-  # Now remove or move aside any old file at destination location.  We
-  # try this two ways since rm can't unlink itself on some systems and
-  # the destination file might be busy for other reasons.  In this case,
-  # the final cleanup might fail but the new file should still install
-  # successfully.
-  {
-    if test -f "$dstdir/$dstfile"; then
-      $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-      || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
       || {
-	  echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-	  (exit 1); exit
-      }
-    else
-      :
-    fi
-  } &&
+	   # The rename failed, perhaps because mv can't rename something else
+	   # to itself, or perhaps because mv is so ancient that it does not
+	   # support -f.
 
-  # Now rename the file to the real destination.
-  $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-fi &&
+	   # Now remove or move aside any old file at destination location.
+	   # We try this two ways since rm can't unlink itself on some
+	   # systems and the destination file might be busy for other
+	   # reasons.  In this case, the final cleanup might fail but the new
+	   # file should still install successfully.
+	   {
+	     if test -f "$dst"; then
+	       $doit $rmcmd -f "$dst" 2>/dev/null \
+	       || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
+		     && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
+	       || {
+		 echo "$0: cannot unlink or rename $dst" >&2
+		 (exit 1); exit 1
+	       }
+	     else
+	       :
+	     fi
+	   } &&
 
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit
-}
+	   # Now rename the file to the real destination.
+	   $doit $mvcmd "$dsttmp" "$dst"
+	 }
+    } || exit 1
+
+    trap '' 0
+  fi
+done
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/old-time.cabal b/old-time.cabal
--- a/old-time.cabal
+++ b/old-time.cabal
@@ -1,9 +1,10 @@
 name:		old-time
-version:	1.0.0.0
+version:	1.0.0.2
 license:	BSD3
 license-file:	LICENSE
 maintainer:	libraries@haskell.org
-synopsis:	Time library.
+synopsis:	Time library
+category:	System
 description:
 	This package provides the old time library.
     For new code, the new time library is recommended.
@@ -18,6 +19,10 @@
 extensions:	CPP, ForeignFunctionInterface
 build-depends: base, old-locale
 nhc98-options: -K2M
+extra-source-files:
+        config.guess config.sub install-sh
+        configure.ac configure
+        include/HsTimeConfig.h.in
 extra-tmp-files:
         config.log config.status autom4te.cache
         include/HsTimeConfig.h
