On Tue, 23 Nov 2004, Johan Holmberg wrote:
>
> I get this on Solaris, with the latest 1.8 CVS:
>
> -----------------------------------------------------------------------------
> [...]
> ./ext/extmk.rb:27:in `require': ./lib/mkmf.rb:1043: can't find string "SRC" 
> anywhere before EOF (SyntaxError)
> ./lib/mkmf.rb:544: parse error
>    if try_compile(<<"SRC", opt, &b) or (/\A\w+\z/n =~ type && 
> try_compile(<<"SRC", opt, &b))
>                                                                                  ^ 
> from ./ext/extmk.rb:27
> *** Error code 1
> ----------------------------------------------------------------------------
>

I also got rid of the problem by the following code change.
I introduced two new temporary variables and avoided putting the two
<<"SRC" expressions (and a regexp) together in one single if-expression.

Does his help understanding the problem?

/Johan Holmberg


old code:
----------------------------------------------------------------------
     if try_compile(<<"SRC", opt, &b) or (/\A\w+\z/n =~ type && try_compile(<<"SRC", opt, &b))
#{COMMON_HEADERS}
#{header}
/*top*/
static #{type} t;
SRC
#{COMMON_HEADERS}
#{header}
/*top*/
static #{type} *t;
SRC
----------------------------------------------------------------------

new code:
----------------------------------------------------------------------
     src1 = <<"SRC"
#{COMMON_HEADERS}
#{header}
/*top*/
static #{type} t;
SRC
     src2 = <<"SRC"
#{COMMON_HEADERS}
#{header}
/*top*/
static #{type} *t;
SRC
     if try_compile(src1, opt, &b) or (/\A\w+\z/n =~ type && try_compile(src2, opt, &b))
----------------------------------------------------------------------