diff --git a/configure.ac b/configure.ac
index 32c2265..de48149 100644
--- a/configure.ac
+++ b/configure.ac
@@ -202,7 +202,7 @@ AC_SUBST([with_engine])
 # Mozilla
 # *******
 
-if test "$with_engine" = "mozilla"; then
+if test "x$with_engine" = "xmozilla"; then
 
 GECKO_INIT([GECKO])
 
@@ -220,7 +220,7 @@ if test "$gecko_cv_gecko_version_int" -lt "1008000"; then
 	AC_MSG_ERROR([Gecko version $gecko_cv_gecko_version is not supported!])
 fi
 
-if test "$gecko_cv_gecko_flavour" != "toolkit"; then
+if test "x$gecko_cv_gecko_flavour" != "xtoolkit"; then
 	AC_MSG_ERROR(["$gecko_cv_gecko_flavour" flavoured geckos aren't tasty enough!])
 fi
 
@@ -290,7 +290,7 @@ status = classID->Equals (badClassID) ? 97 : EXIT_SUCCESS;
 
 AC_MSG_RESULT([$have_broken_typeaheadfind])
 
-if test "$have_broken_typeaheadfind" = "yes"; then
+if test "x$have_broken_typeaheadfind" = "xyes"; then
 	AC_MSG_ERROR([You must not compile $gecko_cv_gecko with the "typeaheadfind" extension enabled!])
 fi
 
@@ -304,30 +304,31 @@ AC_MSG_CHECKING([whether to include PSM support])
 AC_ARG_ENABLE([psm],
 	AS_HELP_STRING([--disable-psm],[Disable PSM support (default: enabled)]),
 	[],[enable_psm=yes])
-AC_MSG_RESULT([$enable_psm])
 
-if test "$enable_psm" = "yes" -a "$have_psm" = "no"; then
+if test "x$enable_psm" = "xyes" && test "x$have_psm" = "xno"; then
 	AC_MSG_ERROR([PSM headers not found; use --disable-psm to disable building with PSM support])
-elif test "$have_psm" = "no"; then
+elif test "x$have_psm" = "xno"; then
 	AC_MSG_WARN([PSM headers not found; PSM support disabled])
 fi
 
-if test "$enable_psm" = "yes" -a "$have_psm" = "yes"; then
-	AC_DEFINE([HAVE_MOZILLA_PSM],[1],[Define if you have the mozilla NSS headers installed]) 
+if test "x$enable_psm" = "xyes" && test "x$have_psm" = "xyes"; then
+        AC_DEFINE([HAVE_MOZILLA_PSM],[1],[Define if you have the mozilla NSS headers installed]) 
 fi
 
+AC_MSG_RESULT([$have_psm])
+
 # Check whether to enable our filepicker component
 
 AC_MSG_CHECKING([whether to enable native gtk+ filepicker])
 AC_ARG_ENABLE([filepicker],
 	AS_HELP_STRING([--enable-filepicker],[Whether to enable the gtk+ native filepicker; not needed when the mozilla build itself has native gtk+ filepicker enabled (default:enabled)]),
-	[],[enable_filepicker=no])
+	[ if test "x$enableval" = "xyes"; then
+        	AC_DEFINE([ENABLE_FILEPICKER],[1],[Define to enable the native filepicker])
+          fi                
+        ],
+        [enable_filepicker=no])
 AC_MSG_RESULT([$enable_filepicker])
 
-if test "$enable_filepicker" = "yes"; then
-	AC_DEFINE([ENABLE_FILEPICKER],[1],[Define to enable the native filepicker])
-fi
-
 # Check for nsINonBlockingAlertService
 # Added in 1.8.1 and 1.9
 
@@ -365,10 +366,10 @@ GECKO_CHECK_CONTRACTIDS([$REQUIRED_CONTRACTS],
 fi # with_engine = mozilla
 
 GECKO_DEFINES
-AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "$with_engine" = "mozilla"])
-AM_CONDITIONAL([HAVE_XULRUNNER],[test "$gecko_cv_gecko" = "xulrunner"])
-AM_CONDITIONAL([HAVE_MOZILLA_PSM],[test "$enable_psm" = "yes" -a "$have_psm" = "yes"])
-AM_CONDITIONAL([ENABLE_FILEPICKER],[test "$enable_filepicker" = "yes"])
+AM_CONDITIONAL([WITH_GECKO_ENGINE], [test "x$with_engine" = "xmozilla"])
+AM_CONDITIONAL([HAVE_XULRUNNER],[test "x$gecko_cv_gecko" = "xxulrunner"])
+AM_CONDITIONAL([HAVE_MOZILLA_PSM],[test "x$enable_psm" = "xyes" && test "x$have_psm" = "xyes"])
+AM_CONDITIONAL([ENABLE_FILEPICKER],[test "x$enable_filepicker" = "xyes"])
 
 # *********
 # Xulrunner
