summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2019-11-25 22:42:16 +0100
committerSlávek Banko <slavek.banko@axis.cz>2019-11-25 22:42:16 +0100
commit2d6d94a45c156bd29d370690f24e6e540917d085 (patch)
treefc5ab97f38f4313223e50c32cec261d8c4bb3194
parent330f486bbee53d012b4defcd4747ca23881b2928 (diff)
downloadamarok-2d6d94a45c156bd29d370690f24e6e540917d085.tar.gz
amarok-2d6d94a45c156bd29d370690f24e6e540917d085.zip
Fix bug #2056, amarok does not rely anymore on pkg-config
to build Ruby support, only rbconfig.rb is needed. Signed-off-by: gregory guy <gregory-tde@laposte.net> Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--amarok/configure.in.in116
1 files changed, 62 insertions, 54 deletions
diff --git a/amarok/configure.in.in b/amarok/configure.in.in
index c98c8ee3..fc258b7c 100644
--- a/amarok/configure.in.in
+++ b/amarok/configure.in.in
@@ -1147,62 +1147,70 @@ AC_CHECK_TYPES([uint8_t, u_int8_t, uint16_t, u_int16_t, uint32_t, u_int32_t, uin
# BEGIN DAAP MONGREL RUBY VARIABLE
###############################################################################
-AC_PATH_PROG(RUBY, ruby, no)
-
-if test -n "$PKG_CONFIG"; then
- RUBY_VERSION=`$PKG_CONFIG ruby --modversion 2>/dev/null`
- if test -n "$RUBY_VERSION"; then
- RUBY_CFLAGS=`$PKG_CONFIG 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"
- fi
- fi
+AC_CHECK_PROG(RUBY_EXECUTABLE, ruby, ruby)
+
+if test -n "RUBY_EXECUTABLE"; then
+ 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])
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_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
- AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x])
+
+ 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}"
fi
-fi
-if test -z "$RUBY_VERSION"; then
- ruby_includes=[`$RUBY -rrbconfig -e 'puts Config.expand( Config::MAKEFILE_CONFIG["archdir"] )'`]
- ruby_ldflags=[`$RUBY -rrbconfig -e 'puts Config.expand( Config::MAKEFILE_CONFIG["LIBRUBYARG_SHARED"] )'`]
- RUBY_CFLAGS="-I$ruby_includes"
- RUBY_LIBRUBYARG="$ruby_ldflags"
-fi
-AC_SUBST(RUBY_CFLAGS)
-AC_SUBST(RUBY_LIBRUBYARG)
-OLDCFLAGS="$CFLAGS"
-CFLAGS="$RUBY_CFLAGS -Wall"
-OLDCPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$RUBY_CFLAGS" #no I don't know why CPPFLAGS is used
-AC_CHECK_HEADERS([ruby.h], [have_ruby_h=yes], [have_ruby_h=no]) #used in ruby check below
-CFLAGS="$OLDCFLAGS"
-CPPFLAGS="$OLDCPPFLAGS"
+ # 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%/}
+
+ 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_SITEDIR)
+ AC_SUBST(RUBY_RUBYLIBDIR)
+ AC_SUBST(RUBY_LIBDIR)
+ AC_SUBST(RUBY_INCLUDEDIR)
+ AC_SUBST(RUBY_LIBRUBYARG)
+ AC_SUBST(RUBY_CFLAGS)
+
+ OLDCFLAGS="$CFLAGS"
+ CFLAGS="$RUBY_CFLAGS -Wall"
+ OLDCPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$RUBY_CFLAGS"
+ AC_CHECK_HEADERS([ruby.h], [have_ruby_h=yes], [have_ruby_h=no]) #used in ruby check below
+ CFLAGS="$OLDCFLAGS"
+ CPPFLAGS="$OLDCPPFLAGS"
+fi
###############################################################################
# END DAAP MONGREL RUBY VARIABLE
@@ -1215,7 +1223,7 @@ CPPFLAGS="$OLDCPPFLAGS"
###############################################################################
## TODO: Check version number >= 1.8
-if test "x$RUBY" = "xno" -o "x$have_ruby_h" = "xno"; then
+if test -z "$RUBY_EXECUTABLE" -o "x$have_ruby_h" = "xno"; then
amarok_error_noruby=yes
DO_NOT_COMPILE="$DO_NOT_COMPILE amarok"
no_amarok=yes