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.
151 lines
6.2 KiB
151 lines
6.2 KiB
KDE_FIND_PATH(pkg-config, PKGCONFIG, [${prefix}/bin ${exec_prefix}/bin /usr/bin /usr/local/bin /opt/local/bin], [
|
|
AC_MSG_WARN([Could not find pkg-config])
|
|
])
|
|
|
|
AC_ARG_ENABLE(scripting,
|
|
AC_HELP_STRING([--enable-scripting],
|
|
[build scripting library (Kross) [default=yes]]),
|
|
compile_kross=$enableval, compile_kross=yes)
|
|
AM_CONDITIONAL(compile_kross, test "x$compile_kross" = "xyes")
|
|
|
|
###############################
|
|
# Check if Python is installed.
|
|
|
|
if test "x$compile_kross" = "xyes" ; then
|
|
#KDE_CHECK_PYTHON(2.3)
|
|
KDE_CHECK_PYTHON
|
|
fi
|
|
|
|
# Compile the Kross python plugin only if both, $LIBPYTHON and
|
|
# $PYTHONINC, are defined.
|
|
AM_CONDITIONAL(compile_kross_python,
|
|
test -n "$LIBPYTHON" && test -n "$PYTHONINC")
|
|
|
|
###############################
|
|
# Check for Ruby
|
|
|
|
if test "x$compile_kross" = "xyes" ; then
|
|
AC_CHECK_PROGS([RUBY], [ruby ruby1.8 ruby18 ruby1.9 ruby19], ruby)
|
|
|
|
if test -n "$RUBY"; then
|
|
AC_MSG_CHECKING(for Ruby dirs)
|
|
# Note: pkgconfig file exists only for ruby >= 1.9.3
|
|
if test -n "$PKGCONFIG"; then
|
|
RUBY_VERSION=`$PKGCONFIG ruby --modversion 2>/dev/null`
|
|
if test -n "$RUBY_VERSION"; then
|
|
RUBY_CFLAGS=`$PKGCONFIG ruby --cflags`
|
|
fi
|
|
if test -z "$RUBY_VERSION"; then
|
|
for RUBY_TEST in 2.5 2.4 2.3 2.2 2.1 2.0 1.9; do
|
|
RUBY_VERSION=`$PKG_CONFIG ruby-$RUBY_TEST --modversion 2>/dev/null`
|
|
if test -n "$RUBY_VERSION"; then
|
|
RUBY_CFLAGS=`$PKG_CONFIG ruby-$RUBY_TEST --cflags`
|
|
break
|
|
fi
|
|
done
|
|
fi
|
|
if test -z "$RUBY_VERSION"; then
|
|
# pkgconfig file does not exist but might be 1.9.1: RUBY_VERSION defined in ruby/version.h
|
|
if test -n "$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'"; then
|
|
# rubyhdrdir parameter works only in >=1.9.1; this is 1.9.1
|
|
RUBY_MAJOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MAJOR']"@:>@)'`
|
|
RUBY_MINOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MINOR']"@:>@)'`
|
|
RUBY_TEENY=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['TEENY']"@:>@)'`
|
|
if test "$RUBY_MAJOR" == "1" && test "$RUBY_MINOR" == "9"; then
|
|
RUBY_VERSION="$RUBY_MAJOR.$RUBY_MINOR.$RUBY_TEENY"
|
|
RUBY_CFLAGS="-I`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'`"
|
|
RUBY_CFLAGS="$RUBY_CFLAGS/`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"arch"@:>@)'` $RUBY_CFLAGS"
|
|
if test -n "`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`"; then
|
|
RUBY_ENABLESHARED=yes
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
if test -n "$RUBY_VERSION"; then
|
|
RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"archdir"@:>@)'`
|
|
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitearchdir"@:>@)'`
|
|
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitelibdir"@:>@)'`
|
|
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubylibdir"@:>@)'`
|
|
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"libdir"@:>@)'`
|
|
RUBY_INCLUDEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'`
|
|
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
|
|
RUBY_ENABLESHARED=yes
|
|
AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x])
|
|
fi
|
|
fi
|
|
if test -z "$RUBY_VERSION"; then
|
|
RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
|
|
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
|
|
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
|
|
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubylibdir"@:>@)'`
|
|
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
|
|
RUBY_INCLUDEDIR=$RUBY_ARCHDIR
|
|
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
|
|
RUBY_ENABLESHARED=yes
|
|
fi
|
|
AC_MSG_RESULT([
|
|
archdir $RUBY_ARCHDIR,
|
|
sitearchdir $RUBY_SITEARCHDIR,
|
|
sitedir $RUBY_SITEDIR,
|
|
rubylibdir $RUBY_RUBYLIBDIR,
|
|
libdir $RUBY_LIBDIR,
|
|
includedir $RUBY_INCLUDEDIR,
|
|
librubyarg $RUBY_LIBRUBYARG,
|
|
cflags $RUBY_CFLAGS])
|
|
AC_SUBST(RUBY_ARCHDIR)
|
|
AC_SUBST(RUBY_SITEARCHDIR)
|
|
AC_SUBST(RUBY_RUBYLIBDIR)
|
|
AC_SUBST(RUBY_INCLUDEDIR)
|
|
AC_SUBST(RUBY_LIBRUBYARG)
|
|
AC_SUBST(RUBY_SITEDIR)
|
|
AC_SUBST(RUBY_CFLAGS)
|
|
AC_SUBST(RUBY_ENABLESHARED)
|
|
|
|
AC_MSG_CHECKING(for Ruby header)
|
|
|
|
if test ! -r $RUBY_INCLUDEDIR/ruby.h; then
|
|
# if $RUBY_INCLUDEDIR is not valid try to use $RUBY_ARCHDIR
|
|
RUBY_INCLUDEDIR=$RUBY_ARCHDIR
|
|
fi
|
|
|
|
AC_MSG_RESULT([found]) # header
|
|
|
|
AC_MSG_CHECKING(Ruby shared library)
|
|
if test "x$RUBY_ENABLESHARED" != "xyes" ; then
|
|
AC_MSG_RESULT([shared library not found])
|
|
RUBY_LIBDIR=""
|
|
else
|
|
if test -z "$RUBY_LIBRUBYARG" ; then
|
|
AC_MSG_RESULT([link argument not found])
|
|
RUBY_LIBDIR=""
|
|
else
|
|
AC_MSG_RESULT([found]) # shared library link arg
|
|
|
|
AC_MSG_CHECKING([if C++ program with ruby can be compiled])
|
|
AC_LANG_SAVE
|
|
AC_LANG_CPLUSPLUS
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
|
CXXFLAGS="$CXXFLAGS -I$RUBY_INCLUDEDIR $RUBY_CFLAGS"
|
|
AC_CACHE_VAL(ruby_build,
|
|
[
|
|
AC_TRY_COMPILE([
|
|
#include <ruby.h>
|
|
],[
|
|
ruby_init();
|
|
return 0;
|
|
], ruby_build=yes,
|
|
ruby_build=no)
|
|
])
|
|
AC_MSG_RESULT($ruby_build)
|
|
if test "$ruby_build" = "no"; then
|
|
RUBY_LIBDIR=""
|
|
fi
|
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
|
AC_LANG_RESTORE
|
|
fi # have ruby shared lib argument
|
|
fi # have shared lib
|
|
fi # have ruby
|
|
fi # compiling kross
|
|
|
|
AM_CONDITIONAL(compile_kross_ruby, test -n "$RUBY_LIBDIR")
|