@@ -376,7 +377,7 @@ AM_CONDITIONAL([ENABLE_FILEPICKER],[test "$enable_filepicker" = "yes"])
 
 # This is the mozilla backend for xulrunner 1.9
 
-if test "$with_engine" = "xulrunner"; then
+if test "x$with_engine" = "xxulrunner"; then
 
 LIBXUL_INIT
 
@@ -386,24 +387,24 @@ WEASEL_UA_VERSION=3.0
 AC_SUBST([WEASEL_UA_VERSION])
 
 
-fi
+fi # with_engine = xulrunner
 
 LIBXUL_DEFINES
 
-AM_CONDITIONAL([WITH_XULRUNNER_ENGINE],[test "$with_engine" = "xulrunner"])
+AM_CONDITIONAL([WITH_XULRUNNER_ENGINE],[test "x$with_engine" = "xxulrunner"])
 
 # ******
 # WebKit
 # ******
 
-if test "$with_engine" = "webkit" ; then
+if test "x$with_engine" = "xwebkit" ; then
    AC_DEFINE([WITH_WEBKIT_ENGINE],[1],[Define if you wish to enable webkit engine])
    PKG_CHECK_MODULES([WEBKIT], WebKitGtk)
    AC_SUBST([WEBKIT_CFLAGS])
    AC_SUBST([WEBKIT_LIBS])
 fi # with_engine = webkit
 
-AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "$with_engine" = "webkit")
+AM_CONDITIONAL([WITH_WEBKIT_ENGINE], test "x$with_engine" = "xwebkit")
 
 # ***************
 # Multimedia keys
@@ -543,28 +544,28 @@ AC_SUBST([EPIPHANY_FEATURES])
 # Plugins
 # *******
 
+if test "x$with_engine" = "xmozilla"; then
 # Gecko 1.9 can handle .desktop files from file: URLs itself, but we
 # also support windows .lnk files, so always enable this plugin
-
-if test "$with_engine" = "mozilla" ; then
-
 AC_MSG_CHECKING([whether to build the deskop file plugin])
 AC_ARG_ENABLE([desktop-file-plugin],
 	AS_HELP_STRING([--disable-desktop-file-plugin],[Disable the desktop file plugin (default: enabled)]),
 	[],[enable_desktop_file_plugin=yes])
-AC_MSG_RESULT([$enable_desktop_file_plugin])
+
+AC_MSG_RESULT([$enable_desktop_file_plugin]) 
 
 if test "x$enable_desktop_file_plugin" = "xyes"; then
-	PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0])
+        PKG_CHECK_MODULES([DESKTOP_FILE_PLUGIN_DEP],[${gecko_cv_gecko}-xpcom ${gecko_cv_gecko}-plugin gtk+-2.0 >= 2.6.0])
 	AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_CFLAGS])
