I'm soliciting an opinion on configuration data .. In writing llvmc, I need to hard code the installation path of LLVM so that llvmc just knows where to look for the configuration data. This is a last resort after command line options, env vars, and "standard" places. So, somehow I need to get the value of the autoconf variable @sysconfdir@ into my program. There's a few ways to do this and since we're likely to eventually run into this again I'm trying to figure out what's best for LLVM: 0. Pass -DCONFIG_SYSCONFDIR=$(sysconfdir) on the command line. 1. Create include/Config/Values.h.in with something like: #define CONFIG_SYSCONFDIR "@sysconfdir@" 2. Create lib/Support/ConfigValues.cpp.in with something like: namespace llvm { const char Config_SysConfDir[] = "@sysconfdir@"; } 3 Create lib/Config/Values.cpp with same content as 2 (this done so that libConfig is separate and only linked when needed. 4. Do 3 but put the Values.cpp file in tools/llvmc so it is peculiar to llvmc Which way? Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040819/98f56069/attachment.sig>
On Thu, 2004-08-19 at 21:37, Reid Spencer wrote:> I'm soliciting an opinion on configuration data .. > > In writing llvmc, I need to hard code the installation path of LLVM so > that llvmc just knows where to look for the configuration data. This is > a last resort after command line options, env vars, and "standard" > places. > > So, somehow I need to get the value of the autoconf variable > @sysconfdir@ into my program. There's a few ways to do this and since > we're likely to eventually run into this again I'm trying to figure out > what's best for LLVM: > > 0. Pass -DCONFIG_SYSCONFDIR=$(sysconfdir) on the command line. > > 1. Create include/Config/Values.h.in with something like: > #define CONFIG_SYSCONFDIR "@sysconfdir@" > > 2. Create lib/Support/ConfigValues.cpp.in with something like: > namespace llvm { > const char Config_SysConfDir[] = "@sysconfdir@"; > } > > 3 Create lib/Config/Values.cpp with same content as 2 (this done > so that libConfig is separate and only linked when needed.You mean lib/Config/Values.cpp.in, right?> 4. Do 3 but put the Values.cpp file in tools/llvmc so it is peculiar > to llvmc > > Which way?I would go with 3. 1 will cause recompiles and 2 will cause a lot of relinks every time we run configure. -- Alkis
On Thu, 19 Aug 2004, Reid Spencer wrote:> So, somehow I need to get the value of the autoconf variable > @sysconfdir@ into my program. There's a few ways to do this and since > we're likely to eventually run into this again I'm trying to figure out > what's best for LLVM: > > 0. Pass -DCONFIG_SYSCONFDIR=$(sysconfdir) on the command line. > > 1. Create include/Config/Values.h.in with something like: > #define CONFIG_SYSCONFDIR "@sysconfdir@"I would prefer #1. This seems entirely in the spirit of our current autoconf system (which hacks on files in include/Config). -Chris -- http://llvm.org/ http://nondot.org/sabre/