]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Stringify preprocessor string 2315/head
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Thu, 5 Mar 2015 15:49:05 +0000 (16:49 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Thu, 5 Mar 2015 15:49:05 +0000 (16:49 +0100)
When compiling with something like './configure
CXXFLAGS=-DPACKAGEVERSION="1.2.3"', we fail with
"../config.h:162:792: error: too many decimal points in number"

This happens because the string as defined in config.h
has embedded double quotes. Escape them.

pdns/version.cc

index df6fd758425aace7f87762e2a565a0ffa18407b9..234ed96d67fbc5700d1d3c8722840714e724860d 100644 (file)
@@ -115,7 +115,11 @@ void showBuildConfiguration()
   theL()<<Logger::Warning<<"Built-in PolarSSL: "<<POLARSSL_VERSION_STRING<<endl;
 #endif
 #ifdef PDNS_CONFIG_ARGS
-  theL()<<Logger::Warning<<"Configured with: "<<PDNS_CONFIG_ARGS<<endl;
+#define double_escape(s) #s
+#define escape_quotes(s) double_escape(s)
+  theL()<<Logger::Warning<<"Configured with: "<<escape_quotes(PDNS_CONFIG_ARGS)<<endl;
+#undef escape_quotes
+#undef double_escape
 #endif
 }