-	AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_LIBS])
+        AC_SUBST([DESKTOP_FILE_PLUGIN_DEP_LIBS])
+        AC_DEFINE([HAVE_PRIVATE_PLUGINS],[1],[Define if any private plugins are enabled])
 fi
 
-if test "x$enable_desktop_file_plugin" = "xyes"; then
-	AC_DEFINE([HAVE_PRIVATE_PLUGINS],[1],[Define if any private plugins are enabled])
-fi
+else # end with_engine = mozilla 
 
-fi # with_engine = mozilla
+        ${enable_desktop_file_plugin="no"}
+
+fi   # end with_engine != mozilla
 
 AM_CONDITIONAL([ENABLE_DESKTOP_FILE_PLUGIN],[test "x$enable_desktop_file_plugin" = "xyes"])
 
@@ -573,98 +574,87 @@ AM_CONDITIONAL([ENABLE_DESKTOP_FILE_PLUGIN],[test "x$enable_desktop_file_plugin"
 # *******************
 
 # Zeroconf bookmarks sites
-
 AC_MSG_CHECKING([whether to enable zeroconf bookmarks support])
 AC_ARG_ENABLE([zeroconf],
-	AS_HELP_STRING([--disable-zeroconf],[Whether to enable zeroconf bookmarks support (default: enabled)]),
-	[], [enable_zeroconf=yes])
+	AS_HELP_STRING([--disable-zeroconf],[Whether to disable zeroconf bookmarks support (default: enabled)]),
+	[],[enable_zeroconf=yes])
 AC_MSG_RESULT([$enable_zeroconf])
 
 if test "x$enable_zeroconf" = "xyes"; then
-	AC_DEFINE([ENABLE_ZEROCONF],[1],[Define to enable zeroconf bookmarks support])
+        AC_DEFINE([ENABLE_ZEROCONF],[1],[Define to enable zeroconf bookmarks support])
 fi
 
 AM_CONDITIONAL([ENABLE_ZEROCONF],[test "x$enable_zeroconf" = "xyes"])
 
 # Certificates manager
-
-if test "$enable_psm" = "yes"; then
-
+if test "x$with_engine" = "xmozilla" && test "x$enable_psm" = "xyes"; then
+# only include if mozilla and psm exist
 AC_MSG_CHECKING([whether to build the certificates manager])
 AC_ARG_ENABLE([certificate-manager],
 	AS_HELP_STRING([--enable-certificate-manager],[Whether to enable the certificate manager (experimental; default:disabled)]),
 	[],[enable_certificate_manager=no])
 AC_MSG_RESULT([$enable_certificate_manager])
 
+if test "x$enable_certificate_manager" = "xyes"; then
+        AC_DEFINE([ENABLE_CERTIFICATE_MANAGER],[1],[Define to enable the certificate manager build])
 fi
 
-if test "$enable_certificate_manager" = "yes"; then
-	AC_DEFINE([ENABLE_CERTIFICATE_MANAGER],[1],[Define to enable the certificate manager build])
-fi
+else # end with_engine = mozilla and enable_psm = yes
 
-AM_CONDITIONAL([ENABLE_CERTIFICATE_MANAGER],[test "$enable_certificate_manager" = "yes"])
+        ${enable_certificate_manager="no"}
 
-# NetworkManager
+fi   # end with_engine != mozilla and psm is disabled
+
+AM_CONDITIONAL([ENABLE_CERTIFICATE_MANAGER],[test "x$enable_certificate_manager" = "xyes"])
 
+# NetworkManager
 AC_MSG_CHECKING([whether to enable NetworkManager support])
 AC_ARG_ENABLE([network-manager],
 	AS_HELP_STRING([--enable-network-manager],[Whether to enable automatic network status with NetworkManager (default: disabled)]),
-	[],[enable_network_manager=no])
+	[ if test "x$enableval" = "xyes"; then
+        	AC_CHECK_HEADERS([NetworkManager/NetworkManager.h],
+	        	[have_network_manager=yes],
+                        [AC_MSG_WARN([NetworkManager support requested but NetworkManager headers not found; ignoring request...])])
+                AC_DEFINE([ENABLE_NETWORK_MANAGER],[1],[Define for NetworkManager support])
+          fi
+        ],
+        [enable_network_manager=no])
 AC_MSG_RESULT([$enable_network_manager])
 
