diff -uNr --exclude=.svn base.orig/src/pextlib1.0/Makefile base/src/pextlib1.0/Makefile
--- base.orig/src/pextlib1.0/Makefile	2008-03-28 01:27:14.000000000 -0600
+++ base/src/pextlib1.0/Makefile	2008-03-28 01:08:02.000000000 -0600
@@ -1,7 +1,7 @@
 OBJS=		Pextlib.o strsed.o fgetln.o md5cmd.o setmode.o xinstall.o \
 		fs-traverse.o strcasecmp.o vercomp.o filemap.o \
 		sha1cmd.o compat.o curl.o rmd160cmd.o readline.o uid.o\
-		tracelib.o
+		tracelib.o proxyfromsystemconfiguration.o
 SHLIB_NAME=	Pextlib${SHLIB_SUFFIX}
 INSTALLDIR= ${DESTDIR}${datadir}/macports/Tcl/pextlib1.0
 export MACOSX_DEPLOYMENT_TARGET=10.3
@@ -11,7 +11,9 @@
 
 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
 
 test:: ${SHLIB_NAME}
diff -uNr --exclude=.svn base.orig/src/pextlib1.0/Pextlib.c base/src/pextlib1.0/Pextlib.c
--- base.orig/src/pextlib1.0/Pextlib.c	2008-03-28 01:27:14.000000000 -0600
+++ base/src/pextlib1.0/Pextlib.c	2008-03-28 00:54:12.000000000 -0600
@@ -114,6 +114,7 @@
 #include "readline.h"
 #include "uid.h"
 #include "tracelib.h"
+#include "proxyfromsystemconfiguration.h"
 
 #if HAVE_CRT_EXTERNS_H
 #include <crt_externs.h>
@@ -1167,6 +1168,7 @@
 	Tcl_CreateObjCommand(interp, "gid_to_name", gid_to_nameCmd, NULL, NULL);
 	
 	Tcl_CreateObjCommand(interp, "tracelib", TracelibCmd, NULL, NULL);
+	Tcl_CreateObjCommand(interp, "proxyfromsystemconfiguration", getProxyFromSystemConfigurationCmd, NULL, NULL);
 
 	if (Tcl_PkgProvide(interp, "Pextlib", "1.0") != TCL_OK)
 		return TCL_ERROR;
