Hello,
I am trying to make a single configuration file which behaves differently
depending on flags set in a master config file.
Essentially what I am trying to simulate is:
.include /etc/config # contains "FOO=yes" (or may not)
.ifdef FOO # or .if FOO=yes
...series of lines
.endif
I am trying to avoid using an external preprocessor. Symlinking the whole
config file to one of a set (or using the -C flag) is not really flexible
enough.
Does anyone know of a way to achieve what I want? My attempts so far are
documented below :-)
Thanks,
Brian.
------------------------------------------------------------------------
Attempt 1:
FOO=configure-foo
.include /usr/exim/FOO
# Nope: says 'failed to open included configuration file /usr/exim/FOO'
Attempt 2:
FOO=.include /usr/exim/configure-foo
FOO
# Nope: says 'main option "" unknown'
Attempt 3:
FOO=#
FOO .include /usr/exim/configure-foo
works as expected, but
FOO=
FOO .include /usr/exim/configure-foo
fails with 'main option "" unknown'
Incidentally, you can't define an empty macro on the command line, and
defining it as a space also fails:
# exim -DFOO
exim abandoned: unknown, malformed, or incomplete option -DFOO
# exim -DFOO=""
exim abandoned: unknown, malformed, or incomplete option -DFOO=
# exim -DFOO=" "
2002-08-08 12:18:36 Exim configuration error in line 2:
main option "" unknown
Attempt 4:
FOO=#
BAR=#
FOO hostlist host_accept_relay =
FOO .. more config lines
FOO ..
BAR hostlist host_accept_relay = 1.2.3.0/24
BAR .. more config lines
BAR ..
This actually works, but the main part of the configuration then becomes
very messy with every line prefixed with FOO or BAR.
I also can't see a way of including a section if "FOO or BAR" is true,
or if "FOO and BAR" is true: e.g.
FOO=#
BAR=#
FOOBAR daemon_smtp_port=25
gives 'main option "" unknown'