[65589] branches/new-help-system/base

raimue at macports.org raimue at macports.org
Sun Mar 28 09:55:02 PDT 2010


Revision: 65589
          http://trac.macports.org/changeset/65589
Author:   raimue at macports.org
Date:     2010-03-28 09:55:01 -0700 (Sun, 28 Mar 2010)
Log Message:
-----------
Merge from trunk

Modified Paths:
--------------
    branches/new-help-system/base/ChangeLog
    branches/new-help-system/base/Doxyfile.in
    branches/new-help-system/base/HACKING
    branches/new-help-system/base/Makefile.in
    branches/new-help-system/base/Mk/macports.autoconf.mk.in
    branches/new-help-system/base/Mk/macports.tea.mk
    branches/new-help-system/base/NEWS
    branches/new-help-system/base/aclocal.m4
    branches/new-help-system/base/config/RELEASE_URL
    branches/new-help-system/base/config/macports_version
    branches/new-help-system/base/config.guess
    branches/new-help-system/base/config.sub
    branches/new-help-system/base/configure
    branches/new-help-system/base/configure.ac
    branches/new-help-system/base/doc/macports.conf.5
    branches/new-help-system/base/doc/macports.conf.in
    branches/new-help-system/base/doc/port.1
    branches/new-help-system/base/doc/portfile.7
    branches/new-help-system/base/doc/portstyle.7
    branches/new-help-system/base/doc/prefix.mtree.in
    branches/new-help-system/base/doc/variants.conf
    branches/new-help-system/base/m4/tcl.m4
    branches/new-help-system/base/portmgr/ReleaseProcess
    branches/new-help-system/base/portmgr/autosubmit.tcl
    branches/new-help-system/base/portmgr/dmg/InstallationCheck
    branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
    branches/new-help-system/base/portmgr/dmg/postflight
    branches/new-help-system/base/portmgr/freebsd/Makefile.in
    branches/new-help-system/base/portmgr/freebsd/pkg-plist
    branches/new-help-system/base/portmgr/jobs/Makefile
    branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl
    branches/new-help-system/base/portmgr/packaging/dpkgall.tcl
    branches/new-help-system/base/setupenv.bash.in
    branches/new-help-system/base/src/Makefile.in
    branches/new-help-system/base/src/config.h.in
    branches/new-help-system/base/src/cregistry/Makefile
    branches/new-help-system/base/src/cregistry/entry.c
    branches/new-help-system/base/src/cregistry/entry.h
    branches/new-help-system/base/src/cregistry/registry.c
    branches/new-help-system/base/src/cregistry/sql.c
    branches/new-help-system/base/src/cregistry/sql.h
    branches/new-help-system/base/src/darwintracelib1.0/Makefile
    branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
    branches/new-help-system/base/src/dep_map_clean.tcl
    branches/new-help-system/base/src/macports1.0/Makefile
    branches/new-help-system/base/src/macports1.0/macports.c
    branches/new-help-system/base/src/macports1.0/macports.tcl
    branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in
    branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in
    branches/new-help-system/base/src/package1.0/Makefile
    branches/new-help-system/base/src/package1.0/package.tcl
    branches/new-help-system/base/src/package1.0/portarchive.tcl
    branches/new-help-system/base/src/package1.0/portdmg.tcl
    branches/new-help-system/base/src/package1.0/portmdmg.tcl
    branches/new-help-system/base/src/package1.0/portpkg.tcl
    branches/new-help-system/base/src/package1.0/portrpm.tcl
    branches/new-help-system/base/src/package1.0/portunarchive.tcl
    branches/new-help-system/base/src/pextlib1.0/Makefile
    branches/new-help-system/base/src/pextlib1.0/Pextlib.c
    branches/new-help-system/base/src/pextlib1.0/curl.c
    branches/new-help-system/base/src/pextlib1.0/curl.h
    branches/new-help-system/base/src/pextlib1.0/filemap.c
    branches/new-help-system/base/src/pextlib1.0/fs-traverse.c
    branches/new-help-system/base/src/pextlib1.0/md5cmd.c
    branches/new-help-system/base/src/pextlib1.0/md_wrappers.h
    branches/new-help-system/base/src/pextlib1.0/readline.c
    branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c
    branches/new-help-system/base/src/pextlib1.0/sha1cmd.c
    branches/new-help-system/base/src/pextlib1.0/strsed.c
    branches/new-help-system/base/src/pextlib1.0/tests/checksums.tcl
    branches/new-help-system/base/src/pextlib1.0/tests/curl.tcl
    branches/new-help-system/base/src/pextlib1.0/tests/unsetenv.tcl
    branches/new-help-system/base/src/pextlib1.0/tracelib.c
    branches/new-help-system/base/src/pextlib1.0/tty.c
    branches/new-help-system/base/src/pextlib1.0/uid.c
    branches/new-help-system/base/src/pextlib1.0/xinstall.c
    branches/new-help-system/base/src/port/Makefile
    branches/new-help-system/base/src/port/port-help.tcl
    branches/new-help-system/base/src/port/port.tcl
    branches/new-help-system/base/src/port/portindex.tcl
    branches/new-help-system/base/src/port/portmirror.tcl
    branches/new-help-system/base/src/port1.0/Makefile
    branches/new-help-system/base/src/port1.0/port.tcl
    branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in
    branches/new-help-system/base/src/port1.0/portactivate.tcl
    branches/new-help-system/base/src/port1.0/portbuild.tcl
    branches/new-help-system/base/src/port1.0/portchecksum.tcl
    branches/new-help-system/base/src/port1.0/portclean.tcl
    branches/new-help-system/base/src/port1.0/portconfigure.tcl
    branches/new-help-system/base/src/port1.0/portdestroot.tcl
    branches/new-help-system/base/src/port1.0/portdistcheck.tcl
    branches/new-help-system/base/src/port1.0/portdistfiles.tcl
    branches/new-help-system/base/src/port1.0/portextract.tcl
    branches/new-help-system/base/src/port1.0/portfetch.tcl
    branches/new-help-system/base/src/port1.0/portinstall.tcl
    branches/new-help-system/base/src/port1.0/portlint.tcl
    branches/new-help-system/base/src/port1.0/portlivecheck.tcl
    branches/new-help-system/base/src/port1.0/portload.tcl
    branches/new-help-system/base/src/port1.0/portmain.tcl
    branches/new-help-system/base/src/port1.0/portpatch.tcl
    branches/new-help-system/base/src/port1.0/portstartupitem.tcl
    branches/new-help-system/base/src/port1.0/porttrace.tcl
    branches/new-help-system/base/src/port1.0/portunload.tcl
    branches/new-help-system/base/src/port1.0/portutil.tcl
    branches/new-help-system/base/src/programs/daemondo/Makefile.in
    branches/new-help-system/base/src/programs/daemondo/main.c
    branches/new-help-system/base/src/registry2.0/Makefile
    branches/new-help-system/base/src/registry2.0/entry.c
    branches/new-help-system/base/src/registry2.0/entryobj.c
    branches/new-help-system/base/src/registry2.0/graph.c
    branches/new-help-system/base/src/registry2.0/item.c
    branches/new-help-system/base/src/registry2.0/itemobj.c
    branches/new-help-system/base/src/registry2.0/portimage.tcl
    branches/new-help-system/base/src/registry2.0/portuninstall.tcl
    branches/new-help-system/base/src/registry2.0/registry.c
    branches/new-help-system/base/src/registry2.0/registry_util.tcl
    branches/new-help-system/base/src/registry2.0/tests/depends.tcl
    branches/new-help-system/base/src/registry2.0/util.c
    branches/new-help-system/base/src/tclobjc1.0/Makefile.in
    branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m
    branches/new-help-system/base/src/upgrade_sources_conf_default.tcl
    branches/new-help-system/base/tests/Makefile
    branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile
    branches/new-help-system/base/tests/test/checksums-1/master
    branches/new-help-system/base/tests/test/cvs-and-patchsites/master
    branches/new-help-system/base/tests/test/dependencies-c/master
    branches/new-help-system/base/tests/test/dependencies-d/master
    branches/new-help-system/base/tests/test/dependencies-e/master
    branches/new-help-system/base/tests/test/envvariables/master
    branches/new-help-system/base/tests/test/site-tags/master
    branches/new-help-system/base/tests/test/trace/master
    branches/new-help-system/base/tests/test/universal-2/master
    branches/new-help-system/base/tests/test/variants/master
    branches/new-help-system/base/tests/test/xcodeversion/master

Added Paths:
-----------
    branches/new-help-system/base/config/dp_version
    branches/new-help-system/base/src/cregistry/README.sqlext
    branches/new-help-system/base/src/cregistry/sqlext.c
    branches/new-help-system/base/src/cregistry/vercomp.c
    branches/new-help-system/base/src/cregistry/vercomp.h
    branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c
    branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.h
    branches/new-help-system/base/src/macports1.0/sysctl.c
    branches/new-help-system/base/src/macports1.0/sysctl.h
    branches/new-help-system/base/src/package1.0/portarchivefetch.tcl
    branches/new-help-system/base/src/pextlib1.0/Pextlib.h
    branches/new-help-system/base/src/pextlib1.0/flock.c
    branches/new-help-system/base/src/pextlib1.0/flock.h
    branches/new-help-system/base/src/pextlib1.0/mktemp.c
    branches/new-help-system/base/src/pextlib1.0/mktemp.h
    branches/new-help-system/base/src/pextlib1.0/pipe.c
    branches/new-help-system/base/src/pextlib1.0/pipe.h
    branches/new-help-system/base/src/pextlib1.0/readdir.c
    branches/new-help-system/base/src/pextlib1.0/readdir.h
    branches/new-help-system/base/src/pextlib1.0/realpath.c
    branches/new-help-system/base/src/pextlib1.0/realpath.h
    branches/new-help-system/base/src/pextlib1.0/sha256cmd.c
    branches/new-help-system/base/src/pextlib1.0/sha256cmd.h
    branches/new-help-system/base/src/pextlib1.0/strsed.h
    branches/new-help-system/base/src/pextlib1.0/system.c
    branches/new-help-system/base/src/pextlib1.0/system.h
    branches/new-help-system/base/src/port1.0/fetch_common.tcl
    branches/new-help-system/base/src/port1.0/portdeactivate.tcl
    branches/new-help-system/base/src/port1.0/portuninstall.tcl
    branches/new-help-system/base/src/registry2.0/receipt_flat.tcl
    branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl
    branches/new-help-system/base/src/registry2.0/registry.tcl
    branches/new-help-system/base/src/registry2.0/registry_autoconf.tcl.in
    branches/new-help-system/base/tests/test/dependencies-e/error_expected

Removed Paths:
-------------
    branches/new-help-system/base/Mk/macports.upgrade.mk
    branches/new-help-system/base/m4/objc.m4
    branches/new-help-system/base/portmgr/bots/
    branches/new-help-system/base/portmgr/dmg/preflight
    branches/new-help-system/base/portmgr/fedora/macports.spec.in
    branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.c
    branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.h
    branches/new-help-system/base/src/registry1.0/
    branches/new-help-system/base/src/sqlite-3.1.3.diff
    branches/new-help-system/base/src/sqlite-3.1.3.tar.gz

Property Changed:
----------------
    branches/new-help-system/base/
    branches/new-help-system/base/portmgr/dmg/InstallationCheck
    branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
    branches/new-help-system/base/portmgr/fedora/
    branches/new-help-system/base/portmgr/jobs/mirror_macports.sh
    branches/new-help-system/base/portmgr/jobs/org.macports.PortIndexRegen.plist
    branches/new-help-system/base/portmgr/jobs/org.macports.mprsyncup.plist
    branches/new-help-system/base/portmgr/jobs/portfile_lint.pl
    branches/new-help-system/base/portmgr/jobs/portfile_mirror.pl
    branches/new-help-system/base/src/cregistry/
    branches/new-help-system/base/src/dep_map_clean.tcl
    branches/new-help-system/base/src/package1.0/portportpkg.tcl
    branches/new-help-system/base/src/pextlib1.0/tracelib.c
    branches/new-help-system/base/src/pextlib1.0/tracelib.h
    branches/new-help-system/base/src/registry2.0/
    branches/new-help-system/base/src/registry2.0/portimage.tcl
    branches/new-help-system/base/src/registry2.0/portuninstall.tcl
    branches/new-help-system/base/src/registry2.0/registry_util.tcl
    branches/new-help-system/base/src/tclobjc1.0/MPMethodSignatureExtensions.h
    branches/new-help-system/base/src/tclobjc1.0/MPMethodSignatureExtensions.m
    branches/new-help-system/base/src/tclobjc1.0/Makefile.in
    branches/new-help-system/base/src/tclobjc1.0/objc_encoding.h
    branches/new-help-system/base/src/tclobjc1.0/objc_encoding.m
    branches/new-help-system/base/src/tclobjc1.0/tclobjc.h
    branches/new-help-system/base/src/tclobjc1.0/tclobjc.m
    branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.h
    branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m
    branches/new-help-system/base/src/thread2.6.diff
    branches/new-help-system/base/src/upgrade_sources_conf_default.tcl


Property changes on: branches/new-help-system/base
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/gsoc08-privileges/base:37343-46937
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:49341-52361
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692
   + /branches/gsoc08-privileges/base:37343-46937
/branches/gsoc09-logging/base:51231-60371
/branches/universal-sanity/base:51872-52323
/branches/variant-descs-14482/base:34469-34855,34900-37508,37511-37512,41040-41463,42575-42626,42640-42659
/trunk/base:49341-65587
/users/perry/base-bugs_and_notes:45682-46060
/users/perry/base-select:44044-44692

Modified: branches/new-help-system/base/ChangeLog
===================================================================
--- branches/new-help-system/base/ChangeLog	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/ChangeLog	2010-03-28 16:55:01 UTC (rev 65589)
@@ -3,41 +3,267 @@
 # $Id$
 ###
 
+Release 1.9.0 (unreleased):
 
-Release 1.8.0 (unreleased):
+    - Allow gcc45 port to be used in configure.compiler (ryandesign in r62223)
+
+    - svn checkouts now use peg revisions instead of operative revisions,
+      so they'll continue to work if a repository gets reorganized
+      (#20777, ryandesign in r60573)
+
+    - Print the location of the log file when a target fails (jmr in r60769)
+
+    - Use CommonCrypto/CommonDigest instead of OpenSSL libcrypto.
+      (toby in r58131, jberry in r59715)
+
+    - Add SHA256 checksums in addition to MD5, SHA1 and RIPEMD160.
+      (afb in r57888, r57913)
+
+    - New "patch.type gnu" for GNU patch, similar to "build.type gnu"
+      for GNU make. Only makes a difference for BSD patch and BSD make.
+      (afb in r58020)
+
+    - Update the FreeBSD package, drop the old Fedora/Ubuntu packages.
+      (MacPorts now requires BSD, but objc/Foundation is now optional)
+      (afb in r57858, r57889)
+
+    - Don't use "make -j1" for build.jobs=1, but prefer "make" instead.
+      (afb in r57998)
+
+    - Add new "use_xz yes" port option to allow distfiles in xz format.
+      (afb in r57827)
+
+    - Archivemode now uses build_arch to create and extract archives.
+      This is a step in the direction of enabling binary distribution.
+      (snc in r58977)
+
+    - Add new log command and keeping of debug output for easy access
+      after port has run (GSoC 2009 logging project by enl, merged in r60372)
+
+Release 1.8.3 (unreleased):
+
+    - Some of the build_arch flags now appear in LDFLAGS as well, fixing
+      several ports when building for a different architecture (jeremyhu in
+      r60662, jmr in r60680)
+
+    - Fixed 'merge' proc for paths with spaces, and for symlinks on Snow
+      Leopard, and added an error message for when 'merge' is not called
+      correctly (ryandesign in r58776, r58777, r58778)
+
+Release 1.8.2 (2010-01-01 by jmr):
+
+    - Fixed 'port load' for non-root installations (#21713, jmr in r60774)
+
+    - Fixed a bug that could cause port to hit the open file limit
+      (#22959, jmr in r61770)
+
+    - Fixed an error when installing from source or selfupdating on Tiger with
+      an svn-based ports tree (#20760, jmr in r61302)
+
+    - Fixed an error when selfupdating as root with a prefix that is not owned
+      by root (#21010, jmr in r60798)
+
+    - Stopped uninstall from failing when files in the port image have already
+      been deleted (#22001, jmr in r59318, r59654)
+
+    - Stopped printing command output multiple times on failure (#21084,
+      jmr in r60770)
+
+    - Started showing bug reporting instructions on failure (jmr in r60770)
+
+    - Fixed a bug where 'port dmg' could create too small an image and run out
+      of space (#22404, jmr in r60260)
+
+    - Fixed a bug where reinplace could fail when running port without root
+      privileges (#20896, jmr in r59597)
+
+    - Started setting our own umask since Snow Leopard makes us inherit
+      the user's even when using sudo (#21389, jmr in r59585)
+
+Release 1.8.1 (2009-09-28 by jmr):
+
+    - Installer error messages now display properly even from the Snow Leopard
+      MacPorts dmg. (jmr in r56448)
+
+    - 'fetch.type svn' no longer requires the installation of the subversion
+      port as of Snow Leopard. (toby in r56160; raimue in r56162)
+
+    - Updated manpages and 'port help' output (ryandesign in r56472, r56473,
+      r56474; blb in r56666, r57048, r57131)
+
+    - Fixed syncing using the daily tarball. (#21034, toby in r56889)
+
+    - Fixed 'port load' (#21128, raimue in r57055)
+
+    - Improved error message when an expression on the command line does not
+      match any ports (jmr in r57026)
+
+    - Stopped recording the completion of the install phase in the
+      statefile, which led to errors if the port was uninstalled but the work
+      dir was not cleaned, and the port was then installed again.
+      (jmr/raimue in r57801, 57820)
+
+Release 1.8.0 (2009-08-28 by jmr):
+    - There is now a 'build_arch' variable, available in portfiles and
+      configurable in macports.conf, which sets the CPU architecture that
+      ports should be compiled for (when not building universal). Its default
+      is the same as that of the Apple-supplied /usr/bin/gcc.
+      (#19874, jmr in r53217,r53386,r53420,r53494,r53860,r54236)
+
+    - MacPorts base now works on and has appropriate default settings for
+      Mac OS X 10.6 Snow Leopard. (#19874, toby/mww/jkh in r38271,r40060,
+      r40836,r43976,r52397)
+      
+    - MacPorts now requires Mac OS X 10.4 Tiger or later. (Panther is not
+      just "unsupported", it really won't work.)
+
+    - The universal_sysroot and universal_target keys have been removed from
+      macports.conf. These settings are now handled automatically.
+      (toby in r52324)
+
+    - Added a 'replaced_by' portfile option. This causes upgrade to deactivate
+      the current port and install the port specified by this option. This
+      also allows ports to be renamed. Upgrade accepts a --no-replace option
+      which disables this behaviour. (#20157, jmr in r54378)
+
+    - The upgrade action now accepts --force and --enforce-variants options.
+      The former causes ports to be rebuilt even if they are not outdated, and
+      the global -f option no longer has this effect (it had too many effects
+      already). The latter causes ports to be rebuilt if the requested
+      variants do not match those installed (even if they are not outdated).
+      (#20156, jmr in r54376)
+
+    - Dependencies can be satisfied by ports that are installed but not
+      available in the ports tree (useful for testing uncommitted ports).
+      (jmr in r52075, r52160)
+
+    - Ports that are installed but not available in the ports tree no longer
+      cause an error when running commands like 'port clean installed'. They
+      are skipped and a warning is printed. (#19253, jmr in r50865)
+
+    - Selfupdate no longer disables readline support unless readline is found
+      in /usr/local, which has historically caused failures.
+      (#19035, jmr in r50868)
+
+    - Uninstalling a port that is not installed now produces an informational
+      message rather than an error. (#18984, jmr in r53709)
+
+    - Added a 'conflicts' portfile option. Conflicting ports will be detected
+      during dependency calculation. (#18794, blb/jmr in r51525)
+
+    - 'port selfupdate' now explicitly states precisely what it does. (#18512)
+
+    - Operating system and architecture information is now shown in debug
+      output. (#18435, raimue in r46669)
+
+    - Fixed a bug that could break some symlinks to man pages. (#18302)
+
+    - Switched to a more efficient algorithm for looking up port information
+      in the index, which makes many operations faster.
+      (#18259, jmr/blb in r47110)
+
+    - MacPorts base now tries to avoid using commands that come from ports, so
+      that a broken port can't break the base code. (#18149)
+
+    - Deleting all the contents of a portfile option no longer unsets the
+      option entirely. (#17865, toby in r44901)
+
+    - Removed the code that upgrades from the old DarwinPorts filesystem
+      layout. Trying to upgrade to 1.8.0+ from a version older than 1.5.0 will
+      produce an error message saying you need to install 1.7.1 first.
+      (#17619, jmr in r53260)
+
+    - port(1) now reports its version as dotted-decimal rather than floating
+      point. (#17420)
+
+    - Dependencies are now always obtained by parsing the Portfile and not
+      from the PortIndex, since the latter can't provide expanded variables
+      like $prefix which may be used in path: depspecs. (#17182)
+
+    - Newline characters in long_description can no longer cause receipt
+      corruption. (#16619, blb in r50663)
+
+    - Now unlocking the filemap when it is not in use. This allows e.g.
+      'port contents' to be run while another port instance is performing
+      installs. Note that running more than one simultaneous port instance
+      that will modify the registry can easily fail, though hopefully
+      without corrupting anything. (#16246, jmr in r51133)
+
+    - Removed some irrelevant debug output that was being printed when a port
+      failed. (#16203, jmr in r53706)
+
+    - Added new depends_fetch and depends_extract options, for dependencies
+      that are needed to fetch or extract the port, respectively.
+      (#15161, jmr in r51780)
+
+    - Packages (including the one for MacPorts base) now correctly indicate
+      that they can only be installed on the root volume.
+      (#14809, jmr in r53250)
+
+    - Using an alternative fetch or extract type now adds appropriate
+      dependencies automatically, e.g. 'use_zip yes' adds a dep on unzip, and
+      'fetch.type svn' adds a dep on subversion. (#13981, jmr in r43782)
+
+    - port(1) should now exit with an appropriate status code when an error is
+      encountered. Use the -p option to continue despite errors.
+      (#13918, jmr in r53704)
+
+    - Proxy information can now be obtained from System Preferences and from
+      macports.conf. The older method using environment variables no longer
+      works out of the box on Leopard due to changes that Apple made to the
+      default /etc/sudoers. (#13158, blb in r47194)
+
+    - Improved handling of malformed variant definitions.
+      (#12596, jmr in r50719, r50721)
+
+    - Cope a little better with missing receipt files. (#19540, jmr in r51138)
+
+    - Fixed a major memory leak in the filemap code.
+      (#12022, pguyot in r51419)
+
+    - Improved the logic for determining whether phases can be skipped. This
+      fixes the specific problems of being unable to build packages of ports
+      that are installed, port not running specific phases (e.g. build)
+      when told to if the port is installed, and inactive dependencies being
+      rebuilt instead of simply activated. (#10881, #16260, jmr in r50490)
+
+    - When archive mode is enabled, ports will no longer be rebuilt if an
+      archive is available. (#10785, jmr in r50416)
+
+    - Activating a port will now first deactivate any other version of the
+      same port that is already active. (#10571, jmr in r53711)
+
+    - Added a 'license' portfile option, which is displayed in 'port info'
+      output. (#7493, jmr in r50801)
+
     - port lint recognizes new top-level category php (#19329, ryandesign)
 
     - Do not print header lines when the quiet option -q is set
-    (r48558, raimue)
+      (raimue in r48558)
 
-    - svn.tag is deprecated, use svn.revision instead (r48222-48223, raimue)
+    - svn.tag is deprecated, use svn.revision instead (raimue in r48222-48223)
 
-    - port -i option has been removed (r48218, blb)
+    - port -i option has been removed (blb in r48218)
 
-    - ui_warn logs to stderr instead of stdout (r48217, raimue)
+    - ui_warn logs to stderr instead of stdout (raimue in r48217)
 
     - Remove --pretend option for port selfupdate, use global dry-run option
-      instead (r48125, raimue)
+      instead (raimue in r48125)
 
-    - port(1) option -y for dry-run (#11892, gwhitney) 
+    - port(1) option -y for dry-run (#11892, gwhitney/jmr in r43726) 
 
     - New pseudo-port 'obsolete' to identify ports which are installed but no
-      longer in the PortIndex (r47253, raimue)
+      longer in the PortIndex (raimue in r47253)
 
-    - MacPorts now performs fetch, extract, patch, configure and build in a
+    - MacPorts can now perform fetch, extract, patch, configure and build in a
       user rather than system owned location. By default, this is
       ~/.macports/opt. This allows MacPorts to do all but the install of the
       port without root privileges. (gsoc08-privileges)
 
-    - MacPorts now automatically drops privileges whenever possible so as to
-      avoid running as root whenever possible. (gsoc08-privileges)
+    - MacPorts can now automatically drop privileges so as to avoid running as
+      root whenever possible. To enable this, pass the desired user to run as
+      to configure with the --with-macports-user option. (gsoc08-privileges)
 
-    - MacPorts will prompt for the root password if you attempt to install a
-      port into the /opt/local hierarchy and did not start MacPorts with sudo.
-      It will not do so however until the install stage. The fetch, extract,
-      patch, configure and build will proceed first under the privileges
-      MacPorts is started with. (gsoc08-privileges)
-
     - The Portfile format has a number of new boolean attributes to indicate
       when an action should or should not be run with root privileges:
       'patch.asroot', 'build.asroot', 'configure.asroot', 'destroot.asroot',
@@ -71,11 +297,11 @@
     - Make dependencies displayed in port info respect variants
       specified in variants.conf; collapse port deps to be an alias
       for port info with appropriate flags. Note this changes output
-      format of port deps somewhat.  (#11891, gwhitney)
+      format of port deps somewhat.  (#11891, gwhitney in r44340)
 
     - Make dependencies in port upgrade respect variants as specified
       (in order of precedence) on command line, latest installed
-      version, or variants.conf .  (#8221, gwhitney)
+      version, or variants.conf .  (#8221, gwhitney in r44362)
 
     - Add select action, which integrates *_select tools into port.
       (#17477, perry)
@@ -84,9 +310,12 @@
       variants and variants' dependencies. (#14178, #15628, perry)
 
     - Implicit variants (e.g., darwin) can no longer be explicitly
-      set/unset. (#12563, perry)
+      set/unset. (#12563, perry in r46938, jmr in r53371)
 
 Release 1.7.1 (2009-03-28 by raimue):
+    - Trailing slashes are stripped from the prefix passed to configure, which
+      prevents incorrect mtree violation warnings. (#13789)
+
     - Fix freshmeat-based livecheck (#18887)
 
     - Fix issue on direct-mode installs where checking for installed ports
@@ -269,7 +498,7 @@
 
     - Change default +universal platform back to: 10.4/10.4u.sdk/i386 ppc (r33087, r33107).
 
-    - Add `port platform` info target that outputs current platform (#12302, afb in r32724).
+    - Add `port platform` info action that outputs current platform (#12302, afb in r32724).
 
     - Enable 64 bit environment, ppc64 x86_64, for all +universal builds (mww in r32194).
 
@@ -317,7 +546,7 @@
 
     - readline is now disabled by default, in order to avoid support issues.
       use --enable-readine parameter to configure to enable support for readine.
-      (jberry r31139, r31140).
+      (#10651, jberry in r31139, r31140).
 
     - daemondo now monitors kevents for the death of the daemon process, which means that it
       now detects the death of processes (even those that aren't direct child processes)
@@ -530,7 +759,7 @@
     - `port info` now supports new --index flag for using old behaviour (eridius r25256).
 
     - `port info` now opens the Portfile and displays up-to-date information.
-      This allows information about variants to be displayed (eg. dependencies).
+      This allows information about variants to be displayed (e.g. dependencies).
       Also allow `port info` to default to current directory if no name is provided
       (eridius r25255).
 

Modified: branches/new-help-system/base/Doxyfile.in
===================================================================
--- branches/new-help-system/base/Doxyfile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/Doxyfile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -93,7 +93,7 @@
 EXAMPLE_RECURSIVE      = NO
 IMAGE_PATH             = 
 INPUT_FILTER           = 
-FILTER_PATTERNS        = *.tcl=tcl-dox
+FILTER_PATTERNS        = *.tcl=@prefix@/bin/tcl-dox
 FILTER_SOURCE_FILES    = NO
 #---------------------------------------------------------------------------
 # configuration options related to source browsing
@@ -222,7 +222,7 @@
 GRAPHICAL_HIERARCHY    = YES
 DIRECTORY_GRAPH        = YES
 DOT_IMAGE_FORMAT       = png
-DOT_PATH               = 
+DOT_PATH               = @prefix@/bin/
 DOTFILE_DIRS           = 
 DOT_GRAPH_MAX_NODES    = 50
 MAX_DOT_GRAPH_DEPTH    = 0

Modified: branches/new-help-system/base/HACKING
===================================================================
--- branches/new-help-system/base/HACKING	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/HACKING	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,6 +1,6 @@
 # Project naming and copyright attribution:
 
- *  "The MacPorts Project" is the string that shall be used whereever
+ *  "The MacPorts Project" is the string that shall be used wherever
     there's a need to reference our project name, such as in copyright
     notices.
 
@@ -23,7 +23,7 @@
 
  *  Commits with user-visible affect made to the "base" component of the
     repository should be accompanied by a corresponding entry in the
-    base/ChanegeLog file, with references to pertitent Trac ticket
+    base/ChangeLog file, with references to pertinent Trac ticket
     numbers and svn commit revisions where appropriate.
 
  *  Such entries to the ChangeLog need not be full duplications of their

Modified: branches/new-help-system/base/Makefile.in
===================================================================
--- branches/new-help-system/base/Makefile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/Makefile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,5 +1,6 @@
 # $Id$
 
+PATH		= @PATH_CLEANED@
 SUBDIR		= doc src
 DISTDIR		= dist
 DISTVER		=
@@ -28,27 +29,21 @@
 		echo "Source tree not configured. Use ./configure" ; \
 	fi
 
-
-include Mk/macports.upgrade.mk
-
-install:: upgrade
-	[ ! -f ${sysconfdir}/macports/mp_version ] || rm -vf ${sysconfdir}/macports/mp_version
-
 include Mk/macports.subdir.mk
 
 install::
+	[ ! -f $(DESTDIR)${sysconfdir}/macports/mp_version ] || rm -vf $(DESTDIR)${sysconfdir}/macports/mp_version
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 setupenv.bash  $(DESTDIR)${datadir}/macports/
 # Only run these scripts when not building in a destroot
 ifeq ($(DESTDIR),)
 # Add [default] tag to the central MacPorts repository, if it isn't already
 	$(TCLSH) src/upgrade_sources_conf_default.tcl ${prefix}
 # Remove duplicate entries from the dependency map (could occur with 1.6 and earlier):
-	$(TCLSH) src/dep_map_clean.tcl ${TCL_PACKAGE_DIR}
+	$(TCLSH) src/dep_map_clean.tcl "${macports_tcl_dir}"
 endif
-	@echo ""; echo "Congratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, run:"; echo ""
+	@echo ""; echo "Congratulations, you have successfully installed the MacPorts system. To get the Portfiles and update the system, add ${prefix}/bin to your PATH and run:"; echo ""
 	@echo "sudo port -v selfupdate"; echo ""
 	@echo "Please read \"man port\", the MacPorts guide at http://guide.macports.org/ and Wiki at http://trac.macports.org/ for full documentation."; echo ""
-	@echo "Stray sources might have been left in the legacy ${localstatedir}/db/dports directory after this upgrade, which moved most of what it could to ${localstatedir}/macports, so you might want to look in the former and cleanup manually."; echo ""
 
 group::
 	@echo "creating a macports group..." && sudo dseditgroup -o create -n . macports && echo "done! use './configure --with-install-group=macports --with-shared-directory' if you haven't already"
@@ -62,7 +57,7 @@
 distclean::
 	rm -f config.log config.status configure.lineno
 	rm -rf autom4te.cache ${DISTDIR}
-	rm -f Makefile Mk/macports.autoconf.mk portmgr/fedora/macports.spec portmgr/freebsd/Makefile
+	rm -f Makefile Mk/macports.autoconf.mk portmgr/freebsd/Makefile
 	rm -f Doxyfile
 	rm -f setupenv.bash
 
@@ -93,10 +88,14 @@
 endif
 
 tcldoc:
-	find src -name '*.tcl' | xargs tcldoc --verbose --title "MacPorts Documentation" --force tcldoc
+	@[ -e "${prefix}/bin/tcldoc" ] \
+		|| { echo "Install tcldoc with MacPorts in ${prefix} first."; exit 1; }
+	find src -name '*.tcl' | xargs ${TCLDOC} --verbose --title "MacPorts Documentation" --force tcldoc
 
 tcldox:
-	doxygen
+	@[ -e "${prefix}/bin/doxygen" -a -e "${prefix}/bin/tcl-dox" -a -e "${prefix}/bin/dot" ] \
+		|| { echo "Install doxygen, tcl-dox and graphviz with MacPorts in ${prefix} first."; exit 1; }
+	${prefix}/bin/doxygen
 
 test::
 

Modified: branches/new-help-system/base/Mk/macports.autoconf.mk.in
===================================================================
--- branches/new-help-system/base/Mk/macports.autoconf.mk.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/Mk/macports.autoconf.mk.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -7,8 +7,8 @@
 VPATH			= @srcdir@
 
 CC			= @CC@
-CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR) $(CPPFLAGS)
-OBJCFLAGS		= @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR) $(CPPFLAGS)
+CFLAGS			= @CFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR)
+OBJCFLAGS		= @OBJCFLAGS@ $(CFLAGS_QUICHEEATERS) $(CFLAGS_WERROR)
 CPPFLAGS		= @CPPFLAGS@ @DEFS@ @INCLUDES@ @TCL_INCLUDES@
 TCL_DEFS		= @TCL_DEFS@
 SHLIB_CFLAGS		= @SHLIB_CFLAGS@
@@ -17,7 +17,7 @@
 
 READLINE_CFLAGS		=
 MD5_CFLAGS		=
-SQLITE3_CFLAGS		=
+SQLITE3_CFLAGS		= @CFLAGS_SQLITE3@
 CURL_CFLAGS		= @CFLAGS_LIBCURL@
 
 OBJC_RUNTIME		= @OBJC_RUNTIME@
@@ -32,7 +32,7 @@
 TCL_CC			= @TCL_CC@
 SHLIB_LD		= @SHLIB_LD@
 STLIB_LD		= @STLIB_LD@
-LDFLAGS			= -L/usr/local/lib @LDFLAGS@
+LDFLAGS			= @LDFLAGS@
 SHLIB_LDFLAGS		= @SHLIB_LDFLAGS@ ${LDFLAGS}
 SHLIB_SUFFIX		= @SHLIB_SUFFIX@
 TCL_STUB_LIB_SPEC	= @TCL_STUB_LIB_SPEC@
@@ -40,7 +40,7 @@
 LIBS			= @LIBS@
 READLINE_LIBS		= @READLINE_LIBS@
 MD5_LIBS		= @MD5_LIBS@
-SQLITE3_LIBS		= @SQLITE3_LIBS@
+SQLITE3_LIBS		= @LDFLAGS_SQLITE3@
 CURL_LIBS		= @LDFLAGS_LIBCURL@
 INSTALL			= @INSTALL@
 MTREE			= @MTREE@
@@ -50,6 +50,7 @@
 
 TCLSH			= @TCLSH@
 TCL_PACKAGE_DIR		= @TCL_PACKAGE_DIR@
+macports_tcl_dir	= @macports_tcl_dir@
 
 DSTUSR			= @DSTUSR@
 DSTGRP			= @DSTGRP@

Modified: branches/new-help-system/base/Mk/macports.tea.mk
===================================================================
--- branches/new-help-system/base/Mk/macports.tea.mk	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/Mk/macports.tea.mk	2010-03-28 16:55:01 UTC (rev 65589)
@@ -3,17 +3,17 @@
 .SUFFIXES: .m
 
 .m.o:
-	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${OBJCFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${OBJCFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 .c.o:
-	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${CFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS -DTCL_NO_DEPRECATED ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 all:: ${SHLIB_NAME} pkgIndex.tcl
 
 $(SHLIB_NAME):: ${OBJS}
 	${SHLIB_LD} ${OBJS} -o ${SHLIB_NAME} ${TCL_STUB_LIB_SPEC} ${SHLIB_LDFLAGS} ${LIBS}
 
-pkgIndex.tcl:
+pkgIndex.tcl: $(SHLIB_NAME)
 	$(SILENT) ../pkg_mkindex.sh .
 
 clean::

Deleted: branches/new-help-system/base/Mk/macports.upgrade.mk
===================================================================
--- branches/new-help-system/base/Mk/macports.upgrade.mk	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/Mk/macports.upgrade.mk	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,115 +0,0 @@
-# $Id$
-
-UPGRADECHECK    = $(DESTDIR)${localstatedir}/macports/.mprename
-
-
-upgrade::
-	@echo ""; echo "Upgrading your existing MacPorts installation to the new namespace if necessary:"; echo ""
-
-# We can safely delete the ${TCL_PACKAGE_DIR}/darwinports1.0 dir as files in it are always overwritten and will now be installed onto
-# ${TCL_PACKAGE_DIR}/macports1.0 with new names:
-	[ ! -d $(DESTDIR)${TCL_PACKAGE_DIR}/darwinports1.0 ] || rm -rf $(DESTDIR)${TCL_PACKAGE_DIR}/darwinports1.0
-
-# MacPorts base files in ${datadir} are also safely removed as new ones are always installed, and onto a their new location in this case too:
-	[ ! -d $(DESTDIR)${datadir}/darwinports ] || rm -rf $(DESTDIR)${datadir}/darwinports
-
-# Old version file can be safely deleted, as it was already used to start this upgrade and a new one will be installed into the new location:
-	[ ! -f $(DESTDIR)${sysconfdir}/ports/dp_version ] || rm -vf $(DESTDIR)${sysconfdir}/ports/dp_version
-
-# Old ports.conf(5) man page is removed:
-	[ ! -f $(DESTDIR)${prefix}/share/man/man5/ports.conf.5 ] || rm -vf $(DESTDIR)${prefix}/share/man/man5/ports.conf.5
-
-# Conf files directory is renamed:
-	[ ! -d $(DESTDIR)${sysconfdir}/ports ] || mv -v $(DESTDIR)${sysconfdir}/ports $(DESTDIR)${sysconfdir}/macports
-
-# Important directories inside ${localstatedir}/db/dports are moved to their new location, creating it first:
-	[ -d $(DESTDIR)${localstatedir}/macports ] || mkdir -vp $(DESTDIR)${localstatedir}/macports
-	for dir in distfiles packages receipts software; do \
-		[ ! -d $(DESTDIR)${localstatedir}/db/dports/$${dir} ] || mv -v $(DESTDIR)${localstatedir}/db/dports/$${dir} $(DESTDIR)${localstatedir}/macports ; \
-	done
-
-# Move the default ports tree to the new layout:
-	[ ! -d $(DESTDIR)${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || { mkdir -vp \
-		$(DESTDIR)${localstatedir}/macports/sources/rsync.macports.org/release && mv -v \
-		$(DESTDIR)${localstatedir}/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports $(DESTDIR)${localstatedir}/macports/sources/rsync.macports.org/release/ports ; \
-	}
-
-# Open up receipts and upgrade any paths in them containing old conventions to the new namespace:
-	for receipt in $(DESTDIR)${localstatedir}/macports/receipts/*/*/receipt.bz2 ; do [ ! \( -f $${receipt} -a ! -f $${receipt}.mpsaved \) ] || { \
-		cp -v $${receipt} $${receipt}.mpsaved && { \
-			$(BZIP2) -q -dc $${receipt} | sed 's/db\/dports/macports/g' | $(BZIP2) -q -zf > $${receipt}.new ; \
-		} && mv -v $${receipt}.new $${receipt} ; \
-	}; done
-
-# Check for existance of the main configuration file and perform a couple of replacements on it, backing it up first:
-## 1) new default path up to our configuration files (referenced through other variables);
-## 2) new default value for the portdbpath variable;
-## 3) new MacPorts rsync server;
-## 4) new default value for the base tree;
-## 5) new default value for trunk's base sources for users who have it (some do);
-## 6) stray quotes are removed from the value of the rsync_options key in old conf files;
-## 7) useless --delete option is removed from the default rsync flags (--delete is implied by --delete-after);
-## 8) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page;
-	[ ! \( -f $(DESTDIR)${sysconfdir}/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || { \
-		mv -v $(DESTDIR)${sysconfdir}/macports/ports.conf $(DESTDIR)${sysconfdir}/macports/macports.conf.mpsaved; \
-		sed 's/etc\/ports/etc\/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf.mpsaved > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/db\/dports/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/darwinports/macports/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/dpupdate1\/base/release\/base/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed '/^rsync_options/s/"\(.*\)"/\1/' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/ --delete / /' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-		sed 's/ ports.conf(5)/ macports.conf(5)/g' $(DESTDIR)${sysconfdir}/macports/macports.conf > $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/macports.conf.tmp $(DESTDIR)${sysconfdir}/macports/macports.conf; \
-	}
-
-# Check for existance of the main sources file and perform a couple of replacements on it, backing it up first:
-## 1) new MacPorts rsync server;
-## 2) new default value for the ports tree.
-	[ ! \( -f $(DESTDIR)${sysconfdir}/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || { \
-		cp -v $(DESTDIR)${sysconfdir}/macports/sources.conf $(DESTDIR)${sysconfdir}/macports/sources.conf.mpsaved; \
-		sed 's/darwinports/macports/g' $(DESTDIR)${sysconfdir}/macports/sources.conf > $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp $(DESTDIR)${sysconfdir}/macports/sources.conf; \
-		sed 's/dpupdate\/dports/release\/ports\//g' $(DESTDIR)${sysconfdir}/macports/sources.conf > $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp && \
-			mv -v $(DESTDIR)${sysconfdir}/macports/sources.conf.tmp $(DESTDIR)${sysconfdir}/macports/sources.conf; \
-	}
-
-# Check for existance of a personal configuration file and perform a couple of replacements on it, backing it up first:
-## 1) new default path up to our configuration files (referenced through other variables);
-## 2) new default value for the portdbpath variable;
-## 3) new MacPorts rsync server;
-## 4) new default value for the base tree;
-## 5) new default value for trunk's base sources for users who have it (some do);
-## 6) stray quotes are removed from the value of the rsync_options key in old conf files;
-## 7) useless --delete option is removed from the default rsync flags (--delete is implied by --delete-after);
-## 8) references to the old ports.conf(5) man page are updated to the new macports.conf(5) page;
-	[ ! \( -f "$(DESTDIR)$${HOME}/.macports/ports.conf" -a ! -f ${UPGRADECHECK} \) ] || { \
-		mv -v "$(DESTDIR)$${HOME}/.macports/ports.conf" "$(DESTDIR)$${HOME}/.macports/macports.conf.mpsaved"; \
-		sed 's/etc\/ports/etc\/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf.mpsaved" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/db\/dports/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/darwinports/macports/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/dpupdate1\/base/release\/base/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed '/^rsync_options/s/"\(.*\)"/\1/' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/ --delete / /' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-		sed 's/ ports.conf(5)/ macports.conf(5)/g' "$(DESTDIR)$${HOME}/.macports/macports.conf" > "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" && \
-			mv -v "$(DESTDIR)$${HOME}/.macports/macports.conf.tmp" "$(DESTDIR)$${HOME}/.macports/macports.conf"; \
-	}
-
-# Upgrade success announcement (meaning we're done ;):
-	@[ -f ${UPGRADECHECK} ] || { echo ""; echo "MacPorts installation successfully upgraded from the old DarwinPorts namespace!"; echo ""; \
-		echo "MacPorts rename update done!" > ${UPGRADECHECK} ; }

Modified: branches/new-help-system/base/NEWS
===================================================================
--- branches/new-help-system/base/NEWS	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/NEWS	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,43 @@
+== Overview of changes from MacPorts 1.7.1 to 1.8.0 ==
 
+# For regular users:
+
+*) Compatible with Mac OS X 10.6 Snow Leopard, requires at least 10.4 Tiger
+*) CPU architecture to build for is now configurable
+*) Performance and memory usage improvements
+*) New -y option for dry-run
+*) 'port search' has many new options that make it more flexible
+*) 'port upgrade' now follows the right dependencies when variants change them
+*) 'port info' and 'port variants' indicate selected and default variants;
+   'port variants' also shows conflicts and dependencies between variants
+*) A port can be marked as being replaced by another port; upgrading will
+   perform the replacement
+*) upgrade accepts new options: --force, --enforce-variants, --no-replace
+*) Ports can be marked as conflicting, and conflicts will be detected before
+   the install process starts
+*) Proxy information can now be obtained from System Preferences and from
+   macports.conf
+*) Activating a port will now first deactivate any other version of the same
+   port that is already active
+*) MacPorts can be configured to drop root privileges when not needed
+*) port(1) will exit with an appropriate status code when an error is
+   encountered (use -p to continue despite errors)
+
+# For Portfile writers:
+
+*) New options: replaced_by, conflicts, depends_fetch, depends_extract, license
+*) build_arch variable indicates which architecture should be targeted. Flags
+   used to implement this are configured per-compiler, for example,
+   configure.cc_archflags will be passed to configure.cc in CFLAGS
+*) Dependencies can be satisfied by ports that are installed but not
+   available in the ports tree
+*) Deleting all the contents of an option no longer unsets the option entirely
+*) Using an alternative fetch or extract type now adds appropriate
+   dependencies automatically, e.g. 'use_zip yes' adds a dep on unzip, and
+   'fetch.type svn' adds a dep on subversion
+*) Running phases prior to install should now work reliably when the port is
+   already installed
+
 == Overview of changes from MacPorts 1.6.0 to 1.7.0 ==
 
 # For regular users:

Modified: branches/new-help-system/base/aclocal.m4
===================================================================
--- branches/new-help-system/base/aclocal.m4	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/aclocal.m4	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,6 +1,5 @@
 dnl $Id$
 builtin(include,m4/tcl.m4)
-builtin(include,m4/objc.m4)
 builtin(include,m4/pthread.m4)
 builtin(include,m4/foundation.m4)
 
@@ -288,7 +287,22 @@
 
 	])
 
+# MP_CHECK_OLDLAYOUT
+#---------------------------------------
+AC_DEFUN([MP_CHECK_OLDLAYOUT],[
+	dnl Bail if there is an existing install of DP/MP older than 1.5
 
+	AC_MSG_CHECKING([that any existing MacPorts install can be upgraded])
+
+	eval dpversionfile="${sysconfdir}/ports/dp_version"
+	if test -f $dpversionfile; then
+		AC_MSG_ERROR([Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first.])
+	else
+		AC_MSG_RESULT([yes])
+	fi
+
+	])
+
 # MP_CHECK_NOROOTPRIVILEGES
 #-------------------------------------------------
 AC_DEFUN([MP_CHECK_NOROOTPRIVILEGES],[
@@ -489,16 +503,22 @@
 # MP_UNIVERSAL_OPTIONS
 #---------------------------------------
 AC_DEFUN([MP_UNIVERSAL_OPTIONS],[
+  AC_ARG_WITH(universal-archs,[AS_HELP_STRING([--with-universal-archs="CPU"],[Universal CPU architectures (space separated)])], UNIVERSAL_ARCHS=${withval})
 
-    AC_ARG_WITH(universal-archs,[AS_HELP_STRING([--with-universal-archs="CPU"],[Universal CPU architectures (space separated)])], UNIVERSAL_ARCHS=${withval})
+  if test "x$UNIVERSAL_ARCHS" = "x"; then
+    case "$MACOSX_VERSION" in
+      10.[[0-5]]*)
+        UNIVERSAL_ARCHS="i386 ppc"
+        ;;
+      *)
+        UNIVERSAL_ARCHS="x86_64 i386"
+        ;;
+    esac
+  fi
 
-	if test "x$UNIVERSAL_ARCHS" = "x"; then
-	    UNIVERSAL_ARCHS="ppc i386"
-	fi
-
-    AC_MSG_CHECKING([for Universal CPU architectures])
-    AC_MSG_RESULT([$UNIVERSAL_ARCHS])
-    AC_SUBST(UNIVERSAL_ARCHS)
+  AC_MSG_CHECKING([for Universal CPU architectures])
+  AC_MSG_RESULT([$UNIVERSAL_ARCHS])
+  AC_SUBST(UNIVERSAL_ARCHS)
 ])
 
 # MP_LIB_MD5
@@ -522,28 +542,8 @@
 		AC_DEFINE([HAVE_LIBMD], ,[Define if you have the `md' library (-lmd).])
 		MD5_LIBS="-lmd"]
 	)
-	if test "x$MD5_LIBS" = "x" ; then
-		# If libmd is not found, check for libcrypto from OpenSSL
-		AC_CHECK_LIB([crypto], [MD5_Update],[
-			AC_CHECK_HEADERS([openssl/md5.h],,[
-				case $host_os in
-					darwin*)	
-					AC_MSG_NOTICE([Please install the BSD SDK package from the Xcode Developer Tools CD.])
-						;;
-					*)	
-					AC_MSG_NOTICE([Please install the libmd developer headers for your platform.])
-						;;
-				esac
-				AC_MSG_ERROR([libcrypt was found, but header file openssl/md5.h is missing.])
-			])
-			AC_DEFINE([HAVE_LIBCRYPTO],,[Define if you have the `crypto' library (-lcrypto).])
-			MD5_LIBS="-lcrypto"
-		], [
-			AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
-		])
-	fi
 	if test "x$MD5_LIBS" = "x"; then
-		AC_MSG_ERROR([Neither OpenSSL or libmd were found. A working md5 implementation is required.])
+		AC_MSG_ERROR([Neither CommonCrypto nor libmd were found. A working md5 implementation is required.])
 	fi
 	AC_SUBST([MD5_LIBS])
 ])
@@ -760,14 +760,92 @@
 	fi
 
 	CFLAGS_LIBCURL=$($CURL_CONFIG --cflags)
-	# Due to a bug in dist, --arch flags are improperly supplied by curl-config.
-	# Get rid of them.
-	LDFLAGS_LIBCURL=$($CURL_CONFIG --libs | [sed 's/-arch [A-Za-z0-9_]* //g'])
+	if test "x$curlprefix" = "x"; then
+		# System curl-config emits absurd output for --libs
+		# See rdar://7244457
+		LDFLAGS_LIBCURL="-lcurl"
+	else
+		# Due to a bug in dist, --arch flags are improperly supplied by curl-config.
+		# Get rid of them.
+		LDFLAGS_LIBCURL=$($CURL_CONFIG --libs | [sed 's/-arch [A-Za-z0-9_]* //g'])
+	fi
 
 	AC_SUBST(CFLAGS_LIBCURL)
 	AC_SUBST(LDFLAGS_LIBCURL)
 ])
 
+# MP_SQLITE3_FLAGS
+#	Sets the flags to compile with libsqlite3 and tclsqlite3.
+#
+# Arguments:
+#	None.
+#
+# Requires:
+#   pkgconfig, libsqlite3 in /usr/lib, or user parameters to define the flags.
+#
+# Results:
+#   defines some help strings.
+#   sets CFLAGS_SQLITE3 and LDFLAGS_SQLITE3
+#---------------------------------------
+AC_DEFUN([MP_SQLITE3_FLAGS],[
+    # first sqlite3 itself
+	AC_ARG_WITH(sqlite3prefix,
+		   [  --with-sqlite3prefix       base directory for the sqlite3 install '/usr', '/usr/local',...],
+		   [  sqlite3prefix=$withval ])
+
+	if test "x$sqlite3prefix" = "x"; then
+		AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+		if test "x$PKG_CONFIG" = "x" || ! $PKG_CONFIG --exists sqlite3; then
+		    # assume it's somewhere like /usr that needs no extra flags
+		    AC_CHECK_HEADER(sqlite3.h, [], [AC_MSG_ERROR([cannot find sqlite3 header])])
+            CFLAGS_SQLITE3=""
+		    LDFLAGS_SQLITE3="-lsqlite3"
+        else
+            CFLAGS_SQLITE3=$($PKG_CONFIG --cflags sqlite3)
+            LDFLAGS_SQLITE3=$($PKG_CONFIG --libs sqlite3)
+            # for tclsqlite below
+            mp_sqlite3_dir=$($PKG_CONFIG --variable=prefix sqlite3)
+            if test "x$mp_sqlite3_dir" = "x"; then
+                mp_sqlite3_dir=${mp_sqlite3_dir}/lib/sqlite3
+            fi
+        fi
+	else
+	    CFLAGS_SQLITE3="-I${sqlite3prefix}/include"
+		LDFLAGS_SQLITE3="-L${sqlite3prefix}/lib -lsqlite3"
+	fi
+
+	AC_SUBST(CFLAGS_SQLITE3)
+	AC_SUBST(LDFLAGS_SQLITE3)
+
+	# now the sqlite Tcl bindings
+	AC_ARG_WITH(tcl-sqlite3,
+		AS_HELP_STRING([--with-tcl-sqlite3=DIR],
+			[directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
+		[mp_sqlite3_dir=$withval])
+
+    if test "x$mp_sqlite3_dir" = "x"; then
+        case $host_os in
+            darwin*)
+                mp_sqlite3_dir="/usr/lib/sqlite3"
+                ;;
+            freebsd*)
+                mp_sqlite3_dir="/usr/local/lib/sqlite"
+                ;;
+            *)
+                mp_sqlite3_dir="/usr/share/tcl${TCL_VERSION}/sqlite3"
+                ;;
+        esac
+    fi
+
+	AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
+		[mp_cv_sqlite3_dir=
+		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
+		])
+
+	SQLITE3_TCL_DIR=$mp_cv_sqlite3_dir
+	AC_SUBST(SQLITE3_TCL_DIR)
+])
+
 dnl This macro tests if the compiler supports GCC's
 dnl __attribute__ syntax for unused variables/parameters
 AC_DEFUN([MP_COMPILER_ATTRIBUTE_UNUSED], [
@@ -805,6 +883,7 @@
 		fi
 	done
 	PATH=$newPATH; export PATH
+	AC_SUBST(PATH_CLEANED,$newPATH)
 	prefix=$oldprefix
 ])
 
@@ -856,6 +935,22 @@
 	fi
 ])
 
+dnl This macro tests for GNU patch
+AC_DEFUN([MP_PATCH_GNU_VERSION],[
+	AC_PATH_PROG(PATCH, [patch])
+	AC_PATH_PROG(GNUPATCH, [gpatch])
+	
+	AC_MSG_CHECKING([for GNU (FSF) patch])
+	AS_IF([test -n "$GNUPATCH"], [PATCH_CMD=$GNUPATCH], [PATCH_CMD=$PATCH])
+	[fsf_version=`$PATCH_CMD --version 2>&1 | grep "Free Software Foundation"`]
+	if test -z "$fsf_version" ; then
+		AC_MSG_RESULT([none])
+	else
+		AC_MSG_RESULT([$PATCH_CMD])
+		GNUPATCH="$PATCH_CMD"
+	fi
+])
+
 #------------------------------------------------------------------------
 # MP_CHECK_READLINK_IS_P1003_1A --
 #

Modified: branches/new-help-system/base/config/RELEASE_URL
===================================================================
--- branches/new-help-system/base/config/RELEASE_URL	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/config/RELEASE_URL	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1 +1 @@
-http://svn.macports.org/repository/macports/tags/release_1_7_1/base
+http://svn.macports.org/repository/macports/tags/release_1_8_2/base

Copied: branches/new-help-system/base/config/dp_version (from rev 65586, trunk/base/config/dp_version)
===================================================================
--- branches/new-help-system/base/config/dp_version	                        (rev 0)
+++ branches/new-help-system/base/config/dp_version	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1 @@
+1.710

Modified: branches/new-help-system/base/config/macports_version
===================================================================
--- branches/new-help-system/base/config/macports_version	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/config/macports_version	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1 +1 @@
-1.8.0
+1.8.99

Modified: branches/new-help-system/base/config.guess
===================================================================
--- branches/new-help-system/base/config.guess	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/config.guess	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,10 +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, 2006, 2007, 2008
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2009-04-27'
+timestamp='2009-09-18'
 
 # 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
@@ -27,16 +27,16 @@
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -170,7 +170,7 @@
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
+			| grep -q __ELF__
 		then
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
 		    # Return netbsd for either.  FIX?
@@ -656,7 +656,7 @@
 	    # => hppa64-hp-hpux11.23
 
 	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
+		grep -q __LP64__
 	    then
 		HP_ARCH="hppa2.0w"
 	    else
@@ -822,6 +822,9 @@
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
 	echo i${UNAME_MACHINE}-pc-mks
 	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -851,6 +854,20 @@
     i*86:Minix:*:*)
 	echo ${UNAME_MACHINE}-pc-minix
 	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
     arm*:Linux:*:*)
 	eval $set_cc_for_build
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -873,6 +890,9 @@
     frv:Linux:*:*)
     	echo frv-unknown-linux-gnu
 	exit ;;
+    i*86:Linux:*:*)
+	echo ${UNAME_MACHINE}-pc-linux-gnu
+	exit ;;
     ia64:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
@@ -882,17 +902,17 @@
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    mips:Linux:*:*)
+    mips:Linux:*:* | mips64:Linux:*:*)
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c
 	#undef CPU
-	#undef mips
-	#undef mipsel
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
+	CPU=${UNAME_MACHINE}el
 	#else
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
+	CPU=${UNAME_MACHINE}
 	#else
 	CPU=
 	#endif
@@ -905,55 +925,15 @@
 	    }'`"
 	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
 	;;
-    mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips64
-	#undef mips64el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
     or32:Linux:*:*)
 	echo or32-unknown-linux-gnu
 	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-	exit ;;
     padre:Linux:*:*)
 	echo sparc-unknown-linux-gnu
 	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -962,9 +942,12 @@
 	  *)    echo hppa-unknown-linux-gnu ;;
 	esac
 	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
 	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit ;;
@@ -986,66 +969,6 @@
     xtensa*:Linux:*:*)
     	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
     i*86:DYNIX/ptx:4*:*)
 	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
 	# earlier versions are messed up and put the nodename in both
@@ -1074,7 +997,7 @@
     i*86:syllable:*:*)
 	echo ${UNAME_MACHINE}-pc-syllable
 	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
 	echo i386-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     i*86:*DOS:*:*)
@@ -1182,7 +1105,7 @@
     rs6000:LynxOS:2.*:*)
 	echo rs6000-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
 	echo powerpc-unknown-lynxos${UNAME_RELEASE}
 	exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1275,6 +1198,16 @@
     *:Darwin:*:*)
 	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
 	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
 	    unknown) UNAME_PROCESSOR=powerpc ;;
 	esac
 	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}

Modified: branches/new-help-system/base/config.sub
===================================================================
--- branches/new-help-system/base/config.sub	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/config.sub	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 #   Free Software Foundation, Inc.
 
-timestamp='2009-04-17'
+timestamp='2009-09-25'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@
 
 
 # Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -149,10 +152,13 @@
 	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
 	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
 	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
+	-apple | -axis | -knuth | -cray | -microblaze)
 		os=
 		basic_machine=$1
 		;;
+        -bluegene*)
+	        os=-cnk
+		;;
 	-sim | -cisco | -oki | -wec | -winbond)
 		os=
 		basic_machine=$1
@@ -281,6 +287,7 @@
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
+	| rx \
 	| score \
 	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
@@ -294,7 +301,7 @@
 	| z8k | z80)
 		basic_machine=$basic_machine-unknown
 		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
 		# Motorola 68HC11/12.
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -337,7 +344,7 @@
 	| lm32-* \
 	| m32c-* | m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -365,7 +372,7 @@
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
-	| romp-* | rs6000-* \
+	| romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -467,6 +474,10 @@
 		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
 		os=-linux
 		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
 	c90)
 		basic_machine=c90-cray
 		os=-unicos
@@ -719,6 +730,9 @@
 		basic_machine=ns32k-utek
 		os=-sysv
 		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
 	mingw32)
 		basic_machine=i386-pc
 		os=-mingw32
@@ -1260,7 +1274,7 @@
 	# Each alternative MUST END IN A *, to match a version number.
 	# -sysv* is not here because it comes later, after sysvr4.
 	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
 	      | -kopensolaris* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
@@ -1613,7 +1627,7 @@
 			-sunos*)
 				vendor=sun
 				;;
-			-aix*)
+			-cnk*|-aix*)
 				vendor=ibm
 				;;
 			-beos*)

Modified: branches/new-help-system/base/configure
===================================================================
--- branches/new-help-system/base/configure	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/configure	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,20 +1,24 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for MacPorts 1.8.0.
+# Generated by GNU Autoconf 2.65 for MacPorts 1.8.99.
 #
 # Report bugs to <macports-dev at lists.macosforge.org>.
 #
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -22,23 +26,15 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -46,7 +42,13 @@
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -57,7 +59,7 @@
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -80,14 +82,7 @@
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
 
-
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
 # there to prevent editors from complaining about space-tab.
@@ -96,15 +91,15 @@
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -116,12 +111,16 @@
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -133,330 +132,300 @@
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-
 # CDPATH.
-$as_unset CDPATH
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
-
 if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
 else
-  as_have_required=no
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
 fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
 
-  if test $as_have_required = yes &&	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
 exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  exitcode=1; echo positional parameters were not saved.
 fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  as_have_required=no
 fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
 else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  case $as_dir in
+  as_found=:
+  case $as_dir in #(
 	 /*)
 	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
 	   done;;
        esac
+  as_found=false
 done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
 IFS=$as_save_IFS
 
 
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
 fi
 
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: macports-dev at lists.macosforge.org about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
+  fi
+  exit 1
 fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
 fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
 fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
 
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
 
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
 
-test $exitcode = 0) || { (exit 1); exit 1; }
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
 
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
 
-_ASEOF
-}; then
-  break
-fi
 
-fi
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
 
-      done
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
 
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-	do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-	done
-	export CONFIG_SHELL
-	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
 
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
 else
-  exitcode=1
-  echo as_func_success failed.
+  as_expr=false
 fi
 
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  as_basename=false
 fi
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  as_dirname=false
 fi
 
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell bug-autoconf at gnu.org about your system,
-  echo including any error possibly output before this message.
-  echo This can help us improve future autoconf versions.
-  echo Configuration will now proceed without shell functions.
-}
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
 
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
   sed -n '
     p
     /[$]LINENO/=
@@ -473,8 +442,7 @@
       s/-\n.*//
     ' >$as_me.lineno &&
   chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
@@ -484,29 +452,18 @@
   exit
 }
 
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
@@ -536,7 +493,7 @@
 rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -555,10 +512,10 @@
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -572,9 +529,9 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
-exec 7<&0 </dev/null 6>&1
-
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
@@ -591,14 +548,14 @@
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
 PACKAGE_NAME='MacPorts'
 PACKAGE_TARNAME='macports'
-PACKAGE_VERSION='1.8.0'
-PACKAGE_STRING='MacPorts 1.8.0'
+PACKAGE_VERSION='1.8.99'
+PACKAGE_STRING='MacPorts 1.8.99'
 PACKAGE_BUGREPORT='macports-dev at lists.macosforge.org'
+PACKAGE_URL=''
 
 ac_unique_file="src/pextlib1.0/Pextlib.c"
 # Factoring default headers for most tests.
@@ -641,6 +598,7 @@
 enable_option_checking=no
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
+macports_tcl_dir
 localstatedir_expanded
 MPCONFIGDIR_EXPANDED
 prefix_expanded
@@ -654,9 +612,11 @@
 STLIB_LD
 PATHCONF
 INCLUDES
-SQLITE3_DIR
-SQLITE3_LIBS
 subdirs
+SQLITE3_TCL_DIR
+LDFLAGS_SQLITE3
+CFLAGS_SQLITE3
+PKG_CONFIG
 LDFLAGS_LIBCURL
 CFLAGS_LIBCURL
 CURL_CONFIG
@@ -715,6 +675,7 @@
 MKBOM
 LSBOM
 BZIP2
+GNUPATCH
 GNUMAKE
 GNUTAR
 XCODEBUILD
@@ -730,16 +691,15 @@
 RSYNC
 RMDIR
 PATCH
-NICE
 LIPO
 GZIP
 HG
 GIT
 SVN
 CVS
+BZR
 FILE
 DSCL
-DITTO
 DIFF
 CPIO
 CP
@@ -764,6 +724,7 @@
 XCODE_SELECT
 DEFAULTS
 SW_VERS
+PATH_CLEANED
 MACPORTS_VERSION
 target_os
 target_vendor
@@ -807,6 +768,7 @@
 program_transform_name
 prefix
 exec_prefix
+PACKAGE_URL
 PACKAGE_BUGREPORT
 PACKAGE_STRING
 PACKAGE_VERSION
@@ -835,9 +797,9 @@
 with_tclinclude
 with_tclpackage
 with_curlprefix
-with_included_tclthread
-with_included_sqlite3
+with_sqlite3prefix
 with_tcl_sqlite3
+with_included_tclthread
 with_trace_sdk
 enable_shared
 '
@@ -859,14 +821,14 @@
 TAR
 MAKE
 GNUTAR
+BSDMAKE
 GNUMAKE
 BZIP2
 XAR
 OPEN
 OBJCPP
 CPP'
-ac_subdirs_all='src/thread2.6
-src/sqlite-3.1.3'
+ac_subdirs_all='src/thread2.6'
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -974,8 +936,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1001,8 +962,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid feature name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1206,8 +1166,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1223,8 +1182,7 @@
     ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
     expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
-   { (exit 1); exit 1; }; }
+      as_fn_error "invalid package name: $ac_useropt"
     ac_useropt_orig=$ac_useropt
     ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
     case $ac_user_opts in
@@ -1254,17 +1212,17 @@
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information."
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
@@ -1281,15 +1239,13 @@
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { $as_echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "missing argument to $ac_option"
 fi
 
 if test -n "$ac_unrecognized_opts"; then
   case $enable_option_checking in
     no) ;;
-    fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2
-   { (exit 1); exit 1; }; } ;;
+    fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
     *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
   esac
 fi
@@ -1312,8 +1268,7 @@
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1343,11 +1298,9 @@
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { $as_echo "$as_me: error: working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
@@ -1386,13 +1339,11 @@
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1418,7 +1369,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures MacPorts 1.8.0 to adapt to many kinds of systems.
+\`configure' configures MacPorts 1.8.99 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1484,7 +1435,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of MacPorts 1.8.0:";;
+     short | recursive ) echo "Configuration of MacPorts 1.8.99:";;
    esac
   cat <<\_ACEOF
 
@@ -1524,10 +1475,10 @@
   --with-tclinclude       directory containing the public Tcl header files.
   --with-tclpackage       Tcl package installation directory.
   --with-curlprefix       base directory for the cURL install '/usr', '/usr/local',...
+  --with-sqlite3prefix       base directory for the sqlite3 install '/usr', '/usr/local',...
+  --with-tcl-sqlite3=DIR  directory for Tcl sqlite3 (default /usr/lib/sqlite3)
   --with-included-tclthread
                           install included Thread package.
-  --with-included-sqlite3 build using bundled sqlite3 package
-  --with-tcl-sqlite3=DIR  directory for Tcl sqlite3 (default /usr/lib/sqlite3)
   --with-trace-sdk=SDK    SDK for redirection in trace lib (for example
                           MacOSX10.4u.sdk)
 
@@ -1537,7 +1488,7 @@
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   OBJC        Objective C compiler command
   OBJCFLAGS   Objective C compiler flags
@@ -1549,6 +1500,7 @@
   TAR         path to tar command
   MAKE        path to make command
   GNUTAR      path to gnutar command
+  BSDMAKE     path to bsdmake/pmake command
   GNUMAKE     path to gnumake command
   BZIP2       path to bzip2 command
   XAR         path to xar command
@@ -1622,22 +1574,674 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-MacPorts configure 1.8.0
-generated by GNU Autoconf 2.63
+MacPorts configure 1.8.99
+generated by GNU Autoconf 2.65
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
   exit
 fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_objc_try_compile LINENO
+# -----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_objc_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_objc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_objc_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_objc_try_cpp LINENO
+# -------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_objc_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } >/dev/null && {
+	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_objc_try_cpp
+
+# ac_fn_objc_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ----------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_objc_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_objc_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_objc_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_objc_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( cat <<\_ASBOX
+## ------------------------------------------------ ##
+## Report this to macports-dev at lists.macosforge.org ##
+## ------------------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_objc_check_header_mongrel
+
+# ac_fn_objc_try_run LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_objc_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_objc_try_run
+
+# ac_fn_objc_check_header_compile LINENO HEADER VAR INCLUDES
+# ----------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_objc_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_objc_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_objc_check_header_compile
+
+# ac_fn_objc_try_link LINENO
+# --------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_objc_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_objc_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_objc_try_link
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( cat <<\_ASBOX
+## ------------------------------------------------ ##
+## Report this to macports-dev at lists.macosforge.org ##
+## ------------------------------------------------ ##
+_ASBOX
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR
+# ------------------------------------
+# Tests whether SYMBOL is declared, setting cache variable VAR accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $2 is declared" >&5
+$as_echo_n "checking whether $2 is declared... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $2
+  (void) $2;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_decl
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by MacPorts $as_me 1.8.0, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+It was created by MacPorts $as_me 1.8.99, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
 
@@ -1673,8 +2277,8 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  $as_echo "PATH: $as_dir"
-done
+    $as_echo "PATH: $as_dir"
+  done
 IFS=$as_save_IFS
 
 } >&5
@@ -1711,9 +2315,9 @@
       ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
     2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      as_fn_append ac_configure_args1 " '$ac_arg'"
       if test $ac_must_keep_next = true; then
 	ac_must_keep_next=false # Got value, back to normal.
       else
@@ -1729,13 +2333,13 @@
 	  -* ) ac_must_keep_next=true ;;
 	esac
       fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
+      as_fn_append ac_configure_args " '$ac_arg'"
       ;;
     esac
   done
 done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
@@ -1760,13 +2364,13 @@
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -1838,40 +2442,42 @@
     exit $exit_status
 ' 0
 for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
 rm -f -r conftest* confdefs.h
 
+$as_echo "/* confdefs.h */" > confdefs.h
+
 # Predefined preprocessor variables.
 
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_NAME "$PACKAGE_NAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_VERSION "$PACKAGE_VERSION"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_STRING "$PACKAGE_STRING"
 _ACEOF
 
-
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
 _ACEOF
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
 
+
 # Let the site file select an alternate cache file if it wants to.
 # Prefer an explicitly selected file to automatically selected ones.
 ac_site_file1=NONE
@@ -1888,8 +2494,8 @@
 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
   test "x$ac_site_file" = xNONE && continue
-  if test -r "$ac_site_file"; then
-    { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file"
@@ -1897,10 +2503,10 @@
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
 $as_echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
       [\\/]* | ?:[\\/]* ) . "$cache_file";;
@@ -1908,7 +2514,7 @@
     esac
   fi
 else
-  { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
 $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
@@ -1923,11 +2529,11 @@
   eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,set)
-      { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
       ac_cache_corrupted=: ;;
     ,);;
@@ -1937,17 +2543,17 @@
 	ac_old_val_w=`echo x $ac_old_val`
 	ac_new_val_w=`echo x $ac_new_val`
 	if test "$ac_old_val_w" != "$ac_new_val_w"; then
-	  { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
 	  ac_cache_corrupted=:
 	else
-	  { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
 	  eval $ac_var=\$ac_old_val
 	fi
-	{ $as_echo "$as_me:$LINENO:   former value:  \`$ac_old_val'" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
 $as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
-	{ $as_echo "$as_me:$LINENO:   current value: \`$ac_new_val'" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
 $as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
       fi;;
   esac
@@ -1959,44 +2565,21 @@
     esac
     case " $ac_configure_args " in
       *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
     esac
   fi
 done
 if $ac_cache_corrupted; then
-  { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-  { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2010,24 +2593,16 @@
 
 ac_aux_dir=
 for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
+  for ac_t in install-sh install.sh shtool; do
+    if test -f "$ac_dir/$ac_t"; then
+      ac_aux_dir=$ac_dir
+      ac_install_sh="$ac_aux_dir/$ac_t -c"
+      break 2
+    fi
+  done
 done
 if test -z "$ac_aux_dir"; then
-  { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
 fi
 
 # These three variables are undocumented and unsupported,
@@ -2041,35 +2616,27 @@
 
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
 $as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
+if test "${ac_cv_build+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_build_alias=$build_alias
 test "x$ac_build_alias" = x &&
   ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
 test "x$ac_build_alias" = x &&
-  { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "cannot guess build type; you must specify one" "$LINENO" 5
 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
 $as_echo "$ac_cv_build" >&6; }
 case $ac_cv_build in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical build" "$LINENO" 5;;
 esac
 build=$ac_cv_build
 ac_save_IFS=$IFS; IFS='-'
@@ -2085,28 +2652,24 @@
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
 $as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
+if test "${ac_cv_host+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$host_alias" = x; then
   ac_cv_host=$ac_cv_build
 else
   ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
 $as_echo "$ac_cv_host" >&6; }
 case $ac_cv_host in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical host" "$LINENO" 5;;
 esac
 host=$ac_cv_host
 ac_save_IFS=$IFS; IFS='-'
@@ -2122,28 +2685,24 @@
 case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ $as_echo "$as_me:$LINENO: checking target system type" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
 $as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then
+if test "${ac_cv_target+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test "x$target_alias" = x; then
   ac_cv_target=$ac_cv_host
 else
   ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
-    { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
 $as_echo "$ac_cv_target" >&6; }
 case $ac_cv_target in
 *-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-$as_echo "$as_me: error: invalid value of canonical target" >&2;}
-   { (exit 1); exit 1; }; };;
+*) as_fn_error "invalid value of canonical target" "$LINENO" 5;;
 esac
 target=$ac_cv_target
 ac_save_IFS=$IFS; IFS='-'
@@ -2167,10 +2726,10 @@
   program_prefix=${target_alias}-
 
 # Read in the MacPorts version from the base/config/macports_version file
-{ $as_echo "$as_me:$LINENO: checking MacPorts version" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking MacPorts version" >&5
 $as_echo_n "checking MacPorts version... " >&6; }
-MACPORTS_VERSION=1.8.0
-{ $as_echo "$as_me:$LINENO: result: $MACPORTS_VERSION" >&5
+MACPORTS_VERSION=1.8.99
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACPORTS_VERSION" >&5
 $as_echo "$MACPORTS_VERSION" >&6; }
 
 
@@ -2196,14 +2755,16 @@
 		fi
 	done
 	PATH=$newPATH; export PATH
+	PATH_CLEANED=$newPATH
+
 	prefix=$oldprefix
 
 
 # Extract the first word of "sw_vers", so it can be a program name with args.
 set dummy sw_vers; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SW_VERS+set}" = set; then
+if test "${ac_cv_path_SW_VERS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SW_VERS in
@@ -2216,14 +2777,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SW_VERS="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -2231,19 +2792,19 @@
 fi
 SW_VERS=$ac_cv_path_SW_VERS
 if test -n "$SW_VERS"; then
-  { $as_echo "$as_me:$LINENO: result: $SW_VERS" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SW_VERS" >&5
 $as_echo "$SW_VERS" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "defaults", so it can be a program name with args.
 set dummy defaults; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DEFAULTS+set}" = set; then
+if test "${ac_cv_path_DEFAULTS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DEFAULTS in
@@ -2256,14 +2817,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_DEFAULTS="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -2271,19 +2832,19 @@
 fi
 DEFAULTS=$ac_cv_path_DEFAULTS
 if test -n "$DEFAULTS"; then
-  { $as_echo "$as_me:$LINENO: result: $DEFAULTS" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEFAULTS" >&5
 $as_echo "$DEFAULTS" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "xcode-select", so it can be a program name with args.
 set dummy xcode-select; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XCODE_SELECT+set}" = set; then
+if test "${ac_cv_path_XCODE_SELECT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $XCODE_SELECT in
@@ -2296,14 +2857,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XCODE_SELECT="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -2311,37 +2872,35 @@
 fi
 XCODE_SELECT=$ac_cv_path_XCODE_SELECT
 if test -n "$XCODE_SELECT"; then
-  { $as_echo "$as_me:$LINENO: result: $XCODE_SELECT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODE_SELECT" >&5
 $as_echo "$XCODE_SELECT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 
 if test "x$SW_VERS" != "x"; then
-  { $as_echo "$as_me:$LINENO: checking Mac OS X version" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Mac OS X version" >&5
 $as_echo_n "checking Mac OS X version... " >&6; }
   MACOSX_VERSION=`$SW_VERS -productVersion`
-  { $as_echo "$as_me:$LINENO: result: $MACOSX_VERSION" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACOSX_VERSION" >&5
 $as_echo "$MACOSX_VERSION" >&6; }
 fi
 
 case "$MACOSX_VERSION" in
-  10.0*|10.1*|10.2*)
-    { $as_echo "$as_me:$LINENO: WARNING: This version of Mac OS X is not supported" >&5
-$as_echo "$as_me: WARNING: This version of Mac OS X is not supported" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: Please upgrade at http://store.apple.com/" >&5
-$as_echo "$as_me: WARNING: Please upgrade at http://store.apple.com/" >&2;}
+  10.0*|10.1*|10.2*|10.3*)
+    as_fn_error "This version of Mac OS X is not supported
+                  Please upgrade at http://store.apple.com/" "$LINENO" 5
     ;;
-  10.1.[0-4]|10.2.[0-7]|10.3.[0-8]|10.4.[0-9]|10.4.10|10.5.[0-6])
-    { $as_echo "$as_me:$LINENO: WARNING: This version of Mac OS X is out of date" >&5
+  10.4.[0-9]|10.4.10|10.5.[0-7]|10.6.[0-1])
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Mac OS X is out of date" >&5
 $as_echo "$as_me: WARNING: This version of Mac OS X is out of date" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: Please run Software Update to update it" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please run Software Update to update it" >&5
 $as_echo "$as_me: WARNING: Please run Software Update to update it" >&2;}
     ;;
-  10.3*|10.4*|10.5*)
+  10.4*|10.5*|10.6*)
         ;;
   *)
     ;;
@@ -2349,10 +2908,10 @@
 
 # locate currently selected Xcode path
 if test "x$XCODE_SELECT" != "x"; then
-  { $as_echo "$as_me:$LINENO: checking Xcode location" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Xcode location" >&5
 $as_echo_n "checking Xcode location... " >&6; }
   DEVELOPER_DIR=`$XCODE_SELECT -print-path`
-  { $as_echo "$as_me:$LINENO: result: $DEVELOPER_DIR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVELOPER_DIR" >&5
 $as_echo "$DEVELOPER_DIR" >&6; }
 else
   DEVELOPER_DIR=/Developer
@@ -2361,31 +2920,31 @@
 
 XCODEPLIST=$DEVELOPER_DIR/Applications/Xcode.app/Contents/version.plist
 if test -r "$XCODEPLIST"; then
-  { $as_echo "$as_me:$LINENO: checking Xcode version" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Xcode version" >&5
 $as_echo_n "checking Xcode version... " >&6; }
   if test "x$DEFAULTS" != "x"; then
     XCODE_VERSION=`$DEFAULTS read $DEVELOPER_DIR/Applications/Xcode.app/Contents/version CFBundleShortVersionString`
   else
     XCODE_VERSION=`tr -d '\r\n' < $XCODEPLIST | sed -e 's/.*<key>CFBundleShortVersionString<\/key>.<string>\([0-9.]*\)<\/string>.*/\1/'`
   fi
-  { $as_echo "$as_me:$LINENO: result: $XCODE_VERSION" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODE_VERSION" >&5
 $as_echo "$XCODE_VERSION" >&6; }
 fi
 
 case "$XCODE_VERSION" in
-  1.[0-1]*|2.[0-1]*)
-    { $as_echo "$as_me:$LINENO: WARNING: This version of Xcode Tools is not supported" >&5
+  1.*|2.[0-1]*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Xcode Tools is not supported" >&5
 $as_echo "$as_me: WARNING: This version of Xcode Tools is not supported" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: Please upgrade at http://connect.apple.com/" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please upgrade at http://connect.apple.com/" >&5
 $as_echo "$as_me: WARNING: Please upgrade at http://connect.apple.com/" >&2;}
     ;;
-  1.[2-4]*|2.[2-3]*|3.[0]*)
-    { $as_echo "$as_me:$LINENO: WARNING: This version of Xcode Tools is out of date" >&5
+  2.[2-3]*|3.[0]*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: This version of Xcode Tools is out of date" >&5
 $as_echo "$as_me: WARNING: This version of Xcode Tools is out of date" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: Please consider upgrading as some ports fail compiling" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Please consider upgrading as some ports fail compiling" >&5
 $as_echo "$as_me: WARNING: Please consider upgrading as some ports fail compiling" >&2;}
     ;;
-  1.5*|2.4*|3.*)
+  2.*|3.*)
         ;;
   *)
     ;;
@@ -2400,9 +2959,9 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2413,24 +2972,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2440,9 +2999,9 @@
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2453,24 +3012,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="gcc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2479,7 +3038,7 @@
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -2493,9 +3052,9 @@
           if test -n "$ac_tool_prefix"; then
     # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2506,24 +3065,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2533,9 +3092,9 @@
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2547,18 +3106,18 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
      fi
     ac_cv_prog_CC="cc"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
@@ -2577,10 +3136,10 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2592,9 +3151,9 @@
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
+if test "${ac_cv_prog_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$CC"; then
@@ -2605,24 +3164,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  { $as_echo "$as_me:$LINENO: result: $CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
 $as_echo "$CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2636,9 +3195,9 @@
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_CC"; then
@@ -2649,24 +3208,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
 $as_echo "$ac_ct_CC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -2679,7 +3238,7 @@
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -2690,57 +3249,37 @@
 fi
 
 
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "no acceptable C compiler found in \$PATH
+See \`config.log' for more details." "$LINENO" 5; }
 
 # Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
 set X $ac_compile
 ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -2756,8 +3295,8 @@
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
@@ -2773,17 +3312,17 @@
 done
 rm -f $ac_rmfiles
 
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -2800,7 +3339,7 @@
 	# certainly right.
 	break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
 	then :; else
 	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	fi
@@ -2819,84 +3358,42 @@
 else
   ac_file=''
 fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
-  $as_echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }; }
+{ as_fn_set_status 77
+as_fn_error "C compiler cannot create executables
+See \`config.log' for more details." "$LINENO" 5; }; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
 rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
 $as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
+if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -2911,32 +3408,83 @@
   esac
 done
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." "$LINENO" 5; }
 fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
 $as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
+if test "${ac_cv_objext+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -2948,17 +3496,17 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_compile") 2>&5
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   for ac_file in conftest.o conftest.obj conftest.*; do
   test -f "$ac_file" || continue;
   case $ac_file in
@@ -2971,31 +3519,23 @@
   $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." "$LINENO" 5; }
 fi
-
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
 $as_echo "$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3009,37 +3549,16 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
 $as_echo "$ac_cv_c_compiler_gnu" >&6; }
 if test $ac_compiler_gnu = yes; then
   GCC=yes
@@ -3048,20 +3567,16 @@
 fi
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
 $as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
+if test "${ac_cv_prog_cc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_save_c_werror_flag=$ac_c_werror_flag
    ac_c_werror_flag=yes
    ac_cv_prog_cc_g=no
    CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3072,35 +3587,11 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3111,36 +3602,12 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
 
-	ac_c_werror_flag=$ac_save_c_werror_flag
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
 	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3151,42 +3618,17 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_g=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    ac_c_werror_flag=$ac_save_c_werror_flag
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
 $as_echo "$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
@@ -3203,18 +3645,14 @@
     CFLAGS=
   fi
 fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
@@ -3271,32 +3709,9 @@
 	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+  if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_prog_cc_c89=$ac_arg
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext
   test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
@@ -3307,17 +3722,19 @@
 # AC_CACHE_VAL
 case "x$ac_cv_prog_cc_c89" in
   x)
-    { $as_echo "$as_me:$LINENO: result: none needed" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
 $as_echo "none needed" >&6; } ;;
   xno)
-    { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
 $as_echo "unsupported" >&6; } ;;
   *)
     CC="$CC $ac_cv_prog_cc_c89"
-    { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
 esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
+fi
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -3331,13 +3748,13 @@
 ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_objc_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in $CCC gcc cc objc
+  for ac_prog in gcc objcc objc cc CC
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_OBJC+set}" = set; then
+if test "${ac_cv_prog_OBJC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$OBJC"; then
@@ -3348,24 +3765,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_OBJC="$ac_tool_prefix$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 OBJC=$ac_cv_prog_OBJC
 if test -n "$OBJC"; then
-  { $as_echo "$as_me:$LINENO: result: $OBJC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJC" >&5
 $as_echo "$OBJC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3375,13 +3792,13 @@
 fi
 if test -z "$OBJC"; then
   ac_ct_OBJC=$OBJC
-  for ac_prog in $CCC gcc cc objc
+  for ac_prog in gcc objcc objc cc CC
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then
+if test "${ac_cv_prog_ac_ct_OBJC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_OBJC"; then
@@ -3392,24 +3809,24 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_OBJC="$ac_prog"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_OBJC=$ac_cv_prog_ac_ct_OBJC
 if test -n "$ac_ct_OBJC"; then
-  { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJC" >&5
 $as_echo "$ac_ct_OBJC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -3422,7 +3839,7 @@
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
@@ -3430,37 +3847,37 @@
   fi
 fi
 
-
 # Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for Objective C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for Objective C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU Objective C compiler" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU Objective C compiler" >&5
 $as_echo_n "checking whether we are using the GNU Objective C compiler... " >&6; }
-if test "${ac_cv_objc_compiler_gnu+set}" = set; then
+if test "${ac_cv_objc_compiler_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3474,52 +3891,34 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_objc_try_compile "$LINENO"; then :
   ac_compiler_gnu=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_compiler_gnu=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_objc_compiler_gnu=$ac_compiler_gnu
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objc_compiler_gnu" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objc_compiler_gnu" >&5
 $as_echo "$ac_cv_objc_compiler_gnu" >&6; }
-GOBJC=`test $ac_compiler_gnu = yes && echo yes`
+if test $ac_compiler_gnu = yes; then
+  GOBJC=yes
+else
+  GOBJC=
+fi
 ac_test_OBJCFLAGS=${OBJCFLAGS+set}
 ac_save_OBJCFLAGS=$OBJCFLAGS
-OBJCFLAGS="-g"
-{ $as_echo "$as_me:$LINENO: checking whether $OBJC accepts -g" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $OBJC accepts -g" >&5
 $as_echo_n "checking whether $OBJC accepts -g... " >&6; }
-if test "${ac_cv_prog_objc_g+set}" = set; then
+if test "${ac_cv_prog_objc_g+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  ac_save_objc_werror_flag=$ac_objc_werror_flag
+   ac_objc_werror_flag=yes
+   ac_cv_prog_objc_g=no
+   OBJCFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3530,35 +3929,48 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_objc_try_compile "$LINENO"; then :
   ac_cv_prog_objc_g=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  OBJCFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-	ac_cv_prog_objc_g=no
-fi
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_objc_try_compile "$LINENO"; then :
+
+else
+  ac_objc_werror_flag=$ac_save_objc_werror_flag
+	 OBJCFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_objc_try_compile "$LINENO"; then :
+  ac_cv_prog_objc_g=yes
+fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_objc_g" >&5
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_objc_werror_flag=$ac_save_objc_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_objc_g" >&5
 $as_echo "$ac_cv_prog_objc_g" >&6; }
 if test "$ac_test_OBJCFLAGS" = set; then
   OBJCFLAGS=$ac_save_OBJCFLAGS
@@ -3595,10 +4007,10 @@
 # OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
 # Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
 $as_echo_n "checking for a BSD-compatible install... " >&6; }
 if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
+if test "${ac_cv_path_install+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3606,11 +4018,11 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -3647,7 +4059,7 @@
     ;;
 esac
 
-done
+  done
 IFS=$as_save_IFS
 
 rm -rf conftest.one conftest.two conftest.dir
@@ -3663,7 +4075,7 @@
     INSTALL=$ac_install_sh
   fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
 $as_echo "$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
@@ -3674,11 +4086,11 @@
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
 set x ${MAKE-make}
 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
   cat >conftest.make <<\_ACEOF
@@ -3696,31 +4108,31 @@
 rm -f conftest.make
 fi
 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
   SET_MAKE=
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
-{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
 $as_echo "no, using $LN_S" >&6; }
 fi
 
 # Extract the first word of "mtree", so it can be a program name with args.
 set dummy mtree; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MTREE+set}" = set; then
+if test "${ac_cv_path_MTREE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MTREE in
@@ -3734,14 +4146,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MTREE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -3749,19 +4161,19 @@
 fi
 MTREE=$ac_cv_path_MTREE
 if test -n "$MTREE"; then
-  { $as_echo "$as_me:$LINENO: result: $MTREE" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MTREE" >&5
 $as_echo "$MTREE" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "chown", so it can be a program name with args.
 set dummy chown; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CHOWN+set}" = set; then
+if test "${ac_cv_path_CHOWN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CHOWN in
@@ -3775,14 +4187,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CHOWN="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -3790,19 +4202,19 @@
 fi
 CHOWN=$ac_cv_path_CHOWN
 if test -n "$CHOWN"; then
-  { $as_echo "$as_me:$LINENO: result: $CHOWN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHOWN" >&5
 $as_echo "$CHOWN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CP+set}" = set; then
+if test "${ac_cv_path_CP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CP in
@@ -3815,14 +4227,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -3830,19 +4242,19 @@
 fi
 CP=$ac_cv_path_CP
 if test -n "$CP"; then
-  { $as_echo "$as_me:$LINENO: result: $CP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CP" >&5
 $as_echo "$CP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "cpio", so it can be a program name with args.
 set dummy cpio; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CPIO+set}" = set; then
+if test "${ac_cv_path_CPIO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CPIO in
@@ -3855,14 +4267,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CPIO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -3870,19 +4282,19 @@
 fi
 CPIO=$ac_cv_path_CPIO
 if test -n "$CPIO"; then
-  { $as_echo "$as_me:$LINENO: result: $CPIO" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPIO" >&5
 $as_echo "$CPIO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "diff", so it can be a program name with args.
 set dummy diff; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DIFF+set}" = set; then
+if test "${ac_cv_path_DIFF+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $DIFF in
@@ -3895,14 +4307,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_DIFF="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -3910,24 +4322,24 @@
 fi
 DIFF=$ac_cv_path_DIFF
 if test -n "$DIFF"; then
-  { $as_echo "$as_me:$LINENO: result: $DIFF" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DIFF" >&5
 $as_echo "$DIFF" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "ditto", so it can be a program name with args.
-set dummy ditto; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+# Extract the first word of "dscl", so it can be a program name with args.
+set dummy dscl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DITTO+set}" = set; then
+if test "${ac_cv_path_DSCL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $DITTO in
+  case $DSCL in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_DITTO="$DITTO" # Let the user override the test with a path.
+  ac_cv_path_DSCL="$DSCL" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3935,39 +4347,39 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_DITTO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_path_DSCL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
 esac
 fi
-DITTO=$ac_cv_path_DITTO
-if test -n "$DITTO"; then
-  { $as_echo "$as_me:$LINENO: result: $DITTO" >&5
-$as_echo "$DITTO" >&6; }
+DSCL=$ac_cv_path_DSCL
+if test -n "$DSCL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSCL" >&5
+$as_echo "$DSCL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "dscl", so it can be a program name with args.
-set dummy dscl; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+# Extract the first word of "file", so it can be a program name with args.
+set dummy file; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_DSCL+set}" = set; then
+if test "${ac_cv_path_FILE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $DSCL in
+  case $FILE in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_DSCL="$DSCL" # Let the user override the test with a path.
+  ac_cv_path_FILE="$FILE" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3975,39 +4387,39 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_DSCL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_path_FILE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
 esac
 fi
-DSCL=$ac_cv_path_DSCL
-if test -n "$DSCL"; then
-  { $as_echo "$as_me:$LINENO: result: $DSCL" >&5
-$as_echo "$DSCL" >&6; }
+FILE=$ac_cv_path_FILE
+if test -n "$FILE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FILE" >&5
+$as_echo "$FILE" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "file", so it can be a program name with args.
-set dummy file; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+# Extract the first word of "bzr", so it can be a program name with args.
+set dummy bzr; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_FILE+set}" = set; then
+if test "${ac_cv_path_BZR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $FILE in
+  case $BZR in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_FILE="$FILE" # Let the user override the test with a path.
+  ac_cv_path_BZR="$BZR" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -4015,34 +4427,34 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_FILE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    ac_cv_path_BZR="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
 esac
 fi
-FILE=$ac_cv_path_FILE
-if test -n "$FILE"; then
-  { $as_echo "$as_me:$LINENO: result: $FILE" >&5
-$as_echo "$FILE" >&6; }
+BZR=$ac_cv_path_BZR
+if test -n "$BZR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZR" >&5
+$as_echo "$BZR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "cvs", so it can be a program name with args.
 set dummy cvs; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CVS+set}" = set; then
+if test "${ac_cv_path_CVS+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CVS in
@@ -4055,14 +4467,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CVS="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4070,19 +4482,19 @@
 fi
 CVS=$ac_cv_path_CVS
 if test -n "$CVS"; then
-  { $as_echo "$as_me:$LINENO: result: $CVS" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CVS" >&5
 $as_echo "$CVS" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "svn", so it can be a program name with args.
 set dummy svn; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SVN+set}" = set; then
+if test "${ac_cv_path_SVN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SVN in
@@ -4095,14 +4507,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SVN="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4110,19 +4522,19 @@
 fi
 SVN=$ac_cv_path_SVN
 if test -n "$SVN"; then
-  { $as_echo "$as_me:$LINENO: result: $SVN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SVN" >&5
 $as_echo "$SVN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "git", so it can be a program name with args.
 set dummy git; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GIT+set}" = set; then
+if test "${ac_cv_path_GIT+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GIT in
@@ -4135,14 +4547,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GIT="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4150,19 +4562,19 @@
 fi
 GIT=$ac_cv_path_GIT
 if test -n "$GIT"; then
-  { $as_echo "$as_me:$LINENO: result: $GIT" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GIT" >&5
 $as_echo "$GIT" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "hg", so it can be a program name with args.
 set dummy hg; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HG+set}" = set; then
+if test "${ac_cv_path_HG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $HG in
@@ -4175,14 +4587,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_HG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4190,19 +4602,19 @@
 fi
 HG=$ac_cv_path_HG
 if test -n "$HG"; then
-  { $as_echo "$as_me:$LINENO: result: $HG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HG" >&5
 $as_echo "$HG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "gzip", so it can be a program name with args.
 set dummy gzip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GZIP+set}" = set; then
+if test "${ac_cv_path_GZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GZIP in
@@ -4215,14 +4627,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GZIP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4230,19 +4642,19 @@
 fi
 GZIP=$ac_cv_path_GZIP
 if test -n "$GZIP"; then
-  { $as_echo "$as_me:$LINENO: result: $GZIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP" >&5
 $as_echo "$GZIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "lipo", so it can be a program name with args.
 set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LIPO+set}" = set; then
+if test "${ac_cv_path_LIPO+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LIPO in
@@ -4255,14 +4667,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LIPO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4270,59 +4682,19 @@
 fi
 LIPO=$ac_cv_path_LIPO
 if test -n "$LIPO"; then
-  { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
 $as_echo "$LIPO" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "nice", so it can be a program name with args.
-set dummy nice; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_NICE+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  case $NICE in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_NICE="$NICE" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_NICE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-  ;;
-esac
-fi
-NICE=$ac_cv_path_NICE
-if test -n "$NICE"; then
-  { $as_echo "$as_me:$LINENO: result: $NICE" >&5
-$as_echo "$NICE" >&6; }
-else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
 # Extract the first word of "patch", so it can be a program name with args.
 set dummy patch; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PATCH+set}" = set; then
+if test "${ac_cv_path_PATCH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PATCH in
@@ -4335,14 +4707,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PATCH="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4350,19 +4722,19 @@
 fi
 PATCH=$ac_cv_path_PATCH
 if test -n "$PATCH"; then
-  { $as_echo "$as_me:$LINENO: result: $PATCH" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH" >&5
 $as_echo "$PATCH" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "rmdir", so it can be a program name with args.
 set dummy rmdir; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RMDIR+set}" = set; then
+if test "${ac_cv_path_RMDIR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $RMDIR in
@@ -4375,14 +4747,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RMDIR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4390,19 +4762,19 @@
 fi
 RMDIR=$ac_cv_path_RMDIR
 if test -n "$RMDIR"; then
-  { $as_echo "$as_me:$LINENO: result: $RMDIR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RMDIR" >&5
 $as_echo "$RMDIR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "rsync", so it can be a program name with args.
 set dummy rsync; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_RSYNC+set}" = set; then
+if test "${ac_cv_path_RSYNC+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $RSYNC in
@@ -4415,14 +4787,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RSYNC="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4430,19 +4802,19 @@
 fi
 RSYNC=$ac_cv_path_RSYNC
 if test -n "$RSYNC"; then
-  { $as_echo "$as_me:$LINENO: result: $RSYNC" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RSYNC" >&5
 $as_echo "$RSYNC" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+if test "${ac_cv_path_SED+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SED in
@@ -4455,14 +4827,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4470,19 +4842,19 @@
 fi
 SED=$ac_cv_path_SED
 if test -n "$SED"; then
-  { $as_echo "$as_me:$LINENO: result: $SED" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
 $as_echo "$SED" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAR+set}" = set; then
+if test "${ac_cv_path_TAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAR in
@@ -4495,14 +4867,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4510,19 +4882,19 @@
 fi
 TAR=$ac_cv_path_TAR
 if test -n "$TAR"; then
-  { $as_echo "$as_me:$LINENO: result: $TAR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
 $as_echo "$TAR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "unzip", so it can be a program name with args.
 set dummy unzip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_UNZIP+set}" = set; then
+if test "${ac_cv_path_UNZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $UNZIP in
@@ -4535,14 +4907,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_UNZIP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4550,19 +4922,19 @@
 fi
 UNZIP=$ac_cv_path_UNZIP
 if test -n "$UNZIP"; then
-  { $as_echo "$as_me:$LINENO: result: $UNZIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNZIP" >&5
 $as_echo "$UNZIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "zip", so it can be a program name with args.
 set dummy zip; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ZIP+set}" = set; then
+if test "${ac_cv_path_ZIP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $ZIP in
@@ -4575,14 +4947,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4590,19 +4962,21 @@
 fi
 ZIP=$ac_cv_path_ZIP
 if test -n "$ZIP"; then
-  { $as_echo "$as_me:$LINENO: result: $ZIP" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5
 $as_echo "$ZIP" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "bsdmake", so it can be a program name with args.
-set dummy bsdmake; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+for ac_prog in bsdmake pmake
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BSDMAKE+set}" = set; then
+if test "${ac_cv_path_BSDMAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BSDMAKE in
@@ -4615,14 +4989,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_BSDMAKE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4630,19 +5004,22 @@
 fi
 BSDMAKE=$ac_cv_path_BSDMAKE
 if test -n "$BSDMAKE"; then
-  { $as_echo "$as_me:$LINENO: result: $BSDMAKE" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BSDMAKE" >&5
 $as_echo "$BSDMAKE" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+  test -n "$BSDMAKE" && break
+done
+
 # Extract the first word of "make", so it can be a program name with args.
 set dummy make; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MAKE+set}" = set; then
+if test "${ac_cv_path_MAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MAKE in
@@ -4655,14 +5032,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MAKE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4670,19 +5047,19 @@
 fi
 MAKE=$ac_cv_path_MAKE
 if test -n "$MAKE"; then
-  { $as_echo "$as_me:$LINENO: result: $MAKE" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAKE" >&5
 $as_echo "$MAKE" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "hdiutil", so it can be a program name with args.
 set dummy hdiutil; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_HDIUTIL+set}" = set; then
+if test "${ac_cv_path_HDIUTIL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $HDIUTIL in
@@ -4695,14 +5072,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_HDIUTIL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4710,19 +5087,19 @@
 fi
 HDIUTIL=$ac_cv_path_HDIUTIL
 if test -n "$HDIUTIL"; then
-  { $as_echo "$as_me:$LINENO: result: $HDIUTIL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HDIUTIL" >&5
 $as_echo "$HDIUTIL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "launchd", so it can be a program name with args.
 set dummy launchd; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_HAVE_LAUNCHD+set}" = set; then
+if test "${ac_cv_prog_HAVE_LAUNCHD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$HAVE_LAUNCHD"; then
@@ -4733,33 +5110,33 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_HAVE_LAUNCHD="yes"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 HAVE_LAUNCHD=$ac_cv_prog_HAVE_LAUNCHD
 if test -n "$HAVE_LAUNCHD"; then
-  { $as_echo "$as_me:$LINENO: result: $HAVE_LAUNCHD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_LAUNCHD" >&5
 $as_echo "$HAVE_LAUNCHD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "launchctl", so it can be a program name with args.
 set dummy launchctl; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LAUNCHCTL+set}" = set; then
+if test "${ac_cv_path_LAUNCHCTL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LAUNCHCTL in
@@ -4772,14 +5149,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LAUNCHCTL="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4787,19 +5164,19 @@
 fi
 LAUNCHCTL=$ac_cv_path_LAUNCHCTL
 if test -n "$LAUNCHCTL"; then
-  { $as_echo "$as_me:$LINENO: result: $LAUNCHCTL" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LAUNCHCTL" >&5
 $as_echo "$LAUNCHCTL" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "xcodebuild", so it can be a program name with args.
 set dummy xcodebuild; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XCODEBUILD+set}" = set; then
+if test "${ac_cv_path_XCODEBUILD+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $XCODEBUILD in
@@ -4812,14 +5189,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XCODEBUILD="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4827,10 +5204,10 @@
 fi
 XCODEBUILD=$ac_cv_path_XCODEBUILD
 if test -n "$XCODEBUILD"; then
-  { $as_echo "$as_me:$LINENO: result: $XCODEBUILD" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XCODEBUILD" >&5
 $as_echo "$XCODEBUILD" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4839,9 +5216,9 @@
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GNUTAR+set}" = set; then
+if test "${ac_cv_path_GNUTAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GNUTAR in
@@ -4855,14 +5232,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GNUTAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4870,10 +5247,10 @@
 fi
 GNUTAR=$ac_cv_path_GNUTAR
 if test -n "$GNUTAR"; then
-  { $as_echo "$as_me:$LINENO: result: $GNUTAR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNUTAR" >&5
 $as_echo "$GNUTAR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4885,9 +5262,9 @@
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GNUMAKE+set}" = set; then
+if test "${ac_cv_path_GNUMAKE+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GNUMAKE in
@@ -4901,14 +5278,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GNUMAKE="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4916,10 +5293,10 @@
 fi
 GNUMAKE=$ac_cv_path_GNUMAKE
 if test -n "$GNUMAKE"; then
-  { $as_echo "$as_me:$LINENO: result: $GNUMAKE" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNUMAKE" >&5
 $as_echo "$GNUMAKE" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -4927,11 +5304,57 @@
   test -n "$GNUMAKE" && break
 done
 
+for ac_prog in gnupatch gpatch
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GNUPATCH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GNUPATCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GNUPATCH="$GNUPATCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="$PATH:/usr/local/bin"
+for as_dir in $as_dummy
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GNUPATCH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+GNUPATCH=$ac_cv_path_GNUPATCH
+if test -n "$GNUPATCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNUPATCH" >&5
+$as_echo "$GNUPATCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$GNUPATCH" && break
+done
+
 # Extract the first word of "bzip2", so it can be a program name with args.
 set dummy bzip2; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_BZIP2+set}" = set; then
+if test "${ac_cv_path_BZIP2+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $BZIP2 in
@@ -4944,14 +5367,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_BZIP2="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4959,19 +5382,19 @@
 fi
 BZIP2=$ac_cv_path_BZIP2
 if test -n "$BZIP2"; then
-  { $as_echo "$as_me:$LINENO: result: $BZIP2" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BZIP2" >&5
 $as_echo "$BZIP2" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "lsbom", so it can be a program name with args.
 set dummy lsbom; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_LSBOM+set}" = set; then
+if test "${ac_cv_path_LSBOM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $LSBOM in
@@ -4984,14 +5407,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_LSBOM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -4999,19 +5422,19 @@
 fi
 LSBOM=$ac_cv_path_LSBOM
 if test -n "$LSBOM"; then
-  { $as_echo "$as_me:$LINENO: result: $LSBOM" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LSBOM" >&5
 $as_echo "$LSBOM" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "mkbom", so it can be a program name with args.
 set dummy mkbom; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MKBOM+set}" = set; then
+if test "${ac_cv_path_MKBOM+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $MKBOM in
@@ -5024,14 +5447,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MKBOM="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5039,19 +5462,19 @@
 fi
 MKBOM=$ac_cv_path_MKBOM
 if test -n "$MKBOM"; then
-  { $as_echo "$as_me:$LINENO: result: $MKBOM" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKBOM" >&5
 $as_echo "$MKBOM" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "pax", so it can be a program name with args.
 set dummy pax; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PAX+set}" = set; then
+if test "${ac_cv_path_PAX+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $PAX in
@@ -5064,14 +5487,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PAX="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5079,19 +5502,19 @@
 fi
 PAX=$ac_cv_path_PAX
 if test -n "$PAX"; then
-  { $as_echo "$as_me:$LINENO: result: $PAX" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAX" >&5
 $as_echo "$PAX" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "xar", so it can be a program name with args.
 set dummy xar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XAR+set}" = set; then
+if test "${ac_cv_path_XAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $XAR in
@@ -5104,14 +5527,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_XAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5119,19 +5542,19 @@
 fi
 XAR=$ac_cv_path_XAR
 if test -n "$XAR"; then
-  { $as_echo "$as_me:$LINENO: result: $XAR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XAR" >&5
 $as_echo "$XAR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 # Extract the first word of "open", so it can be a program name with args.
 set dummy open; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_OPEN+set}" = set; then
+if test "${ac_cv_path_OPEN+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $OPEN in
@@ -5144,14 +5567,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_OPEN="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5159,10 +5582,10 @@
 fi
 OPEN=$ac_cv_path_OPEN
 if test -n "$OPEN"; then
-  { $as_echo "$as_me:$LINENO: result: $OPEN" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OPEN" >&5
 $as_echo "$OPEN" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5183,11 +5606,12 @@
 
 
 
+
 	# Extract the first word of "sed", so it can be a program name with args.
 set dummy sed; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_SED+set}" = set; then
+if test "${ac_cv_path_SED+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $SED in
@@ -5200,14 +5624,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5215,40 +5639,38 @@
 fi
 SED=$ac_cv_path_SED
 if test -n "$SED"; then
-  { $as_echo "$as_me:$LINENO: result: $SED" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
 $as_echo "$SED" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 
 	if test "x$SED" = "x"; then
-		{ { $as_echo "$as_me:$LINENO: error: cannot find sed. Is sed installed?" >&5
-$as_echo "$as_me: error: cannot find sed. Is sed installed?" >&2;}
-   { (exit 1); exit 1; }; }
+		as_fn_error "cannot find sed. Is sed installed?" "$LINENO" 5
 	fi
 
-	{ $as_echo "$as_me:$LINENO: checking which sed flag to use for extended regexp" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which sed flag to use for extended regexp" >&5
 $as_echo_n "checking which sed flag to use for extended regexp... " >&6; }
 	any_sed_flag=`echo foo | $SED    -e s/foo+/OK/ 2>&1 | grep OK`
 	bsd_sed_flag=`echo foo | $SED -E -e s/foo+/OK/ 2>&1 | grep OK`
 	gnu_sed_flag=`echo foo | $SED -r -e s/foo+/OK/ 2>&1 | grep OK`
 	if test "x$any_sed_flag" = "xOK" ; then
-		{ $as_echo "$as_me:$LINENO: result: none" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
 $as_echo "none" >&6; }
 		SED_EXT=
 	elif test "x$bsd_sed_flag" = "xOK" ; then
-		{ $as_echo "$as_me:$LINENO: result: -E (BSD)" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: -E (BSD)" >&5
 $as_echo "-E (BSD)" >&6; }
 		SED_EXT=-E
 	elif test "x$gnu_sed_flag" = "xOK" ; then
-		{ $as_echo "$as_me:$LINENO: result: -r (GNU)" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: -r (GNU)" >&5
 $as_echo "-r (GNU)" >&6; }
 		SED_EXT=-r
 	else
-		{ $as_echo "$as_me:$LINENO: result: not available" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not available" >&5
 $as_echo "not available" >&6; }
 		SED_EXT='N/A'
 	fi
@@ -5257,9 +5679,9 @@
 
 	# Extract the first word of "tar", so it can be a program name with args.
 set dummy tar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TAR+set}" = set; then
+if test "${ac_cv_path_TAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TAR in
@@ -5272,14 +5694,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_TAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5287,19 +5709,19 @@
 fi
 TAR=$ac_cv_path_TAR
 if test -n "$TAR"; then
-  { $as_echo "$as_me:$LINENO: result: $TAR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR" >&5
 $as_echo "$TAR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 	# Extract the first word of "gnutar", so it can be a program name with args.
 set dummy gnutar; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GNUTAR+set}" = set; then
+if test "${ac_cv_path_GNUTAR+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $GNUTAR in
@@ -5312,14 +5734,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_GNUTAR="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -5327,40 +5749,138 @@
 fi
 GNUTAR=$ac_cv_path_GNUTAR
 if test -n "$GNUTAR"; then
-  { $as_echo "$as_me:$LINENO: result: $GNUTAR" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNUTAR" >&5
 $as_echo "$GNUTAR" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
 
-	{ $as_echo "$as_me:$LINENO: checking for which tar variant to use" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for which tar variant to use" >&5
 $as_echo_n "checking for which tar variant to use... " >&6; }
-	if test -n "$GNUTAR"; then
+	if test -n "$GNUTAR"; then :
   TAR_CMD=$GNUTAR
 else
   TAR_CMD=$TAR
 fi
-
-	{ $as_echo "$as_me:$LINENO: result: $TAR_CMD" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $TAR_CMD" >&5
 $as_echo "$TAR_CMD" >&6; }
 
 
-	{ $as_echo "$as_me:$LINENO: checking for $TAR_CMD --no-same-owner support" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $TAR_CMD --no-same-owner support" >&5
 $as_echo_n "checking for $TAR_CMD --no-same-owner support... " >&6; }
 	no_same_owner_support=`$TAR_CMD --help 2>&1 | grep no-same-owner`
 	if test -z "$no_same_owner_support" ; then
-		{ $as_echo "$as_me:$LINENO: result: no" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 	else
-		{ $as_echo "$as_me:$LINENO: result: yes" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 		TAR_CMD="$TAR_CMD --no-same-owner"
 	fi
 
 
+	# Extract the first word of "patch", so it can be a program name with args.
+set dummy patch; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PATCH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PATCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PATCH="$PATCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PATCH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+PATCH=$ac_cv_path_PATCH
+if test -n "$PATCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH" >&5
+$as_echo "$PATCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+	# Extract the first word of "gpatch", so it can be a program name with args.
+set dummy gpatch; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_GNUPATCH+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $GNUPATCH in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GNUPATCH="$GNUPATCH" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_GNUPATCH="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+GNUPATCH=$ac_cv_path_GNUPATCH
+if test -n "$GNUPATCH"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GNUPATCH" >&5
+$as_echo "$GNUPATCH" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU (FSF) patch" >&5
+$as_echo_n "checking for GNU (FSF) patch... " >&6; }
+	if test -n "$GNUPATCH"; then :
+  PATCH_CMD=$GNUPATCH
+else
+  PATCH_CMD=$PATCH
+fi
+	fsf_version=`$PATCH_CMD --version 2>&1 | grep "Free Software Foundation"`
+	if test -z "$fsf_version" ; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PATCH_CMD" >&5
+$as_echo "$PATCH_CMD" >&6; }
+		GNUPATCH="$PATCH_CMD"
+	fi
+
+
 # Quiche eaters options.
 if test x$GCC = xyes; then
 	CFLAGS_QUICHEEATERS='-W -Wall -pedantic'
@@ -5369,7 +5889,7 @@
 
 
 	# Check whether --enable-werror was given.
-if test "${enable_werror+set}" = set; then
+if test "${enable_werror+set}" = set; then :
   enableval=$enable_werror; enable_werror=${enableval}
 else
   enable_werror=no
@@ -5385,70 +5905,37 @@
 
 
 
-	{ $as_echo "$as_me:$LINENO: checking how to mark unused variables" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to mark unused variables" >&5
 $as_echo_n "checking how to mark unused variables... " >&6; }
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 int a __attribute__ ((unused));
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
 
-cat >>confdefs.h <<\_ACEOF
-#define UNUSED __attribute__((unused))
-_ACEOF
+$as_echo "#define UNUSED __attribute__((unused))" >>confdefs.h
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  $as_echo "#define UNUSED /**/" >>confdefs.h
 
-	cat >>confdefs.h <<\_ACEOF
-#define UNUSED /**/
-_ACEOF
-
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-	{ $as_echo "$as_me:$LINENO: result: " >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
 $as_echo "" >&6; }
 
 
 
-	{ $as_echo "$as_me:$LINENO: checking for gcc symbol visibility attribute" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc symbol visibility attribute" >&5
 $as_echo_n "checking for gcc symbol visibility attribute... " >&6; }
-	if test "${mp_cv_attribute_mp_private+set}" = set; then
+	if test "${mp_cv_attribute_mp_private+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 				#if defined(__GNUC__) && defined(__APPLE__) && __GNUC__ < 4
 				# error Darwin does not support the visibility attribute with gcc releases prior to 4
 				#elif defined(WIN32) && __GNUC__ < 4
@@ -5458,42 +5945,21 @@
 
 
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
 
 			mp_cv_attribute_mp_private="__attribute__((visibility(\"hidden\")))"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 			mp_cv_attribute_mp_private="no"
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: $mp_cv_attribute_mp_private" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mp_cv_attribute_mp_private" >&5
 $as_echo "$mp_cv_attribute_mp_private" >&6; }
 
 	if test x"$mp_cv_attribute_mp_private" = "xno"; then
@@ -5532,13 +5998,9 @@
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
         save_LIBS="$LIBS"
         LIBS="$PTHREAD_LIBS $LIBS"
-        { $as_echo "$as_me:$LINENO: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS" >&5
 $as_echo_n "checking for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS... " >&6; }
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -5556,39 +6018,12 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   acx_pthread_ok=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-        { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
 $as_echo "$acx_pthread_ok" >&6; }
         if test x"$acx_pthread_ok" = xno; then
                 PTHREAD_LIBS=""
@@ -5654,12 +6089,12 @@
 
         case $flag in
                 none)
-                { $as_echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work without any flags" >&5
 $as_echo_n "checking whether pthreads work without any flags... " >&6; }
                 ;;
 
                 -*)
-                { $as_echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads work with $flag" >&5
 $as_echo_n "checking whether pthreads work with $flag... " >&6; }
                 PTHREAD_CFLAGS="$flag"
                 ;;
@@ -5667,9 +6102,9 @@
 		pthread-config)
 		# Extract the first word of "pthread-config", so it can be a program name with args.
 set dummy pthread-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_acx_pthread_config+set}" = set; then
+if test "${ac_cv_prog_acx_pthread_config+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -n "$acx_pthread_config"; then
@@ -5680,14 +6115,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_acx_pthread_config="yes"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   test -z "$ac_cv_prog_acx_pthread_config" && ac_cv_prog_acx_pthread_config="no"
@@ -5695,10 +6130,10 @@
 fi
 acx_pthread_config=$ac_cv_prog_acx_pthread_config
 if test -n "$acx_pthread_config"; then
-  { $as_echo "$as_me:$LINENO: result: $acx_pthread_config" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_config" >&5
 $as_echo "$acx_pthread_config" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -5709,7 +6144,7 @@
 		;;
 
                 *)
-                { $as_echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the pthreads library -l$flag" >&5
 $as_echo_n "checking for the pthreads library -l$flag... " >&6; }
                 PTHREAD_LIBS="-l$flag"
                 ;;
@@ -5729,11 +6164,7 @@
         # pthread_cleanup_push because it is one of the few pthread
         # functions on Solaris that doesn't have a non-functional libc stub.
         # We try pthread_create on general principles.
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
 int
@@ -5746,43 +6177,16 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   acx_pthread_ok=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
         LIBS="$save_LIBS"
         CFLAGS="$save_CFLAGS"
 
-        { $as_echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acx_pthread_ok" >&5
 $as_echo "$acx_pthread_ok" >&6; }
         if test "x$acx_pthread_ok" = xyes; then
                 break;
@@ -5801,15 +6205,11 @@
         CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 
         # Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
-	{ $as_echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for joinable pthread attribute" >&5
 $as_echo_n "checking for joinable pthread attribute... " >&6; }
 	attr_name=unknown
 	for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
-	    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <pthread.h>
 int
@@ -5820,40 +6220,13 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   attr_name=$attr; break
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 	done
-        { $as_echo "$as_me:$LINENO: result: $attr_name" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $attr_name" >&5
 $as_echo "$attr_name" >&6; }
         if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
 
@@ -5863,14 +6236,14 @@
 
         fi
 
-        { $as_echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if more special flags are required for pthreads" >&5
 $as_echo_n "checking if more special flags are required for pthreads... " >&6; }
         flag=no
         case "${host_cpu}-${host_os}" in
             *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
             *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
         esac
-        { $as_echo "$as_me:$LINENO: result: ${flag}" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${flag}" >&5
 $as_echo "${flag}" >&6; }
         if test "x$flag" != xno; then
             PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
@@ -5887,9 +6260,7 @@
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 if test x"$acx_pthread_ok" = xyes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_PTHREAD 1
-_ACEOF
+$as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
 
         :
 else
@@ -5909,10 +6280,10 @@
 ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_objc_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the Objective C preprocessor" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the Objective C preprocessor" >&5
 $as_echo_n "checking how to run the Objective C preprocessor... " >&6; }
 if test -z "$OBJCPP"; then
-  if test "${ac_cv_prog_OBJCPP+set}" = set; then
+  if test "${ac_cv_prog_OBJCPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because OBJCPP needs to be expanded
@@ -5927,11 +6298,7 @@
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -5940,78 +6307,34 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_objc_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_objc_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+if $ac_preproc_ok; then :
   break
 fi
 
@@ -6023,7 +6346,7 @@
 else
   ac_cv_prog_OBJCPP=$OBJCPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $OBJCPP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJCPP" >&5
 $as_echo "$OBJCPP" >&6; }
 ac_preproc_ok=false
 for ac_objc_preproc_warn_flag in '' yes
@@ -6034,11 +6357,7 @@
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -6047,87 +6366,40 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_objc_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_objc_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+if $ac_preproc_ok; then :
+
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: Objective C preprocessor \"$OBJCPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: Objective C preprocessor \"$OBJCPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "Objective C preprocessor \"$OBJCPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
 fi
 
 ac_ext=m
@@ -6137,9 +6409,9 @@
 ac_compiler_gnu=$ac_cv_objc_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
 $as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
+if test "${ac_cv_path_GREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$GREP"; then
@@ -6150,7 +6422,7 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
+    for ac_prog in grep ggrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
@@ -6170,7 +6442,7 @@
     $as_echo 'GREP' >> "conftest.nl"
     "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_GREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_GREP="$ac_path_GREP"
@@ -6185,26 +6457,24 @@
       $ac_path_GREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_GREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_GREP=$GREP
 fi
 
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
 $as_echo "$ac_cv_path_GREP" >&6; }
  GREP="$ac_cv_path_GREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
 $as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
+if test "${ac_cv_path_EGREP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -6218,7 +6488,7 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
+    for ac_prog in egrep; do
     for ac_exec_ext in '' $ac_executable_extensions; do
       ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
       { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
@@ -6238,7 +6508,7 @@
     $as_echo 'EGREP' >> "conftest.nl"
     "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
     diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
     if test $ac_count -gt ${ac_path_EGREP_max-0}; then
       # Best one so far, save it but keep looking for a better one
       ac_cv_path_EGREP="$ac_path_EGREP"
@@ -6253,12 +6523,10 @@
       $ac_path_EGREP_found && break 3
     done
   done
-done
+  done
 IFS=$as_save_IFS
   if test -z "$ac_cv_path_EGREP"; then
-    { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
 else
   ac_cv_path_EGREP=$EGREP
@@ -6266,21 +6534,17 @@
 
    fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
 $as_echo "$ac_cv_path_EGREP" >&6; }
  EGREP="$ac_cv_path_EGREP"
 
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -6295,48 +6559,23 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_objc_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -6346,18 +6585,14 @@
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -6367,14 +6602,10 @@
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -6401,118 +6632,34 @@
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_objc_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
 $as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
 		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_objc_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -6526,7 +6673,7 @@
 
 
 # Check whether --with-objc-runtime was given.
-if test "${with_objc_runtime+set}" = set; then
+if test "${with_objc_runtime+set}" = set; then :
   withval=$with_objc_runtime; with_objc_runtime=${withval}
 fi
 
@@ -6540,9 +6687,7 @@
 			no)
 				;;
 			*)
-				{ { $as_echo "$as_me:$LINENO: error: ${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either \"GNU\" or \"apple\"" >&5
-$as_echo "$as_me: error: ${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either \"GNU\" or \"apple\"" >&2;}
-   { (exit 1); exit 1; }; }
+				as_fn_error "${with_objc_runtime} is not a valid argument to --with-objc-runtime. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
 				;;
 		esac
 	fi
@@ -6557,157 +6702,16 @@
 	if test x"${with_objc_runtime}" != x"no"; then
 
 	# Check for common header, objc/objc.h
-
-for ac_header in objc/objc.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_objc_preproc_warn_flag$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_objc_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------------ ##
-## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+	for ac_header in objc/objc.h
+do :
+  ac_fn_objc_check_header_mongrel "$LINENO" "objc/objc.h" "ac_cv_header_objc_objc_h" "$ac_includes_default"
+if test "x$ac_cv_header_objc_objc_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_OBJC_OBJC_H 1
 _ACEOF
 
 else
-  { { $as_echo "$as_me:$LINENO: error: Can't locate Objective C runtime headers" >&5
-$as_echo "$as_me: error: Can't locate Objective C runtime headers" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "Can't locate Objective C runtime headers" "$LINENO" 5
 fi
 
 done
@@ -6725,9 +6729,9 @@
 	# Test if pthreads are required to link against
 	# libobjc - this is the case on FreeBSD.
 
-	{ $as_echo "$as_me:$LINENO: checking if linking libobjc requires pthreads" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if linking libobjc requires pthreads" >&5
 $as_echo_n "checking if linking libobjc requires pthreads... " >&6; }
-	if test "${mp_cv_objc_req_pthread+set}" = set; then
+	if test "${mp_cv_objc_req_pthread+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -6735,14 +6739,10 @@
 		# The following uses quadrigraphs
 		# '[' = '['
 		# ']' = ']'
-		cat >conftest.$ac_ext <<_ACEOF
-
-				/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 						#include <objc/objc.h>
 						#include <objc/Object.h>
 
@@ -6758,58 +6758,29 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 					# Linked without -pthread
 					mp_cv_objc_req_pthread="no"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 					# Failed to link without -pthread
 					mp_cv_objc_req_pthread="yes"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 		# If the above failed, try with pthreads
 		if test x"${mp_cv_objc_req_pthread}" = x"yes"; then
 			LIBS="${LIBS} ${PTHREAD_LIBS}"
 			OBJCFLAGS="${OBJCFLAGS} ${PTHREAD_CFLAGS}"
-			cat >conftest.$ac_ext <<_ACEOF
-
-					/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 							#include <objc/objc.h>
 							#include <objc/Object.h>
 
@@ -6825,36 +6796,13 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 						# Linked with -lpthread
 						mp_cv_objc_req_pthread="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 						# Failed to link against objc at all
 						# This will be caught in the runtime
 						# checks below
@@ -6862,15 +6810,13 @@
 
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 		fi
 
 fi
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_objc_req_pthread}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_objc_req_pthread}" >&5
 $as_echo "${mp_cv_objc_req_pthread}" >&6; }
 
 	if test x"${mp_cv_objc_req_pthread}" = x"no"; then
@@ -6883,23 +6829,19 @@
 	fi
 
 	if test x"${with_objc_runtime}" = x || test x"${with_objc_runtime}" = x"apple"; then
-		{ $as_echo "$as_me:$LINENO: checking for Apple Objective-C runtime" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple Objective-C runtime" >&5
 $as_echo_n "checking for Apple Objective-C runtime... " >&6; }
-		if test "${mp_cv_objc_runtime_apple+set}" = set; then
+		if test "${mp_cv_objc_runtime_apple+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 			# The following uses quadrigraphs
 			# '[' = '['
 			# ']' = ']'
-			cat >conftest.$ac_ext <<_ACEOF
-
-					/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 							#include <objc/objc.h>
 							#include <objc/objc-api.h>
 
@@ -6916,70 +6858,41 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 						mp_cv_objc_runtime_apple="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 						mp_cv_objc_runtime_apple="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 fi
 
-		{ $as_echo "$as_me:$LINENO: result: ${mp_cv_objc_runtime_apple}" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_objc_runtime_apple}" >&5
 $as_echo "${mp_cv_objc_runtime_apple}" >&6; }
 	else
 		mp_cv_objc_runtime_apple="no"
 	fi
 
 	if test x"${with_objc_runtime}" = x || test x"${with_objc_runtime}" = x"GNU"; then
-		{ $as_echo "$as_me:$LINENO: checking for GNU Objective C runtime" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU Objective C runtime" >&5
 $as_echo_n "checking for GNU Objective C runtime... " >&6; }
-		if test "${mp_cv_objc_runtime_gnu+set}" = set; then
+		if test "${mp_cv_objc_runtime_gnu+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 			# The following uses quadrigraphs
 			# '[' = '['
 			# ']' = ']'
-			cat >conftest.$ac_ext <<_ACEOF
-
-					/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 							#include <objc/objc.h>
 							#include <objc/objc-api.h>
 
@@ -6996,47 +6909,22 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 						mp_cv_objc_runtime_gnu="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 						mp_cv_objc_runtime_gnu="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 fi
 
-		{ $as_echo "$as_me:$LINENO: result: ${mp_cv_objc_runtime_gnu}" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_objc_runtime_gnu}" >&5
 $as_echo "${mp_cv_objc_runtime_gnu}" >&6; }
 	else
 		mp_cv_objc_runtime_gnu="no"
@@ -7048,35 +6936,28 @@
 	if test x"${mp_cv_objc_runtime_apple}" = x"yes"; then
 			OBJC_RUNTIME="APPLE_RUNTIME"
 			OBJC_RUNTIME_FLAGS="-fnext-runtime"
-			{ $as_echo "$as_me:$LINENO: Using Apple Objective-C runtime" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Using Apple Objective-C runtime" >&5
 $as_echo "$as_me: Using Apple Objective-C runtime" >&6;}
 
-cat >>confdefs.h <<\_ACEOF
-#define APPLE_RUNTIME 1
-_ACEOF
+$as_echo "#define APPLE_RUNTIME 1" >>confdefs.h
 
 	elif test x"${mp_cv_objc_runtime_gnu}" = x"yes"; then
 			OBJC_RUNTIME="GNU_RUNTIME"
 			OBJC_RUNTIME_FLAGS="-fgnu-runtime"
-			{ $as_echo "$as_me:$LINENO: Using GNU Objective-C runtime" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Using GNU Objective-C runtime" >&5
 $as_echo "$as_me: Using GNU Objective-C runtime" >&6;}
 
-cat >>confdefs.h <<\_ACEOF
-#define GNU_RUNTIME 1
-_ACEOF
+$as_echo "#define GNU_RUNTIME 1" >>confdefs.h
 
 	elif test x"${with_objc_runtime}" = x"no"; then
 			OBJC_RUNTIME="none"
-			{ $as_echo "$as_me:$LINENO: Not using Objective-C runtime" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Not using Objective-C runtime" >&5
 $as_echo "$as_me: Not using Objective-C runtime" >&6;}
 	else
-			{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+			{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: Could not locate a working Objective-C runtime.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: Could not locate a working Objective-C runtime.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "Could not locate a working Objective-C runtime.
+See \`config.log' for more details." "$LINENO" 5; }
 	fi
 
 	# Restore LIBS & OBJCFLAGS
@@ -7101,7 +6982,7 @@
 
 
 # Check whether --with-objc-foundation was given.
-if test "${with_objc_foundation+set}" = set; then
+if test "${with_objc_foundation+set}" = set; then :
   withval=$with_objc_foundation; with_objc_foundation=${withval}
 fi
 
@@ -7118,9 +6999,7 @@
 			no)
 				;;
 			*)
-				{ { $as_echo "$as_me:$LINENO: error: ${with_objc_foundation} is not a valid argument to --with-objc-foundation. Please specify either \"GNU\" or \"apple\"" >&5
-$as_echo "$as_me: error: ${with_objc_foundation} is not a valid argument to --with-objc-foundation. Please specify either \"GNU\" or \"apple\"" >&2;}
-   { (exit 1); exit 1; }; }
+				as_fn_error "${with_objc_foundation} is not a valid argument to --with-objc-foundation. Please specify either \"GNU\" or \"apple\"" "$LINENO" 5
 				;;
 		esac
 	fi
@@ -7137,14 +7016,14 @@
 	if test x"${with_objc_foundation}" == x || test x"${with_objc_foundation}" == x"apple"; then
 		# '[' = '['
 		# ']' = ']'
-		{ $as_echo "$as_me:$LINENO: checking for Apple Foundation library" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Apple Foundation library" >&5
 $as_echo_n "checking for Apple Foundation library... " >&6; }
 
 		# Set NeXT LIBS and CFLAGS
 		APPLE_FOUNDATION_CFLAGS=""
 		APPLE_FOUNDATION_LIBS="-framework Foundation"
 
-		if test "${ac_cv_objc_foundation_apple+set}" = set; then
+		if test "${ac_cv_objc_foundation_apple+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -7155,14 +7034,10 @@
 			CFLAGS="${APPLE_FOUNDATION_CFLAGS} ${CFLAGS}"
 			LIBS="${APPLE_FOUNDATION_LIBS} ${LIBS}"
 
-			cat >conftest.$ac_ext <<_ACEOF
-
-					/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+			cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 								#include <Foundation/Foundation.h>
 
 int
@@ -7177,50 +7052,25 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 						ac_cv_objc_foundation_apple="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 						ac_cv_objc_foundation_apple="no"
 
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 			# Restore LIBS and CFLAGS
 			LIBS="${LIBS_OLD}"
 			CFLAGS="${CFLAGS_OLD}"
 
 fi
 
-		{ $as_echo "$as_me:$LINENO: result: ${ac_cv_objc_foundation_apple}" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_objc_foundation_apple}" >&5
 $as_echo "${ac_cv_objc_foundation_apple}" >&6; }
 	else
 		ac_cv_objc_foundation_apple="no"
@@ -7230,16 +7080,14 @@
 		GNUSTEP_CONFIG=/usr/bin/gnustep-config
 		if test ! -x "${GNUSTEP_CONFIG}" -a x"${GNUSTEP_SYSTEM_ROOT}" == x; then
 			if test x"${with_objc_foundation}" == x"GNUstep"; then
-				{ { $as_echo "$as_me:$LINENO: error: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&5
-$as_echo "$as_me: error: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&2;}
-   { (exit 1); exit 1; }; }
+				as_fn_error "GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" "$LINENO" 5
 			else
-				{ $as_echo "$as_me:$LINENO: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&5
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&5
 $as_echo "$as_me: WARNING: GNUSTEP_SYSTEM_ROOT is not defined in your environment, preventing the use of GNUstep's Foundation library" >&2;}
 			fi
 		else
 
-			{ $as_echo "$as_me:$LINENO: checking for GNUstep Foundation library" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUstep Foundation library" >&5
 $as_echo_n "checking for GNUstep Foundation library... " >&6; }
 
 			# Set GNUstep LDFLAGS, CPPFLAGS, and LIBS
@@ -7253,7 +7101,7 @@
 			GNUSTEP_LIBS="-lgnustep-base"
 			fi
 
-			if test "${ac_cv_objc_foundation_gnustep+set}" = set; then
+			if test "${ac_cv_objc_foundation_gnustep+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -7266,14 +7114,10 @@
 				CPPFLAGS="${GNUSTEP_CPPFLAGS} ${CPPFLAGS}"
 				LIBS="${GNUSTEP_LIBS} ${LIBS}"
 
-				cat >conftest.$ac_ext <<_ACEOF
-
-						/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+				cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 									#include <Foundation/Foundation.h>
 
 int
@@ -7288,43 +7132,18 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_objc_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_objc_try_link "$LINENO"; then :
 
 							ac_cv_objc_foundation_gnustep="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 							ac_cv_objc_foundation_gnustep="no"
 
 
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 				# Restore LDFLAGS, CPPFLAGS, and LIBS
 				LDFLAGS="${LDFLAGS_OLD}"
 				CPPFLAGS="${CPPFLAGS_OLD}"
@@ -7332,7 +7151,7 @@
 
 fi
 
-			{ $as_echo "$as_me:$LINENO: result: ${ac_cv_objc_foundation_gnustep}" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_objc_foundation_gnustep}" >&5
 $as_echo "${ac_cv_objc_foundation_gnustep}" >&6; }
 		fi
 	else
@@ -7348,11 +7167,9 @@
 		OBJC_FOUNDATION_LIBS="${APPLE_FOUNDATION_LIBS}"
 		OBJC_FOUNDATION_LDFLAGS=""
 
-cat >>confdefs.h <<\_ACEOF
-#define APPLE_FOUNDATION 1
-_ACEOF
+$as_echo "#define APPLE_FOUNDATION 1" >>confdefs.h
 
-		{ $as_echo "$as_me:$LINENO: Using Apple Foundation library" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: Using Apple Foundation library" >&5
 $as_echo "$as_me: Using Apple Foundation library" >&6;}
 	elif test x"${ac_cv_objc_foundation_gnustep}" == x"yes"; then
 		OBJC_FOUNDATION="GNUstep"
@@ -7360,20 +7177,16 @@
 		OBJC_FOUNDATION_LIBS="${GNUSTEP_LIBS}"
 		OBJC_FOUNDATION_LDFLAGS="${GNUSTEP_LDFLAGS}"
 
-cat >>confdefs.h <<\_ACEOF
-#define GNUSTEP_FOUNDATION 1
-_ACEOF
+$as_echo "#define GNUSTEP_FOUNDATION 1" >>confdefs.h
 
-		{ $as_echo "$as_me:$LINENO: Using GNUstep Foundation library" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: Using GNUstep Foundation library" >&5
 $as_echo "$as_me: Using GNUstep Foundation library" >&6;}
 	elif test x"${with_objc_foundation}" = x"no"; then
 		OBJC_FOUNDATION="none"
-		{ $as_echo "$as_me:$LINENO: Not using Foundation implementation" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: Not using Foundation implementation" >&5
 $as_echo "$as_me: Not using Foundation implementation" >&6;}
 	else
-		{ { $as_echo "$as_me:$LINENO: error: Could not find a working Foundation implementation" >&5
-$as_echo "$as_me: error: Could not find a working Foundation implementation" >&2;}
-   { (exit 1); exit 1; }; }
+		as_fn_error "Could not find a working Foundation implementation" "$LINENO" 5
 	fi
 
 
@@ -7392,24 +7205,20 @@
 
 	FRAMEWORK_LIBS="-framework CoreFoundation"
 
-	{ $as_echo "$as_me:$LINENO: checking for CoreFoundation framework" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CoreFoundation framework" >&5
 $as_echo_n "checking for CoreFoundation framework... " >&6; }
 
-	if test "${mp_cv_have_framework_corefoundation+set}" = set; then
+	if test "${mp_cv_have_framework_corefoundation+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 					#include <CoreFoundation/CoreFoundation.h>
 
 int
@@ -7424,57 +7233,30 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 				mp_cv_have_framework_corefoundation="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 				mp_cv_have_framework_corefoundation="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 		LIBS="$ac_save_LIBS"
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_have_framework_corefoundation}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_have_framework_corefoundation}" >&5
 $as_echo "${mp_cv_have_framework_corefoundation}" >&6; }
 
 	if test x"${mp_cv_have_framework_corefoundation}" = "xyes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FRAMEWORK_COREFOUNDATION /**/
-_ACEOF
+$as_echo "#define HAVE_FRAMEWORK_COREFOUNDATION /**/" >>confdefs.h
 
 	fi
 
@@ -7483,24 +7265,20 @@
 
 	FRAMEWORK_LIBS="-framework SystemConfiguration"
 
-	{ $as_echo "$as_me:$LINENO: checking for SystemConfiguration framework" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SystemConfiguration framework" >&5
 $as_echo_n "checking for SystemConfiguration framework... " >&6; }
 
-	if test "${mp_cv_have_framework_systemconfiguration+set}" = set; then
+	if test "${mp_cv_have_framework_systemconfiguration+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 					#include <SystemConfiguration/SystemConfiguration.h>
 
 int
@@ -7515,57 +7293,30 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 				mp_cv_have_framework_systemconfiguration="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 				mp_cv_have_framework_systemconfiguration="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 		LIBS="$ac_save_LIBS"
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_have_framework_systemconfiguration}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_have_framework_systemconfiguration}" >&5
 $as_echo "${mp_cv_have_framework_systemconfiguration}" >&6; }
 
 	if test x"${mp_cv_have_framework_systemconfiguration}" = "xyes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FRAMEWORK_SYSTEMCONFIGURATION /**/
-_ACEOF
+$as_echo "#define HAVE_FRAMEWORK_SYSTEMCONFIGURATION /**/" >>confdefs.h
 
 	fi
 
@@ -7574,24 +7325,20 @@
 
 	FRAMEWORK_LIBS="-framework IOKit"
 
-	{ $as_echo "$as_me:$LINENO: checking for IOKit framework" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IOKit framework" >&5
 $as_echo_n "checking for IOKit framework... " >&6; }
 
-	if test "${mp_cv_have_framework_iokit+set}" = set; then
+	if test "${mp_cv_have_framework_iokit+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 					#include <IOKit/IOKitLib.h>
 
 int
@@ -7606,57 +7353,30 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 				mp_cv_have_framework_iokit="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 				mp_cv_have_framework_iokit="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 		LIBS="$ac_save_LIBS"
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_have_framework_iokit}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_have_framework_iokit}" >&5
 $as_echo "${mp_cv_have_framework_iokit}" >&6; }
 
 	if test x"${mp_cv_have_framework_iokit}" = "xyes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FRAMEWORK_IOKIT /**/
-_ACEOF
+$as_echo "#define HAVE_FRAMEWORK_IOKIT /**/" >>confdefs.h
 
 	fi
 
@@ -7665,24 +7385,20 @@
 
 	FRAMEWORK_LIBS="-framework CoreFoundation"
 
-	{ $as_echo "$as_me:$LINENO: checking for CFNotificationCenterGetDarwinNotifyCenter" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFNotificationCenterGetDarwinNotifyCenter" >&5
 $as_echo_n "checking for CFNotificationCenterGetDarwinNotifyCenter... " >&6; }
 
-	if test "${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter+set}" = set; then
+	if test "${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
 		ac_save_LIBS="$LIBS"
 		LIBS="$FRAMEWORK_LIBS $LIBS"
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 					#include <CoreFoundation/CoreFoundation.h>
 
 int
@@ -7696,57 +7412,30 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
 
 				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 				mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter="no"
 
 
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-
 		LIBS="$ac_save_LIBS"
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&5
 $as_echo "${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" >&6; }
 
 	if test x"${mp_cv_have_function_cfnotificationcentergetdarwinnotifycenter}" = "xyes"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER /**/
-_ACEOF
+$as_echo "#define HAVE_FUNCTION_CFNOTIFICATIONCENTERGETDARWINNOTIFYCENTER /**/" >>confdefs.h
 
 	fi
 
@@ -7758,7 +7447,7 @@
 
 
 
-    { $as_echo "$as_me:$LINENO: checking for whether we will build daemondo" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for whether we will build daemondo" >&5
 $as_echo_n "checking for whether we will build daemondo... " >&6; }
     result=no
 	case $host_os in
@@ -7775,7 +7464,7 @@
 		;;
 	*)
 	esac
-	{ $as_echo "$as_me:$LINENO: result: ${result}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${result}" >&5
 $as_echo "${result}" >&6; }
 
 
@@ -7786,26 +7475,27 @@
 
 # Check for paths
 
+if test x$prefix = x/usr/local; then
+    as_fn_error "Installing MacPorts into /usr/local is not supported" "$LINENO" 5
+fi
 
 
 
 
 # Check whether --with-ports-dir was given.
-if test "${with_ports_dir+set}" = set; then
+if test "${with_ports_dir+set}" = set; then :
   withval=$with_ports_dir;  portsdir="$withval"
 fi
 
 
 
- 	{ $as_echo "$as_me:$LINENO: checking for ports tree" >&5
+ 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ports tree" >&5
 $as_echo_n "checking for ports tree... " >&6; }
  	if test "x$portsdir" != "x" ; then
  	  if test -d "$portsdir" -a -e "$portsdir/PortIndex" ; then
  		:
  	  else
- 		{ { $as_echo "$as_me:$LINENO: error: $portsdir not a valid ports tree" >&5
-$as_echo "$as_me: error: $portsdir not a valid ports tree" >&2;}
-   { (exit 1); exit 1; }; }
+ 		as_fn_error "$portsdir not a valid ports tree" "$LINENO" 5
  	  fi
  	else
  		 		if test "x$PORTS_DIR_DEFAULT" != "x" ; then
@@ -7816,24 +7506,24 @@
  	fi
 
  	if test "x$portsdir" != "x" ; then
- 		{ $as_echo "$as_me:$LINENO: result: $portsdir" >&5
+ 		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $portsdir" >&5
 $as_echo "$portsdir" >&6; }
  		PORTSDIR="$portsdir"
 
  	else
- 		{ $as_echo "$as_me:$LINENO: WARNING: No ports tree found" >&5
+ 		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No ports tree found" >&5
 $as_echo "$as_me: WARNING: No ports tree found" >&2;}
  	fi
 
 
 
 
-        { $as_echo "$as_me:$LINENO: checking for MacPorts config directory" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MacPorts config directory" >&5
 $as_echo_n "checking for MacPorts config directory... " >&6; }
 
 	mpconfigdir='${sysconfdir}/macports'
 
-	{ $as_echo "$as_me:$LINENO: result: $mpconfigdir" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mpconfigdir" >&5
 $as_echo "$mpconfigdir" >&6; }
 	MPCONFIGDIR="$mpconfigdir"
 
@@ -7846,7 +7536,7 @@
 
 
 # Check whether --with-no-root-privileges was given.
-if test "${with_no_root_privileges+set}" = set; then
+if test "${with_no_root_privileges+set}" = set; then :
   withval=$with_no_root_privileges; ROOTPRIVS=$withval
 fi
 
@@ -7854,23 +7544,23 @@
 	if test "${ROOTPRIVS+set}" = set; then
 
 		# Set install-user to current user
-		{ $as_echo "$as_me:$LINENO: checking for install user" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install user" >&5
 $as_echo_n "checking for install user... " >&6; }
 		DSTUSR=`id -un`
-		{ $as_echo "$as_me:$LINENO: result: $DSTUSR" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTUSR" >&5
 $as_echo "$DSTUSR" >&6; }
 
 
 		# Set install-group to current user
-		{ $as_echo "$as_me:$LINENO: checking for install group" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install group" >&5
 $as_echo_n "checking for install group... " >&6; }
 		DSTGRP=`id -gn`
-		{ $as_echo "$as_me:$LINENO: result: $DSTGRP" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTGRP" >&5
 $as_echo "$DSTGRP" >&6; }
 
 
 		# Set Tcl package directory to ~/Library/Tcl
-	    { $as_echo "$as_me:$LINENO: checking for Tcl package directory" >&5
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl package directory" >&5
 $as_echo_n "checking for Tcl package directory... " >&6; }
 		ac_cv_c_tclpkgd="~$DSTUSR/Library/Tcl"
 	    # Convert to a native path and substitute into the output files.
@@ -7878,11 +7568,9 @@
 	    TCL_PACKAGE_DIR=${PACKAGE_DIR_NATIVE}
 
 		if test x"${ac_cv_c_tclpkgd}" = x ; then
-			{ { $as_echo "$as_me:$LINENO: error: Tcl package directory not found.  Please specify its location with --with-tclpackage" >&5
-$as_echo "$as_me: error: Tcl package directory not found.  Please specify its location with --with-tclpackage" >&2;}
-   { (exit 1); exit 1; }; }
+			as_fn_error "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
 	    else
-			{ $as_echo "$as_me:$LINENO: result: ${ac_cv_c_tclpkgd}" >&5
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
 $as_echo "${ac_cv_c_tclpkgd}" >&6; }
 	    fi
 	fi
@@ -7895,18 +7583,18 @@
 
 
 # Check whether --with-install-user was given.
-if test "${with_install_user+set}" = set; then
+if test "${with_install_user+set}" = set; then :
   withval=$with_install_user;  DSTUSR=$withval
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: checking for install user" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install user" >&5
 $as_echo_n "checking for install user... " >&6; }
 	if test "x$DSTUSR" = "x" ; then
 	   DSTUSR=root
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $DSTUSR" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTUSR" >&5
 $as_echo "$DSTUSR" >&6; }
 
 
@@ -7915,12 +7603,12 @@
 
 
 # Check whether --with-install-group was given.
-if test "${with_install_group+set}" = set; then
+if test "${with_install_group+set}" = set; then :
   withval=$with_install_group;  DSTGRP=$withval
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: checking for install group" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for install group" >&5
 $as_echo_n "checking for install group... " >&6; }
 	if test "x$DSTGRP" = "x" ; then
 
@@ -7940,7 +7628,7 @@
 	   esac
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $DSTGRP" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTGRP" >&5
 $as_echo "$DSTGRP" >&6; }
 
 
@@ -7949,12 +7637,12 @@
 
 
 # Check whether --with-macports-user was given.
-if test "${with_macports_user+set}" = set; then
+if test "${with_macports_user+set}" = set; then :
   withval=$with_macports_user;  RUNUSR=$withval
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: checking for macports user" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for macports user" >&5
 $as_echo_n "checking for macports user... " >&6; }
 	if test "x$RUNUSR" = "x" ; then
 # dropping root privs is still buggy
@@ -7962,7 +7650,7 @@
 	   RUNUSR=root
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $RUNUSR" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNUSR" >&5
 $as_echo "$RUNUSR" >&6; }
 
 
@@ -7971,18 +7659,18 @@
 
 
 # Check whether --with-directory-mode was given.
-if test "${with_directory_mode+set}" = set; then
+if test "${with_directory_mode+set}" = set; then :
   withval=$with_directory_mode;  DSTMODE=$withval
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: checking what permissions to use for installation directories" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking what permissions to use for installation directories" >&5
 $as_echo_n "checking what permissions to use for installation directories... " >&6; }
 	if test "x$DSTMODE" = "x" ; then
 	   DSTMODE=0755
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $DSTMODE" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTMODE" >&5
 $as_echo "$DSTMODE" >&6; }
 
 
@@ -7991,17 +7679,17 @@
 
 
 # Check whether --with-shared-directory was given.
-if test "${with_shared_directory+set}" = set; then
+if test "${with_shared_directory+set}" = set; then :
   withval=$with_shared_directory;  SHAREDIR=$withval
 fi
 
 
 	if test "${SHAREDIR+set}" = set; then
-		{ $as_echo "$as_me:$LINENO: checking whether to share the install directory with all members of the install group" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to share the install directory with all members of the install group" >&5
 $as_echo_n "checking whether to share the install directory with all members of the install group... " >&6; }
 	    DSTMODE=0775
 
-		{ $as_echo "$as_me:$LINENO: result: $DSTMODE" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSTMODE" >&5
 $as_echo "$DSTMODE" >&6; }
 
 	fi
@@ -8013,7 +7701,7 @@
 
 
 # Check whether --with-applications-dir was given.
-if test "${with_applications_dir+set}" = set; then
+if test "${with_applications_dir+set}" = set; then :
   withval=$with_applications_dir; MPAPPLICATIONSDIR=${withval}
 fi
 
@@ -8022,7 +7710,7 @@
     if test "x$prefix" = "xNONE" ; then
 	prefix=$ac_default_prefix
     fi
-    { $as_echo "$as_me:$LINENO: checking for Applications installation directory" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Applications installation directory" >&5
 $as_echo_n "checking for Applications installation directory... " >&6; }
 
 	if test "x$MPAPPLICATIONSDIR" = "x" ; then
@@ -8033,7 +7721,7 @@
 	    fi
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $MPAPPLICATIONSDIR" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPAPPLICATIONSDIR" >&5
 $as_echo "$MPAPPLICATIONSDIR" >&6; }
 
     prefix=$oldprefix
@@ -8043,7 +7731,7 @@
 
 
 # Check whether --with-frameworks-dir was given.
-if test "${with_frameworks_dir+set}" = set; then
+if test "${with_frameworks_dir+set}" = set; then :
   withval=$with_frameworks_dir; MPFRAMEWORKSDIR=${withval}
 fi
 
@@ -8052,14 +7740,14 @@
     if test "x$prefix" = "xNONE" ; then
 	prefix=$ac_default_prefix
     fi
-    { $as_echo "$as_me:$LINENO: checking for Frameworks installation directory" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Frameworks installation directory" >&5
 $as_echo_n "checking for Frameworks installation directory... " >&6; }
 
 	if test "x$MPFRAMEWORKSDIR" = "x" ; then
 		MPFRAMEWORKSDIR="${prefix}/Library/Frameworks"
 	fi
 
-	{ $as_echo "$as_me:$LINENO: result: $MPFRAMEWORKSDIR" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MPFRAMEWORKSDIR" >&5
 $as_echo "$MPFRAMEWORKSDIR" >&6; }
 
     prefix=$oldprefix
@@ -8068,20 +7756,26 @@
 # Check for universal options
 
 
-
 # Check whether --with-universal-archs was given.
-if test "${with_universal_archs+set}" = set; then
+if test "${with_universal_archs+set}" = set; then :
   withval=$with_universal_archs; UNIVERSAL_ARCHS=${withval}
 fi
 
 
-	if test "x$UNIVERSAL_ARCHS" = "x"; then
-	    UNIVERSAL_ARCHS="ppc i386"
-	fi
+  if test "x$UNIVERSAL_ARCHS" = "x"; then
+    case "$MACOSX_VERSION" in
+      10.[0-5]*)
+        UNIVERSAL_ARCHS="i386 ppc"
+        ;;
+      *)
+        UNIVERSAL_ARCHS="x86_64 i386"
+        ;;
+    esac
+  fi
 
-    { $as_echo "$as_me:$LINENO: checking for Universal CPU architectures" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Universal CPU architectures" >&5
 $as_echo_n "checking for Universal CPU architectures... " >&6; }
-    { $as_echo "$as_me:$LINENO: result: $UNIVERSAL_ARCHS" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNIVERSAL_ARCHS" >&5
 $as_echo "$UNIVERSAL_ARCHS" >&6; }
 
 
@@ -8092,14 +7786,14 @@
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
 $as_echo_n "checking how to run the C preprocessor... " >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
       # Double quotes because CPP needs to be expanded
@@ -8114,11 +7808,7 @@
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -8127,78 +7817,34 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
+if $ac_preproc_ok; then :
   break
 fi
 
@@ -8210,7 +7856,7 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
 $as_echo "$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
@@ -8221,11 +7867,7 @@
   # <limits.h> exists even on freestanding compilers.
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #ifdef __STDC__
 # include <limits.h>
@@ -8234,87 +7876,40 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_cpp "$LINENO"; then :
 
+else
   # Broken: fails on valid input.
 continue
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
   # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
+if ac_fn_c_try_cpp "$LINENO"; then :
   # Broken: success on invalid input.
 continue
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
   # Passes both tests.
 ac_preproc_ok=:
 break
 fi
-
 rm -f conftest.err conftest.$ac_ext
 
 done
 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
 rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+if $ac_preproc_ok; then :
+
 else
-  { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }; }
+as_fn_error "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." "$LINENO" 5; }
 fi
 
 ac_ext=c
@@ -8324,16 +7919,12 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
 $as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
+if test "${ac_cv_header_stdc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 #include <stdarg.h>
@@ -8348,48 +7939,23 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_stdc=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_stdc=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <string.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -8399,18 +7965,14 @@
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdlib.h>
 
 _ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
   ac_cv_header_stdc=no
 fi
@@ -8420,14 +7982,10 @@
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then :
   :
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <ctype.h>
 #include <stdlib.h>
@@ -8454,72 +8012,34 @@
   return 0;
 }
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  $as_echo "$as_me: program exited with status $ac_status" >&5
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_run "$LINENO"; then :
 
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+  ac_cv_header_stdc=no
 fi
-rm -rf conftest.dSYM
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-
 fi
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
 $as_echo "$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
 fi
 
-
-
-
-
-
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -8533,41 +8053,18 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   eval "$as_ac_Header=yes"
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_Header=no"
+  eval "$as_ac_Header=no"
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+eval ac_res=\$$as_ac_Header
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
 $as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 _ACEOF
@@ -8578,17 +8075,13 @@
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
 $as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
+if test "${ac_cv_search_opendir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -8613,70 +8106,39 @@
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+  if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
+if test "${ac_cv_search_opendir+set}" = set; then :
+
 else
   ac_cv_search_opendir=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
 $as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 else
-  { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
 $as_echo_n "checking for library containing opendir... " >&6; }
-if test "${ac_cv_search_opendir+set}" = set; then
+if test "${ac_cv_search_opendir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -8701,70 +8163,39 @@
     ac_res=-l$ac_lib
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
   fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+  if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_search_opendir=$ac_res
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext
-  if test "${ac_cv_search_opendir+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then :
   break
 fi
 done
-if test "${ac_cv_search_opendir+set}" = set; then
-  :
+if test "${ac_cv_search_opendir+set}" = set; then :
+
 else
   ac_cv_search_opendir=no
 fi
 rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
 $as_echo "$ac_cv_search_opendir" >&6; }
 ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
   test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 fi
 
-{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys/wait.h that is POSIX.1 compatible" >&5
 $as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
-if test "${ac_cv_header_sys_wait_h+set}" = set; then
+if test "${ac_cv_header_sys_wait_h+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -8785,201 +8216,28 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
   ac_cv_header_sys_wait_h=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_header_sys_wait_h=no
+  ac_cv_header_sys_wait_h=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_wait_h" >&5
 $as_echo "$ac_cv_header_sys_wait_h" >&6; }
 if test $ac_cv_header_sys_wait_h = yes; then
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_SYS_WAIT_H 1
-_ACEOF
+$as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 
 fi
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
 for ac_header in limits.h paths.h sys/file.h crt_externs.h fcntl.h sys/fcntl.h sys/cdefs.h err.h sys/socket.h \
 	readline/readline.h readline/history.h pwd.h sys/paths.h utime.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------------ ##
-## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
@@ -8992,110 +8250,12 @@
 INCLUDES="-I.. -I. $INCLUDES"
 
 # Checks for library functions.
-
-
-
-
-
-
-
-
-
-
-
 for ac_func in bzero memset fgetln lockf flock setmode strcasecmp strncasecmp strlcpy copyfile clearenv
-do
-as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
-$as_echo_n "checking for $ac_func... " >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  eval "$as_ac_var=yes"
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	eval "$as_ac_var=no"
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-as_val=`eval 'as_val=${'$as_ac_var'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
@@ -9104,21 +8264,17 @@
 done
 
 
-	{ $as_echo "$as_me:$LINENO: checking if readlink conforms to POSIX 1003.1a" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if readlink conforms to POSIX 1003.1a" >&5
 $as_echo_n "checking if readlink conforms to POSIX 1003.1a... " >&6; }
 
-	if test "${mp_cv_readlink_is_posix_1003_1a+set}" = set; then
+	if test "${mp_cv_readlink_is_posix_1003_1a+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-		cat >conftest.$ac_ext <<_ACEOF
-
-			/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+
 					#include <unistd.h>
 					ssize_t readlink(const char *, char *, size_t);
 
@@ -9132,50 +8288,27 @@
 }
 
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
 
 				mp_cv_readlink_is_posix_1003_1a="yes"
 
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-
 				mp_cv_readlink_is_posix_1003_1a="no"
 
 
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
 
 
-	{ $as_echo "$as_me:$LINENO: result: ${mp_cv_readlink_is_posix_1003_1a}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${mp_cv_readlink_is_posix_1003_1a}" >&5
 $as_echo "${mp_cv_readlink_is_posix_1003_1a}" >&6; }
 
 	if test x"${mp_cv_readlink_is_posix_1003_1a}" = "xno"; then
 
-cat >>confdefs.h <<\_ACEOF
-#define READLINK_IS_NOT_P1003_1A /**/
-_ACEOF
+$as_echo "#define READLINK_IS_NOT_P1003_1A /**/" >>confdefs.h
 
 	fi
 
@@ -9183,21 +8316,23 @@
 
 
 # Check for md5 implementation
+ac_fn_c_check_header_mongrel "$LINENO" "CommonCrypto/CommonDigest.h" "ac_cv_header_CommonCrypto_CommonDigest_h" "$ac_includes_default"
+if test "x$ac_cv_header_CommonCrypto_CommonDigest_h" = x""yes; then :
 
+$as_echo "#define HAVE_COMMONCRYPTO_COMMONDIGEST_H 1" >>confdefs.h
 
+else
+
+
 	# Check for libmd, which is prefered
-	{ $as_echo "$as_me:$LINENO: checking for MD5Update in -lmd" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5Update in -lmd" >&5
 $as_echo_n "checking for MD5Update in -lmd... " >&6; }
-if test "${ac_cv_lib_md_MD5Update+set}" = set; then
+if test "${ac_cv_lib_md_MD5Update+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lmd  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -9215,496 +8350,73 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_md_MD5Update=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_md_MD5Update=no
+  ac_cv_lib_md_MD5Update=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_md_MD5Update" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_md_MD5Update" >&5
 $as_echo "$ac_cv_lib_md_MD5Update" >&6; }
-if test "x$ac_cv_lib_md_MD5Update" = x""yes; then
+if test "x$ac_cv_lib_md_MD5Update" = x""yes; then :
 
-
-for ac_header in md5.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------------ ##
-## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
+		for ac_header in md5.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "md5.h" "ac_cv_header_md5_h" "$ac_includes_default"
+if test "x$ac_cv_header_md5_h" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define HAVE_MD5_H 1
 _ACEOF
 
 else
 
 			case $host_os in
 				darwin*)
-					{ $as_echo "$as_me:$LINENO: Please install the BSD SDK package from the Xcode Developer Tools CD." >&5
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: Please install the BSD SDK package from the Xcode Developer Tools CD." >&5
 $as_echo "$as_me: Please install the BSD SDK package from the Xcode Developer Tools CD." >&6;}
 					;;
 				*)
-					{ $as_echo "$as_me:$LINENO: Please install the libmd developer headers for your platform." >&5
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: Please install the libmd developer headers for your platform." >&5
 $as_echo "$as_me: Please install the libmd developer headers for your platform." >&6;}
 					;;
 			esac
-			{ { $as_echo "$as_me:$LINENO: error: libmd was found, but md5.h is missing." >&5
-$as_echo "$as_me: error: libmd was found, but md5.h is missing." >&2;}
-   { (exit 1); exit 1; }; }
+			as_fn_error "libmd was found, but md5.h is missing." "$LINENO" 5
 
 fi
 
 done
 
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBMD /**/
-_ACEOF
+$as_echo "#define HAVE_LIBMD /**/" >>confdefs.h
 
 		MD5_LIBS="-lmd"
 
 fi
 
-	if test "x$MD5_LIBS" = "x" ; then
-		# If libmd is not found, check for libcrypto from OpenSSL
-		{ $as_echo "$as_me:$LINENO: checking for MD5_Update in -lcrypto" >&5
-$as_echo_n "checking for MD5_Update in -lcrypto... " >&6; }
-if test "${ac_cv_lib_crypto_MD5_Update+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+	if test "x$MD5_LIBS" = "x"; then
+		as_fn_error "Neither CommonCrypto nor libmd were found. A working md5 implementation is required." "$LINENO" 5
+	fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char MD5_Update ();
-int
-main ()
-{
-return MD5_Update ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_crypto_MD5_Update=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_crypto_MD5_Update=no
 fi
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_MD5_Update" >&5
-$as_echo "$ac_cv_lib_crypto_MD5_Update" >&6; }
-if test "x$ac_cv_lib_crypto_MD5_Update" = x""yes; then
 
 
-for ac_header in openssl/md5.h
-do
-as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
-$as_echo_n "checking $ac_header usability... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
-$as_echo_n "checking $ac_header presence... " >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------------ ##
-## Report this to macports-dev at lists.macosforge.org ##
-## ------------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
-$as_echo_n "checking for $ac_header... " >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  $as_echo_n "(cached) " >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-	       { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-
-fi
-as_val=`eval 'as_val=${'$as_ac_Header'}
-		 $as_echo "$as_val"'`
-   if test "x$as_val" = x""yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-else
-
-				case $host_os in
-					darwin*)
-					{ $as_echo "$as_me:$LINENO: Please install the BSD SDK package from the Xcode Developer Tools CD." >&5
-$as_echo "$as_me: Please install the BSD SDK package from the Xcode Developer Tools CD." >&6;}
-						;;
-					*)
-					{ $as_echo "$as_me:$LINENO: Please install the libmd developer headers for your platform." >&5
-$as_echo "$as_me: Please install the libmd developer headers for your platform." >&6;}
-						;;
-				esac
-				{ { $as_echo "$as_me:$LINENO: error: libcrypt was found, but header file openssl/md5.h is missing." >&5
-$as_echo "$as_me: error: libcrypt was found, but header file openssl/md5.h is missing." >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-
-done
-
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBCRYPTO /**/
-_ACEOF
-
-			MD5_LIBS="-lcrypto"
-
-else
-
-			{ { $as_echo "$as_me:$LINENO: error: Neither OpenSSL or libmd were found. A working md5 implementation is required." >&5
-$as_echo "$as_me: error: Neither OpenSSL or libmd were found. A working md5 implementation is required." >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-
-	fi
-	if test "x$MD5_LIBS" = "x"; then
-		{ { $as_echo "$as_me:$LINENO: error: Neither OpenSSL or libmd were found. A working md5 implementation is required." >&5
-$as_echo "$as_me: error: Neither OpenSSL or libmd were found. A working md5 implementation is required." >&2;}
-   { (exit 1); exit 1; }; }
-	fi
-
-
-
 # Check for readline
 # Check whether --enable-readline was given.
-if test "${enable_readline+set}" = set; then
+if test "${enable_readline+set}" = set; then :
   enableval=$enable_readline;
-	{ $as_echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5
 $as_echo_n "checking for readline in -lreadline... " >&6; }
-if test "${ac_cv_lib_readline_readline+set}" = set; then
+if test "${ac_cv_lib_readline_readline+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lreadline  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 /* Override any GCC internal prototype to avoid an error.
@@ -9722,508 +8434,134 @@
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
+if ac_fn_c_try_link "$LINENO"; then :
   ac_cv_lib_readline_readline=yes
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_readline_readline=no
+  ac_cv_lib_readline_readline=no
 fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
 $as_echo "$ac_cv_lib_readline_readline" >&6; }
-if test "x$ac_cv_lib_readline_readline" = x""yes; then
+if test "x$ac_cv_lib_readline_readline" = x""yes; then :
 
 				  READLINE_LIBS=-lreadline
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LIBREADLINE 1
-_ACEOF
+$as_echo "#define HAVE_LIBREADLINE 1" >>confdefs.h
 
 
 fi
 
-	{ $as_echo "$as_me:$LINENO: checking whether rl_username_completion_function is declared" >&5
-$as_echo_n "checking whether rl_username_completion_function is declared... " >&6; }
-if test "${ac_cv_have_decl_rl_username_completion_function+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+	ac_fn_c_check_decl "$LINENO" "rl_username_completion_function" "ac_cv_have_decl_rl_username_completion_function" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef rl_username_completion_function
-  (void) rl_username_completion_function;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_rl_username_completion_function=yes
+"
+if test "x$ac_cv_have_decl_rl_username_completion_function" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_rl_username_completion_function=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_rl_username_completion_function" >&5
-$as_echo "$ac_cv_have_decl_rl_username_completion_function" >&6; }
-if test "x$ac_cv_have_decl_rl_username_completion_function" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_USERNAME_COMPLETION_FUNCTION 1
+#define HAVE_DECL_RL_USERNAME_COMPLETION_FUNCTION $ac_have_decl
 _ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_USERNAME_COMPLETION_FUNCTION 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether rl_filename_completion_function is declared" >&5
-$as_echo_n "checking whether rl_filename_completion_function is declared... " >&6; }
-if test "${ac_cv_have_decl_rl_filename_completion_function+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+ac_fn_c_check_decl "$LINENO" "rl_filename_completion_function" "ac_cv_have_decl_rl_filename_completion_function" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef rl_filename_completion_function
-  (void) rl_filename_completion_function;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_rl_filename_completion_function=yes
+"
+if test "x$ac_cv_have_decl_rl_filename_completion_function" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_rl_filename_completion_function=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_rl_filename_completion_function" >&5
-$as_echo "$ac_cv_have_decl_rl_filename_completion_function" >&6; }
-if test "x$ac_cv_have_decl_rl_filename_completion_function" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_FILENAME_COMPLETION_FUNCTION 1
+#define HAVE_DECL_RL_FILENAME_COMPLETION_FUNCTION $ac_have_decl
 _ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_FILENAME_COMPLETION_FUNCTION 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether rl_completion_matches is declared" >&5
-$as_echo_n "checking whether rl_completion_matches is declared... " >&6; }
-if test "${ac_cv_have_decl_rl_completion_matches+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+ac_fn_c_check_decl "$LINENO" "rl_completion_matches" "ac_cv_have_decl_rl_completion_matches" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef rl_completion_matches
-  (void) rl_completion_matches;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_rl_completion_matches=yes
+"
+if test "x$ac_cv_have_decl_rl_completion_matches" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_rl_completion_matches=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_rl_completion_matches" >&5
-$as_echo "$ac_cv_have_decl_rl_completion_matches" >&6; }
-if test "x$ac_cv_have_decl_rl_completion_matches" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_COMPLETION_MATCHES 1
+#define HAVE_DECL_RL_COMPLETION_MATCHES $ac_have_decl
 _ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_RL_COMPLETION_MATCHES 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether username_completion_function is declared" >&5
-$as_echo_n "checking whether username_completion_function is declared... " >&6; }
-if test "${ac_cv_have_decl_username_completion_function+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+ac_fn_c_check_decl "$LINENO" "username_completion_function" "ac_cv_have_decl_username_completion_function" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef username_completion_function
-  (void) username_completion_function;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_username_completion_function=yes
+"
+if test "x$ac_cv_have_decl_username_completion_function" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_username_completion_function=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_username_completion_function" >&5
-$as_echo "$ac_cv_have_decl_username_completion_function" >&6; }
-if test "x$ac_cv_have_decl_username_completion_function" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_USERNAME_COMPLETION_FUNCTION 1
+#define HAVE_DECL_USERNAME_COMPLETION_FUNCTION $ac_have_decl
 _ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_USERNAME_COMPLETION_FUNCTION 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether filename_completion_function is declared" >&5
-$as_echo_n "checking whether filename_completion_function is declared... " >&6; }
-if test "${ac_cv_have_decl_filename_completion_function+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+ac_fn_c_check_decl "$LINENO" "filename_completion_function" "ac_cv_have_decl_filename_completion_function" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef filename_completion_function
-  (void) filename_completion_function;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_filename_completion_function=yes
+"
+if test "x$ac_cv_have_decl_filename_completion_function" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_filename_completion_function=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_filename_completion_function" >&5
-$as_echo "$ac_cv_have_decl_filename_completion_function" >&6; }
-if test "x$ac_cv_have_decl_filename_completion_function" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_FILENAME_COMPLETION_FUNCTION 1
+#define HAVE_DECL_FILENAME_COMPLETION_FUNCTION $ac_have_decl
 _ACEOF
-
-
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_FILENAME_COMPLETION_FUNCTION 0
-_ACEOF
-
-
-fi
-{ $as_echo "$as_me:$LINENO: checking whether completion_matches is declared" >&5
-$as_echo_n "checking whether completion_matches is declared... " >&6; }
-if test "${ac_cv_have_decl_completion_matches+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
+ac_fn_c_check_decl "$LINENO" "completion_matches" "ac_cv_have_decl_completion_matches" "
 	#include <stdio.h>
 	#if HAVE_READLINE_READLINE_H
 	# include <readline/readline.h>
 	#endif
 
-
-int
-main ()
-{
-#ifndef completion_matches
-  (void) completion_matches;
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_have_decl_completion_matches=yes
+"
+if test "x$ac_cv_have_decl_completion_matches" = x""yes; then :
+  ac_have_decl=1
 else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_have_decl_completion_matches=no
+  ac_have_decl=0
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_completion_matches" >&5
-$as_echo "$ac_cv_have_decl_completion_matches" >&6; }
-if test "x$ac_cv_have_decl_completion_matches" = x""yes; then
-
 cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_COMPLETION_MATCHES 1
+#define HAVE_DECL_COMPLETION_MATCHES $ac_have_decl
 _ACEOF
 
 
-else
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_COMPLETION_MATCHES 0
-_ACEOF
-
-
 fi
 
 
 
-fi
-
-
-
 # Lowest non-system-reserved uid and gid (Apple claims <500)
 
-cat >>confdefs.h <<\_ACEOF
-#define MIN_USABLE_UID 500
-_ACEOF
+$as_echo "#define MIN_USABLE_UID 500" >>confdefs.h
 
 
-cat >>confdefs.h <<\_ACEOF
-#define MIN_USABLE_GID 500
-_ACEOF
+$as_echo "#define MIN_USABLE_GID 500" >>confdefs.h
 
 
 # Load tclConfig.sh
@@ -10239,13 +8577,13 @@
 	no_tcl=true
 
 # Check whether --with-tcl was given.
-if test "${with_tcl+set}" = set; then
+if test "${with_tcl+set}" = set; then :
   withval=$with_tcl; with_tclconfig=${withval}
 fi
 
-	{ $as_echo "$as_me:$LINENO: checking for Tcl configuration" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl configuration" >&5
 $as_echo_n "checking for Tcl configuration... " >&6; }
-	if test "${ac_cv_c_tclconfig+set}" = set; then
+	if test "${ac_cv_c_tclconfig+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10255,9 +8593,7 @@
 		if test -f "${with_tclconfig}/tclConfig.sh" ; then
 		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
 		else
-		    { { $as_echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
-$as_echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
-   { (exit 1); exit 1; }; }
+		    as_fn_error "${with_tclconfig} directory doesn't contain tclConfig.sh" "$LINENO" 5
 		fi
 	    fi
 
@@ -10280,15 +8616,14 @@
 	    # check in a few common install locations
 	    if test x"${ac_cv_c_tclconfig}" = x ; then
 		for i in `ls -d ${libdir} 2>/dev/null` \
+			`ls -d /usr/lib 2>/dev/null` \
 			`ls -d /usr/local/lib 2>/dev/null` \
 			`ls -d /usr/contrib/lib 2>/dev/null` \
-			`ls -d /usr/lib 2>/dev/null` \
 			`ls -d /usr/pkg/lib 2>/dev/null` \
-			`ls -d /System/Library/Tcl/8.3 2>/dev/null` \
+			`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/local/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.3 2>/dev/null` \
+			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.3 2>/dev/null` \
 			; do
 		    if test -f "$i/tclConfig.sh" ; then
 			ac_cv_c_tclconfig=`(cd $i; pwd)`
@@ -10314,27 +8649,25 @@
 
 	if test x"${ac_cv_c_tclconfig}" = x ; then
 	    TCL_BIN_DIR="# no Tcl configs found"
-	    { { $as_echo "$as_me:$LINENO: error: Can't find Tcl configuration definitions" >&5
-$as_echo "$as_me: error: Can't find Tcl configuration definitions" >&2;}
-   { (exit 1); exit 1; }; }
+	    as_fn_error "Can't find Tcl configuration definitions" "$LINENO" 5
 	else
 	    no_tcl=
 	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
-	    { $as_echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
+	    { $as_echo "$as_me:${as_lineno-$LINENO}: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
 $as_echo "found $TCL_BIN_DIR/tclConfig.sh" >&6; }
 	fi
     fi
 
 
-    { $as_echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
 $as_echo_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh... " >&6; }
 
     if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
-        { $as_echo "$as_me:$LINENO: result: loading" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: loading" >&5
 $as_echo "loading" >&6; }
 	. $TCL_BIN_DIR/tclConfig.sh
     else
-        { $as_echo "$as_me:$LINENO: result: file not found" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: file not found" >&5
 $as_echo "file not found" >&6; }
     fi
 
@@ -10381,12 +8714,12 @@
 # Check for Tcl public headers
 CYGPATH=echo
 
-    { $as_echo "$as_me:$LINENO: checking for Tcl public headers" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl public headers" >&5
 $as_echo_n "checking for Tcl public headers... " >&6; }
 
 
 # Check whether --with-tclinclude was given.
-if test "${with_tclinclude+set}" = set; then
+if test "${with_tclinclude+set}" = set; then :
   withval=$with_tclinclude; with_tclinclude=${withval}
 fi
 
@@ -10395,12 +8728,10 @@
 	if test -f "${with_tclinclude}/tcl.h" ; then
 	    ac_cv_c_tclh=${with_tclinclude}
 	else
-	    { { $as_echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain Tcl public header file tcl.h" >&5
-$as_echo "$as_me: error: ${with_tclinclude} directory does not contain Tcl public header file tcl.h" >&2;}
-   { (exit 1); exit 1; }; }
+	    as_fn_error "${with_tclinclude} directory does not contain Tcl public header file tcl.h" "$LINENO" 5
 	fi
     else
-	if test "${ac_cv_c_tclh+set}" = set; then
+	if test "${ac_cv_c_tclh+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10415,7 +8746,7 @@
 		# check some other possible local system locations.
 
 		for i in \
-			/usr/local/include /usr/include /usr/local/include/tcl${TCL_VERSION} /usr/include/tcl${TCL_VERSION}; do
+			/usr/include /usr/local/include /usr/local/include/tcl${TCL_VERSION} /usr/include/tcl${TCL_VERSION}; do
 		    if test -f "$i/tcl.h" ; then
 			ac_cv_c_tclh=$i
 			break
@@ -10430,11 +8761,9 @@
     # Print a message based on how we determined the include path
 
     if test x"${ac_cv_c_tclh}" = x ; then
-	{ { $as_echo "$as_me:$LINENO: error: tcl.h not found.  Please specify its location with --with-tclinclude" >&5
-$as_echo "$as_me: error: tcl.h not found.  Please specify its location with --with-tclinclude" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "tcl.h not found.  Please specify its location with --with-tclinclude" "$LINENO" 5
     else
-	{ $as_echo "$as_me:$LINENO: result: ${ac_cv_c_tclh}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclh}" >&5
 $as_echo "${ac_cv_c_tclh}" >&6; }
     fi
 
@@ -10458,9 +8787,9 @@
 			# Look for a real versioned tclsh without threads second
 			# Extract the first word of "tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh", so it can be a program name with args.
 set dummy tclsh${TCL_VERSION}-threads tclsh${TCL_VERSION} tclsh; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TCLSH+set}" = set; then
+if test "${ac_cv_path_TCLSH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TCLSH in
@@ -10473,14 +8802,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -10488,10 +8817,10 @@
 fi
 TCLSH=$ac_cv_path_TCLSH
 if test -n "$TCLSH"; then
-  { $as_echo "$as_me:$LINENO: result: $TCLSH" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
 $as_echo "$TCLSH" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -10501,9 +8830,9 @@
 			# Otherwise, look for a non-versioned tclsh
 			# Extract the first word of "tclsh tclsh${TCL_VERSION}", so it can be a program name with args.
 set dummy tclsh tclsh${TCL_VERSION}; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_TCLSH+set}" = set; then
+if test "${ac_cv_path_TCLSH+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $TCLSH in
@@ -10516,14 +8845,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -10531,10 +8860,10 @@
 fi
 TCLSH=$ac_cv_path_TCLSH
 if test -n "$TCLSH"; then
-  { $as_echo "$as_me:$LINENO: result: $TCLSH" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5
 $as_echo "$TCLSH" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -10542,9 +8871,7 @@
 			;;
 	esac
 	if test "x$TCLSH" = "x" ; then
-		{ { $as_echo "$as_me:$LINENO: error: Could not find tclsh" >&5
-$as_echo "$as_me: error: Could not find tclsh" >&2;}
-   { (exit 1); exit 1; }; }
+		as_fn_error "Could not find tclsh" "$LINENO" 5
 	fi
 
 
@@ -10554,12 +8881,12 @@
 
 
 
-    { $as_echo "$as_me:$LINENO: checking for Tcl package directory" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl package directory" >&5
 $as_echo_n "checking for Tcl package directory... " >&6; }
 
 
 # Check whether --with-tclpackage was given.
-if test "${with_tclpackage+set}" = set; then
+if test "${with_tclpackage+set}" = set; then :
   withval=$with_tclpackage; with_tclpackagedir=${withval}
 fi
 
@@ -10567,7 +8894,7 @@
     if test x"${with_tclpackagedir}" != x ; then
 	ac_cv_c_tclpkgd=${with_tclpackagedir}
     else
-	if test "${ac_cv_c_tclpkgd+set}" = set; then
+	if test "${ac_cv_c_tclpkgd+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10615,11 +8942,9 @@
     fi
 
     if test x"${ac_cv_c_tclpkgd}" = x ; then
-	{ { $as_echo "$as_me:$LINENO: error: Tcl package directory not found.  Please specify its location with --with-tclpackage" >&5
-$as_echo "$as_me: error: Tcl package directory not found.  Please specify its location with --with-tclpackage" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "Tcl package directory not found.  Please specify its location with --with-tclpackage" "$LINENO" 5
     else
-	{ $as_echo "$as_me:$LINENO: result: ${ac_cv_c_tclpkgd}" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_c_tclpkgd}" >&5
 $as_echo "${ac_cv_c_tclpkgd}" >&6; }
     fi
 
@@ -10634,18 +8959,16 @@
 
 # Check if thread is enabled.
 
-	{ $as_echo "$as_me:$LINENO: checking whether tclsh was compiled with threads" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tclsh was compiled with threads" >&5
 $as_echo_n "checking whether tclsh was compiled with threads... " >&6; }
 	tcl_threadenabled=`echo 'puts -nonewline [info exists tcl_platform(threaded)]' | $TCLSH`
 	if test "$tcl_threadenabled" = "1" ; then
-		{ $as_echo "$as_me:$LINENO: result: yes" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
 	else
-		{ $as_echo "$as_me:$LINENO: result: no" >&5
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-		{ { $as_echo "$as_me:$LINENO: error: tcl wasn't compiled with threads enabled" >&5
-$as_echo "$as_me: error: tcl wasn't compiled with threads enabled" >&2;}
-   { (exit 1); exit 1; }; }
+		as_fn_error "tcl wasn't compiled with threads enabled" "$LINENO" 5
 	fi
 
 
@@ -10653,7 +8976,7 @@
 
 
 # Check whether --with-curlprefix was given.
-if test "${with_curlprefix+set}" = set; then
+if test "${with_curlprefix+set}" = set; then :
   withval=$with_curlprefix;   curlprefix=$withval
 fi
 
@@ -10661,9 +8984,9 @@
 	if test "x$curlprefix" = "x"; then
 		# Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CURL_CONFIG+set}" = set; then
+if test "${ac_cv_path_CURL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CURL_CONFIG in
@@ -10676,14 +8999,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -10691,10 +9014,10 @@
 fi
 CURL_CONFIG=$ac_cv_path_CURL_CONFIG
 if test -n "$CURL_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL_CONFIG" >&5
 $as_echo "$CURL_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -10702,9 +9025,9 @@
 	else
 		# Extract the first word of "curl-config", so it can be a program name with args.
 set dummy curl-config; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_CURL_CONFIG+set}" = set; then
+if test "${ac_cv_path_CURL_CONFIG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   case $CURL_CONFIG in
@@ -10717,14 +9040,14 @@
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CURL_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
   ;;
@@ -10732,10 +9055,10 @@
 fi
 CURL_CONFIG=$ac_cv_path_CURL_CONFIG
 if test -n "$CURL_CONFIG"; then
-  { $as_echo "$as_me:$LINENO: result: $CURL_CONFIG" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CURL_CONFIG" >&5
 $as_echo "$CURL_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
@@ -10743,201 +9066,188 @@
 	fi
 
 	if test "x$CURL_CONFIG" = "x"; then
-		{ { $as_echo "$as_me:$LINENO: error: cannot find curl-config. Is libcurl installed?" >&5
-$as_echo "$as_me: error: cannot find curl-config. Is libcurl installed?" >&2;}
-   { (exit 1); exit 1; }; }
+		as_fn_error "cannot find curl-config. Is libcurl installed?" "$LINENO" 5
 	fi
 
 	CFLAGS_LIBCURL=$($CURL_CONFIG --cflags)
-	# Due to a bug in dist, --arch flags are improperly supplied by curl-config.
-	# Get rid of them.
-	LDFLAGS_LIBCURL=$($CURL_CONFIG --libs | sed 's/-arch [A-Za-z0-9_]* //g')
+	if test "x$curlprefix" = "x"; then
+		# System curl-config emits absurd output for --libs
+		# See rdar://7244457
+		LDFLAGS_LIBCURL="-lcurl"
+	else
+		# Due to a bug in dist, --arch flags are improperly supplied by curl-config.
+		# Get rid of them.
+		LDFLAGS_LIBCURL=$($CURL_CONFIG --libs | sed 's/-arch [A-Za-z0-9_]* //g')
+	fi
 
 
 
 
 
-# Determine if we need to install some bundled packages
-OUR_INCLUDED_PACKAGES=
+## sqlite3
 
-## Thread package.
+    # first sqlite3 itself
 
-# Check whether --with-included-tclthread was given.
-if test "${with_included_tclthread+set}" = set; then
-  withval=$with_included_tclthread; with_included_tclthread=$withval
-else
-  with_included_tclthread="unspecified"
+# Check whether --with-sqlite3prefix was given.
+if test "${with_sqlite3prefix+set}" = set; then :
+  withval=$with_sqlite3prefix;   sqlite3prefix=$withval
 fi
 
 
-# Check if thread package is already installed.
-if test "x$with_included_tclthread" = "xunspecified" ; then
+	if test "x$sqlite3prefix" = "x"; then
+		# Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-	{ $as_echo "$as_me:$LINENO: checking for Tcl Thread package" >&5
-$as_echo_n "checking for Tcl Thread package... " >&6; }
-	package_present=`echo 'if {[catch {package require Thread}]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
-	if test "$package_present" = "1"; then
-  { $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }; with_included_tclthread=no
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }; with_included_tclthread=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+		if test "x$PKG_CONFIG" = "x" || ! $PKG_CONFIG --exists sqlite3; then
+		    # assume it's somewhere like /usr that needs no extra flags
+		    ac_fn_c_check_header_mongrel "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
+if test "x$ac_cv_header_sqlite3_h" = x""yes; then :
+
+else
+  as_fn_error "cannot find sqlite3 header" "$LINENO" 5
 fi
 
-# If thread package isn't installed, configure and install thread package.
-if test "$with_included_tclthread" = "yes"; then
-	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
 
+            CFLAGS_SQLITE3=""
+		    LDFLAGS_SQLITE3="-lsqlite3"
+        else
+            CFLAGS_SQLITE3=$($PKG_CONFIG --cflags sqlite3)
+            LDFLAGS_SQLITE3=$($PKG_CONFIG --libs sqlite3)
+            # for tclsqlite below
+            mp_sqlite3_dir=$($PKG_CONFIG --variable=prefix sqlite3)
+            if test "x$mp_sqlite3_dir" = "x"; then
+                mp_sqlite3_dir=${mp_sqlite3_dir}/lib/sqlite3
+            fi
+        fi
+	else
+	    CFLAGS_SQLITE3="-I${sqlite3prefix}/include"
+		LDFLAGS_SQLITE3="-L${sqlite3prefix}/lib -lsqlite3"
+	fi
 
-subdirs="$subdirs src/thread2.6"
 
-	# Extract thread package
-	(cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
-	# Patch thread package (so thread2.6 is the vanilla distribution directory)
-	patch -p0 < src/thread2.6.diff
-fi
 
-## sqlite3 package.
 
-# Check whether --with-included-sqlite3 was given.
-if test "${with_included_sqlite3+set}" = set; then
-  withval=$with_included_sqlite3; with_included_sqlite3=$withval
-else
-  with_included_sqlite3="unspecified"
+	# now the sqlite Tcl bindings
+
+# Check whether --with-tcl-sqlite3 was given.
+if test "${with_tcl_sqlite3+set}" = set; then :
+  withval=$with_tcl_sqlite3; mp_sqlite3_dir=$withval
 fi
 
 
-# Check if sqlite3 package is already installed.
-if test "x$with_included_sqlite3" = "xunspecified" ; then
-	{ $as_echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5
-$as_echo_n "checking for sqlite3_open in -lsqlite3... " >&6; }
-if test "${ac_cv_lib_sqlite3_sqlite3_open+set}" = set; then
+    if test "x$mp_sqlite3_dir" = "x"; then
+        case $host_os in
+            darwin*)
+                mp_sqlite3_dir="/usr/lib/sqlite3"
+                ;;
+            freebsd*)
+                mp_sqlite3_dir="/usr/local/lib/sqlite"
+                ;;
+            *)
+                mp_sqlite3_dir="/usr/share/tcl${TCL_VERSION}/sqlite3"
+                ;;
+        esac
+    fi
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl sqlite3 location" >&5
+$as_echo_n "checking for Tcl sqlite3 location... " >&6; }
+if test "${mp_cv_sqlite3_dir+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsqlite3  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  mp_cv_sqlite3_dir=
+		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char sqlite3_open ();
-int
-main ()
-{
-return sqlite3_open ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-	 test "$cross_compiling" = yes ||
-	 $as_test_x conftest$ac_exeext
-       }; then
-  ac_cv_lib_sqlite3_sqlite3_open=yes
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_sqlite3_sqlite3_open=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $mp_cv_sqlite3_dir" >&5
+$as_echo "$mp_cv_sqlite3_dir" >&6; }
 
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_sqlite3_sqlite3_open" >&5
-$as_echo "$ac_cv_lib_sqlite3_sqlite3_open" >&6; }
-if test "x$ac_cv_lib_sqlite3_sqlite3_open" = x""yes; then
-  with_included_sqlite3=no
-else
-  with_included_sqlite3=yes
-fi
+	SQLITE3_TCL_DIR=$mp_cv_sqlite3_dir
 
-fi
 
 
-# Check whether --with-tcl-sqlite3 was given.
-if test "${with_tcl_sqlite3+set}" = set; then
-  withval=$with_tcl_sqlite3; mp_sqlite3_dir=$withval
+# Determine if we need to install some bundled packages
+OUR_INCLUDED_PACKAGES=
+
+## Thread package.
+
+# Check whether --with-included-tclthread was given.
+if test "${with_included_tclthread+set}" = set; then :
+  withval=$with_included_tclthread; with_included_tclthread=$withval
 else
-  mp_sqlite3_dir=/usr/lib/sqlite3
+  with_included_tclthread="unspecified"
 fi
 
 
-# If sqlite3 package isn't installed, configure and install sqlite3 package.
-if test "$with_included_sqlite3" = "yes"; then
-	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
-	INCLUDES="$INCLUDES -I../sqlite-3.1.3"
-	subdirs="$subdirs src/sqlite-3.1.3"
+# Check if thread package is already installed.
+if test "x$with_included_tclthread" = "xunspecified" ; then
 
-	# Extract sqlite3 package
-	(cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
-	# patch sqlite3 with desired configure options
-	patch -p0 < src/sqlite-3.1.3.diff
-	# the new tclinstaller.tcl needs to have substitution occur
-	mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
-	SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
-	if test "x$prefix" = "xNONE" ; then
-		SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
-	else
-		SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
-	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl Thread package" >&5
+$as_echo_n "checking for Tcl Thread package... " >&6; }
+	package_present=`echo 'if {[catch {package require Thread}]} {puts -nonewline 0} else {puts -nonewline 1}' | $TCLSH`
+	if test "$package_present" = "1"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; with_included_tclthread=no
 else
-	SQLITE3_LIBS="-lsqlite3"
-
-	{ $as_echo "$as_me:$LINENO: checking for Tcl sqlite3 location" >&5
-$as_echo_n "checking for Tcl sqlite3 location... " >&6; }
-if test "${mp_cv_sqlite3_dir+set}" = set; then
-  $as_echo_n "(cached) " >&6
-else
-  mp_cv_sqlite3_dir=
-		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
-
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }; with_included_tclthread=yes
 fi
-{ $as_echo "$as_me:$LINENO: result: $mp_cv_sqlite3_dir" >&5
-$as_echo "$mp_cv_sqlite3_dir" >&6; }
 
-	SQLITE3_DIR=$mp_cv_sqlite3_dir
 fi
 
+# If thread package isn't installed, configure and install thread package.
+if test "$with_included_tclthread" = "yes"; then
+	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES thread2.6"
 
 
+subdirs="$subdirs src/thread2.6"
 
+	# Extract thread package
+	(cd src/; gzip -d < thread2.6.tar.gz | tar xf -)
+	# Patch thread package (so thread2.6 is the vanilla distribution directory)
+	patch -p0 < src/thread2.6.diff
+fi
 
 
 
 # Check whether --with-trace-sdk was given.
-if test "${with_trace_sdk+set}" = set; then
+if test "${with_trace_sdk+set}" = set; then :
   withval=$with_trace_sdk; test -d ${DEVELOPER_DIR}/SDKs/$withval && cat >>confdefs.h <<_ACEOF
 #define TRACE_SDK "${withval}"
 _ACEOF
@@ -10947,10 +9257,10 @@
 
 # Allows building of shared libraries
 
-    { $as_echo "$as_me:$LINENO: checking how to build libraries" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to build libraries" >&5
 $as_echo_n "checking how to build libraries... " >&6; }
     # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
+if test "${enable_shared+set}" = set; then :
   enableval=$enable_shared; tcl_ok=$enableval
 else
   tcl_ok=yes
@@ -10965,17 +9275,15 @@
     fi
 
     if test "$tcl_ok" = "yes" ; then
-	{ $as_echo "$as_me:$LINENO: result: shared" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: shared" >&5
 $as_echo "shared" >&6; }
 	SHARED_BUILD=1
     else
-	{ $as_echo "$as_me:$LINENO: result: static" >&5
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
 $as_echo "static" >&6; }
 	SHARED_BUILD=0
 
-cat >>confdefs.h <<\_ACEOF
-#define STATIC_BUILD 1
-_ACEOF
+$as_echo "#define STATIC_BUILD 1" >>confdefs.h
 
     fi
 
@@ -11007,6 +9315,22 @@
    prefix=$ac_default_prefix
 fi
 
+# Check if there's an existing DP/MP install too old to upgrade
+
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that any existing MacPorts install can be upgraded" >&5
+$as_echo_n "checking that any existing MacPorts install can be upgraded... " >&6; }
+
+	eval dpversionfile="${sysconfdir}/ports/dp_version"
+	if test -f $dpversionfile; then
+		as_fn_error "Existing MacPorts or DarwinPorts install is too old to be upgraded. Install MacPorts 1.7.1 first." "$LINENO" 5
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	fi
+
+
+
 eval "prefix_expanded=$prefix"
 
 # do this twice, since there is a nested variable of
@@ -11016,12 +9340,15 @@
 
 eval "localstatedir_expanded=$localstatedir"
 
+eval "macports_tcl_dir=${datadir}/macports/Tcl"
+eval "macports_tcl_dir=$macports_tcl_dir"
 
+
 prefix=$oldprefix
 
 
 # Output
-ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/macports.conf doc/asciidoc.conf portmgr/freebsd/Makefile portmgr/fedora/macports.spec src/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry1.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
+ac_config_files="$ac_config_files Doxyfile Makefile Mk/macports.autoconf.mk doc/prefix.mtree doc/macosx.mtree doc/macports.conf portmgr/freebsd/Makefile src/Makefile src/macports1.0/macports_autoconf.tcl src/port1.0/port_autoconf.tcl src/registry2.0/registry_autoconf.tcl src/programs/Makefile src/macports1.0/macports_fastload.tcl setupenv.bash"
 
 
 ac_config_files="$ac_config_files src/pkg_mkindex.sh"
@@ -11054,13 +9381,13 @@
     case $ac_val in #(
     *${as_nl}*)
       case $ac_var in #(
-      *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
       esac
       case $ac_var in #(
       _ | IFS | as_nl) ;; #(
       BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
-      *) $as_unset $ac_var ;;
+      *) { eval $ac_var=; unset $ac_var;} ;;
       esac ;;
     esac
   done
@@ -11068,8 +9395,8 @@
   (set) 2>&1 |
     case $as_nl`(ac_space=' '; set) 2>&1` in #(
     *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
       sed -n \
 	"s/'/'\\\\''/g;
 	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -11092,11 +9419,11 @@
 if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
   if test -w "$cache_file"; then
     test "x$cache_file" != "x/dev/null" &&
-      { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
 $as_echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
@@ -11116,8 +9443,8 @@
   ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
   # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
   #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -11129,9 +9456,10 @@
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
 #! $SHELL
 # Generated by $as_me.
 # Run this file to recreate the current configuration.
@@ -11141,17 +9469,18 @@
 debug=false
 ac_cs_recheck=false
 ac_cs_silent=false
+
 SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -11159,23 +9488,15 @@
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -11183,7 +9504,13 @@
 as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -11194,7 +9521,7 @@
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
 	expr "X$arg" : "X\\(.*\\)$as_nl";
 	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -11217,14 +9544,7 @@
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
 
-
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
 # there to prevent editors from complaining about space-tab.
@@ -11233,15 +9553,15 @@
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -11253,12 +9573,16 @@
 fi
 if test ! -f "$as_myself"; then
   $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
@@ -11270,7 +9594,89 @@
 LANGUAGE=C
 export LANGUAGE
 
-# Required to use basename.
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error ERROR [LINENO LOG_FD]
+# ---------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with status $?, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$?; test $as_status -eq 0 && as_status=1
+  if test "$3"; then
+    as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
+  fi
+  $as_echo "$as_me: error: $1" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -11284,8 +9690,12 @@
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
@@ -11305,76 +9715,25 @@
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
 ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
 -n*)
-  case `echo 'x\c'` in
+  case `echo 'xy\c'` in
   *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
   esac;;
 *)
   ECHO_N='-n';;
 esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
 
 rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
@@ -11403,8 +9762,56 @@
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
 
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
 if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
   test -d ./-p && rmdir ./-p
   as_mkdir_p=false
@@ -11423,10 +9830,10 @@
       if test -d "$1"; then
 	test -d "$1/.";
       else
-	case $1 in
+	case $1 in #(
 	-*)set "./$1";;
 	esac;
-	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
 	???[sx]*):;;*)false;;esac;fi
     '\'' sh
   '
@@ -11441,13 +9848,19 @@
 
 
 exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by MacPorts $as_me 1.8.0, which was
-generated by GNU Autoconf 2.63.  Invocation command line was
+This file was extended by MacPorts $as_me 1.8.99, which was
+generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -11478,13 +9891,15 @@
 
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-Usage: $0 [OPTION]... [FILE]...
+Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -11500,16 +9915,17 @@
 Configuration headers:
 $config_headers
 
-Report bugs to <bug-autoconf at gnu.org>."
+Report bugs to <macports-dev at lists.macosforge.org>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-MacPorts config.status 1.8.0
-configured by $0, generated by GNU Autoconf 2.63,
-  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+MacPorts config.status 1.8.99
+configured by $0, generated by GNU Autoconf 2.65,
+  with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2008 Free Software Foundation, Inc.
+Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -11543,6 +9959,8 @@
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
@@ -11550,20 +9968,19 @@
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
     ac_need_defaults=false;;
   --header | --heade | --head | --hea )
     $ac_shift
     case $ac_optarg in
     *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
-    CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
     ac_need_defaults=false;;
   --he | --h)
     # Conflict between --help and --header
-    { $as_echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
+    as_fn_error "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
   --help | --hel | -h )
     $as_echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
@@ -11571,11 +9988,10 @@
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+  -*) as_fn_error "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
-  *) ac_config_targets="$ac_config_targets $1"
+  *) as_fn_append ac_config_targets " $1"
      ac_need_defaults=false ;;
 
   esac
@@ -11629,21 +10045,17 @@
     "doc/prefix.mtree") CONFIG_FILES="$CONFIG_FILES doc/prefix.mtree" ;;
     "doc/macosx.mtree") CONFIG_FILES="$CONFIG_FILES doc/macosx.mtree" ;;
     "doc/macports.conf") CONFIG_FILES="$CONFIG_FILES doc/macports.conf" ;;
-    "doc/asciidoc.conf") CONFIG_FILES="$CONFIG_FILES doc/asciidoc.conf" ;;
     "portmgr/freebsd/Makefile") CONFIG_FILES="$CONFIG_FILES portmgr/freebsd/Makefile" ;;
-    "portmgr/fedora/macports.spec") CONFIG_FILES="$CONFIG_FILES portmgr/fedora/macports.spec" ;;
     "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
     "src/macports1.0/macports_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_autoconf.tcl" ;;
     "src/port1.0/port_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/port1.0/port_autoconf.tcl" ;;
-    "src/registry1.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry1.0/registry_autoconf.tcl" ;;
+    "src/registry2.0/registry_autoconf.tcl") CONFIG_FILES="$CONFIG_FILES src/registry2.0/registry_autoconf.tcl" ;;
     "src/programs/Makefile") CONFIG_FILES="$CONFIG_FILES src/programs/Makefile" ;;
     "src/macports1.0/macports_fastload.tcl") CONFIG_FILES="$CONFIG_FILES src/macports1.0/macports_fastload.tcl" ;;
     "setupenv.bash") CONFIG_FILES="$CONFIG_FILES setupenv.bash" ;;
     "src/pkg_mkindex.sh") CONFIG_FILES="$CONFIG_FILES src/pkg_mkindex.sh" ;;
 
-  *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
+  *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
 done
 
@@ -11669,7 +10081,7 @@
   trap 'exit_status=$?
   { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
 ' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
+  trap 'as_fn_exit 1' 1 2 13 15
 }
 # Create a (secure) tmp directory for tmp files.
 
@@ -11680,11 +10092,7 @@
 {
   tmp=./conf$$-$RANDOM
   (umask 077 && mkdir "$tmp")
-} ||
-{
-   $as_echo "$as_me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
 
 # Set up the scripts for CONFIG_FILES section.
 # No need to generate them if there are no CONFIG_FILES.
@@ -11692,11 +10100,16 @@
 if test -n "$CONFIG_FILES"; then
 
 
-ac_cr='
-'
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
 ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
 if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
-  ac_cs_awk_cr='\\r'
+  ac_cs_awk_cr='\r'
 else
   ac_cs_awk_cr=$ac_cr
 fi
@@ -11710,24 +10123,18 @@
   echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
   echo "_ACEOF"
 } >conf$$subs.sh ||
-  { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   . ./conf$$subs.sh ||
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
 
   ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
   if test $ac_delim_n = $ac_delim_num; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -11749,7 +10156,7 @@
 t delim
 :nl
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -11763,7 +10170,7 @@
 t nl
 :delim
 h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p
@@ -11816,9 +10223,7 @@
 else
   cat
 fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
-  || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not setup config files machinery" "$LINENO" 5
 _ACEOF
 
 # VPATH may cause trouble with some makes, so we remove $(srcdir),
@@ -11859,9 +10264,7 @@
   if test -z "$ac_t"; then
     break
   elif $ac_last_try; then
-    { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
-   { (exit 1); exit 1; }; }
+    as_fn_error "could not make $CONFIG_HEADERS" "$LINENO" 5
   else
     ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
@@ -11946,9 +10349,7 @@
 _ACAWK
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-  { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
-$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "could not setup config headers machinery" "$LINENO" 5
 fi # test -n "$CONFIG_HEADERS"
 
 
@@ -11961,9 +10362,7 @@
   esac
   case $ac_mode$ac_tag in
   :[FHL]*:*);;
-  :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5
-$as_echo "$as_me: error: invalid tag $ac_tag" >&2;}
-   { (exit 1); exit 1; }; };;
+  :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
   :[FH]-) ac_tag=-:-;;
   :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
   esac
@@ -11991,12 +10390,10 @@
 	   [\\/$]*) false;;
 	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
 	   esac ||
-	   { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
+	   as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
       esac
       case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
-      ac_file_inputs="$ac_file_inputs '$ac_f'"
+      as_fn_append ac_file_inputs " '$ac_f'"
     done
 
     # Let's still pretend it is `configure' which instantiates (i.e., don't
@@ -12007,7 +10404,7 @@
 	`' by configure.'
     if test x"$ac_file" != x-; then
       configure_input="$ac_file.  $configure_input"
-      { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
 $as_echo "$as_me: creating $ac_file" >&6;}
     fi
     # Neutralize special characters interpreted by sed in replacement strings.
@@ -12020,9 +10417,7 @@
 
     case $ac_tag in
     *:-:* | *:-) cat >"$tmp/stdin" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; } ;;
+      || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
     esac
     ;;
   esac
@@ -12050,47 +10445,7 @@
 	    q
 	  }
 	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+  as_dir="$ac_dir"; as_fn_mkdir_p
   ac_builddir=.
 
 case "$ac_dir" in
@@ -12142,7 +10497,6 @@
 # If the template does not know about datarootdir, expand it.
 # FIXME: This hack should be removed a few years after 2.60.
 ac_datarootdir_hack=; ac_datarootdir_seen=
-
 ac_sed_dataroot='
 /datarootdir/ {
   p
@@ -12152,12 +10506,11 @@
 /@docdir@/p
 /@infodir@/p
 /@localedir@/p
-/@mandir@/p
-'
+/@mandir@/p'
 case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
 *datarootdir*) ac_datarootdir_seen=yes;;
 *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
@@ -12167,7 +10520,7 @@
   s&@infodir@&$infodir&g
   s&@localedir@&$localedir&g
   s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
 _ACEOF
 
@@ -12195,14 +10548,12 @@
 $ac_datarootdir_hack
 "
 eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
 
 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
   { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
   { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&5
 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
 which seems to be undefined.  Please make sure it is defined." >&2;}
@@ -12212,9 +10563,7 @@
   -) cat "$tmp/out" && rm -f "$tmp/out";;
   *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
   esac \
-  || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+  || as_fn_error "could not create $ac_file" "$LINENO" 5
  ;;
   :H)
   #
@@ -12225,25 +10574,19 @@
       $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
     } >"$tmp/config.h" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create $ac_file" "$LINENO" 5
     if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
-      { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
 $as_echo "$as_me: $ac_file is unchanged" >&6;}
     else
       rm -f "$ac_file"
       mv "$tmp/config.h" "$ac_file" \
-	|| { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
-   { (exit 1); exit 1; }; }
+	|| as_fn_error "could not create $ac_file" "$LINENO" 5
     fi
   else
     $as_echo "/* $configure_input  */" \
       && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
-      || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
-$as_echo "$as_me: error: could not create -" >&2;}
-   { (exit 1); exit 1; }; }
+      || as_fn_error "could not create -" "$LINENO" 5
   fi
  ;;
 
@@ -12258,15 +10601,12 @@
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
 test $ac_write_fail = 0 ||
-  { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
+  as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
 
 
 # configure is writing to config.log, and then calls config.status.
@@ -12287,7 +10627,7 @@
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit $?
 fi
 
 #
@@ -12331,7 +10671,7 @@
       case $ac_arg in
       *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
       esac
-      ac_sub_configure_args="$ac_sub_configure_args '$ac_arg'" ;;
+      as_fn_append ac_sub_configure_args " '$ac_arg'" ;;
     esac
   done
 
@@ -12360,49 +10700,9 @@
     test -d "$srcdir/$ac_dir" || continue
 
     ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
-    $as_echo "$as_me:$LINENO: $ac_msg" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: $ac_msg" >&5
     $as_echo "$ac_msg" >&6
-    { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
+    as_dir="$ac_dir"; as_fn_mkdir_p
     ac_builddir=.
 
 case "$ac_dir" in
@@ -12449,7 +10749,7 @@
       # This should be Cygnus configure.
       ac_sub_configure=$ac_aux_dir/configure
     else
-      { $as_echo "$as_me:$LINENO: WARNING: no configuration information is in $ac_dir" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: no configuration information is in $ac_dir" >&5
 $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2;}
       ac_sub_configure=
     fi
@@ -12463,21 +10763,19 @@
 	ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
       esac
 
-      { $as_echo "$as_me:$LINENO: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
+      { $as_echo "$as_me:${as_lineno-$LINENO}: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&5
 $as_echo "$as_me: running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir" >&6;}
       # The eval makes quoting arguments work.
       eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
 	   --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
-	{ { $as_echo "$as_me:$LINENO: error: $ac_sub_configure failed for $ac_dir" >&5
-$as_echo "$as_me: error: $ac_sub_configure failed for $ac_dir" >&2;}
-   { (exit 1); exit 1; }; }
+	as_fn_error "$ac_sub_configure failed for $ac_dir" "$LINENO" 5
     fi
 
     cd "$ac_popdir"
   done
 fi
 if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
-  { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 

Modified: branches/new-help-system/base/configure.ac
===================================================================
--- branches/new-help-system/base/configure.ac	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/configure.ac	2010-03-28 16:55:01 UTC (rev 65589)
@@ -2,7 +2,7 @@
 dnl $Id$
 AC_PREREQ(2.63)
 AC_DEFUN([MACPORTS_VERSION_MACRO], [esyscmd(cat config/macports_version | tr -d '\n')])
-AC_INIT([MacPorts],[MACPORTS_VERSION_MACRO],[macports-dev at lists.macosforge.org],[macports])
+AC_INIT([MacPorts],MACPORTS_VERSION_MACRO,[macports-dev at lists.macosforge.org],[macports])
 AC_CONFIG_SRCDIR([src/pextlib1.0/Pextlib.c])
 AC_CONFIG_HEADERS([src/config.h])
 
@@ -28,15 +28,15 @@
 fi
 
 case "$MACOSX_VERSION" in
-  10.0*|10.1*|10.2*)
-    AC_MSG_WARN([This version of Mac OS X is not supported])
-    AC_MSG_WARN([Please upgrade at http://store.apple.com/])
+  10.0*|10.1*|10.2*|10.3*)
+    AC_MSG_ERROR([This version of Mac OS X is not supported
+                  Please upgrade at http://store.apple.com/])
     ;;
-  10.1.[[0-4]]|10.2.[[0-7]]|10.3.[[0-8]]|10.4.[[0-9]]|10.4.10|10.5.[[0-6]])
+  10.4.[[0-9]]|10.4.10|10.5.[[0-7]]|10.6.[[0-1]])
     AC_MSG_WARN([This version of Mac OS X is out of date])
     AC_MSG_WARN([Please run Software Update to update it])
     ;;
-  10.3*|10.4*|10.5*)
+  10.4*|10.5*|10.6*)
     dnl Supported version
     ;;
   *)
@@ -65,15 +65,15 @@
 fi
 
 case "$XCODE_VERSION" in
-  1.[[0-1]]*|2.[[0-1]]*)
+  1.*|2.[[0-1]]*)
     AC_MSG_WARN([This version of Xcode Tools is not supported])
     AC_MSG_WARN([Please upgrade at http://connect.apple.com/])
     ;;
-  1.[[2-4]]*|2.[[2-3]]*|3.[[0]]*)
+  2.[[2-3]]*|3.[[0]]*)
     AC_MSG_WARN([This version of Xcode Tools is out of date])
     AC_MSG_WARN([Please consider upgrading as some ports fail compiling])
     ;;
-  1.5*|2.4*|3.*)
+  2.*|3.*)
     dnl Supported version
     ;;
   *)
@@ -91,16 +91,15 @@
 AC_PATH_PROG(CP, [cp], [])
 AC_PATH_PROG(CPIO, [cpio], [])
 AC_PATH_PROG(DIFF, [diff], [])
-AC_PATH_PROG(DITTO, [ditto], [])
 AC_PATH_PROG(DSCL, [dscl], [])
 AC_PATH_PROG(FILE, [file], [])
+AC_PATH_PROG(BZR, [bzr], [])
 AC_PATH_PROG(CVS, [cvs], [])
 AC_PATH_PROG(SVN, [svn], [])
 AC_PATH_PROG(GIT, [git], [])
 AC_PATH_PROG(HG, [hg], [])
 AC_PATH_PROG(GZIP, [gzip], [])
 AC_PATH_PROG(LIPO, [lipo], [])
-AC_PATH_PROG(NICE, [nice], [])
 AC_PATH_PROG(PATCH, [patch], [])
 AC_PATH_PROG(RMDIR, [rmdir], [])
 AC_PATH_PROG(RSYNC, [rsync], [])
@@ -108,7 +107,7 @@
 AC_PATH_PROG(TAR, [tar])
 AC_PATH_PROG(UNZIP, [unzip])
 AC_PATH_PROG(ZIP, [zip])
-AC_PATH_PROG(BSDMAKE, [bsdmake])
+AC_PATH_PROGS(BSDMAKE, [bsdmake pmake], [])
 AC_PATH_PROG(MAKE, [make])
 AC_PATH_PROG(HDIUTIL, [hdiutil], [])
 AC_CHECK_PROG(HAVE_LAUNCHD, [launchd], [yes], [])
@@ -116,6 +115,7 @@
 AC_PATH_PROG(XCODEBUILD, [xcodebuild], [])
 AC_PATH_PROGS(GNUTAR, [gnutar gtar], [], [$PATH:/usr/local/bin])
 AC_PATH_PROGS(GNUMAKE, [gnumake gmake], [], [$PATH:/usr/local/bin])
+AC_PATH_PROGS(GNUPATCH, [gnupatch gpatch], [], [$PATH:/usr/local/bin])
 AC_PATH_PROG(BZIP2, [bzip2], [])
 AC_PATH_PROG(LSBOM, [lsbom], [])
 AC_PATH_PROG(MKBOM, [mkbom], [])
@@ -132,6 +132,7 @@
 AC_ARG_VAR(TAR, [path to tar command])
 AC_ARG_VAR(MAKE, [path to make command])
 AC_ARG_VAR(GNUTAR, [path to gnutar command])
+AC_ARG_VAR(BSDMAKE, [path to bsdmake/pmake command])
 AC_ARG_VAR(GNUMAKE, [path to gnumake command])
 AC_ARG_VAR(BZIP2, [path to bzip2 command])
 AC_ARG_VAR(XAR, [path to xar command])
@@ -139,6 +140,7 @@
 
 MP_SED_EXTENDED_REGEXP
 MP_TAR_NO_SAME_OWNER
+MP_PATCH_GNU_VERSION
 
 # Quiche eaters options.
 if test x$GCC = xyes; then
@@ -164,6 +166,9 @@
 
 # Check for paths
 AC_PREFIX_DEFAULT(/opt/local)
+if test x$prefix = x/usr/local; then
+    AC_MSG_ERROR([Installing MacPorts into /usr/local is not supported])
+fi
 MP_PATH_PORTSDIR([$PORTS_DIR_DEFAULT])
 MP_PATH_MPCONFIGDIR
 
@@ -198,7 +203,7 @@
 MP_CHECK_READLINK_IS_P1003_1A
 
 # Check for md5 implementation
-MP_LIB_MD5
+AC_CHECK_HEADER([CommonCrypto/CommonDigest.h], [AC_DEFINE([HAVE_COMMONCRYPTO_COMMONDIGEST_H], [1], [Define if CommonCrypto is available.])], [MP_LIB_MD5])
 
 # Check for readline
 AC_ARG_ENABLE(readline, AS_HELP_STRING([--enable-readline],[Enable addition of readline support, if readline present.]),
@@ -242,6 +247,9 @@
 ## libcurl
 MP_LIBCURL_FLAGS
 
+## sqlite3
+MP_SQLITE3_FLAGS
+
 # Determine if we need to install some bundled packages
 OUR_INCLUDED_PACKAGES=
 
@@ -271,59 +279,6 @@
 	patch -p0 < src/thread2.6.diff
 fi
 
-## sqlite3 package.
-AC_ARG_WITH(
-		included-sqlite3,
-		AS_HELP_STRING([--with-included-sqlite3],
-			[build using bundled sqlite3 package]),
-		[with_included_sqlite3=$withval],
-		[with_included_sqlite3="unspecified"])
-
-# Check if sqlite3 package is already installed.
-if test "x$with_included_sqlite3" = "xunspecified" ; then
-	AC_CHECK_LIB([sqlite3],[sqlite3_open],
-		[with_included_sqlite3=no],
-		[with_included_sqlite3=yes])
-fi
-
-AC_ARG_WITH(
-		tcl-sqlite3,
-		AS_HELP_STRING([--with-tcl-sqlite3=DIR],
-			[directory for Tcl sqlite3 (default /usr/lib/sqlite3)]),
-		[mp_sqlite3_dir=$withval],
-		[mp_sqlite3_dir=/usr/lib/sqlite3])
-
-# If sqlite3 package isn't installed, configure and install sqlite3 package.
-if test "$with_included_sqlite3" = "yes"; then
-	OUR_INCLUDED_PACKAGES="$OUR_INCLUDED_PACKAGES sqlite-3.1.3"
-	INCLUDES="$INCLUDES -I../sqlite-3.1.3"
-	AC_CONFIG_SUBDIRS([src/sqlite-3.1.3])
-	# Extract sqlite3 package
-	(cd src/; gzip -d < sqlite-3.1.3.tar.gz | tar xf -)
-	# patch sqlite3 with desired configure options
-	patch -p0 < src/sqlite-3.1.3.diff
-	# the new tclinstaller.tcl needs to have substitution occur
-	mv src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3/tclinstaller.tcl.in
-	SQLITE3_LIBS=`pwd`"/src/sqlite-3.1.3/.libs/libsqlite3.a"
-	if test "x$prefix" = "xNONE" ; then
-		SQLITE3_DIR=$ac_default_prefix/share/macports/Tcl/sqlite3
-	else
-		SQLITE3_DIR=$prefix/share/macports/Tcl/sqlite3
-	fi
-else
-	SQLITE3_LIBS="-lsqlite3"
-
-	AC_CACHE_CHECK([for Tcl sqlite3 location], [mp_cv_sqlite3_dir],
-		[mp_cv_sqlite3_dir=
-		test -r "${mp_sqlite3_dir}/pkgIndex.tcl" && mp_cv_sqlite3_dir=$mp_sqlite3_dir
-		])
-
-	SQLITE3_DIR=$mp_cv_sqlite3_dir
-fi
-
-AC_SUBST(SQLITE3_LIBS)
-AC_SUBST(SQLITE3_DIR)
-
 AH_TEMPLATE([TRACE_SDK], [SDK for SDK redirect in tracelib])
 AC_ARG_WITH(
 	trace-sdk,
@@ -361,6 +316,9 @@
    prefix=$ac_default_prefix
 fi
 
+# Check if there's an existing DP/MP install too old to upgrade
+MP_CHECK_OLDLAYOUT
+
 eval "prefix_expanded=$prefix"
 AC_SUBST(prefix_expanded)
 # do this twice, since there is a nested variable of
@@ -370,6 +328,9 @@
 AC_SUBST(MPCONFIGDIR_EXPANDED)
 eval "localstatedir_expanded=$localstatedir"
 AC_SUBST(localstatedir_expanded)
+eval "macports_tcl_dir=${datadir}/macports/Tcl"
+eval "macports_tcl_dir=$macports_tcl_dir"
+AC_SUBST(macports_tcl_dir)
 
 prefix=$oldprefix
 
@@ -387,11 +348,10 @@
 	doc/macports.conf
 	doc/asciidoc.conf
 	portmgr/freebsd/Makefile
-	portmgr/fedora/macports.spec
 	src/Makefile
 	src/macports1.0/macports_autoconf.tcl
 	src/port1.0/port_autoconf.tcl
-	src/registry1.0/registry_autoconf.tcl
+	src/registry2.0/registry_autoconf.tcl
 	src/programs/Makefile
 	src/macports1.0/macports_fastload.tcl
 	setupenv.bash

Modified: branches/new-help-system/base/doc/macports.conf.5
===================================================================
--- branches/new-help-system/base/doc/macports.conf.5	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/macports.conf.5	2010-03-28 16:55:01 UTC (rev 65589)
@@ -51,30 +51,25 @@
 .Bl -tag -width lc
 .It Va prefix
 Sets the directory where ports are installed. Any path may be used but those with spaces and/or non ascii
-characters should be avoided, as this can broke some ports. This key is often referred to as '${prefix}'.
+characters should be avoided, as this can break some ports. This key is often referred to as '${prefix}'.
 .br
 .Ic Default:
 /opt/local
-.It Va x11prefix
-Path containing an X11 installation on your system.
-.br
-.Ic Default:
-/usr/X11R6
 .It Va portdbpath
-Directory where MacPorts keeps working data as downloaded sources, installed ports receipts
-and the main registry. Same path restrictions apply as for '${prefix}'.
+Directory where MacPorts keeps working data such as downloaded sources, installed ports' receipts
+and the main registry. The same path restrictions apply as for '${prefix}'.
 .br
 .Ic Default:
 ${prefix}/var/macports
 .It Va portdbformat
-Storage type to use for the MacPorts registry. Currently the only supportted format is "flat".
+Storage type to use for the MacPorts registry. Currently the only supported format is "flat".
 .br
 .Ic Default:
 flat
 .It Va portinstalltype
 Sets the mode in which ports are installed by MacPorts. Supported values are 'direct' or 'image'.
 The 'direct' mode is often used on systems that do not support 'image' due to limitations in their
-installed version of TCL. In 'direct' mode ports are installed directly into '${prefix}' and only
+installed version of Tcl. In 'direct' mode ports are installed directly into '${prefix}' and only
 one flavor of a port can be installed at any given time. In 'image' mode multiple flavors of a port
 (i.e., different versions and/or any possible combination of its variants) can be installed concurrently
 into '${portdbpath}/software/${portname}' and only one can be "activated" onto '${prefix}' via soft or
@@ -82,11 +77,6 @@
 .br
 .Ic Default:
 image
-.\" I think Paul wrote code to suppot image on Jaguar, so the following comment may no longer be needed.
-.\" is this the case?
-.Pp
-NOTE. Mac OS X 10.2 and Darwin 6.x users should switch to 'direct' mode to have MacPorts working properly
-on their systems.
 .It Va applications_dir
 Directory containing Applications installed from ports.
 .br
@@ -101,7 +91,7 @@
 Location of the sources file. This file enables rsync synchronization of the default ports tree with the
 MacPorts rsync server (through the "sync" target of the
 .Nm port
-commnand) and any other local tree(s) you might have.
+command) and any other local tree(s) you might have.
 .br
 .Ic Default:
 ${prefix}/etc/macports/sources.conf
@@ -117,7 +107,7 @@
 .Ic Default:
 yes
 .It Va portarchivepath
-Location where to store/retrieve ports binary archive files from when archive mode is active.
+Location to store ports' binary archive files when archive mode is active.
 .br
 .Ic Default:
 ${portdbpath}/packages
@@ -145,30 +135,50 @@
 Use pipes rather than intermediate files when compiling C/C++/etc (gcc -pipe)
 .br
 .Ic Default:
-no
+yes
 .It Va buildnicevalue
 Lowered scheduling priority (0-20) to use for make when building ports
 .br
 .Ic Default:
 0
 .It Va buildmakejobs
-Number of simultaneous make jobs (commands) to use when building ports
+Number of simultaneous make jobs (commands) to use when building ports. 0 is a
+special value meaning "the number of CPU cores or the number of GB
+of physical memory plus one, whichever is less."
 .br
 .Ic Default:
-1
+0
 .It Va portautoclean
 Automatic cleaning of the build directory of a given port after it has been installed.
 .br
 .Ic Default:
 yes
+.It Va keeplogs 
+Keep logs for ports
+.br
+.Ic Default:
+yes
+.It Va build_arch
+The machine architecture to try to build for in normal use
+.br
+Regular architectures include: ppc, i386, ppc64, x86_64
+.br
+.Ic Default (10.6):
+x86_64 or i386 depending on hardware
+.br
+.Ic Default (10.5 and earlier):
+i386 or ppc depending on hardware
 .It Va universal_archs
 The machine architectures to use for +universal variant
 (multiple architecture entries should be space separated)
 .br
 Regular architectures include: ppc, i386, ppc64, x86_64
 .br
-.Ic Default:
-ppc i386
+.Ic Default (10.6):
+x86_64 i386
+.br
+.Ic Default (10.5 and earlier):
+i386 ppc
 .It Va startupitem_type
 Set the default type of startupitems to be generated, overridable by Portfiles that explicitly state a
 startupitem.type key. If set to "default", then a type will be selected that's appropriate to the OS.
@@ -177,15 +187,15 @@
 .Ic Default:
 default
 .It Va destroot_umask
-Umask value to use during the destrooting or a port.
+Umask value to use during the destrooting of a port.
 .br
 .Ic Default:
 022
 .It Va rsync_server
 Default rsync server to connect to when running "selfupdate" through the
 .Nm port
-command to update your entire MacPorts
-installation (spanning both the MacPorts infrastucture and the ports tree).
+command to update your base MacPorts infrastructure. While selfupdate also
+syncs the ports tree, it uses the settings from ${sources_conf} to do so.
 .br
 .Ic Default:
 rsync.macports.org
@@ -201,10 +211,11 @@
 -rtzv --delete-after
 .It Va binpath
 Sets the directory search path for locating system executables used by MacPorts. This variable should contain
-the paths for locating utilities such as rsync, tar, cvs and others.
+the paths for locating utilities such as rsync, tar, cvs and others. Don't change this unless you understand
+and accept the consequences.
 .br
 .Ic Default:
-${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin:${x11prefix}/bin
+${prefix}/bin:${prefix}/sbin:/bin:/sbin:/usr/bin:/usr/sbin
 .It Va extra_env
 List of extra environment variables MacPorts should keep in the user's environment when sanitizing it.
 .El

Modified: branches/new-help-system/base/doc/macports.conf.in
===================================================================
--- branches/new-help-system/base/doc/macports.conf.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/macports.conf.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,21 +1,21 @@
 # MacPorts system wide configuration file
 # $Id$
 
-# Set the directory in which to install ports
+# Set the directory in which to install ports. Must match where MacPorts itself is installed.
 prefix			@prefix_expanded@
 
 # Set the user to run MacPorts compiles, etc as when privileges are dropped during an install
-macportsuser		@RUNUSR@
+#macportsuser		@RUNUSR@
 
 # Where to store MacPorts working data
 portdbpath		@localstatedir_expanded@/macports
 
 # Type of storage to use for the port registry information, "flat" or "sqlite"
-# NOTE: sqlite not yet supported.
-portdbformat		flat
+# default is flat, sqlite is still experimental
+#portdbformat		flat
 
 # Type of installation to do for ports, "direct" or "image".  See macports.conf(5) and online documentation.
-portinstalltype		image
+#portinstalltype		image
 
 # PATH settings that are used for external tools (configure, make, etc.) while installing ports. The default
 # paths are given in the example; it need not be uncommented.  Customizing binpath is intended for advanced users only.
@@ -37,10 +37,10 @@
 variants_conf		@MPCONFIGDIR_EXPANDED@/variants.conf
 
 # Create and use binary archive packages for installation/reinstallation ease
-portarchivemode		no
+#portarchivemode		no
 
 # Where to store/retrieve ports binary archive files
-portarchivepath		@localstatedir_expanded@/macports/packages
+#portarchivepath		@localstatedir_expanded@/macports/packages
 
 # Type of binary archive packages to create when using archive mode
 #
@@ -51,47 +51,57 @@
 # first archive to match one of the specified types in order is used.
 #
 # Supported types: tgz (default), tar, tbz, tbz2, tlz, txz, xar, zip, cpgz, cpio
-portarchivetype		tgz
+#portarchivetype		tgz
 
+# CPU architecture to compile for. Defaults to i386 or ppc on Mac OS X 10.5
+# and earlier, depending on the CPU type detected at runtime. On Mac OS X 10.6
+# the default is x86_64 if the CPU supports it, i386 otherwise.
+#build_arch			@host_cpu@
+
+# CPU architectures to use for Universal Binaries (+universal variant)
+universal_archs		@UNIVERSAL_ARCHS@
+
 # Use ccache (C/C++ compiler cache) - see http://ccache.samba.org/
-configureccache		no
+#configureccache		no
 
 # Use distcc (distributed compiler) - see http://distcc.samba.org/
-configuredistcc		no
+#configuredistcc		no
 
 # Use pipes rather than intermediate files when compiling C/C++/etc
-configurepipe		no
+#configurepipe		yes
 
 # Lowered scheduling priority (0-20) to use for make when building ports
-buildnicevalue		0
+#buildnicevalue		0
 
 # Number of simultaneous make jobs (commands) to use when building ports. This
 # value may be set to 0 so the number of simultaneous make jobs will be set to
-# the number of CPU cores that are automatically detected.
+# the number of CPU cores that are automatically detected, or the number of GB
+# of physical memory plus one, whichever is less.
 #buildmakejobs		0
 
+# umask value to use when a port installs its files
+#destroot_umask 022
+
 # Set whether to automatically execute "clean" after "install" of ports
-portautoclean		yes
+#portautoclean		yes
 
+# Set to yes if you don't want logs to be deleted after successful builds
+#keeplogs no
+
 # Rsync server to fetch MacPorts sources from. Note that this is only used
 # for selfupdate. The source(s) for the ports tree are set in sources.conf.
 # Known mirrors at time of writing (see http://trac.macports.org/wiki/Mirrors
 # for the current list):
 #   rsync.macports.org        - California, USA (master)
 #   trd.no.rsync.macports.org - Trondheim, Norway
-rsync_server		rsync.macports.org
+#rsync_server		rsync.macports.org
 
 # Rsync directory from which to pull the base/ component (infrastructure) of MacPorts
-rsync_dir			release/base/
+#rsync_dir			release/base/
 
 # Rsync options
-rsync_options		-rtzv --delete-after
+#rsync_options		-rtzv --delete-after
 
-# Options for Universal Binaries (+universal variant)
-
-# machine architectures
-universal_archs		@UNIVERSAL_ARCHS@
-
 # Options for generated startup items
 # startupitem_type may be "default", "systemstarter", "launchd", or "none";
 # if the option is empty or "default" then a startupitem type appropriate
@@ -99,7 +109,7 @@
 # launchd, while older Mac OS X systems will default to systemstarter. If
 # option "none" is chosen, port startupitems are ignored and no startupitems
 # are installed.
-startupitem_type	default
+#startupitem_type	default
 
 # Extra environment variables to keep. Any variables listed here are added
 # to the list of variables that are not removed from the environment used
@@ -115,7 +125,7 @@
 # Note that System Preferences doesn't have an rsync proxy definition.
 # Also note, on 10.5, sudo will clear many environment variables including
 # those for proxy support.
-# Equivalent envioronment variables: http_proxy, HTTPS_PROXY, FTP_PROXY,
+# Equivalent environment variables: http_proxy, HTTPS_PROXY, FTP_PROXY,
 # RSYNC_PROXY, NO_PROXY
 #
 #proxy_override_env    yes
@@ -130,4 +140,3 @@
 # hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
 # and FTP, but not rsync):
 #proxy_skip            internal1, internal2, internal3
-

Modified: branches/new-help-system/base/doc/port.1
===================================================================
--- branches/new-help-system/base/doc/port.1	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/port.1	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,1181 +1,658 @@
-'\" t
-.\"     Title: port
-.\"    Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.74.3 <http://docbook.sf.net/>
-.\"      Date: 05/07/2009
-.\"    Manual: MacPorts Manual
-.\"    Source: MacPorts 1.8.0
-.\"  Language: English
+.\" port.1
 .\"
-.TH "PORT" "1" "05/07/2009" "MacPorts 1\&.8\&.0" "MacPorts Manual"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-port \- Command line interface for MacPorts
-.SH "SYNOPSIS"
-.sp
-.nf
-\fBport\fR [\fB\-vdqnRuysbckxpotf\fR] [\fB\-D\fR \fIportdir\fR] [\fB\-F\fR \fIcmdfile\fR] [\fIaction\fR] [\fIactionflags\fR]
-     [[\fIportname\fR | \fIpseudo\-portname\fR | \fIport\-expressions\fR | \fIport\-url\fR]]
-     [[\fI at version\fR] [+/\-variant \&...] \&... [option=value \&...]]
-.fi
-.SH "DESCRIPTION"
-.sp
-\fBport\fR is designed to operate on individual or multiple \fIports\fR, optionally within a single call, based on the requested \fIaction\fR\&. If no \fIaction\fR is specified the port command enters interactive mode, in which commands are read via stdin\&. If no \fIportdir\fR or \fIportname\fR is specified for an \fIaction\fR, the current working directory is assumed\&. Batch commands may be passed via a \fIcmdfile\fR\&. Port \fIoptions\fR are passed as key=value pairs and take precedence over individual \fIportname\fR options as specified in its Portfile and system\-wide settings\&.
-.sp
-Port \fIvariants\fR can be specified as \fI+name\fR, which indicates the variant is desired, or \fI\-name\fR, indicating the contrary\&. In case of ambiguities, a port can be fully specified with the \fI at version_revision+variants\fR format\&.
-.sp
-Installed ports can be activated or deactivated without being uninstalled\&. A port can be installed in multiple versions and variant combinations, but only one of them can be \fIactive\fR\&.
-.sp
-When passing \fIportnames\fR to an \fIaction\fR, \fBport\fR recognizes various \fIpseudo\-portnames\fR that will expand to the specified set of ports from the available port tree(s)\&. These may be used in the same way as a \fIportname\fR\&.
-.PP
-\fBThe \fR\fB\fIpseudo\-portnames\fR\fR\fB are:\fR
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIall\fR: all the ports in each ports tree listed in
-\fIsources\&.conf\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIcurrent\fR: the port in the current working directory
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIactive\fR: set of installed and active ports
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIinactive\fR: set of installed but inactive ports
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIinstalled\fR: set of all installed ports
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIuninstalled\fR: ports in the ports tree(s) that are not installed
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIoutdated\fR: installed ports that are out of date with respect to their current version/revision in the ports tree(s)
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIobsolete\fR: set of ports that are installed but no longer exist in any port tree
-.RE
-.sp
-Other options, also known as \fIpseudo\-portname selectors\fR, matching the searchable keys used in a \fIPortfile\fR are also accepted\&. Where applicable, both singular and plural forms are accepted\&.
-.PP
-\fBThe \fR\fB\fIpseudo\-portname selectors\fR\fR\fB are:\fR
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIname\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIversion\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIrevision\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIepoch\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIvariant\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIvariants\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIcategory\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIcategories\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fImaintainer\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fImaintainers\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIplatform\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIplatforms\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIdescription\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIlong_description\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIhomepage\fR
-.RE
-.sp
-.RS 4
-.ie n \{\
-\h'-04'\(bu\h'+03'\c
-.\}
-.el \{\
-.sp -1
-.IP \(bu 2.3
-.\}
-
-\fIportdir\fR
-.RE
-.sp
-Search strings that will expand to a set of matching ports can be constructed based on the "\fIpseudo\-portname selector\fR":regex combination used\&. \fIportnames\fR containing valid UNIX glob patterns will also expand to the set of matching ports\&. Any action passed to port will be invoked on each of them\&.
-.sp
-For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port info variant:no_ssl
-port uninstall name:sql
-port echo \'apache*\'
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-Logical operators "and", "or", "not", "!", "(" and ")" may be used to combine individual \fIportnames\fR, port glob patterns and/or \fIpseudo\-portnames\fR to construct complex \fIport\-expressions\fR that expand to the set of matching ports\&.
-.sp
-For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port upgrade outdated and \'py25\-*\'
-port echo maintainer:jberry and uninstalled and \e( category:java and not commons* \e)
-.fi
-.if n \{\
-.RE
-.\}
-.if n \{\
-.sp
-.\}
-.RS 4
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fBNote\fR
-.ps -1
-.br
-.sp
-Special shell characters like *, \e( or \e) need to be escaped in order to be passed correctly to \fBport\fR\&.
-.sp .5v
-.RE
-.SH "GLOBAL OPTIONS"
-.sp
-The port command recognizes several global flags and options\&.
-.PP
-\fBOutput control\fR
-.PP
-\-v
-.RS 4
-Verbose mode, generates verbose messages
-.RE
-.PP
-\-d
-.RS 4
-Debug mode, generate debugging messages, implies \-v
-.RE
-.PP
-\-q
-.RS 4
-Quiet mode, suppress informational messages to a minimum
-.RE
-.PP
-\fBInstallation and upgrade\fR
-.PP
-\-n
-.RS 4
-Don\(cqt follow dependencies in upgrade (only for
-\fIupgrade\fR)
-.RE
-.PP
-\-R
-.RS 4
-Also upgrade dependents (only for
-\fIupgrade\fR)
-.RE
-.PP
-\-u
-.RS 4
-Uninstall inactive ports when upgrading and uninstalling
-.RE
-.PP
-\-y
-.RS 4
-Perform a dry run\&. All of the steps to build the ports and their dependencies are computed, but not actually performed\&. With the verbose flag, every step is reported; otherwise there is just one message per port, which allows you to easily determine the recursive deps of a port (and the order in which they will be built)\&.
-.RE
-.PP
-\fBSources\fR
-.PP
-\-s
-.RS 4
-Source\-only mode, build and install from source, ignore any existing binary archives; do not create/recreate binary archives\&. (Applies only when
-\fIarchive mode\fR
-is enabled)
-.RE
-.PP
-\-b
-.RS 4
-Binary\-only mode, build and install from binary archives, ignore source, abort if no archive present; do not create/recreate binary archives from source\&. (Applies only when
-\fIarchive mode\fR
-is enabled)
-.RE
-.PP
-\fBCleaning\fR
-.PP
-\-c
-.RS 4
-Autoclean mode, execute clean after
-\fIinstall\fR
-.RE
-.PP
-\-k
-.RS 4
-Keep mode, do not autoclean after
-\fIinstall\fR
-.RE
-.PP
-\fBExit status\fR
-.PP
-\-x
-.RS 4
-In batch and interactive mode, exit on the first error encountered\&. Otherwise, errors during batch execution are simply reported\&.
-.RE
-.PP
-\-p
-.RS 4
-Despite any errors encountered, proceed to process multiple ports and commands\&.
-.RE
-.PP
-\fBDevelopment\fR
-.PP
-\-o
-.RS 4
-Honor state files older than Portfile
-.RE
-.PP
-\-t
-.RS 4
-Enable trace mode debug facilities on platforms that support it, currently only Mac OS X\&.
-
-This feature is two\-folded\&. It consists in automatically detecting and reporting undeclared dependencies based on what files the port reads or what programs the port executes\&. In verbose mode, it will also report unused dependencies for each stage of the port installation\&. It also consists in forbidding and reporting file creation and file writes outside allowed
-.RE
-.PP
-\fBMisc\fR
-.PP
-\-f
-.RS 4
-Force mode, ignore state file
-.RE
-.PP
-\-D \fIportdir\fR
-.RS 4
-Specfiy
-\fIportdir\fR
-.RE
-.PP
-\-F \fIcmdfile\fR
-.RS 4
+.\" Copyright (c) 2002 Apple Computer, Inc.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. Neither the name of Apple Computer, Inc. nor the names of its
+.\"    contributors may be used to endorse or promote products derived from
+.\"    this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd April 29, 2007
+.Dt PORT 1 "MacPorts"
+.Os
+.Sh NAME
+.Nm port
+.Nd operate on individual or multiple Mac
+.Ar ports
+.Sh SYNOPSIS
+.Nm
+.Op Fl bcdfknopqRstuvy
+.Op Fl D Ar portdir
+.Op Fl F Ar cmdfile
+.Op Ar action
+.Op Ar actionflags
+.Op Oo Ar portname | pseudo-portname | port-url Oc
+.Op Oo Ar @version Oc Oo +/-variant ... Oc ... Oo option=value ... Oc
+.Sh DESCRIPTION
+.Nm
+is designed to operate on individual or multiple Mac
+.Ar ports ,
+optionally within a single call, based on the requested
+.Ar action .
+If no
+.Ar portdir
+or
+.Ar portname
+is specified, the current working directory is assumed; if no
+.Ar action
+is specified the port command enters interactive mode, in which commands are read via stdin. Batch commands may be
+passed via a
+.Ar cmdfile .
+Port 
+.Ar options 
+are passed as key=value pairs and take precedence over individual
+.Ar portname
+options as specified in its Portfile and system-wide settings.
+.Pp
+Port
+.Ar variants
+can specified as
+.Ar +name ,
+which indicates the variant is desired, or
+.Ar -name ,
+indicating the contrary. In case of ambiguities, a port can be fully specified with the
+.Ar @version_revision+variants
+format.
+.Pp
+Installed ports can be activated or deactivated without being uninstalled. A port can be installed if all other
+version/variant(s) combinations installed at any given moment are deactivated.
+.Pp
+The
+.Nm
+command knows various
+.Ar pseudo-portnames
+that will expand to the specified set of ports from the available ports tree(s). These may be used in place of a
+.Ar portname .
+Common options are:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+.Ar all :
+all the ports in each ports tree listed in
+.Ar sources.conf
+.Pp
+.It
+.Ar current :
+the port in the current working directory.
+.Pp
+.It
+.Ar active :
+set of installed and active ports.
+.Pp
+.It
+.Ar inactive :
+set of installed but inactive ports.
+.Pp
+.It
+.Ar installed :
+set of all installed ports.
+.Pp
+.It
+.Ar uninstalled :
+ports in the ports tree(s) that aren't installed.
+.Pp
+.It
+.Ar outdated :
+installed ports that are out of date with respect to their current version/revision in the ports tree(s)
+.Pp
+.It
+.Ar obsolete :
+set of ports that are installed but no longer exist in any port tree
+.Pp
+.El
+Other options, also known as
+.Ar pseudo-portname selectors ,
+matching the most common keys used in a
+.Ar Portfile
+are also accepted, in both singular and plural form where applicable. These are:
+.Pp
+.Bl -bullet -offset indent -compact
+.It
+.Ar name
+.It
+.Ar version
+.It
+.Ar revision
+.It
+.Ar epoch
+.It
+.Ar variant
+.It
+.Ar variants
+.It
+.Ar category
+.It
+.Ar categories
+.It
+.Ar maintainer
+.It
+.Ar maintainers
+.It
+.Ar platform
+.It
+.Ar platforms
+.It
+.Ar description
+.It
+.Ar long_description
+.It
+.Ar homepage
+.It
+.Ar portdir
+.El
+.Pp
+Search strings that will expand to a set of matching ports can be constructed based on the 
+.Ar \(rqpseudo-portname selector\(lq:regex
+combination used.
+.Ar portnames
+containing valid UNIX glob patterns will also expand to the set of matching ports. Any
+.Ar action
+passed to
+.Nm
+will be invoked on each of them. For example:
+.Pp
+.Dl port list variant:no_ssl
+.Dl port uninstall name:sql
+.\" COMMENT: glob pattern expansion in portnames:
+.\" write an example here that illustrats better glob pattern expansion in portnames, but that does not employ
+.\" logical operators (and, or, not, !) because I still haven't gotten to them yet.
+.Dl port echo apache*
+.Pp
+Logical operators "and", "or", "not", "!", "(" and ")" may be used to combine individual
+.Ar portnames ,
+port glob patterns and/or
+.Ar pseudo-portnames
+to construct complex port expressions that expand to the set of matching ports. For example:
+.Pp
+.Dl port upgrade installed and "apache*"
+.Dl port echo maintainer:jberry and uninstalled and \e(\ category:java and not commons*\ \e)
+.\" COMMENT: more complex exmaples here would be useful.
+.\" PENDING: port-url explanation. Proposed text:
+.\".Pp
+.\"A
+.\".Ar portname
+.\"may also be specified as a URL pointing to the location of the
+.\".Ar portdir
+.\" ...
+.Pp
+The
+.Nm
+command also recognizes several command line flags and
+.Ar targets :
+.Sh OPTIONS
+.Bl -tag -width -indent
+.It Fl v
+verbose mode (generate verbose messages)
+.It Fl d
+debug mode (generate debugging messages, implies
+.Fl v )
+.It Fl q
+quiet mode (suppress messages)
+.It Fl n
+don't upgrade dependencies (affects upgrade and install)
+.It Fl R
+also upgrade dependents (only for upgrading)
+.It Fl u
+uninstall non-active ports when upgrading and uninstalling
+.It Fl f
+force mode (ignore state file)
+.It Fl o
+honor state files older than Portfile
+.It Fl s
+source-only mode (build and install from source, ignore all binary archives, do not create/recreate binary archives) (only applies when archive mode is enabled)
+.It Fl b
+binary-only mode (build and install from binary archives, ignore source, abort if no archive present; do not create/recreate binary archives from source) (only applies when archive mode is enabled)
+.It Fl c
+autoclean mode (execute clean after install)
+.It Fl k
+keep mode (don't autoclean after install)
+.It Fl D
+specify
+.Ar portdir
+.It Fl F
 Read and process the
-\fIfile\fR
-of commands specified by the argument\&. If the argument is
-\fI\-\fR, then read commands from stdin\&. If the option is given multiple times, then multiple files will be read\&.
-.RE
-.SH "USER TARGETS"
-.sp
+.Ar file
+of commands specified by the argument. If the argument is '-', then read commands from stdin. If the option is given multiple times, then multiple files will be read.
+.It Fl p
+Despite any errors encountered, proceed to process multiple ports and commands.
+.It Fl y
+Perform a dry run. All of the steps to build the ports and their dependencies are computed, but not actually performed. With the verbose flag, every step is reported; otherwise there is just one message per port, which allows you to easily determine the recursive deps of a port (and the order in which they will be built).
+.It Fl t
+enable trace mode debug facilities on platforms that support it (Mac OS X). This feature is two-folded. It consists in automatically detecting and reporting undeclared dependencies based on what files the port reads or what programs the port executes. In verbose mode, it will also report unused dependencies for each stage of the port installation. It also consists in forbidding and reporting file creation and file writes outside allowed directories (temporary directories and ${workpath}).
+.El
+.Sh USER TARGETS
 Targets most commonly used by regular MacPorts users are:
-.PP
-search
-.RS 4
-Search for an available port whose name matches a regular expression\&.
-.sp
-For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port search vim
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-info
-.RS 4
-Displays meta\-information available for
-\fIportname\fR\&. Specific meta\-information may be requested through an option such as
-\fB\-\-maintainer\fR
+.Ss search
+Search for an available port whose name matches a regular expression. For example:
+.Pp
+.Dl "port search vim"
+.Pp
+.Ss info
+Displays meta-information available for
+.Ar portname .
+Specific meta-information may be requested through an option such as
+.Fl -maintainer
 or
-\fB\-\-category\fR\&. Recognized field names are those from the PortIndex, see \(lqport help info\(rq for a complete list\&. If no specific fields are specified, a useful default collection of fields will be displayed\&. If the global option
-\fB\-q\fR
-is in effect, the meta\-info fields will not be labeled\&. If the option
-\fB\-\-line\fR
-is provided, all such data will be consolidated into a single line per port, suitable for processing in a pipe of commands\&. If the option
-\fB\-\-pretty\fR
-is provided, the information will be formatted in a somewhat more attractive fashion for human readers\&. This is the default when no options at all are specified to info\&. If the option
-\fB\-\-index\fR
-is provided, the information will be pulled from the PortIndex rather than from the Portfile\&. In this case variant information, such as dependencies, will not affect the output\&.
-.sp
+.Fl -category
+(recognized field names are those from the PortIndex, see "port help
+info" for a complete list). If no specific fields are specified, a
+useful default collection of fields will be displayed. If the global option
+.Fl q
+is in effect, the meta-info fields will not be labeled.
+If the option
+.Fl -line
+is provided, all such data will be consolidated into a single line per port,
+suitable for processing in a pipe of commands.
+If the option
+.Fl -pretty
+is provided, the information will be formatted in a somewhat more
+attractive fashion for human readers. This is the default when no
+options at all are specified to info.
+If the option
+.Fl -index
+is provided, the information will be pulled from the PortIndex rather than
+from the Portfile (in this case variant information, such as dependencies,
+will not affect the output).
+.Pp
 For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port info vim +ruby
-port info \-\-category \-\-name apache*
-port \-q info \-\-category \-\-name \-\-version category:java
-port info \-\-line \-\-category \-\-name all
-port info \-\-pretty \-\-fullname \-\-depends gtk2
-port info \-\-index python24
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-variants
-.RS 4
-Lists the variants available for
-\fIportname\fR\&.
-.RE
-.PP
-deps
-.RS 4
-Lists the other ports that are required to build and run portname\&. This is simply an alias for \(lqinfo \-\-pretty \-\-fullname \-\-depends\(rq\&.
-.RE
-.PP
-dependents
-.RS 4
+.br
+.Dl "port info vim +ruby"
+.Dl "port info --category --name apache*"
+.Dl "port -q info --category --name --version category:java"
+.Dl "port info --line --category --name all"
+.Dl "port info --pretty --fullname --depends gtk2"
+.Dl "port info --index python24"
+.Ss notes
+Displays notes for 
+.Ar portname
+(useful information concerning setup and use of the port).
+.Ss variants
+Lists the build variants available for
+.Ar portname .
+.Ss deps
+Lists the other ports that are required to build and run
+.Ar portname .
+This is simply an alias for "info --pretty --fullname --depends".
+.Ss dependents
 Lists the installed ports that depend on the port
-\fIportname\fR\&.
-.RE
-.PP
-install
-.RS 4
+.Ar portname .
+.Ss install
 Install and activate
-\fIportname\fR\&.
-.RE
-.PP
-uninstall
-.RS 4
-Deactivate and uninstall portname\&. To uninstall all installed but
-\fIinactive\fR
-ports, use
-\fB\-u\fR\&. To recursively uninstall all dependents of this port, use
-\fB\-\-follow\-dependents\fR\&.
-.sp
+.Ar portname .
+.Ss uninstall
+Deactivate and uninstall
+.Ar portname .
+To uninstall all installed but inactive ports, use
+.Fl u .
+To recursively uninstall all dependents of this port, use
+.Fl -follow-dependents .
+.Pp
 For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port uninstall vim
-port \-u uninstall
-port uninstall \-\-follow\-dependents python24
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-activate
-.RS 4
+.Pp
+.Dl "port uninstall vim"
+.Dl "port -u uninstall"
+.Dl "port uninstall --follow-dependents python24"
+.Ss activate
 Activate the installed
-\fIportname\fR\&.
-.RE
-.PP
-deactivate
-.RS 4
+.Ar portname .
+.Ss deactivate
 Deactivate the installed
-\fIportname\fR\&.
-.RE
-.PP
-installed
-.RS 4
-Lists all installed ports\&. Outputs name, composite version and activation status for each passed
-\fIportname\fR\&. If no arguments are given, all installed ports are displayed\&.
-.RE
-.PP
-location
-.RS 4
-Print the install location of a given port\&.
-.RE
-.PP
-contents
-.RS 4
+.Ar portname .
+.Ss installed
+Show the installed versions and variants for
+.Ar portname .
+If no
+.Ar portname
+is given, all installed ports are shown.
+.Ss location
+Print the install location of a given port.
+.Ss contents
 Lists the files installed by
-\fIportname\fR\&.
-.RE
-.PP
-provides
-.RS 4
-Determines which port owns a given file and can take either a relative or absolute path\&.
-.sp
-For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port provides /opt/local/etc/irssi\&.conf
-port provides include/tiff\&.h
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-sync
-.RS 4
-Performs a sync operation only on the ports tree of a MacPorts installation, pulling in the latest revision available of the Portfiles from the MacPorts rsync server\&.
-.sp
-To update you would normally do:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-sudo port \-d sync
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-If any of the ports tree(s) uses a file: URL that points to a local subversion working copy, sync will perform an svn update on the working copy with the user set to the owner of the working copy\&.
-.RE
-.PP
-outdated
-.RS 4
-Lists the installed ports which need a
-\fIupgrade\fR\&.
-.RE
-.PP
-upgrade
-.RS 4
-The upgrade target works on a port and its dependencies\&. If you want to change this behavior, look at the switches for
-\fB\-n\fR
-(no dependencies) and
-\fB\-R\fR
-(dependents) above\&.
-.sp
+.Ar portname .
+.Ss provides
+Determines which port owns a given file and can take either a relative or absolute path. For example:
+.Pp
+.Dl "port provides /opt/local/etc/irssi.conf"
+.Dl "port provides include/tiff.h"
+.Ss sync
+Performs a sync operation only on the ports tree of a MacPorts installation, pulling in the latest
+revision available of the
+.Ar Portfiles
+from the MacPorts rsync server. To update you would normally do:
+.Pp
+.Dl "sudo port -d sync"
+.Pp
+If any of the ports tree(s) uses a file: URL that points to a local subversion working copy,
+.Ic sync
+will perform an
+.Ic "svn update"
+on the working copy with the user set to the owner of the working copy.
+.Ss outdated
+List the installed ports that need upgrading.
+.Ss upgrade
+The upgrade target works on a port and its dependencies. If you
+want to change this behaviour, look at the switches for n (no
+dependencies) and R (dependents) below.
+.Pp    
 Upgrade the installed
-\fIportname\fR\&. For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port upgrade vim
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-To upgrade all outdated ports:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port upgrade outdated
-.fi
-.if n \{\
-.RE
-.\}
-.sp
+.Ar portname .
+For example:
+.Pp
+.Dl "port upgrade vim"
+.Pp
+To upgrade all installed ports:
+.Pp
+.Dl "port upgrade installed"
+.Pp
 To upgrade
-\fIportname\fR
+.Ar portname
 and the ports that depend on it:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port \-R upgrade libiconv
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-To force a rebuild use:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port \-fn upgrade vim
-.fi
-.if n \{\
-.RE
-.\}
-.sp
+.Pp
+.Dl "port -R upgrade libiconv"
+.Pp
+To force an upgrade (rebuild) use:
+.Pp
+.Dl "port upgrade --force vim"
+.Pp
 To upgrade
-\fIportname\fR
-without following its dependencies before, use
-\fB\-n\fR\&.
-.sp
+.Ar portname
+without following its dependencies, use
+.Fl n .
 For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port \-n upgrade wireshark
-.fi
-.if n \{\
-.RE
-.\}
-.if n \{\
-.sp
-.\}
-.RS 4
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fBNote\fR
-.ps -1
-.br
-By selecting the variants to use in the upgraded build of the port, any variants specified on the command line take highest precedence, then the variants active in the latest installed version of the port, and finally the global variants specified in variants\&.conf, if any\&. Note that upgrade will not normally rebuild a port only to change the selected variants; you can either specify
-\fB\-f\fR, or deactivate the port and reinstall it with different variants\&.
-.sp .5v
-.RE
-.RE
-.PP
-clean
-.RS 4
+.Pp
+.Dl "port -n upgrade wireshark"
+.Pp  
+Note that in selecting the variants to use in the upgraded build of the 
+port, any variants specified on the command line take highest precedence, 
+then the variants active in the latest installed version of the port, and 
+finally the global variants specified in variants.conf, if any.  Note that 
+upgrade will not normally rebuild a port only to change the selected 
+variants; you can either specify --enforce-variants, or deactivate the port and reinstall it 
+with different variants. 
+.Ss clean
 Clean the files used for building
-\fIportname\fR\&. To just remove the work files, use the
-\fB\-\-work\fR
-\fIactionflag\fR\&. This is the default when no flag is given\&. To remove the distribution files (fetched tarballs, patches, etc), specify
-\fB\-\-dist\fR\&. To remove the archive(s) for the current version of a port, pass
-\fB\-\-archive\fR\&. To remove the work files, distribution files and archives, pass
-\fB\-\-all\fR\&.
-.sp
+.Ar portname .
+To just remove the work files, use the
+.Fl -work
+.Ar actionflag .
+This is the default when no flag is given.
+To remove the distribution files (tarballs, etc), specify
+.Fl -dist .
+To remove the archive(s) for the current version of a port, pass
+.Fl -archive .
+To remove the work files, distribution files and archives, pass
+.Fl -all .
+To remove log files for certain port, pass
+.Fl -logs .
 For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port clean \-\-dist vim
-port clean \-\-archive vim
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-To remove only certain version(s) of a port\(cqs archives (version is any valid UNIX glob pattern), you can use:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port clean \-\-archive vim 6\&.2\&.114
-.fi
-.if n \{\
-.RE
-.\}
-.sp
+.Pp
+.Dl "port clean --dist vim"
+.Dl "port clean --archive vim"
+.Dl "port clean --logs vim"
+.Pp
+To remove only certain version(s) of a port's archives (
+.Ar version
+is any valid UNIX glob pattern), you can use:
+.Pp
+.Dl "port clean --archive vim 6.2.114"
+.Pp
 or:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port clean \-\-archive vim \'6\&.*\'
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-echo
-.RS 4
-Writes to stdout the arguments passed to
-\fIport\fR\&. This follows the expansion of
-\fIpseudo\-portnames\fR, portname glob patterns,
-\fIpseudo\-portname selectors\fR
-and the evaluation of
-\fIport\-expressions\fR\&.
-\fBecho\fR
-may be used to determine the exact set of ports to which a given string of arguments will expand, without performing any further operations on them\&.
-.sp
+.Pp
+.Dl "port clean --archive vim '6.*'"
+.Ss log
+Parses and shows log files for
+.Ar portname .
+To filter log files by some criterions use
+.Fl -phase 
+to specify phase you want to show and
+.Fl -verbosity
+to specify message category (msg, info, debug)
 For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port echo category:net
-port echo maintainer:jmpp and name:netw
-port echo maintainer:jmpp and \e( net* or category:text \e)
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-list
-.RS 4
-If no argument is given, display a list of the latest version of all available ports\&. If portname(s) are given as arguments, display a list of the latest version of each port\&.
-.RE
-.PP
-mirror
-.RS 4
-Create/update a local mirror of distfiles used for ports given on the command line\&. The filemap database can be reset by using the
-\fB\-\-new\fR
-option (though if no database is found, it will be created automatically)\&. If the fetched file does not match the checksum given in the Portfile, it is deleted\&. This can be used with
-\fIpseudo\-portnames\fR, e\&.g\&.
-\fIall\fR, to mirror everything\&. Note that if you use
-\fIall\fR, you\(cqll most likely want to use
-\fB\-p\fR
+.Pp
+.Dl "port log --phase configure vim"
+.Dl "port log --phase fetch --verbosity debug vim"
+.Pp
+.Ss echo
+Writes to stdout the arguments passed to
+.Nm .
+This follows the expansion of
+.Ar pseudo-portnames ,
+portname glob patterns,
+.Ar pseudo-portname selectors
+and the evaluation of port expressions.
+.Nm echo 
+may be used to determine the exact set of ports to which a given string of arguments will expand, without performing any further operations on them. For example:
+.Pp
+.Dl port echo category:net
+.Dl port echo maintainer:jmpp and name:netw
+.Dl port echo maintainer:jmpp and \e(\ net* or category:text\ \e)
+.Pp
+.Ss list
+If no argument is given, display a list of the latest version of all available ports.
+If portname(s) are given as arguments, display a list of the latest version of each port.
+.Ss mirror
+Create/update a local mirror of distfiles used for ports given on the command line.  The filemap database can be reset by using the
+.Fl -new
+option (though if no database is found, it will be created automatically).
+If the fetched file does not match the checksum given in the Portfile, it is
+deleted.  This can be used with
+.Ar pseudo-portnames ,
+eg,
+.Ar all ,
+to mirror everything.  Note that if you use
+.Ar all ,
+you'll most likely want to use
+.Fl p
 so
-\fBport\fR
-doesn\(cqt quit on the first download failure\&.
-.RE
-.PP
-version
-.RS 4
-Display the release number of the installed MacPorts infrastructure\&.
-.RE
-.PP
-platform
-.RS 4
-Display the platform information for the current system\&.
-.RE
-.PP
-selfupdate
-.RS 4
-Updates the MacPorts system, ports tree(s) and base tools if needed, from the MacPorts rsync server, installing the newest infrastructure available\&.
-.sp
-To update you would typically do:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-sudo port \-d selfupdate
-.fi
-.if n \{\
-.RE
-.\}
-.sp
+.Nm
+doesn't quit on the first download failure.
+.Ss version
+Display the release number of the installed MacPorts infrastructure.
+.Ss platform
+Display the platform information for the current system.
+.Ss selfupdate
+Updates the MacPorts system, ports tree(s) and base tools if needed, from the MacPorts rsync server,
+installing the newest infrastructure available. To update you would typically do:
+.Pp
+.Dl "sudo port -d selfupdate"
+.Pp
 See
-\fIsync\fR
-for more information about updating ports tree(s)\&.
-.RE
-.PP
-load
-.RS 4
-Provides a shortcut to using launchctl to load a port\(cqs daemon (as installed in /Library/LaunchDaemons)\&. It runs:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-launchctl load \-w /Library/LaunchDaemons/org\&.macports\&.${port}\&.plist
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-unload
-.RS 4
-A shortcut to launchctl, like load, but unloads the daemon\&.
-.RE
-.PP
-gohome
-.RS 4
-Loads the home page for the given portname in the default web browser\&.
-.RE
-.PP
-usage
-.RS 4
-Displays a condensed usage summary\&.
-.RE
-.PP
-help
-.RS 4
-Displays a summary of all available actions and port command syntax on stdout\&.
-.RE
-.SH "DEVELOPER TARGETS"
-.sp
-The targets that are often used by Port developers are intended to provide access to the different phases of a Port\(cqs build process:
-.PP
-dir
-.RS 4
+.Ic sync
+for more information about updating ports tree(s).
+.Ss load
+Provides a shortcut to using launchctl to load a port's daemon (as installed
+in /Library/LaunchDaemons).  It runs:
+.Pp
+.Dl launchctl load -w /Library/LaunchDaemons/org.macports.${port}.plist
+.Ss unload
+A shortcut to launchctl, like load, but unloads the daemon.
+.Ss gohome
+Loads the home page for the given 
+.Ar portname 
+in the default web browser.
+.Ss usage
+Displays a condensed usage summary.
+.Ss help
+Displays a summary of all available actions and port command syntax on stdout.
+.Sh DEVELOPER TARGETS
+The targets that are often used by Port developers are intended to provide access to the different phases of a Port's build process:
+.Ss dir
 Displays the path to the directory containing
-\fIportname\fR\&.
-.RE
-.PP
-work
-.RS 4
+.Ar portname .
+.Ss work
 Displays the path to the work directory for
-\fIportname\fR\&.
-.RE
-.PP
-cd
-.RS 4
-Changes the current working directory to the one containing portname\&. Only useful in interactive mode\&.
-.RE
-.PP
-file
-.RS 4
+.Ar portname .
+.Ss cd
+Changes the current working directory to the one containing
+.Ar portname .
+Only useful in interactive mode.
+.Ss file
 Displays the path to the Portfile for
-\fIportname\fR\&.
-.RE
-.PP
-url
-.RS 4
-Displays the URL for the path of the given portname, which can be passed as
-\fIport\-url\fR\&.\&.
-.RE
-.PP
-cat
-.RS 4
+.Ar portname .
+.Ss url
+Displays the URL for the path of the given
+.Ar portname ,
+which can be passed as port-url
+.Ss cat
 Concatenates and prints the contents of
-\fIPortfile\fR
-on stdout\&.
-.RE
-.PP
-edit, ed
-.RS 4
-Opens Portfile with your default editor specified in your shell\(cqs environment variable\&. Alias
-\fIed\fR
-also invokes this command\&.
-
-You can also use the \-\-editor flag on the command line to specify an alternative edi\- tor\&.
-.sp
-For example:
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port edit \-\-editor nano apache2
-.fi
-.if n \{\
-.RE
-.\}
-.RE
-.PP
-unarchive
-.RS 4
-Unpack the port from a pre\-built binary archive\&. When archive mode is enabled, this command is called automatically, prior to
-\fIfetch\fR, to check for an existing binary archive to unpack\&. If found, it is unpacked and all stages up to
-\fIinstall\fR
-are then skipped\&.
-.RE
-.PP
-fetch
-.RS 4
+.Ar Portfile
+on stdout.
+.Ss edit
+Opens
+.Ar Portfile 
+with your default editor specified in your shell's environment variable. Alias
+.Ar ed
+also invokes this command.
+.Pp
+You can also use the
+.Fl -editor
+flag on the command line to specify an alternative editor. For example:
+.Dl port edit --editor nano apache2
+.Pp
+.Ss ed
+An alias for
+.Ic edit .
+.Ss unarchive
+Unpack the port from a pre-built binary archive. When archive mode is enabled, this command is called automatically, prior to
+.Ar fetch ,
+to check for an existing binary archive to unpack. If found, it is unpacked and all stages up to
+.Ar install
+are then skipped.
+.Ss fetch
 Fetches the distribution files required to build
-\fIportname\fR\&.
-.RE
-.PP
-checksum
-.RS 4
-Compute the checksums of the distribution files for
-\fIportname\fR, and compare them to the checksums listed in
-\fIPortfile\fR\&.
-.RE
-.PP
-extract
-.RS 4
+.Ar portname .
+.Ss checksum
+Compute the checksums of the distribution files for 
+.Ar portname ,
+and compare them to the checksums listed in 
+.Ar Portfile .
+.Ss extract
 Extracts the distribution files for
-\fIportname\fR\&.
-.RE
-.PP
-patch
-.RS 4
-Applies any required patches to
-\fIportname\(cqs\fR
-extracted distribution files\&.
-.RE
-.PP
-configure
-.RS 4
+.Ar portname .
+.Ss patch
+Applies any required patches to 
+.Ar portname's
+extracted distribution files.
+.Ss configure
 Runs any configure process for
-\fIportname\fR\&.
-.RE
-.PP
-build
-.RS 4
+.Ar portname .
+.Ss build
 Build
-\fIportname\fR\&.
-.RE
-.PP
-destroot
-.RS 4
+.Ar portname .
+.Ss destroot
 Installs
-\fIportname\fR
-to a temporary directory\&.
-.RE
-.PP
-test
-.RS 4
+.Ar portname
+to a temporary directory.
+.Ss test
 Tests
-\fIportname\fR\&.
-.RE
-.PP
-lint
-.RS 4
-Verifies Portfile for portname\&. To nitpick about whitespace and patchfile names, use
-\fB\-\-nitpick\fR\&.
-.RE
-.PP
-archive
-.RS 4
-Archive the port for a later unarchive\&. When archive mode is enabled, binary archives will be created automatically whenever an install is performed, or when the archive target is called explicitly\&.
-.RE
-.PP
-distcheck
-.RS 4
-Check if the distfiles haven\(cqt changed and can be fetched\&.
-.RE
-.PP
-distfiles
-.RS 4
-Display each distfile, its checksums, and the URLs used to fetch it\&.
-.RE
-.PP
-livecheck
-.RS 4
-Check if the software hasn\(cqt been updated since the Portfile was last modified\&.
-.RE
-.SH "PACKAGING TARGETS"
-.sp
+.Ar portname .
+.Ss lint
+Verifies Portfile for
+.Ar portname .
+To nitpick about whitespace and patchfile names, use
+.Fl -nitpick .
+.Ss archive
+Archive the port for a later
+.Ar unarchive .
+When archive mode is enabled, binary archives will be created automatically whenever an
+.Ar install
+is performed, or when the
+.Ar archive
+target is called explicitly.
+.Ss distcheck
+Check if the distfiles haven't changed and can be fetched.
+.Ss distfiles
+Display each distfile, its checksums, and the URLs used to fetch it.
+.Ss livecheck
+Check if the software hasn't been updated since the Portfile was last modified.
+.Sh PACKAGING TARGETS
 There are also targets for producing installable packages of ports:
-.PP
-pkg
-.RS 4
+.Pp
+.Ss pkg
 Creates an OS X installer package of
-\fIportname\fR\&.
-.RE
-.PP
-mpkg
-.RS 4
-Creates an OS X installer metapackage of
-\fIportname\fR
-and its dependencies\&.
-.RE
-.PP
-dmg
-.RS 4
-Creates an internet\-enabled disk image containing an OS X package of
-\fIportname\fR\&.
-.RE
-.PP
-mdmg
-.RS 4
-Creates an internet\-enabled disk image containing an OS X metapackage of
-\fIportname\fR
-and its dependencies\&.
-.RE
-.PP
-rpm
-.RS 4
+.Ar portname.
+.Ss mpkg
+Creates an OS X installer metapackage of 
+.Ar portname
+and its dependencies.
+.Ss dmg
+Creates an internet-enabled disk image containing an OS X package of
+.Ar portname .
+.Ss mdmg
+Creates an internet-enabled disk image containing an OS X metapackage of
+.Ar portname
+and its dependencies.
+.Ss rpm
 Creates an RPM binary package of
-\fIportname\fR, similar to a tgz \(lqarchive\(rq\&.
-.RE
-.PP
-srpm
-.RS 4
+.Ar portname ,
+similar to a tgz "archive".
+.Ss srpm
 Creates a SRPM source package of
-\fIportname\fR, similar to a xar \(lqportpkg\(rq\&.
-.RE
-.PP
-dpkg
-.RS 4
+.Ar portname ,
+similar to a xar "portpkg".
+.Ss dpkg
 Creates a DEB binary package of
-\fIportname\fR\&.
-.RE
-.SH "EXAMPLES"
-.sp
-The following demonstrates invoking port with the extract target on portdir \(oq`textproc/figlet\'\' and extract\&.suffix set to ``\&.tgz\(cq\':
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-port extract \-D textproc/figlet extract\&.suffix=\&.tgz
-.fi
-.if n \{\
-.RE
-.\}
-.SH "FILES"
-.PP
-${prefix}/etc/macports/macports\&.conf
-.RS 4
-Global configuration file for the MacPorts system\&.
-.RE
-.PP
-${prefix}/etc/macports/sources\&.conf
-.RS 4
-Global listing of the ports trees used by MacPorts\&. This file also enables rsync synchronization\&.
-.RE
-.PP
-${prefix}/etc/macports/variants\&.conf
-.RS 4
-Global variants used when a port is installed\&.
-.RE
-.PP
-~/\&.macports/macports\&.conf
-.RS 4
-User configuration file for the MacPorts system\&. It overrides the global
-\fImacports\&.conf(5)\fR
-file\&.
-.RE
-.SH "DIAGNOSTICS"
-.sp
-The \fBport\fR utility exits 0 on success, and >0 if an error occurs\&.
-.SH "SEE ALSO"
-.sp
-macports\&.conf(5), portfile(7), portgroup(7), portstyle(7), porthier(7)
-.SH "AUTHORS"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-(C) 2009 The MacPorts Project
-Landon Fuller <landonf at macports\&.org>
-James Berry <jberry at macports\&.org>
-Jordan K\&. Hubbard <jkh at macports\&.org>
-Juan Manuel Palacios <jmpp at macports\&.org>
-Kevin Van Vechten <kevin at opendarwin\&.org>
-Ole Guldberg Jensen <olegb at opendarwin\&.org>
-Robert Shaw <rshaw at opendarwin\&.org>
-Chris Ridd <cjr at opendarwin\&.org>
-Matt Anton <matt at opendarwin\&.org>
-Joe Auty <joe at opendarwin\&.org>
-Rainer Mueller <raimue at macports\&.org>
-.fi
-.if n \{\
-.RE
-.\}
+.Ar portname .
+.Sh EXAMPLES
+The following demonstrates invoking
+.Nm
+with the
+.Ar extract
+target on
+.Ar portdir
+\&"textproc/figlet" and extract.suffix set to ".tgz":
+.Pp
+.Dl "port extract -D textproc/figlet extract.suffix=.tgz"
+.Pp
+.Sh FILES
+.Bl -tag -width
+.It Va ${prefix}/etc/macports/macports.conf
+Global configuration file for the MacPorts system.
+.It Va ${prefix}/etc/macports/sources.conf
+Global listing of the ports trees used by MacPorts. This file also enables rsync synchronization.
+.It Va ${prefix}/etc/macports/variants.conf
+Global variants used when a port is installed.
+.It Va ~/.macports/macports.conf
+User configuration file for the MacPorts system. It overrides the global
+.Ar macports.conf
+file.
+.El
+.Sh DIAGNOSTICS
+.Ex -std
+.Sh SEE ALSO
+.Xr macports.conf 5 ,
+.Xr portfile 7 ,
+.Xr portgroup 7 ,
+.Xr portstyle 7 ,
+.Xr porthier 7
+.Sh AUTHORS
+.An "Landon Fuller" Aq landonf at macports.org
+.An "James Berry" Aq jberry at macports.org
+.An "Jordan K. Hubbard" Aq jkh at macports.org
+.An "Juan Manuel Palacios" Aq jmpp at macports.org
+.An "Kevin Van Vechten" Aq kevin at opendarwin.org
+.An "Ole Guldberg Jensen" Aq olegb at opendarwin.org
+.An "Robert Shaw" Aq rshaw at opendarwin.org
+.An "Chris Ridd" Aq cjr at opendarwin.org
+.An "Matt Anton" Aq matt at opendarwin.org
+.An "Joe Auty" Aq joe at opendarwin.org

Modified: branches/new-help-system/base/doc/portfile.7
===================================================================
--- branches/new-help-system/base/doc/portfile.7	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/portfile.7	2010-03-28 16:55:01 UTC (rev 65589)
@@ -129,6 +129,37 @@
 
     painting, processing, and rendering tools.
 .Ed
+.It Ic notes
+Notes for setup and use of the port.  This is shown after the port is
+activated and anytime the
+.Ic notes
+command is used; for example:
+.Pp
+.Dl "port notes python26"
+.Pp
+The advantage to using
+.Ic notes
+instead of
+.Ic ui_msg
+is that it can be queried after a port is installed but
+.Ic ui_msg
+is only printed during an install.  Therefore
+.Ic notes
+is good for any information which may be needed anytime after an install.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Bd -literal -offset indent -compact
+notes To fully complete your installation and make python \e\
+
+   ${branch} the default, please run: \e\
+
+   sudo port install python_select \e\
+
+   sudo python_select ${name}
+.Ed
 .It Ic revision
 Local revision number of
 .Nm .
@@ -250,6 +281,17 @@
 	sha1 a633a9a811a138eac5ed440d583473b644135ef5 \e\ 
 	rmd160 941cf8f2ef8459ec4f9ce65772e134505d46566
 .Ed
+.It Ic macosx_deployment_target
+Value for MACOSX_DEPLOYMENT_TARGET environment variable when invoking the configure script.
+.br 
+.Sy Type:
+.Em optional
+.br 
+.Sy Default:
+.Em (current OS version)
+.br
+.Sy Example:
+.Dl macosx_deployment_target 10.4
 .It Ic use_parallel_build
 If set to yes (and the user has enabled buildmakejobs in
 .Pa macports.conf
@@ -306,6 +348,40 @@
 .br
 .Sy Example:
 .Dl use_configure no
+.It Ic copy_log_files Ar path/to/logfile1 Ar path/to/logfile2 Ar ...
+Copy specific log files from the workdir to the main macports log dir
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl copy_log_files config.log
+.It Ic conflicts
+Used to list ports which conflict with the one containing the
+.Cm conflicts
+declaration.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none (empty)
+.br
+.Sy Example:
+.Dl conflicts cdrtools
+.It Ic replaced_by
+When a particular port is deprecated in favor of another, use
+.Cm replaced_by
+in the deprecated port and list the new one to be used.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em none (empty)
+.br
+.Sy Example:
+.Dl replaced_by xorg-renderproto
 .El
 .Sh TARGET HOOKS
 A number of hooks are available for customizing many of the standard
@@ -430,33 +506,33 @@
 .Sy Default:
 .Em ${sysportpath}/distfiles/${dist_subdir}/
 .It Ic os.arch
-Identifies hardware type (eg "powerpc").
+Identifies hardware type (e.g. "powerpc").
 .br
 .Sy Type:
 .Em read-only
 .It Ic os.version
-Version number of operating system (eg "7.0").
+Version number of operating system (e.g. "7.0").
 .br
 .Sy Type:
 .Em read-only
 .It Ic os.endian
-Endianness of the processor (eg "bigEndian").
+Endianness of the processor (e.g. "bigEndian").
 .br
 .Sy Type:
 .Em read-only
 .It Ic os.platform
-Operating system name (eg "darwin").
+Operating system name (e.g. "darwin").
 .br
 .Sy Type:
 .Em read-only
 .It Ic install.user
-User for MacPorts installation (eg
+User for MacPorts installation (e.g.
 .Pa root )
 .br
 .Sy Type:
 .Em read-only
 .It Ic install.group
-Group for MacPorts installation (eg
+Group for MacPorts installation (e.g.
 .Pa wheel )
 .br
 .Sy Type:
@@ -665,6 +741,18 @@
 .br
 .Sy Example:
 .Dl use_lzma yes
+.It Ic use_xz
+Use xz.
+.br
+Sets extract.suffix to: .xz
+.br
+Sets extract.cmd to: xz
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Example:
+.Dl use_xz yes
 .It Ic use_7z
 Use 7z (7zip).
 .br
@@ -883,6 +971,17 @@
 .Sh CONFIGURE OPTIONS
 MacPorts provide special support for configure flags (CFLAGS, LDFLAGS, CPPFLAGS, CXXFLAGS, CC, CXX, CPP, FC, F77, F90). Please note that the previous way to alter these flags (using configure.env) may become deprecated at some point. The following options are defined:
 .Bl -tag -width lc
+.It Ic configure.optflags
+Flags to use for optimization.
+.br
+.Sy Type:
+.Em optional
+.br
+.Sy Default:
+.Em -O2
+.br
+.Sy Example:
+.Dl configure.optflags -O3
 .It Ic configure.cflags
 Flags to put in the CFLAGS environment variable when invoking the configure script.
 .br
@@ -890,7 +989,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .br
 .Sy Example:
 .Dl configure.cflags-append -DHAS_LRINTF
@@ -909,7 +1008,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.objcflags
 Flags to put in the OBJCFLAGS environment variable when invoking the configure script.
 .br
@@ -917,7 +1016,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.ldflags
 Flags to put in the LDFLAGS environment variable when invoking the configure script.
 .br
@@ -933,7 +1032,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.f90flags
 Flags to put in the F90FLAGS environment variable when invoking the configure script.
 .br 
@@ -941,7 +1040,7 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.fcflags
 Flags to put in the FCFLAGS environment variable when invoking the configure script.
 .br 
@@ -949,20 +1048,12 @@
 .Em optional
 .br
 .Sy Default:
-.Em -O2
+.Em ${configure.optflags}
 .It Ic configure.classpath
 Flags to put in the CLASSPATH environment variable when invoking the configure script.
 .br 
 .Sy Type:
 .Em optional
-.It Ic configure.macosx_deployment_target
-Flags to put in the MACOSX_DEPLOYMENT_TARGET environment variable when invoking the configure script.
-.br 
-.Sy Type:
-.Em optional
-.br 
-.Sy Example:
-.Dl configure.macosx_deployment_target 10.4
 .It Ic configure.cc
 C-compiler to put in the CC environment variable when invoking the configure script.
 .br
@@ -1944,13 +2035,12 @@
 .It Ic md5 Ar
 Compute the MD5 hashes of the file(s).
 .It Ic rpm-vercomp Ar versionA Ar versionB
-Compare two RPM-format versions for equality.
-.It Ic sudo Ar password Ar command Ar \&...
-Execute
-.Ar command
-using
-.Cm sudo
-with the provided password.
+Compare two RPM-format versions for equality.  The return value is like
+strcmp(), returning -1, 0, or 1 when versionA is earlier, equal to, or
+later than versionB, respectively.  Note that some comparisions featuring
+floating-point notation may compare incorrectly, e.g. 2.101 is considered
+later than 2.2 (101 is larger than 2) which may be incorrect per some
+projects versioning methods (see ticket #11873).
 .It Xo
 .Ic lpush
 .Ar varName

Modified: branches/new-help-system/base/doc/portstyle.7
===================================================================
--- branches/new-help-system/base/doc/portstyle.7	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/portstyle.7	2010-03-28 16:55:01 UTC (rev 65589)
@@ -27,7 +27,7 @@
 .Os
 .Sh NAME
 .Nm portstyle
-.Nd style guide for ports their associated files
+.Nd style guide for ports
 .Sh DESCRIPTION
 A port consists of a directory and its contents, within a category subdirectory
 of the root of the ports tree.

Modified: branches/new-help-system/base/doc/prefix.mtree.in
===================================================================
--- branches/new-help-system/base/doc/prefix.mtree.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/prefix.mtree.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -12,6 +12,8 @@
     include
     ..
     lib
+        pkgconfig
+        ..
     ..
     libexec
     ..
@@ -239,8 +241,12 @@
     ..
     var
         macports
+            build
+            ..
             distfiles
             ..
+            logs
+            ..
             receipts
             ..
             registry

Modified: branches/new-help-system/base/doc/variants.conf
===================================================================
--- branches/new-help-system/base/doc/variants.conf	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/doc/variants.conf	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,11 +1,6 @@
 # To specify global variants to use for all port builds,
 # customize this file to list variant settings you want.
 #
-# Be sure to uncomment/define the variants_conf setting
-# in the system wide ${prefix}/etc/macports/macports.conf
-# file or in your personal ~/.macports/macports.conf to
-# point to this file to enable this feature.
-#
 # Any variants specified here that are not supported by
 # a port will just be ignored. Multiple variants can be
 # specified per line, or one per line is also allowed.

Deleted: branches/new-help-system/base/m4/objc.m4
===================================================================
--- branches/new-help-system/base/m4/objc.m4	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/m4/objc.m4	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,623 +0,0 @@
-# objc.m4
-# Based on c.m4 from GNU Autoconf
-# The Objective C support, added by Landon Fuller <landonf at opendarwin.org>
-# on March 10th, 2004, is heavily based on Autoconf's existing C++ support.
-#
-########### Copyright and Licensing terms ##########
-#
-# This file is part of Autoconf.                       -*- Autoconf -*-
-# Programming languages support.
-# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-#
-# As a special exception, the Free Software Foundation gives unlimited
-# permission to copy, distribute and modify the configure scripts that
-# are the output of Autoconf.  You need not follow the terms of the GNU
-# General Public License when using or distributing such scripts, even
-# though portions of the text of Autoconf appear in them.  The GNU
-# General Public License (GPL) does govern all other use of the material
-# that constitutes the Autoconf program.
-#
-# Certain portions of the Autoconf source text are designed to be copied
-# (in certain cases, depending on the input) into the output of
-# Autoconf.  We call these the "data" portions.  The rest of the Autoconf
-# source text consists of comments plus executable code that decides which
-# of the data portions to output in any given case.  We call these
-# comments and executable code the "non-data" portions.  Autoconf never
-# copies any of the non-data portions into its output.
-#
-# This special exception to the GPL applies to versions of Autoconf
-# released by the Free Software Foundation.  When you make and
-# distribute a modified version of Autoconf, you may extend this special
-# exception to the GPL to apply to your modified version as well, *unless*
-# your modified version has the potential to copy into its output some
-# of the text that was the non-data portion of the version that you started
-# with.  (In other words, unless your change moves or copies text from
-# the non-data portions to the data portions.)  If your modification has
-# such potential, you must delete any notice of this special exception
-# to the GPL from your modified version.
-#
-# Written by David MacKenzie, with help from
-# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
-# Roland McGrath, Noah Friedman, david d zuhn, and many others.
-#
-########## GNU General Public License (GPL), version 2  ##########
-#
-#		    GNU GENERAL PUBLIC LICENSE
-#		       Version 2, June 1991
-#
-#  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-#      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#  Everyone is permitted to copy and distribute verbatim copies
-#  of this license document, but changing it is not allowed.
-#
-# 			    Preamble
-# 
-#  The licenses for most software are designed to take away your
-# freedom to share and change it.  By contrast, the GNU General Public
-# License is intended to guarantee your freedom to share and change free
-# software--to make sure the software is free for all its users.  This
-# General Public License applies to most of the Free Software
-# Foundation's software and to any other program whose authors commit to
-# using it.  (Some other Free Software Foundation software is covered by
-# the GNU Library General Public License instead.)  You can apply it to
-# your programs, too.
-#
-#  When we speak of free software, we are referring to freedom, not
-# price.  Our General Public Licenses are designed to make sure that you
-# have the freedom to distribute copies of free software (and charge for
-# this service if you wish), that you receive source code or can get it
-# if you want it, that you can change the software or use pieces of it
-# in new free programs; and that you know you can do these things.
-#
-#  To protect your rights, we need to make restrictions that forbid
-# anyone to deny you these rights or to ask you to surrender the rights.
-# These restrictions translate to certain responsibilities for you if you
-# distribute copies of the software, or if you modify it.
-#
-#  For example, if you distribute copies of such a program, whether
-# gratis or for a fee, you must give the recipients all the rights that
-# you have.  You must make sure that they, too, receive or can get the
-# source code.  And you must show them these terms so they know their
-# rights.
-#
-#  We protect your rights with two steps: (1) copyright the software, and
-# (2) offer you this license which gives you legal permission to copy,
-# distribute and/or modify the software.
-#
-#  Also, for each author's protection and ours, we want to make certain
-# that everyone understands that there is no warranty for this free
-# software.  If the software is modified by someone else and passed on, we
-# want its recipients to know that what they have is not the original, so
-# that any problems introduced by others will not reflect on the original
-# authors' reputations.
-#
-#  Finally, any free program is threatened constantly by software
-# patents.  We wish to avoid the danger that redistributors of a free
-# program will individually obtain patent licenses, in effect making the
-# program proprietary.  To prevent this, we have made it clear that any
-# patent must be licensed for everyone's free use or not licensed at all.
-#
-#  The precise terms and conditions for copying, distribution and
-# modification follow.
-#
-#		    GNU GENERAL PUBLIC LICENSE
-#  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-#
-#  0. This License applies to any program or other work which contains
-# a notice placed by the copyright holder saying it may be distributed
-# under the terms of this General Public License.  The "Program", below,
-# refers to any such program or work, and a "work based on the Program"
-# means either the Program or any derivative work under copyright law:
-# that is to say, a work containing the Program or a portion of it,
-# either verbatim or with modifications and/or translated into another
-# language.  (Hereinafter, translation is included without limitation in
-# the term "modification".)  Each licensee is addressed as "you".
-#
-# Activities other than copying, distribution and modification are not
-# covered by this License; they are outside its scope.  The act of
-# running the Program is not restricted, and the output from the Program
-# is covered only if its contents constitute a work based on the
-# Program (independent of having been made by running the Program).
-# Whether that is true depends on what the Program does.
-#
-#  1. You may copy and distribute verbatim copies of the Program's
-# source code as you receive it, in any medium, provided that you
-# conspicuously and appropriately publish on each copy an appropriate
-# copyright notice and disclaimer of warranty; keep intact all the
-# notices that refer to this License and to the absence of any warranty;
-# and give any other recipients of the Program a copy of this License
-# along with the Program.
-#
-# You may charge a fee for the physical act of transferring a copy, and
-# you may at your option offer warranty protection in exchange for a fee.
-#
-#  2. You may modify your copy or copies of the Program or any portion
-# of it, thus forming a work based on the Program, and copy and
-# distribute such modifications or work under the terms of Section 1
-# above, provided that you also meet all of these conditions:
-#
-#    a) You must cause the modified files to carry prominent notices
-#    stating that you changed the files and the date of any change.
-#
-#    b) You must cause any work that you distribute or publish, that in
-#    whole or in part contains or is derived from the Program or any
-#    part thereof, to be licensed as a whole at no charge to all third
-#    parties under the terms of this License.
-#
-#    c) If the modified program normally reads commands interactively
-#    when run, you must cause it, when started running for such
-#    interactive use in the most ordinary way, to print or display an
-#    announcement including an appropriate copyright notice and a
-#    notice that there is no warranty (or else, saying that you provide
-#    a warranty) and that users may redistribute the program under
-#    these conditions, and telling the user how to view a copy of this
-#    License.  (Exception: if the Program itself is interactive but
-#    does not normally print such an announcement, your work based on
-#    the Program is not required to print an announcement.)
-#
-# These requirements apply to the modified work as a whole.  If
-# identifiable sections of that work are not derived from the Program,
-# and can be reasonably considered independent and separate works in
-# themselves, then this License, and its terms, do not apply to those
-# sections when you distribute them as separate works.  But when you
-# distribute the same sections as part of a whole which is a work based
-# on the Program, the distribution of the whole must be on the terms of
-# this License, whose permissions for other licensees extend to the
-# entire whole, and thus to each and every part regardless of who wrote it.
-#
-# Thus, it is not the intent of this section to claim rights or contest
-# your rights to work written entirely by you; rather, the intent is to
-# exercise the right to control the distribution of derivative or
-# collective works based on the Program.
-#
-# In addition, mere aggregation of another work not based on the Program
-# with the Program (or with a work based on the Program) on a volume of
-# a storage or distribution medium does not bring the other work under
-# the scope of this License.
-#
-#  3. You may copy and distribute the Program (or a work based on it,
-# under Section 2) in object code or executable form under the terms of
-# Sections 1 and 2 above provided that you also do one of the following:
-#
-#    a) Accompany it with the complete corresponding machine-readable
-#    source code, which must be distributed under the terms of Sections
-#    1 and 2 above on a medium customarily used for software interchange; or,
-#
-#    b) Accompany it with a written offer, valid for at least three
-#    years, to give any third party, for a charge no more than your
-#    cost of physically performing source distribution, a complete
-#    machine-readable copy of the corresponding source code, to be
-#    distributed under the terms of Sections 1 and 2 above on a medium
-#    customarily used for software interchange; or,
-#
-#    c) Accompany it with the information you received as to the offer
-#    to distribute corresponding source code.  (This alternative is
-#    allowed only for noncommercial distribution and only if you
-#    received the program in object code or executable form with such
-#    an offer, in accord with Subsection b above.)
-#
-# The source code for a work means the preferred form of the work for
-# making modifications to it.  For an executable work, complete source
-# code means all the source code for all modules it contains, plus any
-# associated interface definition files, plus the scripts used to
-# control compilation and installation of the executable.  However, as a
-# special exception, the source code distributed need not include
-# anything that is normally distributed (in either source or binary
-# form) with the major components (compiler, kernel, and so on) of the
-# operating system on which the executable runs, unless that component
-# itself accompanies the executable.
-#
-# If distribution of executable or object code is made by offering
-# access to copy from a designated place, then offering equivalent
-# access to copy the source code from the same place counts as
-# distribution of the source code, even though third parties are not
-# compelled to copy the source along with the object code.
-#
-#  4. You may not copy, modify, sublicense, or distribute the Program
-# except as expressly provided under this License.  Any attempt
-# otherwise to copy, modify, sublicense or distribute the Program is
-# void, and will automatically terminate your rights under this License.
-# However, parties who have received copies, or rights, from you under
-# this License will not have their licenses terminated so long as such
-# parties remain in full compliance.
-#
-#  5. You are not required to accept this License, since you have not
-# signed it.  However, nothing else grants you permission to modify or
-# distribute the Program or its derivative works.  These actions are
-# prohibited by law if you do not accept this License.  Therefore, by
-# modifying or distributing the Program (or any work based on the
-# Program), you indicate your acceptance of this License to do so, and
-# all its terms and conditions for copying, distributing or modifying
-# the Program or works based on it.
-
-#  6. Each time you redistribute the Program (or any work based on the
-# Program), the recipient automatically receives a license from the
-# original licensor to copy, distribute or modify the Program subject to
-# these terms and conditions.  You may not impose any further
-# restrictions on the recipients' exercise of the rights granted herein.
-# You are not responsible for enforcing compliance by third parties to
-# this License.
-#
-#  7. If, as a consequence of a court judgment or allegation of patent
-# infringement or for any other reason (not limited to patent issues),
-# conditions are imposed on you (whether by court order, agreement or
-# otherwise) that contradict the conditions of this License, they do not
-# excuse you from the conditions of this License.  If you cannot
-# distribute so as to satisfy simultaneously your obligations under this
-# License and any other pertinent obligations, then as a consequence you
-# may not distribute the Program at all.  For example, if a patent
-# license would not permit royalty-free redistribution of the Program by
-# all those who receive copies directly or indirectly through you, then
-# the only way you could satisfy both it and this License would be to
-# refrain entirely from distribution of the Program.
-#
-# If any portion of this section is held invalid or unenforceable under
-# any particular circumstance, the balance of the section is intended to
-# apply and the section as a whole is intended to apply in other
-# circumstances.
-#
-# It is not the purpose of this section to induce you to infringe any
-# patents or other property right claims or to contest validity of any
-# such claims; this section has the sole purpose of protecting the
-# integrity of the free software distribution system, which is
-# implemented by public license practices.  Many people have made
-# generous contributions to the wide range of software distributed
-# through that system in reliance on consistent application of that
-# system; it is up to the author/donor to decide if he or she is willing
-# to distribute software through any other system and a licensee cannot
-# impose that choice.
-#
-# This section is intended to make thoroughly clear what is believed to
-# be a consequence of the rest of this License.
-#
-#  8. If the distribution and/or use of the Program is restricted in
-# certain countries either by patents or by copyrighted interfaces, the
-# original copyright holder who places the Program under this License
-# may add an explicit geographical distribution limitation excluding
-# those countries, so that distribution is permitted only in or among
-# countries not thus excluded.  In such case, this License incorporates
-# the limitation as if written in the body of this License.
-#
-#  9. The Free Software Foundation may publish revised and/or new versions
-# of the General Public License from time to time.  Such new versions will
-# be similar in spirit to the present version, but may differ in detail to
-# address new problems or concerns.
-#
-# Each version is given a distinguishing version number.  If the Program
-# specifies a version number of this License which applies to it and "any
-# later version", you have the option of following the terms and conditions
-# either of that version or of any later version published by the Free
-# Software Foundation.  If the Program does not specify a version number of
-# this License, you may choose any version ever published by the Free Software
-# Foundation.
-#
-#  10. If you wish to incorporate parts of the Program into other free
-# programs whose distribution conditions are different, write to the author
-# to ask for permission.  For software which is copyrighted by the Free
-# Software Foundation, write to the Free Software Foundation; we sometimes
-# make exceptions for this.  Our decision will be guided by the two goals
-# of preserving the free status of all derivatives of our free software and
-# of promoting the sharing and reuse of software generally.
-#
-#			    NO WARRANTY
-#
-#  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-# FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-# OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-# PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-# OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-# TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-# PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-# REPAIR OR CORRECTION.
-#
-#  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-# WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-# REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-# INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-# OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-# TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-# YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-# PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGES.
-#
-#		     END OF TERMS AND CONDITIONS
-#
-#	    How to Apply These Terms to Your New Programs
-#
-#  If you develop a new program, and you want it to be of the greatest
-# possible use to the public, the best way to achieve this is to make it
-# free software which everyone can redistribute and change under these terms.
-#
-#  To do so, attach the following notices to the program.  It is safest
-# to attach them to the start of each source file to most effectively
-# convey the exclusion of warranty; and each file should have at least
-# the "copyright" line and a pointer to where the full notice is found.
-#
-#    <one line to give the program's name and a brief idea of what it does.>
-#    Copyright (C) <year>  <name of author>
-#
-#    This program is free software; you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation; either version 2 of the License, or
-#    (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU General Public License for more details.
-#
-#    You should have received a copy of the GNU General Public License
-#    along with this program; if not, write to the Free Software
-#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-#
-#
-# Also add information on how to contact you by electronic and paper mail.
-#
-# If the program is interactive, make it output a short notice like this
-# when it starts in an interactive mode:
-#
-#    Gnomovision version 69, Copyright (C) year  name of author
-#    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-#    This is free software, and you are welcome to redistribute it
-#    under certain conditions; type `show c' for details.
-#
-# The hypothetical commands `show w' and `show c' should show the appropriate
-# parts of the General Public License.  Of course, the commands you use may
-# be called something other than `show w' and `show c'; they could even be
-# mouse-clicks or menu items--whatever suits your program.
-#
-# You should also get your employer (if you work as a programmer) or your
-# school, if any, to sign a "copyright disclaimer" for the program, if
-# necessary.  Here is a sample; alter the names:
-#
-#  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-#  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-#
-#  <signature of Ty Coon>, 1 April 1989
-#  Ty Coon, President of Vice
-#
-# This General Public License does not permit incorporating your program into
-# proprietary programs.  If your program is a subroutine library, you may
-# consider it more useful to permit linking proprietary applications with the
-# library.  If this is what you want to do, use the GNU Library General
-# Public License instead of this License.
-#
-########## End of GNU General Public License (GPL), version 2 ##########
-
-## ----------------------- ##
-## 1. Language selection.  ##
-## ----------------------- ##
-
-
-# ------------------------------ #
-# 1d. The Objective C language.  #
-# ------------------------------ #
-
-# AC_LANG(Objective C)
-# --------------------
-# OBJCFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-m4_define([AC_LANG(Objective C)],
-[ac_ext=m
-ac_cpp='$OBJCPP $CPPFLAGS'
-ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
-ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
-ac_compiler_gnu=$ac_cv_objc_compiler_gnu
-])
-
-
-# AC_LANG_OBJC
-# -------------------------
-AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)])
-
-
-# _AC_LANG_ABBREV(Objective C)
-# ----------------------------
-m4_define([_AC_LANG_ABBREV(Objective C)], [objc])
-
-
-# _AC_LANG_PREFIX(Objective C)
-# ----------------------------
-m4_define([_AC_LANG_PREFIX(Objective C)], [OBJC])
-
-
-
-## ---------------------- ##
-## 2.Producing programs.  ##
-## ---------------------- ##
-
-
-# ------------------------- #
-# 2d. Objective C sources.  #
-# ------------------------- #
-
-# AC_LANG_SOURCE(Objective C)(BODY)
-# ---------------------------------
-m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(Objective C)])
-
-
-# AC_LANG_PROGRAM(Objective C)([PROLOGUE], [BODY])
-# ------------------------------------------------
-m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(Objective C)])
-
-
-# AC_LANG_CALL(Objective C)(PROLOGUE, FUNCTION)
-# ---------------------------------------------
-m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(Objective C)])
-
-
-# AC_LANG_FUNC_LINK_TRY(Objective C)(FUNCTION)
-# --------------------------------------------
-m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(Objective C)])
-
-
-# AC_LANG_BOOL_COMPILE_TRY(Objective C)(PROLOGUE, EXPRESSION)
-# -----------------------------------------------------------
-m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(Objective C)])
-
-
-# AC_LANG_INT_SAVE(Objective C)(PROLOGUE, EXPRESSION)
-# ---------------------------------------------------
-m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(Objective C)])
-
-
-
-## -------------------------------------------- ##
-## 3. Looking for Compilers and Preprocessors.  ##
-## -------------------------------------------- ##
-
-
-# ------------------------------ #
-# 3d. The Objective C compiler.  #
-# ------------------------------ #
-
-
-# AC_LANG_PREPROC(Objecitve C)
-# ----------------------------
-# Find the Objective C preprocessor.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
-AC_DEFUN([AC_LANG_PREPROC(Objective C)],
-[AC_REQUIRE([AC_PROG_OBJCPP])])
-
-
-# AC_PROG_OBJCPP
-# --------------
-# Find a working Objective C preprocessor.
-# We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
-# between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_OBJC.
-AC_DEFUN([AC_PROG_OBJCPP],
-[AC_REQUIRE([AC_PROG_OBJC])dnl
-AC_ARG_VAR([OBJCPP],   [Objective C preprocessor])dnl
-_AC_ARG_VAR_CPPFLAGS()dnl
-AC_LANG_PUSH(Objective C)dnl
-AC_MSG_CHECKING([how to run the Objective C preprocessor])
-if test -z "$OBJCPP"; then
-  AC_CACHE_VAL(ac_cv_prog_OBJCPP,
-  [dnl
-    # Double quotes because OBJCPP needs to be expanded
-    for OBJCPP in "$OBJC -E" "/lib/cpp"
-    do
-      _AC_PROG_PREPROC_WORKS_IFELSE([break])
-    done
-    ac_cv_prog_OBJCPP=$OBJCPP
-  ])dnl
-  OBJCPP=$ac_cv_prog_OBJCPP
-else
-  ac_cv_prog_OBJCPP=$OBJCPP
-fi
-AC_MSG_RESULT([$OBJCPP])
-_AC_PROG_PREPROC_WORKS_IFELSE([],
-	  [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])])
-AC_SUBST(OBJCPP)dnl
-AC_LANG_POP(Objective C)dnl
-])# AC_PROG_OBJCPP
-
-
-# AC_LANG_COMPILER(Objective C)
-# -----------------------------
-# Find the Objective C compiler.  Must be AC_DEFUN'd to be AC_REQUIRE'able.
-AC_DEFUN([AC_LANG_COMPILER(Objective C)],
-[AC_REQUIRE([AC_PROG_OBJC])])
-
-
-# ac_cv_prog_objc
-# ---------------
-# We used to name the cache variable this way.
-AU_DEFUN([ac_cv_prog_objc],
-[ac_cv_objc_compiler_gnu])
-
-
-# AC_PROG_OBJC([LIST-OF-COMPILERS])
-# ---------------------------------
-# LIST-OF-COMPILERS is a space separated list of Objective C compilers
-# to search for (if not specified, a default list is used).  This just gives
-# the user an opportunity to specify an alternative search list for the
-# Objective C compiler.
-# cc    Native compiler
-# objc  David Stes' Portable Object Compiler
-AN_MAKEVAR([OBJC],  [AC_PROG_OBJC])
-AN_PROGRAM([gcc],   [AC_PROG_OBJC])
-AN_PROGRAM([cc],    [AC_PROG_OBJC])
-AC_DEFUN([AC_PROG_OBJC],
-[AC_LANG_PUSH(Objective C)dnl
-AC_ARG_VAR([OBJC],      [Objective C compiler command])dnl
-AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-_AC_ARG_VAR_CPPFLAGS()dnl
-AC_CHECK_TOOLS(OBJC,
-	       [$CCC m4_default([$1],
-			  [gcc cc objc])],
-	       gcc)
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD
-ac_compiler=`set X $ac_compile; echo $[2]`
-_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD])
-_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD])
-
-m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
-m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
-_AC_LANG_COMPILER_GNU
-GOBJC=`test $ac_compiler_gnu = yes && echo yes`
-_AC_PROG_OBJC_G
-AC_LANG_POP(Objective C)dnl
-])# AC_PROG_OBJC
-
-
-# _AC_PROG_OBJC_G
-# ---------------
-# Check whether -g works, even if OBJCFLAGS is set, in case the package
-# plays around with OBJCFLAGS (such as to build both debugging and
-# normal versions of a library), tasteless as that idea is.
-m4_define([_AC_PROG_OBJC_G],
-[ac_test_OBJCFLAGS=${OBJCFLAGS+set}
-ac_save_OBJCFLAGS=$OBJCFLAGS
-OBJCFLAGS="-g"
-AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g,
-	       [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
-				   [ac_cv_prog_objc_g=yes],
-				   [ac_cv_prog_objc_g=no])])
-if test "$ac_test_OBJCFLAGS" = set; then
-  OBJCFLAGS=$ac_save_OBJCFLAGS
-elif test $ac_cv_prog_objc_g = yes; then
-  if test "$GOBJC" = yes; then
-    OBJCFLAGS="-g -O2"
-  else
-    OBJCFLAGS="-g"
-  fi
-else
-  if test "$GOBJC" = yes; then
-    OBJCFLAGS="-O2"
-  else
-    OBJCFLAGS=
-  fi
-fi[]dnl
-])# _AC_PROG_OBJC_G
-
-
-## ------------------------------- ##
-## 4. Compilers' characteristics.  ##
-## ------------------------------- ##
-
-
-# -------------------------------- #
-# 4b. C compiler characteristics.  #
-# -------------------------------- #
-
-# libobjc and objc header tests shere?

Modified: branches/new-help-system/base/m4/tcl.m4
===================================================================
--- branches/new-help-system/base/m4/tcl.m4	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/m4/tcl.m4	2010-03-28 16:55:01 UTC (rev 65589)
@@ -106,15 +106,14 @@
 	    # check in a few common install locations
 	    if test x"${ac_cv_c_tclconfig}" = x ; then
 		for i in `ls -d ${libdir} 2>/dev/null` \
+			`ls -d /usr/lib 2>/dev/null` \
 			`ls -d /usr/local/lib 2>/dev/null` \
 			`ls -d /usr/contrib/lib 2>/dev/null` \
-			`ls -d /usr/lib 2>/dev/null` \
 			`ls -d /usr/pkg/lib 2>/dev/null` \
-			`ls -d /System/Library/Tcl/8.3 2>/dev/null` \
+			`ls -d /usr/local/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/local/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/local/lib/tcl8.3 2>/dev/null` \
+			`ls -d /usr/lib/tcl8.5 2>/dev/null` \
 			`ls -d /usr/lib/tcl8.4 2>/dev/null` \
-			`ls -d /usr/lib/tcl8.3 2>/dev/null` \
 			; do
 		    if test -f "$i/tclConfig.sh" ; then
 			ac_cv_c_tclconfig=`(cd $i; pwd)`
@@ -2230,7 +2229,7 @@
 	AC_DEFINE(HAVE_TIMEZONE_VAR)
     else
 	#
-	# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
+	# On some systems (e.g. IRIX 6.2), timezone is a time_t and not a long.
 	#
 	AC_MSG_CHECKING([time_t timezone variable])
 	AC_CACHE_VAL(tcl_cv_timezone_time,
@@ -2545,7 +2544,7 @@
 		# check some other possible local system locations.
 
 		for i in \
-			/usr/local/include /usr/include /usr/local/include/tcl${TCL_VERSION} /usr/include/tcl${TCL_VERSION}; do
+			/usr/include /usr/local/include /usr/local/include/tcl${TCL_VERSION} /usr/include/tcl${TCL_VERSION}; do
 		    if test -f "$i/tcl.h" ; then
 			ac_cv_c_tclh=$i
 			break

Modified: branches/new-help-system/base/portmgr/ReleaseProcess
===================================================================
--- branches/new-help-system/base/portmgr/ReleaseProcess	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/ReleaseProcess	2010-03-28 16:55:01 UTC (rev 65589)
@@ -49,18 +49,11 @@
 
 Only the base subdirectory, not the ports subdirectory, is branched for a given release.
 
-It is strongly recommended to use the svnmerge.py tool (provided by the subversion port) to
-maintain merge tracking information between release branches and trunk/base if you intend to
-merge revisions back and forth between them, which is a very likely scenario. To do this, you
-must initialize the tracking information from within the "base" directory of your checkout of
-the branch you intend to manage:
+It is strongly recommended to use the latest version of the subversion port so that merge
+tracking information can be maintained between release branches and trunk/base if you intend
+to merge revisions back and forth between them, which is a very likely scenario.
 
- svn co http://svn.macports.org/repository/macports/branches/release_1_6 branches/release_1_6
- cd branches/release_1_6/base
- svnmerge.py init
- svn ci -F svnmerge-commit-message.txt
 
-
 === Prepare the code for Release ===
 
 In preparation for a release, several things should be completed within the code:
@@ -155,9 +148,7 @@
 To create a disk image, use the MacPorts port. The Portfile will need to be updated to incorporate the
 proper release version and checksums, and the release tarballs will need to be already uploaded to the
 downloads section of the site (wherefrom the sources are fetched by the MacPorts port to build the dmg
-for the release). Make sure the ports tree you're using to build the dmg's is fully up to date, as to
-insure the resource files in the files/ directory of the port are current (fetched through svn:externals
-off the base/portmgr/dmg directory of the current final release tag).
+for the release). Make sure the ports tree you're using to build the dmg's is fully up to date.
 
  sudo port -d dmg MacPorts
 
@@ -178,12 +169,11 @@
    on a vanilla Mac OS X installation + developer tools, excluding even the MacPorts installation prefix;
    this can be accomplished through the use of otool's -L flag. Currently the libraries and binaries in need
    of linking validation are:
-             ${destroot}/Library/Tcl/macports1.0/MacPorts.dylib
-	     ${destroot}/opt/local/bin/daemondo (only built on 10.4 and later)
-	     ${destroot}/opt/local/share/macports/Tcl/darwintrace1.0/darwintrace.dylib
-	     ${destroot}/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib
-	     ${destroot}/opt/local/share/macports/Tcl/registry2.0/registry.dylib
-	     ${destroot}/opt/local/share/macports/Tcl/tclobjc1.0/tclobjc.dylib
+             ${destroot}/opt/local/bin/daemondo
+             ${destroot}/opt/local/share/macports/Tcl/darwintrace1.0/darwintrace.dylib
+             ${destroot}/opt/local/share/macports/Tcl/macports1.0/MacPorts.dylib
+             ${destroot}/opt/local/share/macports/Tcl/pextlib1.0/Pextlib.dylib
+             ${destroot}/opt/local/share/macports/Tcl/registry2.0/registry.dylib
  * Universal building: When building for Tiger and above, all the files that need linking confirmation in the
    step above also need to be confirmed of the universal type. A way to do this is through the file(1) command:
              file ${destroot}/opt/local/bin/daemondo:
@@ -196,7 +186,7 @@
              #\
              exec /usr/bin/tclsh "$0" "$@"
    thus ensuring that the default Mac OS X bundled Tcl is used in our scripts.
- * macports1.0 Tcl package: The macports1.0 Tcl package should be sourced off its default location in /Library/Tcl/macports1.0
+ * macports1.0 Tcl package: The macports1.0 Tcl package should be sourced off its default location in /opt/local/share/macports/Tcl/macports1.0
    in every single one of our scripts in ${destroot}/opt/local/bin.
  * Miscellaneous: anything else that might seem out of the ordinary for a fully default-configured MacPorts
    installation.
@@ -214,6 +204,12 @@
 practice to update the same file accordingly in its branched guise.
 
 
+=== Update trunk's version for next release ===
+Once trunk is to be used for development of the next major version, increase its version information to
+indicate it's moved past the release version by setting the patch-level version to 99, e.g., 1.8.99 (in
+trunk/base/config/macports_version).
+
+
 === Notify the Public of the Release ===
 
 Once the release has been posted, notification of the release should be sent/posted to the following places:
@@ -226,4 +222,5 @@
  * [http://www.versiontracker.com/dyn/moreinfo/macosx/26679 VersionTracker] (submitter: mij@)
  * [http://sourceforge.net/projects/macports/ sourceforge] (submitted: rhwood@)
  * [http://www.macupdate.com/info.php/id/21309/macports MacUpdate] (submitter: ???)
+ * [http://twitter.com/macports twitter] (submitter: raimue@)
  * (Where else?)

Modified: branches/new-help-system/base/portmgr/autosubmit.tcl
===================================================================
--- branches/new-help-system/base/portmgr/autosubmit.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/autosubmit.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -34,7 +34,7 @@
 proc submit_ports {} {
 	global prefix submit_options verbose
 
-	if {[catch {set res [mportsearch "^.*\$"]} result]} {
+	if {[catch {set res [mportlistall]} result]} {
 		puts "port search failed: $result"
 		exit 1
 	}

Modified: branches/new-help-system/base/portmgr/dmg/InstallationCheck
===================================================================
--- branches/new-help-system/base/portmgr/dmg/InstallationCheck	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/dmg/InstallationCheck	2010-03-28 16:55:01 UTC (rev 65589)
@@ -6,12 +6,23 @@
 # MacPorts port which replaces __DARWINVERS__ with the version of Darwin
 # needed).
 
+# error out if uname or sed can't be found
+if ! which uname > /dev/null || ! which sed > /dev/null; then
+    # message 16 in InstallationCheck.strings
+    exit 112
+fi
+
 base_version=`uname -r | sed 's/\..*//'`
 if [[ ${base_version} != __DARWINVERS__ ]]; then
-   # This maps to message 16 in InstallationCheck.strings (Apple allows
+   # This maps to message 17 in InstallationCheck.strings (Apple allows
    # 16-31 for custom messages); that message should also be customized
    # like this script
-   exit 112
+   exit 113
 fi
+
+if [[ -f /opt/local/etc/ports/dp_version ]]; then
+   # message 18 in InstallationCheck.strings
+   exit 114
+fi
+
 exit 0
-


Property changes on: branches/new-help-system/base/portmgr/dmg/InstallationCheck
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
===================================================================
--- branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,2 +1,3 @@
-"16" = "This package is meant to be installed on __XVERS__";
-
+"16" = "Either uname or sed could not be found in PATH. Your system appears to be incomplete or misconfigured.";
+"17" = "This package is meant to be installed on Mac OS X __XVERS__.";
+"18" = "Your existing MacPorts or DarwinPorts installation is too old to be upgraded by this installer. Please install MacPorts 1.7.1 first.";


Property changes on: branches/new-help-system/base/portmgr/dmg/InstallationCheck.strings
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/portmgr/dmg/postflight
===================================================================
--- branches/new-help-system/base/portmgr/dmg/postflight	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/dmg/postflight	2010-03-28 16:55:01 UTC (rev 65589)
@@ -35,19 +35,31 @@
 #set -x
 
 # Script identification ('cause more often than not the svn Id is not expanded):
-VERSION=1.7.0
+VERSION=1.8.0
 
 # Abstraction variables:
 PREFIX=/opt/local
 BINPATH=${PREFIX}/bin
 SBINPATH=${PREFIX}/sbin
+CONFIGPATH=${PREFIX}/etc/macports
 MANPAGES=${PREFIX}/share/man
+MACPORTS_TCL_DIR=${PREFIX}/share/macports/Tcl
+REG1DIR=${MACPORTS_TCL_DIR}/registry1.0
 TCLSH=/usr/bin/tclsh
 TCL_PACKAGE_DIR=/Library/Tcl
 TIMESTAMP=$(date +"%Y-%m-%d_at_%H:%M:%S")
 BACKUP_SUFFIX=macports-saved_${TIMESTAMP}
 OUR_STRING="MacPorts Installer addition on ${TIMESTAMP}"
 
+# Create config files from defaults if not present
+function setup_configs {
+    for f in macports.conf sources.conf variants.conf ; do
+        if [ ! -f ${CONFIGPATH}/${f} ]; then
+            /bin/cp ${CONFIGPATH}/${f}.default ${CONFIGPATH}/${f}
+            /bin/chmod 644 ${CONFIGPATH}/${f}
+        fi
+    done
+}
 
 # Command to update the MacPorts installation through "selfupdate":
 function update_macports {
@@ -62,7 +74,7 @@
     # Add [default] tag to the central MacPorts repository, if it isn't already
     ${TCLSH} ${PACKAGE_PATH}/Contents/Resources/upgrade_sources_conf_default.tcl ${PREFIX}
     # Remove any duplicates from the dep map (could occur with 1.6 and earlier)
-    ${TCLSH} ${PACKAGE_PATH}/Contents/Resources/dep_map_clean.tcl ${TCL_PACKAGE_DIR}
+    ${TCLSH} ${PACKAGE_PATH}/Contents/Resources/dep_map_clean.tcl ${MACPORTS_TCL_DIR}
 }
 
 # Through this command we write an environment variable to an appropriate shell configuration file,
@@ -97,11 +109,34 @@
     echo -e "Done.\n"
 }
 
+# Delete the old registry1.0 directory
+function delete_reg1 {
+    if [ -d ${REG1DIR} ]; then
+        rm -vrf ${REG1DIR}
+    fi
+}
 
+# link macports1.0 into tcl package dir if possible
+function link_tcl_package {
+    # delete old directory if present
+    if test -d "${TCL_PACKAGE_DIR}/macports1.0"; then
+        rm -vrf "${TCL_PACKAGE_DIR}/macports1.0" || true
+    fi
+    if ! test -e "${TCL_PACKAGE_DIR}/macports1.0" && test -w "${TCL_PACKAGE_DIR}"; then
+		ln -vs "${MACPORTS_TCL_DIR}/macports1.0" "${TCL_PACKAGE_DIR}/macports1.0" || true
+	fi
+}
+
 echo "The MacPorts Project, postflight script version ${VERSION}: checking the shell environment for user \"${USER}\"."
 
+# Set up config files
+setup_configs
+# link macports1.0 pkg
+link_tcl_package
+
 # Remove old stuff
 cleanup_man
+delete_reg1
 
 # Determine the user's shell, in order to choose an appropriate configuration file we'll be tweaking.
 # Exit nicely if the shell is any other than bash or tcsh, as that's considered non-standard.
@@ -154,7 +189,7 @@
 
 # We gather the path into a variable of our own for faster operation:
 ORIGINAL_MANPATH="$(${SHELL} ${LOGIN_FLAG} -c "/usr/bin/printenv MANPATH")"
-# Adding out setting to the MANPATH variable only if it exists:
+# Adding our setting to the MANPATH variable only if it exists:
 if ! ${SHELL} ${LOGIN_FLAG} -c "/usr/bin/env | grep MANPATH" > /dev/null || \
 # and following that, if it's not empty:
   [ -z "${ORIGINAL_MANPATH}" ] || \

Deleted: branches/new-help-system/base/portmgr/dmg/preflight
===================================================================
--- branches/new-help-system/base/portmgr/dmg/preflight	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/dmg/preflight	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,126 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2007 Juan Manuel Palacios <jmpp at macports.org>, The MacPorts Project.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. Neither the name of MacPorts Team nor the names of its contributors
-#    may be used to endorse or promote products derived from this software
-#    without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-
-###
-# dp2mp-move upgrading facility for users installing MacPorts through the pkg installer in the dmg.
-# This script is meant to run as the preflight of the installer, to upgrade an existing MacPorts
-# installation to the MacPorts namespace in the same way the "upgrade" target in base/Makefile
-# does for users installing from source or selfupdate.
-# preflight
-# $Id$
-###
-
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-UPGRADECHECK=/opt/local/var/macports/.mprename
-
-
-[ ! -d /Library/Tcl/darwinports1.0 ] || rm -rf /Library/Tcl/darwinports1.0
-
-[ ! -d /opt/local/share/darwinports ] || rm -rf /opt/local/share/darwinports
-
-[ ! -f /opt/local/etc/ports/dp_version ] || rm -vf /opt/local/etc/ports/dp_version
-
-[ ! -f /opt/local/share/man/man5/ports.conf.5 ] || rm -vf /opt/local/share/man/man5/ports.conf.5
-
-[ ! -d /opt/local/etc/ports ] || mv -v /opt/local/etc/ports /opt/local/etc/macports
-
-[ -d /opt/local/var/macports ] || mkdir -vp /opt/local/var/macports
-for dir in distfiles packages receipts software; do
-    [ ! -d /opt/local/var/db/dports/${dir} ] || mv -v /opt/local/var/db/dports/${dir} /opt/local/var/macports
-done
-
-[ ! -d /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports ] || {
-    mkdir -vp /opt/local/var/macports/sources/rsync.macports.org/release && mv -v \
-      /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports /opt/local/var/macports/sources/rsync.macports.org/release/ports
-}
-
-for receipt in /opt/local/var/macports/receipts/*/*/receipt.bz2; do
-    [ ! \( -f ${receipt} -a ! -f ${receipt}.mpsaved \) ] || { cp -v ${receipt} ${receipt}.mpsaved && {
-        bzip2 -q -dc ${receipt} | sed 's/db\/dports/macports/g' | bzip2 -q -zf > ${receipt}.new
-    } && mv -v ${receipt}.new ${receipt}
-}; done
-
-[ ! \( -f /opt/local/etc/macports/ports.conf -a ! -f ${UPGRADECHECK} \) ] || {
-    mv -v /opt/local/etc/macports/ports.conf /opt/local/etc/macports/macports.conf.mpsaved
-    sed 's/etc\/ports/etc\/macports/g' /opt/local/etc/macports/macports.conf.mpsaved > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/db\/dports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc//macports/macports.conf.tmp && \
-      mv -v /opt/local/etc//macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/darwinports/macports/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/dpupdate1\/base/release\/base/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed '/^rsync_options/s/"\(.*\)"/\1/' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/ --delete / /' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-    sed 's/ ports.conf(5)/ macports.conf(5)/g' /opt/local/etc/macports/macports.conf > /opt/local/etc/macports/macports.conf.tmp && \
-      mv -v /opt/local/etc/macports/macports.conf.tmp /opt/local/etc/macports/macports.conf
-}
-
-[ ! \( -f /opt/local/etc/macports/sources.conf -a ! -f ${UPGRADECHECK} \) ] || {
-    cp -v /opt/local/etc/macports/sources.conf /opt/local/etc/macports/sources.conf.mpsaved
-    sed 's/darwinports/macports/g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
-      mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
-    sed 's/dpupdate\/dports/release\/ports\//g' /opt/local/etc/macports/sources.conf > /opt/local/etc/macports/sources.conf.tmp && \
-      mv -v /opt/local/etc/macports/sources.conf.tmp /opt/local/etc/macports/sources.conf
-}
-
-[ ! \( -f "${HOME}/.macports/ports.conf" -a ! -f ${UPGRADECHECK} \) ] || {
-    mv -v "${HOME}/.macports/ports.conf" "${HOME}/.macports/macports.conf.mpsaved"
-    sed 's/etc\/ports/etc\/macports/g' "${HOME}/.macports/macports.conf.mpsaved" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/db\/dports/macports/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/darwinports/macports/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/dpupdate1\/base/release\/base/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/dpupdate\/base\/\{0,1\}/trunk\/base\//g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed '/^rsync_options/s/"\(.*\)"/\1/' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/ --delete / /' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-    sed 's/ ports.conf(5)/ macports.conf(5)/g' "${HOME}/.macports/macports.conf" > "${HOME}/.macports/macports.conf.tmp" && \
-      mv -v "${HOME}/.macports/macports.conf.tmp" "${HOME}/.macports/macports.conf"
-}
-
-
-[ ! -f /opt/local/etc/macports/mp_version ] || rm -vf /opt/local/etc/macports/mp_version
-
-
-[ -f ${UPGRADECHECK} ] || {
-    echo -e "\nMacPorts installation successfully upgraded from the old DarwinPorts namespace!\n"
-    echo "MacPorts rename update done!" > ${UPGRADECHECK}
-}


Property changes on: branches/new-help-system/base/portmgr/fedora
___________________________________________________________________
Modified: svn:ignore
   - macports.spec

   + 


Deleted: branches/new-help-system/base/portmgr/fedora/macports.spec.in
===================================================================
--- branches/new-help-system/base/portmgr/fedora/macports.spec.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/fedora/macports.spec.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,100 +0,0 @@
-Summary: MacPorts allows installing software on Mac OS X (and other platforms)
-Name: macports
-Version: @MACPORTS_VERSION@
-Release: 0%{?dist}
-License: BSD
-Group: System Environment/Base
-URL: http://www.macports.org
-Source: http://svn.macosforge.org/repository/macports/distfiles/MacPorts/MacPorts-%{version}.tar.bz2
-Prefix: /opt/local
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-
-Requires: curl tcl rsync coreutils make
-BuildRequires: curl-devel tcl-devel tcl-thread sqlite-devel gcc-objc gnustep-base
-BuildRequires: mtree fakeroot /usr/GNUstep/System/Library/Makefiles/GNUstep.sh 
-BuildRequires: openssl-devel
-
-%description
-MacPorts is a system for compiling, installing, and managing free and
-open source software. A MacPorts "port" is a set of specifications
-contained in a Portfile that defines an application, its characteristics,
-and any files or special instructions required to install it, so MacPorts
-may automatically fetch, patch, compile, and install ported software.
-
-MacPorts may also be used to pre-compile ported software into binaries
-that may be installed on remote computers. Binaries of ported software
-may be installed very quickly since the steps required to install ports
-from source code have all been performed in advance.
-
-%prep
-%setup -n MacPorts-%{version}
-# avoid the whole upgrade and information procedure
-perl -pe 's/^install::/interactive::/' -i Makefile.in
-
-%define _prefix         %{prefix}
-%define _bindir         %{prefix}/bin
-%define _sysconfdir     %{prefix}/etc
-%define _datadir        %{prefix}/share
-%define _mandir         %{prefix}/share/man
-%define _infodir        %{prefix}/share/info
-%define _localstatedir  %{prefix}/var
-
-%build
-source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
-%configure \
-	--without-included-tclthread --without-included-sqlite3 \
-	--with-objc-runtime=GNU --with-objc-foundation=GNUstep
-make
-
-%install
-source /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
-rm -rf $RPM_BUILD_ROOT
-make install \
-	DESTDIR="$RPM_BUILD_ROOT" INSTALL="fakeroot install"
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-, root, root)
-%doc LICENSE ChangeLog
-%{_bindir}/port
-%{_bindir}/portf
-%{_bindir}/portindex
-%{_bindir}/portmirror
-%config(noreplace) %{_sysconfdir}/macports
-%doc %{_mandir}/man1/port.1*
-%doc %{_mandir}/man5/macports.conf.5*
-%doc %{_mandir}/man7/portfile.7*
-%doc %{_mandir}/man7/portgroup.7*
-%doc %{_mandir}/man7/porthier.7*
-%doc %{_mandir}/man7/portstyle.7*
-%{_datadir}/macports
-%{_localstatedir}/macports
-/usr/share/tcl8.4/macports1.0
-#### mtree
-%dir %{prefix}
-%dir %{prefix}/bin
-%dir %{prefix}/etc
-%dir %{prefix}/include
-%dir %{prefix}/lib
-%dir %{prefix}/libexec
-     %{prefix}/man
-%dir %{prefix}/sbin
-%dir %{prefix}/share
-%dir %{prefix}/share/info
-%dir %{prefix}/share/man
-%dir %{prefix}/share/man/cat?
-%dir %{prefix}/share/man/man?
-%dir %{prefix}/share/nls
-%dir %{prefix}/share/nls/*
-#dir %{prefix}/skel
-#dir %{prefix}/src
-%dir %{prefix}/var
-
-%changelog
-* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.5.0
-- Updated to version 1.5.0
-
-* Sun Aug 12 2007 Anders F Bjorklund <afb at macports.org> - 1.4.0
-- Initial Fedora packaging

Modified: branches/new-help-system/base/portmgr/freebsd/Makefile.in
===================================================================
--- branches/new-help-system/base/portmgr/freebsd/Makefile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/freebsd/Makefile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -8,7 +8,7 @@
 PORTNAME=	macports
 PORTVERSION=	@MACPORTS_VERSION@
 CATEGORIES=	sysutils
-MASTER_SITES=	http://svn.macosforge.org/repository/macports/distfiles/MacPorts/
+MASTER_SITES=	http://distfiles.macports.org/MacPorts/
 DISTNAME=	MacPorts-${PORTVERSION}
 
 MAINTAINER=	afb at macports.org
@@ -18,7 +18,7 @@
 		ginstall:${PORTSDIR}/sysutils/coreutils \
 		gtar:${PORTSDIR}/archivers/gtar \
 		gmake:${PORTSDIR}/devel/gmake
-LIB_DEPENDS=	tcl84:${PORTSDIR}/lang/tcl84-thread \
+LIB_DEPENDS=	tcl85:${PORTSDIR}/lang/tcl85-thread \
 		curl:${PORTSDIR}/ftp/curl \
 		sqlite3:${PORTSDIR}/databases/sqlite3
 BUILD_DEPENDS=	${LOCALBASE}/lib/thread2.6.5:${PORTSDIR}/devel/tclthread \
@@ -40,12 +40,13 @@
 MTREE_FILE=	${WRKSRC}/doc/prefix.mtree
 
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS+=--with-tcl=${LOCALBASE}/lib/tcl8.4 \
-		--with-tclinclude=${LOCALBASE}/include/tcl8.4 \
+CFLAGS+=	-DPIC -fPIC
+CONFIGURE_ARGS+=--with-tcl=${LOCALBASE}/lib/tcl8.5 \
+		--with-tclinclude=${LOCALBASE}/include/tcl8.5 \
 		--without-included-tclthread --without-included-sqlite3 \
 		--with-objc-runtime=GNU --with-objc-foundation=GNUstep
 CONFIGURE_ENV=	RSYNC=${LOCALBASE}/bin/rsync \
-		TCLSH=${LOCALBASE}/bin/tclsh8.4-threads \
+		TCLSH=${LOCALBASE}/bin/tclsh8.5-threads \
 		GNUTAR=${LOCALBASE}/bin/gtar \
 		GNUMAKE=${LOCALBASE}/bin/gmake \
 		OBJC="${CC}" OBJCFLAGS="${CFLAGS}"
@@ -53,6 +54,8 @@
 pre-configure:
 	@# foundation.m4 is somewhat bashist (MacPorts Bug #12252)
 	@${REINPLACE_CMD} -e 's|#! /bin/sh|#!/usr/bin/env bash|' ${WRKSRC}/configure
+	@# should really have been #!/bin/sh
+	@${REINPLACE_CMD} -e 's|#!/bin/bash|#!/usr/bin/env bash|' ${WRKSRC}/src/pkg_mkindex.sh.in
 post-configure:
 	@# Makefile only works with GNU make (MacPorts Bug #12247)
 	@${LN} -s Makefile ${WRKSRC}/GNUmakefile
@@ -61,18 +64,19 @@
 	@# move tcl from /usr/local, to /opt/local (for packaging)
 	${RM} -rf ${PREFIX}/share/macports/Tcl/macports1.0
 	${MKDIR} ${PREFIX}/share/macports/Tcl
-	test -L ${LOCALBASE}/lib/tcl8.4/macports1.0 || \
-	${MV} ${LOCALBASE}/lib/tcl8.4/macports1.0 \
+	test -L ${LOCALBASE}/lib/tcl8.5/macports1.0 || \
+	${MV} ${LOCALBASE}/lib/tcl8.5/macports1.0 \
 	      ${PREFIX}/share/macports/Tcl/macports1.0
-	test -L ${LOCALBASE}/lib/tcl8.4/macports1.0 || \
+	test -L ${LOCALBASE}/lib/tcl8.5/macports1.0 || \
 	${LN} -s ${PREFIX}/share/macports/Tcl/macports1.0 \
-	         ${LOCALBASE}/lib/tcl8.4/macports1.0
+	         ${LOCALBASE}/lib/tcl8.5/macports1.0
 
 test: build
 	${GMAKE} -C ${WRKSRC} test
 
 # MacPorts mtree demands ${prefix}/share/man
 MANPREFIX=	${PREFIX}/share
+MANCOMPRESSED=	yes
 
 MAN1=		port.1
 MAN5=		macports.conf.5

Modified: branches/new-help-system/base/portmgr/freebsd/pkg-plist
===================================================================
--- branches/new-help-system/base/portmgr/freebsd/pkg-plist	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/freebsd/pkg-plist	2010-03-28 16:55:01 UTC (rev 65589)
@@ -6,7 +6,6 @@
 etc/macports/sources.conf
 etc/macports/variants.conf
 share/macports/Tcl/darwintrace1.0/darwintrace.so
-share/macports/Tcl/darwintrace1.0/pkgIndex.tcl
 share/macports/Tcl/macports1.0/MacPorts.so
 share/macports/Tcl/macports1.0/macports.tcl
 share/macports/Tcl/macports1.0/macports_autoconf.tcl
@@ -18,6 +17,7 @@
 share/macports/Tcl/package1.0/package.tcl
 share/macports/Tcl/package1.0/pkgIndex.tcl
 share/macports/Tcl/package1.0/portarchive.tcl
+share/macports/Tcl/package1.0/portarchivefetch.tcl
 share/macports/Tcl/package1.0/portdmg.tcl
 share/macports/Tcl/package1.0/portdpkg.tcl
 share/macports/Tcl/package1.0/portmpkg.tcl
@@ -27,6 +27,7 @@
 share/macports/Tcl/package1.0/portunarchive.tcl
 share/macports/Tcl/pextlib1.0/Pextlib.so
 share/macports/Tcl/pextlib1.0/pkgIndex.tcl
+share/macports/Tcl/port1.0/fetch_common.tcl
 share/macports/Tcl/port1.0/pkgIndex.tcl
 share/macports/Tcl/port1.0/port.tcl
 share/macports/Tcl/port1.0/port_autoconf.tcl
@@ -35,6 +36,7 @@
 share/macports/Tcl/port1.0/portchecksum.tcl
 share/macports/Tcl/port1.0/portclean.tcl
 share/macports/Tcl/port1.0/portconfigure.tcl
+share/macports/Tcl/port1.0/portdeactivate.tcl
 share/macports/Tcl/port1.0/portdepends.tcl
 share/macports/Tcl/port1.0/portdestroot.tcl
 share/macports/Tcl/port1.0/portdistcheck.tcl
@@ -49,28 +51,17 @@
 share/macports/Tcl/port1.0/portsubmit.tcl
 share/macports/Tcl/port1.0/porttest.tcl
 share/macports/Tcl/port1.0/porttrace.tcl
+share/macports/Tcl/port1.0/portuninstall.tcl
 share/macports/Tcl/port1.0/portutil.tcl
-share/macports/Tcl/registry1.0/pkgIndex.tcl
-share/macports/Tcl/registry1.0/portimage.tcl
-share/macports/Tcl/registry1.0/portuninstall.tcl
-share/macports/Tcl/registry1.0/receipt_flat.tcl
-share/macports/Tcl/registry1.0/receipt_sqlite.tcl
-share/macports/Tcl/registry1.0/registry.tcl
-share/macports/Tcl/registry1.0/registry_autoconf.tcl
-share/macports/Tcl/tclobjc1.0/tclobjc.so
-share/macports/Tcl/tclobjc1.0/pkgIndex.tcl
-share/macports/resources/port1.0/fetch/mirror_sites.tcl
-share/macports/resources/port1.0/group/gnustep-1.0.tcl
-share/macports/resources/port1.0/group/perl5-1.0.tcl
-share/macports/resources/port1.0/group/python-1.0.tcl
-share/macports/resources/port1.0/group/python24-1.0.tcl
-share/macports/resources/port1.0/group/python25-1.0.tcl
-share/macports/resources/port1.0/group/ruby-1.0.tcl
-share/macports/resources/port1.0/group/xcode-1.0.tcl
-share/macports/resources/port1.0/group/zope-1.0.tcl
-share/macports/resources/port1.0/install/macosx.mtree
-share/macports/resources/port1.0/install/prefix.mtree
-share/macports/resources/port1.0/package/background.tiff
+share/macports/Tcl/registry2.0/pkgIndex.tcl
+share/macports/Tcl/registry2.0/portimage.tcl
+share/macports/Tcl/registry2.0/portuninstall.tcl
+share/macports/Tcl/registry2.0/receipt_flat.tcl
+share/macports/Tcl/registry2.0/receipt_sqlite.tcl
+share/macports/Tcl/registry2.0/registry.so
+share/macports/Tcl/registry2.0/registry.tcl
+share/macports/Tcl/registry2.0/registry_autoconf.tcl
+share/macports/Tcl/registry2.0/registry_util.tcl
 var/macports/.tclpackage
 @unexec /bin/rm -f %D/var/macports/.mprename
 @dirrm var/macports/receipts
@@ -83,7 +74,7 @@
 @dirrm share/macports/resources/port1.0
 @dirrm share/macports/resources
 @dirrm share/macports/Tcl/tclobjc1.0
- at dirrm share/macports/Tcl/registry1.0
+ at dirrm share/macports/Tcl/registry2.0
 @dirrm share/macports/Tcl/port1.0
 @dirrm share/macports/Tcl/pextlib1.0
 @dirrm share/macports/Tcl/package1.0
@@ -92,4 +83,4 @@
 @dirrm share/macports
 @dirrm share/macports/Tcl
 @dirrm etc/macports
- at unexec test -L %%LOCALBASE%%/lib/tcl8.4/macports1.0 && /bin/rm %%LOCALBASE%%/lib/tcl8.4/macports1.0
+ at unexec test -L %%LOCALBASE%%/lib/tcl8.5/macports1.0 && /bin/rm %%LOCALBASE%%/lib/tcl8.5/macports1.0

Modified: branches/new-help-system/base/portmgr/jobs/Makefile
===================================================================
--- branches/new-help-system/base/portmgr/jobs/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/jobs/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -3,7 +3,7 @@
 SCRIPTS=	PortIndex2MySQL
 
 edit = sed \
-	-e 's, at TCL_PACKAGE_DIR@,$(TCL_PACKAGE_DIR),g'
+	-e 's, at macports_tcl_dir@,$(macports_tcl_dir),g'
 
 
 include ../../Mk/macports.autoconf.mk

Modified: branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl
===================================================================
--- branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/jobs/PortIndex2MySQL.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -48,7 +48,7 @@
 # meaningful, which is accomplished simply by calling the 'mportsync' proc in macports1.0
 # (which updates the ports tree in use) and by installing the script on cron/launchd to be
 # run on a timely schedule (not any more frequent than the run of the PortIndexRegen.sh
-# script on that creates a new PortIndex file, which is every twelve hours).
+# script on that creates a new PortIndex file).
 #
 # Remaining requirement to successfully run this script is performing the necessary
 # MySQL admin tasks on the host box to create the database in the first place and the
@@ -72,8 +72,13 @@
 set FROM macports-mgr at lists.macosforge.org
 set HEADERS "To: $SPAM_LOVERS\r\nFrom: $FROM\r\nSubject: $SUBJECT\r\n\r\n"
 
-# We first initialize the runlog with proper mail headers
-puts $runlog_fd $HEADERS
+# handle command line arguments
+set create_tables true
+if {[llength $argv]} {
+    if {[lindex $argv 0] == "--create-tables"} {
+        set create_tables true
+    }
+}
 
 # House keeping on exit.
 proc cleanup {args} {
@@ -97,29 +102,6 @@
     exit $exit_status
 }
 
-# Check if there are any stray sibling jobs before moving on, bail in such case.
-if {[file exists $lockfile]} {
-    puts $runlog_fd "PortIndex2MySQL lock file found, is another job running?" 
-    terminate 1
-} else {
-    set lockfile_fd [open $lockfile a]
-}
-
-
-# Load macports1.0 so that we can use some of its procs and the portinfo array.
-if {[catch { source [file join "@TCL_PACKAGE_DIR@" macports1.0 macports_fastload.tcl] } errstr]} {
-    puts $runlog_fd "${::errorInfo}"
-    puts $runlog_fd "Failed to locate the macports1.0 Tcl package file: $errstr"
-    cleanup lockfile
-    terminate 1
-}
-if {[catch { package require macports } errstr]} {
-    puts $runlog_fd "${::errorInfo}"
-    puts $runlog_fd "Failed to load the macports1.0 Tcl package: $errstr"
-    cleanup lockfile
-    terminate 1
-}
-
 # macports1.0 UI instantiation to route information/error messages wherever we want.
 # This is a custom ui_channels proc because we want to get reported information on
 # channels other than the default stdout/stderr that the macports1.0 API provides,
@@ -157,18 +139,6 @@
     }
 }
 
-# Initialize macports1.0 and its UI, in order to find the sources.conf file
-# (which is what will point us to the PortIndex we're gonna use) and use
-# the runtime information.
-array set ui_options {ports_verbose yes}
-if {[catch {mportinit ui_options} errstr]} {
-    puts $runlog_fd "${::errorInfo}"
-    puts $runlog_fd "Failed to initialize MacPorts: $errstr"
-    cleanup lockfile
-    terminate 1
-}
-
-
 # Procedure to catch the database password from a protected file.
 proc getpasswd {passwdfile} {
     if {[catch {open $passwdfile r} passwdfile_fd]} {
@@ -188,6 +158,51 @@
     return $passwd
 }
 
+# SQL string escaping.
+proc sql_escape {str} {
+    regsub -all -- {'} $str {\\'} str
+    regsub -all -- {"} $str {\\"} str
+    regsub -all -- {\n} $str {\\n} str
+    return $str
+}
+
+# We first initialize the runlog with proper mail headers
+puts $runlog_fd $HEADERS
+
+# Check if there are any stray sibling jobs before moving on, bail in such case.
+if {[file exists $lockfile]} {
+    puts $runlog_fd "PortIndex2MySQL lock file found, is another job running?" 
+    terminate 1
+} else {
+    set lockfile_fd [open $lockfile a]
+}
+
+# Load macports1.0 so that we can use some of its procs and the portinfo array.
+if {[catch { source [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl] } errstr]} {
+    puts $runlog_fd "${::errorInfo}"
+    puts $runlog_fd "Failed to locate the macports1.0 Tcl package file: $errstr"
+    cleanup lockfile
+    terminate 1
+}
+if {[catch { package require macports } errstr]} {
+    puts $runlog_fd "${::errorInfo}"
+    puts $runlog_fd "Failed to load the macports1.0 Tcl package: $errstr"
+    cleanup lockfile
+    terminate 1
+}
+
+# Initialize macports1.0 and its UI, in order to find the sources.conf file
+# (which is what will point us to the PortIndex we're gonna use) and use
+# the runtime information.
+array set ui_options {ports_verbose yes}
+if {[catch {mportinit ui_options} errstr]} {
+    puts $runlog_fd "${::errorInfo}"
+    puts $runlog_fd "Failed to initialize MacPorts: $errstr"
+    cleanup lockfile
+    terminate 1
+}
+
+
 # Database abstraction variables:
 set sqlfile "/tmp/portsdb.sql"
 set portsdb_host localhost
@@ -215,46 +230,51 @@
 }
 
 # Load every port in the index through a search that matches everything.
-if {[catch {set ports [mportsearch ".+"]} errstr]} {
+if {[catch {set ports [mportlistall]} errstr]} {
     ui_error "${::errorInfo}"
     ui_error "port search failed: $errstr"
     cleanup sqlfile lockfile
     terminate 1
 }
 
+if {$create_tables} {
+    # Initial creation of database tables: log, portfiles, categories, maintainers, dependencies, variants and platforms.
+    # Do we need any other?
+    puts $sqlfile_fd "DROP TABLE IF EXISTS log;"
+    puts $sqlfile_fd "CREATE TABLE log (activity VARCHAR(255), activity_time TIMESTAMP(14)) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS portfiles;"
+    puts $sqlfile_fd "CREATE TABLE portfiles (name VARCHAR(255) PRIMARY KEY NOT NULL, path VARCHAR(255), version VARCHAR(255),  description TEXT) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS categories;"
+    puts $sqlfile_fd "CREATE TABLE categories (portfile VARCHAR(255), category VARCHAR(255), is_primary INTEGER) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS maintainers;"
+    puts $sqlfile_fd "CREATE TABLE maintainers (portfile VARCHAR(255), maintainer VARCHAR(255), is_primary INTEGER) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS dependencies;"
+    puts $sqlfile_fd "CREATE TABLE dependencies (portfile VARCHAR(255), library VARCHAR(255)) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS variants;"
+    puts $sqlfile_fd "CREATE TABLE variants (portfile VARCHAR(255), variant VARCHAR(255)) DEFAULT CHARSET=utf8;"
+    
+    puts $sqlfile_fd "DROP TABLE IF EXISTS platforms;"
+    puts $sqlfile_fd "CREATE TABLE platforms (portfile VARCHAR(255), platform VARCHAR(255)) DEFAULT CHARSET=utf8;"
 
-# SQL string escaping.
-proc sql_escape {str} {
-    regsub -all -- {'} $str {\\'} str
-    regsub -all -- {"} $str {\\"} str
-    regsub -all -- {\n} $str {\\n} str
-    return $str
+    puts $sqlfile_fd "DROP TABLE IF EXISTS licenses;"
+    puts $sqlfile_fd "CREATE TABLE licenses (portfile VARCHAR(255), license VARCHAR(255)) DEFAULT CHARSET=utf8;"
+} else {
+    # if we are not creating tables from scratch, remove the old data
+    puts $sqlfile_fd "TRUNCATE log;"
+    puts $sqlfile_fd "TRUNCATE portfiles;"
+    puts $sqlfile_fd "TRUNCATE categories;"
+    puts $sqlfile_fd "TRUNCATE maintainers;"
+    puts $sqlfile_fd "TRUNCATE dependencies;"
+    puts $sqlfile_fd "TRUNCATE variants;"
+    puts $sqlfile_fd "TRUNCATE platforms;"
+    puts $sqlfile_fd "TRUNCATE licenses;"
 }
-
-# Initial creation of database tables: log, portfiles, categories, maintainers, dependencies, variants and platforms.
-# Do we need any other?
-puts $sqlfile_fd "DROP TABLE IF EXISTS log;"
-puts $sqlfile_fd "CREATE TABLE log (activity VARCHAR(255), activity_time TIMESTAMP(14)) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS portfiles;"
-puts $sqlfile_fd "CREATE TABLE portfiles (name VARCHAR(255) PRIMARY KEY NOT NULL, path VARCHAR(255), version VARCHAR(255),  description TEXT) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS categories;"
-puts $sqlfile_fd "CREATE TABLE categories (portfile VARCHAR(255), category VARCHAR(255), is_primary INTEGER) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS maintainers;"
-puts $sqlfile_fd "CREATE TABLE maintainers (portfile VARCHAR(255), maintainer VARCHAR(255), is_primary INTEGER) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS dependencies;"
-puts $sqlfile_fd "CREATE TABLE dependencies (portfile VARCHAR(255), library VARCHAR(255)) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS variants;"
-puts $sqlfile_fd "CREATE TABLE variants (portfile VARCHAR(255), variant VARCHAR(255)) DEFAULT CHARSET=utf8;"
-
-puts $sqlfile_fd "DROP TABLE IF EXISTS platforms;"
-puts $sqlfile_fd "CREATE TABLE platforms (portfile VARCHAR(255), platform VARCHAR(255)) DEFAULT CHARSET=utf8;"
-
-
+ 
 # Iterate over each matching port, extracting its information from the
 # portinfo array.
 foreach {name array} $ports {
@@ -319,6 +339,11 @@
     } else {
         set platforms ""
     }
+    if {[info exists portinfo(license)]} {
+        set licenses $portinfo(license)
+    } else {
+        set licenses ""
+    }
 
     puts $sqlfile_fd "INSERT INTO portfiles VALUES ('$portname', '$portdir', '$portversion', '$description');"
 
@@ -371,12 +396,16 @@
         puts $sqlfile_fd "INSERT INTO platforms VALUES ('$portname', '$platform');"
     }
 
+    foreach license $licenses {
+        set license [sql_escape $license]
+        puts $sqlfile_fd "INSERT INTO licenses VALUES ('$portname', '$license');"
+    }
+
 }
 
 # Mark the db regen as done only once we're done processing all ports:
 puts $sqlfile_fd "INSERT INTO log VALUES ('update', NOW());"
 
-
 # Pipe the contents of the generated sql file to the database command,
 # reading from the file descriptor for the raw sql file to assure completeness.
 if {[catch {seek $sqlfile_fd 0 start} errstr]} {
@@ -384,13 +413,13 @@
     cleanup sqlfile lockfile
     terminate 1
 }
+
 if {[catch {exec -- $portsdb_cmd --host=$portsdb_host --user=$portsdb_user --password=$portsdb_passwd --database=$portsdb_name <@ $sqlfile_fd} errstr]} {
     ui_error "${::errorCode}: $errstr"
     cleanup sqlfile lockfile
     terminate 1
 }
 
-
-# And we're done regen'ing the MacPorts dabase! Cleanup and exit successfully.
+# done regenerating the database. Cleanup and exit successfully.
 cleanup sqlfile lockfile
 terminate 0


Property changes on: branches/new-help-system/base/portmgr/jobs/mirror_macports.sh
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/portmgr/jobs/org.macports.PortIndexRegen.plist
___________________________________________________________________
Deleted: svn:eol-stype
   - native
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/portmgr/jobs/org.macports.mprsyncup.plist
___________________________________________________________________
Deleted: svn:eol-stype
   - native
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/portmgr/jobs/portfile_lint.pl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/portmgr/jobs/portfile_mirror.pl
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/portmgr/packaging/dpkgall.tcl
===================================================================
--- branches/new-help-system/base/portmgr/packaging/dpkgall.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/portmgr/packaging/dpkgall.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -347,7 +347,7 @@
 
 	# If no portlist file was specified, create a portlist that includes all ports
 	if {[llength $portlist] == 0 || "$buildall_flag" == "true"} {
-		set res [mportsearch {.*}]
+		set res [mportlistall]
 		foreach {name array} $res {
 			lappend portlist $name
 		}
@@ -704,7 +704,7 @@
 			set port [lindex $portlist 0]
 
 			ui_msg "Uninstalling $port."
-			if { [catch {portuninstall::uninstall $portname $portversion} result] } {
+			if { [catch {registry_uninstall::uninstall $portname $portversion} result] } {
 				global errorInfo
 				ui_debug "$errorInfo"
 				ui_noisy_errorr "Fatal error: Uninstalling $port failed: $result"
@@ -757,7 +757,7 @@
 
 proc get_portinfo {port} {
 	set searchstring [regex_escape_portname $port]
-	set res [mportsearch "^${searchstring}\$"]
+	set res [mportlookup ${searchstring}]
 
 	if {[llength $res] < 2} {
 		return -code error "Port \"$port\" not found in index."

Modified: branches/new-help-system/base/setupenv.bash.in
===================================================================
--- branches/new-help-system/base/setupenv.bash.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/setupenv.bash.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -56,6 +56,10 @@
 function export_manpath() {
     mpath="@prefix_expanded@/share/man"
 
+    if [ -z "$MANPATH" ]; then
+        return
+    fi
+
     local IFS=":"
     for p in $MANPATH; do
         if [ "$p" == "$mpath" ]; then

Modified: branches/new-help-system/base/src/Makefile.in
===================================================================
--- branches/new-help-system/base/src/Makefile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/Makefile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -4,7 +4,6 @@
 			port1.0 \
 			package1.0 \
 			pextlib1.0 \
-			registry1.0 \
 			registry2.0 \
 			darwintracelib1.0
 SUBDIR=		${TCLPKG} port programs

Modified: branches/new-help-system/base/src/config.h.in
===================================================================
--- branches/new-help-system/base/src/config.h.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/config.h.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -18,6 +18,9 @@
 /* Define to 1 if you have the `clearenv' function. */
 #undef HAVE_CLEARENV
 
+/* Define if CommonCrypto is available. */
+#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
+
 /* Define to 1 if you have the `copyfile' function. */
 #undef HAVE_COPYFILE
 
@@ -80,9 +83,6 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define if you have the `crypto' library (-lcrypto). */
-#undef HAVE_LIBCRYPTO
-
 /* Define if you have the `md' library (-lmd). */
 #undef HAVE_LIBMD
 
@@ -110,9 +110,6 @@
 /* Define to 1 if you have the <objc/objc.h> header file. */
 #undef HAVE_OBJC_OBJC_H
 
-/* Define to 1 if you have the <openssl/md5.h> header file. */
-#undef HAVE_OPENSSL_MD5_H
-
 /* Define to 1 if you have the <paths.h> header file. */
 #undef HAVE_PATHS_H
 
@@ -211,6 +208,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 


Property changes on: branches/new-help-system/base/src/cregistry
___________________________________________________________________
Modified: svn:ignore
   - cregistry.a

   + cregistry.a
macports.sqlext


Modified: branches/new-help-system/base/src/cregistry/Makefile
===================================================================
--- branches/new-help-system/base/src/cregistry/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,24 +1,28 @@
 # $Id$
 
-OBJS = registry.o entry.o sql.o
+OBJS = registry.o entry.o sql.o vercomp.o
 STLIB_NAME = cregistry.a
 RANLIB = ranlib
 
+SQLEXT_NAME = macports.sqlext
+SQLEXT_OBJS = sqlext.o vercomp.o
 
 include ../../Mk/macports.autoconf.mk
 
+all:: ${STLIB_NAME} ${SQLEXT_NAME}
 
-all:: ${STLIB_NAME}
-
 .c.o:
-	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${SHLIB_CFLAGS} $< -o $@
+	${CC} -c -DUSE_TCL_STUBS ${CFLAGS} ${CPPFLAGS} ${SHLIB_CFLAGS} $< -o $@
 
 ${STLIB_NAME}:: ${OBJS}
 	${STLIB_LD} ${STLIB_NAME} ${OBJS}
 	${RANLIB} ${STLIB_NAME}
 
+${SQLEXT_NAME}: ${SQLEXT_OBJS}
+	${SHLIB_LD} ${SQLEXT_OBJS} -o $@
+
 clean::
-	rm -f ${STLIB_NAME} ${OBJS}
+	rm -f ${STLIB_NAME} ${SQLEXT_NAME} ${OBJS}
 
 distclean:: clean
 

Copied: branches/new-help-system/base/src/cregistry/README.sqlext (from rev 65586, trunk/base/src/cregistry/README.sqlext)
===================================================================
--- branches/new-help-system/base/src/cregistry/README.sqlext	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/README.sqlext	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,12 @@
+The macports.sqlext is meant to ease debugging the registry database by
+providing the necessary SQLite extensions to examine and modify the database
+using the sqlite3 command line tool.
+
+To use this SQLite extension, use '.load macports.sqlext' at the sqlite3 prompt
+right after attaching the registry.db file.
+
+Example:
+
+$ sqlite3 /opt/local/var/macports/registry/registry.db
+...
+sqlite> .load /Users/julesverne/src/macports/trunk/base/src/cregistry/macports.sqlext

Modified: branches/new-help-system/base/src/cregistry/entry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/entry.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -30,14 +30,14 @@
 #include <config.h>
 #endif
 
+#include "entry.h"
+#include "registry.h"
+#include "sql.h"
+
 #include <string.h>
 #include <stdlib.h>
 #include <sqlite3.h>
 
-#include <cregistry/entry.h>
-#include <cregistry/registry.h>
-#include <cregistry/sql.h>
-
 /*
  * TODO: possibly, allow reg_entry_search to take different matching strategies
  *       for different keys. I don't know of an application for this feature
@@ -78,21 +78,24 @@
  * @param [in,out] dst_space number of characters `dst` can hold
  * @param [in] src           string to concatenate to `dst`
  */
-void reg_strcat(char** dst, int* dst_len, int* dst_space, char* src) {
+static int reg_strcat(char** dst, int* dst_len, int* dst_space, char* src) {
     int src_len = strlen(src);
     int result_len = *dst_len + src_len;
     if (result_len >= *dst_space) {
-        char* old_dst = *dst;
+        char* new_dst;
         *dst_space *= 2;
         if (*dst_space < result_len) {
             *dst_space = result_len;
         }
-        *dst = malloc(*dst_space * sizeof(char) + 1);
-        memcpy(*dst, old_dst, *dst_len);
-        free(old_dst);
+        new_dst = realloc(*dst, *dst_space * sizeof(char) + 1);
+        if (!new_dst)
+            return 0;
+        else
+            *dst = new_dst;
     }
     memcpy(*dst + *dst_len, src, src_len+1);
     *dst_len = result_len;
+    return 1;
 }
 
 /**
@@ -104,16 +107,19 @@
  * @param [in,out] dst_space number of elements `dst` can hold
  * @param [in] src           elements to append to `dst`
  */
-static void reg_listcat(void*** dst, int* dst_len, int* dst_space, void* src) {
+static int reg_listcat(void*** dst, int* dst_len, int* dst_space, void* src) {
     if (*dst_len == *dst_space) {
-        void** old_dst = *dst;
+        void** new_dst;
         *dst_space *= 2;
-        *dst = malloc(*dst_space * sizeof(void*));
-        memcpy(*dst, old_dst, *dst_len);
-        free(old_dst);
+        new_dst = realloc(*dst, *dst_space * sizeof(void*));
+        if (!new_dst)
+            return 0;
+        else
+            *dst = new_dst;
     }
     (*dst)[*dst_len] = src;
     (*dst_len)++;
+    return 1;
 }
 
 /**
@@ -148,8 +154,8 @@
  * @param [in] userdata sqlite3 database
  * @param [out] entry   entry described by `stmt`
  * @param [in] stmt     `sqlite3_stmt` with appropriate columns
- * @param [out] errPtr  unused, since this function doesn't fail
- * @return              true, since this function doesn't fail
+ * @param [out] errPtr  unused
+ * @return              true if success; false if failure
  */
 static int reg_stmt_to_entry(void* userdata, void** entry, void* stmt,
         reg_error* errPtr UNUSED) {
@@ -160,6 +166,9 @@
             (const char*)&id, &is_new);
     if (is_new) {
         reg_entry* e = malloc(sizeof(reg_entry));
+        if (!e) {
+            return 0;
+        }
         e->reg = reg;
         e->id = id;
         e->proc = NULL;
@@ -204,19 +213,21 @@
             && (sqlite3_bind_text(stmt, 5, epoch, -1, SQLITE_STATIC)
                 == SQLITE_OK)) {
         int r;
+        Tcl_HashEntry* hash;
+        int is_new;
         do {
-            Tcl_HashEntry* hash;
-            int is_new;
             r = sqlite3_step(stmt);
             switch (r) {
                 case SQLITE_DONE:
                     entry = malloc(sizeof(reg_entry));
-                    entry->id = sqlite3_last_insert_rowid(reg->db);
-                    entry->reg = reg;
-                    entry->proc = NULL;
-                    hash = Tcl_CreateHashEntry(&reg->open_entries,
-                            (const char*)&entry->id, &is_new);
-                    Tcl_SetHashValue(hash, entry);
+                    if (entry) {
+                        entry->id = sqlite3_last_insert_rowid(reg->db);
+                        entry->reg = reg;
+                        entry->proc = NULL;
+                        hash = Tcl_CreateHashEntry(&reg->open_entries,
+                                (const char*)&entry->id, &is_new);
+                        Tcl_SetHashValue(hash, entry);
+                    }
                     break;
                 case SQLITE_BUSY:
                     break;
@@ -270,8 +281,10 @@
                     break;
                 case SQLITE_DONE:
                     errPtr->code = REG_NOT_FOUND;
-                    errPtr->description = "no matching port found";
-                    errPtr->free = NULL;
+                    errPtr->description = sqlite3_mprintf("no matching port found for: " \
+                            "name=%s, version=%s, revision=%s, variants=%s, epoch=%s", \
+                            name, version, revision, variants, epoch);
+                    errPtr->free = (reg_error_destructor*) sqlite3_free;
                     break;
                 case SQLITE_BUSY:
                     continue;
@@ -405,6 +418,9 @@
     int result_count = 0;
     int result_space = 10;
     sqlite3_stmt* stmt;
+    if (!results) {
+        return -1;
+    }
     if (sqlite3_prepare(reg->db, query, query_len, &stmt, NULL) == SQLITE_OK) {
         int r;
         reg_entry* entry;
@@ -413,8 +429,9 @@
             switch (r) {
                 case SQLITE_ROW:
                     if (fn(reg, (void**)&entry, stmt, errPtr)) {
-                        reg_listcat(&results, &result_count, &result_space,
-                                entry);
+                        if (!reg_listcat(&results, &result_count, &result_space, entry)) {
+                            r = SQLITE_ERROR;
+                        }
                     } else {
                         r = SQLITE_ERROR;
                     }
@@ -492,10 +509,16 @@
     }
     /* build the query */
     query = strdup("SELECT id FROM registry.ports");
+    if (!query) {
+        return -1;
+    }
     for (i=0; i<key_count; i++) {
         char* cond = sqlite3_mprintf(op, keys[i], vals[i]);
-        reg_strcat(&query, &query_len, &query_space, kwd);
-        reg_strcat(&query, &query_len, &query_space, cond);
+        if (!cond || !reg_strcat(&query, &query_len, &query_space, kwd)
+            || !reg_strcat(&query, &query_len, &query_space, cond)) {
+            free(query);
+            return -1;
+        }
         sqlite3_free(cond);
         kwd = " AND ";
     }
@@ -675,15 +698,22 @@
     int result = 0;
     sqlite3_stmt* stmt;
     char* query;
+    const char *text;
     query = sqlite3_mprintf("SELECT %q FROM registry.ports WHERE id=%lld", key,
             entry->id);
     if (sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
-        int r = sqlite3_step(stmt);
+        int r;
         do {
+            r = sqlite3_step(stmt);
             switch (r) {
                 case SQLITE_ROW:
-                    *value = strdup((const char*)sqlite3_column_text(stmt, 0));
-                    result = 1;
+                    text = (const char*)sqlite3_column_text(stmt, 0);
+                    if (text) {
+                        *value = strdup(text);
+                        result = 1;
+                    } else {
+                        reg_sqlite_error(reg->db, errPtr, query);
+                    }
                     break;
                 case SQLITE_DONE:
                     errPtr->code = REG_INVALID;
@@ -884,14 +914,22 @@
         int result_count = 0;
         int result_space = 10;
         int r;
+        const char *text;
+        char* element;
+        if (!result) {
+            return -1;
+        }
         do {
-            char* element;
             r = sqlite3_step(stmt);
             switch (r) {
                 case SQLITE_ROW:
-                    element = strdup((const char*)sqlite3_column_text(stmt, 0));
-                    reg_listcat((void***)&result, &result_count, &result_space,
-                            element);
+                    text = (const char*)sqlite3_column_text(stmt, 0);
+                    if (text) {
+                        element = strdup(text);
+                        if (!element || !reg_listcat((void***)&result, &result_count, &result_space, element)) {
+                            r = SQLITE_ERROR;
+                        }
+                    }
                     break;
                 case SQLITE_DONE:
                 case SQLITE_BUSY:
@@ -942,14 +980,22 @@
         int result_count = 0;
         int result_space = 10;
         int r;
+        const char *text;
+        char* element;
+        if (!result) {
+            return -1;
+        }
         do {
-            char* element;
             r = sqlite3_step(stmt);
             switch (r) {
                 case SQLITE_ROW:
-                    element = strdup((const char*)sqlite3_column_text(stmt, 0));
-                    reg_listcat((void***)&result, &result_count, &result_space,
-                            element);
+                    text = (const char*)sqlite3_column_text(stmt, 0);
+                    if (text) {
+                        element = strdup(text);
+                        if (!element || !reg_listcat((void***)&result, &result_count, &result_space, element)) {
+                            r = SQLITE_ERROR;
+                        }
+                    }
                     break;
                 case SQLITE_DONE:
                 case SQLITE_BUSY:
@@ -1141,8 +1187,6 @@
  * could potentially break any port listed in its dependents, and could not
  * break any other.
  *
- * N.B.: an inactive port has no dependents, since it can be safely removed.
- *
  * @param [in] entry       a port
  * @param [out] dependents a list of ports dependent on the given port
  * @param [out] errPtr     on error, a description of the error that occurred
@@ -1153,8 +1197,9 @@
     reg_registry* reg = entry->reg;
     char* query = sqlite3_mprintf("SELECT dependent.id FROM ports port "
             "INNER JOIN dependencies USING(name) INNER JOIN ports dependent "
-            "USING(id) WHERE port.id=%lld AND port.state = 'installed' "
-            "AND dependent.state = 'installed'",
+            "USING(id) WHERE port.id=%lld ORDER BY dependent.name,"
+            "dependent.epoch, dependent.version, dependent.revision,"
+            "dependent.variants",
             entry->id);
     int result = reg_all_entries(reg, query, -1, dependents, errPtr);
     sqlite3_free(query);
@@ -1176,8 +1221,8 @@
         reg_error* errPtr) {
     reg_registry* reg = entry->reg;
     char* query = sqlite3_mprintf("SELECT ports.id FROM registry.dependencies "
-        "INNER JOIN registry.ports USING(name) WHERE dependencies.id=%lld AND "
-        "ports.state = 'installed'", entry->id);
+        "INNER JOIN registry.ports USING(name) WHERE dependencies.id=%lld",
+        entry->id);
     int result = reg_all_entries(reg, query, -1, dependencies, errPtr);
     sqlite3_free(query);
     return result;
@@ -1227,7 +1272,7 @@
  *
  * @param [in] reg      registry to fetch entries from
  * @param [out] entries a list of open entries
- * @return              the number of open entries
+ * @return              the number of open entries, -1 on error
  */
 int reg_all_open_entries(reg_registry* reg, reg_entry*** entries) {
     reg_entry* entry;
@@ -1236,10 +1281,16 @@
     Tcl_HashEntry* hash;
     Tcl_HashSearch search;
     *entries = malloc(10*sizeof(void*));
+    if (!*entries) {
+        return -1;
+    }
     for (hash = Tcl_FirstHashEntry(&reg->open_entries, &search); hash != NULL;
             hash = Tcl_NextHashEntry(&search)) {
         entry = Tcl_GetHashValue(hash);
-        reg_listcat((void***)entries, &entry_count, &entry_space, entry);
+        if (!reg_listcat((void***)entries, &entry_count, &entry_space, entry)) {
+            free(*entries);
+            return -1;
+        }
     }
     return entry_count;
 }

Modified: branches/new-help-system/base/src/cregistry/entry.h
===================================================================
--- branches/new-help-system/base/src/cregistry/entry.h	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/entry.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -32,8 +32,9 @@
 #include <config.h>
 #endif
 
+#include "registry.h"
+
 #include <sqlite3.h>
-#include <cregistry/registry.h>
 
 typedef enum {
     reg_strategy_exact = 1,

Modified: branches/new-help-system/base/src/cregistry/registry.c
===================================================================
--- branches/new-help-system/base/src/cregistry/registry.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/registry.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -30,6 +30,9 @@
 #include <config.h>
 #endif
 
+#include "entry.h"
+#include "sql.h"
+
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -40,9 +43,6 @@
 #include <sys/stat.h>
 #include <errno.h>
 
-#include <cregistry/entry.h>
-#include <cregistry/sql.h>
-
 /*
  * TODO: maybe all the errPtrs could be made a property of `reg_registry`
  *       instead, and be destroyed with it? That would make memory-management
@@ -76,11 +76,12 @@
     errPtr->code = REG_SQLITE_ERROR;
     errPtr->free = (reg_error_destructor*)sqlite3_free;
     if (query == NULL) {
-        errPtr->description = sqlite3_mprintf("sqlite error: %s",
-                sqlite3_errmsg(db));
+        errPtr->description = sqlite3_mprintf("sqlite error: %s (%d)",
+                sqlite3_errmsg(db), sqlite3_errcode(db));
     } else {
-        errPtr->description = sqlite3_mprintf("sqlite error: %s while "
-                "executing query: %s", sqlite3_errmsg(db), query);
+        errPtr->description = sqlite3_mprintf("sqlite error: %s (%d) while "
+                "executing query: %s", sqlite3_errmsg(db), sqlite3_errcode(db),
+                query);
     }
 }
 
@@ -104,6 +105,9 @@
  */
 int reg_open(reg_registry** regPtr, reg_error* errPtr) {
     reg_registry* reg = malloc(sizeof(reg_registry));
+    if (!reg) {
+        return 0;
+    }
     if (sqlite3_open(NULL, &reg->db) == SQLITE_OK) {
         if (init_db(reg->db, errPtr)) {
             reg->status = reg_none;
@@ -194,10 +198,12 @@
         char* query = sqlite3_mprintf("ATTACH DATABASE '%q' AS registry", path);
         if (sqlite3_prepare(reg->db, query, -1, &stmt, NULL) == SQLITE_OK) {
             int r;
+            /* XXX: Busy waiting, consider using sqlite3_busy_handler/timeout */
             do {
-                r = sqlite3_step(stmt);
+                sqlite3_step(stmt);
+                r = sqlite3_reset(stmt);
                 switch (r) {
-                    case SQLITE_DONE:
+                    case SQLITE_OK:
                         if (initialized || (create_tables(reg->db, errPtr))) {
                             Tcl_InitHashTable(&reg->open_entries,
                                     sizeof(sqlite_int64)/sizeof(int));
@@ -245,10 +251,12 @@
         reg_entry* entry;
         Tcl_HashEntry* curr;
         Tcl_HashSearch search;
+        /* XXX: Busy waiting, consider using sqlite3_busy_handler/timeout */
         do {
-            r = sqlite3_step(stmt);
+            sqlite3_step(stmt);
+            r = sqlite3_reset(stmt);
             switch (r) {
-                case SQLITE_DONE:
+                case SQLITE_OK:
                     for (curr = Tcl_FirstHashEntry(&reg->open_entries, &search);
                             curr != NULL; curr = Tcl_NextHashEntry(&search)) {
                         entry = Tcl_GetHashValue(curr);

Modified: branches/new-help-system/base/src/cregistry/sql.c
===================================================================
--- branches/new-help-system/base/src/cregistry/sql.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/sql.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -30,29 +30,14 @@
 #include <config.h>
 #endif
 
+#include "registry.h"
+#include "sql.h"
+#include "vercomp.h"
+
 #include <tcl.h>
 #include <sqlite3.h>
-#include <string.h>
 #include <time.h>
-#include <ctype.h>
 
-#include <cregistry/registry.h>
-#include <cregistry/sql.h>
-
-/*
- * TODO: maybe this could be made into something that could be separately loaded
- *       by sqlite3? It's a bit hard to query the registry with the command-line
- *       sqlite3 tool because of the missing VERSION collation. My understanding
- *       is that you can make a dylib that can be loaded using an sql statement,
- *       which is less than transparent, but certainly reasonable.
- *
- * TODO: break out rpm_vercomp into a separate file which can be shared by
- *       pextlib and cregistry. The version here is slightly modified so as to
- *       take explicit string lengths. Since these are available in Tcl it's an
- *       easy change and might be a tiny bit faster; it's necessary for the
- *       application here.
- */
-
 /**
  * Executes a null-terminated list of queries. Pass it a list of queries, it'll
  * execute them. This is mainly intended for initialization, when you have a
@@ -107,161 +92,6 @@
 }
 
 /**
- * NOW function for sqlite3. Takes no arguments. Returns the unix timestamp of
- * the current time.
- *
- * @param [in] context sqlite3-defined structure
- * @param [in] argc    number of arguments - always 2 and hence unused
- * @param [in] argv    0: value to match; 1: pattern to match against
- */
-static void sql_now(sqlite3_context* context, int argc UNUSED,
-        sqlite3_value** argv UNUSED) {
-    sqlite3_result_int(context, time(NULL));
-}
-
-/**
- * RPM version comparison. Shamelessly copied from Pextlib, with some changes to
- * use string lengths instead of strlen by default. That's necessary to make it
- * work with sqlite3 collations. It should be shared with Pextlib, rather than
- * just copied though.
- *
- * @param [in] versionA first version string, i.e. "1.4.1"
- * @param [in] lengthA  length of first version string, or -1 to use strlen
- * @param [in] versionB second version string, i.e. "1.4.2"
- * @param [in] lengthA  length of second version string, or -1 to use strlen
- * @return              -1 if A < B; 0 if A = B; 1 if A > B
- */
-static int rpm_vercomp (const char *versionA, int lengthA, const char *versionB,
-        int lengthB) {
-    const char *endA, *endB;
-	const char *ptrA, *ptrB;
-	const char *eptrA, *eptrB;
-
-    if (lengthA < 0)
-        lengthA = strlen(versionA);
-    if (lengthB < 0)
-        lengthB = strlen(versionB);
-
-	/* if versions equal, return zero */
-	if(lengthA == lengthB && !strncmp(versionA, versionB, lengthA))
-		return 0;
-
-	ptrA = versionA;
-	ptrB = versionB;
-    endA = versionA + lengthA;
-    endB = versionB + lengthB;
-	while (ptrA != endA && ptrB != endB) {
-		/* skip all non-alphanumeric characters */
-		while (ptrA != endB && !isalnum(*ptrA))
-			ptrA++;
-		while (ptrB != endB && !isalnum(*ptrB))
-			ptrB++;
-
-		eptrA = ptrA;
-		eptrB = ptrB;
-
-		/* Somewhat arbitrary rules as per RPM's implementation.
-		 * This code could be more clever, but we're aiming
-		 * for clarity instead. */
-
-		/* If versionB's segment is not a digit segment, but
-		 * versionA's segment IS a digit segment, return 1.
-		 * (Added for redhat compatibility. See redhat bugzilla
-		 * #50977 for details) */
-		if (!isdigit(*ptrB)) {
-			if (isdigit(*ptrA))
-				return 1;
-		}
-
-		/* Otherwise, if the segments are of different types,
-		 * return -1 */
-
-		if ((isdigit(*ptrA) && isalpha(*ptrB)) || (isalpha(*ptrA) && isdigit(*ptrB)))
-			return -1;
-
-		/* Find the first segment composed of entirely alphabetical
-		 * or numeric members */
-		if (isalpha(*ptrA)) {
-			while (eptrA != endA && isalpha(*eptrA))
-				eptrA++;
-
-			while (eptrB != endB && isalpha(*eptrB))
-				eptrB++;
-		} else {
-			int countA = 0, countB = 0;
-			while (eptrA != endA && isdigit(*eptrA)) {
-				countA++;
-				eptrA++;
-			}
-			while (eptrB != endB && isdigit(*eptrB)) {
-				countB++;
-				eptrB++;
-			}
-
-			/* skip leading '0' characters */
-			while (ptrA != eptrA && *ptrA == '0') {
-				ptrA++;
-				countA--;
-			}
-			while (ptrB != eptrB && *ptrB == '0') {
-				ptrB++;
-				countB--;
-			}
-
-			/* If A is longer than B, return 1 */
-			if (countA > countB)
-				return 1;
-
-			/* If B is longer than A, return -1 */
-			if (countB > countA)
-				return -1;
-		}
-		/* Compare strings lexicographically */
-		while (ptrA != eptrA && ptrB != eptrB && *ptrA == *ptrB) {
-				ptrA++;
-				ptrB++;
-		}
-		if (ptrA != eptrA && ptrB != eptrB)
-			return *ptrA - *ptrB;
-
-		ptrA = eptrA;
-		ptrB = eptrB;
-	}
-
-	/* If both pointers are null, all alphanumeric
-	 * characters were identical and only seperating
-	 * characters differed. According to RPM, these
-	 * version strings are equal */
-	if (ptrA == endA && ptrB == endB)
-		return 0;
-
-	/* If A has unchecked characters, return 1
-	 * Otherwise, if B has remaining unchecked characters,
-	 * return -1 */
-	if (ptrA != endA)
-		return 1;
-	else
-		return -1;
-}
-
-/**
- * VERSION collation for sqlite3. This function collates text according to
- * pextlib's rpm-vercomp function. This allows direct comparison and sorting of
- * version columns, such as port.version and port.revision.
- *
- * @param [in] userdata unused
- * @param [in] alen     length of first string
- * @param [in] a        first string
- * @param [in] blen     length of second string
- * @param [in] b        second string
- * @return              -1 if a < b; 0 if a = b; 1 if a > b
- */
-static int sql_version(void* userdata UNUSED, int alen, const void* a, int blen,
-        const void* b) {
-    return rpm_vercomp((const char*)a, alen, (const char*)b, blen);
-}
-
-/**
  * Creates tables in the registry. This function is called upon an uninitialized
  * database to create the tables needed to record state between invocations of
  * `port`.
@@ -277,14 +107,16 @@
         /* metadata table */
         "CREATE TABLE registry.metadata (key UNIQUE, value)",
         "INSERT INTO registry.metadata (key, value) VALUES ('version', 1.000)",
-        "INSERT INTO registry.metadata (key, value) VALUES ('created', NOW())",
+        "INSERT INTO registry.metadata (key, value) VALUES ('created', strftime('%s', 'now'))",
 
         /* ports table */
         "CREATE TABLE registry.ports ("
-            "id INTEGER PRIMARY KEY AUTOINCREMENT,"
-            "name, portfile, url, location, epoch, version COLLATE VERSION, "
-            "revision COLLATE VERSION, variants, default_variants, state, "
-            "date, installtype, "
+            "id INTEGER PRIMARY KEY AUTOINCREMENT, "
+            "name TEXT COLLATE NOCASE, portfile CLOB, url TEXT, "
+            "location TEXT, epoch INTEGER, version TEXT COLLATE VERSION, "
+            "revision INTEGER, variants TEXT, negated_variants TEXT, "
+            "state TEXT, date DATETIME, installtype TEXT, archs TEXT, "
+            "requested INT, os_platform TEXT, os_major INTEGER, "
             "UNIQUE (name, epoch, version, revision, variants), "
             "UNIQUE (url, epoch, version, revision, variants)"
             ")",
@@ -295,14 +127,16 @@
         "CREATE INDEX registry.port_state ON ports (state)",
 
         /* file map */
-        "CREATE TABLE registry.files (id, path, actual_path, active, mtime, "
-            "md5sum, editable)",
+        "CREATE TABLE registry.files (id INTEGER, path TEXT, actual_path TEXT, "
+            "active INT, mtime DATETIME, md5sum TEXT, editable INT, "
+            "FOREIGN KEY(id) REFERENCES ports(id))",
         "CREATE INDEX registry.file_port ON files (id)",
         "CREATE INDEX registry.file_path ON files(path)",
         "CREATE INDEX registry.file_actual ON files(actual_path)",
 
         /* dependency map */
-        "CREATE TABLE registry.dependencies (id, name)",
+        "CREATE TABLE registry.dependencies (id INTEGER, name TEXT, variants TEXT, "
+        "FOREIGN KEY(id) REFERENCES ports(id))",
         "CREATE INDEX registry.dep_name ON dependencies (name)",
 
         "COMMIT",
@@ -338,8 +172,6 @@
     /* I'm not error-checking these. I don't think I need to. */
     sqlite3_create_function(db, "REGEXP", 2, SQLITE_UTF8, NULL, sql_regexp,
             NULL, NULL);
-    sqlite3_create_function(db, "NOW", 0, SQLITE_ANY, NULL, sql_now, NULL,
-            NULL);
 
     sqlite3_create_collation(db, "VERSION", SQLITE_UTF8, NULL, sql_version);
 

Modified: branches/new-help-system/base/src/cregistry/sql.h
===================================================================
--- branches/new-help-system/base/src/cregistry/sql.h	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/cregistry/sql.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -32,10 +32,10 @@
 #include <config.h>
 #endif
 
+#include "registry.h"
+
 #include <sqlite3.h>
 
-#include <cregistry/registry.h>
-
 int create_tables(sqlite3* db, reg_error* errPtr);
 int init_db(sqlite3* db, reg_error* errPtr);
 

Copied: branches/new-help-system/base/src/cregistry/sqlext.c (from rev 65586, trunk/base/src/cregistry/sqlext.c)
===================================================================
--- branches/new-help-system/base/src/cregistry/sqlext.c	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/sqlext.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,29 @@
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "vercomp.h"
+
+#include <string.h>
+#include <sqlite3ext.h>
+SQLITE_EXTENSION_INIT1
+
+/**
+ * Extension for sqlite3 defining collates being used in our DB. This can be
+ * used by any sqlite3 client to load the required collates.
+ *
+ * @param [in] db         database connection
+ * @param [out] pzErrMsg  error messages string
+ * @param [in] pApi       API methods
+ */
+int sqlite3_extension_init(
+    sqlite3 *db,          /* The database connection */
+    char **pzErrMsg UNUSED,      /* Write error messages here */
+    const sqlite3_api_routines *pApi  /* API methods */
+) {
+    SQLITE_EXTENSION_INIT2(pApi)
+
+    sqlite3_create_collation(db, "VERSION", SQLITE_UTF8, NULL, sql_version);
+
+    return 0;
+}

Copied: branches/new-help-system/base/src/cregistry/vercomp.c (from rev 65586, trunk/base/src/cregistry/vercomp.c)
===================================================================
--- branches/new-help-system/base/src/cregistry/vercomp.c	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/vercomp.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,189 @@
+/*
+ * vercomp.c
+ * $Id$
+ *
+ * Copyright (c) 2010 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright owner nor the names of contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "vercomp.h"
+
+#include <string.h>
+#include <ctype.h>
+
+/*
+ * TODO: share this function between pextlib and cregistry. The version here is
+ *       slightly modified so as to take explicit string lengths. Since these
+ *       are available in Tcl it's an easy change and might be a tiny bit
+ *       faster; it's necessary for the application here.
+ */
+
+/**
+ * RPM version comparison. Shamelessly copied from Pextlib, with some changes to
+ * use string lengths instead of strlen by default. That's necessary to make it
+ * work with sqlite3 collations. It should be shared with Pextlib, rather than
+ * just copied though.
+ *
+ * @param [in] versionA first version string, i.e. "1.4.1"
+ * @param [in] lengthA  length of first version string, or -1 to use strlen
+ * @param [in] versionB second version string, i.e. "1.4.2"
+ * @param [in] lengthA  length of second version string, or -1 to use strlen
+ * @return              -1 if A < B; 0 if A = B; 1 if A > B
+ */
+static int rpm_vercomp (const char *versionA, int lengthA, const char *versionB,
+        int lengthB) {
+    const char *endA, *endB;
+	const char *ptrA, *ptrB;
+	const char *eptrA, *eptrB;
+
+    if (lengthA < 0)
+        lengthA = strlen(versionA);
+    if (lengthB < 0)
+        lengthB = strlen(versionB);
+
+	/* if versions equal, return zero */
+	if(lengthA == lengthB && !strncmp(versionA, versionB, lengthA))
+		return 0;
+
+	ptrA = versionA;
+	ptrB = versionB;
+    endA = versionA + lengthA;
+    endB = versionB + lengthB;
+	while (ptrA != endA && ptrB != endB) {
+		/* skip all non-alphanumeric characters */
+		while (ptrA != endB && !isalnum(*ptrA))
+			ptrA++;
+		while (ptrB != endB && !isalnum(*ptrB))
+			ptrB++;
+
+		eptrA = ptrA;
+		eptrB = ptrB;
+
+		/* Somewhat arbitrary rules as per RPM's implementation.
+		 * This code could be more clever, but we're aiming
+		 * for clarity instead. */
+
+		/* If versionB's segment is not a digit segment, but
+		 * versionA's segment IS a digit segment, return 1.
+		 * (Added for redhat compatibility. See redhat bugzilla
+		 * #50977 for details) */
+		if (!isdigit(*ptrB)) {
+			if (isdigit(*ptrA))
+				return 1;
+		}
+
+		/* Otherwise, if the segments are of different types,
+		 * return -1 */
+
+		if ((isdigit(*ptrA) && isalpha(*ptrB)) || (isalpha(*ptrA) && isdigit(*ptrB)))
+			return -1;
+
+		/* Find the first segment composed of entirely alphabetical
+		 * or numeric members */
+		if (isalpha(*ptrA)) {
+			while (eptrA != endA && isalpha(*eptrA))
+				eptrA++;
+
+			while (eptrB != endB && isalpha(*eptrB))
+				eptrB++;
+		} else {
+			int countA = 0, countB = 0;
+			while (eptrA != endA && isdigit(*eptrA)) {
+				countA++;
+				eptrA++;
+			}
+			while (eptrB != endB && isdigit(*eptrB)) {
+				countB++;
+				eptrB++;
+			}
+
+			/* skip leading '0' characters */
+			while (ptrA != eptrA && *ptrA == '0') {
+				ptrA++;
+				countA--;
+			}
+			while (ptrB != eptrB && *ptrB == '0') {
+				ptrB++;
+				countB--;
+			}
+
+			/* If A is longer than B, return 1 */
+			if (countA > countB)
+				return 1;
+
+			/* If B is longer than A, return -1 */
+			if (countB > countA)
+				return -1;
+		}
+		/* Compare strings lexicographically */
+		while (ptrA != eptrA && ptrB != eptrB && *ptrA == *ptrB) {
+				ptrA++;
+				ptrB++;
+		}
+		if (ptrA != eptrA && ptrB != eptrB)
+			return *ptrA - *ptrB;
+
+		ptrA = eptrA;
+		ptrB = eptrB;
+	}
+
+	/* If both pointers are null, all alphanumeric
+	 * characters were identical and only seperating
+	 * characters differed. According to RPM, these
+	 * version strings are equal */
+	if (ptrA == endA && ptrB == endB)
+		return 0;
+
+	/* If A has unchecked characters, return 1
+	 * Otherwise, if B has remaining unchecked characters,
+	 * return -1 */
+	if (ptrA != endA)
+		return 1;
+	else
+		return -1;
+}
+
+/**
+ * VERSION collation for sqlite3. This function collates text according to
+ * pextlib's rpm-vercomp function. This allows direct comparison and sorting of
+ * version columns, such as port.version and port.revision.
+ *
+ * @param [in] userdata unused
+ * @param [in] alen     length of first string
+ * @param [in] a        first string
+ * @param [in] blen     length of second string
+ * @param [in] b        second string
+ * @return              -1 if a < b; 0 if a = b; 1 if a > b
+ */
+int sql_version(void* userdata UNUSED, int alen, const void* a, int blen,
+        const void* b) {
+    return rpm_vercomp((const char*)a, alen, (const char*)b, blen);
+}

Copied: branches/new-help-system/base/src/cregistry/vercomp.h (from rev 65586, trunk/base/src/cregistry/vercomp.h)
===================================================================
--- branches/new-help-system/base/src/cregistry/vercomp.h	                        (rev 0)
+++ branches/new-help-system/base/src/cregistry/vercomp.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,38 @@
+/*
+ * vercomp.h
+ * $Id$
+ *
+ * Copyright (c) 2010 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the copyright owner nor the names of contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef _VERCOMP_H
+#define _VERCOMP_H
+
+int sql_version(void* userdata UNUSED, int alen, const void* a, int blen,
+        const void* b);
+
+#endif /* _VERCOMP_H */

Modified: branches/new-help-system/base/src/darwintracelib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/darwintracelib1.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -2,6 +2,8 @@
 SHLIB_NAME=	darwintrace${SHLIB_SUFFIX}
 INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/darwintrace1.0
 
+test::
+
 include ../../Mk/macports.autoconf.mk
 
 all:: ${SHLIB_NAME}

Modified: branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c
===================================================================
--- branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/darwintracelib1.0/darwintrace.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -239,8 +239,10 @@
 	if (varValue) {
 		int theSize = strlen(varName) + strlen(varValue) + 2;
 		theResult = (char*) malloc(theSize);
-		sprintf(theResult, "%s=%s", varName, varValue);
-		theResult[theSize - 1] = 0;
+		if (theResult) {
+		    snprintf(theResult, theSize, "%s=%s", varName, varValue);
+		    theResult[theSize - 1] = 0;
+		}
 	}
 	
 	return theResult;
@@ -250,6 +252,7 @@
  * This function checks that envp contains the global variables we had when the
  * library was loaded and modifies it if it doesn't.
  */
+__attribute__((always_inline))
 inline char* const* __darwintrace_restore_env(char* const envp[]) {
 	/* allocate the strings. */
 	/* we don't care about the leak here because we're going to call execve,
@@ -334,7 +337,7 @@
 			int sock=socket(AF_UNIX, SOCK_STREAM, 0);
 			struct sockaddr_un sun;
 			sun.sun_family=AF_UNIX;
-			strcpy(sun.sun_path, __env_darwintrace_log);
+			strncpy(sun.sun_path, __env_darwintrace_log, sizeof(sun.sun_path));
 			if(connect(sock, (struct sockaddr*)&sun, strlen(__env_darwintrace_log)+1+sizeof(sun.sun_family))!=-1)
 			{
 				dprintf("darwintrace: connect successful. socket %d\n", sock);
@@ -474,8 +477,8 @@
 	if(is_directory(path))
 		return 1;
 	
-	strcpy(buffer, "dep_check\t");
-	strcpy(buffer+10, path);
+	strncpy(buffer, "dep_check\t", sizeof(buffer));
+	strncpy(buffer+10, path, sizeof(buffer)-10);
 	p=exchange_with_port(buffer, strlen(buffer)+1, 1, 0);
 	if(p==(char*)-1||!p)
 		return 0;

Modified: branches/new-help-system/base/src/dep_map_clean.tcl
===================================================================
--- branches/new-help-system/base/src/dep_map_clean.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/dep_map_clean.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -11,8 +11,11 @@
 
 mportinit
 
-registry::open_dep_map
-registry::clean_dep_map
-registry::write_dep_map
+# Only the flat format had the bug which needs to be corrected
+if {${macports::registry.format} == "flat"} {
+    registry::open_dep_map
+    registry::clean_dep_map
+    registry::write_dep_map
+}
 
 exit 0


Property changes on: branches/new-help-system/base/src/dep_map_clean.tcl
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/macports1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/macports1.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/macports1.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,13 +1,18 @@
 SRCS=		macports.tcl macports_dlist.tcl macports_util.tcl \
 		macports_autoconf.tcl macports_index.tcl macports_fastload.tcl
-OBJS=		macports.o
+OBJS=		macports.o get_systemconfiguration_proxies.o sysctl.o
 SHLIB_NAME=	MacPorts${SHLIB_SUFFIX}
 
-INSTALLDIR=	${DESTDIR}${TCL_PACKAGE_DIR}/macports1.0
+INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/macports1.0
+INSTALLPKGLINK=	${TCL_PACKAGE_DIR}/macports1.0
 
 include ../../Mk/macports.autoconf.mk
 include ../../Mk/macports.tea.mk
 
+ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
+	LIBS+= -framework CoreFoundation -framework SystemConfiguration
+endif
+
 test::
 	${TCLSH} tests/macports_dlist.tcl
 	${TCLSH} tests/macports_util.tcl
@@ -22,6 +27,9 @@
 		$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 $$file ${INSTALLDIR}/$$file; \
 	done
 
+	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
+	
 	echo "${TCL_PACKAGE_DIR}" > ${DESTDIR}${prefix}/var/macports/.tclpackage
-
-	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 pkgIndex.tcl ${INSTALLDIR}
+	if test -z "${DESTDIR}" && ! test -e "${INSTALLPKGLINK}" && test -w "${TCL_PACKAGE_DIR}"; then \
+		ln -s "${INSTALLDIR}" "${INSTALLPKGLINK}" || true; \
+	fi

Copied: branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c (from rev 65586, trunk/base/src/macports1.0/get_systemconfiguration_proxies.c)
===================================================================
--- branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c	                        (rev 0)
+++ branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,177 @@
+/*
+ * get_systemconfiguration_proxies.c
+ * $Id$
+ *
+ * Copyright (c) 2008-2009, The MacPorts Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of MacPorts Team nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "get_systemconfiguration_proxies.h"
+
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey );
+char *cfStringToCStringASCII( CFStringRef cfString );
+
+#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
+
+
+/**
+ *
+ * Query SystemConfiguration for proxy information, returning this
+ * information in a Tcl list ready to be 'array set' (key, name pairs).
+ *
+ * Synopsis: array set someArray get_systemconfiguration_proxies
+ */
+int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+{
+    int cmdResult = TCL_OK;
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+    CFDictionaryRef proxies = SCDynamicStoreCopyProxies( NULL );
+    if( proxies != NULL )
+    {
+        Tcl_Obj *proxyList = Tcl_NewListObj( 0, NULL );
+        if( appendProxyInformationForKeys( proxies, proxyList, "proxy_http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort ) == 0 &&
+            appendProxyInformationForKeys( proxies, proxyList, "proxy_https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort ) == 0 &&
+            appendProxyInformationForKeys( proxies, proxyList, "proxy_ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort ) == 0 )
+        {
+            CFArrayRef exceptionsCFArray = CFDictionaryGetValue( proxies, kSCPropNetProxiesExceptionsList );
+            if( exceptionsCFArray != NULL )
+            {
+                CFStringRef exceptionsCFString = CFStringCreateByCombiningStrings( kCFAllocatorDefault, exceptionsCFArray, CFSTR( "," ) );
+                char *exceptionsString = cfStringToCStringASCII( exceptionsCFString );
+                if( exceptionsString != NULL )
+                {
+                    Tcl_Obj *exceptionsKey = Tcl_NewStringObj( "proxy_skip", 10 );
+                    Tcl_Obj *exceptionsTclString = Tcl_NewStringObj( exceptionsString, strlen( exceptionsString ) );
+                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsKey );
+                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsTclString );
+                    free( exceptionsString );
+                }
+                else
+                    cmdResult = TCL_ERROR;
+                CFRelease( exceptionsCFString );
+            }
+            Tcl_SetObjResult( interp, proxyList );
+        }
+        else
+            cmdResult = TCL_ERROR;
+        CFRelease( proxies );
+    }
+    if( cmdResult == TCL_ERROR ) {
+        Tcl_SetErrno( errno );
+        Tcl_SetResult( interp, (char *) Tcl_PosixError( interp ), TCL_STATIC );
+    }
+#endif
+   return cmdResult;
+}
+
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+/**
+ *
+ * Extract the proxy information (given by proxyEnabledKey, proxyHostKey,
+ * and proxyPortKey) from the proxies dictionary, then append listKey and
+ * the pertinent proxy information to the Tcl list.
+ *
+ * Returns 0 on success; -1 on failure
+ */
+int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey )
+{
+    int result = 0;
+    CFNumberRef proxyEnabledNumber = CFDictionaryGetValue( proxies, proxyEnabledKey );
+    int proxyEnabled = 0;
+    if( proxyEnabledNumber != NULL &&
+        CFNumberGetValue( proxyEnabledNumber, kCFNumberIntType, &proxyEnabled ) &&
+        proxyEnabled )
+    {
+        CFStringRef proxyHostString = CFDictionaryGetValue( proxies, proxyHostKey );
+        char *hostname = NULL;
+        if( proxyHostString != NULL &&
+            ( hostname = cfStringToCStringASCII( proxyHostString ) ) != NULL )
+        {
+            CFNumberRef proxyPortNumber = CFDictionaryGetValue( proxies, proxyPortKey );
+            int proxyPort = 0;
+            if( proxyPortNumber != NULL &&
+                CFNumberGetValue( proxyPortNumber, kCFNumberIntType, &proxyPort ) &&
+                proxyPort > 0 )
+            {
+                /*
+                 * We are adding :<port>\0 to the end, which is up to 7
+                 * bytes additional (up to 5 for the port)
+                 */
+                int newLength = strlen( hostname ) + 7;
+                char *hostnameAndPort = calloc( 1, newLength );
+                if( hostnameAndPort != NULL )
+                {
+                    Tcl_Obj *hostnameAndPortTcl;
+                    Tcl_Obj *listKeyTcl = Tcl_NewStringObj( listKey, strlen( listKey ) );
+                    Tcl_ListObjAppendElement( NULL, tclList, listKeyTcl );
+                    snprintf( hostnameAndPort, newLength, "%s:%d", hostname, proxyPort );
+                    hostnameAndPortTcl = Tcl_NewStringObj( hostnameAndPort, strlen( hostnameAndPort ) );
+                    Tcl_ListObjAppendElement( NULL, tclList, hostnameAndPortTcl );
+                    free( hostnameAndPort );
+                }
+                else
+                    result = -1;
+            }
+            else
+                result = -1;
+        }
+        else
+            result = -1;
+    }
+
+    return result;
+}
+
+
+/**
+ *
+ * Convert a CFStringRef to an ASCII-encoded C string; be sure to free()
+ * the returned string when done with it.
+ */
+char *cfStringToCStringASCII( CFStringRef cfString )
+{
+    int strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
+    char *cString = calloc( 1, strLen );
+    if( cString != NULL )
+        CFStringGetCString( cfString, cString, strLen, kCFStringEncodingASCII );
+
+   return cString;
+}
+
+#endif
+

Copied: branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.h (from rev 65586, trunk/base/src/macports1.0/get_systemconfiguration_proxies.h)
===================================================================
--- branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.h	                        (rev 0)
+++ branches/new-help-system/base/src/macports1.0/get_systemconfiguration_proxies.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,41 @@
+/* 
+ * get_systemconfiguration_proxies.h 
+ * $Id$ 
+ * 
+ * Copyright (c) 2008-2009, The MacPorts Project. 
+ * All rights reserved. 
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions 
+ * are met: 
+ * 1. Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer. 
+ * 2. Redistributions in binary form must reproduce the above copyright 
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the distribution. 
+ * 3. Neither the name of MacPorts Team nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission. 
+ *  
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE. 
+ */ 
+
+#ifndef _GETSYSTEMCONFIGURATIONPROXIES_H
+#define _GETSYSTEMCONFIGURATIONPROXIES_H
+
+#include <tcl.h> 
+
+int GetSystemConfigurationProxiesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ); 
+
+#endif   /* _GETSYSTEMCONFIGURATIONPROXIES_H */
+

Modified: branches/new-help-system/base/src/macports1.0/macports.c
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/macports1.0/macports.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,6 +37,9 @@
 
 #include <tcl.h>
 
+#include "get_systemconfiguration_proxies.h"
+#include "sysctl.h"
+
 static int
 macports__version(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj * CONST objv[])
 {
@@ -54,6 +57,8 @@
 	if (Tcl_InitStubs(interp, "8.4", 0) == NULL)
 		return TCL_ERROR;
 	Tcl_CreateObjCommand(interp, "macports::version", macports__version, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "sysctl", SysctlCmd, NULL, NULL);
 	if (Tcl_PkgProvide(interp, "macports", "1.0") != TCL_OK)
 		return TCL_ERROR;
 	return TCL_OK;

Modified: branches/new-help-system/base/src/macports1.0/macports.tcl
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/macports1.0/macports.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -38,23 +38,23 @@
 package require macports_util 1.0
 
 namespace eval macports {
-    namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities
+    namespace export bootstrap_options user_options portinterp_options open_mports ui_priorities port_phases 
     variable bootstrap_options "\
         portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
         portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
-        porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
+        porttrace portverbose keeplogs destroot_umask variants_conf rsync_server rsync_options \
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs \
+        applications_dir frameworks_dir developer_dir universal_archs build_arch \
         macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
         registry.path registry.format registry.installtype portarchivemode portarchivepath \
-        portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
-        rsync_options rsync_dir startupitem_type place_worksymlink \
+        portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
+        rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir frameworks_dir developer_dir universal_archs $user_options"
+        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -63,7 +63,9 @@
 
     variable open_mports {}
 
-    variable ui_priorities "debug info msg error warn"
+    variable ui_priorities "debug info msg error warn any"
+    variable port_phases "any fetch checksum"
+    variable current_phase "main"
 }
 
 # Provided UI instantiations
@@ -106,55 +108,143 @@
     return 0
 }
 
+proc macports::init_logging {mport} {
+    global macports::channels macports::portdbpath
 
-proc macports::ui_init {priority args} {
-    # Get the list of channels.
-    try {
-        set channels [ui_channels $priority]
-    } catch * {
-        set channels [ui_channels_default $priority]
+    if {[getuid] == 0 && [geteuid] != 0} {
+        seteuid 0
     }
+    if {[catch {macports::ch_logging $mport} err]} {
+        ui_debug "Logging disabled, error opening log file: $err"
+        return 1
+    }
+    # Add our log-channel to all already initialized channels
+    foreach key [array names channels] {
+        set macports::channels($key) [concat $macports::channels($key) "debuglog"]
+    }
+    return 0
+}
+proc macports::ch_logging {mport} {
+    global ::debuglog ::debuglogname
 
-    # Simplify ui_$priority.
-    set nbchans [llength $channels]
-    if {$nbchans == 0} {
-        proc ::ui_$priority {args} {}
-    } else {
-        try {
-            set prefix [ui_prefix $priority]
-        } catch * {
-            set prefix [ui_prefix_default $priority]
+    set portname [_mportkey $mport name]
+    set portpath [_mportkey $mport portpath]
+
+    ui_debug "Starting logging for $portname"
+
+    set logname [macports::getportlogpath $portpath]
+    file mkdir $logname
+    set logname [file join $logname "main.log"]
+
+    set ::debuglogname $logname
+
+    # Truncate the file if already exists
+    set ::debuglog [open $::debuglogname w]
+    puts $::debuglog "version:1"
+}
+proc macports::push_log {mport} {
+    global ::logstack ::logenabled ::debuglog ::debuglogname
+    if {![info exists ::logenabled]} {
+        if {[macports::init_logging $mport] == 0} {
+            set ::logenabled yes
+            set ::logstack [list [list $::debuglog $::debuglogname]]
+            return
+        } else {
+            set ::logenabled no
         }
+    }
+    if {$::logenabled} {
+        if {[catch {macports::ch_logging $mport} err]} {
+            ui_debug "Logging disabled, error opening log file: $err"
+            return
+        }
+        lappend ::logstack [list $::debuglog $::debuglogname]
+    }
+}
+proc macports::pop_log {} {
+    global ::logenabled ::logstack ::debuglog ::debuglogname
+    if {![info exists ::logenabled]} {
+        return -code error "pop_log called before push_log"
+    }
+    if {$::logenabled && [llength $::logstack] > 0} {
+        close $::debuglog
+        set ::logstack [lreplace $::logstack end end]
+        if {[llength $::logstack] > 0} {
+            set top [lindex $::logstack end]
+            set ::debuglog [lindex $top 0]
+            set ::debuglogname [lindex $top 1]
+        } else {
+            unset ::debuglog
+            unset ::debuglogname
+        }
+    }
+}
 
-        try {
-            eval ::ui_init $priority $prefix $channels $args
-        } catch * {
-            if {$nbchans == 1} {
-                set chan [lindex $channels 0]
-                proc ::ui_$priority {args} [subst {
-                    if {\[lindex \$args 0\] == "-nonewline"} {
-                        puts -nonewline $chan "$prefix\[lindex \$args 1\]"
-                    } else {
-                        puts $chan "$prefix\[lindex \$args 0\]"
-                    }
-                }]
+proc ui_phase {phase} {
+    global macports::current_phase
+    set macports::current_phase $phase
+    if {$phase != "main"} {
+        set cur_time [clock format [clock seconds] -format  {%+}]
+        ui_debug "$phase phase started at $cur_time"
+    }
+}
+proc ui_message {priority prefix phase args} {
+    global macports::channels ::debuglog macports::current_phase
+    foreach chan $macports::channels($priority) {
+        if {[info exists ::debuglog] && ($chan == "debuglog")} {
+            set chan $::debuglog
+            if {[info exists macports::current_phase]} {
+                set phase $macports::current_phase
+            }
+            set strprefix ":$priority:$phase "
+            if {[lindex $args 0] == "-nonewline"} {
+                puts -nonewline $chan "$strprefix[lindex $args 1]"
             } else {
-                proc ::ui_$priority {args} [subst {
-                    foreach chan \$channels {
-                        if {\[lindex \$args 0\] == "-nonewline"} {
-                            puts -nonewline $chan "$prefix\[lindex \$args 1\]"
-                        } else {
-                            puts $chan "$prefix\[lindex \$args 0\]"
-                        }
-                    }
-                }]
+                puts $chan "$strprefix[lindex $args 0]"
             }
+ 
+        } else {
+            if {[lindex $args 0] == "-nonewline"} {
+                puts -nonewline $chan "$prefix[lindex $args 1]"
+            } else {
+                puts $chan "$prefix[lindex $args 0]"
+            }
         }
-
-        # Call ui_$priority
-        eval ::ui_$priority $args
     }
 }
+proc macports::ui_init {priority args} {
+    global macports::channels ::debuglog
+    set default_channel [macports::ui_channels_default $priority]
+    # Get the list of channels.
+    if {[llength [info commands ui_channels]] > 0} {
+        set channels($priority) [ui_channels $priority]
+    } else {
+        set channels($priority) $default_channel
+    }
+    
+    # if some priority initialized after log file is being created
+    if {[info exists ::debuglog]} {
+        set channels($priority) [concat $channels($priority) "debuglog"]
+    }
+    # Simplify ui_$priority.
+    try {
+        set prefix [ui_prefix $priority]
+    } catch * {
+        set prefix [ui_prefix_default $priority]
+    }
+    set phases {fetch checksum}
+    try {
+        eval ::ui_init $priority $prefix $channels($priority) $args
+    } catch * {
+        interp alias {} ui_$priority {} ui_message $priority $prefix ""
+        foreach phase $phases {
+            interp alias {} ui_${priority}_${phase} {} ui_message $priority $prefix $phase
+        }
+    }
+    # Call ui_$priority
+    eval ::ui_$priority $args
+    
+}
 
 # Default implementation of ui_prefix
 proc macports::ui_prefix_default {priority} {
@@ -215,6 +305,14 @@
     proc ui_$priority {args} [subst { eval macports::ui_init $priority \$args }]
 }
 
+proc ui_warn_once {id msg} {
+    variable macports::warning_done
+    if {![info exists macports::warning_done($id)]} {
+        ui_warn $msg
+        set macports::warning_done($id) 1
+    }
+}
+
 # Replace puts to catch errors (typically broken pipes when being piped to head)
 rename puts tcl::puts
 proc puts {args} {
@@ -319,7 +417,7 @@
         upvar $up_variations variations
     }
 
-    global auto_path env
+    global auto_path env tcl_platform
     global macports::autoconf::macports_conf_path
     global macports::macports_user_dir
     global macports::bootstrap_options
@@ -351,6 +449,7 @@
     global macports::buildnicevalue
     global macports::buildmakejobs
     global macports::universal_archs
+    global macports::build_arch
 
     # Set the system encoding to utf-8
     encoding system utf-8
@@ -471,6 +570,8 @@
             ui_debug "$variants_conf does not exist, variants_conf setting ignored."
         }
     }
+    global macports::global_variations
+    array set macports::global_variations [mport_filtervariants [array get variations] yes]
 
     if {![info exists portdbpath]} {
         return -code error "portdbpath must be set in ${macports_conf_path}/macports.conf or in your ${macports_user_dir}/macports.conf"
@@ -489,10 +590,11 @@
 
     # Format for receipts, can currently be either "flat" or "sqlite"
     if {[info exists portdbformat]} {
-        if { $portdbformat == "sqlite" } {
-            return -code error "SQLite is not yet supported for registry storage."
+        if {$portdbformat == "flat" || $portdbformat == "sqlite"} {
+            set registry.format receipt_${portdbformat}
+        } else {
+            return -code error "unknown registry format '$portdbformat' set in macports.conf"
         }
-        set registry.format receipt_${portdbformat}
     } else {
         set registry.format receipt_flat
     }
@@ -509,6 +611,12 @@
         set macports::portautoclean "yes"
         global macports::portautoclean
     }
+	# whether to keep logs after successful builds
+   	if {![info exists keeplogs]} {
+        set macports::keeplogs "no"
+        global macports::keeplogs
+    }
+   
     # Check command line override for autoclean
     if {[info exists macports::global_options(ports_autoclean)]} {
         if {![string equal $macports::global_options(ports_autoclean) $portautoclean]} {
@@ -544,7 +652,7 @@
 
     # Archive mode, whether to create/use binary archive packages
     if {![info exists portarchivemode]} {
-        set macports::portarchivemode "yes"
+        set macports::portarchivemode "no"
         global macports::portarchivemode
     }
 
@@ -556,7 +664,10 @@
     if {$portarchivemode == "yes"} {
         if {![file isdirectory $portarchivepath]} {
             if {![file exists $portarchivepath]} {
-                if {[catch {file mkdir $portarchivepath} result]} {
+                if {![file owned $portdbpath]} {
+                    file lstat $portdbpath stat
+                    return -code error "insufficient privileges for portdbpath $portdbpath (uid $stat(uid)); cannot create portarchivepath"
+                } elseif {[catch {file mkdir $portarchivepath} result]} {
                     return -code error "portarchivepath $portarchivepath does not exist and could not be created: $result"
                 }
             }
@@ -569,7 +680,7 @@
     # Archive type, what type of binary archive to use (CPIO, gzipped
     # CPIO, XAR, etc.)
     if {![info exists portarchivetype]} {
-        set macports::portarchivetype "cpgz"
+        set macports::portarchivetype "tgz"
         global macports::portarchivetype
     }
     # Convert archive type to a list for multi-archive support, colon or
@@ -632,7 +743,7 @@
         set macports::configuredistcc no
     }
     if {![info exists macports::configurepipe]} {
-        set macports::configurepipe no
+        set macports::configurepipe yes
     }
 
     # Default mp build options
@@ -642,7 +753,12 @@
     if {![info exists macports::buildmakejobs]} {
         set macports::buildmakejobs 0
     }
-    
+
+    # default user to run as when privileges can be dropped
+    if {![info exists macports::macportsuser]} {
+        set macports::macportsuser $macports::autoconf::macportsuser
+    }
+
     # Default Xcode Tools path
     if {![info exists macports::developer_dir]} {
         set macports::developer_dir "/Developer"
@@ -650,15 +766,42 @@
 
     # Default mp universal options
     if {![info exists macports::universal_archs]} {
-        set macports::universal_archs {ppc i386}
+        if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+            set macports::universal_archs {x86_64 i386}
+        } else {
+            set macports::universal_archs {i386 ppc}
+        }
     }
+    
+    # Default arch to build for
+    if {![info exists macports::build_arch]} {
+        if {$tcl_platform(os) == "Darwin"} {
+            if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+                if {[sysctl hw.cpu64bit_capable] == 1} {
+                    set macports::build_arch x86_64
+                } else {
+                    set macports::build_arch i386
+                }
+            } else {
+                if {$tcl_platform(machine) == "Power Macintosh"} {
+                    set macports::build_arch ppc
+                } else {
+                    set macports::build_arch i386
+                }
+            }
+        } else {
+            set macports::build_arch ""
+        }
+    } else {
+        set macports::build_arch [lindex $macports::build_arch 0]
+    }
 
     # ENV cleanup.
     set keepenvkeys {
         DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
         DYLD_FALLBACK_LIBRARY_PATH DYLD_FRAMEWORK_PATH
         DYLD_LIBRARY_PATH DYLD_INSERT_LIBRARIES
-        HOME JAVA_HOME MASTER_SITE_LOCAL
+        HOME JAVA_HOME MASTER_SITE_LOCAL ARCHIVE_SITE_LOCAL
         PATCH_SITE_LOCAL PATH PORTSRC RSYNC_PROXY TMP TMPDIR
         USER GROUP
         http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
@@ -698,6 +841,7 @@
         # should ship with macports1.0 API?
         package require Pextlib 1.0
         package require registry 1.0
+        package require registry2 2.0
     } else {
         return -code error "Library directory '$libpath' must exist"
     }
@@ -713,7 +857,9 @@
     if {![info exists proxy_override_env] } {
         set proxy_override_env "no"
     }
-    array set sysConfProxies [get_systemconfiguration_proxies]
+    if {[catch {array set sysConfProxies [get_systemconfiguration_proxies]} result]} {
+        return -code error "Unable to get proxy configuration from system: $result"
+    }
     if {![info exists env(http_proxy)] || $proxy_override_env == "yes" } {
         if {[info exists proxy_http]} {
             set env(http_proxy) $proxy_http
@@ -750,6 +896,30 @@
 
     # load the quick index
     _mports_load_quickindex
+
+    set default_source_url [lindex ${sources_default} 0]
+    if {[macports::getprotocol $default_source_url] == "file" || [macports::getprotocol $default_source_url] == "rsync"} {
+        set default_portindex [macports::getindex $default_source_url]
+        if {[file exists $default_portindex] && [expr [clock seconds] - [file mtime $default_portindex]] > 1209600} {
+            ui_warn "port definitions are more than two weeks old, consider using selfupdate"
+        }
+    }
+    
+    # init registry if needed
+    if {${registry.format} == "receipt_sqlite"} {
+        set db_path [file join ${registry.path} registry registry.db]
+        set db_exists [file exists $db_path]
+        registry::open $db_path
+        # for the benefit of the portimage code that is called from multiple interpreters
+        global registry_open
+        set registry_open yes
+        # convert any flat receipts if we just created a new db
+        if {$db_exists == 0 && [file writable $db_path]} {
+            ui_warn "Converting your registry to sqlite format, this might take a while..."
+            registry::convert_to_sqlite
+            ui_warn "Successfully converted your registry to sqlite!"
+        }
+    }
 }
 
 proc macports::worker_init {workername portpath porturl portbuildpath options variations} {
@@ -780,21 +950,36 @@
     $workername alias mport_open mportopen
     $workername alias mport_close mportclose
     $workername alias mport_lookup mportlookup
+    $workername alias ui_phase ui_phase
 
     # instantiate the UI call-backs
     foreach priority ${macports::ui_priorities} {
         $workername alias ui_$priority ui_$priority
+        foreach phase ${macports::port_phases} {
+            $workername alias ui_${priority}_${phase} ui_${priority}_${phase}
+        }
+ 
     }
+
     $workername alias ui_prefix ui_prefix
     $workername alias ui_channels ui_channels
+    
+    $workername alias ui_warn_once ui_warn_once
 
     # Export some utility functions defined here.
     $workername alias macports_create_thread macports::create_thread
     $workername alias getportworkpath_from_buildpath macports::getportworkpath_from_buildpath
     $workername alias getportresourcepath macports::getportresourcepath
+    $workername alias getportlogpath macports::getportlogpath
     $workername alias getdefaultportresourcepath macports::getdefaultportresourcepath
     $workername alias getprotocol macports::getprotocol
     $workername alias getportdir macports::getportdir
+    $workername alias findBinary macports::findBinary
+    $workername alias binaryInPath macports::binaryInPath
+    $workername alias sysctl sysctl
+    $workername alias realpath realpath
+    $workername alias _mportsearchpath _mportsearchpath
+    $workername alias _portnameactive _portnameactive
 
     # New Registry/Receipts stuff
     $workername alias registry_new registry::new_entry
@@ -802,16 +987,16 @@
     $workername alias registry_write registry::write_entry
     $workername alias registry_prop_store registry::property_store
     $workername alias registry_prop_retr registry::property_retrieve
-    $workername alias registry_delete registry::delete_entry
     $workername alias registry_exists registry::entry_exists
     $workername alias registry_exists_for_name registry::entry_exists_for_name
     $workername alias registry_activate portimage::activate
     $workername alias registry_deactivate portimage::deactivate
+    $workername alias registry_uninstall registry_uninstall::uninstall
     $workername alias registry_register_deps registry::register_dependencies
     $workername alias registry_fileinfo_for_index registry::fileinfo_for_index
     $workername alias registry_bulk_register_files registry::register_bulk_files
-    $workername alias registry_installed registry::installed
     $workername alias registry_active registry::active
+    $workername alias registry_file_registered registry::file_registered
 
     # deferred options processing.
     $workername alias getoption macports::getoption
@@ -925,23 +1110,22 @@
 # fetched port will be downloaded to (currently only applies to
 # mports:// sources).
 proc macports::getportdir {url {destdir "."}} {
-    if {[regexp {(?x)([^:]+)://(.+)} $url match protocol string] == 1} {
-        switch -regexp -- ${protocol} {
-            {^file$} {
-                return [file normalize $string]
-            }
-            {^mports$} {
-                return [macports::index::fetch_port $url $destdir]
-            }
-            {^https?$|^ftp$} {
-                return [macports::fetch_port $url]
-            }
-            default {
-                return -code error "Unsupported protocol $protocol"
-            }
+    set protocol [macports::getprotocol $url]
+    switch ${protocol} {
+        file {
+            return [file normalize [string range $url [expr [string length $protocol] + 3] end]]
         }
-    } else {
-        return -code error "Can't parse url $url"
+        mports {
+            return [macports::index::fetch_port $url $destdir]
+        }
+        https -
+        http -
+        ftp {
+            return [macports::fetch_port $url]
+        }
+        default {
+            return -code error "Unsupported protocol $protocol"
+        }
     }
 }
 
@@ -964,6 +1148,9 @@
         file {
             set proposedpath [file normalize [file join [getportdir $url] .. ..]]
         }
+        default {
+            set proposedpath [getsourcepath $url]
+        }
     }
 
     # append requested path
@@ -997,6 +1184,38 @@
     return $proposedpath
 }
 
+
+# mport_filtervariants
+# returns the given list of variants with implicitly-set ones removed
+proc mport_filtervariants {variations {warn yes}} {
+    # Iterate through the variants, filtering out
+    # implicit ones. At the moment, the only implicit variants are
+    # platform variants.
+    set filteredvariations {}
+
+    foreach {variation value} $variations {
+        switch -regexp $variation {
+            ^(pure)?darwin         -
+            ^(free|net|open){1}bsd -
+            ^i386                  -
+            ^linux                 -
+            ^macosx                -
+            ^powerpc               -
+            ^solaris               -
+            ^sunos {
+                if {$warn} {
+                    ui_warn "Implicit variants should not be explicitly set or unset. $variation will be ignored."
+                }
+            }
+            default {
+                lappend filteredvariations $variation $value
+            }
+        }
+    }
+    return $filteredvariations
+}
+
+
 # mportopen
 # Opens a MacPorts portfile specified by a URL.  The Portfile is
 # opened with the given list of options and variations.  The result
@@ -1027,6 +1246,9 @@
     } else {
         set portdir ""
     }
+    if {![info exists options_array(ports_requested)]} {
+        lappend options ports_requested 0
+    }
 
     set portpath [macports::getportdir $porturl $portdir]
     ui_debug "Changing to port directory: $portpath"
@@ -1035,29 +1257,6 @@
         return -code error "Could not find Portfile in $portpath"
     }
 
-    # Iterate through the explicitly set/unset variants, filtering out
-    # implicit variants. At the moment, the only implicit variants are
-    # platform variants.
-    set filteredvariations {}
-
-    foreach {variation value} $variations {
-        switch -regexp $variation {
-            ^(pure)?darwin         -
-            ^(free|net|open){1}bsd -
-            ^i386                  -
-            ^linux                 -
-            ^macosx                -
-            ^powerpc               -
-            ^solaris               -
-            ^sunos {
-                ui_debug "Implicit variants should not be explicitly set or unset. $variation will be ignored."
-            }
-            default {
-                lappend filteredvariations $variation $value
-            }
-        }
-    }
-
     set workername [interp create]
 
     set mport [ditem_create]
@@ -1066,18 +1265,16 @@
     ditem_key $mport portpath $portpath
     ditem_key $mport workername $workername
     ditem_key $mport options $options
-    ditem_key $mport variations $filteredvariations
+    ditem_key $mport variations $variations
     ditem_key $mport refcnt 1
 
-    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $filteredvariations
+    macports::worker_init $workername $portpath $porturl [macports::getportbuildpath $portpath] $options $variations
 
     $workername eval source Portfile
 
-    # add the default universal variant, but only if
-    # it will work and another one isn't already present
-    if {[$workername eval default_universal_variant_allowed]} {
-        $workername eval add_default_universal_variant
-    }
+    # add the default universal variant if appropriate, and set up flags that
+    # are conditional on whether universal is set
+    $workername eval universal_setup
 
     # evaluate the variants
     if {[$workername eval eval_variants variations] != 0} {
@@ -1090,6 +1287,51 @@
     return $mport
 }
 
+# mportopen_installed
+# opens a portfile stored in the registry
+proc mportopen_installed {name version revision variants options} {
+    global macports::registry.format macports::registry.path
+    if {${registry.format} != "receipt_sqlite"} {
+        return -code error "mportopen_installed requires sqlite registry"
+    }
+    set regref [lindex [registry::entry imaged $name $version $revision $variants] 0]
+    set portfile_dir [file join ${registry.path} registry portfiles $name "${version}_${revision}${variants}"]
+    file mkdir $portfile_dir
+    set fd [open "${portfile_dir}/Portfile" w]
+    puts $fd [$regref portfile]
+    close $fd
+    file mtime "${portfile_dir}/Portfile" [$regref date]
+
+    set variations {}
+    set minusvariant [lrange [split [$regref negated_variants] -] 1 end]
+    set plusvariant [lrange [split [$regref variants] +] 1 end]
+    foreach v $plusvariant {
+        lappend variations $v "+"
+    }
+    foreach v $minusvariant {
+        lappend variations $v "-"
+    }
+    set variations [mport_filtervariants $variations no]
+    
+    return [mportopen "file://${portfile_dir}/" $options $variations]
+}
+
+# mportclose_installed
+# close mport opened with mportopen_installed and clean up associated files
+proc mportclose_installed {mport} {
+    global macports::registry.path
+    foreach key {name version revision portvariants} {
+        set $key [_mportkey $mport $key]
+    }
+    mportclose $mport
+    set portfiles_dir [file join ${registry.path} registry portfiles $name]
+    set portfile [file join $portfiles_dir "${version}_${revision}${portvariants}" Portfile]
+    file delete -force $portfile [file dirname $portfile]
+    if {[llength [glob -nocomplain -directory $portfiles_dir *]] == 0} {
+        file delete -force $portfiles_dir
+    }
+}
+
 # Traverse a directory with ports, calling a function on the path of ports
 # (at the second depth).
 # I.e. the structure of dir shall be:
@@ -1139,7 +1381,7 @@
 # search_path -> directories to search
 # executable -> whether we want to check that the file is executable by current
 #               user or not.
-proc _mportsearchpath {depregex search_path {executable 0}} {
+proc _mportsearchpath {depregex search_path {executable 0} {return_match 0}} {
     set found 0
     foreach path $search_path {
         if {![file isdirectory $path]} {
@@ -1148,7 +1390,6 @@
 
         if {[catch {set filelist [readdir $path]} result]} {
             return -code error "$result ($path)"
-            set filelist ""
         }
 
         foreach filename $filelist {
@@ -1160,99 +1401,18 @@
             }
         }
     }
-    return $found
-}
-
-### _libtest is private; subject to change without notice
-# XXX - Architecture specific
-# XXX - Rely on information from internal defines in cctools/dyld:
-# define DEFAULT_FALLBACK_FRAMEWORK_PATH
-# /Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks
-# define DEFAULT_FALLBACK_LIBRARY_PATH /lib:/usr/local/lib:/lib:/usr/lib
-#   -- Since /usr/local is bad, using /lib:/usr/lib only.
-# Environment variables DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH,
-# DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
-
-proc _libtest {mport depspec} {
-    global env tcl_platform
-    set depline [lindex [split $depspec :] 1]
-    set prefix [_mportkey $mport prefix]
-    set frameworks_dir [_mportkey $mport frameworks_dir]
-
-    if {[info exists env(DYLD_FRAMEWORK_PATH)]} {
-        lappend search_path $env(DYLD_FRAMEWORK_PATH)
+    if {$return_match} {
+        if {$found} {
+            return [file join $path $filename]
+        } else {
+            return ""
+        }
     } else {
-        lappend search_path ${frameworks_dir} /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
+        return $found
     }
-    if {[info exists env(DYLD_FALLBACK_FRAMEWORK_PATH)]} {
-        lappend search_path $env(DYLD_FALLBACK_FRAMEWORK_PATH)
-    }
-    if {[info exists env(DYLD_LIBRARY_PATH)]} {
-        lappend search_path $env(DYLD_LIBRARY_PATH)
-    }
-    lappend search_path /lib /usr/lib ${prefix}/lib
-    if {[info exists env(DYLD_FALLBACK_LIBRARY_PATH)]} {
-        lappend search_path $env(DYLD_FALLBACK_LIBRARY_PATH)
-    }
-
-    set i [string first . $depline]
-    if {$i < 0} {set i [string length $depline]}
-    set depname [string range $depline 0 [expr $i - 1]]
-    set depversion [string range $depline $i end]
-    regsub {\.} $depversion {\.} depversion
-    if {$tcl_platform(os) == "Darwin"} {
-        set depregex \^${depname}${depversion}\\.dylib\$
-    } else {
-        set depregex \^${depname}\\.so${depversion}\$
-    }
-
-    return [_mportsearchpath $depregex $search_path]
 }
 
-### _bintest is private; subject to change without notice
 
-proc _bintest {mport depspec} {
-    global env
-    set depregex [lindex [split $depspec :] 1]
-    set prefix [_mportkey $mport prefix]
-
-    set search_path [split $env(PATH) :]
-
-    set depregex \^$depregex\$
-
-    return [_mportsearchpath $depregex $search_path 1]
-}
-
-### _pathtest is private; subject to change without notice
-
-proc _pathtest {mport depspec} {
-    global env
-    set depregex [lindex [split $depspec :] 1]
-    set prefix [_mportkey $mport prefix]
-
-    # separate directory from regex
-    set fullname $depregex
-
-    regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
-
-    if {[string index $search_path 0] != "/"} {
-        # Prepend prefix if not an absolute path
-        set search_path "${prefix}/${search_path}"
-    }
-
-    set depregex \^$depregex\$
-
-    return [_mportsearchpath $depregex $search_path]
-}
-
-### _porttest is private; subject to change without notice
-
-proc _porttest {mport depspec} {
-    # We don't actually look for the port, but just return false
-    # in order to let the mportdepends handle the dependency
-    return 0
-}
-
 ### _mportinstalled is private; may change without notice
 
 # Determine if a port is already *installed*, as in "in the registry".
@@ -1303,12 +1463,13 @@
     } else {
         # The receipt test failed, use one of the depspec regex mechanisms
         ui_debug "Didn't find receipt, going to depspec regex for: $portname"
+        set workername [ditem_key $mport workername]
         set type [lindex [split $depspec :] 0]
         switch $type {
-            lib { return [_libtest $mport $depspec] }
-            bin { return [_bintest $mport $depspec] }
-            path { return [_pathtest $mport $depspec] }
-            port { return [_porttest $mport $depspec] }
+            lib { return [$workername eval _libtest $depspec] }
+            bin { return [$workername eval _bintest $depspec] }
+            path { return [$workername eval _pathtest $depspec] }
+            port { return 0 }
             default {return -code error "unknown depspec type: $type"}
         }
         return 0
@@ -1342,9 +1503,11 @@
 ### _mportexec is private; may change without notice
 
 proc _mportexec {target mport} {
+    set portname [_mportkey $mport name]
+    macports::push_log $mport
     # xxx: set the work path?
     set workername [ditem_key $mport workername]
-    if {![catch {$workername eval check_variants variations $target} result] && $result == 0 &&
+    if {![catch {$workername eval check_variants $target} result] && $result == 0 &&
         ![catch {$workername eval eval_targets $target} result] && $result == 0} {
         # If auto-clean mode, clean-up after dependency install
         if {[string equal ${macports::portautoclean} "yes"]} {
@@ -1357,9 +1520,15 @@
             catch {cd $portpath}
             $workername eval eval_targets clean
         }
+        macports::pop_log
         return 0
     } else {
         # An error occurred.
+        global ::debuglogname
+        if {[info exists ::debuglogname]} {
+            ui_msg "Log for $portname is at: $::debuglogname"
+        }
+        macports::pop_log
         return 1
     }
 }
@@ -1372,9 +1541,13 @@
     set workername [ditem_key $mport workername]
 
     # check variants
-    if {[$workername eval check_variants variations $target] != 0} {
+    if {[$workername eval check_variants $target] != 0} {
         return 1
     }
+    set portname [_mportkey $mport name]
+    if {$target != "clean"} {
+        macports::push_log $mport
+    }
 
     # Before we build the port, we must build its dependencies.
     # XXX: need a more general way of comparing against targets
@@ -1390,6 +1563,11 @@
         || $target == "rpm" || $target == "dpkg"
         || $target == "srpm"|| $target == "portpkg" } {
 
+        # upgrade dependencies that are already installed
+        if {![macports::global_option_isset ports_nodeps]} {
+            macports::_upgrade_mport_deps $mport $target
+        }
+
         ui_msg -nonewline "--->  Computing dependencies for [_mportkey $mport name]"
         if {[macports::ui_isset ports_debug]} {
             # play nice with debug messages
@@ -1398,7 +1576,9 @@
         if {[mportdepends $mport $target] != 0} {
             return 1
         }
-        ui_msg ""
+        if {![macports::ui_isset ports_debug]} {
+            ui_msg ""
+        }
 
         # Select out the dependents along the critical path,
         # but exclude this mport, we might not be installing it.
@@ -1430,18 +1610,17 @@
         }
     }
 
-    # If we're doing an install, check if we should clean after
     set clean 0
-    if {[string equal ${macports::portautoclean} "yes"] && [string equal $target "install"] } {
+    if {[string equal $target "install"] && [string equal ${macports::registry.installtype} "image"]} {
+        # If we're doing image installs, then we should activate after install
+        # xxx: This isn't pretty
+        set target activate
+    }
+    if {[string equal ${macports::portautoclean} "yes"] && ([string equal $target "install"] || [string equal $target "activate"])} {
+        # If we're doing an install, check if we should clean after
         set clean 1
     }
 
-    # If we're doing image installs, then we should activate after install
-    # xxx: This isn't pretty
-    if { [string equal ${macports::registry.installtype} "image"] && [string equal $target "install"] } {
-        set target activate
-    }
-
     # Build this port with the specified target
     set result [$workername eval eval_targets $target]
 
@@ -1452,10 +1631,120 @@
         catch {cd $portpath}
         $workername eval eval_targets clean
     }
+    
+    global ::debuglogname
+    if {[info exists ::debuglogname]} {
+        if {$result != 0 && ![macports::ui_isset ports_quiet]} {
+            ui_msg "Log for $portname is at: $::debuglogname"
+        }
+        macports::pop_log
+    }
 
     return $result
 }
 
+# upgrade any dependencies of mport that are installed and needed for target
+proc macports::_upgrade_mport_deps {mport target} {
+    set options [ditem_key $mport options]
+    set workername [ditem_key $mport workername]
+    set deptypes [macports::_deptypes_for_target $target]
+    array set portinfo [mportinfo $mport]
+    set depends {}
+    array set depscache {}
+
+    set required_archs [$workername eval get_canonical_archs]
+
+    foreach deptype $deptypes {
+        # Add to the list of dependencies if the option exists and isn't empty.
+        if {[info exists portinfo($deptype)] && $portinfo($deptype) != ""} {
+            set depends [concat $depends $portinfo($deptype)]
+        }
+    }
+    
+    if {[string equal ${macports::registry.installtype} "image"]} {
+        set test _portnameactive
+    } else {
+        set test registry::entry_exists_for_name
+    }
+
+    foreach depspec $depends {
+        set dep_portname [$workername eval _get_dep_port $depspec]
+        if {$dep_portname != "" && ![info exists depscache(port:$dep_portname)] && [$test $dep_portname]} {
+            set variants {}
+
+            # check that the dep has the required archs
+            set active_archs [_get_registry_archs $dep_portname]
+            if {$active_archs != "" && $active_archs != "noarch" && $required_archs != "noarch"} {
+                set missing {}
+                foreach arch $required_archs {
+                    if {[lsearch -exact $active_archs $arch] == -1} {
+                        lappend missing $arch
+                    }
+                }
+                if {[llength $missing] > 0} {
+                    set res [mportlookup $dep_portname]
+                    array unset dep_portinfo
+                    array set dep_portinfo [lindex $res 1]
+                    if {[info exists dep_portinfo(variants)] && [lsearch $dep_portinfo(variants) universal] != -1} {
+                        # dep offers a universal variant
+                        if {[llength $active_archs] == 1} {
+                            # not installed universal
+                            set missing {}
+                            foreach arch $required_archs {
+                                if {[lsearch -exact $macports::universal_archs $arch] == -1} {
+                                    lappend missing $arch
+                                }
+                            }
+                            if {[llength $missing] > 0} {
+                                ui_error "Cannot install [_mportkey $mport name] for the arch(s) '$required_archs' because"
+                                ui_error "its dependency $dep_portname is only installed for the arch '$active_archs'"
+                                ui_error "and the configured universal_archs '$macports::universal_archs' are not sufficient."
+                                return -code error "architecture mismatch"
+                            } else {
+                                # upgrade the dep with +universal
+                                lappend variants universal +
+                                lappend options ports_upgrade_enforce-variants yes
+                            }
+                        } else {
+                            # already universal
+                            ui_error "Cannot install [_mportkey $mport name] for the arch(s) '$required_archs' because"
+                            ui_error "its dependency $dep_portname is only installed for the archs '$active_archs'."
+                            return -code error "architecture mismatch"
+                        }
+                    } else {
+                        ui_error "Cannot install [_mportkey $mport name] for the arch(s) '$required_archs' because"
+                        ui_error "its dependency $dep_portname is only installed for the arch '$active_archs'"
+                        ui_error "and does not have a universal variant."
+                        return -code error "architecture mismatch"
+                    }
+                }
+            }
+
+            set status [macports::upgrade $dep_portname "port:$dep_portname" $variants $options depscache]
+            # status 2 means the port was not found in the index
+            if {$status != 0 && $status != 2 && ![macports::ui_isset ports_processall]} {
+                return -code error "upgrade $dep_portname failed"
+            }
+        }
+    }
+}
+
+# get the archs with which the active version of portname is installed
+proc macports::_get_registry_archs {portname} {
+    if {[string equal ${macports::registry.installtype} "image"]} {
+        set ilist [registry::active $portname]
+    } else {
+        set ilist [registry::installed $portname]
+    }
+    set i [lindex $ilist 0]
+    set regref [registry::open_entry [lindex $i 0] [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+    set archs [registry::property_retrieve $regref archs]
+    if {$archs == 0} {
+        set archs ""
+    }
+    return $archs
+}
+
 proc macports::getsourcepath {url} {
     global macports::portdbpath
 
@@ -1496,6 +1785,13 @@
     return [file join $portdbpath build $port_path]
 }
 
+proc macports::getportlogpath {id} {
+    global macports::portdbpath
+    regsub {://} $id {.} port_path
+    regsub -all {/} $port_path {_} port_path
+    return [file join $portdbpath logs $port_path]
+}
+
 proc macports::getportworkpath_from_buildpath {portbuildpath} {
     return [file join $portbuildpath work]
 }
@@ -1538,14 +1834,18 @@
                     ui_debug $svn_commandline
                     if {
                         [catch {
-                            set euid [geteuid]
-                            set egid [getegid]
-                            ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
-                            setegid [name_to_gid [file attributes $portdir -group]]
-                            seteuid [name_to_uid [file attributes $portdir -owner]]
+                            if {[getuid] == 0} {
+                                set euid [geteuid]
+                                set egid [getegid]
+                                ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
+                                setegid [name_to_gid [file attributes $portdir -group]]
+                                seteuid [name_to_uid [file attributes $portdir -owner]]
+                            }
                             system $svn_commandline
-                            seteuid $euid
-                            setegid $egid
+                            if {[getuid] == 0} {
+                                seteuid $euid
+                                setegid $egid
+                            }
                         }]
                     } {
                         ui_debug "$::errorInfo"
@@ -1621,7 +1921,8 @@
                         }
                     }
 
-                    if { [catch { system "cd $destdir/.. && tar ${verboseflag} ${extflag} -xf $filename" } error] } {
+                    set tar [macports::findBinary tar $macports::autoconf::tar_path]
+                    if { [catch { system "cd $destdir/.. && $tar ${verboseflag} ${extflag} -xf $filename" } error] } {
                         ui_error "Extracting $source failed ($error)"
                         incr numfailed
                         continue
@@ -1636,7 +1937,8 @@
                     # sync just a PortIndex file
                     set indexfile [macports::getindex $source]
                     file mkdir [file dirname $indexfile]
-                    curl $source/PortIndex $indexfile
+                    curl fetch ${source}/PortIndex $indexfile
+                    curl fetch ${source}/PortIndex.quick ${indexfile}.quick
                 }
             }
             default {
@@ -1657,11 +1959,10 @@
 
     set found 0
     foreach source $sources {
-        set flags [lrange $source 1 end]
         set source [lindex $source 0]
-        if {[macports::getprotocol $source] == "mports"} {
-            array set attrs [list name $pattern]
-            set res [macports::index::search $macports::portdbpath $source [array get attrs]]
+        set protocol [macports::getprotocol $source]
+        if {$protocol == "mports"} {
+            set res [macports::index::search $macports::portdbpath $source [list name $pattern]]
             eval lappend matches $res
         } else {
             if {[catch {set fd [open [macports::getindex $source] r]} result]} {
@@ -1700,12 +2001,14 @@
                             if {$easy} {
                                 array set portinfo $line
                             }
-                            switch -regexp -- [macports::getprotocol ${source}] {
-                                {^rsync$} {
+                            switch $protocol {
+                                rsync {
                                     # Rsync files are local
                                     set source_url "file://[macports::getsourcepath $source]"
                                 }
-                                {^https?$|^ftp$} {
+                                https -
+                                http -
+                                ftp {
                                     if {[_source_is_snapshot $source filename extension]} {
                                         # daily snapshot tarball
                                         set source_url "file://[macports::getsourcepath $source]"
@@ -1734,7 +2037,7 @@
                         }
                     }
                 } catch {*} {
-                    ui_warn "It looks like your PortIndex file may be corrupt."
+                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
                     throw
                 } finally {
                     close $fd
@@ -1761,7 +2064,8 @@
     set matches [list]
     foreach source $sources {
         set source [lindex $source 0]
-        if {[macports::getprotocol $source] != "mports"} {
+        set protocol [macports::getprotocol $source]
+        if {$protocol != "mports"} {
             global macports::quick_index
             if {![info exists quick_index($sourceno,[string tolower $name])]} {
                 incr sourceno 1
@@ -1784,17 +2088,16 @@
 
                     array set portinfo $line
 
-                    switch -regexp -- [macports::getprotocol ${source}] {
-                        {^rsync$} {
-                            # Rsync files are local
+                    switch $protocol {
+                        rsync {
                             set source_url "file://[macports::getsourcepath $source]"
                         }
-                        {^https?$|^ftp$} {
+                        https -
+                        http -
+                        ftp {
                             if {[_source_is_snapshot $source filename extension]} {
-                                # daily snapshot tarball
                                 set source_url "file://[macports::getsourcepath $source]"
                              } else {
-                                # default action
                                 set source_url $source
                              }
                         }
@@ -1809,24 +2112,24 @@
                     }
                     if {[info exists porturl]} {
                         lappend line porturl $porturl
-                        ui_debug "Found port in $porturl"
-                    } else {
-                        ui_debug "Found port info: $line"
                     }
                     lappend matches $name
                     lappend matches $line
                     close $fd
-                    break
+                    set fd -1
                 } catch {*} {
-                    ui_warn "It looks like your PortIndex file may be corrupt."
-                    throw
+                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
                 } finally {
-                    catch {close $fd}
+                    if {$fd != -1} {
+                        close $fd
+                    }
                 }
+                if {[llength $matches] > 0} {
+                    break
+                }
             }
         } else {
-            array set attrs [list name $name]
-            set res [macports::index::search $macports::portdbpath $source [array get attrs]]
+            set res [macports::index::search $macports::portdbpath $source [list name $name]]
             if {[llength $res] > 0} {
                 eval lappend matches $res
                 break
@@ -1837,6 +2140,76 @@
     return $matches
 }
 
+# Returns all ports in the indices. Faster than 'mportsearch .*'
+proc mportlistall {args} {
+    global macports::portdbpath macports::sources
+    set matches [list]
+
+    set found 0
+    foreach source $sources {
+        set source [lindex $source 0]
+        set protocol [macports::getprotocol $source]
+        if {$protocol != "mports"} {
+            if {![catch {set fd [open [macports::getindex $source] r]} result]} {
+                try {
+                    incr found 1
+                    while {[gets $fd line] >= 0} {
+                        array unset portinfo
+                        set name [lindex $line 0]
+                        set len [lindex $line 1]
+                        set line [read $fd $len]
+
+                        array set portinfo $line
+
+                        switch $protocol {
+                            rsync {
+                                set source_url "file://[macports::getsourcepath $source]"
+                            }
+                            https -
+                            http -
+                            ftp {
+                                if {[_source_is_snapshot $source filename extension]} {
+                                    set source_url "file://[macports::getsourcepath $source]"
+                                } else {
+                                    set source_url $source
+                                }
+                            }
+                            default {
+                                set source_url $source
+                            }
+                        }
+                        if {[info exists portinfo(portdir)]} {
+                            set porturl ${source_url}/$portinfo(portdir)
+                        } elseif {[info exists portinfo(portarchive)]} {
+                            set porturl ${source_url}/$portinfo(portarchive)
+                        }
+                        if {[info exists porturl]} {
+                            lappend line porturl $porturl
+                        }
+                        lappend matches $name $line
+                    }
+                } catch {*} {
+                    ui_warn "It looks like your PortIndex file for $source may be corrupt."
+                    throw
+                } finally {
+                    close $fd
+                }
+            } else {
+                ui_warn "Can't open index file for source: $source"
+            }
+        } else {
+            set res [macports::index::search $macports::portdbpath $source [list name .*]]
+            eval lappend matches $res
+        }
+    }
+    if {!$found} {
+        return -code error "No index(es) found! Have you synced your source indexes?"
+    }
+
+    return $matches
+}
+
+
 # Loads PortIndex.quick from each source into the quick_index, generating
 # it first if necessary.
 proc _mports_load_quickindex {args} {
@@ -1851,8 +2224,8 @@
         if {![file exists ${index}]} {
             continue
         }
-        if {![file exists ${index}.quick] || [file mtime ${index}] > [file mtime ${index}.quick]} {
-            # stale or nonexistent quick index file, so generate a new one
+        if {![file exists ${index}.quick]} {
+            ui_warn "No quick index file found, attempting to generate one for source: $source"
             if {[catch {set quicklist [mports_generate_quickindex ${index}]}]} {
                 continue
             }
@@ -1898,7 +2271,7 @@
             }
             puts -nonewline $quickfd $quicklist
         } catch {*} {
-            ui_warn "It looks like your PortIndex file may be corrupt."
+            ui_warn "It looks like your PortIndex file $index may be corrupt."
             throw
         } finally {
             close $indexfd
@@ -1981,30 +2354,8 @@
         }
     }
 
-    # Determine deptypes to look for based on target
-    switch $target {
-        fetch       -
-        checksum    { set deptypes "depends_fetch" }
-        extract     -
-        patch       { set deptypes "depends_fetch depends_extract" }
-        configure   -
-        build       { set deptypes "depends_fetch depends_extract depends_lib depends_build" }
+    set deptypes [macports::_deptypes_for_target $target]
 
-        test        -
-        destroot    -
-        install     -
-        archive     -
-        dmg         -
-        pkg         -
-        portpkg     -
-        mdmg        -
-        mpkg        -
-        rpm         -
-        srpm        -
-        dpkg        -
-        ""          { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
-    }
-
     # Gather the dependencies for deptypes
     foreach deptype $deptypes {
         # Add to the list of dependencies if the option exists and isn't empty.
@@ -2014,8 +2365,11 @@
     }
 
     set subPorts {}
-    set options [ditem_key $mport options]
-    set variations [ditem_key $mport variations]
+    if {[llength $depends] > 0} {
+        set options [ditem_key $mport options]
+        set variations [ditem_key $mport variations]
+        set required_archs [[ditem_key $mport workername] eval get_canonical_archs]
+    }
 
     foreach depspec $depends {
         # Is that dependency satisfied or this port installed?
@@ -2035,6 +2389,9 @@
             array unset portinfo
             array set portinfo [lindex $res 1]
             if {![info exists portinfo(porturl)]} {
+                if {![macports::ui_isset ports_debug]} {
+                    ui_msg ""
+                }
                 ui_error "Dependency '$dep_portname' not found."
                 return 1
             }
@@ -2046,6 +2403,33 @@
             if {$subport == {}} {
                 # We haven't opened this one yet.
                 set subport [mportopen $portinfo(porturl) $options $variations]
+
+                # check archs
+                if {![macports::_mport_supports_archs $subport $required_archs]} {
+                    set supported_archs [_mportkey $subport supported_archs]
+                    mportclose $subport
+                    set arch_mismatch 1
+                    set has_universal 0
+                    if {[info exists portinfo(variants)] && [lsearch -exact $portinfo(variants) universal] != -1} {
+                        # a universal variant is offered
+                        set has_universal 1
+                        array unset variation_array
+                        array set variation_array $variations
+                        if {![info exists variation_array(universal)] || $variation_array(universal) != "+"} {
+                            set variation_array(universal) +
+                            # try again with +universal
+                            set subport [mportopen $portinfo(porturl) $options [array get variation_array]]
+                            if {[macports::_mport_supports_archs $subport $required_archs]} {
+                                set arch_mismatch 0
+                            }
+                        }
+                    }
+                    if {$arch_mismatch} {
+                        macports::_explain_arch_mismatch [_mportkey $mport name] $dep_portname $required_archs $supported_archs $has_universal
+                        return -code error "architecture mismatch"
+                    }
+                }
+                
                 if {$recurseDeps} {
                     # Add to the list we need to recurse on.
                     lappend subPorts $subport
@@ -2071,11 +2455,92 @@
     return 0
 }
 
+# check if the given mport can support dependents with the given archs
+proc macports::_mport_supports_archs {mport required_archs} {
+    if {$required_archs == "noarch"} {
+        return 1
+    }
+    set workername [ditem_key $mport workername]
+    set provided_archs [$workername eval get_canonical_archs]
+    if {$provided_archs == "noarch"} {
+        return 1
+    }
+    foreach arch $required_archs {
+        if {[lsearch -exact $provided_archs $arch] == -1} {
+            return 0
+        }
+    }
+    return 1
+}
+
+# print an error message explaining why a port's archs are not provided by a dependency
+proc macports::_explain_arch_mismatch {port dep required_archs supported_archs has_universal} {
+    global macports::universal_archs
+    if {![macports::ui_isset ports_debug]} {
+        ui_msg ""
+    }
+    ui_error "Cannot install $port for the arch(s) '$required_archs' because"
+    if {$supported_archs != ""} {
+        foreach arch $required_archs {
+            if {[lsearch -exact $supported_archs $arch] == -1} {
+                ui_error "its dependency $dep only supports the arch(s) '$supported_archs'."
+                return
+            }
+        }
+    }
+    if {$has_universal} {
+        foreach arch $required_archs {
+            if {[lsearch -exact $universal_archs $arch] == -1} {
+                ui_error "its dependency $dep does not build for the required arch(s) by default"
+                ui_error "and the configured universal_archs '$universal_archs' are not sufficient."
+                return
+            }
+        }
+        ui_error "its dependency $dep cannot build for the required arch(s)."
+        return
+    }
+    ui_error "its dependency $dep does not build for the required arch(s) by default"
+    ui_error "and does not have a universal variant."
+}
+
+# Determine dependency types required for target
+proc macports::_deptypes_for_target {target} {
+    switch $target {
+        fetch       -
+        checksum    { set deptypes "depends_fetch" }
+        extract     -
+        patch       { set deptypes "depends_fetch depends_extract" }
+        configure   -
+        build       { set deptypes "depends_fetch depends_extract depends_lib depends_build" }
+
+        test        -
+        destroot    -
+        install     -
+        archive     -
+        dmg         -
+        pkg         -
+        portpkg     -
+        mdmg        -
+        mpkg        -
+        rpm         -
+        srpm        -
+        dpkg        -
+        ""          { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
+    }
+    return $deptypes
+}
+
 # selfupdate procedure
-proc macports::selfupdate {{optionslist {}}} {
+proc macports::selfupdate {{optionslist {}} {updatestatusvar ""}} {
     global macports::prefix macports::portdbpath macports::libpath macports::rsync_server macports::rsync_dir macports::rsync_options
-    global macports::autoconf::macports_version macports::autoconf::rsync_path
+    global macports::autoconf::macports_version macports::autoconf::rsync_path tcl_platform
     array set options $optionslist
+    
+    # variable that indicates whether we actually updated base
+    if {$updatestatusvar != ""} {
+        upvar $updatestatusvar updatestatus
+        set updatestatus no
+    }
 
     # syncing ports tree.
     if {![info exists options(ports_selfupdate_nosync)] || $options(ports_selfupdate_nosync) != "yes"} {
@@ -2134,12 +2599,12 @@
             set owner [file attributes ${prefix} -owner]
             set group [file attributes ${prefix} -group]
             set perms [string range [file attributes ${prefix} -permissions] end-3 end]
-            if {![string equal $tcl_platform(user) $owner]} {
+            if {$tcl_platform(user) != "root" && ![string equal $tcl_platform(user) $owner]} {
                 return -code error "User $tcl_platform(user) does not own ${prefix} - try using sudo"
             }
             ui_debug "Permissions OK"
 
-            # where to install our macports1.0 tcl package
+            # where to install a link to our macports1.0 tcl package
             set mp_tclpackage_path [file join $portdbpath .tclpackage]
             if { [file exists $mp_tclpackage_path]} {
                 set fd [open $mp_tclpackage_path r]
@@ -2163,6 +2628,9 @@
             if { [catch { system "cd $mp_source_path && ./configure $configure_args && make && make install" } result] } {
                 return -code error "Error installing new MacPorts base: $result"
             }
+            if {[info exists updatestatus]} {
+                set updatestatus yes
+            }
         }
     } elseif {$comp < 0} {
         ui_msg "--->  MacPorts base is probably trunk or a release candidate"
@@ -2185,10 +2653,42 @@
     return 0
 }
 
-# upgrade procedure
-proc macports::upgrade {portname dspec globalvarlist variationslist optionslist {depscachename ""}} {
+# upgrade API wrapper procedure
+# return codes: 0 = success, 1 = general failure, 2 = port name not found in index
+proc macports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {
+    # only installed ports can be upgraded
+    if {![registry::entry_exists_for_name $portname]} {
+        ui_error "$portname is not installed"
+        return 1
+    }
+    if {![string match "" $depscachename]} {
+        upvar $depscachename depscache
+    } else {
+        array set depscache {}
+    }
+    # stop upgrade from being called via mportexec as well
+    set orig_nodeps yes
+    if {![info exists macports::global_options(ports_nodeps)]} {
+        set macports::global_options(ports_nodeps) yes
+        set orig_nodeps no
+    }
+    # filter out implicit variants from the explicitly set/unset variants.
+    set variationslist [mport_filtervariants $variationslist yes]
+    
+    # run the actual upgrade
+    set status [macports::_upgrade $portname $dspec $variationslist $optionslist depscache]
+    
+    if {!$orig_nodeps} {
+        unset -nocomplain macports::global_options(ports_nodeps)
+    }
+    return $status
+}
+
+# main internal upgrade procedure
+proc macports::_upgrade {portname dspec variationslist optionslist {depscachename ""}} {
     global macports::registry.installtype
     global macports::portarchivemode
+    global macports::global_variations
     array set options $optionslist
 
     # Note $variationslist is left alone and so retains the original
@@ -2196,6 +2696,8 @@
     # upgrade; while variations gets existing variants and global variations
     # merged in later on, so it applies only to this port's upgrade
     array set variations $variationslist
+    
+    set globalvarlist [array get macports::global_variations]
 
     if {![string match "" $depscachename]} {
         upvar $depscachename depscache
@@ -2216,8 +2718,8 @@
     }
     # argh! port doesnt exist!
     if {$result == ""} {
-        ui_error "No port $portname found."
-        return 1
+        ui_warn "No port $portname found in the index."
+        return 2
     }
     # fill array with information
     array set portinfo [lindex $result 1]
@@ -2266,7 +2768,11 @@
                 array set portinfo [mportinfo $workername]
                 
                 # upgrade its dependencies first
-                _upgrade_dependencies portinfo depscache globalvarlist variationslist options
+                set status [_upgrade_dependencies portinfo depscache variationslist options yes]
+                if {$status != 0 && ![ui_isset ports_processall]} {
+                    catch {mportclose $workername}
+                    return $status
+                }
                 # now install it
                 if {[catch {set result [mportexec $workername install]} result]} {
                     global errorInfo
@@ -2294,7 +2800,7 @@
             return 0
         } else {
             ui_error "Checking installed version failed: $result"
-            exit 1
+            return 1
         }
     } else {
         # we'll now take care of upgrading it, so we can add it to the cache
@@ -2329,6 +2835,7 @@
             set version_active $version
             set revision_active $revision
             set variant_active $variant
+            set epoch_active $epoch
         }
     }
 
@@ -2338,42 +2845,47 @@
     ui_debug "$portname ${version_installed}_${revision_installed} $variant_installed is the latest installed"
     if {$anyactive} {
         ui_debug "$portname ${version_active}_${revision_active} $variant_active is active"
+        # save existing variant for later use
+        set oldvariant $variant_active
+        set regref [registry::open_entry $portname $version_active $revision_active $variant_active $epoch_active]
     } else {
         ui_debug "no version of $portname is active"
-    }
-
-    # save existing variant for later use
-    if {$anyactive} {
-        set oldvariant $variant_active
-    } else {
         set oldvariant $variant_installed
+        set regref [registry::open_entry $portname $version_installed $revision_installed $variant_installed $epoch_installed]
     }
+    set oldnegatedvariant [registry::property_retrieve $regref negated_variants]
+    if {$oldnegatedvariant == 0} {
+        set oldnegatedvariant {}
+    }
+    set requestedflag [registry::property_retrieve $regref requested]
+    set os_platform_installed [registry::property_retrieve $regref os_platform]
+    set os_major_installed [registry::property_retrieve $regref os_major]
 
     # Before we do
     # dependencies, we need to figure out the final variants,
     # open the port, and update the portinfo.
-
     set porturl $portinfo(porturl)
     if {![info exists porturl]} {
         set porturl file://./
     }
 
-    # check if the variants is present in $version_in_tree
-    set variant [split $oldvariant +]
-    ui_debug "Merging existing variants $variant into variants"
-    if {[info exists portinfo(variants)]} {
-        set avariants $portinfo(variants)
-    } else {
-        set avariants {}
+    set minusvariant [lrange [split $oldnegatedvariant -] 1 end]
+    set plusvariant [lrange [split $oldvariant +] 1 end]
+    ui_debug "Merging existing variants '${oldvariant}${oldnegatedvariant}' into variants"
+    set oldvariantlist [list]
+    foreach v $plusvariant {
+        lappend oldvariantlist $v "+"
     }
-    ui_debug "available variants are : $avariants"
-    foreach v $variant {
-        if {[lsearch $avariants $v] == -1} {
-        } else {
-            ui_debug "variant $v is present in $portname $version_in_tree"
-            if { ![info exists variations($v)]} {
-                set variations($v) "+"
-            }
+    foreach v $minusvariant {
+        lappend oldvariantlist $v "-"
+    }
+    # remove implicit variants, without printing warnings
+    set oldvariantlist [mport_filtervariants $oldvariantlist no]
+
+    # merge in the old variants
+    foreach {variation value} $oldvariantlist {
+        if { ![info exists variations($variation)]} {
+            set variations($variation) $value
         }
     }
 
@@ -2387,80 +2899,139 @@
     }
 
     ui_debug "new fully merged portvariants: [array get variations]"
+    
+    # at this point we need to check if a different port will be replacing this one
+    if {[info exists portinfo(replaced_by)] && ![info exists options(ports_upgrade_no-replace)]} {
+        ui_debug "$portname is replaced by $portinfo(replaced_by)"
+        if {[catch {mportlookup $portinfo(replaced_by)} result]} {
+            global errorInfo
+            ui_debug "$errorInfo"
+            ui_error "port lookup failed: $result"
+            return 1
+        }
+        if {$result == ""} {
+            ui_error "No port $portinfo(replaced_by) found."
+            return 1
+        }
+        array unset portinfo
+        array set portinfo [lindex $result 1]
+        set newname $portinfo(name)
 
-    if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
+        set porturl $portinfo(porturl)
+        if {![info exists porturl]} {
+            set porturl file://./
+        }
+        set depscache(port:${newname}) 1
+    } else {
+        set newname $portname
+    }
+
+    array set interp_options [array get options]
+    set interp_options(ports_requested) $requestedflag
+
+    if {[catch {set workername [mportopen $porturl [array get interp_options] [array get variations]]} result]} {
         global errorInfo
         ui_debug "$errorInfo"
         ui_error "Unable to open port: $result"
         return 1
     }
+    array unset interp_options
 
     array unset portinfo
     array set portinfo [mportinfo $workername]
-    set portwasopened 1
     set version_in_tree "$portinfo(version)"
     set revision_in_tree "$portinfo(revision)"
     set epoch_in_tree "$portinfo(epoch)"
 
+    set build_override 0
+    set will_install yes
+    # check installed version against version in ports
+    if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
+            || ([rpm-vercomp $version_installed $version_in_tree] == 0
+                && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
+        && ![info exists options(ports_upgrade_force)] } {
+        if {$portname != $newname} { 
+            ui_debug "ignoring versions, installing replacement port"
+        } elseif { $epoch_installed < $epoch_in_tree } {
+            set build_override 1
+            ui_debug "epoch override ... upgrading!"
+        } elseif {[info exists options(ports_upgrade_enforce-variants)] && $options(ports_upgrade_enforce-variants) eq "yes"
+                  && [info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
+            ui_debug "variant override ... upgrading!"
+        } elseif {$os_platform_installed != "" && $os_major_installed != "" && $os_platform_installed != 0
+                  && ([_mportkey $workername "{os.platform}"] != $os_platform_installed
+                  || [_mportkey $workername "{os.major}"] != $os_major_installed)} {
+            ui_debug "platform mismatch ... upgrading!"
+            set build_override 1
+        } else {
+            if {[info exists portinfo(canonical_active_variants)] && $portinfo(canonical_active_variants) != $oldvariant} {
+                ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variants \"$oldvariant\" do not match \"$portinfo(canonical_active_variants)\". Use 'upgrade --enforce-variants' to switch to the requested variants."
+            } else {
+                ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
+            }
+            set will_install no
+        }
+    }
 
+    set will_build no
+    # avoid building again unnecessarily
+    if {$will_install && ([info exists options(ports_upgrade_force)] || $build_override == 1
+        || ![registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)])} {
+        set will_build yes
+    }
+
     # first upgrade dependencies
     if {![info exists options(ports_nodeps)]} {
-        _upgrade_dependencies portinfo depscache globalvarlist variationslist options
+        set status [_upgrade_dependencies portinfo depscache variationslist options $will_build]
+        if {$status != 0 && ![ui_isset ports_processall]} {
+            catch {mportclose $workername}
+            return $status
+        }
     } else {
         ui_debug "Not following dependencies"
     }
 
-    set epoch_override 0
-    # check installed version against version in ports
-    if { ( [rpm-vercomp $version_installed $version_in_tree] > 0
-            || ([rpm-vercomp $version_installed $version_in_tree] == 0
-                && [rpm-vercomp $revision_installed $revision_in_tree] >= 0 ))
-        && ![info exists options(ports_force)] } {
-        ui_debug "No need to upgrade! $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}"
-        if {[info exists portinfo(canonical_active_variants)]
-            && $portinfo(canonical_active_variants) != $oldvariant} {
-            ui_warn "Skipping upgrade since $portname ${version_installed}_${revision_installed} >= $portname ${version_in_tree}_${revision_in_tree}, even though installed variant $oldvariant does not match $portinfo(canonical_active_variants). Specify -f to force upgrade."
-        }
-        if { $epoch_installed >= $epoch_in_tree } {
-            # Check if we have to do dependents
-            if {[info exists options(ports_do_dependents)]} {
-                # We do dependents ..
-                set options(ports_nodeps) 1
+    if {!$will_install} {
+        # nothing to do for this port, so just check if we have to do dependents
+        if {[info exists options(ports_do_dependents)]} {
+            # We do dependents ..
+            set options(ports_nodeps) 1
 
-                registry::open_dep_map
-                set deplist [registry::list_dependents $portname]
+            registry::open_dep_map
+            if {$anyactive} {
+                set deplist [registry::list_dependents $portname $version_active $revision_active $variant_active]
+            } else {
+                set deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]
+            }
 
-                if { [llength deplist] > 0 } {
-                    foreach dep $deplist {
-                        set mpname [lindex $dep 2]
-                        if {![llength [array get depscache port:${mpname}]]} {
-                            macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
+            if { [llength deplist] > 0 } {
+                foreach dep $deplist {
+                    set mpname [lindex $dep 2]
+                    if {![llength [array get depscache port:${mpname}]]} {
+                        set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
+                        if {$status != 0 && ![ui_isset ports_processall]} {
+                            catch {mportclose $workername}
+                            return $status
                         }
                     }
                 }
             }
-            mportclose $workername
-            return 0
-        } else {
-            set epoch_override 1
-            ui_debug "epoch override ... upgrading!"
         }
+        mportclose $workername
+        return 0
     }
 
-
-    # build or unarchive version_in_tree
-    if {0 == [string compare "yes" ${macports::portarchivemode}]} {
-        set upgrade_action "archive"
-    } else {
-        set upgrade_action "destroot"
-    }
-
-    # avoid building again unnecessarily
-    if {[info exists options(ports_force)] || $epoch_override == 1
-        || ![registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
+    if {$will_build} {
+        # build or unarchive version_in_tree
+        if {0 == [string compare "yes" ${macports::portarchivemode}]} {
+            set upgrade_action "archive"
+        } else {
+            set upgrade_action "destroot"
+        }
         if {[catch {set result [mportexec $workername $upgrade_action]} result] || $result != 0} {
-            global errorInfo
-            ui_debug "$errorInfo"
+            if {[info exists ::errorInfo]} {
+                ui_debug "$::errorInfo"
+            }
             ui_error "Unable to upgrade port: $result"
             catch {mportclose $workername}
             return 1
@@ -2468,6 +3039,7 @@
     }
 
     # always uninstall old port in direct mode
+    global macports::registry.format
     if { 0 != [string compare "image" ${macports::registry.installtype}] } {
         # uninstall old
         ui_debug "Uninstalling $portname ${version_installed}_${revision_installed}${variant_installed}"
@@ -2476,7 +3048,8 @@
         set options(ports_force) yes
         if {$is_dryrun eq "yes"} {
             ui_msg "Skipping uninstall $portname @${version_installed}_${revision_installed}${variant_installed} (dry run)"
-        } elseif {[catch {portuninstall::uninstall $portname ${version_installed}_${revision_installed}${variant_installed} [array get options]} result]} {
+        } elseif {(${registry.format} != "receipt_sqlite" || ![registry::run_target $regref uninstall [array get options]])
+                  && [catch {registry_uninstall::uninstall $portname ${version_installed}_${revision_installed}${variant_installed} [array get options]} result]} {
             global errorInfo
             ui_debug "$errorInfo"
             ui_error "Uninstall $portname ${version_installed}_${revision_installed}${variant_installed} failed: $result"
@@ -2488,17 +3061,20 @@
         }
     } else {
         # are we installing an existing version due to force or epoch override?
-        if {[registry::entry_exists $portname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]} {
-             ui_debug "Uninstalling $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
+        if {[registry::entry_exists $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
+            && ([info exists options(ports_upgrade_force)] || $build_override == 1)} {
+             ui_debug "Uninstalling $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants)"
             # we have to force the uninstall in case of dependents
             set force_cur [info exists options(ports_force)]
             set options(ports_force) yes
+            set newregref [registry::open_entry $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants) $epoch_in_tree]
             if {$is_dryrun eq "yes"} {
-                ui_msg "Skipping uninstall $portname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
-            } elseif {[catch {portuninstall::uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
+                ui_msg "Skipping uninstall $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
+            } elseif {!(${registry.format} == "receipt_sqlite" && [registry::run_target $newregref uninstall [array get options]])
+                      && [catch {registry_uninstall::uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) [array get options]} result]} {
                 global errorInfo
                 ui_debug "$errorInfo"
-                ui_error "Uninstall $portname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
+                ui_error "Uninstall $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) failed: $result"
                 catch {mportclose $workername}
                 return 1
             }
@@ -2506,22 +3082,10 @@
                 unset options(ports_force)
             }
             if {$anyactive && $version_in_tree == $version_active && $revision_in_tree == $revision_active
-                && $portinfo(canonical_active_variants) == $variant_active} {
+                && $portinfo(canonical_active_variants) == $variant_active && $portname == $newname} {
                 set anyactive no
             }
         }
-        if {$anyactive} {
-            # deactivate version_active
-            if {$is_dryrun eq "yes"} {
-                ui_msg "Skipping deactivate $portname @${version_active}_${revision_active} (dry run)"
-            } elseif {[catch {portimage::deactivate $portname ${version_active}_${revision_active}${variant_active} $optionslist} result]} {
-                global errorInfo
-                ui_debug "$errorInfo"
-                ui_error "Deactivating $portname ${version_active}_${revision_active} failed: $result"
-                catch {mportclose $workername}
-                return 1
-            }
-        }
         if {[info exists options(port_uninstall_old)]} {
             # uninstalling now could fail due to dependents when not forced,
             # because the new version is not installed
@@ -2530,66 +3094,89 @@
     }
 
     if {$is_dryrun eq "yes"} {
-        ui_msg "Skipping activate $portname @${version_in_tree}_${revision_in_tree} (dry run)"
+        if {$anyactive} {
+            ui_msg "Skipping deactivate $portname @${version_active}_${revision_active}${variant_active} (dry run)"
+        }
+        ui_msg "Skipping activate $newname @${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants) (dry run)"
     } elseif {[catch {set result [mportexec $workername install]} result]} {
         global errorInfo
         ui_debug "$errorInfo"
-        ui_error "Couldn't activate $portname ${version_in_tree}_${revision_in_tree}: $result"
+        ui_error "Couldn't activate $newname ${version_in_tree}_${revision_in_tree}$portinfo(canonical_active_variants): $result"
         catch {mportclose $workername}
         return 1
     }
 
+    # Check if we have to do dependents
+    if {[info exists options(ports_do_dependents)]} {
+        # We do dependents ..
+        set options(ports_nodeps) 1
+
+        registry::open_dep_map
+        if {$portname != $newname} {
+            set deplist [registry::list_dependents $newname $version_in_tree $revision_in_tree $portinfo(canonical_active_variants)]
+        } else {
+            set deplist [list]
+        }
+        if {$anyactive} {
+            set deplist [concat $deplist [registry::list_dependents $portname $version_active $revision_active $variant_active]]
+        } else {
+            set deplist [concat $deplist [registry::list_dependents $portname $version_installed $revision_installed $variant_installed]]
+        }
+
+        if { [llength deplist] > 0 } {
+            foreach dep $deplist {
+                set mpname [lindex $dep 2]
+                if {![llength [array get depscache port:${mpname}]]} {
+                    set status [macports::_upgrade $mpname port:${mpname} $variationslist [array get options] depscache]
+                    if {$status != 0 && ![ui_isset ports_processall]} {
+                        catch {mportclose $workername}
+                        return $status
+                    }
+                }
+            }
+        }
+    }
+
     if {[info exists uninstall_later] && $uninstall_later == yes} {
         foreach i $ilist {
             set version [lindex $i 1]
             set revision [lindex $i 2]
             set variant [lindex $i 3]
-            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants)} {
+            if {$version == $version_in_tree && $revision == $revision_in_tree && $variant == $portinfo(canonical_active_variants) && $portname == $newname} {
                 continue
             }
+            set epoch [lindex $i 5]
             ui_debug "Uninstalling $portname ${version}_${revision}${variant}"
+            set regref [registry::open_entry $portname $version $revision $variant $epoch]
             if {$is_dryrun eq "yes"} {
                 ui_msg "Skipping uninstall $portname @${version}_${revision}${variant} (dry run)"
-            } elseif {[catch {portuninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
+            } elseif {!(${registry.format} == "receipt_sqlite" && [registry::run_target $regref uninstall $optionslist])
+                      && [catch {registry_uninstall::uninstall $portname ${version}_${revision}${variant} $optionslist} result]} {
                 global errorInfo
                 ui_debug "$errorInfo"
-                ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
-                catch {mportclose $workername}
-                return 1
-            }
-        }
-    }
-
-    # Check if we have to do dependents
-    if {[info exists options(ports_do_dependents)]} {
-        # We do dependents ..
-        set options(ports_nodeps) 1
-
-        registry::open_dep_map
-        set deplist [registry::list_dependents $portname]
-
-        if { [llength deplist] > 0 } {
-            foreach dep $deplist {
-                set mpname [lindex $dep 2]
-                if {![llength [array get depscache port:${mpname}]]} {
-                    macports::upgrade $mpname port:${mpname} $globalvarlist $variationslist [array get options] depscache
+                # replaced_by can mean that we try to uninstall all versions of the old port, so handle errors due to dependents
+                if {$result != "Please uninstall the ports that depend on $portname first." && ![ui_isset ports_processall]} {
+                    ui_error "Uninstall $portname @${version}_${revision}${variant} failed: $result"
+                    catch {mportclose $workername}
+                    return 1
                 }
             }
         }
     }
 
-
     # close the port handle
     mportclose $workername
+    return 0
 }
 
 # upgrade_dependencies: helper proc for upgrade
 # Calls upgrade on each dependency listed in the PortInfo.
 # Uses upvar to access the variables.
-proc macports::_upgrade_dependencies {portinfoname depscachename globalvarlistname variationslistname optionsname} {
+proc macports::_upgrade_dependencies {portinfoname depscachename variationslistname optionsname {build_needed yes}} {
     upvar $portinfoname portinfo $depscachename depscache \
-          $globalvarlistname globalvarlist $variationslistname variationslist \
+          $variationslistname variationslist \
           $optionsname options
+    upvar workername parentworker
 
     # If we're following dependents, we only want to follow this port's
     # dependents, not those of all its dependencies. Otherwise, we would
@@ -2603,21 +3190,37 @@
     set saved_do_dependents [info exists options(ports_do_dependents)]
     unset -nocomplain options(ports_do_dependents)
 
-    # each dep type is upgraded
-    foreach dtype {depends_fetch depends_extract depends_build depends_lib depends_run} {
+    set status 0
+    # each required dep type is upgraded
+    if {$build_needed} {
+        set dtypes {depends_fetch depends_extract depends_build depends_lib depends_run}
+    } else {
+        set dtypes {depends_lib depends_run}
+    }
+    foreach dtype $dtypes {
         if {[info exists portinfo($dtype)]} {
             foreach i $portinfo($dtype) {
-                set d [lindex [split $i :] end]
+                set parent_interp [ditem_key $parentworker workername]
+                set d [$parent_interp eval _get_dep_port $i]
                 if {![llength [array get depscache port:${d}]] && ![llength [array get depscache $i]]} {
-                    upgrade $d $i $globalvarlist $variationslist [array get options] depscache
+                    if {$d != ""} {
+                        set dspec port:$d
+                    } else {
+                        set dspec $i
+                        set d [lindex [split $i :] end]
+                    }
+                    set status [macports::_upgrade $d $dspec $variationslist [array get options] depscache]
+                    if {$status != 0 && ![ui_isset ports_processall]} break
                 }
             }
         }
+        if {$status != 0 && ![ui_isset ports_processall]} break
     }
     # restore dependent-following to its former value
     if {$saved_do_dependents} {
         set options(ports_do_dependents) yes
     }
+    return $status
 }
 
 # mportselect
@@ -2636,7 +3239,9 @@
 
     switch -- $command {
         list {
-            if {[catch {set versions [glob -directory $conf_path *]}]} {
+            if {[catch {set versions [glob -directory $conf_path *]} result]} {
+                global errorInfo
+                ui_debug "$result: $errorInfo"
                 return -code error [concat "No configurations associated " \
                                            "with '$group' were found."]
             }
@@ -2655,17 +3260,19 @@
         }
         set {
             # Use $conf_path/$version to read in sources.
-            if {[catch {set src_file [open "$conf_path/$version"]}]} {
-                return -code error [concat "Verify that the specified " \
-                                           "version '$version' is valid " \
-                                           "(i.e., Is it listed when you " \
-                                           "specify the --list command?)."]
+            if {$version == "base" || $version == "current"
+                    || [catch {set src_file [open "$conf_path/$version"]} result]} {
+                global errorInfo
+                ui_debug "$result: $errorInfo"
+                return -code error "The specified version '$version' is not valid."
             }
             set srcs [split [read -nonewline $src_file] "\n"]
             close $src_file
 
             # Use $conf_path/base to read in targets.
-            if {[catch {set tgt_file [open "$conf_path/base"]}]} {
+            if {[catch {set tgt_file [open "$conf_path/base"]} result]} {
+                global errorInfo
+                ui_debug "$result: $errorInfo"
                 return -code error [concat "The configuration file " \
                                            "'$conf_path/base' could not be " \
                                            "opened."]

Modified: branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/macports1.0/macports_autoconf.tcl.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,6 +37,7 @@
     variable macports_conf_path "@MPCONFIGDIR_EXPANDED@"
     variable macports_version "@MACPORTS_VERSION@"
     variable macports_user_dir "~/.macports"
+    variable macportsuser "@RUNUSR@"
     variable open_path "@OPEN@"
     variable rsync_path "@RSYNC@"
     variable tar_command "@TAR_CMD@"

Modified: branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in
===================================================================
--- branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/macports1.0/macports_fastload.tcl.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -70,17 +70,14 @@
 	}
 }
 
-set dir [file join "@TCL_PACKAGE_DIR@" macports1.0]
-catch {source [file join $dir pkgIndex.tcl]}
-
-set sharetcldir [file join "@prefix_expanded@" share macports Tcl]
+set sharetcldir "@macports_tcl_dir@"
 if {[file exists $sharetcldir]} {
 	foreach dir [glob -directory $sharetcldir *] {
 		catch {source [file join $dir pkgIndex.tcl]}
 	}
 }
 
-if { "@SQLITE3_DIR@" != "" } {
-	set dir "@SQLITE3_DIR@"
+if { "@SQLITE3_TCL_DIR@" != "" } {
+	set dir "@SQLITE3_TCL_DIR@"
 	catch {source [file join $dir pkgIndex.tcl]}
 }

Copied: branches/new-help-system/base/src/macports1.0/sysctl.c (from rev 65586, trunk/base/src/macports1.0/sysctl.c)
===================================================================
--- branches/new-help-system/base/src/macports1.0/sysctl.c	                        (rev 0)
+++ branches/new-help-system/base/src/macports1.0/sysctl.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,87 @@
+/*
+ * sysctl.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#include <string.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/sysctl.h>
+
+#include "sysctl.h"
+
+/*
+ * Read-only wrapper for sysctlbyname(3). Only works for values of type CTLTYPE_INT and CTLTYPE_QUAD.
+ */
+int SysctlCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    const char error_message[] = "sysctl failed: ";
+    Tcl_Obj *tcl_result;
+    int res;
+    char *name;
+    int value;
+    Tcl_WideInt long_value;
+    size_t len = sizeof(value);
+
+    if (objc != 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "name");
+        return TCL_ERROR;
+    }
+
+    name = Tcl_GetString(objv[1]);
+    res = sysctlbyname(name, &value, &len, NULL, 0);
+    if (res == -1 && errno != ENOMEM && errno != ERANGE) {
+        tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+        Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
+        Tcl_SetObjResult(interp, tcl_result);
+        return TCL_ERROR;
+    } else if (res == -1) {
+        len = sizeof(long_value);
+        res = sysctlbyname(name, &long_value, &len, NULL, 0);
+        if (res == -1) {
+            tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+            Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
+            Tcl_SetObjResult(interp, tcl_result);
+            return TCL_ERROR;
+        }
+        tcl_result = Tcl_NewWideIntObj(long_value);
+    } else {
+        tcl_result = Tcl_NewIntObj(value);
+    }
+    
+    Tcl_SetObjResult(interp, tcl_result);
+    return TCL_OK;
+}

Copied: branches/new-help-system/base/src/macports1.0/sysctl.h (from rev 65586, trunk/base/src/macports1.0/sysctl.h)
===================================================================
--- branches/new-help-system/base/src/macports1.0/sysctl.h	                        (rev 0)
+++ branches/new-help-system/base/src/macports1.0/sysctl.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,34 @@
+/*
+ * sysctl.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* Read-only wrapper for sysctlbyname(3) */
+int SysctlCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/new-help-system/base/src/package1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/package1.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,7 +1,8 @@
 INSTALLDIR=	${DESTDIR}${datadir}/macports/Tcl/package1.0
 
 SRCS=	package.tcl portdmg.tcl portmdmg.tcl portmpkg.tcl portpkg.tcl portportpkg.tcl \
-	portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl portarchive.tcl
+	portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl portarchive.tcl \
+	portarchivefetch.tcl
 
 include ../../Mk/macports.autoconf.mk
 

Modified: branches/new-help-system/base/src/package1.0/package.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/package.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/package.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -40,5 +40,6 @@
 package require portmdmg 1.0
 package require portdpkg 1.0
 package require portportpkg 1.0
+package require portarchivefetch 1.0
 package require portunarchive 1.0
 package require portarchive 1.0

Modified: branches/new-help-system/base/src/package1.0/portarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchive.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portarchive.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# vim:ts=4 sw=4 fo=croq
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portarchive.tcl
 # $Id$
 #
@@ -37,7 +37,7 @@
 set org.macports.archive [target_new org.macports.archive portarchive::archive_main]
 target_init ${org.macports.archive} portarchive::archive_init
 target_provides ${org.macports.archive} archive
-target_requires ${org.macports.archive} main unarchive fetch extract checksum patch configure build destroot
+target_requires ${org.macports.archive} main archivefetch unarchive fetch extract checksum patch configure build destroot
 target_prerun ${org.macports.archive} portarchive::archive_start
 target_postrun ${org.macports.archive} portarchive::archive_finish
 
@@ -64,358 +64,356 @@
 set_ui_prefix
 
 proc portarchive::archive_init {args} {
-	global UI_PREFIX target_state_fd
-	global variations package.destpath workpath
-	global ports_force ports_source_only ports_binary_only
-	global name version revision portvariants
-	global archive.destpath archive.type archive.meta
-	global archive.file archive.path archive.fulldestpath
+    global UI_PREFIX target_state_fd
+    global package.destpath workpath
+    global ports_force ports_source_only ports_binary_only
+    global name version revision portvariants
+    global archive.destpath archive.type archive.meta
+    global archive.file archive.path archive.fulldestpath
 
-	# Check mode in case archive called directly by user
-	if {[option portarchivemode] != "yes"} {
-		return -code error "Archive mode is not enabled!"
-	}
+    # Check mode in case archive called directly by user
+    if {[option portarchivemode] != "yes"} {
+        return -code error "Archive mode is not enabled!"
+    }
 
-	# Define port variants if not already defined
-	if { ![info exists portvariants] } {
-		set portvariants ""
-		set vlist [lsort -ascii [array names variations]]
-		# Put together variants in the form +foo+bar for the archive name
-		foreach v $vlist {
-			if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
-				set portvariants "${portvariants}+${v}"
-			}
-		}
-	}
+    # Define archive destination directory and target filename
+    if {![string equal ${archive.destpath} ${workpath}] && ![string equal ${archive.destpath} ""]} {
+        if {[llength [get_canonical_archs]] > 1} {
+            set archive.fulldestpath [file join ${archive.destpath} [option os.platform] "universal"]
+        } else {
+            set archive.fulldestpath [file join ${archive.destpath} [option os.platform] [get_canonical_archs]]
+        }
+    } else {
+        set archive.fulldestpath ${archive.destpath}
+    }
 
-	# Define archive destination directory and target filename
-	if {![string equal ${archive.destpath} ${workpath}] && ![string equal ${archive.destpath} ""]} {
-		set archive.fulldestpath [file join ${archive.destpath} [option os.platform] [option os.arch]]
-	} else {
-	    set archive.fulldestpath ${archive.destpath}
-	}
+    # Determine if archive should be skipped
+    set skipped 0
+    if {[check_statefile target org.macports.archive $target_state_fd]} {
+        return 0
+    } elseif {[check_statefile target org.macports.unarchive $target_state_fd] && ([info exists ports_binary_only] && $ports_binary_only == "yes")} {
+        ui_debug "Skipping archive ($name) since binary-only is set"
+        set skipped 1
+    } elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
+        ui_debug "Skipping archive ($name) since source-only is set"
+        set skipped 1
+    } else {
+        set unsupported 0
+        set any_missing no
+        foreach archive.type [option portarchivetype] {
+            if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
+                set archstring [join [get_canonical_archs] -]
+                set archive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${archive.type}"
+                set archive.path "[file join ${archive.fulldestpath} ${archive.file}]"
+                if {![file exists ${archive.path}]} {
+                    set any_missing yes
+                }
+            } else {
+                ui_debug "Skipping [string toupper ${archive.type}] archive: $errmsg"
+                incr unsupported
+            }
+        }
+        if {!$any_missing} {
+            # might be nice to allow forcing, but let's fix #16061 first
+            ui_debug "Skipping archive ($name) since archive(s) already exist"
+            set skipped 1
+        }
+        if {${archive.type} == "xpkg"} {
+            set archive.meta true
+        }
+        if {[llength [option portarchivetype]] == $unsupported} {
+            ui_debug "Skipping archive ($name) since specified archive types not supported"
+            set skipped 1
+        }
+    }
+    # Skip archive target by setting state
+    if {$skipped == 1} {
+        write_statefile target "org.macports.archive" $target_state_fd
+    }
 
-	# Determine if archive should be skipped
-	set skipped 0
-	if {[check_statefile target org.macports.archive $target_state_fd]} {
-		return 0
-	} elseif {[check_statefile target org.macports.unarchive $target_state_fd] && ([info exists ports_binary_only] && $ports_binary_only == "yes")} {
-		ui_debug "Skipping archive ($name) since binary-only is set"
-		set skipped 1
-	} elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
-		ui_debug "Skipping archive ($name) since source-only is set"
-		set skipped 1
-	} else {
-		set unsupported 0
-		set any_missing no
-		foreach archive.type [option portarchivetype] {
-			if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
-				set archive.file "${name}-${version}_${revision}${portvariants}.[option os.arch].${archive.type}"
-				set archive.path "[file join ${archive.fulldestpath} ${archive.file}]"
-				if {![file exists ${archive.path}]} {
-				    set any_missing yes
-				}
-			} else {
-				ui_debug "Skipping [string toupper ${archive.type}] archive: $errmsg"
-				set unsupported [expr $unsupported + 1]
-			}
-		}
-		if {!$any_missing} {
-			# might be nice to allow forcing, but let's fix #16061 first
-			ui_debug "Skipping archive ($name) since archive(s) already exist"
-			set skipped 1
-		}
-		if {${archive.type} == "xpkg"} {
-			set archive.meta true
-		}
-		if {[llength [option portarchivetype]] == $unsupported} {
-			ui_debug "Skipping archive ($name) since specified archive types not supported"
-			set skipped 1
-		}
-	}
-	# Skip archive target by setting state
-	if {$skipped == 1} {
-		write_statefile target "org.macports.archive" $target_state_fd
-	}
-
-	return 0
+    return 0
 }
 
 proc portarchive::archive_start {args} {
-	global UI_PREFIX
-	global name version revision portvariants
+    global UI_PREFIX
+    global name version revision portvariants
 
-	if {[llength [option portarchivetype]] > 1} {
-		ui_msg "$UI_PREFIX [format [msgcat::mc "Packaging [join [option portarchivetype] {, }] archives for %s %s_%s%s"] $name $version $revision $portvariants]"
-	} else {
-		ui_msg "$UI_PREFIX [format [msgcat::mc "Packaging [option portarchivetype] archive for %s %s_%s%s"] $name $version $revision $portvariants]"
-	}
+    if {[llength [option portarchivetype]] > 1} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Packaging [join [option portarchivetype] {, }] archives for %s %s_%s%s"] $name $version $revision $portvariants]"
+    } else {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Packaging [option portarchivetype] archive for %s %s_%s%s"] $name $version $revision $portvariants]"
+    }
 
-	return 0
+    return 0
 }
 
 proc portarchive::archive_command_setup {args} {
-	global archive.env archive.cmd
-	global archive.pre_args archive.args archive.post_args
-	global archive.type archive.path
-	global archive.metaname archive.metapath
-	global os.platform os.version
+    global archive.env archive.cmd
+    global archive.pre_args archive.args archive.post_args
+    global archive.type archive.path
+    global archive.metaname archive.metapath
+    global os.platform os.version
 
-	# Define appropriate archive command and options
-	set archive.env {}
-	set archive.cmd {}
-	set archive.pre_args {}
-	set archive.args {}
-	set archive.post_args {}
-	switch -regex ${archive.type} {
-		cp(io|gz) {
-			set pax "pax"
-			if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
-				ui_debug "Using $pax"
-				set archive.cmd "$pax"
-				set archive.pre_args {-w -v -x cpio}
-				if {[regexp {z$} ${archive.type}]} {
-					set gzip "gzip"
-					if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
-						ui_debug "Using $gzip"
-						set archive.args {.}
-						set archive.post_args "| $gzip -c9 > ${archive.path}"
-					} else {
-						ui_debug $errmsg
-						return -code error "No '$gzip' was found on this system!"
-					}
-				} else {
-					set archive.args "-f ${archive.path} ."
-				}
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$pax' was found on this system!"
-			}
-		}
-		t(ar|bz|lz|xz|gz) {
-			set tar "tar"
-			if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
-				ui_debug "Using $tar"
-				set archive.cmd "$tar"
-				set archive.pre_args {-cvf}
-				if {[regexp {z2?$} ${archive.type}]} {
-					if {[regexp {bz2?$} ${archive.type}]} {
-						set gzip "bzip2"
-						set level 9
-					} elseif {[regexp {lz$} ${archive.type}]} {
-						set gzip "lzma"
-						set level 7
-					} elseif {[regexp {xz$} ${archive.type}]} {
-						set gzip "xz"
-						set level 6
-					} else {
-						set gzip "gzip"
-						set level 9
-					}
-					if {[info exists portutil::autoconf::${gzip}_path]} {
-					    set hint [set portutil::autoconf::${gzip}_path]
-					} else {
-					    set hint ""
-					}
-					if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
-						ui_debug "Using $gzip"
-						set archive.args {- .}
-						set archive.post_args "| $gzip -c$level > ${archive.path}"
-					} else {
-						ui_debug $errmsg
-						return -code error "No '$gzip' was found on this system!"
-					}
-				} else {
-					set archive.args "${archive.path} ."
-				}
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$tar' was found on this system!"
-			}
-		}
-		xar {
-			set xar "xar"
-			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
-				ui_debug "Using $xar"
-				set archive.cmd "$xar"
-				set archive.pre_args {-cvf}
-				set archive.args "${archive.path} ."
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$xar' was found on this system!"
-			}
-		}
-		xpkg {
-			set xar "xar"
-			set compression "bzip2"
-			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
-				ui_debug "Using $xar"
-				set archive.cmd "$xar"
-				set archive.pre_args "-cv --exclude='\./\+.*' --compression=${compression} -n ${archive.metaname} -s ${archive.metapath} -f"
-				set archive.args "${archive.path} ."
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$xar' was found on this system!"
-			}
-		}
-		zip {
-			set zip "zip"
-			if {[catch {set zip [findBinary $zip ${portutil::autoconf::zip_path}]} errmsg] == 0} {
-				ui_debug "Using $zip"
-				set archive.cmd "$zip"
-				set archive.pre_args {-ry9}
-				set archive.args "${archive.path} ."
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$zip' was found on this system!"
-			}
-		}
-		default {
-			return -code error "Invalid port archive type '${archive.type}' specified!"
-		}
-	}
+    # Define appropriate archive command and options
+    set archive.env {}
+    set archive.cmd {}
+    set archive.pre_args {}
+    set archive.args {}
+    set archive.post_args {}
+    switch -regex ${archive.type} {
+        cp(io|gz) {
+            set pax "pax"
+            if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
+                ui_debug "Using $pax"
+                set archive.cmd "$pax"
+                set archive.pre_args {-w -v -x cpio}
+                if {[regexp {z$} ${archive.type}]} {
+                    set gzip "gzip"
+                    if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
+                        ui_debug "Using $gzip"
+                        set archive.args {.}
+                        set archive.post_args "| $gzip -c9 > ${archive.path}"
+                    } else {
+                        ui_debug $errmsg
+                        return -code error "No '$gzip' was found on this system!"
+                    }
+                } else {
+                    set archive.args "-f ${archive.path} ."
+                }
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$pax' was found on this system!"
+            }
+        }
+        t(ar|bz|lz|xz|gz) {
+            set tar "tar"
+            if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
+                ui_debug "Using $tar"
+                set archive.cmd "$tar"
+                set archive.pre_args {-cvf}
+                if {[regexp {z2?$} ${archive.type}]} {
+                    if {[regexp {bz2?$} ${archive.type}]} {
+                        set gzip "bzip2"
+                        set level 9
+                    } elseif {[regexp {lz$} ${archive.type}]} {
+                        set gzip "lzma"
+                        set level 7
+                    } elseif {[regexp {xz$} ${archive.type}]} {
+                        set gzip "xz"
+                        set level 6
+                    } else {
+                        set gzip "gzip"
+                        set level 9
+                    }
+                    if {[info exists portutil::autoconf::${gzip}_path]} {
+                        set hint [set portutil::autoconf::${gzip}_path]
+                    } else {
+                        set hint ""
+                    }
+                    if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
+                        ui_debug "Using $gzip"
+                        set archive.args {- .}
+                        set archive.post_args "| $gzip -c$level > ${archive.path}"
+                    } else {
+                        ui_debug $errmsg
+                        return -code error "No '$gzip' was found on this system!"
+                    }
+                } else {
+                    set archive.args "${archive.path} ."
+                }
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$tar' was found on this system!"
+            }
+        }
+        xar {
+            set xar "xar"
+            if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
+                ui_debug "Using $xar"
+                set archive.cmd "$xar"
+                set archive.pre_args {-cvf}
+                set archive.args "${archive.path} ."
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$xar' was found on this system!"
+            }
+        }
+        xpkg {
+            set xar "xar"
+            set compression "bzip2"
+            if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
+                ui_debug "Using $xar"
+                set archive.cmd "$xar"
+                set archive.pre_args "-cv --exclude='\./\+.*' --compression=${compression} -n ${archive.metaname} -s ${archive.metapath} -f"
+                set archive.args "${archive.path} ."
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$xar' was found on this system!"
+            }
+        }
+        zip {
+            set zip "zip"
+            if {[catch {set zip [findBinary $zip ${portutil::autoconf::zip_path}]} errmsg] == 0} {
+                ui_debug "Using $zip"
+                set archive.cmd "$zip"
+                set archive.pre_args {-ry9}
+                set archive.args "${archive.path} ."
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$zip' was found on this system!"
+            }
+        }
+        default {
+            return -code error "Invalid port archive type '${archive.type}' specified!"
+        }
+    }
 
-	return 0
+    return 0
 }
 
 proc portarchive::putel { fd el data } {
-	# Quote xml data
-	set quoted [string map  { & &amp; < &lt; > &gt; } $data]
-	# Write the element
-	puts $fd "<${el}>${quoted}</${el}>"
+    # Quote xml data
+    set quoted [string map  { & &amp; < &lt; > &gt; } $data]
+    # Write the element
+    puts $fd "<${el}>${quoted}</${el}>"
 }
 
 proc portarchive::putlist { fd listel itemel list } {
-	puts $fd "<$listel>"
-	foreach item $list {
-		putel $fd $itemel $item
-	}
-	puts $fd "</$listel>"
+    puts $fd "<$listel>"
+    foreach item $list {
+        putel $fd $itemel $item
+    }
+    puts $fd "</$listel>"
 }
 
 proc portarchive::archive_main {args} {
-	global UI_PREFIX variations
-	global workpath destpath portpath ports_force
-	global name epoch version revision portvariants
-	global archive.fulldestpath archive.type archive.file archive.path
-	global archive.meta archive.metaname archive.metapath
-	global os.platform os.arch
+    global UI_PREFIX PortInfo
+    global workpath destpath portpath ports_force
+    global name epoch version revision portvariants
+    global archive.fulldestpath archive.type archive.file archive.path
+    global archive.meta archive.metaname archive.metapath
+    global os.platform
 
-	# Create archive destination path (if needed)
-	if {![file isdirectory ${archive.fulldestpath}]} {
-		system "mkdir -p ${archive.fulldestpath}"
-	}
+    # Create archive destination path (if needed)
+    if {![file isdirectory ${archive.fulldestpath}]} {
+        system "mkdir -p ${archive.fulldestpath}"
+    }
 
-	# Create (if no files) destroot for archiving
-	if {![file isdirectory ${destpath}]} {
-		system "mkdir -p ${destpath}"
-	}
+    # Create (if no files) destroot for archiving
+    if {![file isdirectory ${destpath}]} {
+        system "mkdir -p ${destpath}"
+    }
 
-	# Copy state file into destroot for archiving
-	# +STATE contains a copy of the MacPorts state information
+    # Copy state file into destroot for archiving
+    # +STATE contains a copy of the MacPorts state information
     set statefile [file join $workpath .macports.${name}.state]
-	file copy -force $statefile [file join $destpath "+STATE"]
+    file copy -force $statefile [file join $destpath "+STATE"]
 
-	# Copy Portfile into destroot for archiving
-	# +PORTFILE contains a copy of the MacPorts Portfile
+    # Copy Portfile into destroot for archiving
+    # +PORTFILE contains a copy of the MacPorts Portfile
     set portfile [file join $portpath Portfile]
-	file copy -force $portfile [file join $destpath "+PORTFILE"]
+    file copy -force $portfile [file join $destpath "+PORTFILE"]
 
-	# Create some informational files that we don't really use just yet,
-	# but we may in the future in order to allow port installation from
-	# archives without a full "ports" tree of Portfiles.
-	#
-	# Note: These have been modeled after FreeBSD type package files to
-	# start. We can change them however we want for actual future use if
-	# needed.
-	#
-	# +COMMENT contains the port description
-	set fd [open [file join $destpath "+COMMENT"] w]
+    # Create some informational files that we don't really use just yet,
+    # but we may in the future in order to allow port installation from
+    # archives without a full "ports" tree of Portfiles.
+    #
+    # Note: These have been modeled after FreeBSD type package files to
+    # start. We can change them however we want for actual future use if
+    # needed.
+    #
+    # +COMMENT contains the port description
+    set fd [open [file join $destpath "+COMMENT"] w]
     if {[exists description]} {
-		puts $fd "[option description]"
-	}
-	close $fd
-	# +DESC contains the port long_description and homepage
-	set fd [open [file join $destpath "+DESC"] w]
-	if {[exists long_description]} {
-		puts $fd "[option long_description]"
-	}
-	if {[exists homepage]} {
-		puts $fd "\nWWW: [option homepage]"
-	}
-	close $fd
-	# +CONTENTS contains the port version/name info and all installed
-	# files and checksums
-	set control [list]
-	set fd [open [file join $destpath "+CONTENTS"] w]
-	puts $fd "@name ${name}-${version}_${revision}${portvariants}"
-	puts $fd "@portname ${name}"
-	puts $fd "@portepoch ${epoch}"
-	puts $fd "@portversion ${version}"
-	puts $fd "@portrevision ${revision}"
-	set vlist [lsort -ascii [array names variations]]
-	foreach v $vlist {
-		if {![string equal $v [option os.platform]] && ![string equal $v [option os.arch]]} {
-			puts $fd "@portvariant +${v}"
-		}
-	}
-	fs-traverse fullpath $destpath {
-	    if {[file isdirectory $fullpath]} {
-	        continue
-	    }
-		set relpath [strsed $fullpath "s|^$destpath/||"]
-		if {![regexp {^[+]} $relpath]} {
-			puts $fd "$relpath"
-			if {[file isfile $fullpath]} {
-				ui_debug "checksum file: $fullpath"
-				set checksum [md5 file $fullpath]
-				puts $fd "@comment MD5:$checksum"
-			}
-		} else {
-			lappend control $relpath
-		}
-	}
-	foreach relpath $control {
-		puts $fd "@ignore"
-		puts $fd "$relpath"
-	}
-	close $fd
+        puts $fd "[option description]"
+    }
+    close $fd
+    # +DESC contains the port long_description and homepage
+    set fd [open [file join $destpath "+DESC"] w]
+    if {[exists long_description]} {
+        puts $fd "[option long_description]"
+    }
+    if {[exists homepage]} {
+        puts $fd "\nWWW: [option homepage]"
+    }
+    close $fd
+    # +CONTENTS contains the port version/name info and all installed
+    # files and checksums
+    set control [list]
+    set fd [open [file join $destpath "+CONTENTS"] w]
+    puts $fd "@name ${name}-${version}_${revision}${portvariants}"
+    puts $fd "@portname ${name}"
+    puts $fd "@portepoch ${epoch}"
+    puts $fd "@portversion ${version}"
+    puts $fd "@portrevision ${revision}"
+    puts $fd "@archs [get_canonical_archs]"
+    array set ourvariations $PortInfo(active_variants)
+    set vlist [lsort -ascii [array names ourvariations]]
+    foreach v $vlist {
+        if {$ourvariations($v) == "+"} {
+            puts $fd "@portvariant +${v}"
+        }
+    }
+    fs-traverse -depth fullpath $destpath {
+        if {[file isdirectory $fullpath]} {
+            continue
+        }
+        set relpath [strsed $fullpath "s|^$destpath/||"]
+        if {![regexp {^[+]} $relpath]} {
+            puts $fd "$relpath"
+            if {[file isfile $fullpath]} {
+                ui_debug "checksum file: $fullpath"
+                set checksum [md5 file $fullpath]
+                puts $fd "@comment MD5:$checksum"
+            }
+        } else {
+            lappend control $relpath
+        }
+    }
+    foreach relpath $control {
+        puts $fd "@ignore"
+        puts $fd "$relpath"
+    }
+    close $fd
 
-	# the XML package metadata, for XAR package
-	# (doesn't contain any file list/checksums)
-	if {${archive.meta}} {
-		set archive.metaname "xpkg"
-		set archive.metapath [file join $workpath "${archive.metaname}.xml"]
-		set sd [open ${archive.metapath} w]
-		puts $sd "<xpkg version='0.2'>"
-		# TODO: split contents into <buildinfo> (new) and <package> (current)
-		#       see existing <portpkg> for the matching source package layout
+    # the XML package metadata, for XAR package
+    # (doesn't contain any file list/checksums)
+    if {${archive.meta}} {
+        set archive.metaname "xpkg"
+        set archive.metapath [file join $workpath "${archive.metaname}.xml"]
+        set sd [open ${archive.metapath} w]
+        puts $sd "<xpkg version='0.2'>"
+        # TODO: split contents into <buildinfo> (new) and <package> (current)
+        #       see existing <portpkg> for the matching source package layout
 
-		putel $sd name ${name}
-		putel $sd epoch ${epoch}
-		putel $sd version ${version}
-		putel $sd revision ${revision}
-		putel $sd major 0
-		putel $sd minor 0
+        putel $sd name ${name}
+        putel $sd epoch ${epoch}
+        putel $sd version ${version}
+        putel $sd revision ${revision}
+        putel $sd major 0
+        putel $sd minor 0
 
-		putel $sd platform ${os.platform}
-		putel $sd arch ${os.arch}
-		set vlist [lsort -ascii [array names variations]]
-		putlist $sd variants variant $vlist
+        putel $sd platform ${os.platform}
+        if {[llength [get_canonical_archs]] > 1} {
+            putlist $sd archs arch [get_canonical_archs]
+        } else {
+            putel $sd arch [get_canonical_archs]
+        }
+        putlist $sd variants variant $vlist
 
-		if {[exists categories]} {
-			set primary [lindex [split [option categories] " "] 0]
-			putel $sd category $primary
-		}
-		if {[exists description]} {
-			putel $sd comment "[option description]"
-		}
-		if {[exists long_description]} {
-			putel $sd desc "[option long_description]"
-		}
-		if {[exists homepage]} {
-			putel $sd homepage "[option homepage]"
-		}
+        if {[exists categories]} {
+            set primary [lindex [split [option categories] " "] 0]
+            putel $sd category $primary
+        }
+        if {[exists description]} {
+            putel $sd comment "[option description]"
+        }
+        if {[exists long_description]} {
+            putel $sd desc "[option long_description]"
+        }
+        if {[exists homepage]} {
+            putel $sd homepage "[option homepage]"
+        }
 
             # Emit dependencies provided by this package
             puts $sd "<provides>"
@@ -454,53 +452,53 @@
             puts $sd "</requires>"
     }
 
-		puts $sd "</xpkg>"
-		close $sd
-	}
+        puts $sd "</xpkg>"
+        close $sd
+    }
 
-	# Now create the archive(s)
-	# Loop through archive types
-	foreach archive.type [option portarchivetype] {
-		if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
-			# Define archive file/path
-			set archive.file "${name}-${version}_${revision}${portvariants}.[option os.arch].${archive.type}"
-			set archive.path "[file join ${archive.fulldestpath} ${archive.file}]"
+    set archstring [join [get_canonical_archs] -]
+    # Now create the archive(s)
+    # Loop through archive types
+    foreach archive.type [option portarchivetype] {
+        if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
+            # Define archive file/path
+            set archive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${archive.type}"
+            set archive.path "[file join ${archive.fulldestpath} ${archive.file}]"
 
-			# Setup archive command
-			archive_command_setup
+            # Setup archive command
+            archive_command_setup
 
-			# Remove existing archive
-			if {[file exists ${archive.path}]} {
-				ui_info "$UI_PREFIX [format [msgcat::mc "Deleting previous %s"] ${archive.file}]"
-				file delete -force ${archive.path}
-			}
+            # Remove existing archive
+            if {[file exists ${archive.path}]} {
+                ui_info "$UI_PREFIX [format [msgcat::mc "Deleting previous %s"] ${archive.file}]"
+                file delete -force ${archive.path}
+            }
 
-			ui_info "$UI_PREFIX [format [msgcat::mc "Creating %s"] ${archive.file}]"
-			command_exec archive
-			ui_info "$UI_PREFIX [format [msgcat::mc "Archive %s packaged"] ${archive.file}]"
-		}
-	}
+            ui_info "$UI_PREFIX [format [msgcat::mc "Creating %s"] ${archive.file}]"
+            command_exec archive
+            ui_info "$UI_PREFIX [format [msgcat::mc "Archive %s packaged"] ${archive.file}]"
+        }
+    }
 
     return 0
 }
 
 proc portarchive::archive_finish {args} {
-	global UI_PREFIX
-	global name version revision portvariants
-	global destpath
+    global UI_PREFIX
+    global name version revision portvariants
+    global destpath
 
-	# Cleanup all control files when finished
-	set control_files [glob -nocomplain -types f [file join $destpath +*]]
-	foreach file $control_files {
-		ui_debug "removing file: $file"
-		file delete -force $file
-	}
+    # Cleanup all control files when finished
+    set control_files [glob -nocomplain -types f [file join $destpath +*]]
+    foreach file $control_files {
+        ui_debug "removing file: $file"
+        file delete -force $file
+    }
 
-	if {[llength [option portarchivetype]] > 1} {
-		ui_info "$UI_PREFIX [format [msgcat::mc "Archives for %s %s_%s%s packaged"] $name $version $revision $portvariants]"
-	} else {
-		ui_info "$UI_PREFIX [format [msgcat::mc "Archive for %s %s_%s%s packaged"] $name $version $revision $portvariants]"
-	}
-	return 0
+    if {[llength [option portarchivetype]] > 1} {
+        ui_info "$UI_PREFIX [format [msgcat::mc "Archives for %s %s_%s%s packaged"] $name $version $revision $portvariants]"
+    } else {
+        ui_info "$UI_PREFIX [format [msgcat::mc "Archive for %s %s_%s%s packaged"] $name $version $revision $portvariants]"
+    }
+    return 0
 }
-

Copied: branches/new-help-system/base/src/package1.0/portarchivefetch.tcl (from rev 65586, trunk/base/src/package1.0/portarchivefetch.tcl)
===================================================================
--- branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/package1.0/portarchivefetch.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,234 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+#
+# Copyright (c) 2002 - 2003 Apple Inc.
+# Copyright (c) 2004-2010 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide portarchivefetch 1.0
+package require fetch_common 1.0
+package require portutil 1.0
+package require Pextlib 1.0
+
+set org.macports.archivefetch [target_new org.macports.archivefetch portarchivefetch::archivefetch_main]
+target_init ${org.macports.archivefetch} portarchivefetch::archivefetch_init
+target_provides ${org.macports.archivefetch} archivefetch
+target_requires ${org.macports.archivefetch} main
+target_prerun ${org.macports.archivefetch} portarchivefetch::archivefetch_start
+
+namespace eval portarchivefetch {
+    variable archivefetch_urls {}
+}
+
+options archive_sites archivefetch.user archivefetch.password \
+    archivefetch.use_epsv archivefetch.ignore_sslcert \
+    archive_sites.mirror_subdir
+
+# user name & password
+default archivefetch.user ""
+default archivefetch.password ""
+# Use EPSV for FTP transfers
+default archivefetch.use_epsv no
+# Ignore SSL certificate
+default archivefetch.ignore_sslcert no
+
+# TODO: enable this when binaries are available on a macports server
+#default archive_sites macports_archives
+default archive_sites.listfile {"archive_sites.tcl"}
+default archive_sites.listpath {"port1.0/fetch"}
+
+set_ui_prefix
+
+# Checks possible archive files to assemble url lists for later fetching
+proc portarchivefetch::checkarchivefiles {urls} {
+    global all_archive_files archivefetch.fulldestpath \
+           portarchivepath name version revision portvariants archive_sites
+    upvar $urls fetch_urls
+
+    # Define archive directory, file, and path
+    if {[llength [get_canonical_archs]] > 1} {
+        set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] "universal"]
+    } else {
+        set archivefetch.fulldestpath [file join ${portarchivepath} [option os.platform] [get_canonical_archs]]
+    }
+
+    set unsupported 0
+    set found 0
+    foreach archive.type [option portarchivetype] {
+        if {[catch {archiveTypeIsSupported ${archive.type}} errmsg] == 0} {
+            set archstring [join [get_canonical_archs] -]
+            set archive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${archive.type}"
+            set archive.path [file join ${archivefetch.fulldestpath} ${archive.file}]
+            if {[file exists ${archive.path}]} {
+                set found 1
+                break
+            } else {
+                lappend all_archive_files ${archive.file}
+                if {[info exists archive_sites]} {
+                    lappend fetch_urls archive_sites ${archive.file}
+                }
+            }
+        } else {
+            ui_debug "Skipping [string toupper ${archive.type}] archive: $errmsg"
+            incr unsupported
+        }
+    }
+    if {$found} {
+        ui_debug "Found [string toupper ${archive.type}] archive: ${archive.path}"
+        set all_archive_files {}
+        set fetch_urls {}
+    } elseif {[llength [option portarchivetype]] == $unsupported} {
+        return -code error "Unable to fetch archive ($name) since specified archive types not supported"
+    }
+}
+
+# returns full path to mirror list file
+proc portarchivefetch::get_full_archive_sites_path {} {
+    global archive_sites.listfile archive_sites.listpath porturl
+    return [getportresourcepath $porturl [file join ${archive_sites.listpath} ${archive_sites.listfile}]]
+}
+
+# Perform the full checksites/checkarchivefiles sequence.
+proc portarchivefetch::checkfiles {urls} {
+    upvar $urls fetch_urls
+
+    portfetch::checksites [list archive_sites [list {} {} ARCHIVE_SITE_LOCAL]] \
+                          [get_full_archive_sites_path]
+    checkarchivefiles fetch_urls
+}
+
+
+# Perform a standard fetch, assembling fetch urls from
+# the listed url variable and associated archive file
+proc portarchivefetch::fetchfiles {args} {
+    global archivefetch.fulldestpath UI_PREFIX
+    global archivefetch.user archivefetch.password archivefetch.use_epsv \
+           archivefetch.ignore_sslcert
+    global portverbose ports_binary_only
+    variable archivefetch_urls
+    variable ::portfetch::urlmap
+
+    if {![file isdirectory ${archivefetch.fulldestpath}]} {
+        if {[catch {file mkdir ${archivefetch.fulldestpath}} result]} {
+            elevateToRoot "archivefetch"
+            set elevated yes
+            if {[catch {file mkdir ${archivefetch.fulldestpath}} result]} {
+                return -code error [format [msgcat::mc "Unable to create archive path: %s"] $result]
+            }
+        }
+    }
+    chownAsRoot ${archivefetch.fulldestpath}
+    if {[info exists elevated] && $elevated == yes} {
+        dropPrivileges
+    }
+
+    set fetch_options {}
+    if {[string length ${archivefetch.user}] || [string length ${archivefetch.password}]} {
+        lappend fetch_options -u
+        lappend fetch_options "${archivefetch.user}:${archivefetch.password}"
+    }
+    if {${archivefetch.use_epsv} != "yes"} {
+        lappend fetch_options "--disable-epsv"
+    }
+    if {${archivefetch.ignore_sslcert} != "no"} {
+        lappend fetch_options "--ignore-ssl-cert"
+    }
+    if {$portverbose == "yes"} {
+        lappend fetch_options "-v"
+    }
+    set sorted no
+
+    foreach {url_var archive} $archivefetch_urls {
+        if {![file isfile ${archivefetch.fulldestpath}/${archive}]} {
+            ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $archive ${archivefetch.fulldestpath}]"
+            if {![file writable ${archivefetch.fulldestpath}]} {
+                return -code error [format [msgcat::mc "%s must be writable"] ${archivefetch.fulldestpath}]
+            }
+            if {!$sorted} {
+                portfetch::sortsites archivefetch_urls {} archive_sites
+                set sorted yes
+            }
+            if {![info exists urlmap($url_var)]} {
+                ui_error [format [msgcat::mc "No defined site for tag: %s, using archive_sites"] $url_var]
+                set urlmap($url_var) $archive_sites
+            }
+            unset -nocomplain fetched
+            foreach site $urlmap($url_var) {
+                ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $archive $site]"
+                set file_url [portfetch::assemble_url $site $archive]
+                set effectiveURL ""
+                if {![catch {eval curl fetch --effective-url effectiveURL $fetch_options {$file_url} ${archivefetch.fulldestpath}/${archive}.TMP} result] &&
+                    ![catch {file rename -force "${archivefetch.fulldestpath}/${archive}.TMP" "${archivefetch.fulldestpath}/${archive}"} result]} {
+                    # Successful fetch
+                    set fetched 1
+                    break
+                } else {
+                    ui_debug "[msgcat::mc "Fetching archive failed:"]: $result"
+                    file delete -force "${archivefetch.fulldestpath}/${archive}.TMP"
+                }
+            }
+            if {[info exists fetched]} {
+                return 0
+            }
+        } else {
+            return 0
+        }
+    }
+    if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
+        return -code error "archivefetch failed for [option name] @[option version]_[option revision][option portvariants]"
+    } else {
+        return 0
+    }
+}
+
+# Initialize archivefetch target and call checkfiles.
+proc portarchivefetch::archivefetch_init {args} {
+    variable archivefetch_urls
+
+    if {[option portarchivemode] != "yes"} {
+        return -code error "Archive mode is not enabled!"
+    }
+
+    portarchivefetch::checkfiles archivefetch_urls
+}
+
+proc portarchivefetch::archivefetch_start {args} {
+    global UI_PREFIX name
+
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Fetching archive for %s"] $name]"
+}
+
+# Main archive fetch routine
+# just calls the standard fetchfiles procedure
+proc portarchivefetch::archivefetch_main {args} {
+    global all_archive_files
+    if {[info exists all_archive_files] && [llength $all_archive_files] > 0} {
+        # Fetch the files
+        return [portarchivefetch::fetchfiles]
+    }
+}

Modified: branches/new-help-system/base/src/package1.0/portdmg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portdmg.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portdmg.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portdmg.tcl
 # $Id$
 #
@@ -58,7 +58,7 @@
     if {[expr (${portrevision} > 0)]} {
         set imagename "${portname}-${portversion}-${portrevision}"
     } else {
-	set imagename "${portname}-${portversion}"
+        set imagename "${portname}-${portversion}"
     }
     
     set tmp_image ${package.destpath}/${imagename}.tmp.dmg
@@ -67,41 +67,22 @@
     
     if {[file readable $final_image] && ([file mtime ${final_image}] >= [file mtime ${portpath}/Portfile])} {
         ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s-%s is up-to-date"] ${portname} ${portversion}]"
-	return 0
+        return 0
     }
-    
-    # size for .dmg
-    set size [dirSize ${pkgpath}]
-    if {[expr ($size < 4194304)]} {
-	# there is a minimum of 8292 512 blocks in a dmg
-        set blocks 8292
-    } else {
-	# this should later be replaced with hdiutil create -srcfolder
-        set blocks [expr ($size/512) + ((($size/512)*3)/100)]
-    }
-    
+
     # partition for .dmg
     if {${os.major} >= 9 && ${os.arch} == "i386"} {
-	# GUID_partition_scheme
+        # GUID_partition_scheme
         set subdev 1
     } else {
-	# Apple_partition_scheme (Apple_partition_map is at s1)
+        # Apple_partition_scheme (Apple_partition_map is at s1)
         set subdev 2
     }
     
     set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
-    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
+    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${pkgpath} ${tmp_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
     }
-    if {[catch {set attach_output [exec $hdiutil attach -puppetstrings ${tmp_image} | grep s${subdev}]} error]} {
-        return -code error [format [msgcat::mc "Failed to attach temporary image: %s"] ${error}]
-    }
-    set attach_output [split $attach_output "\t"]
-    set devicename [string trim [lindex $attach_output 0]]
-    set mount_point [string trim [lindex $attach_output 2]]
-    regexp {(\/Volumes/[A-Za-z0-9\-\_\s].+)\s\(} $mount_point code mount_point
-    system "[findBinary ditto $portutil::autoconf::ditto_path] -rsrcFork ${pkgpath} '${mount_point}/${portname}-${portversion}.pkg'"
-    system "$hdiutil detach ${devicename} -quiet"
     if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
         return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
     }

Modified: branches/new-help-system/base/src/package1.0/portmdmg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portmdmg.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portmdmg.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portmdmg.tcl
 # $Id$
 #
@@ -58,7 +58,7 @@
     if {[expr (${portrevision} > 0)]} {
         set imagename "${portname}-${portversion}-${portrevision}"
     } else {
-	set imagename "${portname}-${portversion}"
+        set imagename "${portname}-${portversion}"
     }
     
     set tmp_image ${package.destpath}/${imagename}.tmp.dmg
@@ -67,47 +67,22 @@
     
     if {[file readable $final_image] && ([file mtime ${final_image}] >= [file mtime ${portpath}/Portfile])} {
         ui_msg "$UI_PREFIX [format [msgcat::mc "Disk Image for %s-%s is up-to-date"] ${portname} ${portversion}]"
-	return 0
+        return 0
     }
-    
-    # size for .dmg
-    set size [dirSize ${mpkgpath}]
-    if {[expr ($size < 4194304)]} {
-	# there is a minimum of 8292 512 blocks in a dmg
-        set blocks 8292
-    } else {
-	# this is now replaced with hdiutil create -srcfolder
-        set blocks [expr ($size/512) + ((($size/512)*3)/100)]
-    }
-    
+
     # partition for .dmg
     if {${os.major} >= 9 && ${os.arch} == "i386"} {
-	# GUID_partition_scheme
+        # GUID_partition_scheme
         set subdev 1
     } else {
-	# Apple_partition_scheme (Apple_partition_map is at s1)
+        # Apple_partition_scheme (Apple_partition_map is at s1)
         set subdev 2
     }
 
-  set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
-  if {false} {
-    if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -size ${blocks}b ${tmp_image}"] != ""} {
-        return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
-    }
-    if {[catch {set attach_output [exec $hdiutil attach -puppetstrings ${tmp_image} | grep s${subdev}]} error]} {
-        return -code error [format [msgcat::mc "Failed to attach temporary image: %s"] ${error}]
-    }
-    set attach_output [split $attach_output "\t"]
-    set devicename [string trim [lindex $attach_output 0]]
-    set mount_point [string trim [lindex $attach_output 2]]
-    regexp {(\/Volumes/[A-Za-z0-9\-\_\s].+)\s\(} $mount_point code mount_point
-    system "[findBinary ditto $portutil::autoconf::ditto_path] -rsrcFork ${mpkgpath} '${mount_point}/${portname}-${portversion}.mpkg'"
-    system "$hdiutil detach ${devicename} -quiet"
-  } else {
+    set hdiutil [findBinary hdiutil $portutil::autoconf::hdiutil_path]
     if {[system "$hdiutil create -quiet -fs HFS+ -volname ${imagename} -srcfolder ${mpkgpath} ${tmp_image}"] != ""} {
         return -code error [format [msgcat::mc "Failed to create temporary image: %s"] ${imagename}]
     }
-  }
     if {[system "$hdiutil convert ${tmp_image} -format UDCO -o ${final_image} -quiet"] != ""} {
         return -code error [format [msgcat::mc "Failed to convert to final image: %s"] ${final_image}]
     }

Modified: branches/new-help-system/base/src/package1.0/portpkg.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portpkg.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portpkg.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,7 +37,7 @@
 target_runtype ${org.macports.pkg} always
 target_provides ${org.macports.pkg} pkg
 if {[option portarchivemode] == "yes"} {
-    target_requires ${org.macports.pkg} unarchive destroot
+    target_requires ${org.macports.pkg} archivefetch unarchive destroot
 } else {
     target_requires ${org.macports.pkg} destroot
 }
@@ -161,28 +161,6 @@
     close $infofd
 }
 
-# XXX: deprecated
-proc portpkg::write_info_file {infofile portname portversion description} {
-    set infofd [open ${infofile} w+]
-    puts $infofd "Title ${portname}
-Version ${portversion}
-Description ${description}
-DefaultLocation /
-DeleteWarning
-
-### Package Flags
-
-NeedsAuthorization YES
-Required NO
-Relocatable NO
-RequiresReboot NO
-UseUserMask YES
-OverwritePermissions NO
-InstallFat NO
-RootVolumeOnly NO"
-    close $infofd
-}
-
 proc portpkg::xml_escape {s} {
     regsub -all {&} $s {\&amp;} s
     regsub -all {<} $s {\&lt;} s
@@ -228,7 +206,7 @@
     <key>IFPkgFlagRestartAction</key>
     <string>NoRestart</string>
     <key>IFPkgFlagRootVolumeOnly</key>
-    <false/>
+    <true/>
     <key>IFPkgFlagUpdateInstalledLanguages</key>
     <false/>
     <key>IFPkgFormatVersion</key>


Property changes on: branches/new-help-system/base/src/package1.0/portportpkg.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/package1.0/portrpm.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portrpm.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portrpm.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -55,7 +55,7 @@
 
 proc portrpm::rpm_pkg {portname portversion portrevision} {
     global UI_PREFIX package.destpath portdbpath destpath workpath prefix categories maintainers description long_description homepage epoch portpath
-	global os.platform os.arch os.version os.major
+	global os.platform os.arch os.version os.major supported_archs configure.build_arch license
     
     set rpmdestpath ""
     if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
@@ -67,17 +67,18 @@
                    ${pkgpath}/SRPMS
         set rpmdestpath "--define '_topdir ${pkgpath}'"
     }
-    
+
     set rpmbuildarch ""
-    if {[variant_isset "universal"]} {
+    if {$supported_archs == "noarch"} {
+        set rpmbuildarch "--target noarch"
+    } elseif {[variant_exists universal] && [variant_isset universal]} {
         set rpmbuildarch "--target fat"
+    } elseif {${configure.build_arch} != ""} {
+        set rpmbuildarch "--target ${configure.build_arch}"
     }
-    if {false} {
-        set rpmbuildarch "--target noarch"
-    }
     
     foreach dir [list "${prefix}/src/macports/RPMS" "${prefix}/src/apple/RPMS" "/usr/src/apple/RPMS" "/macports/rpms/RPMS"] {
-        foreach arch {"ppc" "i386" "fat" "noarch"} {
+        foreach arch [list ${configure.build_arch} ${os.arch} "fat" "noarch"] {
             set rpmpath "$dir/${arch}/${portname}-${portversion}-${portrevision}.${arch}.rpm"
 	    if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
                 ui_debug "$rpmpath"
@@ -97,7 +98,6 @@
         }
     }
     set category   [lindex [split $categories " "] 0]
-    set license    "Unknown"
     set maintainer $maintainers
     
     set dependencies {}

Modified: branches/new-help-system/base/src/package1.0/portunarchive.tcl
===================================================================
--- branches/new-help-system/base/src/package1.0/portunarchive.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/package1.0/portunarchive.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# vim:ts=4 sw=4 fo=croq
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portunarchive.tcl
 # $Id$
 #
@@ -38,7 +38,7 @@
 target_runtype ${org.macports.unarchive} always
 target_init ${org.macports.unarchive} portunarchive::unarchive_init
 target_provides ${org.macports.unarchive} unarchive
-target_requires ${org.macports.unarchive} main
+target_requires ${org.macports.unarchive} main archivefetch
 target_prerun ${org.macports.unarchive} portunarchive::unarchive_start
 target_postrun ${org.macports.unarchive} portunarchive::unarchive_finish
 
@@ -61,245 +61,237 @@
 set_ui_prefix
 
 proc portunarchive::unarchive_init {args} {
-	global UI_PREFIX target_state_fd variations workpath
-	global ports_force ports_source_only ports_binary_only
-	global name version revision portvariants portpath
-	global unarchive.srcpath unarchive.type unarchive.file unarchive.path unarchive.fullsrcpath
+    global UI_PREFIX target_state_fd workpath
+    global ports_force ports_source_only ports_binary_only
+    global name version revision portvariants portpath
+    global unarchive.srcpath unarchive.type unarchive.file unarchive.path unarchive.fullsrcpath
 
-	# Check mode in case archive called directly by user
-	if {[option portarchivemode] != "yes"} {
-		return -code error "Archive mode is not enabled!"
-	}
+    # Check mode in case archive called directly by user
+    if {[option portarchivemode] != "yes"} {
+        return -code error "Archive mode is not enabled!"
+    }
 
-	# Define port variants if not already defined
-	if { ![info exists portvariants] } {
-		set portvariants ""
-		set vlist [lsort -ascii [array names variations]]
-		# Put together variants in the form +foo+bar for the archive name
-		foreach v $vlist {
-			if { ![string equal $v [option os.platform]] && ![string equal $v [option os.arch]] } {
-				set portvariants "${portvariants}+${v}"
-			}
-		}
-	}
+    # Define archive directory, file, and path
+    if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} {
+        if {[llength [get_canonical_archs]] > 1} {
+            set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] "universal"]
+        } else {
+            set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] [get_canonical_archs]]
+        }
+    } else {
+        set unarchive.fullsrcpath ${unarchive.srcpath}
+    }
 
-	# Define archive directory, file, and path
-	if {![string equal ${unarchive.srcpath} ${workpath}] && ![string equal ${unarchive.srcpath} ""]} {
-		set unarchive.fullsrcpath [file join ${unarchive.srcpath} [option os.platform] [option os.arch]]
-	} else {
-	    set unarchive.fullsrcpath ${unarchive.srcpath}
-	}
+    # Determine if unarchive should be skipped
+    set skipped 0
+    if {[check_statefile target org.macports.unarchive $target_state_fd]} {
+        return 0
+    } elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
+        ui_debug "Skipping unarchive ($name) since source-only is set"
+        set skipped 1
+    } elseif {[check_statefile target org.macports.destroot $target_state_fd]} {
+        ui_debug "Skipping unarchive ($name) since destroot completed"
+        set skipped 1
+    } elseif {[info exists ports_force] && $ports_force == "yes"} {
+        ui_debug "Skipping unarchive ($name) since force is set"
+        set skipped 1
+    } else {
+        set found 0
+        set unsupported 0
+        foreach unarchive.type [option portarchivetype] {
+            if {[catch {archiveTypeIsSupported ${unarchive.type}} errmsg] == 0} {
+                set archstring [join [get_canonical_archs] -]
+                set unarchive.file "${name}-${version}_${revision}${portvariants}.${archstring}.${unarchive.type}"
+                set unarchive.path "[file join ${unarchive.fullsrcpath} ${unarchive.file}]"
+                if {[file exist ${unarchive.path}]} {
+                    set found 1
+                    break
+                } else {
+                    ui_debug "No [string toupper ${unarchive.type}] archive: ${unarchive.path}"
+                }
+            } else {
+                ui_debug "Skipping [string toupper ${unarchive.type}] archive: $errmsg"
+                incr unsupported
+            }
+        }
+        if {$found == 1} {
+            ui_debug "Found [string toupper ${unarchive.type}] archive: ${unarchive.path}"
+        } else {
+            if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
+                return -code error "Archive for ${name} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
+            } else {
+                if {[llength [option portarchivetype]] == $unsupported} {
+                    ui_debug "Skipping unarchive ($name) since specified archive types not supported"
+                } else {
+                    ui_debug "Skipping unarchive ($name) since no archive found"
+                }
+                set skipped 1
+            }
+        }
+    }
+    # Skip unarchive target by setting state
+    if {$skipped == 1} {
+        write_statefile target "org.macports.unarchive" $target_state_fd
+    }
 
-	# Determine if unarchive should be skipped
-	set skipped 0
-	if {[check_statefile target org.macports.unarchive $target_state_fd]} {
-		return 0
-	} elseif {[info exists ports_source_only] && $ports_source_only == "yes"} {
-		ui_debug "Skipping unarchive ($name) since source-only is set"
-		set skipped 1
-	} elseif {[check_statefile target org.macports.destroot $target_state_fd]} {
-		ui_debug "Skipping unarchive ($name) since destroot completed"
-		set skipped 1
-	} elseif {[info exists ports_force] && $ports_force == "yes"} {
-		ui_debug "Skipping unarchive ($name) since force is set"
-		set skipped 1
-	} else {
-		set found 0
-		set unsupported 0
-		foreach unarchive.type [option portarchivetype] {
-			if {[catch {archiveTypeIsSupported ${unarchive.type}} errmsg] == 0} {
-				set unarchive.file "${name}-${version}_${revision}${portvariants}.[option os.arch].${unarchive.type}"
-				set unarchive.path "[file join ${unarchive.fullsrcpath} ${unarchive.file}]"
-				if {[file exist ${unarchive.path}]} {
-					set found 1
-					break
-				} else {
-					ui_debug "No [string toupper ${unarchive.type}] archive: ${unarchive.path}"
-				}
-			} else {
-				ui_debug "Skipping [string toupper ${unarchive.type}] archive: $errmsg"
-				set unsupported [expr $unsupported + 1]
-			}
-		}
-		if {$found == 1} {
-			ui_debug "Found [string toupper ${unarchive.type}] archive: ${unarchive.path}"
-		} else {
-			if {[info exists ports_binary_only] && $ports_binary_only == "yes"} {
-				return -code error "Archive for ${name} ${version}_${revision}${portvariants} not found, required when binary-only is set!"
-			} else {
-				if {[llength [option portarchivetype]] == $unsupported} {
-					ui_debug "Skipping unarchive ($name) since specified archive types not supported"
-				} else {
-					ui_debug "Skipping unarchive ($name) since no archive found"
-				}
-				set skipped 1
-			}
-		}
-	}
-	# Skip unarchive target by setting state
-	if {$skipped == 1} {
-		write_statefile target "org.macports.unarchive" $target_state_fd
-	}
-
-	return 0
+    return 0
 }
 
 proc portunarchive::unarchive_start {args} {
-	global UI_PREFIX name version revision portvariants
-	global unarchive.type
+    global UI_PREFIX name version revision portvariants
+    global unarchive.type
 
-	ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $name $version $revision $portvariants]"
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Unpacking ${unarchive.type} archive for %s %s_%s%s"] $name $version $revision $portvariants]"
 
-	return 0
+    return 0
 }
 
 proc portunarchive::unarchive_command_setup {args} {
-	global unarchive.env unarchive.cmd
-	global unarchive.pre_args unarchive.args unarchive.post_args
-	global unarchive.type unarchive.path
-	global unarchive.pipe_cmd
-	global os.platform os.version env
+    global unarchive.env unarchive.cmd
+    global unarchive.pre_args unarchive.args unarchive.post_args
+    global unarchive.type unarchive.path
+    global unarchive.pipe_cmd
+    global os.platform os.version env
 
-	# Define appropriate unarchive command and options
-	set unarchive.env {}
-	set unarchive.cmd {}
-	set unarchive.pre_args {}
-	set unarchive.args {}
-	set unarchive.post_args {}
-	set unarchive.pipe_cmd ""
-	switch -regex ${unarchive.type} {
-		cp(io|gz) {
-			set pax "pax"
-			if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
-				ui_debug "Using $pax"
-				set unarchive.cmd "$pax"
-				if {[info exists env(USER)] && $env(USER) == "root"} {
-					set unarchive.pre_args {-r -v -p e}
-				} else {
-					set unarchive.pre_args {-r -v -p p}
-				}
-				if {[regexp {z$} ${unarchive.type}]} {
-					set unarchive.args {.}
-					set gzip "gzip"
-					if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
-						ui_debug "Using $gzip"
-						set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
-					} else {
-						ui_debug $errmsg
-						return -code error "No '$gzip' was found on this system!"
-					}
-				} else {
-					set unarchive.args "-f ${unarchive.path} ."
-				}
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$pax' was found on this system!"
-			}
-		}
-		t(ar|bz|lz|xz|gz) {
-			set tar "tar"
-			if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
-				ui_debug "Using $tar"
-				set unarchive.cmd "$tar"
-				set unarchive.pre_args {-xvpf}
-				if {[regexp {z2?$} ${unarchive.type}]} {
-					set unarchive.args {-}
-					if {[regexp {bz2?$} ${unarchive.type}]} {
-						set gzip "bzip2"
-					} elseif {[regexp {lz$} ${unarchive.type}]} {
-						set gzip "lzma"
-					} elseif {[regexp {xz$} ${unarchive.type}]} {
-						set gzip "xz"
-					} else {
-						set gzip "gzip"
-					}
-					if {[info exists portutil::autoconf::${gzip}_path]} {
-					    set hint [set portutil::autoconf::${gzip}_path]
-					} else {
-					    set hint ""
-					}
-					if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
-						ui_debug "Using $gzip"
-						set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
-					} else {
-						ui_debug $errmsg
-						return -code error "No '$gzip' was found on this system!"
-					}
-				} else {
-					set unarchive.args "${unarchive.path}"
-				}
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$tar' was found on this system!"
-			}
-		}
-		xar {
-			set xar "xar"
-			if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
-				ui_debug "Using $xar"
-				set unarchive.cmd "$xar"
-				set unarchive.pre_args {-xvpf}
-				set unarchive.args "${unarchive.path}"
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$xar' was found on this system!"
-			}
-		}
-		zip {
-			set unzip "unzip"
-			if {[catch {set unzip [findBinary $unzip ${portutil::autoconf::unzip_path}]} errmsg] == 0} {
-				ui_debug "Using $unzip"
-				set unarchive.cmd "$unzip"
-				if {[info exists env(USER)] && $env(USER) == "root"} {
-					set unarchive.pre_args {-oX}
-				} else {
-					set unarchive.pre_args {-o}
-				}
-				set unarchive.args "${unarchive.path} -d ."
-			} else {
-				ui_debug $errmsg
-				return -code error "No '$unzip' was found on this system!"
-			}
-		}
-		default {
-			return -code error "Invalid port archive type '${unarchive.type}' specified!"
-		}
-	}
+    # Define appropriate unarchive command and options
+    set unarchive.env {}
+    set unarchive.cmd {}
+    set unarchive.pre_args {}
+    set unarchive.args {}
+    set unarchive.post_args {}
+    set unarchive.pipe_cmd ""
+    switch -regex ${unarchive.type} {
+        cp(io|gz) {
+            set pax "pax"
+            if {[catch {set pax [findBinary $pax ${portutil::autoconf::pax_path}]} errmsg] == 0} {
+                ui_debug "Using $pax"
+                set unarchive.cmd "$pax"
+                if {[info exists env(USER)] && $env(USER) == "root"} {
+                    set unarchive.pre_args {-r -v -p e}
+                } else {
+                    set unarchive.pre_args {-r -v -p p}
+                }
+                if {[regexp {z$} ${unarchive.type}]} {
+                    set unarchive.args {.}
+                    set gzip "gzip"
+                    if {[catch {set gzip [findBinary $gzip ${portutil::autoconf::gzip_path}]} errmsg] == 0} {
+                        ui_debug "Using $gzip"
+                        set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
+                    } else {
+                        ui_debug $errmsg
+                        return -code error "No '$gzip' was found on this system!"
+                    }
+                } else {
+                    set unarchive.args "-f ${unarchive.path} ."
+                }
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$pax' was found on this system!"
+            }
+        }
+        t(ar|bz|lz|xz|gz) {
+            set tar "tar"
+            if {[catch {set tar [findBinary $tar ${portutil::autoconf::tar_path}]} errmsg] == 0} {
+                ui_debug "Using $tar"
+                set unarchive.cmd "$tar"
+                set unarchive.pre_args {-xvpf}
+                if {[regexp {z2?$} ${unarchive.type}]} {
+                    set unarchive.args {-}
+                    if {[regexp {bz2?$} ${unarchive.type}]} {
+                        set gzip "bzip2"
+                    } elseif {[regexp {lz$} ${unarchive.type}]} {
+                        set gzip "lzma"
+                    } elseif {[regexp {xz$} ${unarchive.type}]} {
+                        set gzip "xz"
+                    } else {
+                        set gzip "gzip"
+                    }
+                    if {[info exists portutil::autoconf::${gzip}_path]} {
+                        set hint [set portutil::autoconf::${gzip}_path]
+                    } else {
+                        set hint ""
+                    }
+                    if {[catch {set gzip [findBinary $gzip $hint]} errmsg] == 0} {
+                        ui_debug "Using $gzip"
+                        set unarchive.pipe_cmd "$gzip -d -c ${unarchive.path} |"
+                    } else {
+                        ui_debug $errmsg
+                        return -code error "No '$gzip' was found on this system!"
+                    }
+                } else {
+                    set unarchive.args "${unarchive.path}"
+                }
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$tar' was found on this system!"
+            }
+        }
+        xar {
+            set xar "xar"
+            if {[catch {set xar [findBinary $xar ${portutil::autoconf::xar_path}]} errmsg] == 0} {
+                ui_debug "Using $xar"
+                set unarchive.cmd "$xar"
+                set unarchive.pre_args {-xvpf}
+                set unarchive.args "${unarchive.path}"
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$xar' was found on this system!"
+            }
+        }
+        zip {
+            set unzip "unzip"
+            if {[catch {set unzip [findBinary $unzip ${portutil::autoconf::unzip_path}]} errmsg] == 0} {
+                ui_debug "Using $unzip"
+                set unarchive.cmd "$unzip"
+                if {[info exists env(USER)] && $env(USER) == "root"} {
+                    set unarchive.pre_args {-oX}
+                } else {
+                    set unarchive.pre_args {-o}
+                }
+                set unarchive.args "${unarchive.path} -d ."
+            } else {
+                ui_debug $errmsg
+                return -code error "No '$unzip' was found on this system!"
+            }
+        }
+        default {
+            return -code error "Invalid port archive type '${unarchive.type}' specified!"
+        }
+    }
 
-	return 0
+    return 0
 }
 
 proc portunarchive::unarchive_main {args} {
-	global UI_PREFIX
-	global name version revision portvariants
-	global unarchive.dir unarchive.file unarchive.pipe_cmd
+    global UI_PREFIX
+    global unarchive.dir unarchive.file unarchive.pipe_cmd
 
-	# Setup unarchive command
-	unarchive_command_setup
+    # Setup unarchive command
+    unarchive_command_setup
 
-	# Create destination directory for unpacking
-	if {![file isdirectory ${unarchive.dir}]} {
-		file mkdir ${unarchive.dir}
-	}
+    # Create destination directory for unpacking
+    if {![file isdirectory ${unarchive.dir}]} {
+        file mkdir ${unarchive.dir}
+    }
 
-	# Unpack the archive
-	ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] ${unarchive.file}]"
-	if {${unarchive.pipe_cmd} == ""} {
-		command_exec unarchive
-	} else {
-		command_exec unarchive "${unarchive.pipe_cmd} (" ")"
-	}
+    # Unpack the archive
+    ui_info "$UI_PREFIX [format [msgcat::mc "Extracting %s"] ${unarchive.file}]"
+    if {${unarchive.pipe_cmd} == ""} {
+        command_exec unarchive
+    } else {
+        command_exec unarchive "${unarchive.pipe_cmd} (" ")"
+    }
 
-	return 0
+    return 0
 }
 
 proc portunarchive::unarchive_finish {args} {
-	global UI_PREFIX target_state_fd unarchive.file name workpath destpath
+    global UI_PREFIX target_state_fd unarchive.file name workpath destpath
 
-	# Reset state file with archive version
+    # Reset state file with archive version
     set statefile [file join $workpath .macports.${name}.state]
-	file copy -force [file join $destpath "+STATE"] $statefile
-	file mtime $statefile [clock seconds]
+    file copy -force [file join $destpath "+STATE"] $statefile
+    file mtime $statefile [clock seconds]
 
 # Hack to temporarily move com.apple.* strings in statefiles extracted from old archives
 # to the org.macports.* namespace. "temporarily" because old archives will still have a
@@ -307,7 +299,7 @@
     set fd_new_sf [open $statefile r]
     set fd_tmp [open ${statefile}.tmp w+]
     while {[gets $fd_new_sf line] >= 0} {
-	puts $fd_tmp "[regsub com.apple $line org.macports]"
+    puts $fd_tmp "[regsub com.apple $line org.macports]"
     }
     close $fd_new_sf
     close $fd_tmp
@@ -316,14 +308,13 @@
     # Update the state from unpacked archive version
     set target_state_fd [open_statefile]
     
-	# Cleanup all control files when finished
-	set control_files [glob -nocomplain -types f [file join $destpath +*]]
-	foreach file $control_files {
-		ui_debug "Removing $file"
-		file delete -force $file
-	}
+    # Cleanup all control files when finished
+    set control_files [glob -nocomplain -types f [file join $destpath +*]]
+    foreach file $control_files {
+        ui_debug "Removing $file"
+        file delete -force $file
+    }
 
-	ui_info "$UI_PREFIX [format [msgcat::mc "Archive %s unpacked"] ${unarchive.file}]"
-	return 0
+    ui_info "$UI_PREFIX [format [msgcat::mc "Archive %s unpacked"] ${unarchive.file}]"
+    return 0
 }
-

Modified: branches/new-help-system/base/src/pextlib1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,8 +1,10 @@
-OBJS=		Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
-		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
-		sha1cmd.o curl.o rmd160cmd.o readline.o uid.o\
-		tracelib.o tty.o get_systemconfiguration_proxies.o
-SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
+OBJS= \
+	Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
+	fs-traverse.o strcasecmp.o vercomp.o filemap.o \
+	sha1cmd.o curl.o rmd160cmd.o sha256cmd.o readline.o uid.o \
+	tracelib.o tty.o readdir.o pipe.o flock.o \
+	system.o mktemp.o realpath.o
+SHLIB_NAME= Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 
 include ../../Mk/macports.autoconf.mk
@@ -10,9 +12,6 @@
 
 CFLAGS+= ${CURL_CFLAGS} ${MD5_CFLAGS} ${READLINE_CFLAGS}
 LIBS+= ${CURL_LIBS} ${MD5_LIBS} ${READLINE_LIBS}
-ifeq ($(OBJC_RUNTIME), APPLE_RUNTIME)
-   LIBS+= -framework CoreFoundation -framework SystemConfiguration
-endif
 
 .PHONY: test
 

Modified: branches/new-help-system/base/src/pextlib1.0/Pextlib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -36,73 +36,31 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
 #include <ctype.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <grp.h>
+#include <limits.h>
+#include <pwd.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#if HAVE_STRINGS_H
 #include <strings.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#if HAVE_PATHS_H
-#include <paths.h>
-#endif
-
-#ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL   "/dev/null"
-#endif
-
-#include <pwd.h>
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-
-#if HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#if HAVE_UNISTD_H
 #include <unistd.h>
-#endif
 
-#if HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
 #include <tcl.h>
 
+#include "Pextlib.h"
+
 #include "md5cmd.h"
 #include "sha1cmd.h"
 #include "rmd160cmd.h"
+#include "sha256cmd.h"
 #include "fs-traverse.h"
 #include "filemap.h"
 #include "curl.h"
@@ -112,7 +70,13 @@
 #include "uid.h"
 #include "tracelib.h"
 #include "tty.h"
-#include "get_systemconfiguration_proxies.h"
+#include "strsed.h"
+#include "readdir.h"
+#include "pipe.h"
+#include "flock.h"
+#include "system.h"
+#include "mktemp.h"
+#include "realpath.h"
 
 #if HAVE_CRT_EXTERNS_H
 #include <crt_externs.h>
@@ -121,18 +85,10 @@
 extern char **environ;
 #endif
 
-#if !HAVE_BZERO
-#if HAVE_MEMSET
-#define bzero(b, len) (void)memset(b, 0x00, len)
-#endif
-#endif
-
 #if !HAVE_FGETLN
 char *fgetln(FILE *stream, size_t *len);
 #endif
 
-#define CBUFSIZ 30
-
 static char *
 ui_escape(const char *source)
 {
@@ -200,513 +156,10 @@
 	return rval;
 }
 
-struct linebuf {
-	size_t len;
-	char *line;
-};
-
-int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	char *buf;
-	struct linebuf circbuf[CBUFSIZ];
-	size_t linelen;
-	char *args[4];
-	char *cmdstring;
-	FILE *pdes;
-	int fdset[2], nullfd;
-	int fline, pos, ret;
-	int osetsid = 0;
-	pid_t pid;
-	Tcl_Obj *errbuf;
-	Tcl_Obj *tcl_result;
-	int read_failed, status;
-
-	/* usage: system [-notty] command */
-	if (objc == 2) {
-		cmdstring = Tcl_GetString(objv[1]);
-	} else if (objc == 3) {
-		char *arg = Tcl_GetString(objv[1]);
-		cmdstring = Tcl_GetString(objv[2]);
-
-		if (strcmp(arg, "-notty") == 0) {
-			osetsid = 1;
-		} else {
-			tcl_result = Tcl_NewStringObj("bad option ", -1);
-			Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(arg, -1));
-			Tcl_SetObjResult(interp, tcl_result);
-			return TCL_ERROR;
-		}
-	} else {
-		Tcl_WrongNumArgs(interp, 1, objv, "command");
-		return TCL_ERROR;
-	}
-
-	/*
-	 * Fork a child to run the command, in a popen() like fashion -
-	 * popen() itself is not used because stderr is also desired.
-	 */
-	if (pipe(fdset) != 0) {
-		return TCL_ERROR;
-	}
-
-	pid = fork();
-	switch (pid) {
-	case -1: /* error */
-		return TCL_ERROR;
-		break;
-	case 0: /* child */
-		close(fdset[0]);
-
-		if ((nullfd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
-			_exit(1);
-		dup2(nullfd, STDIN_FILENO);
-		dup2(fdset[1], STDOUT_FILENO);
-		dup2(fdset[1], STDERR_FILENO);
-		/* drop the controlling terminal if requested */
-		if (osetsid) {
-			if (setsid() == -1)
-				_exit(1);
-		}
-		/* XXX ugly string constants */
-		args[0] = "sh";
-		args[1] = "-c";
-		args[2] = cmdstring;
-		args[3] = NULL;
-		execve("/bin/sh", args, environ);
-		_exit(1);
-		break;
-	default: /* parent */
-		break;
-	}
-
-	close(fdset[1]);
-
-	/* read from simulated popen() pipe */
-	read_failed = 0;
-	pos = 0;
-	bzero(circbuf, sizeof(circbuf));
-	pdes = fdopen(fdset[0], "r");
-	while ((buf = fgetln(pdes, &linelen)) != NULL) {
-		char *sbuf;
-		int slen;
-
-		/*
-		 * Allocate enough space to insert a terminating
-		 * '\0' if the line is not terminated with a '\n'
-		 */
-		if (buf[linelen - 1] == '\n')
-			slen = linelen;
-		else
-			slen = linelen + 1;
-
-		if (circbuf[pos].len == 0)
-			sbuf = malloc(slen);
-		else {
-			sbuf = realloc(circbuf[pos].line, slen);
-		}
-
-		if (sbuf == NULL) {
-			read_failed = 1;
-			break;
-		}
-
-		memcpy(sbuf, buf, linelen);
-		/* terminate line with '\0',replacing '\n' if it exists */
-		sbuf[slen - 1] = '\0';
-
-		circbuf[pos].line = sbuf;
-		circbuf[pos].len = slen;
-
-		if (pos++ == CBUFSIZ - 1) {
-			pos = 0;
-		}
-
-		if (ui_info(interp, sbuf) != TCL_OK) {
-			read_failed = 1;
-			break;
-		}
-	}
-	fclose(pdes);
-
-	status = TCL_ERROR;
-
-	if (wait(&ret) == pid && WIFEXITED(ret) && !read_failed) {
-		/* Normal exit, and reading from the pipe didn't fail. */
-		if (WEXITSTATUS(ret) == 0) {
-			status = TCL_OK;
-		} else {
-			/* Copy the contents of the circular buffer to errbuf */
-		  	Tcl_Obj* errorCode;
-			errbuf = Tcl_NewStringObj(NULL, 0);
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len == 0)
-				continue; /* skip empty lines */
-
-				/* Append line, minus trailing NULL */
-				Tcl_AppendToObj(errbuf, circbuf[pos % CBUFSIZ].line,
-						circbuf[pos % CBUFSIZ].len - 1);
-
-				/* Re-add previously stripped newline */
-				Tcl_AppendToObj(errbuf, "\n", 1);
-			}
-
-			/* set errorCode [list CHILDSTATUS <pid> <code>] */
-			errorCode = Tcl_NewListObj(0, NULL);
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_SetObjErrorCode(interp, errorCode);
-
-			/* set result */
-			tcl_result = Tcl_NewStringObj("shell command \"", -1);
-			Tcl_AppendToObj(tcl_result, cmdstring, -1);
-			Tcl_AppendToObj(tcl_result, "\" returned error ", -1);
-			Tcl_AppendObjToObj(tcl_result, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
-			Tcl_AppendObjToObj(tcl_result, errbuf);
-			Tcl_SetObjResult(interp, tcl_result);
-		}
-	}
-
-	/* Cleanup. */
-	close(fdset[0]);
-	for (fline = 0; fline < CBUFSIZ; fline++) {
-		if (circbuf[fline].len != 0) {
-			free(circbuf[fline].line);
-		}
-	}
-
-	return status;
-}
-
-int SudoCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	char *buf;
-	struct linebuf circbuf[CBUFSIZ];
-	size_t linelen;
-	char *args[4];
-	char *cmdstring, *passwd;
-	FILE *pdes;
-	int fdset[2];
-	int fline, pos, ret;
-	pid_t pid;
-	Tcl_Obj *errbuf;
-	Tcl_Obj *tcl_result;
-
-	if (objc != 3) {
-		Tcl_WrongNumArgs(interp, 1, objv, "password command");
-		return TCL_ERROR;
-	}
-	passwd = Tcl_GetString(objv[1]);
-	cmdstring = Tcl_GetString(objv[2]);
-
-	if (pipe(fdset) == -1)
-		return TCL_ERROR;
-
-	/*
-	 * Fork a child to run the command, in a popen() like fashion -
-	 * popen() itself is not used because stderr is also desired.
-	 */
-	pid = fork();
-	if (pid == -1)
-		return TCL_ERROR;
-	if (pid == 0) {
-		dup2(fdset[0], STDIN_FILENO);
-		dup2(fdset[1], STDOUT_FILENO);
-		dup2(fdset[1], STDERR_FILENO);
-		args[0] = "sudo";
-		args[1] = "-S";
-		args[2] = cmdstring;
-		args[3] = NULL;
-		execve("/usr/bin/sudo", args, environ);
-		/* Now throw away the privs we just acquired */
-		args[1] = "-k";
-		args[2] = NULL;
-		execve("/usr/bin/sudo", args, environ);
-		_exit(1);
-	} else {
-		write(fdset[1], passwd, strlen(passwd));
-		write(fdset[1], "\n", 1);
-		close(fdset[1]);
-	}
-	pdes = fdopen(fdset[0], "r");
-
-	/* read from simulated popen() pipe */
-	pos = 0;
-	bzero(circbuf, sizeof(circbuf));
-	while ((buf = fgetln(pdes, &linelen)) != NULL) {
-		char *sbuf;
-		int slen;
-
-		/*
-		 * Allocate enough space to insert a terminating
-		 * '\0' if the line is not terminated with a '\n'
-		 */
-		if (buf[linelen - 1] == '\n')
-			slen = linelen;
-		else
-			slen = linelen + 1;
-
-		if (circbuf[pos].len == 0)
-			sbuf = malloc(slen);
-		else {
-			sbuf = realloc(circbuf[pos].line, slen);
-		}
-
-		if (sbuf == NULL) {
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len != 0)
-					free(circbuf[pos % CBUFSIZ].line);
-			}
-			return TCL_ERROR;
-		}
-
-		memcpy(sbuf, buf, linelen);
-		/* terminate line with '\0',replacing '\n' if it exists */
-		sbuf[slen - 1] = '\0';
-
-		circbuf[pos].line = sbuf;
-		circbuf[pos].len = slen;
-
-		if (pos++ == CBUFSIZ - 1)
-			pos = 0;
-		ret = ui_info(interp, sbuf);
-		if (ret != TCL_OK) {
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len != 0)
-					free(circbuf[pos % CBUFSIZ].line);
-			}
-			return ret;
-		}
-	}
-	fclose(pdes);
-
-	if (wait(&ret) != pid)
-		return TCL_ERROR;
-	if (WIFEXITED(ret)) {
-		if (WEXITSTATUS(ret) == 0)
-			return TCL_OK;
-		else {
-			/* Copy the contents of the circular buffer to errbuf */
-		  	Tcl_Obj* errorCode;
-			errbuf = Tcl_NewStringObj(NULL, 0);
-			for (fline = pos; pos < fline + CBUFSIZ; pos++) {
-				if (circbuf[pos % CBUFSIZ].len == 0)
-				continue; /* skip empty lines */
-
-				/* Append line, minus trailing NULL */
-				Tcl_AppendToObj(errbuf, circbuf[pos % CBUFSIZ].line,
-						circbuf[pos % CBUFSIZ].len - 1);
-
-				/* Re-add previously stripped newline */
-				Tcl_AppendToObj(errbuf, "\n", 1);
-				free(circbuf[pos % CBUFSIZ].line);
-			}
-
-			/* set errorCode [list CHILDSTATUS <pid> <code>] */
-			errorCode = Tcl_NewListObj(0, NULL);
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
-			Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_SetObjErrorCode(interp, errorCode);
-
-			/* set result */
-			tcl_result = Tcl_NewStringObj("sudo command \"", -1);
-			Tcl_AppendToObj(tcl_result, cmdstring, -1);
-			Tcl_AppendToObj(tcl_result, "\" returned error ", -1);
-			Tcl_AppendObjToObj(tcl_result, Tcl_NewIntObj(WEXITSTATUS(ret)));
-			Tcl_AppendToObj(tcl_result, "\nCommand output: ", -1);
-			Tcl_AppendObjToObj(tcl_result, errbuf);
-			Tcl_SetObjResult(interp, tcl_result);
-			return TCL_ERROR;
-		}
-	} else
-		return TCL_ERROR;
-}
-
-int FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
-	int operation = 0, fd, i, ret;
-	int errnoval = 0;
-	int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0;
-#if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
-	off_t curpos;
-#endif
-	char *res;
-	Tcl_Channel channel;
-	ClientData handle;
-
-	if (objc < 3 || objc > 4) {
-		Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
-		return TCL_ERROR;
-	}
-
-    	if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL)
-		return TCL_ERROR;
-
-	if (Tcl_GetChannelHandle(channel, TCL_READABLE|TCL_WRITABLE, &handle) != TCL_OK) {
-		Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
-		return TCL_ERROR;
-	}
-	fd = (int)(intptr_t)handle;
-
-	for (i = 2; i < objc; i++) {
-		char *arg = Tcl_GetString(objv[i]);
-		if (!strcmp(arg, "-shared")) {
-		  oshared = 1;
-		} else if (!strcmp(arg, "-exclusive")) {
-		  oexclusive = 1;
-		} else if (!strcmp(arg, "-unlock")) {
-		  ounlock = 1;
-		} else if (!strcmp(arg, "-noblock")) {
-		  onoblock = 1;
-		}
-	}
-
-	/* verify the arguments */
-
-	if((oshared + oexclusive + ounlock) != 1) {
-	  /* only one of the options should have been specified */
-	  Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
-	  return TCL_ERROR;
-	}
-
-	if(onoblock && ounlock) {
-	  /* should not be specified together */
-	  Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
-	  return TCL_ERROR;
-	}
-	  
-#if HAVE_FLOCK
-	/* prefer flock if present */
-	if(oshared) operation |= LOCK_SH;
-
-	if(oexclusive) operation |= LOCK_EX;
-
-	if(ounlock) operation |= LOCK_UN;
-
-	if(onoblock) operation |= LOCK_NB;
-
-	ret = flock(fd, operation);
-	if(ret == -1) {
-	  errnoval = errno;
-	}
-#else
-#if HAVE_LOCKF
-	if(ounlock) operation = F_ULOCK;
-
-	/* lockf semantics don't map to shared locks. */
-	if(oshared || oexclusive) {
-	  if(onoblock) {
-	    operation = F_TLOCK;
-	  } else {
-	    operation = F_LOCK;
-	  }
-	}
-
-	curpos = lseek(fd, 0, SEEK_CUR);
-	if(curpos == -1) {
-		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-		return TCL_ERROR;
-	}
-
-	ret = lockf(fd, operation, 0); /* lock entire file */
-
-	curpos = lseek(fd, curpos, SEEK_SET);
-	if(curpos == -1) {
-		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
-		return TCL_ERROR;
-	}
-
-	if(ret == -1) {
-	  errnoval = errno;
-	  if((oshared || oexclusive)) {
-	    /* map the errno val to what we would expect for flock */
-	    if(onoblock && errnoval == EAGAIN) {
-	      /* on some systems, EAGAIN=EWOULDBLOCK, but lets be safe */
-	      errnoval = EWOULDBLOCK;
-	    } else if(errnoval == EINVAL) {
-	      errnoval = EOPNOTSUPP;
-	    }
-	  }
-	}
-#else
-#error no available locking implementation
-#endif /* HAVE_LOCKF */
-#endif /* HAVE_FLOCK */
-
-	if (ret != 0)
-	{
-		switch(errnoval) {
-			case EAGAIN:
-				res = "EAGAIN";
-				break;
-			case EBADF:
-				res = "EBADF";
-				break;
-			case EINVAL:
-				res = "EINVAL";
-				break;
-			case EOPNOTSUPP:
-				res = "EOPNOTSUPP";
-				break;
-			default:
-				res = strerror(errno);
-				break;
-		}
-		Tcl_SetResult(interp, (void *) res, TCL_STATIC);
-		return TCL_ERROR;
-	}
-	return TCL_OK;
-}
-
-/**
- *
- * Return the list of elements in a directory.
- * Since 1.60.4.2, the list doesn't include . and ..
- *
- * Synopsis: readdir directory
- */
-int ReaddirCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	DIR *dirp;
-	struct dirent *mp;
-	Tcl_Obj *tcl_result;
-	char *path;
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "directory");
-		return TCL_ERROR;
-	}
-
-	path = Tcl_GetString(objv[1]);
-	dirp = opendir(path);
-	if (!dirp) {
-		Tcl_SetResult(interp, "Cannot read directory", TCL_STATIC);
-		return TCL_ERROR;
-	}
-	tcl_result = Tcl_NewListObj(0, NULL);
-	while ((mp = readdir(dirp))) {
-		/* Skip . and .. */
-		if ((mp->d_name[0] != '.') ||
-			((mp->d_name[1] != 0)	/* "." */
-				&&
-			((mp->d_name[1] != '.') || (mp->d_name[2] != 0)))) /* ".." */ {
-			Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewStringObj(mp->d_name, -1));
-		}
-	}
-	closedir(dirp);
-	Tcl_SetObjResult(interp, tcl_result);
-	
-	return TCL_OK;
-}
-
 int StrsedCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	char *pattern, *string, *res;
 	int range[2];
-	extern char *strsed(char *str, char *pat, int *range);
 	Tcl_Obj *tcl_result;
 
 	if (objc != 3) {
@@ -727,87 +180,6 @@
 	return TCL_OK;
 }
 
-int MkdtempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	char *template, *sp;
-	Tcl_Obj *tcl_result;
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "template");
-		return TCL_ERROR;
-	}
-
-	template = strdup(Tcl_GetString(objv[1]));
-	if (template == NULL)
-		return TCL_ERROR;
-
-	if ((sp = mkdtemp(template)) == NULL) {
-		Tcl_AppendResult(interp, "mkdtemp failed: ", strerror(errno), NULL);
-		free(template);
-		return TCL_ERROR;
-	}
-
-	tcl_result = Tcl_NewStringObj(sp, -1);
-	Tcl_SetObjResult(interp, tcl_result);
-	free(template);
-	return TCL_OK;
-}
-
-int MktempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	char *template, *sp;
-	Tcl_Obj *tcl_result;
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "template");
-		return TCL_ERROR;
-	}
-
-	template = strdup(Tcl_GetString(objv[1]));
-	if (template == NULL)
-		return TCL_ERROR;
-
-	if ((sp = mktemp(template)) == NULL) {
-		Tcl_AppendResult(interp, "mktemp failed: ", strerror(errno), NULL);
-		free(template);
-		return TCL_ERROR;
-	}
-
-	tcl_result = Tcl_NewStringObj(sp, -1);
-	Tcl_SetObjResult(interp, tcl_result);
-	free(template);
-	return TCL_OK;
-}
-
-int MkstempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	Tcl_Channel channel;
-	char *template, *channelname;
-	int fd;
-
-	if (objc != 2) {
-		Tcl_WrongNumArgs(interp, 1, objv, "template");
-		return TCL_ERROR;
-	}
-
-	template = strdup(Tcl_GetString(objv[1]));
-	if (template == NULL)
-		return TCL_ERROR;
-
-	if ((fd = mkstemp(template)) < 0) {
-		Tcl_AppendResult(interp, "mkstemp failed: ", strerror(errno), NULL);
-		free(template);
-		return TCL_ERROR;
-	}
-
-	channel = Tcl_MakeFileChannel((ClientData)(intptr_t)fd, TCL_READABLE|TCL_WRITABLE);
-	Tcl_RegisterChannel(interp, channel);
-	channelname = (char *)Tcl_GetChannelName(channel);
-	Tcl_AppendResult(interp, channelname, " ", template, NULL);
-	free(template);
-	return TCL_OK;
-}
-
 int ExistsuserCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Tcl_Obj *tcl_result;
@@ -862,28 +234,26 @@
 	return TCL_OK;
 }
 
-/* Find the first unused UID > 100
-   previously this would find the highest used UID and add 1
-   but UIDs > 500 are visible on the login screen of OS X */
+/* Find the first unused UID > 500
+   UIDs > 500 are visible on the login screen of OS X,
+   but UIDs < 500 are reserved by Apple */
 int NextuidCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
 {
 	Tcl_Obj *tcl_result;
 	int cur;
 
 	cur = MIN_USABLE_UID;
-	
+
 	while (getpwuid(cur) != NULL) {
 		cur++;
 	}
-	
+
 	tcl_result = Tcl_NewIntObj(cur);
 	Tcl_SetObjResult(interp, tcl_result);
 	return TCL_OK;
 }
 
-/* Just as with NextuidCmd, return the first unused gid > 100
-   groups aren't visible on the login screen, but I see no reason
-   to create group 502 when I can create group 100 */
+/* Just as with NextuidCmd, return the first unused gid > 500 */
 int NextgidCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
 {
 	Tcl_Obj *tcl_result;
@@ -894,7 +264,7 @@
 	while (getgrgid(cur) != NULL) {
 		cur++;
 	}
-	
+
 	tcl_result = Tcl_NewIntObj(cur);
 	Tcl_SetObjResult(interp, tcl_result);
 	return TCL_OK;
@@ -952,39 +322,6 @@
 }
 
 /**
- * Call pipe(2) to create a pipe.
- * Syntax is:
- * pipe
- *
- * Generate a Tcl error if something goes wrong.
- * Return a list with the file descriptors of the pipe. The first item is the
- * readable fd.
- */
-int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
-{
-	Tcl_Obj* result;
-	int fildes[2];
-
-	if (objc != 1) {
-		Tcl_WrongNumArgs(interp, 1, objv, NULL);
-		return TCL_ERROR;
-	}
-	
-	if (pipe(fildes) < 0) {
-		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
-		return TCL_ERROR;
-	}
-	
-	/* build a list out of the couple */
-	result = Tcl_NewListObj(0, NULL);
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
-	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
-	Tcl_SetObjResult(interp, result);
-
-	return TCL_OK;
-}
-
-/**
  * symlink value target
  * Create a symbolic link at target pointing to value
  * See symlink(2) for possible errors
@@ -992,17 +329,19 @@
 int CreateSymlinkCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
     char *value, *target;
-    
+
     if (objc != 3) {
         Tcl_WrongNumArgs(interp, 1, objv, "value target");
         return TCL_ERROR;
     }
-    
+
     value = Tcl_GetString(objv[1]);
     target = Tcl_GetString(objv[2]);
-    
+
     if (symlink(value, target) != 0) {
-        Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
+        Tcl_SetErrno(errno);
+        Tcl_ResetResult(interp);
+        Tcl_AppendResult(interp, "symlink: ", target, " -> ", value, ": ", (char *)Tcl_PosixError(interp), NULL);
         return TCL_ERROR;
     }
     return TCL_OK;
@@ -1024,7 +363,7 @@
     int listLength;
     Tcl_Obj **listArray;
     int loopCounter;
-    
+
     if (objc != 2) {
         Tcl_WrongNumArgs(interp, 1, objv, "name");
         return TCL_ERROR;
@@ -1064,7 +403,7 @@
         (void) unsetenv(name);
     }
     /* Tcl appears to become out of sync with the environment when we
-       unset things, eg, 'info exists env(CC)' will succeed where
+       unset things, e.g. 'info exists env(CC)' will succeed where
        'puts $env(CC)' will fail since it doesn't actually exist after
        being unset here.  This forces Tcl to resync to the current state
        (don't care about the actual result, so reset it) */
@@ -1114,7 +453,9 @@
         }
     }
     if (lchown(path, (uid_t) user, (gid_t) group) != 0) {
-        Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
+        Tcl_SetErrno(errno);
+        Tcl_ResetResult(interp);
+        Tcl_AppendResult(interp, "lchown: ", path, ": ", (char *)Tcl_PosixError(interp), NULL);
         return TCL_ERROR;
     }
 
@@ -1143,18 +484,19 @@
 	Tcl_CreateObjCommand(interp, "filemap", FilemapCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rpm-vercomp", RPMVercompCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rmd160", RMD160Cmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "sha256", SHA256Cmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "sha1", SHA1Cmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "umask", UmaskCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "sudo", SudoCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "pipe", PipeCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "curl", CurlCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "symlink", CreateSymlinkCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "unsetenv", UnsetEnvCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "lchown", lchownCmd, NULL, NULL);
-	
+	Tcl_CreateObjCommand(interp, "realpath", RealpathCmd, NULL, NULL);
+
 	Tcl_CreateObjCommand(interp, "readline", ReadlineCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "rl_history", RLHistoryCmd, NULL, NULL);
-	
+
 	Tcl_CreateObjCommand(interp, "getuid", getuidCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "geteuid", geteuidCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "getgid", getgidCmd, NULL, NULL);
@@ -1168,17 +510,13 @@
 	Tcl_CreateObjCommand(interp, "uname_to_gid", uname_to_gidCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "name_to_gid", name_to_gidCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "gid_to_name", gid_to_nameCmd, NULL, NULL);
-	
+
 	Tcl_CreateObjCommand(interp, "tracelib", TracelibCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "isatty", IsattyCmd, NULL, NULL);
 	Tcl_CreateObjCommand(interp, "term_get_size", TermGetSizeCmd, NULL, NULL);
-	Tcl_CreateObjCommand(interp, "get_systemconfiguration_proxies", GetSystemConfigurationProxiesCmd, NULL, NULL);
 
 	if (Tcl_PkgProvide(interp, "Pextlib", "1.0") != TCL_OK)
 		return TCL_ERROR;
 
-	/* init libcurl */
-	CurlInit(interp);
-
 	return TCL_OK;
 }

Copied: branches/new-help-system/base/src/pextlib1.0/Pextlib.h (from rev 65586, trunk/base/src/pextlib1.0/Pextlib.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/Pextlib.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/Pextlib.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * Pextlib.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int ui_info(Tcl_Interp *, char *);

Modified: branches/new-help-system/base/src/pextlib1.0/curl.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/curl.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/curl.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -36,13 +36,12 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <pthread.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
-#ifdef HAVE_UTIME_H
 #include <utime.h>
-#endif
 
 #include <curl/curl.h>
 
@@ -54,9 +53,9 @@
  * Some compiled-in constants that we may wish to change later, given more
  * empirical data.  These represent "best guess" values for now.
  */
-#define _CURL_CONNECTION_TIMEOUT	((long)(5 * 60))	/* 5 minutes */
+#define _CURL_CONNECTION_TIMEOUT	((long)(30))		/* 30 seconds */
 #define _CURL_MINIMUM_XFER_SPEED	((long)1024)		/* 1Kb/sec */
-#define _CURL_MINIMUM_XFER_TIMEOUT	((long)(10 * 60))	/* 10 minutes */
+#define _CURL_MINIMUM_XFER_TIMEOUT	((long)(60))		/* 1 minute */
 
 /* ========================================================================= **
  * Definitions
@@ -71,6 +70,8 @@
 int CurlIsNewerCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 int CurlGetSizeCmd(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
 
+void CurlInit(void);
+
 /* ========================================================================= **
  * Entry points
  * ========================================================================= */
@@ -86,30 +87,18 @@
  * @return TCL_OK if inErrorCode is 0, TCL_ERROR otherwise.
  */
 int
-SetResultFromCurlErrorCode(Tcl_Interp* interp, CURLcode inErrorCode)
+SetResultFromCurlErrorCode(Tcl_Interp *interp, CURLcode inErrorCode)
 {
-	int theResult;
+	int result = TCL_ERROR;
 
-	switch(inErrorCode)
-	{
-		case CURLE_OK:
-			Tcl_SetResult(interp, "", TCL_STATIC);
-			theResult = TCL_OK;
-			break;
-		
-		default: {
-#if LIBCURL_VERSION_NUM >= 0x070c00 /* 7.12.0 */
-			Tcl_SetResult(interp, (char *)curl_easy_strerror(inErrorCode), TCL_VOLATILE);
-#else
-			char theErrorString[512];
-			(void)snprintf(theErrorString, sizeof(theErrorString), "curl error %i", inErrorCode);
-			Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
-#endif
-			theResult = TCL_ERROR;
-		}
+	if (inErrorCode == CURLE_OK) {
+		Tcl_SetResult(interp, "", TCL_STATIC);
+		result = TCL_OK;
+	} else {
+		Tcl_SetResult(interp, (char *)curl_easy_strerror(inErrorCode), TCL_VOLATILE);
 	}
-	
-	return theResult;
+
+	return result;
 }
 
 /**
@@ -127,9 +116,10 @@
 	int theResult = TCL_OK;
 	CURL* theHandle = NULL;
 	FILE* theFile = NULL;
+	bool performFailed = false;
+	char theErrorString[CURL_ERROR_SIZE];
 
 	do {
-		long theResponseCode = 0;
 		int noprogress = 1;
 		int useepsv = 1;
 		int ignoresslcert = 0;
@@ -145,16 +135,16 @@
 		long theFileTime = 0;
 		CURLcode theCurlCode;
 		struct curl_slist *headers = NULL;
-		
+
 		/* we might have options and then the url and the file */
 		/* let's process the options first */
-		
+
 		optioncrsr = 2;
 		lastoption = objc - 3;
 		while (optioncrsr <= lastoption) {
 			/* get the option */
 			const char* theOption = Tcl_GetString(objv[optioncrsr]);
-			
+
 			if (strcmp(theOption, "-v") == 0) {
 				noprogress = 0;
 			} else if (strcmp(theOption, "--disable-epsv") == 0) {
@@ -173,7 +163,7 @@
 						"curl fetch: -u option requires a parameter",
 						TCL_STATIC);
 					theResult = TCL_ERROR;
-					break;					
+					break;
 				}
 			} else if (strcmp(theOption, "--effective-url") == 0) {
 				/* check we also have the parameter */
@@ -185,7 +175,7 @@
 						"curl fetch: --effective-url option requires a parameter",
 						TCL_STATIC);
 					theResult = TCL_ERROR;
-					break;					
+					break;
 				}
 			} else if (strcmp(theOption, "--user-agent") == 0) {
 				/* check we also have the parameter */
@@ -197,7 +187,7 @@
 						"curl fetch: --user-agent option requires a parameter",
 						TCL_STATIC);
 					theResult = TCL_ERROR;
-					break;					
+					break;
 				}
 			} else {
 				char theErrorString[512];
@@ -207,10 +197,10 @@
 				theResult = TCL_ERROR;
 				break;
 			}
-			
+
 			optioncrsr++;
 		}
-		
+
 		if (optioncrsr <= lastoption) {
 			/* something went wrong */
 			break;
@@ -222,7 +212,7 @@
 		if (objc >= 4) {
 			/* Retrieve the url */
 			theURL = Tcl_GetString(objv[objc - 2]);
-	
+
 			/* Retrieve the file path */
 			theFilePath = Tcl_GetString(objv[objc - 1]);
 		} else {
@@ -230,25 +220,25 @@
 			theResult = TCL_ERROR;
 			break;
 		}
-		
+
 		/* Open the file */
 		theFile = fopen( theFilePath, "w" );
 		if (theFile == NULL) {
 			Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
 			theResult = TCL_ERROR;
-                        break;
+			break;
 		}
 
 		/* Create the CURL handle */
 		theHandle = curl_easy_init();
-		
+
 		/* Setup the handle */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* -L option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FOLLOWLOCATION, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -270,12 +260,12 @@
 			break;
 		}
 
-        /* -A option */
-        theCurlCode = curl_easy_setopt(theHandle, CURLOPT_USERAGENT, userAgent);
-        if (theCurlCode != CURLE_OK) {
-            theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
-            break;
-        }
+		/* -A option */
+		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_USERAGENT, userAgent);
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
 
 		/* skip the header data */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_HEADER, 0);
@@ -283,14 +273,14 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* write to the file */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_WRITEDATA, theFile);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* we want/don't want progress */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_NOPROGRESS, noprogress);
 		if (theCurlCode != CURLE_OK) {
@@ -304,7 +294,7 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* we may want to ignore ssl errors */
 		if (ignoresslcert) {
 			theCurlCode = curl_easy_setopt(theHandle, CURLOPT_SSL_VERIFYPEER, (long) 0);
@@ -343,24 +333,30 @@
 			break;
 		}
 
+		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_ERRORBUFFER, theErrorString);
+		if (theCurlCode != CURLE_OK) {
+			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			break;
+		}
+
 		/* actually fetch the resource */
 		theCurlCode = curl_easy_perform(theHandle);
 		if (theCurlCode != CURLE_OK) {
-			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
+			performFailed = true;
 			break;
 		}
-		
+
 		/* close the file */
 		(void) fclose( theFile );
 		theFile = NULL;
-		
+
 #if LIBCURL_VERSION_NUM == 0x070d01 /* work around broken Tiger version of cURL */
 		if (remotetime) {
 			FILE *fp;
 			char *tmp, *p;
 			char buf[BUFSIZ];
 			size_t size;
-			
+
 			tmp = tmpnam(NULL);
 			fp = fopen(tmp, "w");
 			if (fp == NULL) {
@@ -393,7 +389,6 @@
 		}
 #endif
 
-#ifdef HAVE_UTIME_H
 		if (remotetime) {
 			theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_FILETIME, &theFileTime);
 			if (theFileTime > 0) {
@@ -403,8 +398,7 @@
 				utime(theFilePath, &times); /* set the time we got */
 			}
 		}
-#endif /*HAVE_UTIME_H*/
-		
+
 		/* free header memory */
 		curl_slist_free_all(headers);
 
@@ -415,38 +409,24 @@
 				(effectiveURL == NULL || theCurlCode != CURLE_OK) ? "" : effectiveURL,
 				0);
 		}
-		
-		/* check everything went fine */
-		theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_HTTP_CODE, &theResponseCode);
-		if (theCurlCode != CURLE_OK) {
-			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
-			break;
-		}
-		
-		/* we need something between 200 (incl.) and 300 (excl.).*/
-		/* (actually, we sometimes get 0 from GNU FTP servers) */
-		if (((theResponseCode != 0)  && (theResponseCode < 200))
-			|| (theResponseCode >= 300)) {
-			char theErrorString[512];
-			(void) snprintf(theErrorString, sizeof(theErrorString),
-				"Download failed (code = %li)", theResponseCode);
-			Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
-			theResult = TCL_ERROR;
-			break;
-		}
-		
+
 		/* clean up */
 		curl_easy_cleanup( theHandle );
 		theHandle = NULL;
-    } while (0);
-    
-    if (theHandle != NULL) {
-    	curl_easy_cleanup( theHandle );
-    }
-    if (theFile != NULL) {
-    	fclose( theFile );
-    }
-    
+	} while (0);
+
+	if (performFailed) {
+		Tcl_SetResult(interp, theErrorString, TCL_VOLATILE);
+		theResult = TCL_ERROR;
+	}
+
+	if (theHandle != NULL) {
+		curl_easy_cleanup( theHandle );
+	}
+	if (theFile != NULL) {
+		fclose( theFile );
+	}
+
 	return theResult;
 }
 
@@ -470,9 +450,8 @@
 		CURLcode theCurlCode;
 		long theModDate;
 		long userModDate;
-				
-		/*	first (second) parameter is the url,
-			second (third) parameter is the date */
+
+		/* first (second) parameter is the url, second (third) parameter is the date */
 		if (objc != 4) {
 			Tcl_WrongNumArgs(interp, 1, objv, "isnewer url date");
 			theResult = TCL_ERROR;
@@ -487,25 +466,25 @@
 		if (theResult != TCL_OK) {
 			break;
 		}
-		
+
 		/* Open the file (dev/null) */
 		theFile = fopen( "/dev/null", "a" );
 		if (theFile == NULL) {
 			Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
 			theResult = TCL_ERROR;
-                        break;
+			break;
 		}
 
 		/* Create the CURL handle */
 		theHandle = curl_easy_init();
-		
+
 		/* Setup the handle */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* -L option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FOLLOWLOCATION, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -554,7 +533,7 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* save the modification date */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FILETIME, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -580,18 +559,18 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* actually fetch the resource */
 		theCurlCode = curl_easy_perform(theHandle);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* close the file */
 		(void) fclose( theFile );
 		theFile = NULL;
-		
+
 		/* check everything went fine */
 		theCurlCode = curl_easy_getinfo(theHandle, CURLINFO_HTTP_CODE, &theResponseCode);
 		if (theCurlCode != CURLE_OK) {
@@ -608,11 +587,11 @@
 				theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 				break;
 			}
-	
+
 			/* clean up */
 			curl_easy_cleanup( theHandle );
 			theHandle = NULL;
-	
+
 			/* compare this with the date provided by user */
 			if (theModDate < -1) {
 				Tcl_SetResult(interp, "Couldn't get resource modification date", TCL_STATIC);
@@ -625,16 +604,17 @@
 			Tcl_SetResult(interp, "1", TCL_STATIC);
 		} else {
 			Tcl_SetResult(interp, "0", TCL_STATIC);
-		}		
-    } while (0);
-    
-    if (theHandle != NULL) {
-    	curl_easy_cleanup( theHandle );
-    }
-    if (theFile != NULL) {
-    	fclose( theFile );
-    }
-    
+		}
+	} while (0);
+
+	if (theHandle != NULL) {
+		curl_easy_cleanup(theHandle);
+	}
+
+	if (theFile != NULL) {
+		fclose(theFile);
+	}
+
 	return theResult;
 }
 
@@ -657,8 +637,8 @@
 		const char* theURL;
 		CURLcode theCurlCode;
 		double theFileSize;
-				
-		/*	first (second) parameter is the url */
+
+		/* first (second) parameter is the url */
 		if (objc != 3) {
 			Tcl_WrongNumArgs(interp, 1, objv, "getsize url");
 			theResult = TCL_ERROR;
@@ -673,19 +653,19 @@
 		if (theFile == NULL) {
 			Tcl_SetResult(interp, strerror(errno), TCL_VOLATILE);
 			theResult = TCL_ERROR;
-                        break;
+			break;
 		}
 
 		/* Create the CURL handle */
 		theHandle = curl_easy_init();
-		
+
 		/* Setup the handle */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_URL, theURL);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* -L option */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_FOLLOWLOCATION, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -741,7 +721,7 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* skip the body data */
 		theCurlCode = curl_easy_setopt(theHandle, CURLOPT_NOBODY, 1);
 		if (theCurlCode != CURLE_OK) {
@@ -755,14 +735,14 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* actually fetch the resource */
 		theCurlCode = curl_easy_perform(theHandle);
 		if (theCurlCode != CURLE_OK) {
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-		
+
 		/* close the file */
 		(void) fclose( theFile );
 		theFile = NULL;
@@ -775,7 +755,7 @@
 			theResult = SetResultFromCurlErrorCode(interp, theCurlCode);
 			break;
 		}
-	
+
 		/* clean up */
 		curl_easy_cleanup( theHandle );
 		theHandle = NULL;
@@ -783,15 +763,16 @@
 		(void) snprintf(theSizeString, sizeof(theSizeString),
 			"%.0f", theFileSize);
 		Tcl_SetResult(interp, theSizeString, TCL_VOLATILE);
-    } while (0);
-    
-    if (theHandle != NULL) {
-    	curl_easy_cleanup( theHandle );
-    }
-    if (theFile != NULL) {
-    	fclose( theFile );
-    }
-    
+	} while (0);
+
+	if (theHandle != NULL) {
+		curl_easy_cleanup(theHandle);
+	}
+
+	if (theFile != NULL) {
+		fclose(theFile);
+	}
+
 	return theResult;
 }
 
@@ -807,21 +788,25 @@
 CurlCmd(
 		ClientData clientData UNUSED,
 		Tcl_Interp* interp,
-		int objc, 
+		int objc,
 		Tcl_Obj* CONST objv[])
 {
-    typedef enum {
-    	kCurlFetch,
-    	kCurlIsNewer,
-    	kCurlGetSize
-    } EOption;
-    
+	typedef enum {
+		kCurlFetch,
+		kCurlIsNewer,
+		kCurlGetSize
+	} EOption;
+
 	static const char *options[] = {
 		"fetch", "isnewer", "getsize", NULL
 	};
 	int theResult = TCL_OK;
-    EOption theOptionIndex;
+	EOption theOptionIndex;
+	static pthread_once_t once = PTHREAD_ONCE_INIT;
 
+	/* TODO: use dispatch_once when we drop Leopard support */
+	pthread_once(&once, CurlInit);
+
 	if (objc < 3) {
 		Tcl_WrongNumArgs(interp, 1, objv, "option ?arg ...?");
 		return TCL_ERROR;
@@ -835,33 +820,28 @@
 				0,
 				(int*) &theOptionIndex);
 	if (theResult == TCL_OK) {
-		switch (theOptionIndex)
-		{
-			case kCurlFetch:
-				theResult = CurlFetchCmd(interp, objc, objv);
-				break;
-
-			case kCurlIsNewer:
-				theResult = CurlIsNewerCmd(interp, objc, objv);
-				break;
-
-			case kCurlGetSize:
-				theResult = CurlGetSizeCmd(interp, objc, objv);
-				break;
+		switch (theOptionIndex) {
+		case kCurlFetch:
+			theResult = CurlFetchCmd(interp, objc, objv);
+			break;
+		case kCurlIsNewer:
+			theResult = CurlIsNewerCmd(interp, objc, objv);
+			break;
+		case kCurlGetSize:
+			theResult = CurlGetSizeCmd(interp, objc, objv);
+			break;
 		}
 	}
-	
+
 	return theResult;
 }
 
 /**
  * curl init entry point.
- *
- * @param interp		current interpreter
+ * libcurl will never be cleaned (where should I plug the hook?)
  */
-int
-CurlInit(Tcl_Interp* interp)
+void
+CurlInit()
 {
-	CURLcode theCurlCode = curl_global_init(CURL_GLOBAL_ALL);
-	return SetResultFromCurlErrorCode(interp, theCurlCode);
+	curl_global_init(CURL_GLOBAL_ALL);
 }

Modified: branches/new-help-system/base/src/pextlib1.0/curl.h
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/curl.h	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/curl.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -36,12 +36,6 @@
 #include <tcl.h>
 
 /**
- * Init libcurl.
- * libcurl will never be cleaned (where should I plug the hook?)
- */
-int CurlInit(Tcl_Interp* interp);
-
-/**
  * A native command to use libcurl.
  *
  * The syntax is:

Modified: branches/new-help-system/base/src/pextlib1.0/filemap.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/filemap.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/filemap.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -34,76 +34,17 @@
 #include <config.h>
 #endif
 
-#include <ctype.h>
+#include <sys/stat.h>
 #include <errno.h>
-#include <grp.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#if HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-
-#if HAVE_LIMITS_H
-#include <limits.h>
-#endif
-
-#if HAVE_PATHS_H
-#include <paths.h>
-#endif
-
-#ifndef _PATH_DEVNULL
-#define _PATH_DEVNULL   "/dev/null"
-#endif
-
-#include <pwd.h>
-
-#if HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_SYS_FCNTL_H
-#include <sys/fcntl.h>
-#endif
-
-#if HAVE_FCNTL_H
 #include <fcntl.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#if HAVE_UNISTD_H
+#include <limits.h>
 #include <unistd.h>
-#endif
 
 #include <tcl.h>
 
 #include "filemap.h"
 #include "strcasecmp.h"
 
-/* Avoid a warning with Tcl < 8.4, even if Tcl_GetIndexFromObj's tablePtr
-probably isn't modified. */
-#if (TCL_MAJOR_VERSION > 8) || (TCL_MINOR_VERSION >= 4)
-typedef CONST char* tableEntryString;
-#else
-typedef char* tableEntryString;
-#endif
-
 /* ========================================================================= **
  * Definitions
  * ========================================================================= */
@@ -269,7 +210,7 @@
 		ssize_t theFileSize;
 
 		/* Open the file for reading, creating it if necessary. */
-		int theFD = open(inDatabasePath, O_RDONLY | O_CREAT, 0664);
+		theFD = open(inDatabasePath, O_RDONLY | O_CREAT, 0664);
 		if (theFD < 0)
 		{
 			theErr = errno;
@@ -2020,7 +1961,7 @@
     	kFilemapIsReadOnly
     } EOption;
     
-	static tableEntryString options[] = {
+	static const char *options[] = {
 		"close", "create", "exists", "get", "list", "open", "revert", "save",
 		"set", "unset", "isreadonly", NULL
 	};

Copied: branches/new-help-system/base/src/pextlib1.0/flock.c (from rev 65586, trunk/base/src/pextlib1.0/flock.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/flock.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/flock.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,185 @@
+/*
+ * flock.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#if HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
+#include <errno.h>
+#include <inttypes.h>
+#include <string.h>
+
+#include <tcl.h>
+
+#include "flock.h"
+
+int
+FlockCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	static const char errorstr[] = "use one of \"-shared\", \"-exclusive\", or \"-unlock\", and optionally \"-noblock\"";
+	int operation = 0, fd, i, ret;
+	int errnoval = 0;
+	int oshared = 0, oexclusive = 0, ounlock = 0, onoblock = 0;
+#if defined(HAVE_LOCKF) && !defined(HAVE_FLOCK)
+	off_t curpos;
+#endif
+	char *res;
+	Tcl_Channel channel;
+	ClientData handle;
+
+	if (objc < 3 || objc > 4) {
+		Tcl_WrongNumArgs(interp, 1, objv, "channelId switches");
+		return TCL_ERROR;
+	}
+
+    	if ((channel = Tcl_GetChannel(interp, Tcl_GetString(objv[1]), NULL)) == NULL)
+		return TCL_ERROR;
+
+	if (Tcl_GetChannelHandle(channel, TCL_READABLE|TCL_WRITABLE, &handle) != TCL_OK) {
+		Tcl_SetResult(interp, "error getting channel handle", TCL_STATIC);
+		return TCL_ERROR;
+	}
+	fd = (int)(intptr_t)handle;
+
+	for (i = 2; i < objc; i++) {
+		char *arg = Tcl_GetString(objv[i]);
+		if (!strcmp(arg, "-shared")) {
+		  oshared = 1;
+		} else if (!strcmp(arg, "-exclusive")) {
+		  oexclusive = 1;
+		} else if (!strcmp(arg, "-unlock")) {
+		  ounlock = 1;
+		} else if (!strcmp(arg, "-noblock")) {
+		  onoblock = 1;
+		}
+	}
+
+	/* verify the arguments */
+
+	if((oshared + oexclusive + ounlock) != 1) {
+	  /* only one of the options should have been specified */
+	  Tcl_SetResult(interp, (void *) &errorstr, TCL_STATIC);
+	  return TCL_ERROR;
+	}
+
+	if(onoblock && ounlock) {
+	  /* should not be specified together */
+	  Tcl_SetResult(interp, "-noblock cannot be used with -unlock", TCL_STATIC);
+	  return TCL_ERROR;
+	}
+	  
+#if HAVE_FLOCK
+	/* prefer flock if present */
+	if(oshared) operation |= LOCK_SH;
+
+	if(oexclusive) operation |= LOCK_EX;
+
+	if(ounlock) operation |= LOCK_UN;
+
+	if(onoblock) operation |= LOCK_NB;
+
+	ret = flock(fd, operation);
+	if(ret == -1) {
+	  errnoval = errno;
+	}
+#else
+#if HAVE_LOCKF
+	if(ounlock) operation = F_ULOCK;
+
+	/* lockf semantics don't map to shared locks. */
+	if(oshared || oexclusive) {
+	  if(onoblock) {
+	    operation = F_TLOCK;
+	  } else {
+	    operation = F_LOCK;
+	  }
+	}
+
+	curpos = lseek(fd, 0, SEEK_CUR);
+	if(curpos == -1) {
+		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+		return TCL_ERROR;
+	}
+
+	ret = lockf(fd, operation, 0); /* lock entire file */
+
+	curpos = lseek(fd, curpos, SEEK_SET);
+	if(curpos == -1) {
+		Tcl_SetResult(interp, (void *) "Seek error", TCL_STATIC);
+		return TCL_ERROR;
+	}
+
+	if(ret == -1) {
+	  errnoval = errno;
+	  if((oshared || oexclusive)) {
+	    /* map the errno val to what we would expect for flock */
+	    if(onoblock && errnoval == EAGAIN) {
+	      /* on some systems, EAGAIN=EWOULDBLOCK, but lets be safe */
+	      errnoval = EWOULDBLOCK;
+	    } else if(errnoval == EINVAL) {
+	      errnoval = EOPNOTSUPP;
+	    }
+	  }
+	}
+#else
+#error no available locking implementation
+#endif /* HAVE_LOCKF */
+#endif /* HAVE_FLOCK */
+
+	if (ret != 0)
+	{
+		switch(errnoval) {
+			case EAGAIN:
+				res = "EAGAIN";
+				break;
+			case EBADF:
+				res = "EBADF";
+				break;
+			case EINVAL:
+				res = "EINVAL";
+				break;
+			case EOPNOTSUPP:
+				res = "EOPNOTSUPP";
+				break;
+			default:
+				res = strerror(errno);
+				break;
+		}
+		Tcl_SetResult(interp, (void *) res, TCL_STATIC);
+		return TCL_ERROR;
+	}
+	return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/flock.h (from rev 65586, trunk/base/src/pextlib1.0/flock.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/flock.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/flock.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * flock.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int FlockCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/new-help-system/base/src/pextlib1.0/fs-traverse.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/fs-traverse.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/fs-traverse.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,24 +37,14 @@
 #include <config.h>
 #endif
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
-#endif
-
-#if HAVE_SYS_STAT_H
 #include <sys/stat.h>
-#endif
-
-#include <fts.h>
 #include <errno.h>
-
-#if HAVE_LIMITS_H
+#include <fts.h>
 #include <limits.h>
-#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include <tcl.h>
 
@@ -201,7 +191,8 @@
             {
                 if (!(flags & F_IGNORE_ERRORS)) {
                     Tcl_SetErrno(ent->fts_errno);
-                    Tcl_SetResult(interp, (char *)Tcl_PosixError(interp),  TCL_STATIC);
+                    Tcl_ResetResult(interp);
+                    Tcl_AppendResult(interp, ent->fts_path, ": ", (char *)Tcl_PosixError(interp), NULL); 
                     fts_close(root_fts);
                     return TCL_ERROR;
                 }
@@ -210,6 +201,7 @@
     }
     /* check errno before calling fts_close in case it sets errno to 0 on success */
     if (errno != 0 || (fts_close(root_fts) != 0 && !(flags & F_IGNORE_ERRORS))) {
+        Tcl_SetErrno(errno);
         Tcl_SetResult(interp, (char *)Tcl_PosixError(interp), TCL_STATIC);
         return TCL_ERROR;
     }

Deleted: branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,175 +0,0 @@
-/*
- * get_systemconfiguration_proxies.c
- * $Id$
- *
- * Copyright (c) 2008-2009, The MacPorts Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of MacPorts Team nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "get_systemconfiguration_proxies.h"
-
-
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-#include <CoreFoundation/CoreFoundation.h>
-#include <SystemConfiguration/SystemConfiguration.h>
-
-int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey );
-char *cfStringToCStringASCII( CFStringRef cfString );
-
-#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
-
-
-/**
- *
- * Query SystemConfiguration for proxy information, returning this
- * information in a Tcl list ready to be 'array set' (key, name pairs).
- *
- * Synopsis: array set someArray get_systemconfiguration_proxies
- */
-int GetSystemConfigurationProxiesCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
-{
-    int cmdResult = TCL_OK;
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-    CFDictionaryRef proxies = SCDynamicStoreCopyProxies( NULL );
-    if( proxies != NULL )
-    {
-        Tcl_Obj *proxyList = Tcl_NewListObj( 0, NULL );
-        if( appendProxyInformationForKeys( proxies, proxyList, "proxy_http", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort ) == 0 &&
-            appendProxyInformationForKeys( proxies, proxyList, "proxy_https", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort ) == 0 &&
-            appendProxyInformationForKeys( proxies, proxyList, "proxy_ftp", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort ) == 0 )
-        {
-            CFArrayRef exceptionsCFArray = CFDictionaryGetValue( proxies, kSCPropNetProxiesExceptionsList );
-            if( exceptionsCFArray != NULL )
-            {
-                CFStringRef exceptionsCFString = CFStringCreateByCombiningStrings( kCFAllocatorDefault, exceptionsCFArray, CFSTR( "," ) );
-                char *exceptionsString = cfStringToCStringASCII( exceptionsCFString );
-                if( exceptionsString != NULL )
-                {
-                    Tcl_Obj *exceptionsKey = Tcl_NewStringObj( "proxy_skip", 10 );
-                    Tcl_Obj *exceptionsTclString = Tcl_NewStringObj( exceptionsString, strlen( exceptionsString ) );
-                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsKey );
-                    Tcl_ListObjAppendElement( interp, proxyList, exceptionsTclString );
-                    free( exceptionsString );
-                }
-                else
-                    cmdResult = TCL_ERROR;
-                CFRelease( exceptionsCFString );
-            }
-            Tcl_SetObjResult( interp, proxyList );
-        }
-        else
-            cmdResult = TCL_ERROR;
-        CFRelease( proxies );
-    }
-    if( cmdResult == TCL_ERROR )
-        Tcl_SetResult( interp, (char *) Tcl_PosixError( interp ), TCL_STATIC );
-#endif
-   return cmdResult;
-}
-
-
-#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
-/**
- *
- * Extract the proxy information (given by proxyEnabledKey, proxyHostKey,
- * and proxyPortKey) from the proxies dictionary, then append listKey and
- * the pertinent proxy information to the Tcl list.
- *
- * Returns 0 on success; -1 on failure
- */
-int appendProxyInformationForKeys( CFDictionaryRef proxies, Tcl_Obj *tclList, const char *listKey, const void *proxyEnabledKey, const void *proxyHostKey, const void *proxyPortKey )
-{
-    int result = 0;
-    CFNumberRef proxyEnabledNumber = CFDictionaryGetValue( proxies, proxyEnabledKey );
-    int proxyEnabled = 0;
-    if( proxyEnabledNumber != NULL &&
-        CFNumberGetValue( proxyEnabledNumber, kCFNumberIntType, &proxyEnabled ) &&
-        proxyEnabled )
-    {
-        CFStringRef proxyHostString = CFDictionaryGetValue( proxies, proxyHostKey );
-        char *hostname = NULL;
-        if( proxyHostString != NULL &&
-            ( hostname = cfStringToCStringASCII( proxyHostString ) ) != NULL )
-        {
-            CFNumberRef proxyPortNumber = CFDictionaryGetValue( proxies, proxyPortKey );
-            int proxyPort = 0;
-            if( proxyPortNumber != NULL &&
-                CFNumberGetValue( proxyPortNumber, kCFNumberIntType, &proxyPort ) &&
-                proxyPort > 0 )
-            {
-                /*
-                 * We are adding :<port>\0 to the end, which is up to 7
-                 * bytes additional (up to 5 for the port)
-                 */
-                int newLength = strlen( hostname ) + 7;
-                char *hostnameAndPort = calloc( 1, newLength );
-                if( hostnameAndPort != NULL )
-                {
-                    Tcl_Obj *hostnameAndPortTcl;
-                    Tcl_Obj *listKeyTcl = Tcl_NewStringObj( listKey, strlen( listKey ) );
-                    Tcl_ListObjAppendElement( NULL, tclList, listKeyTcl );
-                    snprintf( hostnameAndPort, newLength, "%s:%d", hostname, proxyPort );
-                    hostnameAndPortTcl = Tcl_NewStringObj( hostnameAndPort, strlen( hostnameAndPort ) );
-                    Tcl_ListObjAppendElement( NULL, tclList, hostnameAndPortTcl );
-                    free( hostnameAndPort );
-                }
-                else
-                    result = -1;
-            }
-            else
-                result = -1;
-        }
-        else
-            result = -1;
-    }
-
-    return result;
-}
-
-
-/**
- *
- * Convert a CFStringRef to an ASCII-encoded C string; be sure to free()
- * the returned string when done with it.
- */
-char *cfStringToCStringASCII( CFStringRef cfString )
-{
-    int strLen = CFStringGetMaximumSizeForEncoding( CFStringGetLength( cfString ), kCFStringEncodingASCII ) + 1;
-    char *cString = calloc( 1, strLen );
-    if( cString != NULL )
-        CFStringGetCString( cfString, cString, strLen, kCFStringEncodingASCII );
-
-   return cString;
-}
-
-#endif
-

Deleted: branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.h
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.h	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/get_systemconfiguration_proxies.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,41 +0,0 @@
-/* 
- * get_systemconfiguration_proxies.h 
- * $Id$ 
- * 
- * Copyright (c) 2008-2009, The MacPorts Project. 
- * All rights reserved. 
- * 
- * Redistribution and use in source and binary forms, with or without 
- * modification, are permitted provided that the following conditions 
- * are met: 
- * 1. Redistributions of source code must retain the above copyright 
- *    notice, this list of conditions and the following disclaimer. 
- * 2. Redistributions in binary form must reproduce the above copyright 
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the distribution. 
- * 3. Neither the name of MacPorts Team nor the names of its contributors 
- *    may be used to endorse or promote products derived from this software 
- *    without specific prior written permission. 
- *  
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
- * POSSIBILITY OF SUCH DAMAGE. 
- */ 
-
-#ifndef _GETSYSTEMCONFIGURATIONPROXIES_H
-#define _GETSYSTEMCONFIGURATIONPROXIES_H
-
-#include <tcl.h> 
-
-int GetSystemConfigurationProxiesCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ); 
-
-#endif   /* _GETSYSTEMCONFIGURATIONPROXIES_H */
-

Modified: branches/new-help-system/base/src/pextlib1.0/md5cmd.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/md5cmd.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/md5cmd.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -34,42 +34,35 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <tcl.h>
 
-#if defined(HAVE_LIBCRYPTO) && !defined(HAVE_LIBMD)
+#include "md5cmd.h"
 
-/* Minimal wrapper around OpenSSL's libcrypto, as a compatibility
- * layer for FreeBSD's libmd library.
- * Originally written by: Rob Braun (bbraun) 1/18/2002
- */
+#if HAVE_COMMONCRYPTO_COMMONDIGEST_H
 
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
+#define COMMON_DIGEST_FOR_OPENSSL
+#include <CommonCrypto/CommonDigest.h>
 
-#include <openssl/md5.h>
-
-/* This is a magic number taken from the FreeBSD libmd Makefile */
-#define LENGTH 16
-
+/* md5 functions are named differently */
 #define MD5Init(x) MD5_Init(x)
 #define MD5Update(x,y,z) MD5_Update(x,y,z)
 #define MD5Final(x,y) MD5_Final(x,y)
 
 #include "md_wrappers.h"
-CHECKSUMEnd(MD5, MD5_CTX, LENGTH)
+CHECKSUMEnd(MD5, MD5_CTX, MD5_DIGEST_LENGTH)
 CHECKSUMFile(MD5, MD5_CTX)
-CHECKSUMData(MD5, MD5_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>
 #include <md5.h>
 #else
-#error libcrypto or libmd are required
+#error CommonCrypto or libmd required
 #endif
 
 int MD5Cmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

Modified: branches/new-help-system/base/src/pextlib1.0/md_wrappers.h
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/md_wrappers.h	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/md_wrappers.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -34,13 +34,12 @@
 #define _MD_WRAPPERS_H
 
 /* wrappers for libmd-like functions:
- * char* ALGOData(const unsigned char* data, unsigned int len, char* buf)
  * char* ALGOFile(const char* filename, char* buf)
  * char* ALGOEnd(ALGO_CTX, char* buf)
  */
 
 #define CHECKSUMEnd(algo, ctxtype, digest_length)		\
-char *													\
+static char *													\
 algo##End(ctxtype *ctx, char *buf)						\
 {														\
     int i;												\
@@ -61,7 +60,7 @@
 }
 
 #define CHECKSUMFile(algo, ctxtype)						\
-char *algo##File(const char *filename, char *buf)		\
+static char *algo##File(const char *filename, char *buf)		\
 {														\
     unsigned char buffer[BUFSIZ];						\
     ctxtype ctx;										\
@@ -80,15 +79,5 @@
     return algo##End(&ctx, buf);						\
 }
 
-#define CHECKSUMData(algo, ctxtype)						\
-char *algo##Data(const unsigned char *data, unsigned int len, char *buf)	\
-{														\
-	ctxtype ctx;										\
-	algo##Init(&ctx);									\
-	algo##Update(&ctx, data, len);						\
-	return algo##End(&ctx, buf);						\
-}
-
-
 #endif
-	/* _MD_WRAPPERS_H */
+/* _MD_WRAPPERS_H */

Copied: branches/new-help-system/base/src/pextlib1.0/mktemp.c (from rev 65586, trunk/base/src/pextlib1.0/mktemp.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/mktemp.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/mktemp.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,125 @@
+/*
+ * mktemp.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <tcl.h>
+
+#include "mktemp.h"
+
+int MkdtempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	char *template, *sp;
+	Tcl_Obj *tcl_result;
+
+	if (objc != 2) {
+		Tcl_WrongNumArgs(interp, 1, objv, "template");
+		return TCL_ERROR;
+	}
+
+	template = strdup(Tcl_GetString(objv[1]));
+	if (template == NULL)
+		return TCL_ERROR;
+
+	if ((sp = mkdtemp(template)) == NULL) {
+		Tcl_AppendResult(interp, "mkdtemp failed: ", strerror(errno), NULL);
+		free(template);
+		return TCL_ERROR;
+	}
+
+	tcl_result = Tcl_NewStringObj(sp, -1);
+	Tcl_SetObjResult(interp, tcl_result);
+	free(template);
+	return TCL_OK;
+}
+
+int MktempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	char *template, *sp;
+	Tcl_Obj *tcl_result;
+
+	if (objc != 2) {
+		Tcl_WrongNumArgs(interp, 1, objv, "template");
+		return TCL_ERROR;
+	}
+
+	template = strdup(Tcl_GetString(objv[1]));
+	if (template == NULL)
+		return TCL_ERROR;
+
+	if ((sp = mktemp(template)) == NULL) {
+		Tcl_AppendResult(interp, "mktemp failed: ", strerror(errno), NULL);
+		free(template);
+		return TCL_ERROR;
+	}
+
+	tcl_result = Tcl_NewStringObj(sp, -1);
+	Tcl_SetObjResult(interp, tcl_result);
+	free(template);
+	return TCL_OK;
+}
+
+int MkstempCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	Tcl_Channel channel;
+	char *template, *channelname;
+	int fd;
+
+	if (objc != 2) {
+		Tcl_WrongNumArgs(interp, 1, objv, "template");
+		return TCL_ERROR;
+	}
+
+	template = strdup(Tcl_GetString(objv[1]));
+	if (template == NULL)
+		return TCL_ERROR;
+
+	if ((fd = mkstemp(template)) < 0) {
+		Tcl_AppendResult(interp, "mkstemp failed: ", strerror(errno), NULL);
+		free(template);
+		return TCL_ERROR;
+	}
+
+	channel = Tcl_MakeFileChannel((ClientData)(intptr_t)fd, TCL_READABLE|TCL_WRITABLE);
+	Tcl_RegisterChannel(interp, channel);
+	channelname = (char *)Tcl_GetChannelName(channel);
+	Tcl_AppendResult(interp, channelname, " ", template, NULL);
+	free(template);
+	return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/mktemp.h (from rev 65586, trunk/base/src/pextlib1.0/mktemp.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/mktemp.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/mktemp.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,35 @@
+/*
+ * mktemp.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int MkdtempCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);
+int MktempCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);
+int MkstempCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Copied: branches/new-help-system/base/src/pextlib1.0/pipe.c (from rev 65586, trunk/base/src/pextlib1.0/pipe.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/pipe.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/pipe.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,76 @@
+/*
+ * pipe.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <tcl.h>
+
+#include "pipe.h"
+
+/**
+ * Call pipe(2) to create a pipe.
+ * Syntax is:
+ * pipe
+ *
+ * Generate a Tcl error if something goes wrong.
+ * Return a list with the file descriptors of the pipe. The first item is the
+ * readable fd.
+ */
+int PipeCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	Tcl_Obj* result;
+	int fildes[2];
+
+	if (objc != 1) {
+		Tcl_WrongNumArgs(interp, 1, objv, NULL);
+		return TCL_ERROR;
+	}
+	
+	if (pipe(fildes) < 0) {
+		Tcl_AppendResult(interp, "pipe failed: ", strerror(errno), NULL);
+		return TCL_ERROR;
+	}
+	
+	/* build a list out of the couple */
+	result = Tcl_NewListObj(0, NULL);
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[0]));
+	Tcl_ListObjAppendElement(interp, result, Tcl_NewIntObj(fildes[1]));
+	Tcl_SetObjResult(interp, result);
+
+	return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/pipe.h (from rev 65586, trunk/base/src/pextlib1.0/pipe.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/pipe.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/pipe.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * pipe.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int PipeCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Copied: branches/new-help-system/base/src/pextlib1.0/readdir.c (from rev 65586, trunk/base/src/pextlib1.0/readdir.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/readdir.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/readdir.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,82 @@
+/*
+ * readdir.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dirent.h>
+
+#include <tcl.h>
+
+#include "readdir.h"
+
+/**
+ *
+ * Return the list of elements in a directory.
+ * Since 1.60.4.2, the list doesn't include . and ..
+ *
+ * Synopsis: readdir directory
+ */
+int ReaddirCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	DIR *dirp;
+	struct dirent *mp;
+	Tcl_Obj *tcl_result;
+	char *path;
+
+	if (objc != 2) {
+		Tcl_WrongNumArgs(interp, 1, objv, "directory");
+		return TCL_ERROR;
+	}
+
+	path = Tcl_GetString(objv[1]);
+	dirp = opendir(path);
+	if (!dirp) {
+		Tcl_SetResult(interp, "Cannot read directory", TCL_STATIC);
+		return TCL_ERROR;
+	}
+	tcl_result = Tcl_NewListObj(0, NULL);
+	while ((mp = readdir(dirp))) {
+		/* Skip . and .. */
+		if ((mp->d_name[0] != '.') ||
+			((mp->d_name[1] != 0)	/* "." */
+				&&
+			((mp->d_name[1] != '.') || (mp->d_name[2] != 0)))) /* ".." */ {
+			Tcl_ListObjAppendElement(interp, tcl_result, Tcl_NewStringObj(mp->d_name, -1));
+		}
+	}
+	closedir(dirp);
+	Tcl_SetObjResult(interp, tcl_result);
+	
+	return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/readdir.h (from rev 65586, trunk/base/src/pextlib1.0/readdir.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/readdir.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/readdir.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * readdir.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int ReaddirCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/new-help-system/base/src/pextlib1.0/readline.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/readline.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/readline.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -13,12 +13,9 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
 #if HAVE_READLINE_READLINE_H
 #include <readline/readline.h>
 #endif

Copied: branches/new-help-system/base/src/pextlib1.0/realpath.c (from rev 65586, trunk/base/src/pextlib1.0/realpath.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/realpath.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/realpath.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,80 @@
+/*
+ * realpath.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of MacPorts Team nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "realpath.h"
+
+/**
+ * realpath command entry point.
+ *
+ * @param interp		current interpreter
+ * @param objc			number of parameters
+ * @param objv			parameters
+ */
+int RealpathCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    const char error_message[] = "realpath failed: ";
+    Tcl_Obj *tcl_result;
+    char *path;
+    char *rpath = malloc(PATH_MAX+1);
+    char *res;
+
+    if (objc != 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "path");
+        return TCL_ERROR;
+    }
+
+    path = Tcl_GetString(objv[1]);
+    res = realpath(path, rpath);
+    if (!res) {
+        free(rpath);
+        tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+        Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(strerror(errno), -1));
+        Tcl_SetObjResult(interp, tcl_result);
+        return TCL_ERROR;
+    } else {
+        tcl_result = Tcl_NewStringObj(rpath, -1);
+    }
+    
+    Tcl_SetObjResult(interp, tcl_result);
+    return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/realpath.h (from rev 65586, trunk/base/src/pextlib1.0/realpath.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/realpath.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/realpath.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,49 @@
+/*
+ * realpath.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of MacPorts Team nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _REALPATH_H
+#define _REALPATH_H
+
+#include <tcl.h>
+
+/**
+ * A native command to handle a limitation of old versions of Tcl.
+ *
+ * The syntax is:
+ * realpath path
+ *	Normalize path like file normalize does.
+ *  Fixes a problem with Tcl installations affected by not defining HAVE_REALPATH (this is
+ *	the case with the Tcl in OS X shipped prior to 10.6)
+ */
+int RealpathCmd(ClientData clientData, Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]);
+
+#endif /* _REALPATH_H */

Modified: branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/rmd160cmd.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -38,8 +38,10 @@
 
 #include <tcl.h>
 
-#if !defined(HAVE_LIBMD)
+#include "rmd160cmd.h"
 
+#if HAVE_COMMONCRYPTO_COMMONDIGEST_H
+
 /* We do not have libmd.
  * let's use our own version of rmd160* libraries.
  */
@@ -57,14 +59,13 @@
 #include "md_wrappers.h"
 CHECKSUMEnd(RMD160, RMD160_CTX, RIPEMD160_DIGEST_LENGTH)
 CHECKSUMFile(RMD160, RMD160_CTX)
-CHECKSUMData(RMD160, RMD160_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>
 #include <ripemd.h>
 #define RMD160File(x, y) RIPEMD160_File(x, y)
 #else
-#error libcrypto or libmd are required
+#error CommonCrypto or libmd required
 #endif
 
 int RMD160Cmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])

Modified: branches/new-help-system/base/src/pextlib1.0/sha1cmd.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/sha1cmd.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/sha1cmd.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -35,40 +35,30 @@
 #include <config.h>
 #endif
 
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <tcl.h>
 
-#if defined(HAVE_LIBCRYPTO) && !defined(HAVE_LIBMD)
+#include "sha1cmd.h"
 
-/* Minimal wrapper around OpenSSL's libcrypto, as a compatibility
- * layer for FreeBSD's libmd library.
- * Originally written by: Rob Braun (bbraun) 1/18/2002
- */
+#if HAVE_COMMONCRYPTO_COMMONDIGEST_H
 
-#include <stdio.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
+#define COMMON_DIGEST_FOR_OPENSSL
+#include <CommonCrypto/CommonDigest.h>
 
-#include <openssl/sha.h>
-
-#define SHA1Init(x) SHA1_Init(x)
-#define SHA1Update(x,y,z) SHA1_Update(x,y,z)
-#define SHA1Final(x,y) SHA1_Final(x,y)
-
 #include "md_wrappers.h"
-CHECKSUMEnd(SHA1, SHA_CTX, SHA_DIGEST_LENGTH)
-CHECKSUMFile(SHA1, SHA_CTX)
-CHECKSUMData(SHA1, SHA_CTX)
+CHECKSUMEnd(SHA1_, SHA_CTX, SHA_DIGEST_LENGTH)
+CHECKSUMFile(SHA1_, SHA_CTX)
 
 #elif defined(HAVE_LIBMD)
 #include <sys/types.h>
 #include <sha.h>
-#define SHA1File(x, y) SHA1_File(x, y)
 #else
-#error libcrypto or libmd are required
+#error CommonCrypto or libmd required
 #endif
 
 int SHA1Cmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
@@ -95,7 +85,7 @@
 	}
 	file = Tcl_GetString(objv[2]);
 
-	if (!SHA1File(file, buf)) {
+	if (!SHA1_File(file, buf)) {
 		tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
 		Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(file, -1));
 		Tcl_SetObjResult(interp, tcl_result);

Copied: branches/new-help-system/base/src/pextlib1.0/sha256cmd.c (from rev 65586, trunk/base/src/pextlib1.0/sha256cmd.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/sha256cmd.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/sha256cmd.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,106 @@
+/*
+ * sha256cmd.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <tcl.h>
+
+#include "sha256cmd.h"
+
+#if HAVE_COMMONCRYPTO_COMMONDIGEST_H
+
+#define COMMON_DIGEST_FOR_OPENSSL
+#include <CommonCrypto/CommonDigest.h>
+
+/* Tiger compatibility */
+#ifndef SHA256_DIGEST_LENGTH
+#define SHA256_DIGEST_LENGTH            CC_SHA256_DIGEST_LENGTH
+#define SHA256_CTX                      CC_SHA256_CTX
+#define SHA256_Init(c)                  CC_SHA256_Init(c)
+#define SHA256_Update(c,d,l)            CC_SHA256_Update(c,d,l)
+#define SHA256_Final(m, c)              CC_SHA256_Final(m,c)
+#endif
+
+#include "md_wrappers.h"
+CHECKSUMEnd(SHA256_, SHA256_CTX, SHA256_DIGEST_LENGTH)
+CHECKSUMFile(SHA256_, SHA256_CTX)
+
+#elif defined(HAVE_LIBMD)
+#include <sys/types.h>
+#include <sha256.h>
+#define SHA256_DIGEST_LENGTH 32
+#else
+#error CommonCrypto or libmd required
+#endif
+
+int SHA256Cmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+	char *file, *action;
+	char buf[2*SHA256_DIGEST_LENGTH + 1];
+	const char usage_message[] = "Usage: sha256 file";
+	const char error_message[] = "Could not open file: ";
+	Tcl_Obj *tcl_result;
+
+	if (objc != 3) {
+		Tcl_WrongNumArgs(interp, 1, objv, "action ?file?");
+		return TCL_ERROR;
+	}
+
+	/*
+	 * Only the 'file' action is currently supported
+	 */
+	action = Tcl_GetString(objv[1]);
+	if (strcmp(action, "file") != 0) {
+		tcl_result = Tcl_NewStringObj(usage_message, sizeof(usage_message) - 1);
+		Tcl_SetObjResult(interp, tcl_result);
+		return TCL_ERROR;
+	}
+	file = Tcl_GetString(objv[2]);
+
+	if (!SHA256_File(file, buf)) {
+		tcl_result = Tcl_NewStringObj(error_message, sizeof(error_message) - 1);
+		Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(file, -1));
+		Tcl_SetObjResult(interp, tcl_result);
+		return TCL_ERROR;
+	}
+	tcl_result = Tcl_NewStringObj(buf, sizeof(buf) - 1);
+	Tcl_SetObjResult(interp, tcl_result);
+	return TCL_OK;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/sha256cmd.h (from rev 65586, trunk/base/src/pextlib1.0/sha256cmd.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/sha256cmd.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/sha256cmd.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,44 @@
+/*
+ * sha256cmd.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SHA256CMD_H
+#define _SHA256CMD_H
+
+#include <tcl.h>
+
+/**
+ * A native command for sha256 checksums.
+ */
+int SHA256Cmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);
+
+#endif
+	/* _SHA256CMD_H */

Modified: branches/new-help-system/base/src/pextlib1.0/strsed.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strsed.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/strsed.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -129,6 +129,8 @@
 
 #define HS_REGEX	1
 
+#include "strsed.h"
+
 #include <ctype.h>
 #include <string.h>
 #include <stdlib.h>
@@ -215,13 +217,14 @@
 /* ------------------------------------------------------------------------- **
  * Prototypes
  * ------------------------------------------------------------------------- */
-static char *mem();
-static void mem_init();
-static void mem_free();
-static char *build_map();
-static char nextch();
-static void mem_save();
-static int mem_find();
+static char *mem(int, int);
+static void mem_init(void);
+static void mem_free(char *);
+static char *build_map(char *, char *);
+static char nextch(char *, int);
+static void mem_save(int);
+static int mem_find(int);
+char *backslash_eliminate(char *, int, int);
 
 /* ------------------------------------------------------------------------- **
  * strsed
@@ -245,8 +248,6 @@
     static regmatch_t *exp_regs = NULL;
     static regex_t exp;
 #endif
-
-    char *backslash_eliminate();
     
     char *from;
     char *new_str;

Copied: branches/new-help-system/base/src/pextlib1.0/strsed.h (from rev 65586, trunk/base/src/pextlib1.0/strsed.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/strsed.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/strsed.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * strsed.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+char *strsed(char *, char *, int *);

Copied: branches/new-help-system/base/src/pextlib1.0/system.c (from rev 65586, trunk/base/src/pextlib1.0/system.c)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/system.c	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/system.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,255 @@
+/* vim: set et sw=4 ts=4 sts=4: */
+/*
+ * system.c
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <tcl.h>
+
+#if HAVE_PATHS_H
+#include <paths.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/resource.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <limits.h>
+
+#include "system.h"
+#include "Pextlib.h"
+
+#if HAVE_CRT_EXTERNS_H
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
+extern char **environ;
+#endif
+
+#ifndef _PATH_DEVNULL
+#define _PATH_DEVNULL "/dev/null"
+#endif
+
+#define CBUFSIZ 30
+
+struct linebuf {
+    size_t len;
+    char *line;
+};
+
+/* usage: system ?-notty? ?-nice value? command */
+int SystemCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
+{
+    char *buf;
+    struct linebuf circbuf[CBUFSIZ];
+    size_t linelen;
+    char *args[4];
+    char *cmdstring;
+    FILE *pdes;
+    int fdset[2], nullfd;
+    int fline, pos, ret;
+    int osetsid = 0;
+    int oniceval = INT_MAX; /* magic value indicating no change */
+    pid_t pid;
+    uid_t euid;
+    Tcl_Obj *tcl_result;
+    int read_failed, status;
+    int i;
+
+    if (objc < 2) {
+        Tcl_WrongNumArgs(interp, 1, objv, "?-notty? ?-nice value? command");
+        return TCL_ERROR;
+    }
+
+    cmdstring = Tcl_GetString(objv[objc - 1]);
+
+    for (i = 1; i < objc - 1; i++) {
+        char *arg = Tcl_GetString(objv[i]);
+        if (strcmp(arg, "-notty") == 0) {
+            osetsid = 1;
+        } else if (strcmp(arg, "-nice") == 0) {
+            i++;
+            if (Tcl_GetIntFromObj(interp, objv[i], &oniceval) != TCL_OK) {
+                Tcl_SetResult(interp, "invalid value for -nice", TCL_STATIC);
+                return TCL_ERROR;
+            }
+        } else {
+            tcl_result = Tcl_NewStringObj("bad option ", -1);
+            Tcl_AppendObjToObj(tcl_result, Tcl_NewStringObj(arg, -1));
+            Tcl_SetObjResult(interp, tcl_result);
+            return TCL_ERROR;
+        }
+    }
+
+    /*
+     * Fork a child to run the command, in a popen() like fashion -
+     * popen() itself is not used because stderr is also desired.
+     */
+    if (pipe(fdset) != 0) {
+        return TCL_ERROR;
+    }
+
+    pid = fork();
+    switch (pid) {
+    case -1: /* error */
+        return TCL_ERROR;
+        break;
+    case 0: /* child */
+        close(fdset[0]);
+
+        if ((nullfd = open(_PATH_DEVNULL, O_RDONLY)) == -1)
+            _exit(1);
+        dup2(nullfd, STDIN_FILENO);
+        dup2(fdset[1], STDOUT_FILENO);
+        dup2(fdset[1], STDERR_FILENO);
+        /* drop the controlling terminal if requested */
+        if (osetsid) {
+            if (setsid() == -1)
+                _exit(1);
+        }
+        /* change scheduling priority if requested */
+        if (oniceval != INT_MAX) {
+            if (setpriority(PRIO_PROCESS, getpid(), oniceval) != 0) {
+                /* ignore failure, just continue */
+            }
+        }
+        /* drop privileges entirely for child */
+        if (getuid() == 0 && (euid = geteuid()) != 0) {
+            if (seteuid(0) || setuid(euid)) {
+                _exit(1);
+            }
+        }
+        /* XXX ugly string constants */
+        args[0] = "sh";
+        args[1] = "-c";
+        args[2] = cmdstring;
+        args[3] = NULL;
+        execve("/bin/sh", args, environ);
+        _exit(1);
+        break;
+    default: /* parent */
+        break;
+    }
+
+    close(fdset[1]);
+
+    /* read from simulated popen() pipe */
+    read_failed = 0;
+    pos = 0;
+    memset(circbuf, 0, sizeof(circbuf));
+    pdes = fdopen(fdset[0], "r");
+    while ((buf = fgetln(pdes, &linelen)) != NULL) {
+        char *sbuf;
+        int slen;
+
+        /*
+         * Allocate enough space to insert a terminating
+         * '\0' if the line is not terminated with a '\n'
+         */
+        if (buf[linelen - 1] == '\n')
+            slen = linelen;
+        else
+            slen = linelen + 1;
+
+        if (circbuf[pos].len == 0)
+            sbuf = malloc(slen);
+        else {
+            sbuf = realloc(circbuf[pos].line, slen);
+        }
+
+        if (sbuf == NULL) {
+            read_failed = 1;
+            break;
+        }
+
+        memcpy(sbuf, buf, linelen);
+        /* terminate line with '\0',replacing '\n' if it exists */
+        sbuf[slen - 1] = '\0';
+
+        circbuf[pos].line = sbuf;
+        circbuf[pos].len = slen;
+
+        if (pos++ == CBUFSIZ - 1) {
+            pos = 0;
+        }
+
+        if (ui_info(interp, sbuf) != TCL_OK) {
+            read_failed = 1;
+            break;
+        }
+    }
+    fclose(pdes);
+
+    status = TCL_ERROR;
+
+    if (wait(&ret) == pid && WIFEXITED(ret) && !read_failed) {
+        /* Normal exit, and reading from the pipe didn't fail. */
+        if (WEXITSTATUS(ret) == 0) {
+            status = TCL_OK;
+        } else {
+            char *errorstr;
+            size_t errorstrlen;
+            /* set errorCode [list CHILDSTATUS <pid> <code>] */
+            Tcl_Obj* errorCode = Tcl_NewListObj(0, NULL);
+            Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewStringObj("CHILDSTATUS", -1));
+            Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(pid));
+            Tcl_ListObjAppendElement(interp, errorCode, Tcl_NewIntObj(WEXITSTATUS(ret)));
+            Tcl_SetObjErrorCode(interp, errorCode);
+
+            /* print error */
+            errorstrlen = strlen("shell command \"")+strlen(cmdstring)+strlen("\" returned error ")+12;
+            errorstr = malloc(errorstrlen);
+            if (errorstr) {
+                *errorstr = '\0';
+                snprintf(errorstr, errorstrlen, "%s%s%s%d", "shell command \"", cmdstring, "\" returned error ", WEXITSTATUS(ret));
+                ui_info(interp, errorstr);
+                free(errorstr);
+            }
+            Tcl_SetObjResult(interp, Tcl_NewStringObj("shell command failed", -1));
+        }
+    }
+
+    /* Cleanup. */
+    close(fdset[0]);
+    for (fline = 0; fline < CBUFSIZ; fline++) {
+        if (circbuf[fline].len != 0) {
+            free(circbuf[fline].line);
+        }
+    }
+
+    return status;
+}

Copied: branches/new-help-system/base/src/pextlib1.0/system.h (from rev 65586, trunk/base/src/pextlib1.0/system.h)
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/system.h	                        (rev 0)
+++ branches/new-help-system/base/src/pextlib1.0/system.h	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,33 @@
+/*
+ * system.h
+ * $Id$
+ *
+ * Copyright (c) 2009 The MacPorts Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of The MacPorts Project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+int SystemCmd(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST objv[]);

Modified: branches/new-help-system/base/src/pextlib1.0/tests/checksums.tcl
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tests/checksums.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/tests/checksums.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -45,6 +45,10 @@
 		puts {[rmd160 file $testfile] != "b654ecbdced69aba8a4ea8d6824dd1ac103b3116"}
 		exit 1
 	}
+	if {[sha256 file $testfile] != "424359e1002a1d117f12f95346a81987037b3fde60a564a7aacb48c65a518fe5"} {
+		puts {[sha256 file $testfile] != "424359e1002a1d117f12f95346a81987037b3fde60a564a7aacb48c65a518fe5"}
+		exit 1
+	}
 
 	# delete the file.
 	file delete -force $testfile

Modified: branches/new-help-system/base/src/pextlib1.0/tests/curl.tcl
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tests/curl.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/tests/curl.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -28,8 +28,9 @@
 	test {[md5 file $tempfile] == "a4b0f4a5fbd8bec23002ad8023e01729"}
 	
 	# use -u
-	curl fetch -u "I accept www.opensource.org/licenses/cpl:." http://www.research.att.com/~gsf/download/tgz/sfio.2005-02-01.tgz $tempfile
-	test {[md5 file $tempfile] == "48f45c7c77c23ab0ccca48c22b3870de"}
+	# This URL does not work anymore, disabled the test
+	#curl fetch -u "I accept www.opensource.org/licenses/cpl:." http://www.research.att.com/~gsf/download/tgz/sfio.2005-02-01.tgz $tempfile
+	#test {[md5 file $tempfile] == "48f45c7c77c23ab0ccca48c22b3870de"}
 	
 	file delete -force $tempfile
 }

Modified: branches/new-help-system/base/src/pextlib1.0/tests/unsetenv.tcl
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tests/unsetenv.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/tests/unsetenv.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -5,15 +5,12 @@
     load $pextlibname
 
     global env
-    puts [array get env]
 
     array unset env *
-    puts [array get env]
     if {[array size env] > 0} {
         puts "note: your TclUnsetEnv is broken... (need to use unsetenv too)"
     }
     unsetenv *
-    puts [array get env]
     if {[array size env] > 0} {
         error "env not empty as expected"
     }

Modified: branches/new-help-system/base/src/pextlib1.0/tracelib.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tracelib.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/tracelib.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -158,7 +158,9 @@
 		return 0;
 	if(!len)
 		return 0;
-	buf[len]=0;
+	
+	buf[len] = '\0';
+	
 	for(t=buf;*t&&t-buf<(int)sizeof(buf);t=next_t)
 	{
 		next_t = t+strlen(t)+1;
@@ -176,7 +178,7 @@
 						ui_warn("recv failed");
 						return 0;
 					}
-					if(*end_of_t++ == 0)
+					if(*end_of_t++ == '\0')
 						break;
 				}
 			}
@@ -188,8 +190,12 @@
 			ui_warn("malformed command %s", t);
 			break;
 		}
-		*f++=0;
 
+		/* Replace \t with \0 */
+		*f = '\0';
+		/* Advance pointer to arguments */
+		f++;
+
 		if(!strcmp(t, "filemap"))
 		{
 			send_file_map(sock);
@@ -336,9 +342,9 @@
 {
 	char buf[1024], tclcmd[32];
 	
-	vsprintf(buf, format, va);
+	vsnprintf(buf, sizeof(buf), format, va);
 	
-	sprintf(tclcmd, "ui_%s $warn", severity);
+	snprintf(tclcmd, sizeof(tclcmd), "ui_%s $warn", severity);
 	
 	Tcl_SetVar(interp, "warn", buf, 0);
 	
@@ -380,6 +386,13 @@
 		return 0;
 	}
 	sock=socket(AF_UNIX, SOCK_STREAM, 0);
+	if (sock == -1) {
+		Tcl_SetErrno(errno);
+		Tcl_ResetResult(interp);
+		Tcl_AppendResult(interp, "socket: ", (char *) Tcl_PosixError(interp), NULL);
+		pthread_mutex_unlock(&sock_mutex);
+		return TCL_ERROR;
+	}
 	pthread_mutex_unlock(&sock_mutex);
 	
 	interp=in;
@@ -397,13 +410,19 @@
 	
 	sun.sun_family=AF_UNIX;
 	strlcpy(sun.sun_path, name, sizeof(sun.sun_path));
-	if(bind(sock, (struct sockaddr*)&sun, sizeof(sun))==-1)
-	{
-		Tcl_SetResult(interp, "Cannot bind socket", TCL_STATIC);
+	if (bind(sock, (struct sockaddr*)&sun, sizeof(sun)) == -1) {
+		Tcl_SetErrno(errno);
+		Tcl_ResetResult(interp);
+		Tcl_AppendResult(interp, "bind: ", (char *) Tcl_PosixError(interp), NULL);
 		return TCL_ERROR;
 	}
 	
-	listen(sock, 5);
+	if (listen(sock, 5) == -1) {
+		Tcl_SetErrno(errno);
+		Tcl_ResetResult(interp);
+		Tcl_AppendResult(interp, "listen: ", (char *) Tcl_PosixError(interp), NULL);
+		return TCL_ERROR;
+	}
 	max_used=0;
 	max_fd=sock;
 	


Property changes on: branches/new-help-system/base/src/pextlib1.0/tracelib.c
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/pextlib1.0/tracelib.h
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/pextlib1.0/tty.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/tty.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/tty.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,12 +37,9 @@
 #include <config.h>
 #endif
 
-#if HAVE_UNISTD_H
+#include <sys/ioctl.h>
 #include <unistd.h>
-#endif
 
-#include <sys/ioctl.h>
-
 #include <tcl.h>
 
 #include "tty.h"
@@ -53,7 +50,7 @@
     Tcl_Obj *tcl_result;
     Tcl_Channel chan;
     int dir;
-    int fd;
+    ClientData fd;
     int rval;
 
     if (objc != 2) {
@@ -69,11 +66,11 @@
 
     if (Tcl_GetChannelHandle(chan,
             dir & TCL_READABLE ? TCL_READABLE : TCL_WRITABLE,
-            (ClientData*) &fd) == TCL_ERROR) {
+            &fd) == TCL_ERROR) {
         return TCL_ERROR;
     }
 
-    rval = isatty(fd);
+    rval = isatty((int)(intptr_t)fd);
 
     tcl_result = Tcl_NewIntObj(rval);
     Tcl_SetObjResult(interp, tcl_result);
@@ -87,7 +84,7 @@
     Tcl_Obj *tcl_result;
     Tcl_Channel chan;
     int dir;
-    int fd;
+    ClientData fd;
     Tcl_Obj *robjv[2];
     struct winsize ws = {0, 0, 0, 0};
 
@@ -104,16 +101,16 @@
 
     if (Tcl_GetChannelHandle(chan,
             dir & TCL_READABLE ? TCL_READABLE : TCL_WRITABLE,
-            (ClientData*) &fd) == TCL_ERROR) {
+            &fd) == TCL_ERROR) {
         return TCL_ERROR;
     }
 
-    if (!isatty(fd)) {
+    if (!isatty((int)(intptr_t)fd)) {
         Tcl_SetResult(interp, "channel is not connected to a tty", TCL_STATIC);
         return TCL_ERROR;
     }
 
-    if (ioctl(fd, TIOCGWINSZ, &ws) == -1) {
+    if (ioctl((int)(intptr_t)fd, TIOCGWINSZ, &ws) == -1) {
         Tcl_SetResult(interp, "ioctl failed", TCL_STATIC);
         return TCL_ERROR;
     }

Modified: branches/new-help-system/base/src/pextlib1.0/uid.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/uid.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/uid.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -12,29 +12,14 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
 #include <grp.h>
-#include <string.h>
-
-#if HAVE_STDLIB_H
+#include <pwd.h>
+#include <stdio.h>
 #include <stdlib.h>
-#endif
-
-#if HAVE_UNISTD_H
+#include <string.h>
 #include <unistd.h>
-#endif
 
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#if HAVE_STDIO_H
-#include <stdio.h>
-#endif
-
-#if HAVE_PWD_H
-#include <pwd.h>
-#endif
-
 #include <tcl.h>
 
 #include "uid.h"

Modified: branches/new-help-system/base/src/pextlib1.0/xinstall.c
===================================================================
--- branches/new-help-system/base/src/pextlib1.0/xinstall.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/pextlib1.0/xinstall.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -70,6 +70,8 @@
 
 #include <tcl.h>
 
+#include "Pextlib.h"
+
 #if HAVE_PATHS_H
 #include <paths.h>
 #endif
@@ -139,8 +141,6 @@
 static int	trymmap(int);
 static void	usage(Tcl_Interp *interp);
 
-extern int	ui_info(Tcl_Interp *interp, char *mesg);
-
 int
 InstallCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
@@ -436,8 +436,10 @@
 	int devnull, files_match, from_fd = 0, serrno, target;
 	int tempcopy, temp_fd, to_fd = 0;
 	char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
-	char msg[256];
 
+        /* message contains function name, two paths and a little bit extra formatting */
+        char msg[MAXPATHLEN * 2 + 32];
+
 	files_match = 0;
 
 	/* If try to install NULL file to a directory, fails. */

Modified: branches/new-help-system/base/src/port/Makefile
===================================================================
--- branches/new-help-system/base/src/port/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -4,7 +4,7 @@
 
 edit = sed \
 	-e 's, at TCLSH\@,$(TCLSH),g' \
-	-e 's, at TCL_PACKAGE_DIR\@,$(TCL_PACKAGE_DIR),g'
+	-e 's, at macports_tcl_dir\@,$(macports_tcl_dir),g'
 
 include ../../Mk/macports.autoconf.mk
 

Modified: branches/new-help-system/base/src/port/port-help.tcl
===================================================================
--- branches/new-help-system/base/src/port/port-help.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port/port-help.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -15,6 +15,10 @@
 Archive the given ports
 }
 
+set porthelp(archivefetch) {
+Fetch archive for the given ports
+}
+
 set porthelp(build) {
 Build the given ports
 }
@@ -34,16 +38,20 @@
 }
 
 set porthelp(clean) {
-Removes file associates with given ports
+Removes files associated with the given ports
 
 --archive     Removes created archives
 --dist        Removes downloaded distfiles
+--logs        Removes log files
 --work        Removes work directory (default)
 --all         Removes everything from above
 }
 
-set porthelp(compact) {
-Compact the given ports (unimplemented)
+set porthelp(log) {
+Shows main log for given ports
+
+--phase <phase>		Filteres log file by phase (configure, fetch, etc..)
+--verbosity <ver>	Filteres log file by verbosity level (msg, debug, info)	
 }
 
 set porthelp(configure) {
@@ -233,7 +241,7 @@
 
 This allows you to choose which version, among several installed versions
 of a port, is to be considered primary.  What this means is which version
-becomes the one most would consider the default, eg, the one run without
+becomes the one most would consider the default, e.g. the one run without
 specifying any version.
 
 One example is the set of python ports, where there are (among others)
@@ -273,10 +281,6 @@
 Unarchive the given ports
 }
 
-set porthelp(uncompact) {
-Uncompact a port (unimplemented)
-}
-
 set porthelp(uninstall) {
 Uninstall the given ports
 }
@@ -285,10 +289,17 @@
 
 set porthelp(upgrade) {
 Upgrades the given ports to the latest version. Respects global options
--n, -R, -u, and -f (see the port man page).  Note that in selecting variants
+-n, -R, and -u (see the port man page).  Note that in selecting variants
 to use in the upgraded build of the port, the order of precedence is variants
 specified on the command line, then variants active in the latest installed
 version of the port, then the variants.conf file.
+
+--force             Ignore circumstances that would normally cause ports to be
+                    skipped (e.g. not outdated).
+--enforce-variants  If the installed variants do not match those requested,
+                    upgrade even if the port is not outdated.
+--no-replace        Do not replace one port with another according to the
+                    replaced_by field
 }
 
 set porthelp(url) {

Modified: branches/new-help-system/base/src/port/port.tcl
===================================================================
--- branches/new-help-system/base/src/port/port.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port/port.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -35,7 +35,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 
 catch {source \
-    [file join "@TCL_PACKAGE_DIR@" macports1.0 macports_fastload.tcl]}
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib 1.0
 
@@ -44,7 +44,7 @@
 proc print_usage {{verbose 1}} {
     global cmdname
     set syntax {
-        [-bcdfknopqRstuvxy] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
+        [-bcdfknopqRstuvy] [-D portdir] [-F cmdfile] action [privopts] [actionflags]
         [[portname|pseudo-portname|port-url] [@version] [+-variant]... [option=value]...]...
     }
 
@@ -78,11 +78,10 @@
         set cmds "$cmds$new"
     }
 
-    set cmdText [string range "
-Supported commands
+    set cmdText "Supported commands
 ------------------
 $cmds
-" 1 end-1]
+"
 
     set text {
 Pseudo-portnames
@@ -96,7 +95,7 @@
 variants:, variant:, description:, depends:, depends_lib:, depends_run:,
 depends_build:, depends_fetch:, depends_extract:, portdir:, homepage:, epoch:,
 platforms:, platform:, name:, long_description:, maintainers:, maintainer:,
-categories:, category:, version:, and revision:.
+categories:, category:, version:, revision:, and license:.
 These each select a set of ports based on a regex search of metadata
 about the ports. In all such cases, a standard regex pattern following
 the colon will be used to select the set of ports to which the
@@ -116,7 +115,7 @@
 porthier(7), portstyle(7). Also, see http://www.macports.org.
     }
 
-    puts "$cmdText $text"
+    puts "$cmdText$text"
 }
 
 
@@ -127,7 +126,32 @@
     exit 1
 }
 
+##
+# Helper function to define constants
+#
+# Constants defined with const can simply be accessed in the same way as
+# calling a proc.
+#
+# Example:
+# const FOO 42
+# puts [FOO]
+#
+# @param name variable name
+# @param value constant variable value
+proc const {name args} {
+    interp alias {} $name {} _const [expr $args]
+}
 
+##
+# Helper function to define constants
+#
+# @see const
+proc _const value {
+    return $value
+}
+
+
+
 # Produce an error message, and exit, unless
 # we're handling errors in a soft fashion, in which
 # case we continue
@@ -156,6 +180,12 @@
     }
 }
 
+# show the URL for the ticket reporting instructions
+proc print_tickets_url {args} {
+    if {![macports::ui_isset ports_quiet]} {
+        ui_msg "To report a bug, see <http://guide.macports.org/#project.tickets>"
+    }
+}
 
 # Form a composite version as is sometimes used for registry functions
 proc composite_version {version variations {emptyVersionOkay 0}} {
@@ -260,6 +290,7 @@
     #   name
     #   version         (version_revision)
     #   variants array  (variant=>+-)
+    #   requested_variants array  (variant=>+-)
     #   options array   (key=>value)
     #   fullname        (name/version_revision+-variants)
 
@@ -268,6 +299,7 @@
     if {![info exists port(name)]}      { set port(name) "" }
     if {![info exists port(version)]}   { set port(version) "" }
     if {![info exists port(variants)]}  { set port(variants) "" }
+    if {![info exists port(requested_variants)]}  { set port(requested_variants) "" }
     if {![info exists port(options)]}   { set port(options) [array get global_options] }
 
     # If neither portname nor url is specified, then default to the current port
@@ -300,7 +332,8 @@
     foreach portentry $ports {
         array set port $portentry
         if ([info exists overrides(version)])   { set port(version) $overrides(version) }
-        if ([info exists overrides(variants)])  { set port(variants) $overrides(variants)   }
+        if ([info exists overrides(variants)])  { set port(variants) $overrides(variants) }
+        if ([info exists overrides(requested_variants)])  { set port(requested_variants) $overrides(requested_variants) }
         if ([info exists overrides(options)])   { set port(options) $overrides(options) }
         add_to_portlist portlist [array get port]
     }
@@ -332,7 +365,7 @@
     upvar $nameportlist portlist
 
     if {[llength $portlist] == 0 && (![info exists private_options(ports_no_args)] || $private_options(ports_no_args) == "no")} {
-        ui_error "No ports found"
+        ui_error "No ports matched the given expression"
         return 1
     }
 
@@ -364,6 +397,8 @@
             set portversion $portspec(version)
             array unset variations
             array set variations $portspec(variants)
+            array unset requested_variations
+            array set requested_variations $portspec(requested_variants)
             array unset options
             array set options $portspec(options)
         }
@@ -431,11 +466,11 @@
         if {[isatty stdout]} {
             set size [term_get_size stdout]
 
-            if {![info exists env(LINES)]} {
+            if {![info exists env(LINES)] && [lindex $size 0] > 0} {
                 set env(LINES) [lindex $size 0]
             }
 
-            if {![info exists env(COLUMNS)]} {
+            if {![info exists env(COLUMNS)] && [lindex $size 1] > 0} {
                 set env(COLUMNS) [lindex $size 1]
             }
         }
@@ -463,8 +498,10 @@
     }
 
     set splitstring {}
+    set indentline $indentfirstline
     foreach line [split $string "\n"] {
-        lappend splitstring [wrapline $line $maxlen $indent $indentfirstline]
+        lappend splitstring [wrapline $line $maxlen $indent $indentline]
+        set indentline 1
     }
     return [join $splitstring "\n"]
 }
@@ -584,7 +621,19 @@
     global all_ports_cache
 
     if {![info exists all_ports_cache]} {
-        set all_ports_cache [get_matching_ports "*"]
+         if {[catch {set res [mportlistall]} result]} {
+            global errorInfo
+            ui_debug "$errorInfo"
+            fatal "listing all ports failed: $result"
+        }
+        set results {}
+        foreach {name info} $res {
+            array unset portinfo
+            array set portinfo $info
+            add_to_portlist results [list url $portinfo(porturl) name $name]
+        }
+
+        set all_ports_cache [portlist_sort $results]
     }
     return $all_ports_cache
 }
@@ -676,6 +725,9 @@
     # Now process the list, keeping only those ports that are outdated
     set results {}
     if { [llength $ilist] > 0 } {
+        global tcl_platform
+        set os_platform [string tolower $tcl_platform(os)]
+        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
         foreach i $ilist {
 
             # Get information about the installed port
@@ -725,6 +777,16 @@
                     set comp_result [rpm-vercomp $installed_revision $latest_revision]
                 }
             }
+            if {$comp_result == 0} {
+                set regref [registry::open_entry $portname $installed_version $installed_revision $installed_variants $installed_epoch]
+                set os_platform_installed [registry::property_retrieve $regref os_platform]
+                set os_major_installed [registry::property_retrieve $regref os_major]
+                if {$os_platform_installed != "" && $os_platform_installed != 0
+                    && $os_major_installed != "" && $os_major_installed != 0
+                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    set comp_result -1
+                }
+            }
 
             # Add outdated ports to our results list
             if { $comp_result < 0 } {
@@ -758,7 +820,43 @@
     return [portlist_sort $results]
 }
 
+# return ports that have registry property $propname set to $propval
+proc get_ports_with_prop {propname propval} {
+    set ilist {}
+    if { [catch {set ilist [registry::installed]} result] } {
+        if {$result != "Registry error: No ports registered as installed."} {
+            global errorInfo
+            ui_debug "$errorInfo"
+            fatal "port installed failed: $result"
+        }
+    }
 
+    set results {}
+    foreach i $ilist {
+        set iname [lindex $i 0]
+        set iversion [lindex $i 1]
+        set irevision [lindex $i 2]
+        set ivariants [lindex $i 3]
+        set iepoch [lindex $i 5]
+        set regref [registry::open_entry $iname $iversion $irevision $ivariants $iepoch]
+        if {[registry::property_retrieve $regref $propname] == $propval} {
+            add_to_portlist results [list name $iname version "${iversion}_${irevision}" variants [split_variants $ivariants]]
+        }
+    }
+
+    # Return the list of ports, sorted
+    return [portlist_sort $results]
+}
+
+proc get_requested_ports {} {
+    return [get_ports_with_prop requested 1]
+}
+
+proc get_unrequested_ports {} {
+    return [get_ports_with_prop requested 0]
+}
+
+
 ##########################################
 # Port expressions
 ##########################################
@@ -880,7 +978,7 @@
     set url ""
     set name ""
     set version ""
-    array unset variants
+    array unset requested_variants
     array unset options
     
     set token [lookahead]
@@ -905,6 +1003,8 @@
         ^inactive(@.*)?$    -
         ^outdated(@.*)?$    -
         ^obsolete(@.*)?$    -
+        ^requested(@.*)?$   -
+        ^unrequested(@.*)?$ -
         ^current(@.*)?$     {
             # A simple pseudo-port name
             advance
@@ -937,7 +1037,8 @@
         ^depends_run:       -
         ^depends_extract:   -
         ^depends_fetch:     -
-        ^revision:          { # Handle special port selectors
+        ^revision:          -
+        ^license:           { # Handle special port selectors
             advance
 
             # Break up the token, because older Tcl switch doesn't support -matchvar
@@ -974,11 +1075,12 @@
             advance
             set name [url_to_portname $token]
             if {$name != ""} {
-                parsePortSpec version variants options
+                parsePortSpec version requested_variants options
                 add_to_portlist reslist [list url $token \
                   name $name \
                   version $version \
-                  variants [array get variants] \
+                  requested_variants [array get requested_variants] \
+                  variants [array get requested_variants] \
                   options [array get options]]
             } else {
                 ui_error "Can't open URL '$token' as a port"
@@ -989,11 +1091,12 @@
 
         default             { # Treat anything else as a portspec (portname, version, variants, options
             # or some combination thereof).
-            parseFullPortSpec url name version variants options
+            parseFullPortSpec url name version requested_variants options
             add_to_portlist reslist [list url $url \
               name $name \
               version $version \
-              variants [array get variants] \
+              requested_variants [array get requested_variants] \
+              variants [array get requested_variants] \
               options [array get options]]
             set el 1
         }
@@ -1013,7 +1116,12 @@
     
     array unset overrides
     if {$version != ""} { set overrides(version) $version }
-    if {[array size variants]} { set overrides(variants) [array get variants] }
+    if {[array size variants]} {
+        # we always record the requested variants separately,
+        # but requested ones always override existing ones
+        set overrides(requested_variants) [array get variants]
+        set overrides(variants) [array get variants]
+    }
     if {[array size options]} { set overrides(options) [array get options] }
 
     add_ports_to_portlist reslist $ports [array get overrides]
@@ -1300,9 +1408,9 @@
         }
         set args ""
         set needed [action_needs_portlist $action]
-        if {[action_args_const strings] == $needed} {
+        if {[ACTION_ARGS_STRINGS] == $needed} {
             set args " <arguments>"
-        } elseif {[action_args_const strings] == $needed} {
+        } elseif {[ACTION_ARGS_STRINGS] == $needed} {
             set args " <portlist>"
         }
 
@@ -1332,6 +1440,7 @@
             return 1
         }
     }
+    return 0
 }
 
 
@@ -1374,6 +1483,82 @@
 }
 
 
+proc action_log { action portlist opts } {
+    global global_options
+    if {[require_portlist portlist]} {
+        return 1
+    }
+    foreachport $portlist {
+        # If we have a url, use that, since it's most specific
+        # otherwise try to map the portname to a url
+        if {$porturl eq ""} {
+        # Verify the portname, getting portinfo to map to a porturl
+            if {[catch {mportlookup $portname} result]} {
+                ui_debug "$::errorInfo"
+                break_softcontinue "lookup of portname $portname failed: $result" 1 status
+            }
+            if {[llength $result] < 2} {
+                break_softcontinue "Port $portname not found" 1 status
+            }
+            array unset portinfo
+            array set portinfo [lindex $result 1]
+            set porturl $portinfo(porturl)
+            set portdir $portinfo(portdir)
+        } elseif {$porturl ne "file://."} {
+            # Extract the portdir from porturl and use it to search PortIndex.
+            # Only the last two elements of the path (porturl) make up the
+            # portdir.
+            set portdir [file split [macports::getportdir $porturl]]
+            set lsize [llength $portdir]
+            set portdir \
+                [file join [lindex $portdir [expr $lsize - 2]] \
+                           [lindex $portdir [expr $lsize - 1]]]
+            if {[catch {mportsearch $portdir no exact portdir} result]} {
+                ui_debug "$::errorInfo"
+                break_softcontinue "Portdir $portdir not found" 1 status
+            }
+            if {[llength $result] < 2} {
+                break_softcontinue "Portdir $portdir not found" 1 status
+            }
+            array unset portinfo
+            array set portinfo [lindex $result 1]
+        }
+        set portpath [macports::getportdir $porturl]
+        set logfile [file join [macports::getportlogpath $portpath] "main.log"]
+        if {[file exists $logfile]} {
+            if {[catch {set fp [open $logfile r]} result]} {
+                break_softcontinue "Could not open file $logfile: $result" 1 status
+            }
+            set data [read $fp]
+            set data [split $data "\n"]
+
+            if {[info exists global_options(ports_log_phase)]} {
+                set phase $global_options(ports_log_phase);
+            } else {
+                set phase "\[a-z\]*"
+            }
+
+            if {[info exists global_options(ports_log_verbosity)]} {
+                set prefix $global_options(ports_log_verbosity);
+            } else {
+                set prefix "\[a-z\]*"
+            }
+            foreach line $data {
+                set exp "^:($prefix|any):($phase|any) (.*)$"
+                if {[regexp $exp $line -> lpriority lphase lmsg] == 1} {
+                    puts "[macports::ui_prefix_default $lpriority]$lmsg"
+                }
+            }
+
+            close $fp
+        } else {
+            break_softcontinue "Log file for port $portname not found" 1 status
+        }
+    }
+    return 0
+}
+
+
 proc action_info { action portlist opts } {
     global global_variations
     set status 0
@@ -1479,11 +1664,13 @@
             maintainers Maintainers
             license     License
             conflicts   "Conflicts with"
+            replaced_by "Replaced by"
         }
 
         # Wrap-length map for pretty printing
         array set pretty_wrap {
             heading 0
+            replaced_by 22
             variants 22
             depends_fetch 22
             depends_extract 22
@@ -1547,7 +1734,9 @@
         set opts_todo [array names options ports_info_*]
         set fields_tried {}
         if {![llength $opts_todo]} {
-            set opts_todo {ports_info_heading ports_info_variants 
+            set opts_todo {ports_info_heading
+                ports_info_replaced_by
+                ports_info_variants 
                 ports_info_skip_line
                 ports_info_long_description ports_info_homepage 
                 ports_info_skip_line ports_info_depends_fetch
@@ -1720,9 +1909,10 @@
             set version [lindex $ilist 1]
             set revision [lindex $ilist 2]
             set variants [lindex $ilist 3]
+            set epoch [lindex $ilist 5]
         }
 
-        set ref [registry::open_entry $portname $version $revision $variants]
+        set ref [registry::open_entry $portname $version $revision $variants $epoch]
         if { [string equal [registry::property_retrieve $ref installtype] "image"] } {
             set imagedir [registry::property_retrieve $ref imagedir]
             if {![macports::ui_isset ports_quiet]} {
@@ -1743,6 +1933,7 @@
         return 1
     }
 
+    set status 0
     foreachport $portlist {
         if {$porturl eq ""} {
             # Look up the port.
@@ -1760,6 +1951,16 @@
             array set portinfo [lindex $result 1]
             set porturl $portinfo(porturl)
         }
+        
+        # Add any global_variations to the variations
+        # specified for the port
+        array unset merged_variations
+        array set merged_variations [array get variations]
+        foreach { variation value } [array get global_variations] { 
+            if { ![info exists merged_variations($variation)] } { 
+                set merged_variations($variation) $value 
+            } 
+        }
 
         # Open the Portfile associated with this port.
         if {[catch {set mport [mportopen $porturl [array get options] \
@@ -1793,6 +1994,7 @@
             }
         }
     }
+    return $status
 }
 
 
@@ -1806,8 +2008,8 @@
     }
     foreach filename $portlist {
         set file [file normalize $filename]
-        if {[file exists $file]} {
-            if {![file isdirectory $file]} {
+        if {[file exists $file] || ![catch {file type $file}]} {
+            if {![file isdirectory $file] || [file type $file] == "link"} {
                 set port [registry::file_registered $file]
                 if { $port != 0 } {
                     puts "$file is provided by: $port"
@@ -1828,13 +2030,22 @@
 
 
 proc action_activate { action portlist opts } {
+    global macports::registry.format
     set status 0
     if {[require_portlist portlist]} {
         return 1
     }
     foreachport $portlist {
+        set composite_version [composite_version $portversion [array get variations]]
+        if {${macports::registry.format} == "receipt_sqlite" && ![catch {set ilist [registry::installed $portname $composite_version]}] && [llength $ilist] == 1} {
+            set i [lindex $ilist 0]
+            set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+            if {[registry::run_target $regref activate [array get options]]} {
+                continue
+            }
+        }
         if {![macports::global_option_isset ports_dryrun]} {
-            if { [catch {portimage::activate $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
+            if { [catch {portimage::activate $portname $composite_version [array get options]} result] } {
                 global errorInfo
                 ui_debug "$errorInfo"
                 break_softcontinue "port activate failed: $result" 1 status
@@ -1849,13 +2060,27 @@
 
 
 proc action_deactivate { action portlist opts } {
+    global macports::registry.format
     set status 0
     if {[require_portlist portlist]} {
         return 1
     }
     foreachport $portlist {
+        set composite_version [composite_version $portversion [array get variations]]
+        if {${macports::registry.format} == "receipt_sqlite" && ![catch {set ilist [registry::active $portname]}]} {
+            set i [lindex $ilist 0]
+            set iversion [lindex $i 1]
+            set irevision [lindex $i 2]
+            set ivariants [lindex $i 3]
+            if {$composite_version == "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
+                set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
+                if {[registry::run_target $regref deactivate [array get options]]} {
+                    continue
+                }
+            }
+        }
         if {![macports::global_option_isset ports_dryrun]} {
-            if { [catch {portimage::deactivate $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
+            if { [catch {portimage::deactivate $portname $composite_version [array get options]} result] } {
                 global errorInfo
                 ui_debug "$errorInfo"
                 break_softcontinue "port deactivate failed: $result" 1 status
@@ -1910,15 +2135,30 @@
                                 "arguments. Extra arguments will be ignored."]
             }
 
+            if {[catch {mportselect show $group} selected_version]} {
+                global errorInfo
+                ui_debug $errorInfo
+                ui_warn "Unable to get active selected version: $selected_version"
+            }
+
             # On error mportselect returns with the code 'error'.
             if {[catch {mportselect $command $group} versions]} {
                 ui_error "The 'list' command failed: $versions"
                 return 1
             }
 
-            puts "Available Versions:"
+            if {![macports::ui_isset ports_quiet] && [isatty stdout]} {
+                puts "Available versions for $group:"
+            }
             foreach v $versions {
-                puts "\t$v"
+                if {![macports::ui_isset ports_quiet] && [isatty stdout]} {
+                    puts -nonewline "\t"
+                }
+                if {$selected_version == $v} {
+                    puts "$v (active)"
+                } else {
+                    puts "$v"
+                }
             }
             return 0
         }
@@ -1966,37 +2206,68 @@
 
 proc action_selfupdate { action portlist opts } {
     global global_options
-    if { [catch {macports::selfupdate [array get global_options]} result ] } {
+    if { [catch {macports::selfupdate [array get global_options] base_updated} result ] } {
         global errorInfo
         ui_debug "$errorInfo"
         fatal "port selfupdate failed: $result"
     }
     
-    return 0
+    if {$base_updated} {
+        # exit immediately if in batch/interactive mode
+        return -999
+    } else {
+        return 0
+    }
 }
 
 
+proc action_setrequested { action portlist opts } {
+    set status 0
+    if {[require_portlist portlist]} {
+        return 1
+    }
+    # set or unset?
+    set val [string equal $action setrequested]
+    foreachport $portlist {
+        set composite_version [composite_version $portversion [array get variations]]
+        if {![catch {set ilist [registry::installed $portname $composite_version]}]} {
+            ui_info "Setting requested flag for $portname to $val"
+            foreach i $ilist {
+                set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+                registry::property_store $regref requested $val
+            }
+        } else {
+            global errorInfo
+            ui_debug "$errorInfo"
+            break_softcontinue "$result" 1 status
+        }
+    }
+    
+    return $status
+}
+
+
 proc action_upgrade { action portlist opts } {
-    global global_variations
     if {[require_portlist portlist]} {
         return 1
     }
     # shared depscache for all ports in the list
     array set depscache {}
+    set status 0
     foreachport $portlist {
-        if {![registry::entry_exists_for_name $portname]} {
-            ui_error "$portname is not installed"
-            return 1
-        }
         if {![info exists depscache(port:$portname)]} {
-            # Global variations will have to be merged into the specified
-            # variations, but perhaps after the installed variations are
-            # merged. So we pass them into upgrade:
-            macports::upgrade $portname "port:$portname" [array get global_variations] [array get variations] [array get options] depscache
+            set status [macports::upgrade $portname "port:$portname" [array get requested_variations] [array get options] depscache]
+            if {$status != 0 && ![macports::ui_isset ports_processall]} {
+                break
+            }
         }
     }
+    
+    if {$status != 0} {
+        print_tickets_url
+    }
 
-    return 0
+    return $status
 }
 
 
@@ -2021,40 +2292,6 @@
 }
 
 
-proc action_compact { action portlist opts } {
-    set status 0
-    if {[require_portlist portlist]} {
-        return 1
-    }
-    foreachport $portlist {
-        if { [catch {portimage::compact $portname [composite_version $portversion [array get variations]]} result] } {
-            global errorInfo
-            ui_debug "$errorInfo"
-            break_softcontinue "port compact failed: $result" 1 status
-        }
-    }
-
-    return $status
-}
-
-
-proc action_uncompact { action portlist opts } {
-    set status 0
-    if {[require_portlist portlist]} {
-        return 1
-    }
-    foreachport $portlist {
-        if { [catch {portimage::uncompact $portname [composite_version $portversion [array get variations]]} result] } {
-            global errorInfo
-            ui_debug "$errorInfo"
-            break_softcontinue "port uncompact failed: $result" 1 status
-        }
-    }
-    
-    return $status
-}
-
-
 proc action_dependents { action portlist opts } {
     if {[require_portlist portlist]} {
         return 1
@@ -2063,6 +2300,7 @@
 
     registry::open_dep_map
 
+    set status 0
     foreachport $portlist {
         set composite_version [composite_version $portversion [array get variations]]
         if { [catch {set ilist [registry::installed $portname $composite_version]} result] } {
@@ -2070,11 +2308,26 @@
             ui_debug "$errorInfo"
             break_softcontinue "$result" 1 status
         } else {
+            # choose the active version if there is one
+            set index 0
+            foreach i $ilist {
+                if {[lindex $i 4]} {
+                    set found 1
+                    break
+                }
+                incr index
+            }
+            if {![info exists found]} {
+                set index 0
+            }
             # set portname again since the one we were passed may not have had the correct case
-            set portname [lindex [lindex $ilist 0] 0]
+            set portname [lindex [lindex $ilist $index] 0]
+            set iversion [lindex [lindex $ilist $index] 1]
+            set irevision [lindex [lindex $ilist $index] 2]
+            set ivariants [lindex [lindex $ilist $index] 3]
         }
         
-        set deplist [registry::list_dependents $portname]
+        set deplist [registry::list_dependents $portname $iversion $irevision $ivariants]
         if { [llength $deplist] > 0 } {
             set dl [list]
             # Check the deps first
@@ -2090,11 +2343,12 @@
             ui_msg "$portname has no dependents!"
         }
     }
-    return 0
+    return $status
 }
 
 
 proc action_uninstall { action portlist opts } {
+    global macports::registry.format
     set status 0
     if {[macports::global_option_isset port_uninstall_old]} {
         # if -u then uninstall all inactive ports
@@ -2108,14 +2362,29 @@
     }
 
     foreachport $portlist {
-        if { [catch {portuninstall::uninstall $portname [composite_version $portversion [array get variations]] [array get options]} result] } {
+        if {![registry::entry_exists_for_name $portname]} {
+            ui_info "$portname is already uninstalled"
+            continue
+        }
+        set composite_version [composite_version $portversion [array get variations]]
+        if {${macports::registry.format} == "receipt_sqlite" && ![catch {set ilist [registry::installed $portname $composite_version]}] && [llength $ilist] == 1} {
+            set i [lindex $ilist 0]
+            set iactive [lindex $i 4]
+            set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
+            if {(!$iactive || [registry::run_target $regref deactivate [array get options]])
+                && [registry::run_target $regref uninstall [array get options]]} {
+                continue
+            }
+        }
+
+        if { [catch {registry_uninstall::uninstall $portname $composite_version [array get options]} result] } {
             global errorInfo
             ui_debug "$errorInfo"
             break_softcontinue "port uninstall failed: $result" 1 status
         }
     }
 
-    return 0
+    return $status
 }
 
 
@@ -2164,11 +2433,15 @@
             }
         }
     } elseif { $restrictedList } {
-        puts "None of the specified ports are installed."
+        if {![macports::ui_isset ports_quiet]} {
+            puts "None of the specified ports are installed."
+        }
     } else {
-        puts "No ports are installed."
+        if {![macports::ui_isset ports_quiet]} {
+            puts "No ports are installed."
+        }
     }
-    
+
     return $status
 }
 
@@ -2208,8 +2481,11 @@
     }
 
     set num_outdated 0
-    if { [llength $ilist] > 0 } {   
-        foreach i $ilist { 
+    if { [llength $ilist] > 0 } {
+        global tcl_platform
+        set os_platform [string tolower $tcl_platform(os)]
+        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
+        foreach i $ilist {
         
             # Get information about the installed port
             set portname [lindex $i 0]
@@ -2239,6 +2515,10 @@
             array set portinfo [lindex $res 1]
             
             # Get information about latest available version and revision
+            if {![info exists portinfo(version)]} {
+                ui_warn "$portname has no version field"
+                continue
+            }
             set latest_version $portinfo(version)
             set latest_revision 0
             if {[info exists portinfo(revision)] && $portinfo(revision) > 0} { 
@@ -2251,11 +2531,24 @@
             }
             
             # Compare versions, first checking epoch, then version, then revision
-            set comp_result [expr $installed_epoch - $latest_epoch]
+            set epoch_comp_result [expr $installed_epoch - $latest_epoch]
+            set comp_result [rpm-vercomp $installed_version $latest_version]
             if { $comp_result == 0 } {
-                set comp_result [rpm-vercomp $installed_version $latest_version]
-                if { $comp_result == 0 } {
-                    set comp_result [rpm-vercomp $installed_revision $latest_revision]
+                set comp_result [rpm-vercomp $installed_revision $latest_revision]
+            }
+            set reason ""
+            if {$comp_result == 0 && $epoch_comp_result != 0} {
+                set reason { (epoch $installed_epoch $relation $latest_epoch)}
+                set comp_result $epoch_comp_result
+            } elseif {$comp_result == 0 && $epoch_comp_result == 0} {
+                set regref [registry::open_entry $portname $installed_version $installed_revision [lindex $i 3] $installed_epoch]
+                set os_platform_installed [registry::property_retrieve $regref os_platform]
+                set os_major_installed [registry::property_retrieve $regref os_major]
+                if {$os_platform_installed != "" && $os_platform_installed != 0
+                    && $os_major_installed != "" && $os_major_installed != 0
+                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    set comp_result -1
+                    set reason { (platform $os_platform_installed $os_major_installed != $os_platform $os_major)}
                 }
             }
             
@@ -2279,7 +2572,7 @@
                     }
                     incr num_outdated
 
-                    puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound" $flag]
+                    puts [format "%-30s %-24s %1s" $portname "$installed_compound $relation $latest_compound [subst $reason]" $flag]
                 }
                 
             }
@@ -2323,7 +2616,7 @@
                 }
             } else {
                 if {![macports::ui_isset ports_quiet]} {
-                    puts "Port $portname does not contain any file or is not active."
+                    puts "Port $portname does not contain any files or is not active."
                 }
             }
         } else {
@@ -2617,16 +2910,19 @@
     
     foreachport $portlist {
         if {$portname == "-all-"} {
-            set search_string ".+"
+           if {[catch {set res [mportlistall]} result]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                break_softcontinue "listing all ports failed: $result" 1 status
+            }
         } else {
             set search_string [regex_pat_sanitize $portname]
+            if {[catch {set res [mportsearch ^$search_string\$ no]} result]} {
+                global errorInfo
+                ui_debug "$errorInfo"
+                break_softcontinue "search for portname $search_string failed: $result" 1 status
+            }
         }
-        
-        if {[catch {set res [mportsearch ^$search_string\$ no]} result]} {
-            global errorInfo
-            ui_debug "$errorInfo"
-            break_softcontinue "search for portname $search_string failed: $result" 1 status
-        }
 
         foreach {name array} $res {
             array unset portinfo
@@ -2646,20 +2942,24 @@
 proc action_echo { action portlist opts } {
     # Simply echo back the port specs given to this command
     foreachport $portlist {
-        set opts {}
-        foreach { key value } [array get options] {
-            lappend opts "$key=$value"
-        }
-        
-        set composite_version [composite_version $portversion [array get variations] 1]
-        if { $composite_version != "" } {
-            set ver_field "@$composite_version"
+        if {![macports::ui_isset ports_quiet]} {
+            set opts {}
+            foreach { key value } [array get options] {
+                lappend opts "$key=$value"
+            }
+
+            set composite_version [composite_version $portversion [array get variations] 1]
+            if { $composite_version != "" } {
+                set ver_field "@$composite_version"
+            } else {
+                set ver_field ""
+            }
+            puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
         } else {
-            set ver_field ""
+            puts "$portname"
         }
-        puts [format "%-30s %s %s" $portname $ver_field  [join $opts " "]]
     }
-    
+
     return 0
 }
 
@@ -2794,7 +3094,11 @@
 
                     # Try to open a browser to the homepage for the given port
                     if { $homepage != "" } {
-                        system "${macports::autoconf::open_path} '$homepage'"
+                        if {[catch {system "${macports::autoconf::open_path} '$homepage'"} result]} {
+                            global errorInfo
+                            ui_debug "$errorInfo"
+                            break_softcontinue "unable to invoke browser using ${macports::autoconf::open_path}: $result" 1 status
+                        }
                     } else {
                         ui_error [format "No homepage for %s" $portname]
                     }
@@ -2830,9 +3134,8 @@
     if {[require_portlist portlist]} {
         return 1
     }
+    set target $action
     foreachport $portlist {
-        set target $action
-
         # If we have a url, use that, since it's most specific
         # otherwise try to map the portname to a url
         if {$porturl == ""} {
@@ -2856,11 +3159,30 @@
             set porturl $portinfo(porturl)
         }
         
+        # use existing variants iff none were explicitly requested
+        if {[array get requested_variations] == "" && [array get variations] != ""} {
+            array unset requested_variations
+            array set requested_variations [array get variations]
+            set filtered_variations [mport_filtervariants [array get variations] no]
+        } else {
+            set filtered_variations [mport_filtervariants [array get requested_variations] yes]
+        }
+        # Filter out implicit variants from the explicitly set/unset variants.
+        # Except we need to keep them for some targets to work right...
+        switch -exact $target {
+            distfiles -
+            mirror {}
+            default {
+                array unset requested_variations
+                array set requested_variations $filtered_variations
+            }
+        }
+        
         # Add any global_variations to the variations
         # specified for the port
         foreach { variation value } [array get global_variations] {
-            if { ![info exists variations($variation)] } {
-                set variations($variation) $value
+            if { ![info exists requested_variations($variation)] } {
+                set requested_variations($variation) $value
             }
         }
 
@@ -2869,7 +3191,11 @@
         if {[string length $portversion]} {
             set options(ports_version_glob) $portversion
         }
-        if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result]} {
+        # if installing, mark the port as explicitly requested
+        if {$target == "install"} {
+            set options(ports_requested) 1
+        }
+        if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
             global errorInfo
             ui_debug "$errorInfo"
             break_softcontinue "Unable to open port: $result" 1 status
@@ -2889,6 +3215,10 @@
         }
     }
     
+    if {$status != 0} {
+        print_tickets_url
+    }
+    
     return $status
 }
 
@@ -2939,103 +3269,97 @@
 #   0 none        Does not expect any text argument
 #   1 strings     Expects some strings as text argument
 #   2 ports       Wants an expanded list of ports as text argument
-# Use action_args_const to translate them
 global action_array
-proc action_args_const {arg} {
-    switch -- $arg {
-        none {
-            return 0
-        }
-        strings {
-            return 1
-        }
-        default -
-        ports {
-            return 2
-        }
-    }
-}
+
+# Define global constants
+const ACTION_ARGS_NONE 0
+const ACTION_ARGS_STRINGS 1
+const ACTION_ARGS_PORTS 2
+
 array set action_array [list \
-    usage       [list action_usage          [action_args_const strings]] \
-    help        [list action_help           [action_args_const strings]] \
+    usage       [list action_usage          [ACTION_ARGS_STRINGS]] \
+    help        [list action_help           [ACTION_ARGS_STRINGS]] \
     \
-    echo        [list action_echo           [action_args_const ports]] \
+    echo        [list action_echo           [ACTION_ARGS_PORTS]] \
     \
-    info        [list action_info           [action_args_const ports]] \
-    location    [list action_location       [action_args_const ports]] \
-    notes       [list action_notes          [action_args_const ports]] \
-    provides    [list action_provides       [action_args_const strings]] \
+    info        [list action_info           [ACTION_ARGS_PORTS]] \
+    location    [list action_location       [ACTION_ARGS_PORTS]] \
+    notes       [list action_notes          [ACTION_ARGS_PORTS]] \
+    provides    [list action_provides       [ACTION_ARGS_STRINGS]] \
+    log         [list action_log            [ACTION_ARGS_PORTS]] \
     \
-    activate    [list action_activate       [action_args_const ports]] \
-    deactivate  [list action_deactivate     [action_args_const ports]] \
+    activate    [list action_activate       [ACTION_ARGS_PORTS]] \
+    deactivate  [list action_deactivate     [ACTION_ARGS_PORTS]] \
     \
-    select      [list action_select         [action_args_const strings]] \
+    select      [list action_select         [ACTION_ARGS_STRINGS]] \
     \
-    sync        [list action_sync           [action_args_const none]] \
-    selfupdate  [list action_selfupdate     [action_args_const none]] \
+    sync        [list action_sync           [ACTION_ARGS_NONE]] \
+    selfupdate  [list action_selfupdate     [ACTION_ARGS_NONE]] \
     \
-    upgrade     [list action_upgrade        [action_args_const ports]] \
+    setrequested   [list action_setrequested  [ACTION_ARGS_PORTS]] \
+    unsetrequested [list action_setrequested  [ACTION_ARGS_PORTS]] \
     \
-    version     [list action_version        [action_args_const none]] \
-    platform    [list action_platform       [action_args_const none]] \
-    compact     [list action_compact        [action_args_const ports]] \
-    uncompact   [list action_uncompact      [action_args_const ports]] \
+    upgrade     [list action_upgrade        [ACTION_ARGS_PORTS]] \
     \
-    uninstall   [list action_uninstall      [action_args_const ports]] \
+    version     [list action_version        [ACTION_ARGS_NONE]] \
+    platform    [list action_platform       [ACTION_ARGS_NONE]] \
     \
-    installed   [list action_installed      [action_args_const ports]] \
-    outdated    [list action_outdated       [action_args_const ports]] \
-    contents    [list action_contents       [action_args_const ports]] \
-    dependents  [list action_dependents     [action_args_const ports]] \
-    deps        [list action_info           [action_args_const ports]] \
-    variants    [list action_variants       [action_args_const ports]] \
+    uninstall   [list action_uninstall      [ACTION_ARGS_PORTS]] \
     \
-    search      [list action_search         [action_args_const strings]] \
-    list        [list action_list           [action_args_const ports]] \
+    installed   [list action_installed      [ACTION_ARGS_PORTS]] \
+    outdated    [list action_outdated       [ACTION_ARGS_PORTS]] \
+    contents    [list action_contents       [ACTION_ARGS_PORTS]] \
+    dependents  [list action_dependents     [ACTION_ARGS_PORTS]] \
+    deps        [list action_info           [ACTION_ARGS_PORTS]] \
+    variants    [list action_variants       [ACTION_ARGS_PORTS]] \
     \
-    ed          [list action_portcmds       [action_args_const ports]] \
-    edit        [list action_portcmds       [action_args_const ports]] \
-    cat         [list action_portcmds       [action_args_const ports]] \
-    dir         [list action_portcmds       [action_args_const ports]] \
-    work        [list action_portcmds       [action_args_const ports]] \
-    cd          [list action_portcmds       [action_args_const ports]] \
-    url         [list action_portcmds       [action_args_const ports]] \
-    file        [list action_portcmds       [action_args_const ports]] \
-    gohome      [list action_portcmds       [action_args_const ports]] \
+    search      [list action_search         [ACTION_ARGS_STRINGS]] \
+    list        [list action_list           [ACTION_ARGS_PORTS]] \
     \
-    fetch       [list action_target         [action_args_const ports]] \
-    checksum    [list action_target         [action_args_const ports]] \
-    extract     [list action_target         [action_args_const ports]] \
-    patch       [list action_target         [action_args_const ports]] \
-    configure   [list action_target         [action_args_const ports]] \
-    build       [list action_target         [action_args_const ports]] \
-    destroot    [list action_target         [action_args_const ports]] \
-    install     [list action_target         [action_args_const ports]] \
-    clean       [list action_target         [action_args_const ports]] \
-    test        [list action_target         [action_args_const ports]] \
-    lint        [list action_target         [action_args_const ports]] \
-    submit      [list action_target         [action_args_const ports]] \
-    trace       [list action_target         [action_args_const ports]] \
-    livecheck   [list action_target         [action_args_const ports]] \
-    distcheck   [list action_target         [action_args_const ports]] \
-    mirror      [list action_target         [action_args_const ports]] \
-    load        [list action_target         [action_args_const ports]] \
-    unload      [list action_target         [action_args_const ports]] \
-    distfiles   [list action_target         [action_args_const ports]] \
+    ed          [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    edit        [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    cat         [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    dir         [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    work        [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    cd          [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    url         [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    file        [list action_portcmds       [ACTION_ARGS_PORTS]] \
+    gohome      [list action_portcmds       [ACTION_ARGS_PORTS]] \
     \
-    archive     [list action_target         [action_args_const ports]] \
-    unarchive   [list action_target         [action_args_const ports]] \
-    dmg         [list action_target         [action_args_const ports]] \
-    mdmg        [list action_target         [action_args_const ports]] \
-    dpkg        [list action_target         [action_args_const ports]] \
-    mpkg        [list action_target         [action_args_const ports]] \
-    pkg         [list action_target         [action_args_const ports]] \
-    portpkg     [list action_target         [action_args_const ports]] \
-    rpm         [list action_target         [action_args_const ports]] \
-    srpm        [list action_target         [action_args_const ports]] \
+    fetch       [list action_target         [ACTION_ARGS_PORTS]] \
+    checksum    [list action_target         [ACTION_ARGS_PORTS]] \
+    extract     [list action_target         [ACTION_ARGS_PORTS]] \
+    patch       [list action_target         [ACTION_ARGS_PORTS]] \
+    configure   [list action_target         [ACTION_ARGS_PORTS]] \
+    build       [list action_target         [ACTION_ARGS_PORTS]] \
+    destroot    [list action_target         [ACTION_ARGS_PORTS]] \
+    install     [list action_target         [ACTION_ARGS_PORTS]] \
+    clean       [list action_target         [ACTION_ARGS_PORTS]] \
+    test        [list action_target         [ACTION_ARGS_PORTS]] \
+    lint        [list action_target         [ACTION_ARGS_PORTS]] \
+    submit      [list action_target         [ACTION_ARGS_PORTS]] \
+    trace       [list action_target         [ACTION_ARGS_PORTS]] \
+    livecheck   [list action_target         [ACTION_ARGS_PORTS]] \
+    distcheck   [list action_target         [ACTION_ARGS_PORTS]] \
+    mirror      [list action_target         [ACTION_ARGS_PORTS]] \
+    load        [list action_target         [ACTION_ARGS_PORTS]] \
+    unload      [list action_target         [ACTION_ARGS_PORTS]] \
+    distfiles   [list action_target         [ACTION_ARGS_PORTS]] \
     \
-    quit        [list action_exit           [action_args_const none]] \
-    exit        [list action_exit           [action_args_const none]] \
+    archive     [list action_target         [ACTION_ARGS_PORTS]] \
+    archivefetch [list action_target         [ACTION_ARGS_PORTS]] \
+    unarchive   [list action_target         [ACTION_ARGS_PORTS]] \
+    dmg         [list action_target         [ACTION_ARGS_PORTS]] \
+    mdmg        [list action_target         [ACTION_ARGS_PORTS]] \
+    dpkg        [list action_target         [ACTION_ARGS_PORTS]] \
+    mpkg        [list action_target         [ACTION_ARGS_PORTS]] \
+    pkg         [list action_target         [ACTION_ARGS_PORTS]] \
+    portpkg     [list action_target         [ACTION_ARGS_PORTS]] \
+    rpm         [list action_target         [ACTION_ARGS_PORTS]] \
+    srpm        [list action_target         [ACTION_ARGS_PORTS]] \
+    \
+    quit        [list action_exit           [ACTION_ARGS_NONE]] \
+    exit        [list action_exit           [ACTION_ARGS_NONE]] \
 ]
 
 proc find_action_proc { action } {
@@ -3051,11 +3375,10 @@
 
 # Returns whether an action expects text arguments at all,
 # expects text arguments or wants an expanded list of ports
-# Return value:
-#   0 none        Does not expect any text argument
-#   1 strings     Expects some strings as text argument
-#   2 ports       Wants an expanded list of ports as text argument
-# Use action_args_const to translate them
+# Return values are constants:
+#   [ACTION_ARGS_NONE]     Does not expect any text argument
+#   [ACTION_ARGS_STRINGS]  Expects some strings as text argument
+#   [ACTION_ARGS_PORTS]    Wants an expanded list of ports as text argument
 proc action_needs_portlist { action } {
     global action_array
 
@@ -3081,7 +3404,7 @@
                  depends description epoch fullname heading homepage index license
                  line long_description
                  maintainer maintainers name platform platforms portdir pretty
-                 revision variant variants version}
+                 replaced_by revision variant variants version}
     search      {case-sensitive category categories depends_fetch
                  depends_extract depends_build depends_lib depends_run
                  depends description epoch exact glob homepage line
@@ -3090,10 +3413,12 @@
     selfupdate  {nosync}
     uninstall   {follow-dependents}
     variants    {index}
-    clean       {all archive dist work}
+    clean       {all archive dist work logs}
     mirror      {new}
     lint        {nitpick}
     select      {list set show}
+    log         {{phase 1} {verbosity 1}}
+    upgrade     {force enforce-variants no-replace}
 }
 
 global cmd_implied_options
@@ -3206,11 +3531,6 @@
                         # Ignore errors while processing within a command
                         set ui_options(ports_processall) yes
                     }
-                    x {
-                        # Exit with error from any command while in batch/interactive mode
-                        set ui_options(ports_exit) yes
-                    }
-
                     f {
                         set global_options(ports_force) yes
                     }
@@ -3282,7 +3602,7 @@
     set action_status 0
 
     # Process an action if there is one
-    while {$action_status == 0 && [moreargs]} {
+    while {($action_status == 0 || [macports::ui_isset ports_processall]) && [moreargs]} {
         set action [lookahead]
         advance
         
@@ -3340,16 +3660,16 @@
                 set private_options(ports_no_args) yes
             }
             default {
-                if {[action_args_const none] == $expand} {
+                if {[ACTION_ARGS_NONE] == $expand} {
                     ui_error "$action does not accept string arguments"
                     set action_status 1
                     break
-                } elseif {[action_args_const strings] == $expand} {
+                } elseif {[ACTION_ARGS_STRINGS] == $expand} {
                     while { [moreargs] && ![match ";"] } {
                         lappend portlist [lookahead]
                         advance
                     }
-                } elseif {[action_args_const ports] == $expand} {
+                } elseif {[ACTION_ARGS_PORTS] == $expand} {
                     # Parse port specifications into portlist
                     if {![portExpr portlist]} {
                         ui_error "Improper expression syntax while processing parameters"
@@ -3365,11 +3685,6 @@
 
         # semaphore to exit
         if {$action_status == -999} break
-
-        # If we're not in exit mode then ignore the status from the command
-        if { ![macports::ui_isset ports_exit] } {
-            set action_status 0
-        }
     }
     
     return $action_status
@@ -3492,7 +3807,7 @@
 
     # Main command loop
     set exit_status 0
-    while { $exit_status == 0 } {
+    while { $exit_status == 0 || [macports::ui_isset ports_processall] } {
 
         # Calculate our prompt
         if { $noisy } {
@@ -3512,11 +3827,9 @@
         set exit_status [process_cmd $line]
         
         # Check for semaphore to exit
-        if {$exit_status == -999} break
-        
-        # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ports_exit] } {
+        if {$exit_status == -999} {
             set exit_status 0
+            break
         }
     }
 
@@ -3558,16 +3871,10 @@
             close $in
         }
 
-        # Check for semaphore to exit
-        if {$exit_status == -999} {
-            set exit_status 0
-            break
+        # Exit on first failure unless -p was given
+        if {$exit_status != 0 && ![macports::ui_isset ports_processall]} {
+            return $exit_status
         }
-
-        # Ignore status unless we're in error-exit mode
-        if { ![macports::ui_isset ports_exit] } {
-            set exit_status 0
-        }
     }
 
     return $exit_status
@@ -3605,6 +3912,9 @@
 set cmd_argc $argc
 set cmd_argn 0
 
+# make sure we're using a sane umask
+umask 022
+
 # If we've been invoked as portf, then the first argument is assumed
 # to be the name of a command file (i.e., there is an implicit -F
 # before any arguments).
@@ -3648,20 +3958,16 @@
 set global_options_base [array get global_options]
 
 # First process any remaining args as action(s)
+global exit_status
 set exit_status 0
 if { [llength $remaining_args] > 0 } {
 
     # If there are remaining arguments, process those as a command
-
-    # Exit immediately, by default, unless we're going to be processing command files
-    if {![info exists ui_options(ports_commandfiles)]} {
-        set ui_options(ports_exit) yes
-    }
     set exit_status [process_cmd $remaining_args]
 }
 
 # Process any prescribed command files, including standard input
-if { $exit_status == 0 && [info exists ui_options(ports_commandfiles)] } {
+if { ($exit_status == 0 || [macports::ui_isset ports_processall]) && [info exists ui_options(ports_commandfiles)] } {
     set exit_status [process_command_files $ui_options(ports_commandfiles)]
 }
 

Modified: branches/new-help-system/base/src/port/portindex.tcl
===================================================================
--- branches/new-help-system/base/src/port/portindex.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port/portindex.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -8,7 +8,7 @@
 # $Id$
 
 catch {source \
-    [file join "@TCL_PACKAGE_DIR@" macports1.0 macports_fastload.tcl]}
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib
 
@@ -60,15 +60,15 @@
             set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
             cd [file join $directory [file dirname $portinfo(portdir)]]
             puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
-            set tar [findBinary tar $macports::autoconf::tar_path]
-            set gzip [findBinary gzip $macports::autoconf::gzip_path]
+            set tar [macports::findBinary tar $macports::autoconf::tar_path]
+            set gzip [macports::findBinary gzip $macports::autoconf::gzip_path]
             if {[catch {exec $tar -cf - [file tail $portdir] | $gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
                 puts stderr "Failed to create port archive $portinfo(portarchive): $result"
                 exit 1
             }
         }
 
-        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir}
+        set keepkeys {categories depends_fetch depends_extract depends_build depends_lib depends_run description epoch homepage long_description maintainers name platforms revision variants version portdir portarchive replaced_by license}
         foreach availkey [array names portinfo] {
             if {[lsearch -exact ${keepkeys} $availkey] == -1} {
                 unset portinfo($availkey)

Modified: branches/new-help-system/base/src/port/portmirror.tcl
===================================================================
--- branches/new-help-system/base/src/port/portmirror.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port/portmirror.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -12,7 +12,7 @@
 # Uses the database.
 
 catch {source \
-    [file join "@TCL_PACKAGE_DIR@" macports1.0 macports_fastload.tcl]}
+    [file join "@macports_tcl_dir@" macports1.0 macports_fastload.tcl]}
 package require macports
 package require Pextlib
 

Modified: branches/new-help-system/base/src/port1.0/Makefile
===================================================================
--- branches/new-help-system/base/src/port1.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -2,11 +2,11 @@
 
 SRCS=	port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl	    \
 	portfetch.tcl portmain.tcl portbuild.tcl portpatch.tcl portutil.tcl \
-	portinstall.tcl portdepends.tcl portdestroot.tcl portlint.tcl \
-	portclean.tcl porttest.tcl portactivate.tcl portsubmit.tcl \
-	port_autoconf.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
-	portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl \
-	portdistfiles.tcl
+	portinstall.tcl portuninstall.tcl portdepends.tcl portdestroot.tcl \
+	portlint.tcl portclean.tcl porttest.tcl portactivate.tcl \
+	portdeactivate.tcl portsubmit.tcl port_autoconf.tcl portstartupitem.tcl \
+	porttrace.tcl portlivecheck.tcl portdistcheck.tcl portmirror.tcl \
+	portload.tcl portunload.tcl portdistfiles.tcl fetch_common.tcl
 
 include ../../Mk/macports.subdir.mk
 include ../../Mk/macports.autoconf.mk

Copied: branches/new-help-system/base/src/port1.0/fetch_common.tcl (from rev 65586, trunk/base/src/port1.0/fetch_common.tcl)
===================================================================
--- branches/new-help-system/base/src/port1.0/fetch_common.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/port1.0/fetch_common.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,255 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+#
+# Copyright (c) 2002 - 2003 Apple Inc.
+# Copyright (c) 2004-2010 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+package provide fetch_common 1.0
+package require portutil 1.0
+package require Pextlib 1.0
+
+namespace eval portfetch {
+    variable urlmap
+    array set urlmap {}
+}
+
+# Name space for internal site lists storage
+namespace eval portfetch::mirror_sites {
+    variable sites
+
+    array set sites {}
+}
+
+# Given a site url and the name of the distfile, assemble url and
+# return it.
+proc portfetch::assemble_url {site distfile} {
+    if {[string index $site end] != "/"} {
+        return "${site}/${distfile}"
+    } else {
+        return "${site}${distfile}"
+    }
+}
+
+# For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
+# pre-registered set of sites, and if so, return them.
+proc portfetch::mirror_sites {mirrors tag subdir mirrorfile} {
+    global UI_PREFIX name dist_subdir
+    global global_mirror_site fallback_mirror_site
+
+    if {[file exists $mirrorfile]} {
+        source $mirrorfile
+    }
+
+    if {![info exists portfetch::mirror_sites::sites($mirrors)]} {
+        if {$mirrors != $global_mirror_site && $mirrors != $fallback_mirror_site} {
+            ui_warn "[format [msgcat::mc "No mirror sites on file for class %s"] $mirrors]"
+        }
+        return {}
+    }
+
+    set ret [list]
+    foreach element $portfetch::mirror_sites::sites($mirrors) {
+
+        # here we have the chance to take a look at tags, that possibly
+        # have been assigned in mirror_sites.tcl
+        set splitlist [split $element :]
+        # every element is a URL, so we'll always have multiple elements. no need to check
+        set element "[lindex $splitlist 0]:[lindex $splitlist 1]"
+        set mirror_tag "[lindex $splitlist 2]"
+
+        set name_re {\$(?:name\y|\{name\})}
+        # if the URL has $name embedded, kill any mirror_tag that may have been added
+        # since a mirror_tag and $name are incompatible
+        if {[regexp $name_re $element]} {
+            set mirror_tag ""
+        }
+
+        if {$mirror_tag == "mirror"} {
+            set thesubdir ${dist_subdir}
+        } elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
+            set thesubdir ${name}
+        } else {
+            set thesubdir ${subdir}
+        }
+
+        # parse an embedded $name. if present, remove the subdir
+        if {[regsub $name_re $element $thesubdir element] > 0} {
+            set thesubdir ""
+        }
+
+        if {"$tag" != ""} {
+            eval append element "${thesubdir}:${tag}"
+        } else {
+            eval append element "${thesubdir}"
+        }
+
+        eval lappend ret $element
+    }
+
+    return $ret
+}
+
+# Checks sites.
+# sites tags create variables in the portfetch:: namespace containing all sites
+# within that tag distfiles are added in $site $distfile format, where $site is
+# the name of a variable in the portfetch:: namespace containing a list of fetch
+# sites
+proc portfetch::checksites {sitelists mirrorfile} {
+    global env
+    variable urlmap
+
+    foreach {listname extras} $sitelists {
+        upvar #0 $listname $listname
+        if {![info exists $listname]} {
+            continue
+        }
+        global ${listname}.mirror_subdir
+        # add the specified global, fallback and user-defined mirrors
+        set sglobal [lindex $extras 0]; set sfallback [lindex $extras 1]; set senv [lindex $extras 2]
+        set full_list [set $listname]
+        append full_list " $sglobal $sfallback"
+        if {[info exists env($senv)]} {
+            set full_list [concat $env($senv) $full_list]
+        }
+
+        set site_list [list]
+        foreach site $full_list {
+            if {[regexp {([a-zA-Z]+://.+)} $site match site]} {
+                set site_list [concat $site_list $site]
+            } else {
+                set splitlist [split $site :]
+                if {[llength $splitlist] > 3 || [llength $splitlist] <1} {
+                    ui_error [format [msgcat::mc "Unable to process mirror sites for: %s, ignoring."] $site]
+                }
+                set mirrors "[lindex $splitlist 0]"
+                set subdir "[lindex $splitlist 1]"
+                set tag "[lindex $splitlist 2]"
+                if {[info exists ${listname}.mirror_subdir]} {
+                    append subdir "[set ${listname}.mirror_subdir]"
+                }
+                set site_list [concat $site_list [mirror_sites $mirrors $tag $subdir $mirrorfile]]
+            }
+        }
+
+        # add in the global, fallback and user-defined mirrors for each tag
+        foreach site $site_list {
+            if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] && ![info exists extras_added($tag)]} {
+                if {$sglobal != ""} {
+                    set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]]
+                }
+                if {$sfallback != ""} {
+                    set site_list [concat $site_list [mirror_sites $sfallback $tag "" $mirrorfile]]
+                }
+                if {[info exists env($senv)]} {
+                    set site_list [concat [list $env($senv)] $site_list]
+                }
+                set extras_added($tag) yes
+            }
+        }
+
+        foreach site $site_list {
+        if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag]} {
+                lappend urlmap($tag) $site
+            } else {
+                lappend urlmap($listname) $site
+            }
+        }
+    }
+}
+
+# sorts fetch_urls in order of ping time
+proc portfetch::sortsites {urls fallback_mirror_list default_listvar} {
+    global $default_listvar
+    upvar $urls fetch_urls
+    variable urlmap
+
+    foreach {url_var distfile} $fetch_urls {
+        if {![info exists urlmap($url_var)]} {
+            ui_error [format [msgcat::mc "No defined site for tag: %s, using $default_listvar"] $url_var]
+            set urlmap($url_var) [set $default_listvar]
+        }
+        set urllist $urlmap($url_var)
+        set hosts {}
+        set hostregex {[a-zA-Z]+://([a-zA-Z0-9\.\-_]+)}
+
+        if {[llength $urllist] - [llength $fallback_mirror_list] <= 1} {
+            # there is only one mirror, no need to ping or sort
+            continue
+        }
+
+        foreach site $urllist {
+            regexp $hostregex $site -> host
+
+            if { [info exists seen($host)] } {
+                continue
+            }
+            foreach fallback $fallback_mirror_list {
+                if {[string match [append fallback *] $site]} {
+                    # don't bother pinging fallback mirrors
+                    set seen($host) yes
+                    # and make them sort to the very end of the list
+                    set pingtimes($host) 20000
+                    break
+                }
+            }
+            if { ![info exists seen($host)] } {
+                if {[catch {set fds($host) [open "|ping -noq -c3 -t3 $host | grep round-trip | cut -d / -f 5"]}]} {
+                    ui_debug "Spawning ping for $host failed"
+                    # will end up after all hosts that were pinged OK but before those that didn't respond
+                    set pingtimes($host) 5000
+                } else {
+                    ui_debug "Pinging $host..."
+                    set seen($host) yes
+                    lappend hosts $host
+                }
+            }
+        }
+
+        foreach host $hosts {
+            set len [gets $fds($host) pingtimes($host)]
+            if { [catch { close $fds($host) }] || ![string is double -strict $pingtimes($host)] } {
+                # ping failed, so put it last in the list (but before the fallback mirrors)
+                set pingtimes($host) 10000
+            }
+            ui_debug "$host ping time is $pingtimes($host)"
+        }
+
+        set pinglist {}
+        foreach site $urllist {
+            regexp $hostregex $site -> host
+            lappend pinglist [ list $site $pingtimes($host) ]
+        }
+
+        set pinglist [ lsort -real -index 1 $pinglist ]
+
+        set urlmap($url_var) {}
+        foreach pair $pinglist {
+            lappend urlmap($url_var) [lindex $pair 0]
+        }
+    }
+}

Modified: branches/new-help-system/base/src/port1.0/port.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/port.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/port.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -43,7 +43,9 @@
 package require portbuild 1.0
 package require portdestroot 1.0
 package require portinstall 1.0
+package require portuninstall 1.0
 package require portactivate 1.0
+package require portdeactivate 1.0
 package require portclean 1.0
 package require porttest 1.0
 package require portlint 1.0

Modified: branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in
===================================================================
--- branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/port_autoconf.tcl.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -35,17 +35,17 @@
 	variable cp_path "@CP@"
 	variable cpio_path "@CPIO@"
 	variable diff_path "@DIFF@"
-	variable ditto_path "@DITTO@"
 	variable dscl_path "@DSCL@"
 	variable file_path "@FILE@"
+	variable bzr_path "@BZR@"
 	variable cvs_path "@CVS@"
 	variable svn_path "@SVN@"
 	variable git_path "@GIT@"
 	variable hg_path "@HG@"
 	variable gzip_path "@GZIP@"
 	variable lipo_path "@LIPO@"
-	variable nice_path "@NICE@"
 	variable patch_path "@PATCH@"
+	variable gnupatch_path "@GNUPATCH@"
 	variable rmdir_path "@RMDIR@"
 	variable rsync_path "@RSYNC@"
 	variable unzip_path "@UNZIP@"
@@ -69,5 +69,4 @@
 	variable install_user "@DSTUSR@"
 	variable install_group "@DSTGRP@"
 	variable prefix "@prefix_expanded@"
-	variable macportsuser "@RUNUSR@"
 }

Modified: branches/new-help-system/base/src/port1.0/portactivate.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portactivate.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portactivate.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portactivate.tcl
 # $Id$
 #
@@ -41,19 +41,29 @@
 target_state ${org.macports.activate} no
 target_provides ${org.macports.activate} activate
 if {[option portarchivemode] == "yes"} {
-    target_requires ${org.macports.activate} main unarchive fetch extract checksum patch configure build destroot archive install
+    target_requires ${org.macports.activate} main archivefetch unarchive fetch extract checksum patch configure build destroot archive install
 } else {
     target_requires ${org.macports.activate} main fetch extract checksum patch configure build destroot install
 }
+target_prerun ${org.macports.activate} portactivate::activate_start
 
 namespace eval portactivate {
 }
 
-set_ui_prefix
+options activate.asroot
+default activate.asroot no
 
+proc portactivate::activate_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "activate"
+    }
+}
+
 proc portactivate::activate_main {args} {
     global env name version revision portvariants user_options portnotes
-    registry_activate $name ${version}_${revision}${portvariants} [array get user_options]
+    registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
 
     # Display notes at the end of the activation phase.
     if {[info exists portnotes] && $portnotes ne {}} {

Modified: branches/new-help-system/base/src/port1.0/portbuild.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portbuild.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portbuild.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -43,7 +43,6 @@
 
 # define options
 options build.target
-options build.nice
 options build.jobs
 options build.asroot
 options use_parallel_build
@@ -53,7 +52,7 @@
 default build.dir {${workpath}/${worksrcdir}}
 default build.cmd {[portbuild::build_getmaketype]}
 default build.nice {${buildnicevalue}}
-default build.jobs {${buildmakejobs}}
+default build.jobs {[portbuild::build_getjobs]}
 default build.pre_args {${build.target}}
 default build.target "all"
 default use_parallel_build yes
@@ -69,18 +68,18 @@
             if {[option os.platform] == "darwin"} {
                 return [findBinary bsdmake $portutil::autoconf::bsdmake_path]
             } elseif {[option os.platform] == "freebsd"} {
-                return [binaryInPath make]
+                return [findBinary make $portutil::autoconf::make_path]
             } else {
-                return [binaryInPath pmake]
+                return [findBinary pmake $portutil::autoconf::bsdmake_path]
             }
         }
         gnu {
             if {[option os.platform] == "darwin"} {
                 return [findBinary gnumake $portutil::autoconf::gnumake_path]
             } elseif {[option os.platform] == "linux"} {
-                return [binaryInPath make]
+                return [findBinary make $portutil::autoconf::make_path]
             } else {
-                return [binaryInPath gmake]
+                return [findBinary gmake $portutil::autoconf::gnumake_path]
             }
         }
         pbx {
@@ -103,18 +102,27 @@
     }
 }
 
-proc portbuild::build_getnicevalue {args} {
-    if {![exists build.nice] || [string match "* *" [option build.cmd]]} {
-        return ""
+proc portbuild::build_getjobs {args} {
+    global buildmakejobs
+    set jobs $buildmakejobs
+    # if set to '0', use the number of cores for the number of jobs
+    if {$jobs == 0} {
+        if {[catch {set jobs [sysctl hw.activecpu]}] || [catch {set memsize [sysctl hw.memsize]}]} {
+            set jobs 2
+            ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
+            ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
+        }
+        if {$jobs > $memsize / 1000000000 + 1} {
+            set jobs [expr $memsize / 1000000000 + 1]
+        }
     }
-    set nice [option build.nice]
-    if {![string is integer -strict $nice] || $nice <= 0} {
-        return ""
+    if {![string is integer -strict $jobs] || $jobs <= 1} {
+        set jobs 1
     }
-    return "[findBinary nice $portutil::autoconf::nice_path] -n $nice "
+    return $jobs
 }
 
-proc portbuild::build_getmakejobs {args} {
+proc portbuild::build_getjobsarg {args} {
     # check if port allows a parallel build
     global use_parallel_build
     if {![tbool use_parallel_build]} {
@@ -126,14 +134,6 @@
         return ""
     }
     set jobs [option build.jobs]
-    # if set to '0', use the number of cores for the number of jobs
-    if {$jobs == 0} {
-        if {[catch {set jobs [exec "/usr/sbin/sysctl" "-n" "hw.availcpu"]}]} {
-            set jobs 2
-            ui_warn "failed to determine the number of available CPUs (probably not supported on this platform)"
-            ui_warn "defaulting to $jobs jobs, consider setting buildmakejobs to a nonzero value in macports.conf"
-        }
-    }
     if {![string is integer -strict $jobs] || $jobs <= 1} {
         return ""
     }
@@ -149,11 +149,10 @@
 proc portbuild::build_main {args} {
     global build.cmd
 
-    set nice_prefix [build_getnicevalue]
-    set jobs_suffix [build_getmakejobs]
+    set jobs_suffix [build_getjobsarg]
 
     set realcmd ${build.cmd}
-    set build.cmd "$nice_prefix${build.cmd}$jobs_suffix"
+    set build.cmd "${build.cmd}$jobs_suffix"
     command_exec build
     set build.cmd ${realcmd}
     return 0

Modified: branches/new-help-system/base/src/port1.0/portchecksum.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portchecksum.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portchecksum.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -236,7 +236,7 @@
                         ui_debug "[format [msgcat::mc "Correct (%s) checksum for %s"] $type $distfile]"
                     } else {
                         ui_error "[format [msgcat::mc "Checksum (%s) mismatch for %s"] $type $distfile]"
-                        ui_info "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
+                        ui_info_fetch "[format [msgcat::mc "Portfile checksum: %s %s %s"] $distfile $type $sum]"
                         ui_info "[format [msgcat::mc "Distfile checksum: %s %s %s"] $distfile $type $calculated_sum]"
 
                         # Raise the failure flag

Modified: branches/new-help-system/base/src/port1.0/portclean.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portclean.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portclean.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -57,8 +57,9 @@
 
 proc portclean::clean_main {args} {
     global UI_PREFIX
-    global ports_clean_dist ports_clean_work ports_clean_archive
-    global ports_clean_all usealtworkpath
+    global ports_clean_dist ports_clean_work ports_clean_archive ports_clean_logs
+    global ports_clean_all usealtworkpath 
+    global	keeplogs
 
     if {[info exists ports_clean_all] && $ports_clean_all == "yes" || \
         [info exists ports_clean_dist] && $ports_clean_dist == "yes"} {
@@ -76,6 +77,9 @@
          ui_info "$UI_PREFIX [format [msgcat::mc "Removing build directory for %s"] [option name]]"
          clean_work
     }
+    if {([info exists ports_clean_logs] && $ports_clean_logs == "yes") || ($keeplogs == "no")} {
+        clean_logs
+    }
 
     # start gsoc-08 privileges
     if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
@@ -197,38 +201,53 @@
 
     return 0
 }
+proc portclean::clean_logs {args} {
+    global portpath portbuildpath worksymlink name portverbose keeplogs prefix
+    set logpath [getportlogpath $portpath]
+  	if {[file isdirectory $logpath]} {
+        ui_debug "Removing directory: ${logpath}"
+        if {[catch {delete $logpath} result]} {
+            ui_debug "$::errorInfo"
+            ui_error "$result"
+        }
+    } else {
+        ui_debug "No log directory found to remove at ${logpath}"
+    }           	
+    return 0
+}
 
 proc portclean::clean_archive {args} {
     global workpath portarchivepath name version ports_version_glob
 
-    # Define archive destination directory and target filename
+    # Define archive destination directory, target filename, regex for archive name
     if {$portarchivepath ne $workpath && $portarchivepath ne ""} {
-        set archivepath [file join $portarchivepath [option os.platform] [option os.arch]]
+        set archivepath [file join $portarchivepath [option os.platform]]
+        set regexstring "^$name-\[\\-_a-zA-Z0-9\\.\]+_\[0-9\]*\[+\\-_a-zA-Z0-9\]*\[\\.\].*\[\\.\]\[a-z2\]+\$"
     }
 
     if {[info exists ports_version_glob]} {
-        # Match all possible archive variatns that match the version
+        # Match all possible archive variants that match the version
         # glob specified by the user for this OS.
-        set fileglob "$name-[option ports_version_glob]*.[option os.arch].*"
+        set fileglob "$name-[option ports_version_glob]*.*.*"
     } else {
         # Match all possible archive variants for the current version on
         # this OS. If you want to delete previous versions, use the
         # version glob argument to clean.
         #
         # We do this because if we don't, then ports that match the
-        # first part of the name (e.g. trying to remove foo-*, it will
+        # first part of the name (e.g. trying to remove foo-* will
         # pick up anything foo-bar-* as well, which is undesirable).
-        set fileglob "$name-$version*.[option os.arch].*"
+        set fileglob "$name-$version*.*.*"
     }
 
     # Remove the archive files
     set count 0
-    if {![catch {set archivelist [glob [file join $archivepath $fileglob]]} result]} {
+    if {![catch {set archivelist [glob [file join $archivepath * $fileglob]]} result]} {
         foreach path $archivelist {
             set file [file tail $path]
             # Make sure file is truly a port archive file, and not
-            # and accidental match with some other file that might exist.
-            if {[regexp "^$name-\[-_a-zA-Z0-9\.\]+_\[0-9\]*\[+-_a-zA-Z0-9\]*\[\.\][option os.arch]\[\.\]\[a-z\]+\$" $file]} {
+            # an accidental match with some other file that might exist.
+            if {[regexp $regexstring $file]} {
                 if {[file isfile $path]} {
                     ui_debug "Removing archive: $path"
                     if {[catch {delete $path} result]} {

Modified: branches/new-help-system/base/src/port1.0/portconfigure.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portconfigure.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portconfigure.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -46,7 +46,7 @@
 commands configure autoreconf automake autoconf xmkmf
 # defaults
 default configure.env       ""
-default configure.pre_args  {[portconfigure::configure_get_pre_args]}
+default configure.pre_args  {--prefix=${prefix}}
 default configure.cmd       ./configure
 default configure.dir       {${worksrcpath}}
 default autoreconf.dir      {${worksrcpath}}
@@ -62,14 +62,56 @@
 option_proc use_autoconf    portconfigure::set_configure_type
 option_proc use_xmkmf       portconfigure::set_configure_type
 
+option_proc autoreconf.cmd  portconfigure::set_configure_type
+option_proc automake.cmd    portconfigure::set_configure_type
+option_proc autoconf.cmd    portconfigure::set_configure_type
+option_proc xmkmf.cmd       portconfigure::set_configure_type
+
+##
+# Local helper proc
+proc portconfigure::add_build_dep { type dep } {
+    global ${type}.cmd option_defaults
+
+    if {![info exists ${type}.cmd] || (
+        ([info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == $option_defaults(${type}.cmd)) ||
+        (![info exists option_defaults(${type}.cmd)] && [set ${type}.cmd] == "${type}")
+        )} {
+            eval depends_build-append $dep
+    }
+}
+
+##
+# Adds dependencies for the binaries which will be called, but only if it is
+# the default. If .cmd was overwritten the port has to care for deps itself.
 proc portconfigure::set_configure_type {option action args} {
-    if {[string equal ${action} "set"] && [tbool args]} {
+    global autoreconf.cmd automake.cmd autoconf.cmd xmkmf.cmd
+
+    array set configure_map {
+        autoconf    {port:autoconf port:automake port:libtool}
+        xmkmf       port:imake
+    }
+
+    if {[string equal ${action} "set"]} {
         switch $option {
+            autoreconf.cmd  -
+            automake.cmd    -
+            autoconf.cmd {
+                eval depends_build-delete $configure_map(autoconf)
+            }
+            xmkmf.cmd {
+                depends_build-delete $configure_map(xmkmf)
+            }
             use_xmkmf {
-                depends_build-append port:imake
+                if {[tbool args]} {
+                    depends_build-append $configure_map(xmkmf)
+                }
             }
             default {
-                depends_build-append port:autoconf port:automake port:libtool
+                # strip "use_"
+                set type [string range $option 4 end]
+                if {[tbool args]} {
+                    add_build_dep $type $configure_map(autoconf)
+                }
             }
         }
     }
@@ -87,58 +129,17 @@
 options configure.optflags configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
 default configure.optflags  {-O2}
 # compiler flags section
-default configure.cflags    {[portconfigure::configure_get_cflags]}
-default configure.cppflags  {[portconfigure::configure_get_cppflags]}
-default configure.cxxflags  {[portconfigure::configure_get_cflags]}
-default configure.objcflags {[portconfigure::configure_get_cflags]}
-default configure.ldflags   {[portconfigure::configure_get_ldflags]}
+default configure.cflags    {${configure.optflags}}
+default configure.cppflags  {-I${prefix}/include}
+default configure.cxxflags  {${configure.optflags}}
+default configure.objcflags {${configure.optflags}}
+default configure.ldflags   {-L${prefix}/lib}
 default configure.libs      {}
-default configure.fflags    {[portconfigure::configure_get_cflags]}
-default configure.f90flags  {[portconfigure::configure_get_cflags]}
-default configure.fcflags   {[portconfigure::configure_get_cflags]}
+default configure.fflags    {${configure.optflags}}
+default configure.f90flags  {${configure.optflags}}
+default configure.fcflags   {${configure.optflags}}
 default configure.classpath {}
 
-# internal function to return the system value for CFLAGS/CXXFLAGS/etc
-proc portconfigure::configure_get_cflags {args} {
-    global configure.optflags
-    global configure.m32 configure.m64 configure.march configure.mtune
-    global configure.universal_cflags
-    set flags "${configure.optflags}"
-    if {[tbool configure.m64]} {
-        set flags "-m64 ${flags}"
-    } elseif {[tbool configure.m32]} {
-        set flags "-m32 ${flags}"
-    }
-    if {[info exists configure.march] && ${configure.march} != {}} {
-        set flags "${flags} -march=${configure.march}"
-    }
-    if {[info exists configure.mtune] && ${configure.mtune} != {}} {
-        set flags "${flags} -mtune=${configure.mtune}"
-    }
-    if {[variant_isset universal] && ${configure.universal_cflags} != ""} {
-        set flags "${flags} ${configure.universal_cflags}"
-    }
-    return $flags
-}
-
-proc portconfigure::configure_get_cppflags {args} {
-    global prefix configure.universal_cppflags
-    set flags "-I${prefix}/include"
-    if {[variant_isset universal] && ${configure.universal_cppflags} != ""} {
-        set flags "${flags} ${configure.universal_cppflags}"
-    }
-    return $flags
-}
-
-proc portconfigure::configure_get_ldflags {args} {
-    global prefix configure.universal_ldflags
-    set flags "-L${prefix}/lib"
-    if {[variant_isset universal] && ${configure.universal_ldflags} != ""} {
-        set flags "${flags} ${configure.universal_ldflags}"
-    }
-    return $flags
-}
-
 # tools section
 options configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
 default configure.perl              {}
@@ -150,8 +151,17 @@
 default configure.pkg_config        {}
 default configure.pkg_config_path   {}
 
+options configure.build_arch
+default configure.build_arch {[portconfigure::choose_supported_archs ${build_arch}]}
+options configure.ld_archflags
+default configure.ld_archflags {[portconfigure::configure_get_ld_archflags]}
+foreach tool {cc cxx objc f77 f90 fc} {
+    options configure.${tool}_archflags
+    default configure.${tool}_archflags  "\[portconfigure::configure_get_archflags $tool\]"
+}
+
 options configure.universal_archs configure.universal_args configure.universal_cflags configure.universal_cppflags configure.universal_cxxflags configure.universal_ldflags
-default configure.universal_archs       {${universal_archs}}
+default configure.universal_archs       {[portconfigure::choose_supported_archs ${universal_archs}]}
 default configure.universal_args        {--disable-dependency-tracking}
 default configure.universal_cflags      {[portconfigure::configure_get_universal_cflags]}
 default configure.universal_cppflags    {[portconfigure::configure_get_universal_cppflags]}
@@ -176,8 +186,7 @@
 set_ui_prefix
 
 proc portconfigure::configure_start {args} {
-    global UI_PREFIX
-    global configure.compiler
+    global UI_PREFIX configure.compiler
     
     ui_msg "$UI_PREFIX [format [msgcat::mc "Configuring %s"] [option name]]"
 
@@ -199,20 +208,66 @@
         macports-gcc-4.2 { set name "MacPorts gcc 4.2" }
         macports-gcc-4.3 { set name "MacPorts gcc 4.3" }
         macports-gcc-4.4 { set name "MacPorts gcc 4.4" }
+        macports-gcc-4.5 { set name "MacPorts gcc 4.5" }
         default { return -code error "Invalid value for configure.compiler" }
     }
     ui_debug "Using compiler '$name'"
 }
 
-proc portconfigure::configure_get_pre_args {args} {
-    global prefix configure.universal_args
-    set result "--prefix=${prefix}"
-    if {[variant_isset universal] && ${configure.universal_args} != ""} {
-        set result "$result ${configure.universal_args}"
+# internal function to choose the default configure.build_arch and
+# configure.universal_archs based on supported_archs and build_arch or
+# universal_archs
+proc portconfigure::choose_supported_archs {archs} {
+    global supported_archs
+    if {$supported_archs == ""} {
+        return $archs
     }
-    return $result
+    set ret {}
+    foreach arch $archs {
+        if {[lsearch -exact $supported_archs $arch] != -1} {
+            lappend ret $arch
+        } elseif {$arch == "x86_64" && [lsearch -exact $supported_archs "i386"] != -1 && [lsearch -exact $ret "i386"] == -1} {
+            lappend ret "i386"
+        } elseif {$arch == "ppc64" && [lsearch -exact $supported_archs "ppc"] != -1 && [lsearch -exact $ret "ppc"] == -1} {
+            lappend ret "ppc"
+        }
+    }
+    return $ret
 }
 
+# internal function to determine the compiler flags to select an arch
+proc portconfigure::configure_get_archflags {tool} {
+    global configure.build_arch configure.m32 configure.m64 configure.compiler
+    set flags ""
+    if {[tbool configure.m64]} {
+        set flags "-m64"
+    } elseif {[tbool configure.m32]} {
+        set flags "-m32"
+    } elseif {${configure.build_arch} != ""} {
+        if {[arch_flag_supported] && ($tool == "cc" || $tool == "cxx" || $tool == "objc")} {
+            set flags "-arch ${configure.build_arch}"
+        } elseif {${configure.build_arch} == "x86_64" || ${configure.build_arch} == "ppc64"} {
+            set flags "-m64"
+        } elseif {${configure.compiler} != "gcc-3.3"} {
+            set flags "-m32"
+        }
+    }
+    return $flags
+}
+
+# internal function to determine the ld flags to select an arch
+# Unfortunately there's no consistent way to do this when the compiler
+# doesn't support -arch, because it could be used to link rather than using
+# ld directly. So we punt and let portfiles deal with that case.
+proc portconfigure::configure_get_ld_archflags {args} {
+    global configure.build_arch
+    if {${configure.build_arch} != "" && [arch_flag_supported]} {
+        return "-arch ${configure.build_arch}"
+    } else {
+        return ""
+    }
+}
+
 # internal function to determine the "-arch xy" flags for the compiler
 proc portconfigure::configure_get_universal_archflags {args} {
     global configure.universal_archs
@@ -221,7 +276,7 @@
         if {$flags == ""} {
             set flags "-arch $arch"
         } else {
-            set flags "$flags -arch $arch"
+            append flags " -arch $arch"
         }
     }
     return $flags
@@ -260,6 +315,24 @@
     return $flags
 }
 
+# internal proc to determine if the compiler supports -arch
+proc portconfigure::arch_flag_supported {args} {
+    global configure.compiler
+    switch -exact ${configure.compiler} {
+        gcc-4.0 -
+        gcc-4.2 -
+        llvm-gcc-4.2 -
+        clang -
+        apple-gcc-4.0 -
+        apple-gcc-4.2 {
+            return yes
+        }
+        default {
+            return no
+        }
+    }
+}
+
 # internal function to determine the default compiler
 proc portconfigure::configure_get_default_compiler {args} {
     global os.platform os.major
@@ -269,6 +342,7 @@
         "darwin 8" { set compiler gcc-4.0 }
         "darwin 9" { set compiler gcc-4.0 }
         "darwin 10" { set compiler gcc-4.2 }
+        "darwin 11" { set compiler llvm-gcc-4.2 }
         default { set compiler gcc }
     }
     return $compiler
@@ -308,13 +382,15 @@
                 cc   { set ret /usr/bin/gcc-4.2 }
                 objc { set ret /usr/bin/gcc-4.2 }
                 cxx  { set ret /usr/bin/g++-4.2 }
+                cpp  { set ret /usr/bin/cpp-4.2 }
             }
         }
         llvm-gcc-4.2 {
             switch -exact ${type} {
-                cc   { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
-                objc { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 }
-                cxx  { set ret ${developer_dir}/usr/llvm-gcc-4.2/bin/llvm-g++-4.2 }
+                cc   { set ret ${developer_dir}/usr/bin/llvm-gcc-4.2 }
+                objc { set ret ${developer_dir}/usr/bin/llvm-gcc-4.2 }
+                cxx  { set ret ${developer_dir}/usr/bin/llvm-g++-4.2 }
+                cpp  { set ret ${developer_dir}/usr/bin/llvm-cpp-4.2 }
             }
         }
         clang {
@@ -412,6 +488,17 @@
                 f90  { set ret ${prefix}/bin/gfortran-mp-4.4 }
             }
         }
+        macports-gcc-4.5 {
+            switch -exact ${type} {
+                cc   { set ret ${prefix}/bin/gcc-mp-4.5 }
+                objc { set ret ${prefix}/bin/gcc-mp-4.5 }
+                cxx  { set ret ${prefix}/bin/g++-mp-4.5 }
+                cpp  { set ret ${prefix}/bin/cpp-mp-4.5 }
+                fc   { set ret ${prefix}/bin/gfortran-mp-4.5 }
+                f77  { set ret ${prefix}/bin/gfortran-mp-4.5 }
+                f90  { set ret ${prefix}/bin/gfortran-mp-4.5 }
+            }
+        }
     }
     return $ret
 }
@@ -419,9 +506,15 @@
 proc portconfigure::configure_main {args} {
     global [info globals]
     global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf
-    global configure.env configure.pipe configure.cflags configure.cppflags configure.cxxflags configure.objcflags configure.ldflags configure.libs configure.fflags configure.f90flags configure.fcflags configure.classpath
+    global configure.env configure.pipe configure.libs configure.classpath configure.universal_args
     global configure.perl configure.python configure.ruby configure.install configure.awk configure.bison configure.pkg_config configure.pkg_config_path
-    global configure.ccache configure.distcc configure.cc configure.cxx configure.cpp configure.objc configure.f77 configure.f90 configure.fc configure.javac
+    global configure.ccache configure.distcc configure.cpp configure.javac configure.march configure.mtune
+    foreach tool {cc cxx objc f77 f90 fc ld} {
+        global configure.${tool} configure.${tool}_archflags
+    }
+    foreach flags {cflags cppflags cxxflags objcflags ldflags fflags f90flags fcflags} {
+        global configure.${flags} configure.universal_${flags}
+    }
     
     if {[tbool use_autoreconf]} {
         if {[catch {command_exec autoreconf} result]} {
@@ -474,7 +567,6 @@
 
         # Append configure flags.
         append_list_to_environment_value configure "CC" ${filter}${configure.cc}
-        append_list_to_environment_value configure "CPP" ${filter}${configure.cpp}
         append_list_to_environment_value configure "CXX" ${filter}${configure.cxx}
         append_list_to_environment_value configure "OBJC" ${filter}${configure.objc}
         append_list_to_environment_value configure "FC" ${configure.fc}
@@ -499,6 +591,27 @@
         append_list_to_environment_value configure "BISON" ${configure.bison}
         append_list_to_environment_value configure "PKG_CONFIG" ${configure.pkg_config}
         append_list_to_environment_value configure "PKG_CONFIG_PATH" ${configure.pkg_config_path}
+        
+        # add extra flags that are conditional on whether we're building universal
+        if {[variant_exists universal] && [variant_isset universal]} {
+            foreach flags {CFLAGS OBJCFLAGS} {
+                append_list_to_environment_value configure $flags ${configure.universal_cflags}
+            }
+            append_list_to_environment_value configure "CXXFLAGS" ${configure.universal_cxxflags}
+            append_list_to_environment_value configure "CPPFLAGS" ${configure.universal_cppflags}
+            append_list_to_environment_value configure "LDFLAGS" ${configure.universal_ldflags}
+            eval configure.pre_args-append ${configure.universal_args}
+        } else {
+            foreach {tool flags} {cc CFLAGS cxx CXXFLAGS objc OBJCFLAGS f77 FFLAGS f90 F90FLAGS fc FCFLAGS ld LDFLAGS} {
+                append_list_to_environment_value configure $flags [set configure.${tool}_archflags]
+                if {${configure.march} != {}} {
+                    append_list_to_environment_value configure $flags "-march=${configure.march}"
+                }
+                if {${configure.mtune} != {}} {
+                    append_list_to_environment_value configure $flags "-mtune=${configure.mtune}"
+                }
+            }
+        }
 
         # Execute the command (with the new environment).
         if {[catch {command_exec configure} result]} {

Copied: branches/new-help-system/base/src/port1.0/portdeactivate.tcl (from rev 65586, trunk/base/src/port1.0/portdeactivate.tcl)
===================================================================
--- branches/new-help-system/base/src/port1.0/portdeactivate.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/port1.0/portdeactivate.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,63 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# portdeactivate.tcl
+# $Id$
+#
+# Copyright (c) 2010 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The MacPorts Project nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# the 'deactivate' target is provided by this package
+
+package provide portdeactivate 1.0
+package require portutil 1.0
+
+set org.macports.deactivate [target_new org.macports.deactivate portdeactivate::deactivate_main]
+target_runtype ${org.macports.deactivate} always
+target_state ${org.macports.deactivate} no
+target_provides ${org.macports.deactivate} deactivate
+target_requires ${org.macports.deactivate} main
+target_prerun ${org.macports.deactivate} portdeactivate::deactivate_start
+
+namespace eval portdeactivate {
+}
+
+options deactivate.asroot
+default deactivate.asroot no
+
+proc portdeactivate::deactivate_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "deactivate"
+    }
+}
+
+proc portdeactivate::deactivate_main {args} {
+    global name version revision portvariants user_options
+    registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    return 0
+}

Modified: branches/new-help-system/base/src/port1.0/portdestroot.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdestroot.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portdestroot.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -88,14 +88,14 @@
 
 proc portdestroot::destroot_start {args} {
     global UI_PREFIX prefix name porturl destroot os.platform destroot.clean portsharepath
-    global destroot.umask destroot.asroot macportsuser euid egid usealtworkpath altprefix
+    global destroot.umask destroot.asroot euid egid
     global applications_dir frameworks_dir
     variable oldmask
 
     ui_msg "$UI_PREFIX [format [msgcat::mc "Staging %s into destroot"] ${name}]"
 
     # start gsoc08-privileges
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
+    if { [getuid] == 0 && [geteuid] != 0 } {
     # if started with sudo but have dropped the privileges
         ui_debug "Can't run destroot under sudo without elevated privileges (due to mtree)."
         ui_debug "Run destroot without sudo to avoid root privileges."
@@ -109,14 +109,6 @@
         return -code error "You cannot run this port without root privileges. You need to re-run with 'sudo port'.";
     }
 
-    if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
-        # rewrite destroot.args
-        set argprefix "=[option prefix]"
-        set newargprefix "=${altprefix}[option prefix]"
-        set newdestrootargs [string map [list $argprefix $newargprefix] [option destroot.args]]
-        option destroot.args $newdestrootargs
-    }
-
     # end gsoc08-privileges
 
     set oldmask [umask ${destroot.umask}]
@@ -129,11 +121,11 @@
     file mkdir "${destroot}"
     if { ${os.platform} == "darwin" } {
         system "cd \"${destroot}\" && ${mtree} -e -U -f [file join ${portsharepath} install macosx.mtree]"
-        file mkdir "${destroot}/${applications_dir}"
-        file mkdir "${destroot}/${frameworks_dir}"
+        file mkdir "${destroot}${applications_dir}"
+        file mkdir "${destroot}${frameworks_dir}"
     }
-    file mkdir "${destroot}/${prefix}"
-    system "cd \"${destroot}/${prefix}\" && ${mtree} -e -U -f [file join ${portsharepath} install prefix.mtree]"
+    file mkdir "${destroot}${prefix}"
+    system "cd \"${destroot}${prefix}\" && ${mtree} -e -U -f [file join ${portsharepath} install prefix.mtree]"
 }
 
 proc portdestroot::destroot_main {args} {
@@ -170,11 +162,21 @@
         }
     }
     fs-traverse -depth dir ${destroot} {
-        if {[file isdirectory $dir]} {
+        if {[file type $dir] == "directory"} {
             catch {file delete $dir}
         }
     }
 
+    if {![file isdirectory ${destroot}]} {
+        ui_error "No files have been installed in the destroot directory!"
+        ui_error "Please make sure that this software supports\
+                  'make install DESTDIR=\${destroot}' or implement an\
+                  alternative destroot mechanism in the Portfile."
+        ui_error "Files might have been installed directly into your system,\
+                  check before proceeding."
+        return -code error "Staging $portname into destroot failed"
+    }
+
     # Compress all manpages with gzip (instead)
     set manpath "${destroot}${prefix}/share/man"
     set gzip [findBinary gzip ${portutil::autoconf::gzip_path}]
@@ -229,11 +231,6 @@
                 set manlinkpath [file join $manpath $manlink]
                 # if link destination is not gzipped, check it
                 set manlinksrc [file readlink $manlinkpath]
-                # if link destination is an absolute path, convert it to a
-                # relative path
-                if {[file pathtype $manlinksrc] eq "absolute"} {
-                    set manlinksrc [file tail $manlinksrc]
-                }
                 if {![regexp "\[.\]gz\$" ${manlinksrc}]} {
                     set mandir [file dirname $manlink]
                     set mandirpath [file join $manpath $mandir]
@@ -242,8 +239,13 @@
                         puts $err
                         return
                     }
+                    # if link source is an absolute path, check for it under destroot
+                    set mls_check "$manlinksrc"
+                    if {[file pathtype $mls_check] eq "absolute"} {
+                        set mls_check "${destroot}${mls_check}"
+                    }
                     # if gzipped destination exists, fix link
-                    if {[file isfile ${manlinksrc}.gz]} {
+                    if {[file isfile ${mls_check}.gz]} {
                         # if actual link name does not end with gz, rename it
                         if {![regexp "\[.\]gz\$" ${manlink}]} {
                             ui_debug "renaming link: $manlink to ${manlink}.gz"

Modified: branches/new-help-system/base/src/port1.0/portdistcheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdistcheck.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portdistcheck.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -64,21 +64,20 @@
     if {"${distcheck.check}" != "none"
         && "${fetch.type}" == "standard"} {
         # portfetch 1.0::checkfiles sets fetch_urls list.
-        global fetch_urls
-        checkfiles
+        set fetch_urls {}
+        portfetch::checkfiles fetch_urls
         set totalsize 0
 
         # Check all the files.
         foreach {url_var distfile} $fetch_urls {
-            global portfetch::$url_var
-            if {![info exists $url_var]} {
+            global portfetch::urlmap
+            if {![info exists urlmap($url_var)]} {
                 ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
-                set url_var master_sites
-                global portfetch::$url_var
+                set urlmap($url_var) $master_sites
             }
             if {${distcheck.check} == "moddate"} {
                 set count 0
-                foreach site [set $url_var] {
+                foreach site $urlmap($url_var) {
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
                     if {[catch {set urlnewer [curl isnewer $file_url $port_moddate]} error]} {
@@ -95,7 +94,7 @@
                 }
             } elseif {${distcheck.check} == "filesize"} {
                 set count 0
-                foreach site [set $url_var] {
+                foreach site $urlmap($url_var) {
                     ui_debug [format [msgcat::mc "Checking %s from %s"] $distfile $site]
                     set file_url [portfetch::assemble_url $site $distfile]
                     if {[catch {set urlsize [curl getsize $file_url]} error]} {

Modified: branches/new-help-system/base/src/port1.0/portdistfiles.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portdistfiles.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portdistfiles.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -53,7 +53,7 @@
 }
 
 proc portdistfiles::distfiles_main {args} {
-    global UI_PREFIX master_sites fetch_urls url_var distfile checksums_array
+    global UI_PREFIX master_sites checksums_array
     
     # give up on ports that do not provide URLs
     if {$master_sites == "{}"} {
@@ -61,13 +61,15 @@
     }
 
     # from portfetch... process the sites, files and patches
-    portfetch::checkfiles
+    set fetch_urls {}
+    portfetch::checkfiles fetch_urls
 
     # get checksum data from the portfile and parse it
     set checksums_str [option checksums]
     set result [portchecksum::parse_checksums $checksums_str]
 
-    foreach {url_var distfile} $portfetch::fetch_urls {
+    foreach {url_var distfile} $fetch_urls {
+        global portfetch::urlmap
 
         ui_msg "\[$distfile\]"
 
@@ -79,13 +81,12 @@
         }
 
         # determine sites to download from
-        namespace import ::portfetch::$url_var
-        if {![info exists $url_var]} {
-            set url_var master_sites
+        if {![info exists urlmap($url_var)]} {
+            set urlmap($url_var) $master_sites
         }
         
         # determine URLs to download
-        foreach site [set $url_var] {
+        foreach site $urlmap($url_var) {
             set file_url [portfetch::assemble_url $site $distfile]
             ui_msg "  $file_url"
         }

Modified: branches/new-help-system/base/src/port1.0/portextract.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portextract.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portextract.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -74,7 +74,7 @@
 }
 
 proc portextract::extract_init {args} {
-    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_lzma use_zip use_7z use_dmg workpath
+    global extract.only extract.dir extract.cmd extract.pre_args extract.post_args extract.mkdir distfiles use_bzip2 use_lzma use_xz use_zip use_7z use_dmg workpath
 
     # should the distfiles be extracted to worksrcpath instead?
     if {[tbool extract.mkdir]} {
@@ -88,6 +88,8 @@
         option extract.cmd [findBinary bzip2 ${portutil::autoconf::bzip2_path}]
     } elseif {[tbool use_lzma]} {
         option extract.cmd [binaryInPath "lzma"]
+    } elseif {[tbool use_xz]} {
+        option extract.cmd [binaryInPath "xz"]
     } elseif {[tbool use_zip]} {
         option extract.cmd [findBinary unzip ${portutil::autoconf::unzip_path}]
         option extract.pre_args -q

Modified: branches/new-help-system/base/src/port1.0/portfetch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portfetch.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portfetch.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -31,6 +31,7 @@
 #
 
 package provide portfetch 1.0
+package require fetch_common 1.0
 package require portutil 1.0
 package require Pextlib 1.0
 
@@ -45,17 +46,11 @@
     variable fetch_urls {}
 }
 
-# Name space for internal site lists storage
-namespace eval portfetch::mirror_sites {
-    variable sites
-
-    array set sites {}
-}
-
 # define options: distname master_sites
-options master_sites patch_sites extract.suffix distfiles patchfiles use_zip use_bzip2 use_lzma use_7z use_dmg dist_subdir \
+options master_sites patch_sites extract.suffix distfiles patchfiles use_bzip2 use_lzma use_xz use_zip use_7z use_dmg dist_subdir \
     fetch.type fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert \
     master_sites.mirror_subdir patch_sites.mirror_subdir \
+    bzr.url bzr.revision \
     cvs.module cvs.root cvs.password cvs.date cvs.tag cvs.method \
     svn.url svn.revision svn.method \
     git.cmd git.url git.branch \
@@ -63,6 +58,7 @@
 
 # XXX we use the command framework to buy us some useful features,
 # but this is not a user-modifiable command
+commands bzr
 commands cvs
 commands svn
 
@@ -70,6 +66,13 @@
 default extract.suffix .tar.gz
 default fetch.type standard
 
+default bzr.cmd {[findBinary bzr $portutil::autoconf::bzr_path]}
+default bzr.dir {${workpath}}
+default bzr.revision {-1}
+default bzr.pre_args {"--builtin --no-aliases checkout --lightweight"}
+default bzr.args ""
+default bzr.post_args {"-r ${bzr.revision} ${bzr.url} ${worksrcdir}"}
+
 default cvs.cmd {[findBinary cvs $portutil::autoconf::cvs_path]}
 default cvs.password ""
 default cvs.dir {${workpath}}
@@ -82,12 +85,13 @@
 default cvs.args ""
 default cvs.post_args {"${cvs.module}"}
 
-default svn.cmd {[findBinary svn $portutil::autoconf::svn_path]}
+# we want the svn port so we know --trust-server-cert will work
+default svn.cmd {[portfetch::find_svn_path]}
 default svn.dir {${workpath}}
 default svn.method {export}
 default svn.revision ""
 default svn.env {}
-default svn.pre_args {"--non-interactive"}
+default svn.pre_args {"--non-interactive --trust-server-cert"}
 default svn.args ""
 default svn.post_args {"${svn.url}"}
 
@@ -124,6 +128,7 @@
 # Option-executed procedures
 option_proc use_bzip2 portfetch::set_extract_type
 option_proc use_lzma  portfetch::set_extract_type
+option_proc use_xz    portfetch::set_extract_type
 option_proc use_zip   portfetch::set_extract_type
 option_proc use_7z    portfetch::set_extract_type
 option_proc use_dmg   portfetch::set_extract_type
@@ -141,6 +146,10 @@
                 set extract.suffix .tar.lzma
                 depends_extract-append bin:lzma:lzmautils
             }
+            use_xz {
+                set extract.suffix .tar.xz
+                depends_extract-append bin:xz:xz-devel
+            }
             use_zip {
                 set extract.suffix .zip
                 depends_extract-append bin:unzip:unzip
@@ -157,13 +166,21 @@
 }
 
 proc portfetch::set_fetch_type {option action args} {
+    global os.platform os.major
     if {[string equal ${action} "set"]} {
         switch $args {
+            bzr {
+                depends_fetch-append bin:bzr:bzr
+            }
             cvs {
                 depends_fetch-append bin:cvs:cvs
             }
             svn {
-                depends_fetch-append bin:svn:subversion
+                if {${os.platform} == "darwin" && ${os.major} >= 10} {
+                    depends_fetch-append bin:svn:subversion
+                } else {
+                    depends_fetch-append port:subversion
+                }
             }
             git {
                 depends_fetch-append bin:git:git-core
@@ -175,6 +192,15 @@
     }
 }
 
+proc portfetch::find_svn_path {args} {
+    global prefix os.platform os.major
+    if {${os.platform} == "darwin" && ${os.major} >= 10} {
+        return [findBinary svn $portutil::autoconf::svn_path]
+    } else {
+        return ${prefix}/bin/svn
+    }
+}
+
 set_ui_prefix
 
 
@@ -182,6 +208,7 @@
 proc portfetch::suffix {distname} {
     global extract.suffix fetch.type
     switch -- "${fetch.type}" {
+        bzr         -
         cvs         -
         svn         -
         git         -
@@ -194,148 +221,10 @@
 # Portfiles, but should better go somewhere else
 namespace import portfetch::suffix
 
-# Given a site url and the name of the distfile, assemble url and
-# return it.
-proc portfetch::assemble_url {site distfile} {
-    if {[string index $site end] != "/"} {
-        return "${site}/${distfile}"
-    } else {
-        return "${site}${distfile}"
-    }
-}
-
-# For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
-# pre-registered set of sites, and if so, return them.
-proc portfetch::mirror_sites {mirrors tag subdir} {
-    global UI_PREFIX name porturl mirror_sites.listfile mirror_sites.listpath dist_subdir
-    global global_mirror_site fallback_mirror_site
-
-    set mirrorfile [getportresourcepath $porturl [file join ${mirror_sites.listpath} ${mirror_sites.listfile}]]
-    if {[file exists $mirrorfile]} {
-        source $mirrorfile
-    }
-
-    if {![info exists portfetch::mirror_sites::sites($mirrors)]} {
-        if {$mirrors != $global_mirror_site && $mirrors != $fallback_mirror_site} {
-            ui_warn "[format [msgcat::mc "No mirror sites on file for class %s"] $mirrors]"
-        }
-        return {}
-    }
-
-    set ret [list]
-    foreach element $portfetch::mirror_sites::sites($mirrors) {
-
-    # here we have the chance to take a look at tags, that possibly
-    # have been assigned in mirror_sites.tcl
-    set splitlist [split $element :]
-    # every element is a URL, so we'll always have multiple elements. no need to check
-    set element "[lindex $splitlist 0]:[lindex $splitlist 1]"
-    set mirror_tag "[lindex $splitlist 2]"
-
-    set name_re {\$(?:name\y|\{name\})}
-    # if the URL has $name embedded, kill any mirror_tag that may have been added
-    # since a mirror_tag and $name are incompatible
-    if {[regexp $name_re $element]} {
-        set mirror_tag ""
-    }
-
-    if {$mirror_tag == "mirror"} {
-        set thesubdir ${dist_subdir}
-    } elseif {$subdir == "" && $mirror_tag != "nosubdir"} {
-        set thesubdir ${name}
-    } else {
-        set thesubdir ${subdir}
-    }
-
-    # parse an embedded $name. if present, remove the subdir
-    if {[regsub $name_re $element $thesubdir element] > 0} {
-        set thesubdir ""
-    }
-
-    if {"$tag" != ""} {
-        eval append element "${thesubdir}:${tag}"
-    } else {
-        eval append element "${thesubdir}"
-    }
-        eval lappend ret $element
-    }
-
-    return $ret
-}
-
-# Checks sites.
-# sites tags create variables in the portfetch:: namespace containing all sites
-# within that tag distfiles are added in $site $distfile format, where $site is
-# the name of a variable in the portfetch:: namespace containing a list of fetch
-# sites
-proc portfetch::checksites {args} {
-    global patch_sites master_sites master_sites.mirror_subdir \
-        patch_sites.mirror_subdir fallback_mirror_site global_mirror_site env
-
-    append master_sites " ${global_mirror_site} ${fallback_mirror_site}"
-    if {[info exists env(MASTER_SITE_LOCAL)]} {
-    set master_sites [concat $env(MASTER_SITE_LOCAL) $master_sites]
-    }
-
-    append patch_sites " ${global_mirror_site} ${fallback_mirror_site}"
-    if {[info exists env(PATCH_SITE_LOCAL)]} {
-    set patch_sites [concat $env(PATCH_SITE_LOCAL) $patch_sites]
-    }
-
-    foreach list {master_sites patch_sites} {
-        upvar #0 $list uplist
-        if {![info exists uplist]} {
-            continue
-        }
-
-        set site_list [list]
-        foreach site $uplist {
-            if {[regexp {([a-zA-Z]+://.+)} $site match site]} {
-                set site_list [concat $site_list $site]
-            } else {
-            set splitlist [split $site :]
-        if {[llength $splitlist] > 3 || [llength $splitlist] <1} {
-                    ui_error [format [msgcat::mc "Unable to process mirror sites for: %s, ignoring."] $site]
-        }
-        set mirrors "[lindex $splitlist 0]"
-        set subdir "[lindex $splitlist 1]"
-        set tag "[lindex $splitlist 2]"
-                if {[info exists $list.mirror_subdir]} {
-                    append subdir "[set ${list}.mirror_subdir]"
-                }
-                set site_list [concat $site_list [mirror_sites $mirrors $tag $subdir]]
-            }
-        }
-
-        # add in the global and fallback mirrors for each tag
-        foreach site $site_list {
-            if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag]} {
-                if {![info exists extras_added($tag)]} {
-                    set site_list [concat $site_list [mirror_sites $global_mirror_site $tag ""] [mirror_sites $fallback_mirror_site $tag ""]]
-                    if {[string equal $list master_sites] && [info exists env(MASTER_SITE_LOCAL)]} {
-                        set site_list [concat [list $env(MASTER_SITE_LOCAL)] $site_list]
-                    } elseif {[string equal $list patch_sites] && [info exists env(PATCH_SITE_LOCAL)]} {
-                        set site_list [concat [list $env(PATCH_SITE_LOCAL)] $site_list]
-                    }
-                    set extras_added($tag) yes
-                }
-            }
-        }
-
-        foreach site $site_list {
-        if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag]} {
-                lappend portfetch::$tag $site
-            } else {
-                lappend portfetch::$list $site
-            }
-        }
-    }
-}
-
 # Checks patch files and their tags to assemble url lists for later fetching
-proc portfetch::checkpatchfiles {args} {
+proc portfetch::checkpatchfiles {urls} {
     global patchfiles all_dist_files patch_sites filespath
-    variable fetch_urls
+    upvar $urls fetch_urls
 
     if {[info exists patchfiles]} {
         foreach file $patchfiles {
@@ -356,9 +245,9 @@
 }
 
 # Checks dist files and their tags to assemble url lists for later fetching
-proc portfetch::checkdistfiles {args} {
-    global distfiles all_dist_files master_sites filespath
-    variable fetch_urls
+proc portfetch::checkdistfiles {urls} {
+    global distfiles all_dist_files filespath
+    upvar $urls fetch_urls
 
     if {[info exists distfiles]} {
         foreach file $distfiles {
@@ -376,92 +265,38 @@
     }
 }
 
-# sorts fetch_urls in order of ping time
-proc portfetch::sortsites {args} {
-    global fallback_mirror_site
-    variable fetch_urls
-
-    set fallback_mirror_list [mirror_sites $fallback_mirror_site {} {}]
-
-    foreach {url_var distfile} $fetch_urls {
-        variable portfetch::$url_var
-        if {![info exists $url_var]} {
-            ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
-            set url_var master_sites
-            variable portfetch::$url_var
-        }
-        set urllist [set $url_var]
-        set hosts {}
-        set hostregex {[a-zA-Z]+://([a-zA-Z0-9\.\-_]+)}
-
-        if {[llength $urllist] - [llength $fallback_mirror_list] <= 1} {
-            # there is only one mirror, no need to ping or sort
-            continue
-        }
-
-        foreach site $urllist {
-            regexp $hostregex $site -> host
-
-            if { [info exists seen($host)] } {
-                continue
-            }
-            foreach fallback $fallback_mirror_list {
-                if {[string match [append fallback *] $site]} {
-                    # don't bother pinging fallback mirrors
-                    set seen($host) yes
-                    # and make them sort to the very end of the list
-                    set pingtimes($host) 20000
-                    break
-                }
-            }
-            if { ![info exists seen($host)] } {
-                if {[catch {set fds($host) [open "|ping -noq -c3 -t3 $host | grep round-trip | cut -d / -f 5"]}]} {
-                    ui_debug "Spawning ping for $host failed"
-                    # will end up after all hosts that were pinged OK but before those that didn't respond
-                    set pingtimes($host) 5000
-                } else {
-                    ui_debug "Pinging $host..."
-                    set seen($host) yes
-                    lappend hosts $host
-                }
-            }
-        }
-
-        foreach host $hosts {
-            set len [gets $fds($host) pingtimes($host)]
-            if { [catch { close $fds($host) }] || ![string is double -strict $pingtimes($host)] } {
-                # ping failed, so put it last in the list (but before the fallback mirrors)
-                set pingtimes($host) 10000
-            }
-            ui_debug "$host ping time is $pingtimes($host)"
-        }
-
-        set pinglist {}
-        foreach site $urllist {
-            regexp $hostregex $site -> host
-            lappend pinglist [ list $site $pingtimes($host) ]
-        }
-
-        set pinglist [ lsort -real -index 1 $pinglist ]
-
-        set $url_var {}
-        foreach pair $pinglist {
-            lappend $url_var [lindex $pair 0]
-        }
-    }
+# returns full path to mirror list file
+proc portfetch::get_full_mirror_sites_path {} {
+    global mirror_sites.listfile mirror_sites.listpath porturl
+    return [getportresourcepath $porturl [file join ${mirror_sites.listpath} ${mirror_sites.listfile}]]
 }
 
 # Perform the full checksites/checkpatchfiles/checkdistfiles sequence.
 # This method is used by distcheck target.
-proc portfetch::checkfiles {args} {
-    variable fetch_urls
+proc portfetch::checkfiles {urls} {
+    global global_mirror_site fallback_mirror_site
+    upvar $urls fetch_urls
 
-    checksites
-    checkpatchfiles
-    checkdistfiles
+    checksites [list patch_sites [list $global_mirror_site $fallback_mirror_site PATCH_SITE_LOCAL] \
+                master_sites [list $global_mirror_site $fallback_mirror_site MASTER_SITE_LOCAL]] \
+               [get_full_mirror_sites_path]
+    checkpatchfiles fetch_urls
+    checkdistfiles fetch_urls
 }
 
+# Perform a bzr fetch
+proc portfetch::bzrfetch {args} {
+    if {[catch {command_exec bzr "" "2>&1"} result]} {
+        return -code error [msgcat::mc "Bazaar checkout failed"]
+    }
 
+    if {[info exists patchfiles]} {
+        return [portfetch::fetchfiles]
+    }
+
+    return 0
+}
+
 # Perform a CVS login and fetch, storing the CVS login
 # information in a custom .cvspass file
 proc portfetch::cvsfetch {args} {
@@ -510,11 +345,15 @@
 
 # Perform an svn fetch
 proc portfetch::svnfetch {args} {
-    global svn.args svn.revision svn.method
+    global svn.args svn.method svn.revision svn.url
 
+    if {[regexp {\s} ${svn.url}]} {
+        return -code error [msgcat::mc "Subversion URL cannot contain whitespace"]
+    }
+
     set svn.args "${svn.method} ${svn.args}"
     if {[string length ${svn.revision}]} {
-        set svn.args "${svn.args} -r ${svn.revision}"
+        append svn.url "@${svn.revision}"
     }
 
     if {[catch {command_exec svn "" "2>&1"} result]} {
@@ -583,9 +422,9 @@
 proc portfetch::fetchfiles {args} {
     global distpath all_dist_files UI_PREFIX
     global fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time
-    global distfile site
-    global portverbose
+    global fallback_mirror_site portverbose
     variable fetch_urls
+    variable urlmap
 
     if {![file isdirectory $distpath]} {
         if {[catch {file mkdir $distpath} result]} {
@@ -627,17 +466,15 @@
                 return -code error [format [msgcat::mc "%s must be writable"] $distpath]
             }
             if {!$sorted} {
-                sortsites
+                sortsites fetch_urls [mirror_sites $fallback_mirror_site {} {} [get_full_mirror_sites_path]] master_sites
                 set sorted yes
             }
-            variable portfetch::$url_var
-            if {![info exists $url_var]} {
+            if {![info exists urlmap($url_var)]} {
                 ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
-                set url_var master_sites
-                variable portfetch::$url_var
+                set urlmap($url_var) $master_sites
             }
             unset -nocomplain fetched
-            foreach site [set $url_var] {
+            foreach site $urlmap($url_var) {
                 ui_msg "$UI_PREFIX [format [msgcat::mc "Attempting to fetch %s from %s"] $distfile $site]"
                 set file_url [portfetch::assemble_url $site $distfile]
                 set effectiveURL ""
@@ -646,8 +483,8 @@
 
                     # Special hack to check for sourceforge mirrors, which don't return a proper error code on failure
                     if {![string equal $effectiveURL $file_url] &&
-                        [string match "*sourceforge*" $file_url] &&
-                        [string match "*failedmirror*" $effectiveURL]} {
+                        [string match "http://*sourceforge.net/*" $file_url] &&
+                        [string match "http://*sourceforge.net/projects/*/files/" $effectiveURL]} {
 
                         # *SourceForge hackage in effect*
                         # The url seen by curl seems to have been a redirect to the sourceforge mirror page
@@ -700,23 +537,14 @@
 
 # Initialize fetch target and call checkfiles.
 proc portfetch::fetch_init {args} {
-    global distfiles distname distpath all_dist_files dist_subdir fetch.type fetch_init_done
-    global altprefix usealtworkpath
+    global distpath dist_subdir fetch_init_done
+    variable fetch_urls
 
     if {[info exists distpath] && [info exists dist_subdir] && ![info exists fetch_init_done]} {
-
-        # start gsoc08-privileges
-        if {[info exists usealtworkpath] && $usealtworkpath == "yes"} {
-            # I have removed ![file writable $distpath] from the if condition as
-            # the writable condition seems to get confused by effective uids.
-            set distpath "$altprefix/[ string range $distpath 1 end ]"
-            ui_debug "Going to use $distpath for fetch."
-        }
-        # end gsoc08-privileges
         set distpath ${distpath}/${dist_subdir}
         set fetch_init_done yes
     }
-    portfetch::checkfiles
+    portfetch::checkfiles fetch_urls
 }
 
 proc portfetch::fetch_start {args} {
@@ -730,7 +558,7 @@
 # there are no files to download. Otherwise, either do a cvs checkout
 # or call the standard fetchfiles procedure
 proc portfetch::fetch_main {args} {
-    global distname distpath all_dist_files fetch.type
+    global all_dist_files fetch.type
 
     # Check for files, download if necessary
     if {![info exists all_dist_files] && "${fetch.type}" == "standard"} {
@@ -739,6 +567,7 @@
 
     # Fetch the files
     switch -- "${fetch.type}" {
+        bzr     { return [bzrfetch] }
         cvs     { return [cvsfetch] }
         svn     { return [svnfetch] }
         git     { return [gitfetch] }

Modified: branches/new-help-system/base/src/port1.0/portinstall.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portinstall.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portinstall.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -33,11 +33,13 @@
 
 package provide portinstall 1.0
 package require portutil 1.0
+package require registry2 2.0
 
 set org.macports.install [target_new org.macports.install portinstall::install_main]
 target_provides ${org.macports.install} install
+target_runtype ${org.macports.install} always
 if {[option portarchivemode] == "yes"} {
-    target_requires ${org.macports.install} main unarchive fetch extract checksum patch configure build destroot archive
+    target_requires ${org.macports.install} main archivefetch unarchive fetch extract checksum patch configure build destroot archive
 } else {
     target_requires ${org.macports.install} main fetch extract checksum patch configure build destroot
 }
@@ -55,8 +57,8 @@
 set_ui_prefix
 
 proc portinstall::install_start {args} {
-    global UI_PREFIX name version revision variations portvariants
-    global prefix
+    global UI_PREFIX name version revision portvariants
+    global prefix registry_open registry.format registry.path
     ui_msg "$UI_PREFIX [format [msgcat::mc "Installing %s @%s_%s%s"] $name $version $revision $portvariants]"
     
     # start gsoc08-privileges
@@ -65,6 +67,11 @@
         elevateToRoot "install"
     }
     # end gsoc08-privileges
+    
+    if {${registry.format} == "receipt_sqlite" && ![info exists registry_open]} {
+        registry::open [file join ${registry.path} registry registry.db]
+        set registry_open yes
+    }
 }
 
 proc portinstall::install_element {src_element dst_element} {
@@ -77,32 +84,32 @@
     
     # if the file is a symlink, do not try to set file attributes
     if {[file type $src_element] != "link"} {
-        eval file attributes {$dst_element} [file attributes $src_element]
+        # tclsh on 10.6 doesn't like the combination of 0444 perm and
+        # '-creator {}' (which is returned from 'file attributes <file>'; so
+        # instead just set the attributes which are needed
+        set wantedattrs {owner group permissions}
+        set file_attr_cmd {file attributes $dst_element}
+        foreach oneattr $wantedattrs {
+            set file_attr_cmd "$file_attr_cmd -$oneattr \[file attributes \$src_element -$oneattr\]"
+        }
+        eval $file_attr_cmd
         # set mtime on installed element
         file mtime $dst_element [file mtime $src_element]
     }
 }
 
-proc portinstall::directory_dig {rootdir workdir regref {cwd ""}} {
+proc portinstall::directory_dig {rootdir workdir imagedir {cwd ""} {prepend 1}} {
     global installPlist
     set pwd [pwd]
     if {[catch {_cd $workdir} err]} {
         puts $err
         return
     }
-    
+
+    set root [file join [file separator] $imagedir]
     foreach name [readdir .] {
         set element [file join $cwd $name]
-        
-        if {![info exists root]} {
-            set root [file separator]
-        }
-        
-        if { [registry_prop_retr $regref installtype] == "image" } {
-            set imagedir [registry_prop_retr $regref imagedir]
-            set root [file join $root $imagedir]
-        }
-        
+
         set dst_element [file join $root $element]
         set src_element [file join $rootdir $element]
         # overwrites files but not directories
@@ -117,71 +124,165 @@
             install_element $src_element $dst_element
             # only track files/links for registry, not directories
             if {[file type $dst_element] != "directory"} {
-                lappend installPlist $dst_element
+                if {$prepend} {
+                    lappend installPlist $dst_element
+                } else {
+                    lappend installPlist [file join [file separator] $element]
+                }
             }
         }
         if {[file isdirectory $name] && [file type $name] != "link"} {
-            directory_dig $rootdir $name $regref [file join $cwd $name]
+            directory_dig $rootdir $name $imagedir [file join $cwd $name] $prepend
         }
     }
     _cd $pwd
 }
 
 proc portinstall::install_main {args} {
-    global name version portpath categories description long_description homepage depends_run installPlist package-install uninstall workdir worksrcdir pregrefix UI_PREFIX destroot revision maintainers ports_force portvariants targets depends_lib PortInfo epoch license
-    
-    # Begin the registry entry
-    set regref [registry_new $name $version $revision $portvariants $epoch]
-    
-    # Install the files
-    directory_dig ${destroot} ${destroot} ${regref}
-    
-    registry_prop_store $regref categories $categories
-    
-    if {[info exists description]} {
-        registry_prop_store $regref description [string map {\n \\n} ${description}]
-    }
-    if {[info exists long_description]} {
-        registry_prop_store $regref long_description [string map {\n \\n} ${long_description}]
-    }
-    if {[info exists license]} {
-        registry_prop_store $regref license ${license}
-    }
-    if {[info exists homepage]} {
-        registry_prop_store $regref homepage ${homepage}
-    }
-    if {[info exists maintainers]} {
-        registry_prop_store $regref maintainers ${maintainers}
-    }
-    if {[info exists depends_run]} {
-        registry_prop_store $regref depends_run $depends_run
-        registry_register_deps $depends_run $name
-    }
-    if {[info exists depends_lib]} {
-        registry_prop_store $regref depends_lib $depends_lib
-        registry_register_deps $depends_lib $name
-    }
-    if {[info exists installPlist]} {
-        registry_prop_store $regref contents [registry_fileinfo_for_index $installPlist]
-        if { [registry_prop_retr $regref installtype] != "image" } {
-            registry_bulk_register_files [registry_fileinfo_for_index $installPlist] $name
+    global name version portpath categories description long_description \
+    homepage depends_run installPlist package-install workdir \
+    worksrcdir UI_PREFIX destroot revision maintainers user_options \
+    portvariants negated_variants targets depends_lib PortInfo epoch license \
+    registry.installtype registry.path registry.format \
+    os.platform os.major
+
+    if {[string equal ${registry.format} "receipt_sqlite"]} {
+        # registry2.0
+
+        # can't do this inside the write transaction due to deadlock issues with _get_dep_port
+        set dep_portnames [list]
+        foreach deplist {depends_lib depends_run} {
+            if {[info exists $deplist]} {
+                foreach dep [set $deplist] {
+                    set dep_portname [_get_dep_port $dep]
+                    if {$dep_portname != ""} {
+                        lappend dep_portnames $dep_portname
+                    }
+                }
+            }
         }
+
+        registry::write {
+
+            set regref [registry::entry create $name $version $revision $portvariants $epoch]
+
+            $regref requested $user_options(ports_requested)
+            $regref os_platform ${os.platform}
+            $regref os_major ${os.major}
+            $regref archs [get_canonical_archs]
+            # Trick to have a portable GMT-POSIX epoch-based time.
+            $regref date [expr [clock scan now -gmt true] - [clock scan "1970-1-1 00:00:00" -gmt true]]
+            if {[info exists negated_variants]} {
+                $regref negated_variants $negated_variants
+            }
+
+            foreach dep_portname $dep_portnames {
+                $regref depends $dep_portname
+            }
+
+            if {${registry.installtype} == "image"} {
+                $regref installtype image
+                $regref state imaged
+                set imagedir [file join ${registry.path} software ${name} ${version}_${revision}${portvariants}]
+            } else {
+                $regref installtype direct
+                $regref state installed
+                set imagedir ""
+            }
+            $regref location $imagedir
+
+            # Install the files, requesting that the list not have the image dir prepended
+            directory_dig ${destroot} ${destroot} ${imagedir} "" 0
+            
+            if {[info exists installPlist]} {
+                # register files
+                $regref map $installPlist
+            }
+            
+            # store portfile
+            set fd [open [file join ${portpath} Portfile]]
+            $regref portfile [read $fd]
+            close $fd
+        }
+    } else {
+        # Begin the registry entry
+        set regref [registry_new $name $version $revision $portvariants $epoch]
+        if {[info exists negated_variants]} {
+            registry_prop_store $regref negated_variants $negated_variants
+        }
+
+        set imagedir ""
+        if { [registry_prop_retr $regref installtype] == "image" } {
+            set imagedir [registry_prop_retr $regref imagedir]
+        }
+        # Install the files
+        directory_dig ${destroot} ${destroot} ${imagedir}
+
+        registry_prop_store $regref requested $user_options(ports_requested)
+        registry_prop_store $regref categories $categories
+
+        registry_prop_store $regref os_platform ${os.platform}
+        registry_prop_store $regref os_major ${os.major}
+        registry_prop_store $regref archs [get_canonical_archs]
+
+        if {[info exists description]} {
+            registry_prop_store $regref description [string map {\n \\n} ${description}]
+        }
+        if {[info exists long_description]} {
+            registry_prop_store $regref long_description [string map {\n \\n} ${long_description}]
+        }
+        if {[info exists license]} {
+            registry_prop_store $regref license ${license}
+        }
+        if {[info exists homepage]} {
+            registry_prop_store $regref homepage ${homepage}
+        }
+        if {[info exists maintainers]} {
+            registry_prop_store $regref maintainers ${maintainers}
+        }
+        if {[info exists depends_run]} {
+            registry_prop_store $regref depends_run $depends_run
+            registry_register_deps $depends_run $name
+        }
+        if {[info exists depends_lib]} {
+            registry_prop_store $regref depends_lib $depends_lib
+            registry_register_deps $depends_lib $name
+        }
+        if {[info exists installPlist]} {
+            registry_prop_store $regref contents [registry_fileinfo_for_index $installPlist]
+            if { [registry_prop_retr $regref installtype] != "image" } {
+                registry_bulk_register_files [registry_fileinfo_for_index $installPlist] $name
+            }
+        }
+        if {[info exists package-install]} {
+            registry_prop_store $regref package-install ${package-install}
+        }
+        if {[info proc pkg_uninstall] == "pkg_uninstall"} {
+            registry_prop_store $regref pkg_uninstall [proc_disasm pkg_uninstall]
+        }
+
+        registry_write $regref
     }
-    if {[info exists package-install]} {
-        registry_prop_store $regref package-install ${package-install}
-    }
-    if {[info proc pkg_uninstall] == "pkg_uninstall"} {
-        registry_prop_store $regref uninstall [proc_disasm pkg_uninstall]
-    }
-    
-    registry_write $regref
-    
+
     return 0
 }
 
+# apparent usage of pkg_uninstall variable in the (flat) registry
+# the Portfile needs to define a procedure
+# proc pkg_uninstall {portname portver} {
+#     body of proc
+# }
+# which gets stored above in the receipt's pkg_uninstall property
+# this is then called by the portuninstall procedure
+# note that the portuninstall procedure is not called within
+# the context of the portfile so many usual port variables do not exist
+# e.g. destroot/workpath/filespath
+ 
+# this procedure encodes the pkg_uninstall body so that it can be stored in the
+# the receipt file
 proc portinstall::proc_disasm {pname} {
     set p "proc "
-    append p $pname " \{"
+    append p $pname " {"
     set space ""
     foreach arg [info args $pname] {
         if {[info default $pname $arg value]} {
@@ -191,6 +292,6 @@
         }
         set space " "
     }
-    append p "\} \{" [info body $pname] "\}"
+    append p "} {" [string map { \n \\n } [info body $pname] ] " }"
     return $p
 }

Modified: branches/new-help-system/base/src/port1.0/portlint.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlint.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portlint.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -239,6 +239,14 @@
                 lappend local_variants $variantname
             }
         }
+        
+        if {[string match "platform\[ \t\]*" $line]} {
+            regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
+            if {$platform_arch == "ppc"} {
+                ui_error "Arch 'ppc' in platform variant on line $lineno should be 'powerpc'"
+                incr errors
+            }
+        }
 
         if {[regexp {(^|\s)configure\s+\{\s*\}} $line]} {
             ui_warn "Line $lineno should say \"use_configure no\" instead of declaring an empty configure phase"
@@ -262,8 +270,7 @@
 
     global os.platform os.arch os.version
     global version revision epoch
-    # hoping for "noarch" :
-    set portarch ${os.arch}
+    set portarch [get_canonical_archs]
     global description long_description platforms categories all_variants
     global maintainers homepage master_sites checksums patchfiles
     global depends_fetch depends_extract depends_lib depends_build depends_run distfiles fetch.type
@@ -320,6 +327,13 @@
             ui_info "OK: Found optional variable: $opt_var"
         }
     }
+    
+    if {[info exists name]} {
+        if {[regexp {[^[:alnum:]_.-]} $name]} {
+            ui_error "Port name '$name' contains unsafe characters. Names should only contain alphanumeric characters, underscores, dashes or dots."
+            incr errors
+        }
+    }
 
     if {[info exists platforms]} {
         foreach platform $platforms {
@@ -432,6 +446,22 @@
         }
     }
 
+    # Check for multiple dependencies
+    foreach deptype {depends_extract depends_lib depends_build depends_run} {
+        if {[info exists $deptype]} {
+            array set depwarned {}
+            foreach depspec [set $deptype] {
+                if {![info exists depwarned($depspec)]
+                        && [llength [lsearch -exact -all [set $deptype] $depspec]] > 1} {
+                    ui_warn "Dependency $depspec specified multiple times in $deptype"
+                    incr warnings
+                    # Report each depspec only once
+                    set depwarned($depspec) yes
+                }
+            }
+        }
+    }
+
     if {[regexp "^(.+)nomaintainer(@macports.org)?(.+)$" $maintainers] } {
         ui_error "Using nomaintainer together with other maintainer"
         incr errors
@@ -499,7 +529,7 @@
     ui_debug "Epoch: $epoch"
     ui_debug "Version: $version"
     ui_debug "Revision: $revision"
-    ui_debug "Arch: $portarch"
+    ui_debug "Archs: $portarch"
     ###################################################################
 
     ui_msg "$UI_PREFIX [format [msgcat::mc "%d errors and %d warnings found."] $errors $warnings]"

Modified: branches/new-help-system/base/src/port1.0/portlivecheck.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portlivecheck.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portlivecheck.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -54,8 +54,8 @@
 default livecheck.type default
 default livecheck.md5 ""
 default livecheck.regex ""
-default livecheck.name {$name}
-default livecheck.distname {${livecheck.name}}
+default livecheck.name default
+default livecheck.distname default
 default livecheck.version {$version}
 
 # Deprecation
@@ -121,12 +121,21 @@
         if {${livecheck.type} eq "default"} {
             set livecheck.type "fallback"
         }
+        if {$has_homepage} {
+            if {[regexp {^http://code.google.com/p/([^/]+)} $homepage _ tag]} {
+                set livecheck.type "googlecode"
+            } elseif {[regexp {^http://www.gnu.org/software/([^/]+)} $homepage _ tag]} {
+                set livecheck.type "gnu"
+            }
+        }
     }
     if {[lsearch -exact [split $available_types "|"] ${livecheck.type}] != -1} {
         # Load the defaults from _resources/port1.0/livecheck/${livecheck.type}.tcl.
         set defaults_file "$types_dir/${livecheck.type}.tcl"
         ui_debug "Loading the defaults from '$defaults_file'"
         if {[catch {source $defaults_file} result]} {
+            global errorInfo
+            ui_debug "$errorInfo: result"
             return -code 1 "The defaults could not be loaded from '$defaults_file'."
         }
     }

Modified: branches/new-help-system/base/src/port1.0/portload.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portload.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portload.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -37,11 +37,14 @@
 set org.macports.load [target_new org.macports.load portload::load_main]
 target_runtype ${org.macports.load} always
 target_provides ${org.macports.load} load 
-target_requires ${org.macports.load} portload::main
+target_requires ${org.macports.load} main
 
 namespace eval portload {
 }
 
+options load.asroot
+default load.asroot yes
+
 set_ui_prefix
 
 proc portload::load_main {args} {

Modified: branches/new-help-system/base/src/port1.0/portmain.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portmain.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portmain.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -44,20 +44,21 @@
 }
 
 # define options
-options prefix macportsuser name version revision epoch categories maintainers
-options long_description description homepage license provides conflicts
+options prefix name version revision epoch categories maintainers
+options long_description description homepage license provides conflicts replaced_by
 options worksrcdir filesdir distname portdbpath libpath distpath sources_conf os.platform os.version os.major os.arch os.endian platforms default_variants install.user install.group macosx_deployment_target
 options universal_variant os.universal_supported
+options supported_archs
+options copy_log_files
+options compiler.cpath compiler.library_path
 
 # Export options via PortInfo
-options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts
+options_export name version revision epoch categories maintainers platforms description long_description homepage license provides conflicts replaced_by
 
 # Assign option procedure to default_variants
 option_proc default_variants handle_default_variants
 
-default distpath {[file join $portdbpath distfiles]}
 default workpath {[getportworkpath_from_buildpath $portbuildpath]}
-default worksymlink {[file join $portpath work]}
 default prefix /opt/local
 default applications_dir /Applications/MacPorts
 default frameworks_dir {${prefix}/Library/Frameworks}
@@ -74,16 +75,17 @@
 default worksrcdir {$distname}
 default filespath {[file join $portpath $filesdir]}
 default worksrcpath {[file join $workpath $worksrcdir]}
+# empty list means all archs are supported
+default supported_archs {}
 
 # Configure settings
-default macportsuser {${portutil::autoconf::macportsuser}}
 default install.user {${portutil::autoconf::install_user}}
 default install.group {${portutil::autoconf::install_group}}
 
 # Platform Settings
 set os_arch $tcl_platform(machine)
 if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
-if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
+if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
 set os_version $tcl_platform(osVersion)
 set os_major [lindex [split $os_version .] 0]
 set os_platform [string tolower $tcl_platform(os)]
@@ -94,25 +96,23 @@
 default os.arch {$os_arch}
 # Remove trailing "Endian"
 default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
-default os.universal_supported no
 
 set macosx_version {}
+set macosx_version_text {}
 if {$os_platform == "darwin"} {
     # This will probably break when Apple changes versioning
     set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+    set macosx_version_text "(Mac OS X ${macosx_version}) "
 }
+ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
 
-ui_debug "OS Platform: [option os.platform]"
-ui_debug "OS Version: [option os.version]"
-if {$macosx_version != ""} {
-    ui_debug "Mac OS X Version: ${macosx_version}"
-}
-ui_debug "System Arch: [option os.arch]"
-
 default macosx_deployment_target {$macosx_version}
 
 default universal_variant yes
 
+default compiler.cpath {${prefix}/include}
+default compiler.library_path {${prefix}/lib}
+
 # Select implicit variants
 if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
 if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
@@ -121,13 +121,51 @@
 if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
     # the universal variant itself is now created in
     # add_default_universal_variant, which is called from mportopen
-    option os.universal_supported yes
+    default os.universal_supported yes
+} else {
+    default os.universal_supported no
 }
 
+# start gsoc08-privileges
+
 # Record initial euid/egid
 set euid [geteuid]
 set egid [getegid]
 
+# if unable to write to workpath, implies running without either root privileges
+# or a shared directory owned by the group so use ~/.macports
+if { $euid != 0 && (([info exists workpath] && [file exists $workpath] && ![file writable $workpath]) || ([info exists portdbpath] && ![file writable [file join $portdbpath build]])) } {
+
+    set username [uid_to_name [getuid]]
+
+    # set global variable indicating to other functions to use ~/.macports as well
+    set usealtworkpath yes
+
+    # do tilde expansion manually - Tcl won't expand tildes automatically for curl, etc.
+    if {[info exists env(HOME)]} {
+        # HOME environment var is set, use it.
+        set userhome "$env(HOME)"
+    } else {
+        # the environment var isn't set, expand ~user instead
+        set userhome [file normalize "~${username}"]
+    }
+
+    # set alternative prefix global variable
+    set altprefix [file join $userhome .macports]
+
+    default worksymlink {[file join ${altprefix}${portpath} work]}
+    default distpath {[file join ${altprefix}${portdbpath} distfiles]}
+    set portbuildpath "${altprefix}${portbuildpath}"
+
+    ui_debug "Going to use alternate build prefix: $altprefix"
+    ui_debug "workpath = $workpath"
+} else {
+    set usealtworkpath no
+    default worksymlink {[file join $portpath work]}
+    default distpath {[file join $portdbpath distfiles]}
+}
+# end gsoc08-privileges
+
 proc portmain::main {args} {
     return 0
 }

Modified: branches/new-help-system/base/src/port1.0/portpatch.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portpatch.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portpatch.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -49,14 +49,29 @@
 # Set up defaults
 default patch.asroot no
 default patch.dir {${worksrcpath}}
-default patch.cmd {[findBinary patch $portutil::autoconf::patch_path]}
+default patch.cmd {[portpatch::build_getpatchtype]}
 default patch.pre_args -p0
 
+proc portpatch::build_getpatchtype {args} {
+    if {![exists patch.type]} {
+        return [findBinary patch $portutil::autoconf::patch_path]
+    }
+    switch -exact -- [option patch.type] {
+        gnu {
+            return [findBinary gpatch $portutil::autoconf::gnupatch_path]
+        }
+        default {
+            ui_warn "[format [msgcat::mc "Unknown patch.type %s, using 'patch'"] [option patch.type]]"
+            return [findBinary patch $portutil::autoconf::patch_path]
+        }
+    }
+}
+
 proc portpatch::patch_main {args} {
     global UI_PREFIX
 
     # First make sure that patchfiles exists and isn't stubbed out.
-    if {![exists patchfiles]} {
+    if {![exists patchfiles] || [option patchfiles] == ""} {
         return 0
     }
 
@@ -75,7 +90,7 @@
     if {![info exists patchlist]} {
         return -code error [msgcat::mc "Patch files missing"]
     }
-    _cd [option worksrcpath]
+
     set gzcat "[findBinary gzip $portutil::autoconf::gzip_path] -dc"
     set bzcat "[findBinary bzip2 $portutil::autoconf::bzip2_path] -dc"
     foreach patch $patchlist {

Modified: branches/new-help-system/base/src/port1.0/portstartupitem.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portstartupitem.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portstartupitem.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -79,7 +79,7 @@
     global startupitem.start startupitem.stop startupitem.restart
     global startupitem.type
 
-    set scriptdir ${destroot}/${prefix}/etc/rc.d
+    set scriptdir ${destroot}${prefix}/etc/rc.d
 
     if { ![exists startupitem.requires] } {
         set startupitem.requires ""
@@ -574,7 +574,6 @@
     puts ${plist} "<key>Debug</key><false/>"
     puts ${plist} "<key>Disabled</key><true/>"
     puts ${plist} "<key>OnDemand</key><false/>"
-    puts ${plist} "<key>RunAtLoad</key><false/>"
     
     if { [llength ${startupitem.logfile}] } {
         puts ${plist} "<key>StandardOutPath</key><string>${startupitem.logfile}</string>"
@@ -607,7 +606,7 @@
     ui_msg "# by default. Execute the following command to start it,"
     ui_msg "# and to cause it to launch at startup:"
     ui_msg "#"
-    ui_msg "# sudo launchctl load -w /Library/${daemondest}/${plistname}"
+    ui_msg "# sudo port load ${name}"
     ui_msg "###########################################################"
 }
 

Modified: branches/new-help-system/base/src/port1.0/porttrace.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/porttrace.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/porttrace.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -44,7 +44,7 @@
         if {[catch {package require Thread} error]} {
             ui_warn "trace requires Tcl Thread package ($error)"
         } else {
-            global env trace_fifo trace_sandboxbounds portpath distpath
+            global env trace_fifo trace_sandboxbounds portpath distpath altprefix
             # Create a fifo.
             # path in unix socket limited to 109 chars
             # # set trace_fifo "$workpath/trace_fifo"
@@ -282,7 +282,9 @@
     set ports_list {}
     set sandbox_violation_list {}
     tracelib setname $fifo
-    tracelib run
+    if [catch {tracelib run} err] {
+        ui_warn "Error in tracelib: $err"
+    }
 }
 
 # Private.

Copied: branches/new-help-system/base/src/port1.0/portuninstall.tcl (from rev 65586, trunk/base/src/port1.0/portuninstall.tcl)
===================================================================
--- branches/new-help-system/base/src/port1.0/portuninstall.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/port1.0/portuninstall.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,63 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# portuninstall.tcl
+# $Id$
+#
+# Copyright (c) 2010 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of The MacPorts Project nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+# the 'uninstall' target is provided by this package
+
+package provide portuninstall 1.0
+package require portutil 1.0
+
+set org.macports.uninstall [target_new org.macports.uninstall portuninstall::uninstall_main]
+target_runtype ${org.macports.uninstall} always
+target_state ${org.macports.uninstall} no
+target_provides ${org.macports.uninstall} uninstall
+target_requires ${org.macports.uninstall} main
+target_prerun ${org.macports.uninstall} portuninstall::uninstall_start
+
+namespace eval portuninstall {
+}
+
+options uninstall.asroot
+default uninstall.asroot no
+
+proc portuninstall::uninstall_start {args} {
+    global prefix
+    if { ![file writable $prefix] } {
+        # if install location is not writable, need root privileges
+        elevateToRoot "uninstall"
+    }
+}
+
+proc portuninstall::uninstall_main {args} {
+    global name version revision portvariants user_options
+    registry_uninstall $name "${version}_${revision}${portvariants}" [array get user_options]
+    return 0
+}

Modified: branches/new-help-system/base/src/port1.0/portunload.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portunload.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portunload.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -42,6 +42,9 @@
 namespace eval portunload {
 }
 
+options unload.asroot
+default unload.asroot yes
+
 set_ui_prefix
 
 proc portunload::unload_main {args} {

Modified: branches/new-help-system/base/src/port1.0/portutil.tcl
===================================================================
--- branches/new-help-system/base/src/port1.0/portutil.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/port1.0/portutil.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -289,7 +289,7 @@
 # and used to form a standard set of command options.
 proc commands {args} {
     foreach option $args {
-        options use_${option} ${option}.dir ${option}.pre_args ${option}.args ${option}.post_args ${option}.env ${option}.type ${option}.cmd
+        options use_${option} ${option}.dir ${option}.pre_args ${option}.args ${option}.post_args ${option}.env ${option}.nice ${option}.type ${option}.cmd
     }
 }
 
@@ -328,14 +328,14 @@
 # command_prefix    additional command prefix (typically pipe command)
 # command_suffix    additional command suffix (typically redirection)
 proc command_exec {command args} {
-    global ${command}.env ${command}.env_array env
-    set notty 0
+    global ${command}.env ${command}.env_array ${command}.nice env
+    set notty ""
     set command_prefix ""
     set command_suffix ""
 
     if {[llength $args] > 0} {
         if {[lindex $args 0] == "-notty"} {
-            set notty 1
+            set notty "-notty"
             set args [lrange $args 1 end]
         }
 
@@ -358,10 +358,24 @@
     if {[option macosx_deployment_target] ne ""} {
         set ${command}.env_array(MACOSX_DEPLOYMENT_TARGET) [option macosx_deployment_target]
     }
+    set ${command}.env_array(CC_PRINT_OPTIONS) "YES"
+    set ${command}.env_array(CC_PRINT_OPTIONS_FILE) [file join [option workpath] ".CC_PRINT_OPTIONS"]
+    if {[option compiler.cpath] ne ""} {
+        set ${command}.env_array(CPATH) [join [option compiler.cpath] :]
+    }
+    if {[option compiler.library_path] ne ""} {
+        set ${command}.env_array(LIBRARY_PATH) [join [option compiler.library_path] :]
+    }
 
     # Debug that.
     ui_debug "Environment: [environment_array_to_string ${command}.env_array]"
 
+    # Prepare nice value change
+    set nice ""
+    if {[info exists ${command}.nice] && [set ${command}.nice] != ""} {
+        set nice "-nice [set ${command}.nice]"
+    }
+
     # Get the command string.
     set cmdstring [command_string ${command}]
 
@@ -373,11 +387,8 @@
     array set env [array get ${command}.env_array]
     # Call the command.
     set fullcmdstring "$command_prefix $cmdstring $command_suffix"
-    if {$notty} {
-        set code [catch {system -notty $fullcmdstring} result]
-    } else {
-        set code [catch {system $fullcmdstring} result]
-    }
+    set code [catch {eval system $notty $nice \$fullcmdstring} result]
+
     # Unset the command array until next time.
     array unset ${command}.env_array
 
@@ -441,7 +452,23 @@
 proc notes {args} {
     global PortInfo portnotes
 
-    set PortInfo(notes) [string trim [join $args]]
+    # Strip trailing empty lines
+    set notes [string trim [join $args] "\n"]
+    # Determine indent level
+    set indent ""
+    for {set i 0} {$i < [string length $notes]} {incr i} {
+        set c [string index $notes $i]
+        if {$c != " " && $c != "\t"} {
+            break
+        }
+        append indent $c
+    }
+    # Remove indent on first line
+    set notes [string replace $notes 0 [expr $i - 1]]
+    # Remove indent on each other line
+    set notes [string map "\"\n$indent\" \"\n\"" $notes]
+
+    set PortInfo(notes) $notes
     set portnotes $PortInfo(notes)
 }
 
@@ -681,35 +708,19 @@
     # Pick up a unique name.
     if {[variant_exists $platform]} {
         set suffix 1
-        while {[variant_exists "$platform-$suffix"]} {
+        while {[variant_exists "${platform}_${suffix}"]} {
             incr suffix
         }
 
-        set platform "$platform-$suffix"
+        set platform "${platform}_${suffix}"
     }
     variant $platform $code
 
     # Set the variant if this platform matches the platform we're on
-    set matches 1
-    if {[info exists os.platform] && ${os.platform} == $os} {
-        set sel_platform $os
-        if {[info exists os.major] && [info exists release]} {
-            if {${os.major} == $release } {
-                set sel_platform ${sel_platform}_${release}
-            } else {
-                set matches 0
-            }
-        }
-        if {$matches == 1 && [info exists arch] && [info exists os.arch]} {
-            if {${os.arch} == $arch} {
-                set sel_platform ${sel_platform}_${arch}
-            } else {
-                set matches 0
-            }
-        }
-        if {$matches == 1} {
-            variant_set $sel_platform
-        }
+    if {([info exists os.platform] && ${os.platform} == $os)
+            && !([info exists os.major] && [info exists release] && ${os.major} != $release)
+            && !([info exists arch] && [info exists os.arch] && ${os.arch} != $arch)} {
+        variant_set $platform
     }
 }
 
@@ -911,7 +922,7 @@
             return -code error "reinplace copy failed"
         }
 
-        eval file attributes {$file} $attributes
+        fileAttrsAsRoot $file $attributes
 
         file delete "$tmpfile"
     }
@@ -1207,7 +1218,7 @@
 set ports_dry_last_skipped ""
 
 proc target_run {ditem} {
-    global target_state_fd workpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped
+    global target_state_fd workpath portpath ports_trace PortInfo ports_dryrun ports_dry_last_skipped worksrcpath prefix
     set portname [option name]
     set result 0
     set skipped 0
@@ -1219,7 +1230,9 @@
 
     if {$procedure != ""} {
         set targetname [ditem_key $ditem name]
-        if { [tbool ${targetname}.asroot] } {
+        set target [ditem_key $ditem provides]
+        global ${target}.asroot
+        if { [tbool ${target}.asroot] } {
             elevateToRoot $targetname
         }
 
@@ -1256,7 +1269,7 @@
                 if {[ditem_contains $ditem prerun]} {
                     set result [catch {[ditem_key $ditem prerun] $targetname} errstr]
                 }
-
+                ui_phase  $target
                 #start tracelib
                 if {($result ==0
                   && [info exists ports_trace]
@@ -1366,6 +1379,18 @@
                 }
             }
         }
+        if {[exists copy_log_files]} {
+            set log_files [option copy_log_files]
+            set log_dir [getportlogpath $portpath]
+            file mkdir $log_dir
+ 
+            foreach log_file $log_files {
+                set from "$worksrcpath/$log_file"
+                if {[file exists $from]} {
+                    file copy -force $from $log_dir
+                }
+            }
+        }
         if {$result == 0} {
             # Only write to state file if:
             # - we indeed performed this step.
@@ -1401,7 +1426,12 @@
     set res [mport_lookup $portname]
     if {[llength $res] < 2} \
     {
-        return {}
+        # Even if this port cannot be found in the index,
+        # it is still listed as dependency
+        if {[lsearch -exact $depsfound $portname] == -1} {
+            lappend depsfound $portname
+        }
+        return $depsfound
     }
 
     set depends {}
@@ -1429,29 +1459,25 @@
 
 
 proc eval_targets {target} {
-    global targets target_state_fd name version revision portvariants ports_dryrun user_options
+    global targets target_state_fd name version revision portvariants epoch ports_dryrun user_options
     set dlist $targets
 
     # the statefile will likely be autocleaned away after install,
-    # so special-case ignore already-completed install and activate
+    # so special-case already-completed install and activate
     if {[registry_exists $name $version $revision $portvariants]} {
         if {$target == "install"} {
             ui_debug "Skipping $target ($name) since this port is already installed"
             return 0
         } elseif {$target == "activate"} {
-            set regref [registry_open $name $version $revision $portvariants]
+            set regref [registry_open $name $version $revision $portvariants $epoch]
             if {[registry_prop_retr $regref active] != 0} {
                 # Something to close the registry entry may be called here, if it existed.
                 ui_debug "Skipping $target ($name @${version}_${revision}${portvariants}) since this port is already active"
+                return 0
             } else {
-                # do the activate here since target_run doesn't know how to selectively ignore the preceding steps
-                if {[info exists ports_dryrun] && $ports_dryrun == "yes"} {
-                    ui_msg "For $name: skipping $target (dry run)"
-                } else {
-                    registry_activate $name ${version}_${revision}${portvariants} [array get user_options]
-                }
+                # run the activate target but ignore its (completed) dependencies
+                return [target_run [lindex [dlist_search $dlist provides $target] 0]]
             }
-            return 0
         }
     }
 
@@ -1489,106 +1515,66 @@
 # open file to store name of completed targets
 proc open_statefile {args} {
     global workpath worksymlink place_worksymlink name portpath ports_ignore_older
-    global altprefix usealtworkpath env applications_dir portbuildpath distpath
+    global usealtworkpath altprefix env applications_dir portbuildpath
 
-    # start gsoc08-privileges
-    if { ![file exists $workpath] } {
-        if {[catch {set result [file mkdir $workpath]} result]} {
-            global errorInfo
-            ui_debug "mkdir $workpath: $errorInfo"
+    if {![file isdirectory $workpath]} {
+        file mkdir $workpath
+        chownAsRoot $portbuildpath
+        # Create a symlink to the workpath for port authors
+        if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
+            ui_debug "Attempting ln -sf $workpath $worksymlink"
+            ln -sf $workpath $worksymlink
         }
     }
-
-    # if unable to write to workpath, implies running without either root privileges
-    # or a shared directory owned by the group so use ~/.macports
-    if { ![file writable $workpath] } {
-
-        set userid [getuid]
-        set username [uid_to_name $userid]
-
-        if { $userid !=0 } {
-            ui_msg "MacPorts running without privileges.\
-                    You may be unable to complete certain actions (eg install)."
-        }
-
-        # set global variable indicating to other functions to use ~/.macports as well
-        set usealtworkpath yes
-
-        # do tilde expansion manually - tcl won't expand tildes automatically for curl, etc.
-        if {[info exists env(HOME)]} {
-            # HOME environment var is set, use it.
-            set userhome "$env(HOME)"
-        } else {
-            # the environment var isn't set, expand ~user instead
-            set userhome [file normalize "~${username}"]
-        }
-
-        # set alternative prefix global variables
-        set altprefix "$userhome/.macports"
-
-        # get alternative paths
-        set newworkpath "$altprefix$workpath"
-        set newworksymlink "$altprefix$worksymlink"
-        set newportbuildpath "$altprefix$portbuildpath"
-        set newdistpath "$altprefix$distpath"
-
-        set sourcepath [string map {"work" ""} $worksymlink]
-        set newsourcepath "$altprefix/[ string range $sourcepath 1 end ]"
-
+    
+    if { [getuid] != 0 } {
+        ui_warn_once "privileges" "MacPorts running without privileges.\
+                You may be unable to complete certain actions (e.g. install)."
+    }
+    
+    # de-escalate privileges if MacPorts was started with sudo
+    dropPrivileges
+    
+    if {$usealtworkpath} {
+        set newsourcepath "$altprefix/$portpath"
+    
         # copy Portfile (and patch files) if not there already
         # note to maintainers/devs: the original portfile in /opt/local is ALWAYS the one that will be
         #    read by macports. The copying of the portfile is done to preserve the symlink provided
         #    historically by macports from the portfile directory to the work directory.
         #    It is NOT read by MacPorts.
-        if {![file exists ${newsourcepath}Portfile] } {
+        if {![file exists ${newsourcepath}/Portfile] } {
             file mkdir $newsourcepath
             ui_debug "$newsourcepath created"
-            ui_debug "Going to copy: ${sourcepath}Portfile"
-            file copy ${sourcepath}Portfile $newsourcepath
-            if {[file exists ${sourcepath}files] } {
-                ui_debug "Going to copy: ${sourcepath}files"
-                file copy ${sourcepath}files $newsourcepath
+            ui_debug "Going to copy: ${portpath}/Portfile"
+            file copy ${portpath}/Portfile $newsourcepath
+            if {[file exists ${portpath}/files] } {
+                ui_debug "Going to copy: ${portpath}/files"
+                file copy ${portpath}/files $newsourcepath
             }
         }
-
-        set workpath $newworkpath
-        set worksymlink $newworksymlink
-        set portbuildpath $newportbuildpath
-        set distpath $newdistpath
-
-        ui_debug "Going to use $newworkpath for statefile."
-    } else {
-        set usealtworkpath no
     }
-    # end gsoc08-privileges
 
-    if {![file isdirectory $workpath]} {
-        file mkdir $workpath
-    }
-
     # flock Portfile
     set statefile [file join $workpath .macports.${name}.state]
     if {[file exists $statefile]} {
         if {![file writable $statefile]} {
             return -code error "$statefile is not writable - check permission on port directory"
         }
+        if {[file mtime ${portpath}/Portfile] >= [clock seconds]} {
+            return -code error "Portfile is from the future - check date and time of your system"
+        }
         if {!([info exists ports_ignore_older] && $ports_ignore_older == "yes") && [file mtime $statefile] < [file mtime ${portpath}/Portfile]} {
-            ui_msg "Portfile changed since last build; discarding previous state."
-            #file delete $statefile
-            delete [file join $workpath]
-            file mkdir [file join $workpath]
+            if {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
+                ui_msg "Portfile changed since last build; discarding previous state."
+                delete $workpath
+                file mkdir $workpath
+            } else {
+                ui_msg "Portfile changed since last build but not discarding previous state (dry run)"
+            }
         }
     }
-    chownAsRoot $workpath
 
-    # Create a symlink to the workpath for port authors
-    if {[tbool place_worksymlink] && ![file isdirectory $worksymlink]} {
-        ui_debug "Attempting ln -sf $workpath $worksymlink"
-        ln -sf $workpath $worksymlink
-    }
-    # de-escalate privileges - only run if MacPorts was started with sudo
-    dropPrivileges
-
     set fd [open $statefile a+]
     if {[catch {flock $fd -exclusive -noblock} result]} {
         if {"$result" == "EAGAIN"} {
@@ -1627,28 +1613,40 @@
     flush $fd
 }
 
-# check_statefile_variants
+##
 # Check that recorded selection of variants match the current selection
-proc check_statefile_variants {variations fd} {
+#
+# @param variations input array name of new variants
+# @param oldvariations output array name of old variants
+# @param fd file descriptor of the state file
+# @return 0 if variants match, 1 otherwise
+proc check_statefile_variants {variations oldvariations fd} {
     upvar $variations upvariations
+    upvar $oldvariations upoldvariations
 
+    array set upoldvariations {}
+
+    seek $fd 0 end
+    if {[tell $fd] == 0} {
+        # Statefile is empty, skipping further tests
+        return 0
+    }
+
     seek $fd 0
     while {[gets $fd line] >= 0} {
         if {[regexp "variant: (.*)" $line match name]} {
-            set oldvariations([string range $name 1 end]) [string range $name 0 0]
+            set upoldvariations([string range $name 1 end]) [string range $name 0 0]
         }
     }
 
     set mismatch 0
-    if {[array size oldvariations] > 0} {
-        if {[array size oldvariations] != [array size upvariations]} {
-            set mismatch 1
-        } else {
-            foreach key [array names upvariations *] {
-                if {![info exists oldvariations($key)] || $upvariations($key) != $oldvariations($key)} {
+    if {[array size upoldvariations] != [array size upvariations]} {
+        set mismatch 1
+    } else {
+        foreach key [array names upvariations *] {
+            if {![info exists upoldvariations($key)] || $upvariations($key) != $upoldvariations($key)} {
                 set mismatch 1
                 break
-                }
             }
         }
     }
@@ -1664,6 +1662,7 @@
     upvar $variations upvariations
 
     set selected [list]
+    set negated [list]
 
     foreach ditem $dlist {
         # Enumerate through the provides, tallying the pros and cons.
@@ -1682,13 +1681,14 @@
             }
         }
 
-        if {$cons > 0} { continue }
-
+        if {$cons > 0} {
+            lappend negated $ditem
+        }
         if {$pros > 0 && $ignored == 0} {
             lappend selected $ditem
         }
     }
-    return $selected
+    return [list $selected $negated]
 }
 
 proc variant_run {ditem} {
@@ -1698,7 +1698,7 @@
     # test for conflicting variants
     foreach v [ditem_key $ditem conflicts] {
         if {[variant_isset $v]} {
-            ui_error "Variant $name conflicts with $v"
+            ui_error "[option name]: Variant $name conflicts with $v"
             return 1
         }
     }
@@ -1707,7 +1707,7 @@
     if {[catch "variant-${name}" result]} {
         global errorInfo
         ui_debug "$errorInfo"
-        ui_error "Error executing $name: $result"
+        ui_error "[option name]: Error executing $name: $result"
         return 1
     }
     return 0
@@ -1719,29 +1719,26 @@
     # was turned on or off, a particular instance of the port is uniquely
     # characterized by the set of variants that are *on*. Thus, record those
     # variants in a string in a standard order as +var1+var2 etc.
-    # We can skip the platform and architecture since those are always
-    # requested.  XXX: Is that really true? What if the user explicitly
-    # overrides the platform and architecture variants? Will the registry get
-    # bollixed? It would seem safer to me to just leave in all the variants that
-    # are on, but for now I'm just leaving the skipping code as it was in the
-    # previous version.
-proc canonicalize_variants {variants} {
+    # Can also do the same for -variants, for recording the negated list.
+proc canonicalize_variants {variants {sign "+"}} {
     array set vara $variants
     set result ""
     set vlist [lsort -ascii [array names vara]]
     foreach v $vlist {
-        if {$vara($v) == "+" && $v ne [option os.platform] && $v ne [option os.arch]} {
-            append result +$v
+        if {$vara($v) == $sign} {
+            append result "${sign}${v}"
         }
     }
     return $result
 }
 
 proc eval_variants {variations} {
-    global all_variants ports_force PortInfo portvariants
+    global all_variants ports_force PortInfo portvariants negated_variants
     set dlist $all_variants
     upvar $variations upvariations
     set chosen [choose_variants $dlist upvariations]
+    set negated [lindex $chosen 1]
+    set chosen [lindex $chosen 0]
     set portname $PortInfo(name)
 
     # Check to make sure the requested variations are available with this
@@ -1779,7 +1776,7 @@
     # it's convenient to check for inconsistent requests for
     # variations, namely foo +requirer -required where the 'requirer'
     # variant requires the 'required' one.
-    array set activevariants [list]
+    set activevariants [list]
     foreach dvar $newlist {
         set thevar [ditem_key $dvar provides]
         if {[info exists upvariations($thevar)] && $upvariations($thevar) eq "-"} {
@@ -1790,33 +1787,31 @@
             ui_error "Inconsistent variant specification: $portname variant +$thevar is required by at least one of $chosenlist, but specified -$thevar"
             return 1
         }
-        set activevariants($thevar) "+"
+        lappend activevariants $thevar "+"
     }
 
     # Record a canonical variant string, used e.g. in accessing the registry
-    set portvariants [canonicalize_variants [array get activevariants]]
+    set portvariants [canonicalize_variants $activevariants]
 
     # Make this important information visible in PortInfo
-    set PortInfo(active_variants) [array get activevariants]
+    set PortInfo(active_variants) $activevariants
     set PortInfo(canonical_active_variants) $portvariants
 
-    # XXX: I suspect it would actually work better in the following
-    # block to record the activevariants in the statefile rather than
-    # the upvariations, since as far as I can see different sets of
-    # upvariations which amount to the same activevariants in the end
-    # can share all aspects of the build. But I'm leaving this alone
-    # for the time being, so that someone with more extensive
-    # experience can examine the idea before putting it into
-    # action. -- GlenWhitney
+    # now set the negated variants
+    set negated_list [list]
+    foreach dvar $negated {
+        set thevar [ditem_key $dvar provides]
+        lappend negated_list $thevar "-"
+    }
+    set negated_variants [canonicalize_variants $negated_list "-"]
 
     return 0
 }
 
-proc check_variants {variations target} {
+proc check_variants {target} {
     global targets ports_force ports_dryrun PortInfo
-    upvar $variations upvariations
     set result 0
-    set portname $PortInfo(name)
+    array set variations $PortInfo(active_variants)
 
     # Make sure the variations match those stored in the statefile.
     # If they don't match, print an error indicating a 'port clean'
@@ -1828,6 +1823,9 @@
     # Assume we do not need the statefile
     set statereq 0
     set ditems [dlist_search $targets provides $target]
+    if {[llength $ditems] > 0} {
+        set ditems [dlist_append_dependents $targets [lindex $ditems 0] [list]]
+    }
     foreach d $ditems {
         if {[ditem_key $d state] != "no"} {
             # At least one matching target requires the state file
@@ -1840,13 +1838,14 @@
 
         set state_fd [open_statefile]
 
-        if {[check_statefile_variants upvariations $state_fd]} {
-            ui_error "Requested variants do not match original selection.\nPlease perform 'port clean $portname' or specify the force option."
+        array set oldvariations {}
+        if {[check_statefile_variants variations oldvariations $state_fd]} {
+            ui_error "Requested variants \"[canonicalize_variants [array get variations]]\" do not match original selection \"[canonicalize_variants [array get oldvariations]]\".\nPlease use the same variants again, perform 'port clean [option name]' or specify the force option (-f)."
             set result 1
         } elseif {!([info exists ports_dryrun] && $ports_dryrun == "yes")} {
             # Write variations out to the statefile
-            foreach key [array names upvariations *] {
-            write_statefile variant $upvariations($key)$key $state_fd
+            foreach key [array names variations *] {
+                write_statefile variant $variations($key)$key $state_fd
             }
         }
 
@@ -1856,35 +1855,31 @@
     return $result
 }
 
-proc default_universal_variant_allowed {args} {
-
+# add the default universal variant if appropriate
+proc universal_setup {args} {
     if {[variant_exists universal]} {
         ui_debug "universal variant already exists, so not adding the default one"
-        return no
     } elseif {[exists universal_variant] && ![option universal_variant]} {
         ui_debug "'universal_variant no' specified, so not adding the default universal variant"
-        return no
     } elseif {[exists use_xmkmf] && [option use_xmkmf]} {
         ui_debug "using xmkmf, so not adding the default universal variant"
-        return no
     } elseif {[exists use_configure] && ![option use_configure] && ![exists xcode.project]} {
         # Allow +universal if port uses xcode portgroup.
         ui_debug "not using configure, so not adding the default universal variant"
-        return no
     } elseif {![exists os.universal_supported] || ![option os.universal_supported]} {
         ui_debug "OS doesn't support universal builds, so not adding the default universal variant"
-        return no
+    } elseif {[llength [option supported_archs]] == 1} {
+        ui_debug "only one arch supported, so not adding the default universal variant"
     } else {
         ui_debug "adding the default universal variant"
-        return yes
+        variant universal {}
     }
+    
+    if {[variant_isset universal] && ![variant_exists universal]} {
+        ui_warn "[option name] has no universal variant"
+    }
 }
 
-proc add_default_universal_variant {args} {
-    # Declare default universal variant (all the magic happens in portconfigure now)
-    variant universal {}
-}
-
 # Target class definition.
 
 # constructor for target object
@@ -2118,33 +2113,6 @@
     return $size;
 }
 
-# check for a binary in the path
-# returns an error code if it cannot be found
-proc binaryInPath {binary} {
-    global env
-    foreach dir [split $env(PATH) :] {
-        if {[file executable [file join $dir $binary]]} {
-            return [file join $dir $binary]
-        }
-    }
-
-    return -code error [format [msgcat::mc "Failed to locate '%s' in path: '%s'"] $binary $env(PATH)];
-}
-
-# find a binary either in a path defined at MacPorts' configuration time
-# or in the PATH environment variable through binaryInPath (fallback)
-proc findBinary {prog {autoconf_hint ""}} {
-    if {${autoconf_hint} != "" && [file executable ${autoconf_hint}]} {
-        return ${autoconf_hint}
-    } else {
-        if {[catch {set cmd_path [binaryInPath ${prog}]} result] == 0} {
-            return ${cmd_path}
-        } else {
-            return -code error "${result} or at its MacPorts configuration time location, did you move it?"
-        }
-    }
-}
-
 # Set the UI prefix to something standard (so it can be grepped for in output)
 proc set_ui_prefix {} {
     global UI_PREFIX env
@@ -2245,12 +2213,11 @@
 # e.g. 'merge_lipo ${workpath}/pre-dest ${destroot} ${prefix}/bin/pstree i386 ppc
 # will merge binary files with lipo which have to be in the same (relative) path
 proc merge_lipo {base target file archs} {
-    set exec-lipo ""
+    set exec-lipo [list [findBinary lipo $portutil::autoconf::lipo_path]]
     foreach arch ${archs} {
-        set exec-lipo [concat ${exec-lipo} [list "-arch" "${arch}" "${base}/${arch}${file}"]]
+        lappend exec-lipo -arch ${arch} ${base}/${arch}${file}
     }
-    set exec-lipo [concat ${exec-lipo}]
-    system "[findBinary lipo $portutil::autoconf::lipo_path] ${exec-lipo} -create -output ${target}${file}"
+    eval exec ${exec-lipo} [list -create -output ${target}${file}]
 }
 
 # private function
@@ -2295,6 +2262,9 @@
             set base_arch ${arch}
         }
     }
+    if {"" == ${base_arch}} {
+        return -code error [format [msgcat::mc "Cannot merge because directory '%s' contains no architecture directories."] ${base}]
+    }
     ui_debug "merging architectures ${archs}, base_arch is ${base_arch}"
 
     # traverse the base-architecture directory
@@ -2303,30 +2273,34 @@
         set fpath [string range "${file}" [string length "${basepath}"] [string length "${file}"]]
         if {${fpath} != ""} {
             # determine the type (dir/file/link)
-            set filetype [exec [findBinary file $portutil::autoconf::file_path] "-b" "${basepath}${fpath}"]
-            switch -regexp ${filetype} {
+            switch [file type ${basepath}${fpath}] {
                 directory {
                     # just create directories
                     ui_debug "mrg: directory ${fpath}"
                     file mkdir "${destroot}${fpath}"
                 }
-                symbolic\ link.* {
+                link {
                     # copy symlinks, TODO: check if targets match!
                     ui_debug "mrg: symlink ${fpath}"
                     file copy "${basepath}${fpath}" "${destroot}${fpath}"
                 }
-                Mach-O.* {
-                    merge_lipo "${base}" "${destroot}" "${fpath}" "${archs}"
-                }
-                current\ ar\ archive {
-                    merge_lipo "${base}" "${destroot}" "${fpath}" "${archs}"
-                }
-                ASCII\ C\ program\ text {
-                    merge_cpp "${base}" "${destroot}" "${fpath}" "${archs}"
-                }
                 default {
-                    ui_debug "unknown file type: ${filetype}"
-                    merge_file "${base}" "${destroot}" "${fpath}" "${archs}"
+                    set filetype [exec [findBinary file $portutil::autoconf::file_path] "-b" "${basepath}${fpath}"]
+                    switch -regexp ${filetype} {
+                        Mach-O.* {
+                            merge_lipo "${base}" "${destroot}" "${fpath}" "${archs}"
+                        }
+                        current\ ar\ archive {
+                            merge_lipo "${base}" "${destroot}" "${fpath}" "${archs}"
+                        }
+                        ASCII\ C\ program\ text {
+                            merge_cpp "${base}" "${destroot}" "${fpath}" "${archs}"
+                        }
+                        default {
+                            ui_debug "unknown file type: ${filetype}"
+                            merge_file "${base}" "${destroot}" "${fpath}" "${archs}"
+                        }
+                    }
                 }
             }
         }
@@ -2366,38 +2340,64 @@
 proc chownAsRoot {path} {
     global euid macportsuser
 
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
-    # if started with sudo but have dropped the privileges
-        seteuid $euid
-        ui_debug "euid changed to: [geteuid]"
-        chown  ${path} ${macportsuser}
-        ui_debug "chowned $path to $macportsuser"
-        seteuid [name_to_uid "$macportsuser"]
-        ui_debug "euid changed to: [geteuid]"
-    } elseif { [getuid] == 0 } {
-    # if started with sudo but have elevated back to root already
-        chown  ${path} ${macportsuser}
+    if { [getuid] == 0 } {
+        if {[geteuid] != 0} {
+            # if started with sudo but have dropped the privileges
+            seteuid $euid
+            ui_debug "euid changed to: [geteuid]"
+            chown  ${path} ${macportsuser}
+            ui_debug "chowned $path to $macportsuser"
+            seteuid [name_to_uid "$macportsuser"]
+            ui_debug "euid changed to: [geteuid]"
+        } else {
+            # if started with sudo but have elevated back to root already
+            chown  ${path} ${macportsuser}
+        }
     }
 }
 
 ##
+# Change attributes of file while running as root
+#
+# @param file the file in question
+# @param attributes the attributes for the file
+proc fileAttrsAsRoot {file attributes} {
+    global euid macportsuser
+    if {[getuid] == 0} {
+        if {[geteuid] != 0} {
+            # Started as root, but not root now
+            seteuid $euid
+            ui_debug "euid changed to: [geteuid]"
+            ui_debug "setting attributes on $file"
+            eval file attributes {$file} $attributes
+            seteuid [name_to_uid "$macportsuser"]
+            ui_debug "euid changed to: [geteuid]"
+        } else {
+            eval file attributes {$file} $attributes
+        }
+    } else {
+        # not root, so can't set owner/group
+        set permissions [lindex $attributes [expr [lsearch $attributes "-permissions"] + 1]]
+        file attributes $file -permissions $permissions
+    }
+}
+
+##
 # Elevate privileges back to root.
 #
 # @param action the action for which privileges are being elevated
 proc elevateToRoot {action} {
     global euid egid macportsuser
 
-    if { [getuid] == 0 && [geteuid] == [name_to_uid "$macportsuser"] } {
+    if { [getuid] == 0 && [geteuid] != 0 } {
     # if started with sudo but have dropped the privileges
         ui_debug "Can't run $action on this port without elevated privileges. Escalating privileges back to root."
         setegid $egid
         seteuid $euid
         ui_debug "euid changed to: [geteuid]. egid changed to: [getegid]."
+    } elseif { [getuid] != 0 } {
+        return -code error "MacPorts requires root privileges for this action"
     }
-
-    if { [getuid] != 0 } {
-        return -code error "MacPorts requires root privileges for this action";
-    }
 }
 
 ##
@@ -2407,15 +2407,17 @@
     global euid egid macportsuser workpath
     if { [geteuid] == 0 } {
         if { [catch {
-                ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
+                if {[name_to_uid "$macportsuser"] != 0} {
+                    ui_debug "changing euid/egid - current euid: $euid - current egid: $egid"
 
-                #seteuid [name_to_uid [file attributes $workpath -owner]]
-                #setegid [name_to_gid [file attributes $workpath -group]]
+                    #seteuid [name_to_uid [file attributes $workpath -owner]]
+                    #setegid [name_to_gid [file attributes $workpath -group]]
 
-                setegid [uname_to_gid "$macportsuser"]
-                seteuid [name_to_uid "$macportsuser"]
-                ui_debug "egid changed to: [getegid]"
-                ui_debug "euid changed to: [geteuid]"
+                    setegid [uname_to_gid "$macportsuser"]
+                    seteuid [name_to_uid "$macportsuser"]
+                    ui_debug "egid changed to: [getegid]"
+                    ui_debug "euid changed to: [geteuid]"
+                }
             }]
         } {
             ui_debug "$::errorInfo"
@@ -2426,3 +2428,134 @@
     }
 }
 
+# dependency analysis helpers
+
+### _libtest is private; subject to change without notice
+# XXX - Architecture specific
+# XXX - Rely on information from internal defines in cctools/dyld:
+# define DEFAULT_FALLBACK_FRAMEWORK_PATH
+# /Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks
+# define DEFAULT_FALLBACK_LIBRARY_PATH /lib:/usr/local/lib:/lib:/usr/lib
+#   -- Since /usr/local is bad, using /lib:/usr/lib only.
+# Environment variables DYLD_FRAMEWORK_PATH, DYLD_LIBRARY_PATH,
+# DYLD_FALLBACK_FRAMEWORK_PATH, and DYLD_FALLBACK_LIBRARY_PATH take precedence
+
+proc _libtest {depspec {return_match 0}} {
+    global env prefix frameworks_dir os.platform
+    set depline [lindex [split $depspec :] 1]
+
+    if {[info exists env(DYLD_FRAMEWORK_PATH)]} {
+        lappend search_path $env(DYLD_FRAMEWORK_PATH)
+    } else {
+        lappend search_path ${frameworks_dir} /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
+    }
+    if {[info exists env(DYLD_FALLBACK_FRAMEWORK_PATH)]} {
+        lappend search_path $env(DYLD_FALLBACK_FRAMEWORK_PATH)
+    }
+    if {[info exists env(DYLD_LIBRARY_PATH)]} {
+        lappend search_path $env(DYLD_LIBRARY_PATH)
+    }
+    lappend search_path /lib /usr/lib ${prefix}/lib
+    if {[info exists env(DYLD_FALLBACK_LIBRARY_PATH)]} {
+        lappend search_path $env(DYLD_FALLBACK_LIBRARY_PATH)
+    }
+
+    set i [string first . $depline]
+    if {$i < 0} {set i [string length $depline]}
+    set depname [string range $depline 0 [expr $i - 1]]
+    set depversion [string range $depline $i end]
+    regsub {\.} $depversion {\.} depversion
+    if {${os.platform} == "darwin"} {
+        set depregex \^${depname}${depversion}\\.dylib\$
+    } else {
+        set depregex \^${depname}\\.so${depversion}\$
+    }
+
+    return [_mportsearchpath $depregex $search_path 0 $return_match]
+}
+
+### _bintest is private; subject to change without notice
+
+proc _bintest {depspec {return_match 0}} {
+    global env prefix
+    set depregex [lindex [split $depspec :] 1]
+
+    set search_path [split $env(PATH) :]
+
+    set depregex \^$depregex\$
+
+    return [_mportsearchpath $depregex $search_path 1 $return_match]
+}
+
+### _pathtest is private; subject to change without notice
+
+proc _pathtest {depspec {return_match 0}} {
+    global env prefix
+    set depregex [lindex [split $depspec :] 1]
+
+    # separate directory from regex
+    set fullname $depregex
+
+    regexp {^(.*)/(.*?)$} "$fullname" match search_path depregex
+
+    if {[string index $search_path 0] != "/"} {
+        # Prepend prefix if not an absolute path
+        set search_path "${prefix}/${search_path}"
+    }
+
+    set depregex \^$depregex\$
+
+    return [_mportsearchpath $depregex $search_path 0 $return_match]
+}
+
+# returns the name of the port that will actually be satisfying $depspec
+proc _get_dep_port {depspec} {
+    global registry.installtype
+    set speclist [split $depspec :]
+    set portname [lindex $speclist end]
+    if {[string equal ${registry.installtype} "image"]} {
+        set res [_portnameactive $portname]
+    } else {
+        set res [registry_exists_for_name $portname]
+    }
+    if {$res != 0} {
+        return $portname
+    }
+    
+    set depfile ""
+    switch [lindex $speclist 0] {
+        bin {
+            set depfile [_bintest $depspec 1]
+        }
+        lib {
+            set depfile [_libtest $depspec 1]
+        }
+        path {
+            set depfile [_pathtest $depspec 1]
+        }
+    }
+    if {$depfile == ""} {
+        return $portname
+    } else {
+        set theport [registry_file_registered $depfile]
+        if {$theport != 0} {
+            return $theport
+        } else {
+            return ""
+        }
+    }
+}
+
+# returns the list of archs that the port is targeting
+proc get_canonical_archs {} {
+    global supported_archs os.arch configure.build_arch configure.universal_archs
+    if {$supported_archs == "noarch"} {
+        return "noarch"
+    } elseif {[variant_exists universal] && [variant_isset universal]} {
+        return [lsort -ascii ${configure.universal_archs}]
+    } elseif {${configure.build_arch} != ""} {
+        return ${configure.build_arch}
+    } else {
+        return ${os.arch}
+    }
+}

Modified: branches/new-help-system/base/src/programs/daemondo/Makefile.in
===================================================================
--- branches/new-help-system/base/src/programs/daemondo/Makefile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/programs/daemondo/Makefile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -8,7 +8,8 @@
 mandir=		@mandir@
 mandircat8=	${mandir}/cat8
 
-CFLAGS_QUICHEEATERS	= -W -Wall -Wno-unused-parameter
+CFLAGS_QUICHEEATERS	= -W -Wall
+CPPFLAGS	+= -I../..
 SRCS		= main.c
 OBJS		= main.o
 LIBS		= -framework CoreFoundation \
@@ -32,7 +33,7 @@
 distclean: clean
 	rm -f Makefile
 
-install:
+install: daemondo
 	${INSTALL} -o ${DSTUSR} -g ${DSTGRP} -m 555 ${PROGRAM} ${DESTDIR}${bindir}
 
 test:

Modified: branches/new-help-system/base/src/programs/daemondo/main.c
===================================================================
--- branches/new-help-system/base/src/programs/daemondo/main.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/programs/daemondo/main.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -47,7 +47,11 @@
     
         com.apple.system.config.network_change
 */
-    
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <unistd.h>
 #include <signal.h>
@@ -707,7 +711,7 @@
 
 
 void
-ScheduledRestartCallback(CFRunLoopTimerRef timer, void *info)
+ScheduledRestartCallback(CFRunLoopTimerRef timer UNUSED, void *info UNUSED)
 {
     if (verbosity >= 3)
         LogMessage("Scheduled restart time has arrived.\n");
@@ -759,9 +763,9 @@
 
 void
 DynamicStoreChanged(
-                    SCDynamicStoreRef   store,
+                    SCDynamicStoreRef   store UNUSED,
                     CFArrayRef          changedKeys,
-                    void                *info
+                    void                *info UNUSED
                     )
 {
     if (verbosity >= 3)
@@ -789,7 +793,7 @@
 
 
 void
-PowerCallBack(void *x, io_service_t y, natural_t messageType, void *messageArgument)
+PowerCallBack(void *x UNUSED, io_service_t y UNUSED, natural_t messageType, void *messageArgument)
 {
     switch (messageType)
     {
@@ -814,11 +818,11 @@
 
 void
 NotificationCenterCallback(
-                                CFNotificationCenterRef center, 
-                                void *observer, 
-                                CFStringRef name, 
-                                const void *object, 
-                                CFDictionaryRef userInfo)
+                                CFNotificationCenterRef center UNUSED,
+                                void *observer UNUSED,
+                                CFStringRef name,
+                                const void *object UNUSED,
+                                CFDictionaryRef userInfo UNUSED)
 {
     if (verbosity >= 3)
     {
@@ -832,7 +836,7 @@
 
 
 void
-SignalCallback(CFMachPortRef port, void *msg, CFIndex size, void *info)
+SignalCallback(CFMachPortRef port UNUSED, void *msg, CFIndex size UNUSED, void *info UNUSED)
 {
     mach_msg_header_t* hdr = (mach_msg_header_t*)msg;
     switch (hdr->msgh_id)
@@ -865,8 +869,8 @@
 }
 
 
-void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type,
-             CFDataRef address, const void *data, void *context)
+void KQueueCallBack (CFSocketRef socketRef, CFSocketCallBackType type UNUSED,
+             CFDataRef address UNUSED, const void *data UNUSED, void *context UNUSED)
 {
     int fd = CFSocketGetNative(socketRef);
     


Property changes on: branches/new-help-system/base/src/registry2.0
___________________________________________________________________
Modified: svn:ignore
   - registry.dylib
pkgIndex.tcl

   + pkgIndex.tcl
registry.dylib
registry_autoconf.tcl


Modified: branches/new-help-system/base/src/registry2.0/Makefile
===================================================================
--- branches/new-help-system/base/src/registry2.0/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,8 +1,9 @@
 # $Id$
 
-SRCS = registry_util.tcl portimage.tcl portuninstall.tcl
+SRCS = registry.tcl registry_autoconf.tcl registry_util.tcl receipt_flat.tcl receipt_sqlite.tcl portimage.tcl portuninstall.tcl
 OBJS = registry.o util.o \
-	entry.o entryobj.o
+	entry.o entryobj.o \
+	../cregistry/cregistry.a
 	#graph.o graphobj.o
 
 SHLIB_NAME= registry${SHLIB_SUFFIX}
@@ -11,7 +12,8 @@
 include ../../Mk/macports.autoconf.mk
 include ../../Mk/macports.tea.mk
 
-LIBS+=	../cregistry/cregistry.a ${SQLITE3_LIBS}
+CFLAGS+=	${SQLITE3_CFLAGS}
+LIBS+=	${SQLITE3_LIBS}
 
 .PHONY: test
 
@@ -19,7 +21,11 @@
 	${TCLSH} tests/entry.tcl ${SHLIB_NAME}
 	${TCLSH} tests/depends.tcl ${SHLIB_NAME}
 
+distclean:: clean
+	rm -f registry_autoconf.tcl
+
 install:: all
+	[ ! -d $(DESTDIR)${datadir}/macports/Tcl/registry1.0 ] || rm -vrf $(DESTDIR)${datadir}/macports/Tcl/registry1.0
 	$(INSTALL) -d -o ${DSTUSR} -g ${DSTGRP} -m ${DSTMODE} ${INSTALLDIR}
 	$(INSTALL) -o ${DSTUSR} -g ${DSTGRP} -m 444 ${SHLIB_NAME} ${INSTALLDIR}
 	$(SILENT) set -x; for file in ${SRCS}; do \

Modified: branches/new-help-system/base/src/registry2.0/entry.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/entry.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/entry.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -151,8 +151,13 @@
         if (list_handle) {
             entry_list* list = *list_handle;
             *list_handle = malloc(sizeof(entry_list*));
-            (*list_handle)->entry = entry;
-            (*list_handle)->next = list;
+            if (*list_handle) {
+                (*list_handle)->entry = entry;
+                (*list_handle)->next = list;
+            } else {
+                reg_entry_free(entry);
+                return TCL_ERROR;
+            }
         } else {
             reg_entry_free(entry);
         }
@@ -280,6 +285,9 @@
         }
         keys = malloc(key_count * sizeof(char*));
         vals = malloc(key_count * sizeof(char*));
+        if (!keys || !vals) {
+            return TCL_ERROR;
+        }
         for (i=0; i<key_count; i+=1) {
             keys[i] = Tcl_GetString(objv[2*i+start]);
             vals[i] = Tcl_GetString(objv[2*i+start+1]);
@@ -366,14 +374,15 @@
         entry_count = reg_entry_imaged(reg, name, version, revision, variants,
                 &entries, &error);
         if (entry_count >= 0) {
-            Tcl_Obj* resultObj;
             Tcl_Obj** objs;
-            list_entry_to_obj(interp, &objs, entries, entry_count, &error);
-            resultObj = Tcl_NewListObj(entry_count, objs);
-            Tcl_SetObjResult(interp, resultObj);
+            if (list_entry_to_obj(interp, &objs, entries, entry_count, &error)) {
+                Tcl_Obj* resultObj = Tcl_NewListObj(entry_count, objs);
+                Tcl_SetObjResult(interp, resultObj);
+                free(entries);
+                free(objs);
+                return TCL_OK;
+            }
             free(entries);
-            free(objs);
-            return TCL_OK;
         }
         return registry_failed(interp, &error);
     }
@@ -408,14 +417,15 @@
         }
         entry_count = reg_entry_installed(reg, name, &entries, &error);
         if (entry_count >= 0) {
-            Tcl_Obj* resultObj;
             Tcl_Obj** objs;
-            list_entry_to_obj(interp, &objs, entries, entry_count, &error);
-            resultObj = Tcl_NewListObj(entry_count, objs);
-            Tcl_SetObjResult(interp, resultObj);
+            if (list_entry_to_obj(interp, &objs, entries, entry_count, &error)) {
+                Tcl_Obj* resultObj = Tcl_NewListObj(entry_count, objs);
+                Tcl_SetObjResult(interp, resultObj);
+                free(entries);
+                free(objs);
+                return TCL_OK;
+            }
             free(entries);
-            free(objs);
-            return TCL_OK;
         }
         return registry_failed(interp, &error);
     }
@@ -423,6 +433,9 @@
 
 
 /*
+ * registry::entry owner filename
+ *
+ * Returns the port that owns the given filename (empty string if none).
  */
 static int entry_owner(Tcl_Interp* interp, int objc, Tcl_Obj* CONST objv[]) {
     reg_registry* reg = registry_for(interp, reg_attached);

Modified: branches/new-help-system/base/src/registry2.0/entryobj.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/entryobj.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/entryobj.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -48,10 +48,14 @@
     "version",
     "revision",
     "variants",
-    "default_variants",
+    "negated_variants",
     "date",
     "state",
     "installtype",
+    "archs",
+    "os_platform",
+    "os_major",
+    "requested",
     NULL
 };
 
@@ -189,7 +193,7 @@
         Tcl_Obj* CONST objv[]) {
     reg_registry* reg = registry_for(interp, reg_attached);
     if (objc != 2) {
-        Tcl_WrongNumArgs(interp, 1, objv, "files");
+        Tcl_WrongNumArgs(interp, 1, objv, "imagefiles");
         return TCL_ERROR;
     } else if (reg == NULL) {
         return TCL_ERROR;
@@ -278,7 +282,7 @@
         int objc, Tcl_Obj* CONST objv[]) {
     reg_registry* reg = registry_for(interp, reg_attached);
     if (objc != 2) {
-        Tcl_WrongNumArgs(interp, 1, objv, "dependents");
+        Tcl_WrongNumArgs(interp, 1, objv, "dependencies");
         return TCL_ERROR;
     } else if (reg == NULL) {
         return TCL_ERROR;
@@ -368,10 +372,14 @@
     { "version", entry_obj_prop },
     { "revision", entry_obj_prop },
     { "variants", entry_obj_prop },
-    { "default_variants", entry_obj_prop },
+    { "negated_variants", entry_obj_prop },
     { "date", entry_obj_prop },
     { "state", entry_obj_prop },
     { "installtype", entry_obj_prop },
+    { "archs", entry_obj_prop },
+    { "os_platform", entry_obj_prop },
+    { "os_major", entry_obj_prop },
+    { "requested", entry_obj_prop },
     /* filemap */
     { "map", entry_obj_filemap },
     { "unmap", entry_obj_filemap },

Modified: branches/new-help-system/base/src/registry2.0/graph.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/graph.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/graph.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -90,8 +90,11 @@
                             == SQLITE_OK)
                         && (sqlite3_step(stmt) == SQLITE_DONE))) {
                 graph* g = malloc(sizeof(graph));
+                sqlite3_free(query);
+                if (!g) {
+                    return TCL_ERROR;
+                }
                 g->db = db;
-                sqlite3_free(query);
                 if (objc == 4) {
                     /* graph create dbfile name */
                     if (SetGraph(interp, Tcl_GetString(objv[3]), g) == TCL_OK) {
@@ -100,7 +103,7 @@
                     }
                 } else {
                     /* graph create dbfile; generate a name */
-                    char* name = UniqueName(interp, "registry::graph");
+                    char* name = unique_name(interp, "::registry::graph");
                     if (SetGraph(interp, name, g) == TCL_OK) {
                         Tcl_Obj* res = Tcl_NewStringObj(name, -1);
                         Tcl_SetObjResult(interp, res);

Modified: branches/new-help-system/base/src/registry2.0/item.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/item.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/item.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -58,6 +58,9 @@
 static int set_item(Tcl_Interp* interp, char* name, sqlite_int64 rowid) {
     sqlite3* db = registry_db(interp, 0);
     item_t* new_item = malloc(sizeof(item_t));
+    if (!new_item) {
+        return TCL_ERROR;
+    }
     new_item->rowid = rowid;
     new_item->db = db;
     if (set_object(interp, name, new_item, "item", item_obj_cmd, delete_item)
@@ -102,7 +105,7 @@
         }
     } else {
         /* item create */
-        char* name = unique_name(interp, "registry::item");
+        char* name = unique_name(interp, "::registry::item");
         if (set_item(interp, name, item) == TCL_OK) {
             Tcl_Obj* res = Tcl_NewStringObj(name, -1);
             Tcl_SetObjResult(interp, res);
@@ -150,13 +153,16 @@
     sqlite3_stmt* stmt;
     Tcl_Obj* result;
     /* 40 + 20 per clause is safe */
-    char* query = (char*)malloc((20*objc)*sizeof(char));
+    int query_size = (20*objc)*sizeof(char);
+    char* query = (char*)malloc(query_size);
+    char* query_start = "SELECT proc FROM items";
     char* insert;
-    if (db == NULL) {
+    int insert_size = query_size - strlen(query_start);
+    if (db == NULL || query == NULL) {
         return TCL_ERROR;
     }
-    strcpy(query, "SELECT proc FROM items");
-    insert = query + strlen("SELECT proc FROM items");
+    strncpy(query, query_start, query_size);
+    insert = query + strlen(query_start);
     for (i=2; i<objc; i++) {
         int len;
         int index;
@@ -179,11 +185,13 @@
         }
         key = Tcl_GetString(keyObj);
         if (i == 2) {
-            sprintf(insert, " WHERE %s=?", key);
+            snprintf(insert, insert_size, " WHERE %s=?", key);
             insert += 9 + strlen(key);
+            insert_size -= 9 + strlen(key);
         } else {
-            sprintf(insert, " AND %s=?", key);
+            snprintf(insert, insert_size, " AND %s=?", key);
             insert += 7 + strlen(key);
+            insert_size -= 7 + strlen(key);
         }
     }
     r = sqlite3_prepare(db, query, -1, &stmt, NULL);

Modified: branches/new-help-system/base/src/registry2.0/itemobj.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/itemobj.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/itemobj.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -110,7 +110,7 @@
             int len;
             const char* result;
             Tcl_Obj* resultObj;
-            sprintf(query, "SELECT %s FROM items WHERE rowid=?", key);
+            snprintf(query, sizeof(query), "SELECT %s FROM items WHERE rowid=?", key);
             sqlite3_prepare(item->db, query, -1, &stmt, NULL);
             sqlite3_bind_int64(stmt, 1, item->rowid);
             sqlite3_step(stmt);
@@ -133,7 +133,7 @@
             char query[64];
             char* key = Tcl_GetString(objv[2]);
             char* value = Tcl_GetString(objv[3]);
-            sprintf(query, "UPDATE items SET %s=? WHERE rowid=?", key);
+            snprintf(query, sizeof(query), "UPDATE items SET %s=? WHERE rowid=?", key);
             sqlite3_prepare(item->db, query, -1, &stmt, NULL);
             sqlite3_bind_text(stmt, 1, value, -1, SQLITE_STATIC);
             sqlite3_bind_int64(stmt, 2, item->rowid);

Modified: branches/new-help-system/base/src/registry2.0/portimage.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portimage.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/portimage.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portimage.tcl
 # $Id$
 #
@@ -17,7 +17,7 @@
 # 3. Neither the name of Apple Inc. nor the names of its contributors
 #    may be used to endorse or promote products derived from this software
 #    without specific prior written permission.
-#
+# 
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -33,9 +33,10 @@
 
 package provide portimage 2.0
 
-package require macports 1.0
+package require registry 1.0
 package require registry2 2.0
 package require registry_util 2.0
+package require macports 1.0
 package require Pextlib 1.0
 
 set UI_PREFIX "--> "
@@ -57,294 +58,455 @@
 # will also remove all of the references of the files from the registry's
 # file_map
 #
-# Compacting and Uncompacting of port images to save space will be implemented
-# at some point.
-#
 # For the creating and removing of links during activation and deactivation,
 # code very similar to what is used in portinstall is used.
 #
 
 namespace eval portimage {
 
+variable force 0
+variable use_reg2 0
+
 # Activate a "Port Image"
-proc activate {name specifier optionslist} {
-    global macports::prefix macports::registry.path UI_PREFIX
+proc activate {name v optionslist} {
+    global macports::prefix macports::registry.format macports::registry.path registry_open UI_PREFIX
     array set options $optionslist
+    variable force
+    variable use_reg2
 
-    if {[info exists options(ports_force)] && [string is true $options(ports_force)] } {
+    if {[info exists options(ports_force)] && [string is true -strict $options(ports_force)] } {
         set force 1
-    } else {
-        set force 0
     }
-
-    if {$specifier != ""} {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $specifier]"
-    } else {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
+    if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
+        set use_reg2 1
+        if {![info exists registry_open]} {
+            registry::open [file join ${macports::registry.path} registry registry.db]
+            set registry_open yes
+        }
     }
+    set todeactivate [list]
 
-    registry::read {
+    if {$use_reg2} {
+        registry::read {
 
-        set requested [_check_registry $name $specifier]
-        set version [$requested version]
-        set revision [$requested revision]
-        set variants [$requested variants]
-        set specifier "${version}_$revision$variants"
+            set requested [_check_registry $name $v]
+            # set name again since the one we were passed may not have had the correct case
+            set name [$requested name]
+            set version [$requested version]
+            set revision [$requested revision]
+            set variants [$requested variants]
+            set specifier "${version}_${revision}${variants}"
 
-        set current [registry::entry installed $name]
-        if { [llength $current] > 1 } {
+            # if another version of this port is active, deactivate it first
+            set current [registry::entry installed $name]
             foreach i $current {
-                set iname [$i name]
-                set iversion [$i version]
-                set irevision [$i revision]
-                set ivariants [$i variants]
-                set ispecifier "${iversion}_$irevision$ivariants"
-                if { ![string equal $specifier $ispecifier]
-                        && [string equal [$i state] "installed"] } {
-                    return -code error "Image error: Another version of this port ($iname @${iversion}_${irevision}${ivariants}) is already active."
+                if { ![string equal $specifier "[$i version]_[$i revision][$i variants]"] } {
+                    lappend todeactivate $i
                 }
             }
+
+            # this shouldn't be possible
+            if { ![string equal [$requested installtype] "image"] } {
+                return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
+            }
+
+            if { [string equal [$requested state] "installed"] } {
+                return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
+            }
         }
+        foreach a $todeactivate {
+            if {![registry::run_target $a deactivate [list ports_nodepcheck 1]]} {
+                deactivate $name "[$a version]_[$a revision][$a variants]" [list ports_nodepcheck 1]
+            }
+        }
+    } else {
+        # registry1.0
+        set ilist [_check_registry $name $v]
+        # set name again since the one we were passed may not have had the correct case
+        set name [lindex $ilist 0]
+        set version [lindex $ilist 1]
+        set revision [lindex $ilist 2]
+        set variants [lindex $ilist 3]
 
-        # this shouldn't be possible
-        if { ![string equal [$requested installtype] "image"] } {
+        # if another version of this port is active, deactivate it first
+        set ilist [registry::installed $name]
+        if { [llength $ilist] > 1 } {
+            foreach i $ilist {
+                set iversion [lindex $i 1]
+                set irevision [lindex $i 2]
+                set ivariants [lindex $i 3]
+                set iactive [lindex $i 4]
+                if { ![string equal "${iversion}_${irevision}${ivariants}" "${version}_${revision}${variants}"] && $iactive == 1 } {
+                    lappend todeactivate "${iversion}_${irevision}${ivariants}"
+                }
+            }
+        }
+
+        set ref [registry::open_entry $name $version $revision $variants]
+
+        if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {
             return -code error "Image error: ${name} @${version}_${revision}${variants} not installed as an image."
         }
-
-        if { [string equal [$requested state] "active"] } {
+        if { [registry::property_retrieve $ref active] != 0 } {
             return -code error "Image error: ${name} @${version}_${revision}${variants} is already active."
         }
 
-        # compaction is not yet supported
-        #if { [$requested compact] != 0 } {
-        #    return -code error "Image error: ${name} @${version}_${revision}${variants} is compacted."
-        #}
+        foreach a $todeactivate {
+            deactivate $name $a [list ports_nodepcheck 1]
+        }
     }
 
-    _activate_contents $port $force
-    $requested state active
+    if {$v != ""} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s @%s"] $name $v]"
+    } else {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Activating %s"] $name]"
+    }
+
+    if {$use_reg2} {
+        _activate_contents $requested
+        $requested state installed
+    } else {
+        set imagedir [registry::property_retrieve $ref imagedir]
+
+        set contents [registry::property_retrieve $ref contents]
+
+        set imagefiles [_check_contents $name $contents $imagedir]
+
+        registry::open_file_map
+        _activate_contents $name $imagefiles $imagedir
+
+        registry::property_store $ref active 1
+
+        registry::write_entry $ref
+
+        foreach file $imagefiles {
+            registry::register_file $file $name
+        }
+        registry::write_file_map
+        registry::close_file_map
+    }
 }
 
-proc deactivate {name spec optionslist} {
-    global UI_PREFIX
+proc deactivate {name v optionslist} {
+    global UI_PREFIX macports::registry.format macports::registry.path registry_open
     array set options $optionslist
+    variable use_reg2
 
-    if {[info exists options(ports_force)] && [string is true $options(ports_force)] } {
+    if {[info exists options(ports_force)] && [string is true -strict $options(ports_force)] } {
+        # this not using the namespace variable is correct, since activate
+        # needs to be able to force deactivate independently of whether
+        # the activation is being forced
         set force 1
     } else {
         set force 0
     }
+    if {[string equal ${macports::registry.format} "receipt_sqlite"]} {
+        set use_reg2 1
+        if {![info exists registry_open]} {
+            registry::open [file join ${macports::registry.path} registry registry.db]
+            set registry_open yes
+        }
+    }
 
-    if {$spec != ""} {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $spec]"
+    if {$use_reg2} {
+        if { [string equal $name ""] } {
+            throw registry::image-error "Registry error: Please specify the name of the port."
+        }
+        set ilist [registry::entry installed $name]
+        if { [llength $ilist] == 1 } {
+            set requested [lindex $ilist 0]
+        } else {
+            throw registry::image-error "Image error: port ${name} is not active."
+        }
+        # set name again since the one we were passed may not have had the correct case
+        set name [$requested name]
+        set version [$requested version]
+        set revision [$requested revision]
+        set variants [$requested variants]
+        set specifier "${version}_${revision}${variants}"
     } else {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s"] $name]"
+        set ilist [registry::active $name]
+        if { [llength $ilist] > 1 } {
+            return -code error "Registry error: Please specify the name of the port."
+        } else {
+            set ilist [lindex $ilist 0]
+        }
+        # set name again since the one we were passed may not have had the correct case
+        set name [lindex $ilist 0]
+        set version [lindex $ilist 1]
+        set revision [lindex $ilist 2]
+        set variants [lindex $ilist 3]
+        set specifier "${version}_${revision}${variants}"
     }
 
-    if { [string equal $name {}] } {
-        throw registry::image-error "Registry error: Please specify the name of the port."
+    if { $v != "" && ![string equal $specifier $v] } {
+        return -code error "Active version of $name is not $v but ${specifier}."
     }
-    set ilist [registry::entry installed $name]
-    if { [llength $ilist] == 1 } {
-        set requested [lindex $ilist 0]
+
+    if {$v != ""} {
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s @%s"] $name $v]"
     } else {
-        throw registry::image-error "Image error: port ${name} is not active."
+        ui_msg "$UI_PREFIX [format [msgcat::mc "Deactivating %s"] $name]"
     }
-    set version [$requested version]
-    set revision [$requested revision]
-    set variants [$requested variants]
-    set specifier ${version}_$revision$variants
 
-    if { ![string equal $spec {}] && ![string equal $spec $specifier] } {
-        return -code error "Active version of $name is not $spec but $specifier."
-    }
-    if { ![string equal [$requested installtype] "image"] } {
-        return -code error "Image error: ${name} @${specifier} not installed as an image."
-    }
-    # this shouldn't be possible
-    if { [$requested state] != "installed" } {
-        return -code error "Image error: ${name} @${specifier} is not active."
-    }
+    if {$use_reg2} {
+        if { ![string equal [$requested installtype] "image"] } {
+            return -code error "Image error: ${name} @${specifier} not installed as an image."
+        }
+        # this shouldn't be possible
+        if { [$requested state] != "installed" } {
+            return -code error "Image error: ${name} @${specifier} is not active."
+        }
 
-    # compaction not yet supported
-    #if { [registry::property_retrieve $ref compact] != 0 } {
-    #    return -code error "Image error: ${name} @${specifier} is compacted."
-    #}
+        if {![info exists options(ports_nodepcheck)] || ![string is true -strict $options(ports_nodepcheck)]} {
+            registry::check_dependents $requested $force
+        }
 
-    registry::check_dependents $port $force
+        _deactivate_contents $requested {} $force
+        $requested state imaged
+    } else {
+        set ref [registry::open_entry $name $version $revision $variants]
 
-    set imagedir [$requested imagedir]
-    set imagefiles [$requested files]
+        if { ![string equal [registry::property_retrieve $ref installtype] "image"] } {
+            return -code error "Image error: ${name} @${specifier} not installed as an image."
+        }
+        if { [registry::property_retrieve $ref active] != 1 } {
+            return -code error "Image error: ${name} @${specifier} is not active."
+        }
 
-    _deactivate_contents $requested $force
-    $requested state imaged
-}
+        registry::open_file_map
+        set imagefiles [registry::port_registered $name]
 
-proc compact {name v} {
-    global UI_PREFIX
+        _deactivate_contents $name $imagefiles
 
-    throw registry::image-error "Image error: compact/uncompact not yet implemented."
-}
+        foreach file $imagefiles {
+            registry::unregister_file $file
+        }
+        registry::write_file_map
+        registry::close_file_map
 
-proc uncompact {name v} {
-    global UI_PREFIX
+        registry::property_store $ref active 0
 
-    throw registry::image-error "Image error: compact/uncompact not yet implemented."
+        registry::write_entry $ref
+    }
 }
 
-proc _check_registry {name specifier} {
-    global UI_PREFIX
+proc _check_registry {name v} {
+    global UI_PREFIX macports::registry.installtype
+    variable use_reg2
 
-    if { [registry::decode_spec $specifier version revision variants] } {
-        set ilist [registry::entry imaged $name $version $revision $variants]
-        set valid 1
-    } else {
-        set valid [string equal $specifier {}]
-        set ilist [registry::entry imaged $name]
-    }
+    if {$use_reg2} {
+        if { [registry::decode_spec $v version revision variants] } {
+            set ilist [registry::entry imaged $name $version $revision $variants]
+            set valid 1
+        } else {
+            set valid [string equal $v {}]
+            set ilist [registry::entry imaged $name]
+        }
 
-    if { [llength $ilist] > 1 || (!$valid && [llength $ilist] == 1) } {
-        ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
-        foreach i $ilist {
-            set iname [$i name]
-            set iversion [$i version]
-            set irevision [$i revision]
-            set ivariants [$i variants]
-            if { [$i state] == "installed" } {
-                ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
+        if { [llength $ilist] > 1 || (!$valid && [llength $ilist] == 1) } {
+            ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
+            foreach i $ilist {
+                set iname [$i name]
+                set iversion [$i version]
+                set irevision [$i revision]
+                set ivariants [$i variants]
+                if { [$i state] == "installed" } {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
+                } else {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
+                }
+            }
+            if { $valid } {
+                throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
             } else {
-                ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
+                throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
             }
+        } elseif { [llength $ilist] == 1 } {
+            return [lindex $ilist 0]
         }
-        if { $valid } {
-            throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
-        } else {
-            throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
+        throw registry::invalid "Registry error: No port of $name installed."
+    } else {
+        # registry1.0
+        set ilist [registry::installed $name $v]
+        if { [string equal $v ""] && [llength $ilist] > 1 } {
+            # set name again since the one we were passed may not have had the correct case
+            set name [lindex [lindex $ilist 0] 0]
+            ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $name are currently installed:"]"
+            foreach i $ilist { 
+                set iname [lindex $i 0]
+                set iversion [lindex $i 1]
+                set irevision [lindex $i 2]
+                set ivariants [lindex $i 3]
+                set iactive [lindex $i 4]
+                if { $iactive == 0 } {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
+                } elseif { $iactive == 1 } {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
+                }
+            }
+            return -code error "Registry error: Please specify the full version as recorded in the port registry."
+        } elseif {[llength $ilist] == 1} {
+            return [lindex $ilist 0]
         }
-    } else if { [llength $ilist] == 1 } {
-        return [lindex $ilist 0]
+        return -code error "Registry error: No port of $name installed."
     }
-    throw registry::invalid "Registry error: No port of $name installed."
 }
 
+proc _check_contents {name contents imagedir} {
+
+    set imagefiles [list]
+    set idlen [string length $imagedir]
+
+    # generate list of activated file paths from list of paths in the image dir
+    foreach fe $contents {
+        set srcfile [lindex $fe 0]
+        if { ![string equal $srcfile ""] && [file type $srcfile] != "directory" } {
+            set file [string range $srcfile $idlen [string length $srcfile]]
+
+            lappend imagefiles $file
+        }
+    }
+
+    return $imagefiles
+}
+
 ## Activates a file from an image into the filesystem. Deals with symlinks,
 ## directories and files.
 ##
 ## @param [in] srcfile path to file in image
 ## @param [in] dstfile path to activate file to
 proc _activate_file {srcfile dstfile} {
-    switch { [file type $srcfile] } {
-        case link {
+    switch [file type $srcfile] {
+        link {
             ui_debug "activating link: $dstfile"
-            file copy -force $srcfile $dstfile
+            file copy -force -- $srcfile $dstfile
         }
-        case directory {
+        directory {
             # Don't recursively copy directories
             ui_debug "activating directory: $dstfile"
             # Don't do anything if the directory already exists.
             if { ![file isdirectory $dstfile] } {
                 file mkdir $dstfile
-                # copy attributes, set mtime and atime
-                eval file attributes [list $dstfile] [file attributes $srcfile]
+                # fix attributes on the directory.
+                eval file attributes {$dstfile} [file attributes $srcfile]
+                # set mtime on installed element
                 file mtime $dstfile [file mtime $srcfile]
-                file atime $dstfile [file atime $srcfile]
             }
         }
-        case file {
+        default {
             ui_debug "activating file: $dstfile"
             # Try a hard link first and if that fails, a symlink
-            try {
-                file link -hard $dstfile $srcfile
-            } catch {*} {
-                ui_debug "hardlinking $srcfile to $dstfile failed; symlinking instead"
+            if {[catch {file link -hard $dstfile $srcfile}]} {
+                ui_debug "hardlinking $srcfile to $dstfile failed, symlinking instead"
                 file link -symbolic $dstfile $srcfile
             }
         }
-        default {
-            # don't activate e.g. a unix socket
-            ui_warning "skipped file $srcfile of unknown type [file type $srcfile]"
-        }
     }
 }
 
 ## Activates the contents of a port
-proc _activate_contents {port force} {
+proc _activate_contents {port {imagefiles {}} {imagedir {}}} {
+    variable force
+    variable use_reg2
     global macports::prefix
 
     set files [list]
-    set imagedir [$port imagedir]
-    set imagefiles [$port imagefiles]
-
-    # first, ensure all files exist in the image dir
-    foreach file $imagefiles {
-        set srcfile $imagedir$file
-        # To be able to install links, we test if we can lstat the file to
-        # figure out if the source file exists (file exists will return
-        # false for symlinks on files that do not exist)
-        try {
-            file lstat $srcfile dummystatvar
-        } catch {*} {
-            throw registry::image-error "Image error: Source file $srcfile does not appear to exist (cannot lstat it).  Unable to activate port [$port name]."
-        }
+    set baksuffix .mp_[clock seconds]
+    if {$use_reg2} {
+        set imagedir [$port location]
+        set imagefiles [$port imagefiles]
+    } else {
+        set name $port
     }
 
-    set baksuffix .mp_[clock seconds]
     set backups [list]
-
     # This is big and hairy and probably could be done better.
-
+    # First, we need to check the source file, make sure it exists
     # Then we remove the $imagedir from the path of the file in the contents
     #  list  and check to see if that file exists
     # Last, if the file exists, and belongs to another port, and force is set
     #  we remove the file from the file_map, take ownership of it, and
     #  clobber it
-    try {
-        registry::write {
-            foreach file $imagefiles {
-                set srcfile ${imagedir}${file}
+    if {$use_reg2} {
+        array set todeactivate {}
+        try {
+            registry::write {
+                foreach file $imagefiles {
+                    set srcfile "${imagedir}${file}"
 
-                set owner [registry::entry owner $file]
+                    # To be able to install links, we test if we can lstat the file to
+                    # figure out if the source file exists (file exists will return
+                    # false for symlinks on files that do not exist)
+                    if { [catch {file lstat $srcfile dummystatvar}] } {
+                        throw registry::image-error "Image error: Source file $srcfile does not appear to exist (cannot lstat it).  Unable to activate port [$port name]."
+                    }
 
-                if { [string is true $force] } {
-                    # if we're forcing the activation, then we move any existing
-                    # files to a backup file, both in the filesystem and in the
-                    # registry
-                    if { [file exists $file] } {
-                        ui_warn "File $file already exists.  Moving to: $bakfile."
-                        file rename -force $file $file$baksuffix
-                        lappend backups $file
+                    set owner [registry::entry owner $file]
+
+                    if {$owner != {} && $owner != $port} {
+                        # deactivate conflicting port if it is replaced_by this one
+                        set result [mportlookup [$owner name]]
+                        array unset portinfo
+                        array set portinfo [lindex $result 1]
+                        if {[info exists portinfo(replaced_by)] && [lsearch -exact -nocase $portinfo(replaced_by) [$port name]] != -1} {
+                            # we'll deactivate the owner later, but before activating our files
+                            set todeactivate($owner) yes
+                            set owner "replaced"
+                        }
                     }
-                    if { $owner != {} } {
-                        $owner deactivate [list $file]
-                        $owner activate [list $file] [list $file$baksuffix]
+
+                    if {$owner != "replaced"} {
+                        if { [string is true -strict $force] } {
+                            # if we're forcing the activation, then we move any existing
+                            # files to a backup file, both in the filesystem and in the
+                            # registry
+                            if { [file exists $file] } {
+                                set bakfile "${file}${baksuffix}"
+                                ui_warn "File $file already exists.  Moving to: $bakfile."
+                                file rename -force -- $file $bakfile
+                                lappend backups $file
+                            }
+                            if { $owner != {} } {
+                                $owner deactivate [list $file]
+                                $owner activate [list $file] [list "${file}${baksuffix}"]
+                            }
+                        } else {
+                            # if we're not forcing the activation, then we bail out if
+                            # we find any files that already exist, or have entries in
+                            # the registry
+                            if { $owner != {} && $owner != $port } {
+                                throw registry::image-error "Image error: $file is being used by the active [$owner name] port.  Please deactivate this port first, or use 'port -f activate [$port name]' to force the activation."
+                            } elseif { $owner == {} && [file exists $file] } {
+                                throw registry::image-error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port [$port name]. Use 'port -f activate [$port name]' to force the activation."
+                            }
+                        }
                     }
-                } else {
-                    # if we're not forcing the activation, then we bail out if
-                    # we find any files that already exist, or have entries in
-                    # the registry
-                    if { $owner != {} && $owner != $port } {
-                        throw registry::image-error "Image error: $file is being used by the active [$owner name] port.  Please deactivate this port first, or use the -f flag to force the activation."
-                    } elseif { $owner == {} && [file exists $file] } {
-                        throw registry::image-error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port [$owner name]."
+
+                    # Split out the filename's subpaths and add them to the
+                    # imagefile list.
+                    # We need directories first to make sure they will be there
+                    # before links. However, because file mkdir creates all parent
+                    # directories, we don't need to have them sorted from root to
+                    # subpaths. We do need, nevertheless, all sub paths to make sure
+                    # we'll set the directory attributes properly for all
+                    # directories.
+                    set directory [file dirname $file]
+                    while { [lsearch -exact $files $directory] == -1 } {
+                        lappend files $directory
+                        set directory [file dirname $directory]
                     }
+
+                    # Also add the filename to the imagefile list.
+                    lappend files $file
                 }
+            }
 
-                # Split out the filename's subpaths and add them to the
-                # imagefile list.
-                # We need directories first to make sure they will be there
-                # before links. However, because file mkdir creates all parent
-                # directories, we don't need to have them sorted from root to
-                # subpaths. We do need, nevertheless, all sub paths to make sure
-                # we'll set the directory attributes properly for all
-                # directories.
-                set directory [file dirname $file]
-                while { [lsearch -exact $files $directory] == -1 } {
-                    lappend files $directory
-                    set directory [file dirname $directory]
+            # deactivate ports replaced_by this one
+            foreach owner [array names todeactivate] {
+                if {![registry::run_target $owner deactivate [list ports_nodepcheck 1]]} {
+                    deactivate [$owner name] "" [list ports_nodepcheck 1]
                 }
-
-                # Also add the filename to the imagefile list.
-                lappend files $file
             }
 
             # Sort the list in forward order, removing duplicates.
@@ -354,63 +516,172 @@
             # debug output of activate make more sense.
             set theList [lsort -increasing -unique $files]
 
-            # Activate it, and catch errors so we can roll-back
-            try {
-                [$port activate $imagefiles]
-                foreach file $theList {
-                    _activate_file $imagedir$file $file
+            registry::write {
+                # Activate it, and catch errors so we can roll-back
+                try {
+                    $port activate $imagefiles
+                    foreach file $theList {
+                        _activate_file "${imagedir}${file}" $file
+                    }
+                } catch {*} {
+                    ui_debug "Activation failed, rolling back."
+                    # can't do it here since we're already inside a transaction
+                    set deactivate_this yes
+                    throw
                 }
-            } catch {*} {
-                ui_debug "Activation failed, rolling back."
-                _deactivate_contents $port yes
-                throw
             }
+        } catch {*} {
+            # roll back activation of this port
+            if {[info exists deactivate_this]} {
+                _deactivate_contents $port {} yes
+            }
+            # if any errors occurred, move backed-up files back to their original
+            # locations, then rethrow the error. Transaction rollback will take care
+            # of this in the registry.
+            foreach file $backups {
+                file rename -force -- "${file}${baksuffix}" $file
+            }
+            # reactivate deactivated ports
+            foreach entry [array names todeactivate] {
+                if {[$entry state] == "imaged" && ![registry::run_target $entry activate ""]} {
+                    set pvers "[$entry version]_[$entry revision][$entry variants]"
+                    activate [$entry name] $pvers ""
+                }
+            }
+            throw
         }
-    } catch {*} {
-        # if any errors occurred, move backed-up files back to their original
-        # locations, then rethrow the error. Transaction rollback will take care
-        # of this in the registry.
-        foreach file $backups {
-            file rename -force $file$baksuffix $file
+    } else {
+        # registry1.0
+        set deactivated [list]
+        foreach file $imagefiles {
+            set srcfile "${imagedir}${file}"
+
+            # To be able to install links, we test if we can lstat the file to
+            # figure out if the source file exists (file exists will return
+            # false for symlinks on files that do not exist)
+            if { [catch {file lstat $srcfile dummystatvar}] } {
+                return -code error "Image error: Source file $srcfile does not appear to exist (cannot lstat it).  Unable to activate port $name."
+            }
+
+            set port [registry::file_registered $file]
+            
+            if {$port != 0  && $port != $name} {
+                # deactivate conflicting port if it is replaced_by this one
+                if {[catch {mportlookup $port} result]} {
+                    global errorInfo
+                    ui_debug "$errorInfo"
+                    return -code error "port lookup failed: $result"
+                }
+                array unset portinfo
+                array set portinfo [lindex $result 1]
+                if {[info exists portinfo(replaced_by)] && [lsearch -exact -nocase $portinfo(replaced_by) $name] != -1} {
+                    lappend deactivated [lindex [registry::active $port] 0]
+                    deactivate $port "" ""
+                    set port 0
+                }
+            }
+    
+            if { $port != 0  && $force != 1 && $port != $name } {
+                return -code error "Image error: $file is being used by the active $port port.  Please deactivate this port first, or use 'port -f activate $name' to force the activation."
+            } elseif { [file exists $file] && $force != 1 } {
+                return -code error "Image error: $file already exists and does not belong to a registered port.  Unable to activate port $name. Use 'port -f activate $name' to force the activation."
+            } elseif { $force == 1 && [file exists $file] || $port != 0 } {
+                set bakfile "${file}${baksuffix}"
+
+                if {[file exists $file]} {
+                    ui_warn "File $file already exists.  Moving to: $bakfile."
+                    file rename -force -- $file $bakfile
+                    lappend backups $file
+                }
+
+                if { $port != 0 } {
+                    set bakport [registry::file_registered $file]
+                    registry::unregister_file $file
+                    if {[file exists $bakfile]} {
+                        registry::register_file $bakfile $bakport
+                    }
+                }
+            }
+
+            # Split out the filename's subpaths and add them to the imagefile list.
+            # We need directories first to make sure they will be there before
+            # links. However, because file mkdir creates all parent directories,
+            # we don't need to have them sorted from root to subpaths. We do need,
+            # nevertheless, all sub paths to make sure we'll set the directory
+            # attributes properly for all directories.
+            set directory [file dirname $file]
+            while { [lsearch -exact $files $directory] == -1 } { 
+                lappend files $directory
+                set directory [file dirname $directory]
+            }
+
+            # Also add the filename to the imagefile list.
+            lappend files $file
         }
-        throw
+        registry::write_file_map
+
+        # Sort the list in forward order, removing duplicates.
+        # Since the list is sorted in forward order, we're sure that directories
+        # are before their elements.
+        # We don't have to do this as mentioned above, but it makes the
+        # debug output of activate make more sense.
+        set theList [lsort -increasing -unique $files]
+
+        # Activate it, and catch errors so we can roll-back
+        if { [catch { foreach file $theList {
+                        _activate_file "${imagedir}${file}" $file
+                    }} result]} {
+            ui_debug "Activation failed, rolling back."
+            _deactivate_contents $name $imagefiles
+            # return backed up files to their old locations
+            foreach f $backups {
+                set bakfile "${f}${baksuffix}"
+                set bakport [registry::file_registered $bakfile]
+                if {$bakport != 0} {
+                    registry::unregister_file $bakfile
+                    registry::register_file $f $bakport
+                }
+                file rename -force -- $bakfile $file
+            }
+            # reactivate deactivated ports
+            foreach entry $deactivated {
+                set pname [lindex $entry 0]
+                set pvers "[lindex $entry 1]_[lindex $entry 2][lindex $entry 3]"
+                activate $pname $pvers ""
+            }
+            registry::write_file_map
+
+            return -code error $result
+        }
     }
 }
 
 proc _deactivate_file {dstfile} {
-    switch { [file type $dstfile] } {
-        case link {
-            ui_debug "deactivating link: $dstfile"
+    if { [file type $dstfile] == "link" } {
+        ui_debug "deactivating link: $dstfile"
+        file delete -- $dstfile
+    } elseif { [file isdirectory $dstfile] } {
+        # 0 item means empty.
+        if { [llength [readdir $dstfile]] == 0 } {
+            ui_debug "deactivating directory: $dstfile"
             file delete -- $dstfile
+        } else {
+            ui_debug "$dstfile is not empty"
         }
-        case directory {
-            # 0 item means empty.
-            if { [llength [readdir $dstfile]] == 0 } {
-                ui_debug "deactivating directory: $dstfile"
-                file delete -- $dstfile
-            } else {
-                ui_debug "$dstfile is not empty"
-            }
-        }
-        case file {
-            ui_debug "deactivating file: $dstfile"
-            file delete -- $dstfile
-        }
-        default {
-            # don't deactivate e.g. a unix socket
-            ui_warning "skipped file $dstfile of unknown type [file type $dstfile]"
-        }
+    } else {
+        ui_debug "deactivating file: $dstfile"
+        file delete -- $dstfile
     }
 }
 
-proc _deactivate_contents {port force} {
-
+proc _deactivate_contents {port imagefiles {force 0}} {
+    variable use_reg2
     set files [list]
+    if {$use_reg2} {
+        set imagefiles [$port files]
+    }
 
-    set realfiles [$port files]
-
-    foreach file $realfiles {
-        set owner [registry::entry owner $file]
+    foreach file $imagefiles {
         if { [file exists $file] || (![catch {file type $file}] && [file type $file] == "link") } {
             # Normalize the file path to avoid removing the intermediate
             # symlinks (remove the empty directories instead)
@@ -423,10 +694,11 @@
             set theFile [file normalize $file]
             lappend files $theFile
 
-            # Split out the filename's subpaths and add them to the image list
-            # as well.
-            set directory [file dirname $theFile]
-            while { [lsearch -exact $files $directory] == -1 } {
+            # Split out the filename's subpaths and add them to the image list as
+            # well. The realpath call is necessary because file normalize
+            # does not resolve symlinks on OS X < 10.6
+            set directory [realpath [file dirname $theFile]]
+            while { [lsearch -exact $files $directory] == -1 } { 
                 lappend files $directory
                 set directory [file dirname $directory]
             }
@@ -440,9 +712,15 @@
     # are after their elements.
     set theList [lsort -decreasing -unique $files]
 
-    registry::write {
-        # Remove all elements.
-        $port deactivate $realfiles
+    # Remove all elements.
+    if {$use_reg2} {
+        registry::write {
+            $port deactivate $imagefiles
+            foreach file $theList {
+                _deactivate_file $file
+            }
+        }
+    } else {
         foreach file $theList {
             _deactivate_file $file
         }


Property changes on: branches/new-help-system/base/src/registry2.0/portimage.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/registry2.0/portuninstall.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/portuninstall.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,4 +1,4 @@
-# et:ts=4
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # portuninstall.tcl
 # $Id$
 #
@@ -16,7 +16,7 @@
 # 3. Neither the name of Apple Inc. nor the names of its contributors
 #    may be used to endorse or promote products derived from this software
 #    without specific prior written permission.
-# 
+#
 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,109 +30,267 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-package provide portuninstall 2.0
+package provide registry_uninstall 2.0
 
+package require registry 1.0
 package require registry2 2.0
 package require registry_util 2.0
 
 set UI_PREFIX "---> "
 
-namespace eval portuninstall {
+namespace eval registry_uninstall {
 
-proc uninstall {portname {specifier ""} optionslist} {
-	global uninstall.force uninstall.nochecksum UI_PREFIX
-	array set options $optionslist
+proc uninstall {portname {v ""} optionslist} {
+    global uninstall.force uninstall.nochecksum UI_PREFIX \
+           macports::registry.format macports::registry.installtype
+    array set options $optionslist
 
-	if {[info exists options(ports_force)] && [string is true $options(ports_force)] } {
-        set force 1
-    } else {
-        set force 0
+    if {![info exists uninstall.force]} {
+        set uninstall.force no
     }
+    # If global forcing is on, make it the same as a local force flag.
+    if {[info exists options(ports_force)] && [string is true -strict $options(ports_force)]} {
+        set uninstall.force yes
+    }
+    # check which registry API to use
+    set use_reg2 [string equal ${macports::registry.format} "receipt_sqlite"]
 
-    if { [registry::decode_spec $specifier version revision variants] } {
-        set ilist [registry::entry imaged $portname $version $revision $variants]
+    if {$use_reg2} {
+        if { [registry::decode_spec $v version revision variants] } {
+            set ilist [registry::entry imaged $portname $version $revision $variants]
+            set valid 1
+        } else {
+            set valid [string equal $v {}]
+            set ilist [registry::entry imaged $portname]
+        }
+    } else {
+        set ilist [registry::installed $portname $v]
         set valid 1
-    } else {
-        set valid [string equal $specifier {}]
-        set ilist [registry::entry imaged $portname]
     }
-
-	if { [llength $ilist] > 1 } {
-		ui_msg "$UI_PREFIX [format [msgcat::mc "The following versions of %s are currently installed:"] $portname]"
-		foreach i $ilist { 
-			set iname [lindex $i 0]
-			set iactive [lindex $i 4]
-            set ispec "[$i version]_[$i revision][$i variants]"
-			if { [string equal [$i state] installed] } {
-				ui_msg "$UI_PREFIX [format [msgcat::mc "	%s @%s (active)"] $iname $ispec]"
-			} elseif { $iactive == 1 } {
-				ui_msg "$UI_PREFIX [format [msgcat::mc "	%s @%s"] $iname $ispec]"
-			}
-		}
+    if { [llength $ilist] > 1 } {
+        # set portname again since the one we were passed may not have had the correct case
+        if {$use_reg2} {
+            set portname [[lindex $ilist 0] name]
+        } else {
+            set portname [lindex [lindex $ilist 0] 0]
+        }
+        ui_msg "$UI_PREFIX [msgcat::mc "The following versions of $portname are currently installed:"]"
+        foreach i [portlist_sortint $ilist] {
+            if {$use_reg2} {
+                set ispec "[$i version]_[$i revision][$i variants]"
+                if { [string equal [$i state] installed] } {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s (active)"] [$i name] $ispec]"
+                } else {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s"] [$i name] $ispec]"
+                }
+            } else {
+                set iname [lindex $i 0]
+                set iversion [lindex $i 1]
+                set irevision [lindex $i 2]
+                set ivariants [lindex $i 3]
+                set iactive [lindex $i 4]
+                if { $iactive == 1 } {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s (active)"] $iname $iversion $irevision $ivariants]"
+                } else {
+                    ui_msg "$UI_PREFIX [format [msgcat::mc "    %s @%s_%s%s"] $iname $iversion $irevision $ivariants]"
+                }
+            }
+        }
         if { $valid } {
             throw registry::invalid "Registry error: Please specify the full version as recorded in the port registry."
         } else {
             throw registry::invalid "Registry error: Invalid version specified. Please specify a version as recorded in the port registry."
         }
-	} elseif { [llength $ilist] == 1 } {
-        set port [lindex $ilist 0]
-	} else {
+    } elseif { [llength $ilist] == 1 } {
+        if {$use_reg2} {
+            set port [lindex $ilist 0]
+            if {$v == ""} {
+                set v "[$port version]_[$port revision][$port variants]"
+            }
+        } else {
+            set version [lindex [lindex $ilist 0] 1]
+            set revision [lindex [lindex $ilist 0] 2]
+            set variants [lindex [lindex $ilist 0] 3]
+            set active [lindex [lindex $ilist 0] 4]
+            if {$v == ""} {
+                set v "${version}_${revision}${variants}"
+            }
+        }
+    } else {
         throw registry::invalid "Registry error: $portname not registered as installed"
     }
 
-    if { [string equal [$port installtype] direct] } {
-        # if port is installed directly, check its dependents
-        registry::check_dependents $port $force
-    } else {
-        # if it's an image, deactivate it (and check dependents there)
+    if {$use_reg2} {
+        # uninstall dependents if requested
+        if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} {
+            foreach depport [$port dependents] {
+                # make sure it's still installed, since a previous dep uninstall may have removed it
+                if {[registry::entry exists $depport] && ([$depport state] == "imaged" || [$depport state] == "installed")} {
+                    set depname [$depport name]
+                    set depver "[$depport version]_[$depport revision][$depport variants]"
+                    registry_uninstall::uninstall $depname $depver [array get options]
+                }
+            }
+        } else {
+            # check its dependents
+            registry::check_dependents $port ${uninstall.force}
+        }
+        # if it's an image, deactivate it
         if { [string equal [$port state] installed] } {
-            portimage::deactivate $portname ${version}_${revision}${variants} $optionslist
+            if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+                ui_msg "For $portname @${v}: skipping deactivate (dry run)"
+            } else {
+                portimage::deactivate $portname $v $optionslist
+            }
         }
-	}
+    } else {
+        # registry1.0
+        
+        # determine if it's the only installed port with that name or not.
+        if {$v == ""} {
+            set nb_versions_installed 1
+        } else {
+            set ilist [registry::installed $portname ""]
+            set nb_versions_installed [llength $ilist]
+        }
+    
+        set ref [registry::open_entry $portname $version $revision $variants]
+    
+        # Check and make sure no ports depend on this one
+        registry::open_dep_map  
+        set deplist [registry::list_dependents $portname $version $revision $variants]
+        if { [llength $deplist] > 0 } {
+            set dl [list]
+            # Check the deps first
+            foreach dep $deplist { 
+                set depport [lindex $dep 2]
+                ui_debug "$depport depends on this port"
+                if {[registry::entry_exists_for_name $depport]} {
+                    lappend dl $depport
+                }
+            }
+            # Now see if we need to error
+            if { [llength $dl] > 0 } {
+                if {[info exists options(ports_uninstall_follow-dependents)] && $options(ports_uninstall_follow-dependents) eq "yes"} {
+                    foreach depport $dl {
+                        # make sure it's still installed, since a previous dep uninstall may have removed it
+                        if {[registry::entry_exists_for_name $depport]} {
+                            registry_uninstall::uninstall $depport "" [array get options]
+                        }
+                    }
+                } else {
+                    # will need to change this when we get version/variant dependencies
+                    if {$nb_versions_installed == 1 || $active == 1} {
+                        ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall %s %s_%s%s, the following ports depend on it:"] $portname $version $revision $variants]"
+                        foreach depport $dl {
+                            ui_msg "$UI_PREFIX [format [msgcat::mc "    %s"] $depport]"
+                        }
+                        if { [string is true -strict ${uninstall.force}] } {
+                            ui_warn "Uninstall forced.  Proceeding despite dependencies."
+                        } else {
+                            return -code error "Please uninstall the ports that depend on $portname first."
+                        }
+                    }
+                }
+            }
+        }
+    
+        set installtype [registry::property_retrieve $ref installtype]
+        if { $installtype == "image" && [registry::property_retrieve $ref active] == 1} {
+            if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+                ui_msg "For $portname @${version}_${revision}${variants}: skipping deactivate (dry run)"
+            } else {
+                portimage::deactivate $portname ${version}_${revision}${variants} $optionslist
+            }
+        }
+    }
 
-	ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s_%s%s"] $portname $version $revision $variants]"
+    if {[info exists options(ports_dryrun)] && [string is true -strict $options(ports_dryrun)]} {
+        ui_msg "For $portname @${v}: skipping uninstall (dry run)"
+        return 0
+    }
 
-    # pkg_uninstall isn't used anywhere as far as I can tell and I intend to add
-    # some proper pre-/post- hooks to uninstall/deactivate.
+    ui_msg "$UI_PREFIX [format [msgcat::mc "Uninstalling %s @%s"] $portname $v]"
 
-	# Look to see if the port has registered an uninstall procedure
-	#set uninstall [registry::property_retrieve $ref pkg_uninstall] 
-	#if { $uninstall != 0 } {
-	#	if {![catch {eval $uninstall} err]} {
-	#		pkg_uninstall $portname ${version}_${revision}${variants}
-	#	} else {
-	#		global errorInfo
-	#		ui_debug "$errorInfo"
-	#		ui_error [format [msgcat::mc "Could not evaluate pkg_uninstall procedure: %s"] $err]
-	#	}
-	#}
+    if {!$use_reg2} {
+        # Look to see if the port has registered an uninstall procedure
+        set uninstall [registry::property_retrieve $ref pkg_uninstall] 
+        if { $uninstall != 0 } {
+            if {![catch {eval [string map { \\n \n } $uninstall]} err]} {
+                ui_info "Executing pkg_uninstall procedure"
+                if {[catch {pkg_uninstall $portname "${version}_${revision}${variants}" } err]} {
+                    ui_error [format [msgcat::mc "Error executing pkg_uninstall procedure: %s"] $err]
+                }
+            } else {
+                global errorInfo
+                ui_debug "$errorInfo"
+                ui_error [format [msgcat::mc "Could not evaluate pkg_uninstall procedure: %s"] $err]
+            }
+        }
+    
+        # Remove the port from the dep_map if only one version was installed.
+        # This is a temporary fix for a deeper problem that is that the dependency
+        # map doesn't take the port version into account (but should).
+        # Fixing it means transitionning to a new dependency map format.
+        if {$nb_versions_installed == 1} {
+            registry::unregister_dependencies $portname
+        }
+    }
 
-	set contents [$port files]
-
-    set bak_suffix .mp_[time seconds]
-    set uninst_err 0
+    # Now look for a contents list
+    if {$use_reg2} {
+        # imagefiles gives the actual installed files in direct mode
+        set contents [$port imagefiles]
+        set imagedir [$port location]
+    } else {
+        set contents [registry::property_retrieve $ref contents]
+        if { $contents == "" } {
+            return -code error [msgcat::mc "Uninstall failed: Port has no contents entry"]
+        }
+    }
+    set bak_suffix ".mp_[clock seconds]"
     set files [list]
-    foreach file $contents {
-        if { !([info exists uninstall.nochecksum]
-                && [string is true $uninstall.nochecksum]) } {
-            set sum1 [$port md5sum $file]
-            if {![catch {set sum2 [md5 $file]}] && ![string match $sum1 $sum2]} {
-                ui_info "$UI_PREFIX  [format [msgcat::mc "Original checksum does not match for %s, saving a copy to %s"] $file $file$bak_suffix]"
-                file copy $file $file$bak_suffix
+    foreach f $contents {
+        if {$use_reg2} {
+            set fname "${imagedir}${f}"
+            #set sum1 [$port md5sum $f]
+            # there's an md5 column in registry.files in the db, but
+            # no way to get or set it seems to be implemented
+            set sum1 NONE
+        } else {
+            set fname [lindex $f 0]
+            set md5index [lsearch -regex [lrange $f 1 end] MD5]
+            if {$md5index != -1} {
+                set sumx [lindex $f [expr $md5index + 1]]
+            } else {
+                # XXX There is no MD5 listed, set sumx to an
+                # empty list, causing the next conditional to
+                # return a checksum error
+                set sumx {}
             }
+            set sum1 [lindex $sumx [expr [llength $sumx] - 1]]
         }
+        if {![string match $sum1 NONE] && !([info exists uninstall.nochecksum] && [string is true -strict ${uninstall.nochecksum}]) } {
+            if {![catch {set sum2 [md5 $fname]}] && ![string match $sum1 $sum2]} {
+                ui_warn "$UI_PREFIX  [format [msgcat::mc "Original checksum does not match for %s, saving a copy to %s"] $fname ${fname}${bak_suffix}]"
+                catch {file copy $fname "${fname}${bak_suffix}"}
+            }
+        }
+        
+        set theFile [file normalize $fname]
+        if { [file exists $theFile] || (![catch {file type $theFile}] && [file type $theFile] == "link") } {
+            # Normalize the file path to avoid removing the intermediate
+            # symlinks (remove the empty directories instead)
+            lappend files $theFile
 
-        # Normalize the file path to avoid removing the intermediate
-        # symlinks (remove the empty directories instead)
-        set theFile [file normalize $file]
-        lappend files $theFile
-
-        # Split out the filename's subpaths and add them to the
-        # list as well.
-        set directory [file dirname $theFile]
-        while { [lsearch -exact $files $directory] == -1 } { 
-            lappend files $directory
-            set directory [file dirname $directory]
+            # Split out the filename's subpaths and add them to the
+            # list as well. The realpath call is necessary because file normalize
+            # does not resolve symlinks on OS X < 10.6
+            set directory [realpath [file dirname $theFile]]
+            while { [lsearch -exact $files $directory] == -1 } { 
+                lappend files $directory
+                set directory [file dirname $directory]
+            }
         }
     }
 
@@ -142,49 +300,44 @@
     set theList [lsort -decreasing -unique $files]
 
     # Remove all elements.
-    foreach file $theList {
-        _uninstall_file $file
+    _uninstall_list $theList
+
+    if {$use_reg2} {
+        registry::entry delete $port
+    } else {
+        ui_info "$UI_PREFIX [format [msgcat::mc "Uninstall is removing %s from the port registry."] $portname]"
+        registry::delete_entry $ref
     }
-
-    ui_info "$UI_PREFIX [format [msgcat::mc "Uninstall is removing %s from the port registry."] $portname]"
-    registry::entry delete $port
     return 0
 }
 
 proc _uninstall_file {dstfile} {
-	if { ![catch {set type [file type $dstfile]}] } {
-        switch {$type} {
-            case link {
-                ui_debug "uninstalling link: $dstfile"
+    if { ![catch {set type [file type $dstfile]}] } {
+        if { $type == "link" } {
+            ui_debug "uninstalling link: $dstfile"
+            file delete -- $dstfile
+        } elseif { [file isdirectory $dstfile] } {
+            # 0 item means empty.
+            if { [llength [readdir $dstfile]] == 0 } {
+                ui_debug "uninstalling directory: $dstfile"
                 file delete -- $dstfile
+            } else {
+                ui_debug "$dstfile is not empty"
             }
-            case directory {
-                # 0 item means empty.
-                if { [llength [readdir $dstfile]] == 0 } {
-                    ui_debug "uninstalling directory: $dstfile"
-                    file delete -- $dstfile
-                } else {
-                    ui_debug "$dstfile is not empty"
-                }
-            }
-            case file {
-                ui_debug "uninstalling file: $dstfile"
-                file delete -- $dstfile
-            }
-            default {
-                ui_debug "skip file of unknown type $type: $dstfile"
-            }
+        } else {
+            ui_debug "uninstalling file: $dstfile"
+            file delete -- $dstfile
         }
-	} else {
-		ui_debug "skip missing file: $dstfile"
-	}
+    } else {
+        ui_debug "skip missing file: $dstfile"
+    }
 }
 
 proc _uninstall_list {filelist} {
-	foreach file $filelist {
-		_uninstall_file $file
-	}
+    foreach file $filelist {
+        _uninstall_file $file
+    }
 }
 
-# End of portuninstall namespace
+# End of registry_uninstall namespace
 }


Property changes on: branches/new-help-system/base/src/registry2.0/portuninstall.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Copied: branches/new-help-system/base/src/registry2.0/receipt_flat.tcl (from rev 65586, trunk/base/src/registry2.0/receipt_flat.tcl)
===================================================================
--- branches/new-help-system/base/src/registry2.0/receipt_flat.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/receipt_flat.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,864 @@
+# receipt_flat.tcl
+# $Id$
+#
+# Copyright (c) 2004 Will Barton <wbb4 at opendarwin.org>
+# Copyright (c) 2004 Paul Guyot, The MacPorts Project.
+# Copyright (c) 2002 Apple Computer, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide receipt_flat 1.0
+
+package require macports 1.0
+package require Pextlib 1.0
+
+##
+# Receipts Code supporting flat-files
+##
+namespace eval receipt_flat {
+
+# receipt_lastref is the last attributed index of receipts.
+variable receipt_lastref -1
+# maps port name,version,variants to the corresponding receipt ref
+variable ref_index
+
+##
+#
+# Create a new entry and return its reference number.
+# The reference number allows us to retrieve the receipt array.
+proc new_entry {} {
+	variable receipt_lastref
+	incr receipt_lastref
+
+	variable receipt_$receipt_lastref
+	array set receipt_$receipt_lastref {}
+
+	return $receipt_lastref
+}
+
+##
+#
+# Get the path to the receipt in HEAD format.
+# Remark: this code doesn't work for some ports.
+# That's why we moved to the new path format in the first place.
+#
+# portname			the name of the port.
+# portversion		the version for this port, 0 if unknown.
+# return the path to the file or "" if the file couldn't be found.
+proc get_head_entry_receipt_path {portname portversion} {
+    global macports::registry.path
+
+    # regex match case
+    if {$portversion == 0} {
+	set x [glob -nocomplain -directory [file join ${macports::registry.path} receipts] -- ${portname}-*]
+	if {[string length $x]} {
+	    set matchfile [lindex $x 0]
+		# Remove trailing .bz2, if any.
+		regexp {(.*)\.bz2$} $matchfile match matchfile
+	} else {
+	    set matchfile ""
+	}
+    } else {
+	set matchfile [file join ${macports::registry.path} receipts ${portname}-${portversion}]
+    }
+
+    # Might as well bail out early if no file to match
+    if {![string length $matchfile]} {
+		return ""
+    }
+
+    if {[file exists $matchfile] || [file exists ${matchfile}.bz2]} {
+		return $matchfile
+    }
+    return ""
+}
+
+##
+#
+# Open an existing entry and return its reference number.
+proc open_entry {name {version ""} {revision 0} {variants ""} {epoch ""}} {
+	global macports::registry.installtype
+	global macports::registry.path
+	variable ref_index
+	
+	# if this entry is already open, just return the reference
+	if {[info exists ref_index($name,$version,$revision,$variants)]} {
+	    return $ref_index($name,$version,$revision,$variants)
+	}
+
+	set receipt_path [file join ${macports::registry.path} receipts ${name}]
+
+	# If the receipt path ${name} doesn't exist, then the receipt probably is
+	# in the old HEAD format.
+	if { ![file isdirectory $receipt_path] } {
+		set receipt_file [get_head_entry_receipt_path $name $version]
+		
+		if {![string length $receipt_file]} {
+			if { $version != "" } {
+				return -code error "Registry error: ${name} @${version}_${revision}${variants} not registered as installed."
+			} else {
+				return -code error "Registry error: ${name} not registered as installed."
+			}
+		}
+		
+		# Extract the version from the path.
+		if { $version == "" } {
+			set theFileName [file tail $receipt_file]
+			regexp "^$name-(.*)\$" $theFileName match version
+		}
+	} else {
+		# If version wasn't specified, find out the version number.  This will
+		# depend on which installtype mode we're in, "direct" or "image"	
+		if { $version == "" } {
+			# xxx: If we're in image mode, we really should have had the 
+			# version given to us.  How should we handle this?
+			set x [glob -nocomplain -directory ${receipt_path} *]
+			if { [string length $x] } {
+				set v [lindex [file split [lindex $x 0]] end]
+				regexp {([-_a-zA-Z0-9\.]+)_([0-9]*)([+-_a-zA-Z0-9]*)$} $v match version revision variants
+			} else {
+				return -code error "Registry error: ${name} not registered as installed."
+			}
+		}
+	
+		if { ![entry_exists $name $version $revision $variants] } {
+			return -code error "Registry error: ${name} @${version}_${revision}${variants} not registered as installed."
+		}
+	
+		set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+	
+		set receipt_file [file join ${receipt_path} receipt]
+	}
+
+	if { [file exists ${receipt_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+		set receipt_file ${receipt_file}.bz2
+		set receipt_contents [exec ${registry::autoconf::bzip2_path} -d -c ${receipt_file}]
+	} elseif { [file exists ${receipt_file}] } {
+		set receipt_handle [open ${receipt_file} r]
+		set receipt_contents [read $receipt_handle]
+		close $receipt_handle
+	} else {
+		return -code error "Registry error: receipt for ${name} @${version}_${revision}${variants} seems to be compressed, but bzip2 couldn't be found."
+	}
+
+	set ref [new_entry]
+	variable receipt_$ref
+
+	# Determine the format of the receipt.
+	if {[string match "# Format: var value ...*" $receipt_contents]} {
+		# This is old HEAD format.
+		# We convert it and we save it.
+		# tell the user
+		ui_msg "Converting receipt for $name-$version to new format"
+
+		convert_entry_from_HEAD $name $version $revision $variants $receipt_contents $ref
+		
+		# move the old receipt
+		set convertedDirPath [file join ${macports::registry.path} receipts_converted]
+		file mkdir $convertedDirPath
+		file rename -- $receipt_file $convertedDirPath
+	} elseif {[string match "# Version: *" $receipt_contents]} {
+		# This is new format
+		if {![string match "# Version: 1.0*" $receipt_contents]} {
+			return -code error "Registry error: receipt ${name} @${version}_${revision}${variants} is in an unknown format (version too new?)."
+		}
+
+		# Remove any line starting with #
+		while {[regexp "(^|\n)#.*\n(.*)\$" $receipt_contents match foo receipt_contents]} {}
+		if {[catch {array set receipt_$ref $receipt_contents} rcpterr]} {
+			ui_error "Malformed receipt for ${name} @${version}_${revision}${variants}"
+			ui_error "receipt_contents = '$receipt_contents'"
+			error $rcpterr
+		}
+	} else {
+		# This is old Images format
+
+		# Iterate on the elements of $receipt_contents and add them to the list.
+		foreach pair $receipt_contents {
+			array set receipt_[set ref] $pair
+		}
+	}
+	
+	set ref_index($name,$version,$revision,$variants) $ref
+	
+	return $ref
+}
+
+##
+#
+# Convert an entry from HEAD old format.
+# HEAD old format is a file in the key,value format with key and values being on the
+# same line separated with a space.
+# This typically is read with an options-like approach.
+# This conversion routine also appends the contents to the file map.
+#
+# name				the name of the port to convert.
+# version			the version of the port to convert.
+# revision			the revision of the port to convert (probably inaccurate).
+# variants			the variants of the port to convert (idem).
+# receipt_contents	the content of the old receipt file.
+# ref				reference of the target receipt array where the content must be put.
+proc convert_entry_from_HEAD {name version revision variants receipt_contents ref} {
+	variable receipt_$ref
+	
+	# First set default value for stuff that aren't in the receipt.
+	array set receipt_[set ref] [list name $name]
+	array set receipt_[set ref] [list version $version]
+	array set receipt_[set ref] [list revision $revision]
+	array set receipt_[set ref] [list variants $variants]
+	array set receipt_[set ref] [list installtype direct]
+	array set receipt_[set ref] [list receipt_f receipt_flat]
+	array set receipt_[set ref] [list active 1]
+	
+	# Then start a new interpreter to read the content of the portfile.
+	interp create theConverterInterpreter
+	# Just ignore prefix.
+	interp eval theConverterInterpreter "proc prefix {args} {\n\
+	}"
+	# Also ignore run_depends.
+	interp eval theConverterInterpreter "proc run_depends {args} {\n\
+	}"
+	interp eval theConverterInterpreter "proc categories {args} {\n\
+		global theConvertedReceipt\n\
+		array set theConvertedReceipt \[list categories \$args\]\n\
+	}"
+	interp eval theConverterInterpreter "proc description {args} {\n\
+		global theConvertedReceipt\n\
+		array set theConvertedReceipt \[list description \$args\]\n\
+	}"
+	interp eval theConverterInterpreter "proc long_description {args} {\
+		global theConvertedReceipt\n\
+		array set theConvertedReceipt \[list long_description \$args\]\n\
+	}"
+	interp eval theConverterInterpreter "proc homepage {args} {\n\
+		global theConvertedReceipt\n\
+		array set theConvertedReceipt \[list homepage \$args\]\n\
+	}"
+	# contents already is a list.
+	interp eval theConverterInterpreter "proc contents {args} {\n\
+		variable contents\n\
+		set contents \[lindex \$args 0\]\n\
+	}"
+	interp eval theConverterInterpreter "array set theConvertedReceipt {}"
+	interp eval theConverterInterpreter "variable contents"
+	interp eval theConverterInterpreter $receipt_contents
+	array set receipt_$ref [interp eval theConverterInterpreter "array get theConvertedReceipt"]
+	set contents [interp eval theConverterInterpreter "set contents"]
+	interp delete theConverterInterpreter
+
+	# Append the contents list to the file map (only the files).
+	set theActualContents [list]
+	foreach file $contents {
+		if {[llength $file]} {
+			set theFilePath [lindex $file 0]
+			if {[file isfile $theFilePath]} {
+				set previousPort [file_registered $theFilePath]
+				if {$previousPort != 0} {
+					ui_warn "Conflict detected for file $theFilePath between $previousPort and $name."
+				}
+				if {[catch {register_file $theFilePath $name}]} {
+					ui_warn "An error occurred while adding $theFilePath to the file_map database."
+				}
+			} elseif {![file exists $theFilePath]} {
+				ui_warn "Port $name refers to $theFilePath which doesn't exist."
+			}
+			lappend theActualContents $file
+		} else {
+			ui_warn "Port $name contents list includes an empty element."
+		}
+	}
+	
+	property_store $ref contents $theActualContents
+
+	# Save the file_map afterwards
+	write_file_map
+	close_file_map
+	
+	# Save the entry to new format.
+	write_entry $ref $name $version $revision $variants
+}
+
+##
+#
+# Write the entry that was previously created.
+#
+# ref				the reference number of the entry.
+# name				the name of the port.
+# version			the version of the port.
+# variants			the variants of the port.
+proc write_entry {ref name version {revision 0} {variants ""}} {
+	global macports::registry.installtype
+	variable receipt_$ref
+
+	set receipt_contents [array get receipt_$ref]
+
+	set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+	set receipt_file [file join ${receipt_path} receipt]
+
+	if { ![file isdirectory ${receipt_path}] } {
+		file mkdir ${receipt_path}
+	}
+
+	set receipt_handle [open ${receipt_file}.tmp w 0644]
+	puts $receipt_handle "# Version: 1.0"
+	puts $receipt_handle $receipt_contents
+	close $receipt_handle
+
+	if { [file exists ${receipt_file}] } {
+		file delete -force -- "${receipt_file}"
+	} elseif { [file exists ${receipt_file}.bz2] } {
+		file delete -force -- "${receipt_file}.bz2"
+	}
+
+	file rename -force -- "${receipt_file}.tmp" "${receipt_file}"
+
+	if { [file exists ${receipt_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
+		system "${registry::autoconf::bzip2_path} -f ${receipt_file}"
+	}
+
+	return 1
+}
+
+# Check to see if an entry exists
+proc entry_exists {name version {revision 0} {variants ""}} {
+	global macports::registry.path
+
+	set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+	set receipt_file [file join ${receipt_path} receipt]
+
+	if { [file exists $receipt_file] } {
+		return 1
+	} elseif { [file exists ${receipt_file}.bz2] } {
+		return 1
+	}
+
+	return 0
+}
+
+# Check to see if any entry exists for the given port name
+proc entry_exists_for_name {name} {
+	global macports::registry.path
+
+	set receipt_path [file join ${macports::registry.path} receipts ${name}]
+
+	if {[llength [glob -nocomplain -directory $receipt_path */receipt{,.bz2}]] > 0} {
+		return 1
+	}
+
+	return 0
+}
+
+##
+#
+# Store a property to a receipt that was loaded in memory.
+# This replaces any property that had the same key previously in the receipt.
+#
+# ref			reference number for the receipt.
+# property		key for the property to store.
+# value			value for the property to store.
+proc property_store {ref property value} {
+	variable receipt_$ref
+	
+	array set receipt_[set ref] [list $property $value]
+
+	return 1
+}
+
+##
+#
+# Retrieve a property from a receipt that was loaded in memory.
+#
+# ref			reference number for the receipt.
+# property		key for the property to retrieve.
+#
+proc property_retrieve {ref property} {
+	variable receipt_$ref
+
+	set theCouple [array get receipt_[set ref] $property]
+	if {[llength $theCouple] != 2} {
+		return 0
+	} else {
+		return [lindex $theCouple 1]
+	}
+}
+
+# Delete an entry
+proc delete_entry {name version {revision 0} {variants ""}} {
+	global macports::registry.path
+	variable ref_index
+	
+	# if the entry is loaded, purge it
+	if {[info exists ref_index($name,$version,$revision,$variants)]} {
+	    set ref $ref_index($name,$version,$revision,$variants)
+	    variable receipt_${ref}
+	    array unset receipt_${ref}
+	    array unset ref_index "$name,$version,$revision,$variants"
+	}
+
+	set receipt_path [file join ${macports::registry.path} receipts ${name} ${version}_${revision}${variants}]
+	if { [file exists ${receipt_path}] } {
+		# remove port receipt directory
+		ui_debug "deleting directory: ${receipt_path}"
+		file delete -force -- ${receipt_path}
+		# remove port receipt parent directory (if empty)
+		set receipt_dir [file join ${macports::registry.path} receipts ${name}]
+		if { [file isdirectory ${receipt_dir}] } {
+			# 0 item means empty.
+			if { [llength [readdir ${receipt_dir}]] == 0 } {
+				ui_debug "deleting directory: ${receipt_dir}"
+				file delete -force -- ${receipt_dir}
+			} else {
+				ui_debug "${receipt_dir} is not empty"
+			}
+		}
+		return 1
+	} else {
+		return 0
+	}
+}
+
+# Return all installed ports
+#
+# If version is "", return all ports of that version.
+# Otherwise, return only ports that exactly match this version.
+# What we call version here is version_revision+variants.
+# Note: at some point we need to change these APIs and support something
+# like selecting on the version or selecting variants in any order.
+proc installed {{name ""} {version ""}} {
+	global macports::registry.path
+
+	set query_path [file join ${macports::registry.path} receipts]
+	
+	if { $name == "" } {
+		set query_path [file join ${query_path} *]
+		if { $version == "" } {
+			set query_path [file join ${query_path} *]
+		}
+		# [PG] Huh?
+	} else {
+	    # We want to be case-insensitive but case-preserving, so the name gets
+	    # returned with the correct case even if it's wrong when given. To get the
+	    # correct case on a case-insensitive FS, we have to list the directory and
+	    # compare against each entry.
+	    set name_path [file join ${query_path} *]
+	    set name_entries [glob -nocomplain -types d ${name_path}]
+	    foreach entry $name_entries {
+	        set basename [file tail $entry]
+	        if {[string equal -nocase $basename $name]} {
+	            set name $basename
+	            break
+	        }
+	    }
+		set query_path [file join ${query_path} ${name}]
+		if { $version != "" } {
+			set query_path [file join ${query_path} ${version}]
+		} else {
+			set query_path [file join ${query_path} *]
+		}
+	}
+
+	set x [glob -nocomplain -types d ${query_path}]
+	set rlist [list]
+	foreach p $x {
+		if {![file isfile [file join $p receipt.bz2]] && ![file isfile [file join $p receipt]]} {
+			continue
+		}
+		set plist [list]
+		regexp {([-_a-zA-Z0-9\.]+)_([0-9]*)([+-_a-zA-Z0-9]*)$} [lindex [file split $p] end] match version revision variants
+		lappend plist [lindex [file split $p] end-1]
+		lappend plist $version
+		lappend plist $revision
+		lappend plist $variants
+		lappend rlist $plist
+	}
+
+	# append the ports in old HEAD format.
+	if { $name == "" } {
+		set query_path [file join ${macports::registry.path} receipts *]
+	} else {
+		set query_path [file join ${macports::registry.path} receipts ${name}-*]
+	}
+    set receiptglob [glob -nocomplain -types f ${query_path}]
+    foreach receipt_file $receiptglob {
+		set theFileName [file tail $receipt_file]
+
+    	# Remark: these regexes do not always work.
+   		set theName ""
+    	if { $name == "" } {
+			regexp {^(.*)-(.*)$} $theFileName match theName version
+    	} else {
+			regexp "^($name)-(.*)\$" $theFileName match theName version
+		}
+		
+		# Skip if the name is empty, i.e. if it didn't match.
+		if {[string length $theName]} {
+			set plist [list]
+			lappend plist $theName
+			
+			# Remove .bz2 suffix, if present.
+			regexp {^(.*)\.bz2$} $version match version
+			lappend plist $version
+			lappend plist 0
+			lappend plist ""
+			lappend rlist $plist
+		}
+	}
+
+	return $rlist
+}
+
+# File Map stuff
+
+##
+# open the file map and store a reference to it into variable file_map.
+# convert from the old format if required.
+#
+proc open_file_map {{readonly 0}} {
+	global macports::registry.path
+	variable file_map
+
+	set receipt_path [file join ${macports::registry.path} receipts]
+	set map_file [file join ${receipt_path} file_map]
+
+	# Don't reopen it (it actually would deadlock us), unless it was open r/o.
+	# and we want it r/w.
+	if { [info exists file_map] } {
+		if { $readonly == 0 } {
+			if {[filemap isreadonly file_map]} {
+				filemap close file_map
+				filemap open file_map ${map_file}.db
+			}
+		}
+		return 0
+	}
+
+	set old_filemap [list]
+
+	if { ![file exists ${map_file}.db] } {
+		# Convert to new format
+		if { [file exists ${map_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+			set old_filemap [exec ${registry::autoconf::bzip2_path} -d -c ${map_file}.bz2]
+		} elseif { [file exists $map_file] } {		
+			set map_handle [open ${map_file} r]
+			set old_filemap [read $map_handle]
+			close $map_handle
+		}
+	}
+
+	if { [llength $old_filemap] > 0 } {
+		# Translate from old format.
+		# Open the map (new format)
+		filemap open file_map ${map_file}.db
+		
+		# Tell the user.
+		ui_msg "Converting file map to new format (this may take a while)"
+
+		foreach f $old_filemap {
+			filemap set file_map [lindex $f 0] [lindex $f 1]
+		}
+		
+		# Save it afterwards.
+		filemap save file_map
+
+		# reopen it r/o if we wanted it r/o.
+	} else {
+		# open it directly
+		if { $readonly == 1 } {
+			filemap open file_map ${map_file}.db readonly
+		} else {
+			filemap open file_map ${map_file}.db
+		}
+	}
+	
+	return 0
+}
+
+##
+# determine if a file is registered in the file map, and if it is,
+# get its port.
+# open the file map if required.
+#
+# - file	the file to test
+# return the 0 if the file is not registered, the name of the port otherwise.
+#
+proc file_registered {file} {
+	variable file_map
+
+	open_file_map 1
+
+	if {[filemap exists file_map $file]} {
+		return [filemap get file_map $file]
+	} else {
+		return 0
+	}
+}
+
+##
+# determine if a port is registered in the file map, and if it is,
+# get its installed (activated) files.
+# convert the port if required.
+# open the file map if required.
+#
+# - port	the port to test
+# return the 0 if the port is not registered, the list of its files otherwise.
+#
+proc port_registered {name} {
+	# Trust the file map first.
+	variable file_map
+
+	open_file_map 1
+
+	set files [filemap list file_map $name]
+
+	if { [llength $files] > 0 } {
+		return $files
+	} else {
+		# Is port installed?
+		set matchingPorts [installed $name]
+		if { [llength $matchingPorts] } {
+			# Convert the port and retry.
+			open_entry $name
+			
+			set files [filemap list file_map $name]
+			
+			return $files
+		} else {
+			return 0
+		}
+	}
+}
+
+##
+# register a file in the file map.
+# open the file map if required.
+#
+# - file	the file to register
+# - port	the port to associate with the file
+#
+proc register_file {file port} {
+	variable file_map
+
+	open_file_map
+
+	if { [file type $file] == "link" } {
+		ui_debug "Adding link to file_map: $file for: $port"
+	} else {
+		ui_debug "Adding file to file_map: $file for: $port"
+	}
+	filemap set file_map $file $port
+}
+
+##
+# register all the files in the list 'files' in the filemap.
+# open the file map if required.
+#
+# - files	the list of files to register
+# - port	the port to associate the files with
+#
+proc register_bulk_files {files port} {
+	variable file_map
+
+	open_file_map
+
+	foreach f $files {
+		set file [lindex $f 0]
+		if { [file type $file] == "link" } {
+			ui_debug "Adding link to file_map: $file for: $port"
+		} else {
+			ui_debug "Adding file to file_map: $file for: $port"
+		}
+		filemap set file_map $file $port
+	}
+}
+
+##
+# unregister a file from the file map.
+# open the file map if required.
+#
+# - file	the file to unregister
+#
+proc unregister_file {file} {
+	variable file_map
+
+	open_file_map
+
+	ui_debug "Removing entry from file_map: $file"
+	filemap unset file_map $file
+}
+
+##
+# save the file map to disk.
+# do not do anything if the file map wasn't open.
+#
+# always return 1
+#
+proc write_file_map {args} {
+	variable file_map
+
+	if { [info exists file_map] } {
+		open_file_map
+		filemap save file_map
+	}
+
+	return 1
+}
+
+##
+# close the file map.
+# important to do this so the lock is released.
+# do not do anything if the file map wasn't open.
+#
+proc close_file_map {args} {
+	variable file_map
+
+	if { [info exists file_map] } {
+		filemap close file_map
+	}
+}
+
+# Dependency Map Code
+proc open_dep_map {args} {
+	global macports::registry.path
+	variable dep_map
+
+	set receipt_path [file join ${macports::registry.path} receipts]
+
+	set map_file [file join ${receipt_path} dep_map]
+
+	if { [file exists ${map_file}.bz2] && [file exists ${registry::autoconf::bzip2_path}] } {
+		set dep_map [exec ${registry::autoconf::bzip2_path} -d -c ${map_file}.bz2]
+	} elseif { [file exists ${map_file}] } {
+		set map_handle [open ${map_file} r]
+		set dep_map [read $map_handle]
+		close $map_handle
+	} else {
+	    set dep_map [list]
+	}
+	if { ![llength $dep_map] > 0 } {
+		set dep_map [list]
+	}
+}
+
+# List all ports this one depends on
+proc list_depends {name} {
+	variable dep_map
+	if { [llength $dep_map] < 1 && [info exists dep_map] } {
+		open_dep_map
+	}
+	set rlist [list]
+	foreach de $dep_map {
+		if { $name == [lindex $de 2] } {
+			lappend rlist $de
+		}
+	}
+	return $rlist
+}
+
+# List all the ports that depend on this port
+proc list_dependents {name version revision variants} {
+	variable dep_map
+	if { [llength $dep_map] < 1 && [info exists dep_map] } {
+		open_dep_map
+	}
+	set rlist [list]
+	foreach de $dep_map {
+		if { $name == [lindex $de 0] } {
+			lappend rlist $de
+		}
+	}
+	return $rlist
+}
+
+proc register_dep {dep type port} {
+	variable dep_map
+	set newdep [list $dep $type $port]
+	# slow, but avoids duplicate entries building up
+	if {[lsearch -exact $dep_map $newdep] == -1} {
+	    lappend dep_map $newdep
+	}
+}
+
+proc unregister_dep {dep type port} {
+	variable dep_map
+	set new_map [list]
+	foreach de $dep_map {
+		if { $de != [list $dep $type $port] } {
+			lappend new_map $de
+		}
+	}
+	set dep_map $new_map
+}
+
+# remove duplicate entries from the dep_map
+# (could be put there by older versions of MacPorts)
+proc clean_dep_map {args} {
+    variable dep_map
+    set new_map [list]
+    set oldlen [llength $dep_map]
+    ui_debug "Current dep_map has $oldlen entries"
+    foreach de $dep_map {
+        if {[lsearch -exact $new_map $de] == -1} {
+            lappend new_map $de
+        } else {
+            ui_debug "Removing $de from dep_map"
+        }
+    }
+    set dep_map $new_map
+    
+    set newlen [llength $dep_map]
+    set diff [expr $oldlen - $newlen]
+    ui_debug "New dep_map has $newlen entries"
+    ui_info "Removed $diff duplicate entries from the dependency map"
+}
+
+proc write_dep_map {args} {
+	global macports::registry.path
+	variable dep_map
+
+	set receipt_path [file join ${macports::registry.path} receipts]
+
+	set map_file [file join ${receipt_path} dep_map]
+
+	set map_handle [open ${map_file}.tmp w 0644]
+	puts $map_handle $dep_map
+	close $map_handle
+
+    # don't both checking for presence, file delete doesn't error if file doesn't exist
+    file delete -- ${map_file} ${map_file}.bz2
+
+    file rename -- ${map_file}.tmp ${map_file}
+
+	if { [file exists ${map_file}] && [file exists ${registry::autoconf::bzip2_path}] && ![info exists registry.nobzip] } {
+		system "${registry::autoconf::bzip2_path} -f ${map_file}"
+	}
+
+	return 1
+}
+
+# End of receipt_flat namespace
+}
+

Copied: branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl (from rev 65586, trunk/base/src/registry2.0/receipt_sqlite.tcl)
===================================================================
--- branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/receipt_sqlite.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,261 @@
+# receipt_sqlite.tcl
+# $Id$
+#
+# Copyright (c) 2010 The MacPorts Project
+# Copyright (c) 2004 Will Barton <wbb4 at opendarwin.org>
+# Copyright (c) 2002 Apple Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide receipt_sqlite 1.0
+
+package require macports 1.0
+package require registry2 2.0
+package require registry_util 2.0
+
+##
+# registry2.0 wrapper code that matches old receipt_flat interface
+##
+namespace eval receipt_sqlite {
+
+# return list of active ports, or active version of port 'name' if specified
+proc active {name} {
+    if {$name != ""} {
+        set ports [registry::entry installed $name]
+    } else {
+        set ports [registry::entry installed]
+    }
+    set rlist [list]
+    foreach port $ports {
+        lappend rlist [list [$port name] [$port version] [$port revision] [$port variants] [string equal [$port state] "installed"] [$port epoch]]
+    }
+    return $rlist
+}
+
+##
+# Open an existing entry and return a reference.
+proc open_entry {name version revision variants epoch} {
+    return [registry::entry open $name $version $revision $variants $epoch]
+}
+
+# Check to see if an entry exists
+proc entry_exists {name version {revision 0} {variants ""}} {
+    if {![catch {set ports [registry::entry search name $name version $version revision $revision variants $variants]}] && [llength $ports] > 0} {
+        return 1
+    }
+	return 0
+}
+
+# Check to see if an entry exists
+proc entry_exists_for_name {name} {
+	if {![catch {set ports [registry::entry search name $name]}] && [llength $ports] > 0} {
+	    return 1
+	}
+	return 0
+}
+
+##
+# determine if a file is registered in the file map, and if it is,
+# get its port.
+#
+# - file	the file to test
+# returns 0 if the file is not registered, the name of the port otherwise.
+#
+proc file_registered {file} {
+    set port [registry::entry owner $file]
+	if {$port != ""} {
+		return [$port name]
+	} else {
+		return 0
+	}
+}
+
+##
+# determine if a port is registered in the file map, and if it is,
+# get its installed (activated) files.
+#
+# - port	the port to test
+# returns 0 if the port is not registered, the list of its files otherwise.
+proc port_registered {name} {
+	if {![catch {set ports [registry::entry installed $name]}]
+	    && [llength $ports] > 0} {
+	    # should never return more than one port
+	    set port [lindex $ports 0]
+		return [$port files]
+	} elseif {![catch {set ports [registry::entry imaged $name]}]
+	    && [llength $ports] > 0} {
+	    return ""
+	} else {
+        return 0
+    }
+}
+
+##
+# Retrieve a property from a registry entry.
+#
+# ref			reference to the entry.
+# property		key for the property to retrieve.
+proc property_retrieve {ref property} {
+    switch $property {
+        active {
+            set ret [string equal [$ref state] "installed"]
+        }
+        imagedir {
+            set ret [$ref location]
+        }
+        default {
+            if {[catch {set ret [$ref $property]}]} {
+                # match behaviour of receipt_flat
+                set ret 0
+            }
+        }
+    }
+    return $ret
+}
+
+##
+# Store a property in a registry entry.
+#
+# ref			reference to the entry.
+# property		key for the property to set.
+# value         value to set it to.
+proc property_store {ref property value} {
+    switch $property {
+        active {
+            if {!$value} {
+                $ref state "imaged"
+            } else {
+                $ref state "installed"
+            }
+        }
+        imagedir {
+            $ref location $value
+        }
+        default {
+            $ref $property $value
+        }
+    }
+}
+
+# Return installed ports
+#
+# If version is "", return all ports of that name.
+# Otherwise, return only ports that exactly match this version.
+# What we call version here is version_revision+variants.
+proc installed {{name ""} {version ""}} {
+    global macports::registry.installtype
+
+	if { $name == "" && $version == "" } {
+	    set ports [registry::entry imaged]
+	} elseif { $name != "" && $version == ""} {
+	    set ports [registry::entry imaged $name]
+	} else {
+	    set cmd "registry::entry imaged $name"
+	    registry::decode_spec $version version revision variants
+	    if {[info exists version] && $version != ""} {
+                append cmd " $version"
+                if {[info exists revision] && $revision != ""} {
+                    append cmd " $revision"
+                    if {![info exists variants]} {
+                        set variants ""
+                    }
+                    append cmd " {$variants}"
+                }
+        }
+	    if {[catch {set ports [eval $cmd]}]} {
+	        set ports [list]
+	    }
+	}
+
+    set rlist [list]
+    foreach port $ports {
+        lappend rlist [list [$port name] [$port version] [$port revision] [$port variants] [string equal [$port state] "installed"] [$port epoch]]
+    }
+	return $rlist
+}
+
+proc close_file_map {args} {
+}
+
+proc open_dep_map {args} {
+}
+
+# List all the ports that depend on this port
+proc list_dependents {name version revision variants} {
+	set rlist [list]
+	set searchcmd "registry::entry search"
+    foreach key {name version revision} {
+        append searchcmd " $key [set $key]"
+    }
+    append searchcmd " variants {$variants}"
+    if {[catch {set ports [eval $searchcmd]}]} {
+        set ports [list]
+    }
+    foreach port $ports {
+        set dependents [$port dependents]
+        foreach dependent $dependents {
+            lappend rlist [list [$port name] port [$dependent name]]
+        }
+    }
+	
+	return [lsort -unique $rlist]
+}
+
+# adds a registry entry from a list of keys and values
+proc create_entry_l {proplist} {
+    array set props $proplist
+    registry::write {
+        set regref [registry::entry create $props(name) $props(version) $props(revision) $props(variants) $props(epoch)]
+        $regref date $props(date)
+        $regref requested $props(requested)
+        $regref location $props(location)
+        $regref state $props(state)
+        $regref installtype $props(installtype)
+        if {$props(installtype) == "image"} {
+            $regref map $props(imagefiles)
+            if {$props(state) == "installed"} {
+                $regref activate $props(imagefiles) $props(files)
+            }
+        } else {
+            $regref map $props(files)
+        }
+        foreach key {negated_variants os_platform os_major archs} {
+            if {$props($key) != 0} {
+                $regref $key $props($key)
+            } else {
+                $regref $key ""
+            }
+        }
+        foreach dep_portname $props(depends) {
+            $regref depends $dep_portname
+        }
+        $regref portfile $props(portfile)
+    }
+}
+
+# End of receipt_sqlite namespace
+}

Modified: branches/new-help-system/base/src/registry2.0/registry.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/registry.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -81,6 +81,9 @@
     reg_entry** entries;
     int entry_count = reg_all_open_entries(reg, &entries);
     int i;
+    if (entry_count == -1) {
+        return 0;
+    }
     for (i=0; i<entry_count; i++) {
         if (entries[i]->proc) {
             Tcl_DeleteCommand(interp, entries[i]->proc);

Copied: branches/new-help-system/base/src/registry2.0/registry.tcl (from rev 65586, trunk/base/src/registry2.0/registry.tcl)
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry.tcl	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/registry.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,456 @@
+# registry.tcl
+#
+# Copyright (c) 2004 Will Barton <wbb4 at opendarwin.org>
+# Copyright (c) 2002 Apple Computer, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+package provide registry 1.0
+
+package require macports 1.0
+package require receipt_flat 1.0
+package require receipt_sqlite 1.0
+package require portimage 2.0
+package require registry_uninstall 2.0
+package require msgcat
+
+namespace eval registry {
+
+# Begin creating a new registry entry for the port version_revision+variant
+# This process assembles the directory name and creates a receipt dlist
+proc new_entry {name version {revision 0} {variants ""} {epoch 0} } {
+	global macports::registry.path macports::registry.format macports::registry.installtype macports::prefix
+
+	
+	# Make sure we don't already have an entry in the Registry for this
+	# port version_revision+variants
+	if {![entry_exists $name $version $revision $variants] } {
+
+		set ref [${macports::registry.format}::new_entry]
+
+		property_store $ref name $name
+		property_store $ref version $version
+		property_store $ref revision $revision
+		property_store $ref variants $variants
+		property_store $ref epoch $epoch
+		property_store $ref date [clock seconds]
+		property_store $ref installtype ${macports::registry.installtype}
+		property_store $ref receipt_f ${macports::registry.format}
+		if { ${macports::registry.installtype} == "image" } {
+			set imagedir [file join ${macports::registry.path} software ${name} ${version}_${revision}${variants}]
+			property_store $ref imagedir $imagedir
+			property_store $ref active 0
+		}
+
+		return $ref
+	} else {
+		return -code error "Registry error: ${name} @${version}_${revision}${variants} already registered as installed.  Please uninstall it first."
+	}
+}
+
+# Check to see if an entry exists in the registry.  This is passed straight 
+# through to the receipts system
+proc entry_exists {name version {revision 0} {variants ""}} {
+	global macports::registry.format
+	return [${macports::registry.format}::entry_exists $name $version $revision $variants] 
+}
+
+# Check to see if any entry exists in the registry for the given port name.
+proc entry_exists_for_name {name} {
+	global macports::registry.format
+	return [${macports::registry.format}::entry_exists_for_name $name]
+}
+
+# Close the registry... basically wrap the receipts systems's write process
+proc write_entry {ref} {
+	global macports::registry.format
+	
+	set name [property_retrieve $ref name]
+	set version [property_retrieve $ref version]
+	set revision [property_retrieve $ref revision]
+	set variants [property_retrieve $ref variants]
+	set epoch [property_retrieve $ref epoch]
+	set contents [property_retrieve $ref contents]
+
+	${macports::registry.format}::write_entry $ref $name $version $revision $variants
+
+}
+
+# Delete an entry from the registry.
+proc delete_entry {ref} {
+	global macports::registry.format
+	
+	set name [property_retrieve $ref name]
+	set version [property_retrieve $ref version]
+	set revision [property_retrieve $ref revision]
+	set variants [property_retrieve $ref variants]
+	
+	${macports::registry.format}::delete_entry $name $version $revision $variants
+	
+}
+
+# Open a registry entry.
+proc open_entry {name {version ""} {revision 0} {variants ""} {epoch ""}} {
+	global macports::registry.format
+
+	return [${macports::registry.format}::open_entry $name $version $revision $variants $epoch]
+
+}
+
+# Store a property with the open registry entry.
+proc property_store {ref property value} {
+	global macports::registry.format
+	${macports::registry.format}::property_store $ref $property $value
+}
+
+# Retrieve a property from the open registry entry.
+proc property_retrieve {ref property} {
+	global macports::registry.format
+	return [${macports::registry.format}::property_retrieve $ref $property]
+}
+
+# If only one version of the port is installed, this process returns that
+# version's parts.  Otherwise, it lists the versions installed and exists.
+proc installed {{name ""} {version ""}} {
+	global macports::registry.format
+
+    if {${macports::registry.format} == "receipt_flat"} {
+        set ilist [${macports::registry.format}::installed $name $version]
+        set rlist [list]
+    
+        foreach installed $ilist {
+            set iname [lindex $installed 0]
+            set iversion [lindex $installed 1]
+            set irevision [lindex $installed 2]
+            set ivariants [lindex $installed 3]
+            set iref [open_entry $iname $iversion $irevision $ivariants]
+            set iactive	[property_retrieve $iref active]
+            set iepoch [property_retrieve $iref epoch]
+            lappend rlist [list $iname $iversion $irevision $ivariants $iactive $iepoch]
+        }
+    } else {
+        set rlist [${macports::registry.format}::installed $name $version]
+    }
+    
+    if { [llength $rlist] < 1 } {
+        if { $name == "" } {
+            return -code error "Registry error: No ports registered as installed."
+        } else {
+            if { $version == "" } {
+                return -code error "Registry error: $name not registered as installed."
+            } else {
+                return -code error "Registry error: $name $version not registered as installed."
+            }
+        }
+    }
+    
+	return $rlist
+}
+
+# Return a list with the active version of a port (or the active versions of
+# all ports if name is "").
+proc active {{name ""}} {
+	global macports::registry.format
+    
+    if {${macports::registry.format} == "receipt_flat"} {
+        set rlist [list]
+        set ilist [${macports::registry.format}::installed $name]
+    
+        foreach installed $ilist {
+            set iname [lindex $installed 0]
+            set iversion [lindex $installed 1]
+            set irevision [lindex $installed 2]
+            set ivariants [lindex $installed 3]
+            set iref [open_entry $iname $iversion $irevision $ivariants]
+            set iactive	[property_retrieve $iref active]
+            set iepoch [property_retrieve $iref epoch]
+            if {$iactive} {
+                lappend rlist [list $iname $iversion $irevision $ivariants $iactive $iepoch]
+            }
+        }
+    } else {
+        set rlist [${macports::registry.format}::active $name]
+    }
+	
+	if { [llength $rlist] < 1 } {
+		if { $name == "" } {
+			return -code error "Registry error: No ports registered as active."
+		} else {
+			return -code error "Registry error: $name not registered as installed & active."
+		}
+	}
+	return $rlist
+}
+
+proc location {portname portversion} {
+	set ilist [registry::installed $portname $portversion]
+
+	if { [llength $ilist] > 1 } {
+		puts "The following versions of $portname are currently installed:"
+		foreach i $ilist { 
+			set iname [lindex $i 0]
+			set iversion [lindex $i 1]
+			set irevision [lindex $i 2]
+			set ivariants [lindex $i 3]
+			set iactive [lindex $i 4]
+			if { $iactive == 0 } {
+				puts "	$iname @${iversion}_${irevision}${ivariants}"
+			} elseif { $iactive == 1 } {
+				puts "	$iname @${iversion}_${irevision}${ivariants} (active)"
+			}
+		}
+		return -1
+	} else {
+		return [lindex $ilist 0]
+	}
+}	
+
+
+# File Map Code
+proc open_file_map {args} {
+	global macports::registry.format
+	return [${macports::registry.format}::open_file_map $args]
+}
+
+proc file_registered {file} {
+	global macports::registry.format
+	return [${macports::registry.format}::file_registered $file]
+}
+
+proc port_registered {name} {
+	global macports::registry.format
+	return [${macports::registry.format}::port_registered $name]
+}
+
+proc register_file {file port} {
+	global macports::registry.format
+	return [${macports::registry.format}::register_file $file $port]
+}
+
+proc register_bulk_files {files port} {
+	global macports::registry.format
+	open_file_map
+        set r [${macports::registry.format}::register_bulk_files $files $port]
+	write_file_map
+	close_file_map
+	return $r
+}
+
+proc unregister_file {file} {
+	global macports::registry.format
+	return [${macports::registry.format}::unregister_file $file]
+}
+
+proc write_file_map {args} {
+	global macports::registry.format
+	return [${macports::registry.format}::write_file_map $args]
+}
+
+proc close_file_map {args} {
+	global macports::registry.format
+	return [${macports::registry.format}::close_file_map $args]
+}
+
+# Dependency Map Code
+proc register_dependencies {deps name} {
+
+	open_dep_map
+	foreach dep $deps {
+		# We expect the form type:regexp:port to come in, but we don't need to 
+		# store it that way in the dep map.
+		set type [lindex [split $dep :] 0]
+		set depport [lindex [split $dep :] end]
+		register_dep $depport $type $name
+	}
+	write_dep_map
+}
+
+proc unregister_dependencies {name} {
+
+	open_dep_map
+	foreach dep [list_depends $name] {
+		unregister_dep [lindex $dep 0] [lindex $dep 1] [lindex $dep 2]
+	}
+	write_dep_map
+}
+
+proc open_dep_map {args} {
+	global macports::registry.format
+	return [${macports::registry.format}::open_dep_map $args]
+}
+
+##
+#
+# From a file name, return a list representing data currently known about the file.
+# This list is a 6-tuple of the form:
+# 0: file path
+# 1: uid
+# 2: gid
+# 3: mode
+# 4: size
+# 5: md5 checksum information
+#
+# fname		a path to a given file.
+# return a 6-tuple about this file.
+proc fileinfo_for_file {fname} {
+    # Add the link to the registry, not the actual file.
+    # (we won't store the md5 of the target of links since it's meaningless
+    # and $statvar(mode) tells us that links are links).
+    if {![catch {file lstat $fname statvar}]} {
+	if {[file isfile $fname] && [file type $fname] != "link"} {
+	    if {[catch {md5 file $fname} md5sum] == 0} {
+		# Create a line that matches md5(1)'s output
+		# for backwards compatibility
+		set line "MD5 ($fname) = $md5sum"
+		return [list $fname $statvar(uid) $statvar(gid) $statvar(mode) $statvar(size) $line]
+	    }
+	} else {
+	    return  [list $fname $statvar(uid) $statvar(gid) $statvar(mode) $statvar(size) "MD5 ($fname) NONE"]
+	}
+    }
+    return {}
+}
+
+##
+#
+# From a list of files, return a list of information concerning these files.
+# The information is obtained through fileinfo_for_file.
+#
+# flist		the list of file to get information about.
+# return a list of 6-tuples described in fileinfo_for_file.
+proc fileinfo_for_index {flist} {
+	global prefix
+
+	set rval [list]
+	foreach file $flist {
+		if {[string index $file 0] != "/"} {
+			set file [file join $prefix $file]
+		}
+		lappend rval [fileinfo_for_file $file]
+	}
+	return $rval
+}
+
+# List all ports this one depends on
+proc list_depends {name} {
+	global macports::registry.format
+	return [${macports::registry.format}::list_depends $name]
+}
+
+# List all the ports that depend on this port
+proc list_dependents {name {version ""} {revision ""} {variants ""}} {
+	global macports::registry.format
+	return [${macports::registry.format}::list_dependents $name $version $revision $variants]
+}
+
+proc register_dep {dep type port} {
+	global macports::registry.format
+	return [${macports::registry.format}::register_dep $dep $type $port]
+}
+
+proc unregister_dep {dep type port} {
+	global macports::registry.format
+	return [${macports::registry.format}::unregister_dep $dep $type $port]
+}
+
+proc clean_dep_map {args} {
+    global macports::registry.format
+    return [${macports::registry.format}::clean_dep_map $args]
+}
+
+proc write_dep_map {args} {
+	global macports::registry.format
+	return [${macports::registry.format}::write_dep_map $args]
+}
+
+# upgrade flat receipts to registry2.0 sqlite db
+proc convert_to_sqlite {} {
+    set ilist [receipt_flat::installed "" ""]
+
+    foreach installed $ilist {
+        set iname [lindex $installed 0]
+        set iversion [lindex $installed 1]
+        set irevision [lindex $installed 2]
+        set ivariants [lindex $installed 3]
+        set proplist [list name $iname version $iversion revision $irevision variants $ivariants]
+
+        set iref [receipt_flat::open_entry $iname $iversion $irevision $ivariants]
+
+        lappend proplist date [receipt_flat::property_retrieve $iref date]
+        lappend proplist epoch [receipt_flat::property_retrieve $iref epoch]
+        lappend proplist negated_variants [receipt_flat::property_retrieve $iref negated_variants]
+        lappend proplist requested [receipt_flat::property_retrieve $iref requested]
+        lappend proplist os_platform [receipt_flat::property_retrieve $iref os_platform]
+        lappend proplist os_major [receipt_flat::property_retrieve $iref os_major]
+        lappend proplist archs [receipt_flat::property_retrieve $iref archs]
+
+        set installtype [receipt_flat::property_retrieve $iref installtype]
+        lappend proplist installtype $installtype
+        if { $installtype == "image" } {
+            set imagedir [receipt_flat::property_retrieve $iref imagedir]
+            set contents [receipt_flat::property_retrieve $iref contents]
+            set imagefiles [list]
+            set idlen [string length $imagedir]
+            foreach f $contents {
+                set fullpath [lindex $f 0]
+                # strip image dir from start
+                set path [string range $fullpath $idlen [string length $fullpath]]
+                lappend imagefiles $path
+            }
+            lappend proplist imagefiles $imagefiles
+            set active [receipt_flat::property_retrieve $iref active]
+            if {$active} {
+                set state installed
+                lappend proplist files [receipt_flat::port_registered $iname]
+            } else {
+                set state imaged
+            }
+        } else {
+            set imagedir ""
+            set state installed
+            lappend proplist files [receipt_flat::port_registered $iname]
+        }
+        lappend proplist location $imagedir
+        lappend proplist state $state
+        
+        receipt_flat::open_dep_map
+        set deplist [receipt_flat::list_depends $iname]
+        set depnames [list]
+        foreach dep $deplist {
+            lappend depnames [lindex $dep 0]
+        }
+        lappend proplist depends $depnames
+        
+        lappend proplist portfile ""
+        
+        # add the entry to the db
+        receipt_sqlite::create_entry_l $proplist
+    }
+}
+
+# End of registry namespace
+}

Copied: branches/new-help-system/base/src/registry2.0/registry_autoconf.tcl.in (from rev 65586, trunk/base/src/registry2.0/registry_autoconf.tcl.in)
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry_autoconf.tcl.in	                        (rev 0)
+++ branches/new-help-system/base/src/registry2.0/registry_autoconf.tcl.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -0,0 +1,35 @@
+# registry_autoconf.tcl.in
+# $Id$
+#
+# Copyright (c) 2007 Kevin Ballard <eridius at macports.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its contributors
+#    may be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+package provide registry 1.0
+
+namespace eval registry::autoconf {
+    variable bzip2_path "@BZIP2@"
+}

Modified: branches/new-help-system/base/src/registry2.0/registry_util.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/registry_util.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/registry_util.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -52,7 +52,7 @@
 ## @return               true if `specifier` is a valid specifier, else false
 proc decode_spec {specifier version revision variants} {
     upvar 1 $version ver $revision rev $variants var
-    return [regexp {^([^-+_]+)(_([^-+]+)(([-+][^-+]+)*))?$} - ver - rev var]
+    return [regexp {^([^+]+?)(_(\d+)(([-+][^-+]+)*))?$} $specifier - ver - rev var]
 }
 
 ## Checks that the given port has no dependent ports. If it does, throws an
@@ -61,19 +61,61 @@
 ## @param [in] port  a registry::entry to check
 ## @param [in] force if true, continue even if there are dependents
 proc check_dependents {port force} {
-    # Check and make sure no ports depend on this one
-    set deplist [$port dependents]
-    if { [llength $deplist] > 0 } {
-        ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall %s %s_%s%s, the following ports depend on it:"] $portname $version $revision $variants]"
-        foreach depport $deplist {
-            ui_msg "$UI_PREFIX [format [msgcat::mc "	%s"] $depport]"
+    global UI_PREFIX
+    if {[$port state] == "installed" || [llength [registry::entry imaged [$port name]]] == 1} {
+        # Check and make sure no ports depend on this one
+        set deplist [$port dependents]
+        if { [llength $deplist] > 0 } {
+            ui_msg "$UI_PREFIX [format [msgcat::mc "Unable to uninstall/deactivate %s @%s_%s%s, the following ports depend on it:"] [$port name] [$port version] [$port revision] [$port variants]]"
+            foreach depport $deplist {
+                ui_msg "$UI_PREFIX [format [msgcat::mc "	%s @%s_%s%s"] [$depport name] [$depport version] [$depport revision] [$depport variants]]"
+            }
+            if { [string is true -strict $force] } {
+                ui_warn "Uninstall/deactivate forced.  Proceeding despite dependencies."
+            } else {
+                throw registry::uninstall-error "Please uninstall the ports that depend on [$port name] first."
+            }
         }
-        if { [string is true $force] } {
-            ui_warn "Uninstall forced.  Proceeding despite dependencies."
+    }
+}
+
+## runs the given target of the given port using its stored portfile
+## @return   true if successful, false otherwise
+proc run_target {port target options} {
+    set portspec "[$port name] @[$port version]_[$port revision][$port variants]"
+    if {![catch {set mport [mportopen_installed [$port name] [$port version] [$port revision] [$port variants] $options]}]} {
+        if {[catch {set result [mportexec $mport $target]} result] || $result != 0} {
+            global errorInfo
+            ui_debug "$errorInfo"
+            catch {mportclose_installed $mport}
+            ui_warn "Failed to execute portfile from registry for $portspec"
+            switch $target {
+                activate {
+                    if {[$port state] == "installed"} {
+                        return 1
+                    }
+                }
+                deactivate {
+                    if {[$port state] == "imaged"} {
+                        return 1
+                    }
+                }
+                uninstall {
+                    if {![registry::entry exists $port]} {
+                        return 1
+                    }
+                }
+            }
         } else {
-            throw registry::uninstall-error "Please uninstall the ports that depend on $portname first."
+            mportclose_installed $mport
+            return 1
         }
+    } else {
+        global errorInfo
+        ui_debug "$errorInfo"
+        ui_warn "Failed to open Portfile from registry for $portspec"
     }
+    return 0
 }
 
 }


Property changes on: branches/new-help-system/base/src/registry2.0/registry_util.tcl
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/registry2.0/tests/depends.tcl
===================================================================
--- branches/new-help-system/base/src/registry2.0/tests/depends.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/tests/depends.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -22,29 +22,29 @@
     #                   e
 
     registry::write {
-        set a1 [registry::entry create a 1 0 0 {}]
-        set a2 [registry::entry create a 2 0 0 {}]
-        set a3 [registry::entry create a 3 0 0 {}]
+        set a1 [registry::entry create a 1 0 {} 0]
+        set a2 [registry::entry create a 2 0 {} 0]
+        set a3 [registry::entry create a 3 0 {} 0]
         $a1 depends b
         $a2 depends b
         $a3 depends c
 
-        set b1 [registry::entry create b 1 0 0 {}]
-        set b2 [registry::entry create b 2 0 0 {}]
+        set b1 [registry::entry create b 1 0 {} 0]
+        set b2 [registry::entry create b 2 0 {} 0]
         $b1 depends d
         $b1 depends f
         $b2 depends d
         $b2 depends g
 
-        set c [registry::entry create c 1 0 0 {}]
+        set c [registry::entry create c 1 0 {} 0]
         $c depends e
 
-        set d [registry::entry create d 1 0 0 {}]
+        set d [registry::entry create d 1 0 {} 0]
         $d depends e
 
-        set e [registry::entry create e 1 0 0 {}]
-        set f [registry::entry create f 1 0 0 {}]
-        set g [registry::entry create g 1 0 0 {}]
+        set e [registry::entry create e 1 0 {} 0]
+        set f [registry::entry create f 1 0 {} 0]
+        set g [registry::entry create g 1 0 {} 0]
 
         $a1 state installed
         $a2 state imaged
@@ -62,16 +62,19 @@
         test_set {[$a1 dependents]} {}
         test_set {[$a2 dependents]} {}
         test_set {[$a3 dependents]} {}
-        test_set {[$b1 dependents]} {$a1}
-        test_set {[$b2 dependents]} {}
-        test_set {[$c dependents]} {}
-        test_set {[$d dependents]} {$b1}
+        test_set {[$b1 dependents]} {$a1 $a2}
+        test_set {[$b2 dependents]} {$a1 $a2}
+        test_set {[$c dependents]} {$a3}
+        test_set {[$d dependents]} {$b1 $b2}
         test_set {[$e dependents]} {$c $d}
         test_set {[$f dependents]} {$b1}
-        test_set {[$g dependents]} {}
+        test_set {[$g dependents]} {$b2}
 
-        test_set {[$a1 dependencies]} {$b1}
+        test_set {[$a1 dependencies]} {$b1 $b2}
+        test_set {[$a2 dependencies]} {$b1 $b2}
+        test_set {[$a3 dependencies]} {$c}
         test_set {[$b1 dependencies]} {$d $f}
+        test_set {[$b2 dependencies]} {$d $g}
         test_set {[$c dependencies]} {$e}
         test_set {[$d dependencies]} {$e}
         test_set {[$e dependencies]} {}
@@ -79,83 +82,6 @@
         test_set {[$g dependencies]} {}
     }
 
-    registry::write {
-        $b1 state imaged
-        $b2 state installed
-        $g state installed
-    }
-
-    registry::read {
-        test_set {[$b1 dependents]} {}
-        test_set {[$b2 dependents]} {$a1}
-        test_set {[$c dependents]} {}
-        test_set {[$d dependents]} {$b2}
-        test_set {[$e dependents]} {$c $d}
-        test_set {[$f dependents]} {}
-        test_set {[$g dependents]} {$b2}
-
-        test_set {[$a1 dependencies]} {$b2}
-        test_set {[$b2 dependencies]} {$d $g}
-        test_set {[$c dependencies]} {$e}
-        test_set {[$d dependencies]} {$e}
-    }
-
-    registry::write {
-        $a1 state imaged
-        $a2 state installed
-        $f state imaged
-    }
-
-    registry::read {
-        test_set {[$b1 dependents]} {}
-        test_set {[$b2 dependents]} {$a2}
-        test_set {[$c dependents]} {}
-        test_set {[$d dependents]} {$b2}
-        test_set {[$e dependents]} {$c $d}
-        test_set {[$f dependents]} {}
-        test_set {[$g dependents]} {$b2}
-
-        test_set {[$a2 dependencies]} {$b2}
-        test_set {[$b2 dependencies]} {$d $g}
-        test_set {[$c dependencies]} {$e}
-        test_set {[$d dependencies]} {$e}
-    }
-
-    registry::write {
-        $a2 state imaged
-        $a3 state installed
-    }
-
-    registry::read {
-        test_set {[$b1 dependents]} {}
-        test_set {[$b2 dependents]} {}
-        test_set {[$c dependents]} {$a3}
-        test_set {[$d dependents]} {$b2}
-        test_set {[$e dependents]} {$c $d}
-        test_set {[$f dependents]} {}
-        test_set {[$g dependents]} {$b2}
-
-        test_set {[$a3 dependencies]} {$c}
-        test_set {[$b2 dependencies]} {$d $g}
-        test_set {[$c dependencies]} {$e}
-        test_set {[$d dependencies]} {$e}
-    }
-
-    registry::write {
-        $b2 state imaged
-        $d state imaged
-    }
-
-    registry::read {
-        test_set {[$c dependents]} {$a3}
-        test_set {[$d dependents]} {}
-        test_set {[$e dependents]} {$c}
-        test_set {[$g dependents]} {}
-
-        test_set {[$a3 dependencies]} {$c}
-        test_set {[$d dependencies]} {$e}
-    }
-
     file delete test.db
 }
 

Modified: branches/new-help-system/base/src/registry2.0/util.c
===================================================================
--- branches/new-help-system/base/src/registry2.0/util.c	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/registry2.0/util.c	2010-03-28 16:55:01 UTC (rev 65589)
@@ -51,11 +51,14 @@
  * N^2 to N. It'll be alchemy for the 21st century.
  */
 char* unique_name(Tcl_Interp* interp, char* prefix) {
-    char* result = malloc(strlen(prefix) + TCL_INTEGER_SPACE + 1);
+    int result_size = strlen(prefix) + TCL_INTEGER_SPACE + 1;
+    char* result = malloc(result_size);
     Tcl_CmdInfo info;
     int i;
+    if (!result)
+        return NULL;
     for (i=0; ; i++) {
-        sprintf(result, "%s%d", prefix, i);
+        snprintf(result, result_size, "%s%d", prefix, i);
         if (Tcl_GetCommandInfo(interp, result, &info) == 0) {
             break;
         }
@@ -174,6 +177,9 @@
                 errPtr)) {
         int size = strlen(name) + 1;
         entry->proc = malloc(size*sizeof(char));
+        if (!entry->proc) {
+            return 0;
+        }
         memcpy(entry->proc, name, size);
         return 1;
     }
@@ -218,6 +224,9 @@
         while (sqlite3_step(stmt) == SQLITE_ROW) {
             sqlite_int64 rowid = sqlite3_column_int64(stmt, 0);
             char* name = unique_name(interp, prefix);
+            if (!name) {
+                return TCL_ERROR;
+            }
             if (setter(interp, name, rowid) == TCL_OK) {
                 Tcl_Obj* element = Tcl_NewStringObj(name, -1);
                 Tcl_ListObjAppendElement(interp, result, element);
@@ -233,7 +242,6 @@
         set_sqlite_result(interp, db, query);
         return TCL_ERROR;
     }
-    return TCL_ERROR;
 }
 
 const char* string_or_null(Tcl_Obj* obj) {
@@ -249,6 +257,9 @@
         void** inv, int inc, reg_error* errPtr) {
     void** result = malloc(inc*sizeof(void*));
     int i;
+    if (!result) {
+        return 0;
+    }
     for (i=0; i<inc; i++) {
         if (!fn(userdata, &result[i], inv[i], errPtr)) {
             if (del != NULL) {
@@ -267,7 +278,10 @@
 int entry_to_obj(Tcl_Interp* interp, Tcl_Obj** obj, reg_entry* entry,
         reg_error* errPtr) {
     if (entry->proc == NULL) {
-        char* name = unique_name(interp, "registry::entry");
+        char* name = unique_name(interp, "::registry::entry");
+        if (!name) {
+            return 0;
+        }
         if (!set_entry(interp, name, entry, errPtr)) {
             free(name);
             return 0;

Deleted: branches/new-help-system/base/src/sqlite-3.1.3.diff
===================================================================
--- branches/new-help-system/base/src/sqlite-3.1.3.diff	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/sqlite-3.1.3.diff	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,53 +0,0 @@
-diff -ru src/sqlite-3.1.3/Makefile.in src/sqlite-3.1.3.mine/Makefile.in
---- src/sqlite-3.1.3/Makefile.in	2005-02-19 19:11:19.000000000 -0500
-+++ src/sqlite-3.1.3.mine/Makefile.in	2007-05-31 17:34:02.000000000 -0400
-@@ -605,7 +605,7 @@
- 	mkdir -p doc
- 	mv $(DOC) doc
- 
--install:	sqlite3 libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
-+dont_install:	sqlite3 libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install}
- 	$(INSTALL) -d $(DESTDIR)$(libdir)
- 	$(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir)
- 	$(INSTALL) -d $(DESTDIR)$(exec_prefix)/bin
-@@ -615,7 +615,7 @@
- 	$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig; 
- 	$(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig; 
- 
--tcl_install:	libtclsqlite3.la
-+install:	libtclsqlite3.la
- 	tclsh $(TOP)/tclinstaller.tcl $(VERSION)
- 
- clean:	
-diff -ru src/sqlite-3.1.3/configure src/sqlite-3.1.3.mine/configure
---- src/sqlite-3.1.3/configure	2005-02-19 09:30:48.000000000 -0500
-+++ src/sqlite-3.1.3.mine/configure	2007-05-31 17:39:49.000000000 -0400
-@@ -20343,7 +20343,7 @@
- #########
- # Generate the output files.
- #
--                    ac_config_files="$ac_config_files Makefile sqlite3.pc"
-+                    ac_config_files="$ac_config_files Makefile sqlite3.pc tclinstaller.tcl"
- cat >confcache <<\_ACEOF
- # This file is a shell script that caches the results of configure
- # tests run on this system so they can be shared between configure
-diff -ru src/sqlite-3.1.3/tclinstaller.tcl src/sqlite-3.1.3.mine/tclinstaller.tcl
---- src/sqlite-3.1.3/tclinstaller.tcl	2005-01-30 17:10:01.000000000 -0500
-+++ src/sqlite-3.1.3.mine/tclinstaller.tcl	2007-05-31 17:33:32.000000000 -0400
-@@ -7,14 +7,14 @@
- set VERSION [lindex $argv 0]
- set LIBFILE .libs/libtclsqlite3[info sharedlibextension]
- if { ![info exists env(DESTDIR)] } { set env(DESTDIR) "" }
--set LIBDIR $env(DESTDIR)[lindex $auto_path 0]
-+set LIBDIR $env(DESTDIR)@prefix@/share/macports/Tcl
- set LIBNAME [file tail $LIBFILE]
- set LIB $LIBDIR/sqlite3/$LIBNAME
- 
- file delete -force $LIBDIR/sqlite3
- file mkdir $LIBDIR/sqlite3
- set fd [open $LIBDIR/sqlite3/pkgIndex.tcl w]
--puts $fd "package ifneeded sqlite3 $VERSION \[list load $LIB sqlite3\]"
-+puts $fd "package ifneeded sqlite3 $VERSION \[list load \[file join \$dir libtclsqlite3.dylib\]\]"
- close $fd
- 
- # We cannot use [file copy] because that will just make a copy of

Deleted: branches/new-help-system/base/src/sqlite-3.1.3.tar.gz
===================================================================
(Binary files differ)


Property changes on: branches/new-help-system/base/src/tclobjc1.0/MPMethodSignatureExtensions.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/MPMethodSignatureExtensions.m
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/tclobjc1.0/Makefile.in
===================================================================
--- branches/new-help-system/base/src/tclobjc1.0/Makefile.in	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/tclobjc1.0/Makefile.in	2010-03-28 16:55:01 UTC (rev 65589)
@@ -10,7 +10,7 @@
 LIBS+=	${OBJC_FOUNDATION_LIBS}
 
 clean::
-	rm -f *.d
+	rm -f *.o
 
 distclean::
 	rm -f Makefile


Property changes on: branches/new-help-system/base/src/tclobjc1.0/Makefile.in
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/objc_encoding.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/objc_encoding.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/tclobjc.h
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/tclobjc.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.h
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m
===================================================================
--- branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m	2010-03-28 16:55:01 UTC (rev 65589)
@@ -110,7 +110,7 @@
 
 	/* objPtr->bytes must be allocated with Tcl_Alloc */
 	objPtr->bytes = Tcl_Alloc(length);
-	strcpy(objPtr->bytes, string);
+	strncpy(objPtr->bytes, string, length);
 	free(string);
 }
 


Property changes on: branches/new-help-system/base/src/tclobjc1.0/tclobjc_types.m
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: branches/new-help-system/base/src/thread2.6.diff
___________________________________________________________________
Deleted: svn:keywords
   - Id

Modified: branches/new-help-system/base/src/upgrade_sources_conf_default.tcl
===================================================================
--- branches/new-help-system/base/src/upgrade_sources_conf_default.tcl	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/src/upgrade_sources_conf_default.tcl	2010-03-28 16:55:01 UTC (rev 65589)
@@ -41,15 +41,39 @@
          } elseif {[regexp {rsync://rsync\.(macports|darwinports)\.org/(release|dpupdate)/d?ports} $url]} {
             set addDefault true
          } elseif {[regexp {file://(/.+)} $url -> filepath]} {
-            if {[file exists [file join ${filepath} .svn]] && ![catch {set svnChannel [open "|svn info ${filepath}" r]}]} {
-               set svnURL {}
-               while {[gets $svnChannel svnLine] >= 0} {
-                  regexp {^URL: (.*)} $svnLine -> svnURL
+            if {[file exists [file join ${filepath} .svn]]} {
+               if {![info exists svnCmd]} {
+                  set svnCmd ""
+                  foreach path [concat [list ${prefix}/bin] [split $env(PATH) :]] {
+                     if {[file executable ${path}/svn]} {
+                        set svnCmd ${path}/svn
+                        break
+                     }
+                  }
                }
-               close $svnChannel
-               if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
-                  set addDefault true
+               if {$svnCmd == ""} {
+                  puts "WARNING: Unable to check svn URL for '$filepath' because no svn command could be found; please manually verify $sourcesConf!"
+                  continue
                }
+               if {![catch {set svnChannel [open "|$svnCmd info ${filepath}" r]} err]} {
+                  set svnURL {}
+                  while {[gets $svnChannel svnLine] >= 0} {
+                     regexp {^URL: (.*)} $svnLine -> svnURL
+                  }
+                  if {[catch {close $svnChannel} err]} {
+                     if {![string match "*This client is too old to work with working copy*" $err]} {
+                        return -code error $err
+                     } else {
+                        puts $err
+                        puts "WARNING: Unable to check svn URL for '$filepath' as it has been checked out with a newer Subversion client; please manually verify $sourcesConf!"
+                     }
+                  }
+                  if {[regexp {^https?://svn\.(macports|macosforge)\.org/repository/macports/trunk/dports} $svnURL]} {
+                     set addDefault true
+                  }
+               } else {
+                  return -code error $err
+               }
             }
          }
          if {$addDefault} {
@@ -83,7 +107,7 @@
 needs to have a \[default\] tag added to the primary MacPorts repository,
 however the proper entry could not be determined.  Please add the tag
 manually by either appending \[default\] to the end of the correct line,
-or if there are already tags, adding it to the list, eg,
+or if there are already tags, adding it to the list, e.g.
 \[nosync,default\].
 [string repeat - 72]"
    }


Property changes on: branches/new-help-system/base/src/upgrade_sources_conf_default.tcl
___________________________________________________________________
Added: svn:eol-style
   + native

Modified: branches/new-help-system/base/tests/Makefile
===================================================================
--- branches/new-help-system/base/tests/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -21,15 +21,14 @@
 	cp sources.conf /tmp/macports-tests/opt/local/etc/macports/
 
 /tmp/macports-tests/ports/PortIndex: /tmp/macports-tests/opt/local/etc/macports/sources.conf PortIndex
-	cp PortIndex /tmp/macports-tests/ports/PortIndex
+	cp PortIndex PortIndex.quick /tmp/macports-tests/ports/
 
 PortIndex:
 	$(bindir)/portindex
 
 clean:
 	rm -rf /tmp/macports-tests/
-	rm -f PortIndex
-	rm -f PortIndex.quick
+	rm -f PortIndex PortIndex.quick
 	for testname in $(TESTS); do \
 		rm -f test/$$testname/{output,output.sed,difference,work}; \
 	done
@@ -52,7 +51,7 @@
 			( cd $$subdir && \
 				PORTSRC=$(PWD)/test-macports.conf $(bindir)/port clean > /dev/null && \
 				PORTSRC=$(PWD)/test-macports.conf $(bindir)/port test > output 2>&1 \
-					|| (cat output; exit 1) && \
+					|| ([ -e error_expected ] || (cat output; exit 1)) && \
 			sed -e "s|${PWD}|PWD|g" < output > output.sed && \
 			diff output.sed master 2>&1 | tee difference && \
 			if [ -s difference ]; then \
@@ -63,7 +62,7 @@
 		fi || exit 1; \
 	done
 	@rm -rf /tmp/macports-tests/
-	@rm -f PortIndex
+	@rm -f PortIndex PortIndex.quick
 
 # Run specific test
 # Prepend the directory name with "test-" and use it as target

Modified: branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile
===================================================================
--- branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/case-insensitive-deactivate/Makefile	2010-03-28 16:55:01 UTC (rev 65589)
@@ -14,13 +14,13 @@
 test:
 	@echo port install $(TESTPORT1)
 	@sed 's/@name@/$(TESTPORT1)/' Portfile.in > Portfile
-	@PORTSRC=$(PORTSRC) $(bindir)/port -x install > output 2>&1 || (cat output; exit 1)
+	@PORTSRC=$(PORTSRC) $(bindir)/port install > output 2>&1 || (cat output; exit 1)
 	@if [ ! -f $(TESTFILE) ]; then \
 		echo "FAILED: File should exist after install: $(TESTFILE)" && exit 1; \
 	fi
 	@echo port uninstall $(TESTPORT2)
 	@sed 's/@name@/$(TESTPORT2)/' Portfile.in > Portfile
-	@PORTSRC=$(PORTSRC) $(bindir)/port -x uninstall > output 2>&1 || (cat output; exit 1)
+	@PORTSRC=$(PORTSRC) $(bindir)/port uninstall > output 2>&1 || (cat output; exit 1)
 	@if [ -f $(TESTFILE) ]; then \
 		rm $(TESTFILE); \
 		echo "FAILED: File should NOT exist after uninstall: $(TESTFILE)" && exit 1; \

Modified: branches/new-help-system/base/tests/test/checksums-1/master
===================================================================
--- branches/new-help-system/base/tests/test/checksums-1/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/checksums-1/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for checksum
 --->  Fetching checksum
 --->  Verifying checksum(s) for checksum
 --->  Extracting checksum

Modified: branches/new-help-system/base/tests/test/cvs-and-patchsites/master
===================================================================
--- branches/new-help-system/base/tests/test/cvs-and-patchsites/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/cvs-and-patchsites/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for cvs-and-patchsites
 --->  Fetching cvs-and-patchsites
 --->  Attempting to fetch patch-1.5.14.dgc.xlabel_ext.9 from http://home.uchicago.edu/~dgc/sw/mutt/
 --->  Verifying checksum(s) for cvs-and-patchsites

Modified: branches/new-help-system/base/tests/test/dependencies-c/master
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-c/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/dependencies-c/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for dependencies-c
 --->  Fetching dependencies-b
 --->  Verifying checksum(s) for dependencies-b
 --->  Extracting dependencies-b

Modified: branches/new-help-system/base/tests/test/dependencies-d/master
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-d/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/dependencies-d/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,5 +1,6 @@
 Warning: depends option is not handled yet
 Warning: depends option is not handled yet
+--->  Computing dependencies for dependencies-d
 --->  Fetching dependencies-b
 --->  Verifying checksum(s) for dependencies-b
 --->  Extracting dependencies-b

Modified: branches/new-help-system/base/tests/test/dependencies-e/master
===================================================================
--- branches/new-help-system/base/tests/test/dependencies-e/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/dependencies-e/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,2 +1,3 @@
+--->  Computing dependencies for dependencies-e
 Error: Dependency 'docbook-xml-4.1.2' not found.
 Error: Status 1 encountered during processing.

Modified: branches/new-help-system/base/tests/test/envvariables/master
===================================================================
--- branches/new-help-system/base/tests/test/envvariables/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/envvariables/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for envvariables
 --->  Fetching envvariables
 --->  Verifying checksum(s) for envvariables
 --->  Extracting envvariables

Modified: branches/new-help-system/base/tests/test/site-tags/master
===================================================================
--- branches/new-help-system/base/tests/test/site-tags/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/site-tags/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for site-tags
 --->  Fetching site-tags
 --->  Attempting to fetch app-bm.tar.gz from http://www.douglas.stebila.ca/code/vim/app/
 --->  Attempting to fetch doc.tar.gz from http://www.douglas.stebila.ca/code/vim/doc/

Modified: branches/new-help-system/base/tests/test/trace/master
===================================================================
--- branches/new-help-system/base/tests/test/trace/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/trace/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for trace
 --->  Fetching trace
 --->  Verifying checksum(s) for trace
 --->  Extracting trace

Modified: branches/new-help-system/base/tests/test/universal-2/master
===================================================================
--- branches/new-help-system/base/tests/test/universal-2/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/universal-2/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,2 +1 @@
-no info for 'variants'
 variants: 

Modified: branches/new-help-system/base/tests/test/variants/master
===================================================================
--- branches/new-help-system/base/tests/test/variants/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/variants/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,5 +1,6 @@
 Utopia platform -- 1
-Utopia platform -- 2
+Utopia platform -- 1
+--->  Computing dependencies for variants
 --->  Fetching variants
 --->  Verifying checksum(s) for variants
 --->  Extracting variants

Modified: branches/new-help-system/base/tests/test/xcodeversion/master
===================================================================
--- branches/new-help-system/base/tests/test/xcodeversion/master	2010-03-28 16:54:35 UTC (rev 65588)
+++ branches/new-help-system/base/tests/test/xcodeversion/master	2010-03-28 16:55:01 UTC (rev 65589)
@@ -1,3 +1,4 @@
+--->  Computing dependencies for xcodeversion
 --->  Fetching xcodeversion
 --->  Verifying checksum(s) for xcodeversion
 --->  Extracting xcodeversion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100328/2d0cfb4b/attachment-0001.html>


More information about the macports-changes mailing list