- if(n>1000)
- throw bad_expansion("nested too deep");
-
- string::size_type end;
- string var;
- if(dollar+1<result.size() && result[dollar+1]=='{')
- {
- end = result.find('}', dollar+2);
- if(end==string::npos)
- throw bad_expansion("unterminated variable reference");
- var = result.substr(dollar+2, end-dollar-2);
- ++end;
- }
- else
- {
- for(end=dollar+1; (isalnum(result[end]) || result[end]=='_'); ++end) ;
- var = result.substr(dollar+1, end-dollar-1);
- }
-
- string value;
- if(config.is_option(var))
- value = config.get_option(var).value;
- else if(var=="arch")
- value = builder.get_current_arch().get_name();
- else if(var=="system")
- value = builder.get_current_arch().get_system();
- else if(const char *ptr = getenv(var.c_str()))
- value = ptr;
-
- result.replace(dollar, end-dollar, value);
-
- ++n;
+ if(equals==0)
+ throw invalid_argument("SourcePackage::match_feature");
+ bool negate = cond[equals-1]=='!';
+ string feat = cond.substr(0, equals-negate);
+ string value = config.get_option("with_"+feat).value;
+ return (value==cond.substr(equals+1))!=negate;