diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp
index a0ca91672aa357f9743dba9cc0f58a4d58f06a11..375dce485d71b2eec8c332f686a689ecb4bb4b9d 100644
--- a/indra/newview/llversioninfo.cpp
+++ b/indra/newview/llversioninfo.cpp
@@ -99,10 +99,16 @@ const std::string &LLVersionInfo::getShortVersion()
 
 namespace
 {
+	// LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
+	// macro expands to the string name of the channel, but without quotes. We
+	// need to turn it into a quoted string. This macro trick does that.
+#define stringize_inner(x) #x
+#define stringize_outer(x) stringize_inner(x)
+
 	/// Storage of the channel name the viewer is using.
 	//  The channel name is set by hardcoded constant, 
 	//  or by calling LLVersionInfo::resetChannel()
-	std::string sWorkingChannelName(LL_VIEWER_CHANNEL);
+	std::string sWorkingChannelName(stringize_outer(LL_VIEWER_CHANNEL));
 
 	// Storage for the "version and channel" string.
 	// This will get reset too.
diff --git a/indra/newview/tests/llversioninfo_test.cpp b/indra/newview/tests/llversioninfo_test.cpp
index 6b0be29c2d284ab96b19ff4f8a2bff750196c8b9..f1f69f33f19b7ba2da08e56499e77434dce1e995 100644
--- a/indra/newview/tests/llversioninfo_test.cpp
+++ b/indra/newview/tests/llversioninfo_test.cpp
@@ -29,6 +29,13 @@
 
 #include "../llversioninfo.h"
 
+// LL_VIEWER_CHANNEL is a macro defined on the compiler command line. The
+// macro expands to the string name of the channel, but without quotes. We
+// need to turn it into a quoted string. This macro trick does that.
+#define stringize_inner(x) #x
+#define stringize_outer(x) stringize_inner(x)
+#define ll_viewer_channel stringize_outer(LL_VIEWER_CHANNEL)
+
 namespace tut
 {
     struct versioninfo
@@ -50,7 +57,7 @@ namespace tut
 			mShortVersion = stream.str();
 			stream.str("");
 
-			stream << LL_VIEWER_CHANNEL
+			stream << ll_viewer_channel
 				   << " "
 				   << mVersion;
 			mVersionAndChannel = stream.str();
@@ -89,7 +96,7 @@ namespace tut
 					  LL_VIEWER_VERSION_BUILD);
 		ensure_equals("Channel version", 
 					  LLVersionInfo::getChannel(), 
-					  LL_VIEWER_CHANNEL);
+					  ll_viewer_channel);
 		ensure_equals("Version String", 
 					  LLVersionInfo::getVersion(), 
 					  mVersion);