How to find ruby header file without platform dependency

Hello everyone.

Now I am wondering to have a way to find a location of the ruby header file in various platforms whenever I try to configure to compile my sources.

in case of python, it provide the 'python-config' executable file to find a location of python.h.

how about ruby?

Is there any possible way to get a location(path) of it.

thanks for all.

You can look at the Config module and, in particular, at Config::CONFIG, which
is a hash containing a number of build-time settings.

For example (using ruby 1.9):

require 'rbconfig' #you don't need this line in ruby 1.8
puts Config::CONFIG.keys.sort

=>
["ALLOCA", "AR", "ARCHFILE", "ARCH_FLAG", "AS", "ASFLAGS", "BASERUBY",
"BUILTIN_TRANSSRCS", "CC", "CCDLFLAGS", "CFLAGS", "COMMON_HEADERS",
"COMMON_LIBS", "COMMON_MACROS", "COUTFLAG", "CP", "CPP", "CPPFLAGS",
"CPPOUTFILE", "CXX", "CXXFLAGS", "DEFS", "DESTDIR", "DLDFLAGS", "DLDLIBS",
"DLEXT", "DLEXT2", "DLLWRAP", "ECHO_C", "ECHO_N", "ECHO_T", "EGREP",
"ENABLE_SHARED", "EXEEXT", "EXPORT_PREFIX", "EXTOUT", "EXTSTATIC", "GNU_LD",
"GREP", "INSTALL", "INSTALL_DATA", "INSTALL_PROGRAM", "INSTALL_SCRIPT",
"LDFLAGS", "LDSHARED", "LDSHAREDXX", "LIBEXT", "LIBPATHENV", "LIBPATHFLAG",
"LIBRUBY", "LIBRUBYARG", "LIBRUBYARG_SHARED", "LIBRUBYARG_STATIC",
"LIBRUBY_A", "LIBRUBY_ALIASES", "LIBRUBY_DLDFLAGS", "LIBRUBY_LDSHARED",
"LIBRUBY_SO", "LIBS", "LINK_SO", "LN_S", "MAINLIBS", "MAJOR", "MAKEDIRS",
"MAKEFILES", "MANTYPE", "MINOR", "NM", "NROFF", "OBJCOPY", "OBJDUMP",
"OBJEXT", "OUTFLAG", "PACKAGE_BUGREPORT", "PACKAGE_NAME", "PACKAGE_STRING",
"PACKAGE_TARNAME", "PACKAGE_VERSION", "PATH_SEPARATOR", "PREP", "RANLIB",
"RDOCTARGET", "RM", "RMALL", "RMDIRS", "RPATHFLAG", "RUBYW_INSTALL_NAME",
"RUBY_INSTALL_NAME", "RUBY_SO_NAME", "SET_MAKE", "SHELL", "SOLIBS", "STATIC",
"STRIP", "TEENY", "THREAD_MODEL", "TRY_LINK", "WINDRES", "arch", "archdir",
"bindir", "build", "build_alias", "build_cpu", "build_os", "build_vendor",
"cflags", "configure_args", "cppflags", "datadir", "datarootdir",
"debugflags", "docdir", "dvidir", "exec_prefix", "host", "host_alias",
"host_cpu", "host_os", "host_vendor", "htmldir", "includedir", "infodir",
"libdir", "libexecdir", "localedir", "localstatedir", "mandir",
"oldincludedir", "optflags", "pdfdir", "prefix", "psdir", "ruby_install_name",
"ruby_version", "rubyhdrdir", "rubylibdir", "rubyw_install_name", "sbindir",
"setup", "sharedstatedir", "sitearch", "sitearchdir", "sitedir", "sitehdrdir",
"sitelibdir", "sysconfdir", "target", "target_alias", "target_cpu",
"target_os", "target_vendor", "topdir", "vendorarchdir", "vendordir",
"vendorhdrdir", "vendorlibdir", "warnflags"]

I hope this helps

Stefano

···

On Thursday 12 November 2009, Jun Young Kim wrote:

>Hello everyone.
>
>Now I am wondering to have a way to find a location of the ruby header
> file in various platforms whenever I try to configure to compile my
> sources.
>
>in case of python, it provide the 'python-config' executable file to find
> a location of python.h.
>
>how about ruby?
>
>Is there any possible way to get a location(path) of it.
>
>thanks for all.
>

