Menu

#7 build problem related to DEFAULTGS

open
nobody
None
5
2012-09-15
2007-11-13
Anonymous
No

DEFAULTGS is a C macro defined with the value of the Makefile variable GS, which contains the plain path where to find the ghostscript executable (i.e., plain = with no surrounding quotes).

In src/callgs.cpp, if DEFAULTGS is defined, the following code

define str(x) #x

define xstr(x) str(x)

ifdef DEFAULTGS

static const char *const defaultgs = xstr(DEFAULTGS);

else

static const char *const defaultgs = "";

endif

forces DEFAULTGS (which could be something as /abs/path/sparc-sun-solaris2/gs) to be completely macro-expanded before being stringified. If some path components/words happen to be defined as macros (such as sun, which is defined to 1 on solaris), they are silently replaced, yielding a wrong precompiled path for gs. In the previous example, one could get /abs/path/sparc-1-solaris2/gs.

Discussion


Log in to post a comment.