-if test "$enable_network_manager" != "no"; then
-	AC_CHECK_HEADERS([NetworkManager/NetworkManager.h],
-		[have_network_manager=yes],[have_network_manager=no])
-
-	if test "$enable_network_manager" = "yes" -a "$have_network_manager" = "no"; then
-		AC_MSG_ERROR([NetworkManager support requested but NetworkManager headers not found])
-	elif test "$have_network_manager" = "no"; then
-		AC_MSG_WARN([NetworkManager headers not found; disabling NetworkManager support])
-	fi
-fi
-
-if test "$enable_network_manager" = "yes"; then
-	AC_DEFINE([ENABLE_NETWORK_MANAGER],[1],[Define for NetworkManager support])
-fi
-
-AM_CONDITIONAL([ENABLE_NETWORK_MANAGER],[test "$enable_network_manager" = "yes"])
+AM_CONDITIONAL([ENABLE_NETWORK_MANAGER],[test "x$enable_network_manager" = "xyes" && test "x$have_network_manager" = "xyes"])
 
 # Enchant spell checking
-# Does not appear to work on gecko 1.8.0, so only offer for >= 1.8.1
-
-if test "$with_engine" = "mozilla" ; then
+if test "x$with_engine" = "xmozilla" ; then
 
+# Does not appear to work on gecko 1.8.0, so only offer for >= 1.8.1
 if test "$gecko_cv_gecko_version_int" -ge "1008001"; then
-
 # Default to 'disabled' until it's fully functional
 AC_MSG_CHECKING([whether spell checking support is requested])
 AC_ARG_ENABLE([spell-checker],
 	AS_HELP_STRING([--enable-spell-checker],[Whether to enable spell checking using enchant]),
-	[],[enable_spell_checker=no])
+	[ if test "x$enableval" = "xyes" && test "x$have_gecko_spell_checker" = "xno"; then
+        	AC_MSG_ERROR([Spell check support requested but $gecko_cv_gecko was not compiled with spellchecker extension enabled.])
+          elif test "x$enableval" = "xyes" && test "x$have_gecko_spell_checker" = "xyes"; then
+          	# FIXME check which version we really need
+                ${enable_spell_checker="yes"}
+               	ENCHANT_REQUIRED=1.0
+                PKG_CHECK_MODULES([SPELLCHECKER],[enchant >= $ENCHANT_REQUIRED])
+                AC_SUBST([SPELLCHECKER_CFLAGS])
+                AC_SUBST([SPELLCHECKER_LIBS])
+                AC_DEFINE([ENABLE_SPELLCHECKER],[1],[Define to enable the spell checker])
+          fi
+        ],
+        [enable_spell_checker=no])
 AC_MSG_RESULT([$enable_spell_checker])
-
-else
-	enable_spell_checker=no
 fi # gecko >= 1.8.1
 
-if test "$enable_spell_checker" = "yes" -a "$have_gecko_spell_checker" != "yes"; then
-	AC_MSG_ERROR([Spell check support requested but $gecko_cv_gecko was not compiled with 'spellchecker' extension enabled.])
-fi
-
-if test "$enable_spell_checker" = "yes" -a "$have_gecko_spell_checker" = "yes"; then
-	# FIXME check which version we really need
-	ENCHANT_REQUIRED=1.0
+else # end with_engine = mozilla
 
-	PKG_CHECK_MODULES([SPELLCHECKER],[enchant >= $ENCHANT_REQUIRED])
-	AC_SUBST([SPELLCHECKER_CFLAGS])
-	AC_SUBST([SPELLCHECKER_LIBS])
-
-	AC_DEFINE([ENABLE_SPELLCHECKER],[1],[Define to enable the spell checker])
-fi
+        ${enable_spell_checker="no"}
 
