You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
3.5 KiB
91 lines
3.5 KiB
5 years ago
|
AC_CHECK_PROG(RUBY_EXECUTABLE, ruby, ruby)
|
||
12 years ago
|
|
||
5 years ago
|
if test -z "RUBY_EXECUTABLE"; then
|
||
15 years ago
|
DO_NOT_COMPILE="$DO_NOT_COMPILE qtruby"
|
||
|
else
|
||
5 years ago
|
RUBY_MAJOR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(MAJOR))"`
|
||
|
RUBY_MINOR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(MINOR))"`
|
||
|
|
||
|
RUBY_ARCHDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(archdir))"`
|
||
|
RUBY_SITEARCHDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(sitearchdir))"`
|
||
|
RUBY_SITEDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(sitelibdir))"`
|
||
|
RUBY_LIBDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(libdir))"`
|
||
|
RUBY_RUBYLIBDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(rubylibdir))"`
|
||
|
RUBY_LIBRUBYARG=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(LIBRUBYARG_SHARED))"`
|
||
|
|
||
|
RUBY_SERIES="$RUBY_MAJOR$RUBY_MINOR"
|
||
|
if test "$RUBY_SERIES" -ge "19"; then
|
||
|
AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x])
|
||
12 years ago
|
fi
|
||
5 years ago
|
|
||
|
if test `${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.key?(%q(rubyhdrdir))"` = "true"; then
|
||
|
RUBY_INCLUDEDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(rubyhdrdir))"`
|
||
|
if test `${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.key?(%q(rubyarchhdrdir))"` = "true"; then
|
||
|
RUBY_ARCHINCLUDEDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(rubyarchhdrdir))"`
|
||
|
else
|
||
|
RUBY_ARCH=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(arch))"`
|
||
|
RUBY_ARCHINCLUDEDIR=${RUBY_INCLUDEDIR}/${RUBY_ARCH}
|
||
|
fi
|
||
|
RUBY_CFLAGS="-I${RUBY_INCLUDEDIR} -I${RUBY_ARCHINCLUDEDIR}"
|
||
|
else
|
||
|
RUBY_INCLUDEDIR=`${RUBY_EXECUTABLE} -r rbconfig -e "puts RbConfig::CONFIG.fetch(%q(archdir))"`
|
||
|
RUBY_CFLAGS="-I${RUBY_INCLUDEDIR}"
|
||
12 years ago
|
fi
|
||
11 years ago
|
|
||
3 years ago
|
# check if Ruby requires explicit specification of C++ standard
|
||
|
AC_LANG_SAVE
|
||
|
AC_LANG_CPLUSPLUS
|
||
|
SAVED_CXXFLAGS="$CXXFLAGS"
|
||
|
for CXX_STD_TEST in "" 11 14 17; do
|
||
|
CXXFLAGS="$SAVED_CXXFLAGS"
|
||
|
if test "x$CXX_STD_TEST" = "x"; then
|
||
|
AC_MSG_CHECKING([Ruby build with default C++ standard])
|
||
|
RUBY_CXXFLAGS=""
|
||
|
else
|
||
|
AC_MSG_CHECKING([Ruby build with C++$CXX_STD_TEST])
|
||
|
RUBY_CXXFLAGS="-std=c++$CXX_STD_TEST"
|
||
|
fi
|
||
|
CXXFLAGS="$SAVED_CXXFLAGS $RUBY_CFLAGS $RUBY_CXXFLAGS"
|
||
|
AC_TRY_COMPILE([
|
||
|
#include <ruby.h>
|
||
|
],[ ],
|
||
|
ruby_cxx_std=yes,
|
||
|
ruby_cxx_std=no
|
||
|
)
|
||
|
if test "x$ruby_cxx_std" = "xyes"; then
|
||
|
AC_SUBST(RUBY_CXXFLAGS)
|
||
|
AC_MSG_RESULT(yes)
|
||
|
break
|
||
|
else
|
||
|
AC_MSG_RESULT(no)
|
||
|
fi
|
||
|
done
|
||
|
CXXFLAGS="$SAVED_CXXFLAGS"
|
||
|
AC_LANG_RESTORE
|
||
|
|
||
11 years ago
|
# Removes trailing slashes, if any, to avoid fail to install with recent libtool.
|
||
|
RUBY_ARCHDIR=${RUBY_ARCHDIR%/}
|
||
|
RUBY_SITEDIR=${RUBY_SITEDIR%/}
|
||
|
RUBY_LIBDIR=${RUBY_LIBDIR%/}
|
||
|
RUBY_RUBYLIBDIR=${RUBY_RUBYLIBDIR%/}
|
||
|
|
||
5 years ago
|
AC_MSG_RESULT([\
|
||
12 years ago
|
archdir $RUBY_ARCHDIR,
|
||
|
sitearchdir $RUBY_SITEARCHDIR,
|
||
|
sitedir $RUBY_SITEDIR,
|
||
|
rubylibdir $RUBY_RUBYLIBDIR,
|
||
|
libdir $RUBY_LIBDIR,
|
||
|
includedir $RUBY_INCLUDEDIR,
|
||
|
librubyarg $RUBY_LIBRUBYARG,
|
||
3 years ago
|
cflags $RUBY_CFLAGS,
|
||
|
cxxflags $RUBY_CXXFLAGS])
|
||
15 years ago
|
AC_SUBST(RUBY_ARCHDIR)
|
||
|
AC_SUBST(RUBY_SITEARCHDIR)
|
||
|
AC_SUBST(RUBY_SITEDIR)
|
||
15 years ago
|
AC_SUBST(RUBY_RUBYLIBDIR)
|
||
15 years ago
|
AC_SUBST(RUBY_LIBDIR)
|
||
12 years ago
|
AC_SUBST(RUBY_INCLUDEDIR)
|
||
15 years ago
|
AC_SUBST(RUBY_LIBRUBYARG)
|
||
12 years ago
|
AC_SUBST(RUBY_CFLAGS)
|
||
15 years ago
|
fi
|