1099.1.1
by Monty Taylor
pandora-build v0.23 |
1 |
dnl -*- mode: m4; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
2 |
dnl vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
|
3 |
dnl |
|
4 |
dnl pandora-build: A pedantic build system |
|
5 |
dnl Copyright (C) 2009 Sun Microsystems, Inc. |
|
1126.6.8
by Monty Taylor
pandora-build v0.62 - cleaned up some copyright header mistakes. Merged in trond's innodb detection. |
6 |
dnl This file is free software; Sun Microsystems |
1099.1.1
by Monty Taylor
pandora-build v0.23 |
7 |
dnl gives unlimited permission to copy and/or distribute it, |
8 |
dnl with or without modifications, as long as this notice is preserved. |
|
9 |
dnl
|
|
10 |
dnl From Monty Taylor |
|
11 |
||
12 |
||
13 |
AC_DEFUN([PANDORA_WITH_RUBY], [ |
|
14 |
||
15 |
AC_ARG_WITH([ruby], |
|
16 |
[AS_HELP_STRING([--with-ruby], |
|
17 |
[Build Ruby Bindings @<:@default=yes@:>@])], |
|
18 |
[with_ruby=$withval], |
|
19 |
[with_ruby=ruby]) |
|
20 |
||
21 |
AS_IF([test "x$with_ruby" != "xno"],[ |
|
22 |
AS_IF([test "x$with_ruby" != "xyes"], |
|
23 |
[ac_chk_ruby=$with_ruby], |
|
24 |
[ac_chk_ruby=ruby1.8 ruby]) |
|
25 |
AC_CHECK_PROGS(RUBY,$ac_chk_ruby) |
|
26 |
]) |
|
27 |
||
28 |
AS_IF([test "x$RUBY" != "x"],[ |
|
29 |
||
30 |
AC_MSG_CHECKING(for ruby devel)
|
|
31 |
||
32 |
dnl need to change quotes to allow square brackets
|
|
33 |
changequote(<<, >>)dnl
|
|
34 |
ruby_prefix=`$RUBY -rrbconfig -e "print Config::CONFIG['archdir']"` |
|
35 |
strip_ruby_prefix=`$RUBY -rrbconfig -e "print Config::CONFIG['prefix']" | sed 's/\//./g'` |
|
36 |
|
|
37 |
RUBY_LIB=`$RUBY -rrbconfig -e "puts Config::CONFIG['ruby_install_name']"` |
|
38 |
LIBRUBYARG_SHARED=`$RUBY -rrbconfig -e "puts Config::CONFIG['LIBRUBYARG_SHARED']"` |
|
39 |
RUBY_DIR=`$RUBY -rrbconfig -e "puts Config::CONFIG['archdir']"` |
|
40 |
RUBY_ARCH_DIR=`echo $RUBY_DIR | sed "s/$strip_ruby_prefix//"` |
|
41 |
RUBY_LIBDIR=`$RUBY -rrbconfig -e "puts Config::CONFIG['rubylibdir']"` |
|
42 |
RUBY_INCLUDES="-I$ruby_prefix" |
|
43 |
changequote([, ])dnl
|
|
44 |
||
45 |
ac_save_CFLAGS="$CFLAGS" |
|
46 |
ac_save_CPPFLAGS="$CPPFLAGS" |
|
47 |
ac_save_LDFLAGS="$LDFLAGS" |
|
48 |
CFLAGS="$ac_save_CFLAGS $RUBY_INCLUDES" |
|
49 |
CPPFLAGS="$ac_save_CPPFLAGS $RUBY_INCLUDES" |
|
50 |
LDFLAGS="$ac_save_LDFLAGS $LIBRUBYARG_SHARED" |
|
51 |
|
|
52 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ruby.h>]], [[VALUE rb_ac_test = rb_define_module("actest");]])],[with_ruby="yes";AC_MSG_RESULT(found)],[with_ruby="no";AC_MSG_RESULT(missing)]) |
|
53 |
||
54 |
CPPFLAGS="$ac_save_CPPFLAGS" |
|
55 |
CFLAGS="$ac_save_CFLAGS" |
|
56 |
LDFLAGS="$ac_save_LDFLAGS" |
|
57 |
],[
|
|
58 |
# This allows 'make clean' in the ruby directory to work when
|
|
59 |
# ruby isn't available
|
|
60 |
RUBY=
|
|
61 |
RUBY_INCLUDES=
|
|
62 |
LIBRUBYARG_SHARED=
|
|
63 |
RUBY_LIB=
|
|
64 |
RUBY_DIR=
|
|
65 |
RUBY_LIBDIR=
|
|
66 |
RUBY_ARCH_DIR=
|
|
67 |
with_ruby="no" |
|
68 |
])
|
|
69 |
||
70 |
AC_SUBST(RUBY_INCLUDES)
|
|
71 |
AC_SUBST(LIBRUBYARG_SHARED)
|
|
72 |
AC_SUBST(RUBY_LIB)
|
|
73 |
AC_SUBST(RUBY_DIR)
|
|
74 |
AC_SUBST(RUBY_LIBDIR)
|
|
75 |
AC_SUBST(RUBY_ARCH_DIR)
|
|
76 |
||
77 |
AS_IF([test "x$RUBY_DIR" = "x"],[with_ruby="no"]) |
|
78 |
AM_CONDITIONAL(BUILD_RUBY, test "$with_ruby" = "yes") |
|
79 |
]) |