OK, I attempted to pass them via make:

make -DMYSQL_UPDATE_SERVER=\"db.simerson.net\" -DMYSQL_UPDATE_USER=\"vpopmail\" -DMYSQL_UPDATE_PASSWD=\"secret\" -DMYSQL_READ_SERVER=\"localhost\" -DMYSQL_READ_USER=\"vpopmail\" -DMYSQL_READ_PASSWD=\"secret\"

but that didn't work. So, I set the CFLAGS environment variable as follows:

setenv CFLAGS '-DMYSQL_UPDATE_SERVER=\"db.simerson.net\" -DMYSQL_UPDATE_USER=\"vpopmail\" -DMYSQL_UPDATE_PASSWD=\"secret\" -DMYSQL_READ_SERVER=\"localhost\" -DMYSQL_READ_USER=\"vpopmail\" -DMYSQL_READ_PASSWD=\"secret\"'

Interestingly enough, the CFLAGS env variable is set properly but configure fails when CFLAGS is set and it tests gcc. If I run configure without CFLAGS set and then set it, and compile via "make", then the CFLAGS don't get passed to gcc. So the only way I've been able to set the compiler flags and have them effect is by editing the Makefile. In that case they actually get passed to gcc and it warns about redefining them but the values I pass don't end up overriding the ones in the vmysql.h file as the resulting binaries don't work.

The closest thing to a hack I've found is by echo'ing the new values to the bottom of the vmysql.h file. Then I get the expected redefine errors and the resulting binaries work as expected. However, that leaves me no better off than when I started. In order to do it "right" I still have to parse through the file, dropping the MYSQL_UPDATE_* and MYSQL_READ_* lines.

What I really, really want is to override the defined values in vmysql.h without actually altering any files in any way. Maybe it's not possible, but it just seems like it should be.

Matt

On Saturday, February 8, 2003, at 08:14 PM, Peter Palmreuther wrote:

I don't know if there's a way to "override" the '#define's. A quick
test gave me "warning: `... redefined"

So I guess your best bet is to comment out the defines (well knowing
it _will not_ compile anymore w/o defining the values on command line)
and passing '-D' arguments to the compiler.

E.g.:

-DMYSQL_UPDATE_SERVER=\"localhost\" \
-DMYSQL_UPDATE_USER=\"vpopmail\" \
-DMYSQL_UPDATE_PASSWD=\"bla\"

and so on.
The important part is escaping the quotes with '\'. Else they'll be
interpreted _before_ defining the value as "delimiter to avoid
argument splitting by e.g. space characters". The '\' tells the
compiler they're not surrounding the value, but they're part of the
value.

HTH
--
Best regards
Peter Palmreuther

Features should be discovered, not documented.




Reply via email to