diff -uNr --exclude=.svn base.orig/src/pextlib1.0/proxyfromsystemconfiguration.c base/src/pextlib1.0/proxyfromsystemconfiguration.c
--- base.orig/src/pextlib1.0/proxyfromsystemconfiguration.c	1969-12-31 17:00:00.000000000 -0700
+++ base/src/pextlib1.0/proxyfromsystemconfiguration.c	2008-03-28 00:58:24.000000000 -0600
@@ -0,0 +1,182 @@
+/*
+ * proxyfromsystemconfiguration.c
+ * $Id: $
+ *
+ * Copyright (c) 2008, 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 "proxyfromsystemconfiguration.h"
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+#include <CoreFoundation/CoreFoundation.h>
+#include <SystemConfiguration/SystemConfiguration.h>
+
+int setProxyInfoForEnvWithKeys( CFDictionaryRef proxies, const char *envName, const void *enabledKey, const void *hostKey, const void *portKey );
+char *cfStringToCStringASCII( CFStringRef cfString );
+
+#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
+
+
+/**
+ *
+ * Set various libcurl-specific environment variables based on settings
+ * gleaned from the SystemConfiguration framework on Mac OS X.  If this
+ * Is run on a non-Mac system, it does nothing
+ *
+ * Synopsis: getproxyfromsystemconfiguration
+ */
+int getProxyFromSystemConfigurationCmd( ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED )
+{
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+    int result = 0;
+    CFDictionaryRef proxies = SCDynamicStoreCopyProxies( NULL );
+    if( proxies != NULL )
+    {
+        if( !setProxyInfoForEnvWithKeys( proxies, "http_proxy", kSCPropNetProxiesHTTPEnable, kSCPropNetProxiesHTTPProxy, kSCPropNetProxiesHTTPPort ) )
+        {
+            if( !setProxyInfoForEnvWithKeys( proxies, "HTTPS_PROXY", kSCPropNetProxiesHTTPSEnable, kSCPropNetProxiesHTTPSProxy, kSCPropNetProxiesHTTPSPort ) )
+            {
+                if( !setProxyInfoForEnvWithKeys( proxies, "FTP_PROXY", kSCPropNetProxiesFTPEnable, kSCPropNetProxiesFTPProxy, kSCPropNetProxiesFTPPort ) )
+                {
+                    CFArrayRef exceptionsList = CFDictionaryGetValue( proxies, kSCPropNetProxiesExceptionsList );
+                    if( exceptionsList != NULL )
+                    {
+                        CFStringRef exceptionsCommaSeparated = CFStringCreateByCombiningStrings( kCFAllocatorDefault, exceptionsList, CFSTR( "," ) );
+                        char *cStringList = cfStringToCStringASCII( exceptionsCommaSeparated );
+                        if( cStringList != NULL )
+                        {
+                            setenv( "NO_PROXY", cStringList, 0 );
+                            free( cStringList );
+                        }
+                        else
+                            result = -1;
+                        CFRelease( exceptionsCommaSeparated );
+                    }
+                }
+                else
+                    result = -1;
+            }
+            else
+                result = -1;
+        }
+        else
+            result = -1;
+
+        CFRelease( proxies );
+    }
+
+    if( result == -1 )
+    {
+        Tcl_SetResult( interp, (char *) Tcl_PosixError( interp ), TCL_STATIC );
+        return TCL_ERROR;
+    }
+    return TCL_OK;
+#else    /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
+   return TCL_OK;
+#endif   /* HAVE_FRAMEWORK_SYSTEMCONFIGURATION */
+}
+
+
+#ifdef HAVE_FRAMEWORK_SYSTEMCONFIGURATION
+/**
+ *
+ * Set an environment variable based on the given SystemConfiguration
+ * dictionary keys.
+ *
+ * Returns 0 on success; -1 on failure (to allocate memory)
+ */
+int setProxyInfoForEnvWithKeys( CFDictionaryRef proxies, const char *envName, const void *enabledKey, const void *hostKey, const void *portKey )
+{
+    int result = 0;
+    CFNumberRef proxyEnabledNumber = CFDictionaryGetValue( proxies, enabledKey );
+    if( proxyEnabledNumber != NULL )
+    {
+        int proxyEnabled;
+        CFNumberGetValue( proxyEnabledNumber, kCFNumberIntType, &proxyEnabled );
+        if( proxyEnabled )
+        {
+            CFStringRef proxyHost = CFDictionaryGetValue( proxies, hostKey );
+            if( proxyHost != NULL )
+            {
+                char *hostname = cfStringToCStringASCII( proxyHost );
+                if( hostname != NULL )
+                {
+                    CFNumberRef proxyPort = CFDictionaryGetValue( proxies, portKey );
+                    int port = 0;
+                    if( proxyPort != NULL )
+                        CFNumberGetValue( proxyPort, kCFNumberIntType, &port );
+
+                    if( port > 0 )
+                    {
+                        /* hostname:12345\0 is adding up to 7 chars... */
+                        int newLength = strlen( hostname ) + 7;
+                        char *hostAndPort = calloc( 1, newLength );
+                        if( hostAndPort != NULL )
+                        {
+                            snprintf( hostAndPort, newLength, "%s:%d", hostname, port );
+                            setenv( envName, hostAndPort, 0 );
+                            free( hostAndPort );
+                        }
+                        else
+                            result = -1;
+                    }
+                    else
+                       setenv( envName, hostname, 0 );
+                    free( hostname );
+                }
+                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
+
diff -uNr --exclude=.svn base.orig/src/pextlib1.0/proxyfromsystemconfiguration.h base/src/pextlib1.0/proxyfromsystemconfiguration.h
--- base.orig/src/pextlib1.0/proxyfromsystemconfiguration.h	1969-12-31 17:00:00.000000000 -0700
+++ base/src/pextlib1.0/proxyfromsystemconfiguration.h	2008-03-28 00:54:36.000000000 -0600
@@ -0,0 +1,41 @@
+/*
+ * proxyfromsystemconfiguration.h
+ * $Id: $
+ *
+ * Copyright (c) 2008, 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 _PROXYFROMSYSTEMCONFIGURATION_H
+#define _PROXYFROMSYSTEMCONFIGURATION_H
+
+#include <tcl.h>
+
+int getProxyFromSystemConfigurationCmd( ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] );
+
+#endif   /* _PROXYFROMSYSTEMCONFIGURATION_H */
+
diff -uNr --exclude=.svn base.orig/src/port1.0/portfetch.tcl base/src/port1.0/portfetch.tcl
--- base.orig/src/port1.0/portfetch.tcl	2008-03-28 01:27:23.000000000 -0600
+++ base/src/port1.0/portfetch.tcl	2008-03-28 01:12:24.000000000 -0600
@@ -466,7 +466,9 @@
 	if {$portverbose == "yes"} {
 		lappend fetch_options "-v"
 	}
-	
+
+	proxyfromsystemconfiguration
+
 	foreach {url_var distfile} $fetch_urls {
 		if {![file isfile $distpath/$distfile]} {
 			ui_info "$UI_PREFIX [format [msgcat::mc "%s doesn't seem to exist in %s"] $distfile $distpath]"
