Index: wp-includes/default-filters.php
===================================================================
--- wp-includes/default-filters.php	(revision 5072)
+++ wp-includes/default-filters.php	(working copy)
@@ -145,6 +145,8 @@
 // Misc filters
 add_filter('option_ping_sites', 'privacy_ping_filter');
 add_filter('option_blog_charset', 'wp_specialchars');
+add_filter('option_home', '_config_wp_home');
+add_filter('option_siteurl', '_config_wp_siteurl');
 add_filter('mce_plugins', '_mce_load_rtl_plugin');
 add_filter('mce_buttons', '_mce_add_direction_buttons');
 
@@ -171,4 +173,4 @@
 add_action('admin_print_scripts', 'wp_print_scripts', 20);
 add_action('mce_options', '_mce_set_direction');
 add_action('init', 'smilies_init', 5);
-?>
\ No newline at end of file
+?>
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 5072)
+++ wp-includes/functions.php	(working copy)
@@ -993,7 +993,9 @@
 	$wpdb->hide_errors();
 	$installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
 	$wpdb->show_errors();
-	return $installed;
+
+	$install_status = !empty( $installed ) ? TRUE : FALSE;
+	return $install_status;
 }
 
 function wp_nonce_url($actionurl, $action = -1) {
@@ -1351,6 +1353,18 @@
 	die();
 }
 
+function _config_wp_home($url = '') {
+	if ( defined( 'WP_HOME' ) ) 
+		return WP_HOME;
+	else return $url;
+}
+
+function _config_wp_siteurl($url = '') {
+	if ( defined( 'WP_SITEURL' ) ) 
+		return WP_SITEURL;
+	else return $url;
+}
+
 function _mce_set_direction() {
 	global $wp_locale;
 
@@ -1443,4 +1457,4 @@
 	}
 }
 
-?>
\ No newline at end of file
+?>
Index: wp-admin/upgrade-functions.php
===================================================================
--- wp-admin/upgrade-functions.php	(revision 5072)
+++ wp-admin/upgrade-functions.php	(working copy)
@@ -21,7 +21,12 @@
 	update_option('admin_email', $user_email);
 	update_option('blog_public', $public);
 	$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
-	$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+
+	if( defined('WP_SITEURL') && '' != WP_SITEURL ) {
+		$guessurl = WP_SITEURL;
+	} else {
+		$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+	}
 	update_option('siteurl', $guessurl);
 
 	// If not a public blog, don't ping.
Index: wp-admin/options-general.php
===================================================================
--- wp-admin/options-general.php	(revision 5072)
+++ wp-admin/options-general.php	(working copy)
@@ -25,11 +25,11 @@
 </tr> 
 <tr valign="top"> 
 <th scope="row"><?php _e('WordPress address (URL):') ?></th> 
-<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code" /></td> 
+<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td> 
 </tr> 
 <tr valign="top">
 <th scope="row"><?php _e('Blog address (URL):') ?></th>
-<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code" /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
+<td><input name="home" type="text" id="home" value="<?php form_option('home'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?php _e('If you want your blog homepage <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory">to be different than the directory</a> you installed WordPress in, enter that address here.'); ?></td>
 </tr>
 <tr valign="top"> 
 <th scope="row"><?php _e('E-mail address:') ?> </th> 
