[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