From: Amos Jeffries Date: Tue, 23 Oct 2012 06:39:34 +0000 (+1300) Subject: Remove Bungled warning on missing component directives X-Git-Tag: SQUID_3_4_0_1~553 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6ead21b283b664d162e0e852c7cb1f92d030562;p=thirdparty%2Fsquid.git Remove Bungled warning on missing component directives * Make Squid display a ERROR notice and ignore squid.conf directives which belong to components disabled at build time instead of throwing up 'FATAL: Bungled' message and aborting. * Polish the 'requires X' message text for better display of cases like 'requires MS Windows' and 'requires Linux' * Add 'requires X' message for --enable-auth, --enable-eui, and --enable-ssl-crtd which were missing. --- diff --git a/src/cf_gen.cc b/src/cf_gen.cc index 82b4d3adc8..631f4a6728 100644 --- a/src/cf_gen.cc +++ b/src/cf_gen.cc @@ -157,6 +157,7 @@ static void gen_conf(const EntryList &, std::ostream&, bool verbose_output); static void gen_default_if_none(const EntryList &, std::ostream&); static void gen_default_postscriptum(const EntryList &, std::ostream&); static bool isDefined(const std::string &name); +static const char *available_if(const std::string &name); static void checkDepend(const std::string &directive, const char *name, const TypeList &types, const EntryList &entries) @@ -551,7 +552,9 @@ gen_default_if_none(const EntryList &head, std::ostream &fout) { fout << "static void" << std::endl << "defaults_if_none(void)" << std::endl << - "{" << std::endl; + "{" << std::endl << + " cfg_filename = \"Default Configuration (if absent)\";" << std::endl << + " config_lineno = 0;" << std::endl; for (EntryList::const_iterator entry = head.begin(); entry != head.end(); ++entry) { assert(entry->name.size()); @@ -579,7 +582,8 @@ gen_default_if_none(const EntryList &head, std::ostream &fout) fout << "#endif" << std::endl; } - fout << "}" << std::endl << std::endl; + fout << " cfg_filename = NULL;" << std::endl << + "}" << std::endl << std::endl; } /// append configuration options specified by POSTSCRIPTUM lines @@ -588,7 +592,9 @@ gen_default_postscriptum(const EntryList &head, std::ostream &fout) { fout << "static void" << std::endl << "defaults_postscriptum(void)" << std::endl << - "{" << std::endl; + "{" << std::endl << + " cfg_filename = \"Default Configuration (postscriptum)\";" << std::endl << + " config_lineno = 0;" << std::endl; for (EntryList::const_iterator entry = head.begin(); entry != head.end(); ++entry) { assert(entry->name.size()); @@ -609,13 +615,16 @@ gen_default_postscriptum(const EntryList &head, std::ostream &fout) fout << "#endif" << std::endl; } - fout << "}" << std::endl << std::endl; + fout << " cfg_filename = NULL;" << std::endl << + "}" << std::endl << std::endl; } void Entry::genParseAlias(const std::string &aName, std::ostream &fout) const { fout << " if (!strcmp(token, \"" << aName << "\")) {" << std::endl; + if (ifdef.size()) + fout << "#if " << ifdef << std::endl; fout << " "; if (type.compare("obsolete") == 0) { fout << "debugs(0, DBG_CRITICAL, \"ERROR: Directive '" << aName << "' is obsolete.\");\n"; @@ -630,6 +639,12 @@ Entry::genParseAlias(const std::string &aName, std::ostream &fout) const fout << "parse_" << type << "(&" << loc << (array_flag ? "[0]" : "") << ");"; } fout << std::endl; + if (ifdef.size()) { + fout << + "#else" << std::endl << + " debugs(0, DBG_PARSE_NOTE(DBG_IMPORTANT), \"ERROR: '" << name << "' requires " << available_if(ifdef) << "\");" << std::endl << + "#endif" << std::endl; + } fout << " return 1;" << std::endl; fout << " };" << std::endl; } @@ -640,9 +655,6 @@ Entry::genParse(std::ostream &fout) const if (name.compare("comment") == 0) return; - if (ifdef.size()) - fout << "#if " << ifdef << std::endl; - // Once for the current directive name genParseAlias(name, fout); @@ -650,9 +662,6 @@ Entry::genParse(std::ostream &fout) const for (EntryAliasList::const_iterator a = alias.begin(); a != alias.end(); ++a) { genParseAlias(*a, fout); } - - if (ifdef.size()) - fout << "#endif\n"; } static void diff --git a/src/cf_gen_defines b/src/cf_gen_defines index 1fd4ab9ca0..2e7b2c6a86 100644 --- a/src/cf_gen_defines +++ b/src/cf_gen_defines @@ -14,6 +14,7 @@ BEGIN { define["ICAP_CLIENT"]="--enable-icap-client" define["SQUID_SNMP"]="--enable-snmp" define["USE_ADAPTATION"]="--enable-ecap or --enable-icap-client" + define["USE_AUTH"]="--enable-auth" define["USE_CACHE_DIGESTS"]="--enable-cache-digests" define["USE_DNSHELPER"]="--disable-internal-dns" define["!USE_DNSHELPER"]="--enable-internal-dns" @@ -24,6 +25,8 @@ BEGIN { define["USE_IDENT"]="--enable-ident-lookups" define["USE_LOADABLE_MODULES"]="--enable-loadable-modules" define["USE_SQUID_ESI"]="--enable-esi" + define["USE_SQUID_EUI"]="--enable-eui" + define["USE_SSL_CRTD"]="--enable-ssl-crtd" define["USE_SSL"]="--enable-ssl" define["USE_UNLINKD"]="--enable-unlinkd" define["USE_WCCP"]="--enable-wccp" @@ -34,8 +37,8 @@ BEGIN { } /^IFDEF:/ { if (define[$2] != "") - DEFINE=define[$2] " option" - else + DEFINE=define[$2] + else DEFINE="-D" $2 " define" print "{\"" $2 "\", \"" DEFINE "\", " print "#if " $2