ruby_headers
ruby_cflags
ruby_ldflags
-RUBY_EXTRA_LDFLAGS
RUBY_EXTRA_LIBS
RUBY_SITE_PKG
RUBY_LDFLAGS
+
targetname=rlm_ruby
if test x$with_rlm_ruby != xno; then
ac_ext=c
#
# Check for Ruby include path
#
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby include path" >&5
-$as_echo_n "checking for Ruby include path... " >&6; }
if test -z "$RUBY_CFLAGS"; then
- ruby_path=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(archdir))'`
+ #
+ # Check for Ruby cflags
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby cflags" >&5
+$as_echo_n "checking for Ruby cflags... " >&6; }
+ if test -z "$RUBY_CFLAGS"; then
+ RUBY_CFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(CFLAGS))' | sed 's/-arch [^ ]*[ ]*//g'`
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_CFLAGS" >&5
+$as_echo "$RUBY_CFLAGS" >&6; }
+
+ #
+ # Check for Ruby include path
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby include path" >&5
+$as_echo_n "checking for Ruby include path... " >&6; }
+ ruby_path=`$RUBY -rmkmf -e 'c = RbConfig::CONFIG; print c.has_key?(%q(rubyhdrdir)) ? \
+ c.fetch(%q(rubyhdrdir)) : c.fetch(%q(archdir))'`
+
+ ruby_arch=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(arch))'`
+
if test -n "${ruby_path}"; then
- ruby_path="-I$ruby_path"
+ #
+ # For some reason ruby 1.9.1 on linux seems to put its
+ # config.h file in ${ruby_path}/${ruby_arch}/ruby/config.h
+ # Aside from the fact that it is WRONG to include your own
+ # config.h file it means we can't use the headers unless we
+ # add both paths
+ #
+ if test -d "${ruby_path}/${arch}"; then
+ ruby_path=" -I${ruby_path} -I${ruby_path}/${ruby_arch}"
+ else
+ ruby_path=" -I${ruby_path}"
+ fi
fi
- RUBY_CFLAGS=$ruby_path
+
+ RUBY_CFLAGS+="$ruby_path"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ruby_path" >&5
+$as_echo "$ruby_path" >&6; }
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_CFLAGS" >&5
-$as_echo "$RUBY_CFLAGS" >&6; }
- #
- # Check for Ruby library path
- #
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby library path" >&5
-$as_echo_n "checking for Ruby library path... " >&6; }
+
if test -z "$RUBY_LDFLAGS"; then
+ #
+ # Check for Ruby library path
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby library path" >&5
+$as_echo_n "checking for Ruby library path... " >&6; }
+ if test -z "$RUBY_LIBRARY_PATH"; then
+ RUBY_LIBRARY_PATH=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(libdir))'`
+ if test -n "${RUBY_LIBRARY_PATH}"; then
+ RUBY_LIBRARY_PATH=" -L$RUBY_LIBRARY_PATH"
+ fi
+ fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_LIBRARY_PATH" >&5
+$as_echo "$RUBY_LIBRARY_PATH" >&6; }
+
+ #
+ # Check for Ruby linking flags
+ #
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby linking flags" >&5
+$as_echo_n "checking for Ruby linking flags... " >&6; }
+
RUBY_LDFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(LIBRUBYARG_SHARED))'`
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_LDFLAGS" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_LDFLAGS" >&5
$as_echo "$RUBY_LDFLAGS" >&6; }
+ RUBY_LDFLAGS="${RUBY_LIBRARY_PATH} ${RUBY_LDFLAGS}"
+ fi
+
+
#
# Check for site packages
#
# libraries which must be linked in when embedding
#
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking ruby extra libraries" >&5
-$as_echo_n "checking ruby extra libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Ruby extra libraries" >&5
+$as_echo_n "checking for Ruby extra libraries... " >&6; }
if test -z "$RUBY_EXTRA_LIBS"; then
RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(SOLIBS))'`
fi
# linking flags needed when embedding
# (is it even needed for Ruby?)
#
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking ruby extra linking flags" >&5
-$as_echo_n "checking ruby extra linking flags... " >&6; }
- if test -z "$RUBY_EXTRA_LDFLAGS"; then
- RUBY_EXTRA_LDFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(LINKFORSHARED))'`
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUBY_EXTRA_LDFLAGS" >&5
-$as_echo "$RUBY_EXTRA_LDFLAGS" >&6; }
-
+ # AC_MSG_CHECKING([for Ruby extra linking flags])
+ # if test -z "$RUBY_EXTRA_LIBS"; then
+ # RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print RubyConfig::CONFIG.fetch(%q(LINKFORSHARED))'`
+ # fi
+ # AC_MSG_RESULT([$RUBY_EXTRA_LIBS])
+ # AC_SUBST(RUBY_EXTRA_LIBS)
# this flags breaks ruby.h, and is sometimes defined by KDE m4 macros
CFLAGS="`echo "$CFLAGS" | sed -e 's/-std=iso9899:1990//g;'`"
# turn back to default flags
CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+ LIBS="$ac_save_LDFLAGS"
#
# all done!
#
- if test x$RUBY_VERSION != x""; then
+ if test ! -n "$RUBY_VERSION"; then
ruby_cflags+="$RUBY_CFLAGS"
ruby_ldflags+="$RUBY_LDFLAGS"
ruby_ldflags+="$RUBY_EXTRA_LIBS"
#
# Check for Ruby include path
#
- AC_MSG_CHECKING([for Ruby include path])
if test -z "$RUBY_CFLAGS"; then
- ruby_path=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(archdir))'`
+ #
+ # Check for Ruby cflags
+ #
+ AC_MSG_CHECKING([for Ruby cflags])
+ if test -z "$RUBY_CFLAGS"; then
+ RUBY_CFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(CFLAGS))' | sed ['s/-arch [^ ]*[ ]*//g']`
+ fi
+ AC_MSG_RESULT([$RUBY_CFLAGS])
+
+ #
+ # Check for Ruby include path
+ #
+ AC_MSG_CHECKING([for Ruby include path])
+ ruby_path=`$RUBY -rmkmf -e 'c = RbConfig::CONFIG; print c.has_key?(%q(rubyhdrdir)) ? \
+ c.fetch(%q(rubyhdrdir)) : c.fetch(%q(archdir))'`
+
+ ruby_arch=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(arch))'`
+
if test -n "${ruby_path}"; then
- ruby_path="-I$ruby_path"
+ #
+ # For some reason ruby 1.9.1 on linux seems to put its
+ # config.h file in ${ruby_path}/${ruby_arch}/ruby/config.h
+ # Aside from the fact that it is WRONG to include your own
+ # config.h file it means we can't use the headers unless we
+ # add both paths
+ #
+ if test -d "${ruby_path}/${arch}"; then
+ ruby_path=" -I${ruby_path} -I${ruby_path}/${ruby_arch}"
+ else
+ ruby_path=" -I${ruby_path}"
+ fi
fi
- RUBY_CFLAGS=$ruby_path
+
+ RUBY_CFLAGS+="$ruby_path"
+ AC_MSG_RESULT([$ruby_path])
fi
- AC_MSG_RESULT([$RUBY_CFLAGS])
+
AC_SUBST([RUBY_CFLAGS])
- #
- # Check for Ruby library path
- #
- AC_MSG_CHECKING([for Ruby library path])
if test -z "$RUBY_LDFLAGS"; then
+ #
+ # Check for Ruby library path
+ #
+ AC_MSG_CHECKING([for Ruby library path])
+ if test -z "$RUBY_LIBRARY_PATH"; then
+ RUBY_LIBRARY_PATH=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(libdir))'`
+ if test -n "${RUBY_LIBRARY_PATH}"; then
+ RUBY_LIBRARY_PATH=" -L$RUBY_LIBRARY_PATH"
+ fi
+ fi
+
+ AC_MSG_RESULT([$RUBY_LIBRARY_PATH])
+
+ #
+ # Check for Ruby linking flags
+ #
+ AC_MSG_CHECKING([for Ruby linking flags])
+
RUBY_LDFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(LIBRUBYARG_SHARED))'`
+ AC_MSG_RESULT([$RUBY_LDFLAGS])
+
+ RUBY_LDFLAGS="${RUBY_LIBRARY_PATH} ${RUBY_LDFLAGS}"
fi
- AC_MSG_RESULT([$RUBY_LDFLAGS])
+
AC_SUBST([RUBY_LDFLAGS])
#
#
# libraries which must be linked in when embedding
#
- AC_MSG_CHECKING(ruby extra libraries)
+ AC_MSG_CHECKING([for Ruby extra libraries])
if test -z "$RUBY_EXTRA_LIBS"; then
RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(SOLIBS))'`
fi
# linking flags needed when embedding
# (is it even needed for Ruby?)
#
- AC_MSG_CHECKING(ruby extra linking flags)
- if test -z "$RUBY_EXTRA_LDFLAGS"; then
- RUBY_EXTRA_LDFLAGS=`$RUBY -rmkmf -e 'print RbConfig::CONFIG.fetch(%q(LINKFORSHARED))'`
- fi
- AC_MSG_RESULT([$RUBY_EXTRA_LDFLAGS])
- AC_SUBST(RUBY_EXTRA_LDFLAGS)
+ # AC_MSG_CHECKING([for Ruby extra linking flags])
+ # if test -z "$RUBY_EXTRA_LIBS"; then
+ # RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print RubyConfig::CONFIG.fetch(%q(LINKFORSHARED))'`
+ # fi
+ # AC_MSG_RESULT([$RUBY_EXTRA_LIBS])
+ # AC_SUBST(RUBY_EXTRA_LIBS)
# this flags breaks ruby.h, and is sometimes defined by KDE m4 macros
CFLAGS="`echo "$CFLAGS" | sed -e 's/-std=iso9899:1990//g;'`"
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$ac_save_CFLAGS $RUBY_CFLAGS"
AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([#include <ruby.h>],[ruby_init()])],
- [rubyexists=yes],
- [rubyexists=no])
+ [AC_LANG_PROGRAM([#include <ruby.h>],[ruby_init()])],
+ [rubyexists=yes],
+ [rubyexists=no])
AC_MSG_RESULT([$rubyexists])
AC_LANG_POP
# turn back to default flags
CFLAGS="$ac_save_CFLAGS"
- LIBS="$ac_save_LIBS"
+ LIBS="$ac_save_LDFLAGS"
#
# all done!
#
])
+