Best way to get compile-time configuration for building/linking against Ruby?

Hello list,

I want to embed the Ruby interpreter in a project and am currently fiddeling
with getting Ruby's compile-time configuration, e.g. include and libraries
paths. I cannot use 'mkmf' for various reasons.

Currently, I'm running something like that:

- ---%<---
ruby -rrbconfig -e 'puts
RbConfig::expand(\"#{RbConfig::CONFIG[\"rubyhdrdir\"]}/$(arch)\")'
- --->%---

I trust there is a better/more elegant way of solving this? If so, what
would it be?

Thanks a lot in advance,
    Eric

P. S. Any chance the Ruby sources would include a pkg-config file or
something similar in the near future?

paths. I cannot use 'mkmf' for various reasons.

I would call out to mkmf with a fake ext and "see" what it uses.
-r

···

--
Posted via http://www.ruby-forum.com/.

I trust there is a better/more elegant way of solving this? If so, what

i use this

  http://gist.github.com/575279

makes it simple to import the output into any program that can parse
yaml>json.

-a

Roger,
Ara,

thanks for your answers. I should have been a bit clearer with my request;
sorry.

Thing is, I'm using Autotools (autoconf et al), so I cannot hardcore paths
for obvious reasons, and parsing JSON or YAML is from the table, too. So,
"more elegant" basically meant: Something that's easy to use from a shell
script (i.e., configure.ac).

Does sombody have another suggestion? :slight_smile:

      Eric

A workaround will be create ruby as static library (--enable-static --
disable-shared) during Ruby configure phase.

Then, create a program entry point (your program) and link against
libruby library.

You can check how that is done for projects like exerb, is Windows and
MinGW, but you can get the idea form it:

HTH,

···

On Sep 11, 1:01 pm, Eric MSP Veith <eve...@wwweb-library.net> wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Roger,
Ara,

thanks for your answers. I should have been a bit clearer with my request;
sorry.

Thing is, I'm using Autotools (autoconf et al), so I cannot hardcore paths
for obvious reasons, and parsing JSON or YAML is from the table, too. So,
"more elegant" basically meant: Something that's easy to use from a shell
script (i.e., configure.ac).

Does sombody have another suggestion? :slight_smile:

--
Luis Lavena