-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfigure.in
99 lines (87 loc) · 2.7 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
AC_PREREQ([2.53])
AC_INIT(rlm_ruby.c)
AC_REVISION($Revision: 1.9 $)
AC_DEFUN(modname,[rlm_ruby])
if test x$with_[]modname != xno; then
AC_PROG_CC
AC_PROG_CPP
AC_CHECK_PROGS(RUBYBIN, [ ruby ruby1.8 ], not-found, [${PATH}:/usr/bin:/usr/local/bin])
if test x$RUBYBIN = xnot-found; then
fail="ruby-binary"
fi
dnl extra argument: --with-rlm-ruby-lib-dir
RB_LIB_DIR=
AC_ARG_WITH(rlm-ruby-lib-dir,
[ --with-rlm-ruby-lib-dir=DIR Directory for Ruby library files []],
[ case "$withval" in
no)
AC_MSG_ERROR(Need rlm-ruby-lib-dir)
;;
yes)
;;
*)
RB_LIB_DIR="$withval"
;;
esac ]
)
dnl extra argument: --with-rlm-ruby-include-dir
RB_INC_DIR=
AC_ARG_WITH(rlm-ruby-include-dir,
[ --with-rlm-ruby-include-dir=DIR Directory for Ruby include files []],
[ case "$withval" in
no)
AC_MSG_ERROR(Need rlm-ruby-include-dir)
;;
yes)
;;
*)
RB_INC_DIR="$withval"
;;
esac ]
)
if test x$fail = x; then
#We use fetch, cause [] are disapearing somewere
RB_PREFIX=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('prefix')"`
RB_EXEC_PREFIX=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('exec_prefix')"`
changequote(<<, >>)dnl
RB_VERSION=`${RUBYBIN} -e 'puts RUBY_VERSION'`
changequote([, ])dnl
# RB_LIBS=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('LIBRUBY')"`
# RB_LIB_DIR=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('libdir')"`
# RB_EXTRA_LIBS=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('LIBS')"`
RB_LIBS=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('LIBRUBYARG_SHARED')"`
RB_INC_DIR=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('includedir')"`
RB_CFLAGS=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('CFLAGS')"`
RB_ARCH_DIR=`${RUBYBIN} -e "require 'rbconfig'; puts Config::CONFIG.fetch('archdir')"`
old_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $RB_CFLAGS -I${RB_ARCH_DIR} -I${RB_INC_DIR}"
# smart_try_dir=$RB_INC_DIR
ruby_cflags=$CFLAGS
CFLAGS=$old_CFLAGS
old_LIBS=$LIBS
# LIBS="$RB_LIBS $RB_LIB_DIR $RB_EXTRA_LIBS -lm"
LIBS="$RB_LIBS"
# smart_try_dir=$RB_LIB_DIR
ruby_ldflags=$LIBS
LIBS=$old_LIBS
targetname=modname
# ruby_headers="${RB_INC_DIR} ${RB_ARCH_DIR}"
fi
else
targetname=
echo \*\*\* module modname is disabled.
fi
if test x"$fail" != x""; then
if test x"${enable_strict_dependencies}" = x"yes"; then
AC_MSG_ERROR([set --without-]modname[ to disable it explicitly.])
else
AC_MSG_WARN([silently not building ]modname[.])
AC_MSG_WARN([FAILURE: ]modname[ requires: $fail.]);
targetname=""
fi
fi
AC_SUBST(ruby_ldflags)
AC_SUBST(ruby_cflags)
AC_SUBST(ruby_headers)
AC_SUBST(targetname)
AC_OUTPUT(Makefile)