cgccapache2libtool

How to define compile-time -D macros (Apache 2.2)?


While compiling Apache source, I've been able to define one macro just fine:

# export CFLAGS=" -DSINGLE_LISTEN_UNSERIALIZED_ACCEPT"   // OR even:
# export CFLAGS=" -DSINGLE_LISTEN_UNSERIALIZED_ACCEPT=1"

... works like a charm, however every time I try to set:

# export CFLAGS=" -DDEFAULT_PIDLOG=/var/run/apache/apache.pid"

I get this error during make:

prefork.c: In function ‘prefork_pre_config’:
prefork.c:1340:20: error: expected expression before ‘/’ token
make[4]: *** [prefork.lo] Error 1

So I've tried escaping the forward slashes and different quoting techniques of DEFAULT_PIDLOG's value, but it always fails, apparently because of the forward slashes in the value.


Solution

  • Seems that DEFAULT_PIDLOG is expected to define a constant C string. Try with

    export CFLAGS="-DDEFAULT_PIDLOG=\\\"/var/run/apache/apache.pid\\\""
    

    (Thanks @mathk)