Thank you Daniel, the example from above works now. Unfortunately the opposite condition still not work:
$./kamailio -c -f ../etc/test-define.cfg -Y /root 0(10801) CRITICAL: <core> [core/cfg.y:3532]: yyerror_at(): parse error in config file /home/henning/repositories/kamailio/src/../etc/test-define.cfg, from line 19, column 2 to line 20, column 0: syntax error ERROR: bad config file (1 errors) 0(10801) WARNING: <core> [core/ppcfg.c:223]: pp_ifdef_level_check(): different number of preprocessor directives: 1 more #!if[n]def as #!endif
``` $ cat test-define.cfg #!KAMAILIO
#!define foo
#!ifdef foobar1 #!ifdef foobar2 #!ifdef foobar3 #!endif #!endif
#!ifdef bar invalid=123 #else children=8 #!endif
request_route { ; } ```