thanks stefano. :slight_smile:

2009. 11. 12., 오후 6:53, Stefano Crocco 작성:

···

On Thursday 12 November 2009, Jun Young Kim wrote:

>Hello everyone.
>
>Now I am wondering to have a way to find a location of the ruby header
> file in various platforms whenever I try to configure to compile my
> sources.
>
>in case of python, it provide the 'python-config' executable file to find
> a location of python.h.
>
>how about ruby?
>
>Is there any possible way to get a location(path) of it.
>
>thanks for all.
>

You can look at the Config module and, in particular, at Config::CONFIG, which
is a hash containing a number of build-time settings.

For example (using ruby 1.9):

require 'rbconfig' #you don't need this line in ruby 1.8
puts Config::CONFIG.keys.sort

=>
["ALLOCA", "AR", "ARCHFILE", "ARCH_FLAG", "AS", "ASFLAGS", "BASERUBY",
"BUILTIN_TRANSSRCS", "CC", "CCDLFLAGS", "CFLAGS", "COMMON_HEADERS",
"COMMON_LIBS", "COMMON_MACROS", "COUTFLAG", "CP", "CPP", "CPPFLAGS",
"CPPOUTFILE", "CXX", "CXXFLAGS", "DEFS", "DESTDIR", "DLDFLAGS", "DLDLIBS",
"DLEXT", "DLEXT2", "DLLWRAP", "ECHO_C", "ECHO_N", "ECHO_T", "EGREP",
"ENABLE_SHARED", "EXEEXT", "EXPORT_PREFIX", "EXTOUT", "EXTSTATIC", "GNU_LD",
"GREP", "INSTALL", "INSTALL_DATA", "INSTALL_PROGRAM", "INSTALL_SCRIPT",
"LDFLAGS", "LDSHARED", "LDSHAREDXX", "LIBEXT", "LIBPATHENV", "LIBPATHFLAG",
"LIBRUBY", "LIBRUBYARG", "LIBRUBYARG_SHARED", "LIBRUBYARG_STATIC",
"LIBRUBY_A", "LIBRUBY_ALIASES", "LIBRUBY_DLDFLAGS", "LIBRUBY_LDSHARED",
"LIBRUBY_SO", "LIBS", "LINK_SO", "LN_S", "MAINLIBS", "MAJOR", "MAKEDIRS",
"MAKEFILES", "MANTYPE", "MINOR", "NM", "NROFF", "OBJCOPY", "OBJDUMP",
"OBJEXT", "OUTFLAG", "PACKAGE_BUGREPORT", "PACKAGE_NAME", "PACKAGE_STRING",
"PACKAGE_TARNAME", "PACKAGE_VERSION", "PATH_SEPARATOR", "PREP", "RANLIB",
"RDOCTARGET", "RM", "RMALL", "RMDIRS", "RPATHFLAG", "RUBYW_INSTALL_NAME",
"RUBY_INSTALL_NAME", "RUBY_SO_NAME", "SET_MAKE", "SHELL", "SOLIBS", "STATIC",
"STRIP", "TEENY", "THREAD_MODEL", "TRY_LINK", "WINDRES", "arch", "archdir",
"bindir", "build", "build_alias", "build_cpu", "build_os", "build_vendor",
"cflags", "configure_args", "cppflags", "datadir", "datarootdir",
"debugflags", "docdir", "dvidir", "exec_prefix", "host", "host_alias",
"host_cpu", "host_os", "host_vendor", "htmldir", "includedir", "infodir",
"libdir", "libexecdir", "localedir", "localstatedir", "mandir",
"oldincludedir", "optflags", "pdfdir", "prefix", "psdir", "ruby_install_name",
"ruby_version", "rubyhdrdir", "rubylibdir", "rubyw_install_name", "sbindir",
"setup", "sharedstatedir", "sitearch", "sitearchdir", "sitedir", "sitehdrdir",
"sitelibdir", "sysconfdir", "target", "target_alias", "target_cpu",
"target_os", "target_vendor", "topdir", "vendorarchdir", "vendordir",
"vendorhdrdir", "vendorlibdir", "warnflags"]

I hope this helps

Stefano