Looking over the documentation for DocumentRoot (and <VirtualHost>), it looks like your options are to write a script to create the configuration (as you mentioned) or write a module if you want to automatically set DocumentRoot. If you're using Apache 1.3, the source for mod_example may be...