-fi # with_engine = mozilla
+fi   # end with_engine != mozilla
 
-AM_CONDITIONAL([ENABLE_SPELLCHECKER],[test "$enable_spell_checker" = "yes" -a "$have_gecko_spell_checker" = "yes"])
+AM_CONDITIONAL([ENABLE_SPELLCHECKER],[test "x$enable_spell_checker" = "xyes" && test "x$have_gecko_spell_checker" = "xyes"])
 
 # ************
 # Misc defines
@@ -694,7 +684,7 @@ ISO_CODES_REQUIRED=0.35
 PKG_CHECK_EXISTS([iso-codes >= $ISO_CODES_REQUIRED],
 	[have_iso_codes=yes],[have_iso_codes=no])
 
-if test "$have_iso_codes" = "yes"; then
+if test "x$have_iso_codes" = "xyes"; then
 	AC_MSG_CHECKING([whether iso-codes has iso-639 and iso-3166 domains])
 	if $PKG_CONFIG --variable=domains iso-codes | grep -q 639 && \
 	   $PKG_CONFIG --variable=domains iso-codes | grep -q 3166 ; then
@@ -706,7 +696,7 @@ if test "$have_iso_codes" = "yes"; then
 	AC_MSG_RESULT([$result])
 fi
 
-if test "$have_iso_codes" = "yes"; then
+if test "x$have_iso_codes" = "xyes"; then
 	AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes`"],[ISO codes prefix])
 	AC_DEFINE([HAVE_ISO_CODES],[1],[Define if you have the iso-codes package])
 else
@@ -783,10 +773,10 @@ PKG_CHECK_MODULES([GNOME],[libgnome-2.0 >= $LIBGNOME_REQUIRED libgnomeui-2.0 >=
 
 PKG_CHECK_MODULES([GVFS],[gio-standalone],[have_gvfs=yes],[have_gvfs=no])
 
-if test "$have_gvfs" = "yes"; then
+if test "x$have_gvfs" = "xyes"; then
   AC_DEFINE([HAVE_GVFS],[1],[Define if GVFS is available])
 fi
-AM_CONDITIONAL([HAVE_GVFS],[test "$have_gvfs" = "yes"])
+AM_CONDITIONAL([HAVE_GVFS],[test "x$have_gvfs" = "xyes"])
 
 # Distributor name
 
@@ -831,6 +821,7 @@ AC_CONFIG_FILES([
 embed/xulrunner/data/gnome-gecko-embed-${GGE_API_VERSION}.pc:embed/xulrunner/data/gnome-gecko-embed.pc.in
 ],[],[GGE_API_VERSION=$GGE_API_VERSION])
 
+
 AC_OUTPUT
 
 # *************************************
@@ -844,14 +835,18 @@ Epiphany was configured with the following options:
 	Prefix                     : $prefix
 	Extra debugging support    : $enable_debug
 
-        Engine                     : $with_engine
-	Gecko backend              : $gecko_cv_gecko version $gecko_cv_gecko_version
-	PSM support                : $enable_psm
 	Zeroconf bookmarks support : $enable_zeroconf
 	NetworkManager support     : $enable_network_manager
-	Certificate manager        : $enable_certificate_manager (experimental)
 	Python support             : $enable_python
 	Desktop file plugin        : $enable_desktop_file_plugin
 	Spellchecker               : $enable_spell_checker (experimental)
 
+        Engine                     : $with_engine
 "
+
+if test "x$with_engine" = "xmozilla"; then
+echo "        Gecko backend              : $gecko_cv_gecko version $gecko_cv_gecko_version
+	PSM support                : $enable_psm
+	Certificate manager        : $enable_certificate_manager (experimental)
+"
+fi
