Skip to content

Instantly share code, notes, and snippets.

@koudelka
Created May 9, 2010 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koudelka/394844 to your computer and use it in GitHub Desktop.
Save koudelka/394844 to your computer and use it in GitHub Desktop.
diff --git a/src/configure.in b/src/configure.in
index 85df7da..c812062 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -996,72 +996,75 @@ if test "$enable_rubyinterp" = "yes"; then
AC_ARG_WITH(ruby-command, [ --with-ruby-command=RUBY name of the Ruby command (default: ruby)],
RUBY_CMD="$withval"; AC_MSG_RESULT($RUBY_CMD),
RUBY_CMD="ruby"; AC_MSG_RESULT(defaulting to $RUBY_CMD))
+ if test "X$vi_cv_path_ruby" = "X"; then
+ vi_cv_path_ruby=$withval
+ fi
AC_SUBST(vi_cv_path_ruby)
AC_PATH_PROG(vi_cv_path_ruby, $RUBY_CMD)
- if test "X$vi_cv_path_ruby" != "X"; then
- AC_MSG_CHECKING(Ruby version)
- if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
- AC_MSG_RESULT(OK)
- AC_MSG_CHECKING(Ruby header files)
- rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
- if test "X$rubyhdrdir" != "X"; then
- AC_MSG_RESULT($rubyhdrdir)
- RUBY_CFLAGS="-I$rubyhdrdir"
- rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
- if test -d "$rubyhdrdir/$rubyarch"; then
- RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
+ AC_MSG_CHECKING(Ruby version)
+ if $vi_cv_path_ruby -e '(VERSION rescue RUBY_VERSION) >= "1.6.0" or exit 1' >/dev/null 2>/dev/null; then
+ AC_MSG_RESULT(OK)
+ AC_MSG_CHECKING(Ruby header files)
+ rubyhdrdir=`$vi_cv_path_ruby -r mkmf -e 'print Config::CONFIG[["rubyhdrdir"]] || Config::CONFIG[["archdir"]] || $hdrdir' 2>/dev/null`
+ AC_SUBST(rubyhdrdir)
+ if test "X$rubyhdrdir" != "X"; then
+ AC_MSG_RESULT($rubyhdrdir)
+ RUBY_CFLAGS="-I$rubyhdrdir"
+ rubyarch=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["arch"]]'`
+ if test -d "$rubyhdrdir/$rubyarch"; then
+ RUBY_CFLAGS="$RUBY_CFLAGS -I$rubyhdrdir/$rubyarch"
+ fi
+ rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
+ RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
+ rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
+ if test "X$rubylibs" != "X"; then
+ RUBY_LIBS="$rubylibs"
+ fi
+ librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
+ if test -f "$rubyhdrdir/$librubyarg"; then
+ librubyarg="$rubyhdrdir/$librubyarg"
+ else
+ rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
+ if test $RUBY_CMD != $withval && test -d "/System/Library/Frameworks/Ruby.framework"; then
+ dnl On Mac OS X it is safer to just use the -framework flag
+ RUBY_LIBS="-framework Ruby"
+ dnl Don't include the -I flag when -framework is set
+ RUBY_CFLAGS=
+ librubyarg=
+ elif test -f "$rubylibdir/$librubyarg"; then
+ librubyarg="$rubylibdir/$librubyarg"
+ elif test "$librubyarg" = "libruby.a"; then
+ dnl required on Mac OS 10.3 where libruby.a doesn't exist
+ librubyarg="-lruby"
+ else
+ echo $librubyarg
+ librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, '') << %' -L#{Config.expand(Config::CONFIG[\"libdir\"])}'"`
fi
- rubyversion=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["ruby_version"]].gsub(/\./, "")[[0,2]]'`
- RUBY_CFLAGS="$RUBY_CFLAGS -DRUBY_VERSION=$rubyversion"
- rubylibs=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LIBS"]]'`
- if test "X$rubylibs" != "X"; then
- RUBY_LIBS="$rubylibs"
- fi
- librubyarg=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["LIBRUBYARG"]])'`
- if test -f "$rubyhdrdir/$librubyarg"; then
- librubyarg="$rubyhdrdir/$librubyarg"
- else
- rubylibdir=`$vi_cv_path_ruby -r rbconfig -e 'print Config.expand(Config::CONFIG[["libdir"]])'`
- if test -d "/System/Library/Frameworks/Ruby.framework"; then
- dnl On Mac OS X it is safer to just use the -framework flag
- RUBY_LIBS="-framework Ruby"
- dnl Don't include the -I flag when -framework is set
- RUBY_CFLAGS=
- librubyarg=
- elif test -f "$rubylibdir/$librubyarg"; then
- librubyarg="$rubylibdir/$librubyarg"
- elif test "$librubyarg" = "libruby.a"; then
- dnl required on Mac OS 10.3 where libruby.a doesn't exist
- librubyarg="-lruby"
- else
- librubyarg=`$vi_cv_path_ruby -r rbconfig -e "print '$librubyarg'.gsub(/-L\./, %'-L#{Config.expand(Config::CONFIG[\"libdir\"])}')"`
- fi
- fi
+ fi
- if test "X$librubyarg" != "X"; then
- RUBY_LIBS="$librubyarg $RUBY_LIBS"
- fi
- rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
- if test "x$MACOSX" = "xyes"; then
- dnl Ruby on Mac OS X 10.5 and later adds "-arch" flags but these
- dnl should only be included if requested by passing --with-archs
- dnl to configure, so strip these flags first (if present)
- rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[[^-]]*//g'`
- fi
- if test "X$rubyldflags" != "X"; then
- LDFLAGS="$rubyldflags $LDFLAGS"
- fi
- RUBY_SRC="if_ruby.c"
- RUBY_OBJ="objects/if_ruby.o"
- RUBY_PRO="if_ruby.pro"
+ if test "X$librubyarg" != "X"; then
+ RUBY_LIBS="$librubyarg $RUBY_LIBS"
+ fi
+ rubyldflags=`$vi_cv_path_ruby -r rbconfig -e 'print Config::CONFIG[["LDFLAGS"]]'`
+ if test "x$MACOSX" = "xyes"; then
+ dnl Ruby on Mac OS X 10.5 and later adds "-arch" flags but these
+ dnl should only be included if requested by passing --with-archs
+ dnl to configure, so strip these flags first (if present)
+ rubyldflags=`echo "$rubyldflags" | sed -e 's/-arch[[^-]]*//g'`
+ fi
+ if test "X$rubyldflags" != "X"; then
+ LDFLAGS="$rubyldflags $LDFLAGS"
+ fi
+ RUBY_SRC="if_ruby.c"
+ RUBY_OBJ="objects/if_ruby.o"
+ RUBY_PRO="if_ruby.pro"
- AC_DEFINE(FEAT_RUBY)
+ AC_DEFINE(FEAT_RUBY)
else
- AC_MSG_RESULT(not found; disabling Ruby)
- fi
- else
- AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
+ AC_MSG_RESULT(not found; disabling Ruby)
fi
+ else
+ AC_MSG_RESULT(too old; need Ruby version 1.6.0 or later)
fi
fi
AC_SUBST(RUBY_SRC)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment