File: acinclude.m4

package info (click to toggle)
langscan 1.2%2Bcvs20070125-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,316 kB
  • ctags: 1,892
  • sloc: ruby: 5,346; lex: 1,906; ansic: 1,583; makefile: 442; perl: 205; ml: 131; sh: 52
file content (104 lines) | stat: -rw-r--r-- 3,082 bytes parent folder | download
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
100
101
102
103
104
AC_DEFUN([AM_PATH_RUBY_BIN],
 [dnl # 
  dnl # Check Ruby excecutable
  dnl #
  AC_ARG_WITH(ruby,
    AC_HELP_STRING([--with-ruby=PATH],[path to ruby executable]),
    [
      AC_MSG_RESULT([using $withval for ruby])
      RUBY="$withval"
    ], [
      AC_PATH_PROG(RUBY, ruby, no)
    ])
  if test "$RUBY" == "no" -o ! -x "$RUBY"; then
    AC_MSG_ERROR(ruby executable not found)
  fi
  dnl # 
  dnl # Check the Ruby version
  dnl # 
  REQUIRED_VERSION="$1"
  AC_MSG_CHECKING([ruby version...])
  RUBY_VERSION="`$RUBY -e "puts RUBY_VERSION"`"
  if ruby -e "exit(RUBY_VERSION >= '$REQUIRED_VERSION')" >/dev/null; then
    AC_MSG_RESULT($RUBY_VERSION found)
  else
    AC_MSG_RESULT($RUBY_VERSION found)
    AC_MSG_ERROR($REQUIRED_VERSION or later is needed)
  fi
  ])

AC_DEFUN([AM_PATH_RUBY_LIB],
 [dnl # 
  dnl # Check Ruby lib directory
  dnl #
  AC_ARG_WITH(rubydir,
    AC_HELP_STRING([--with-rubydir=PATH],[path to ruby library]),
    [case "${withval}" in
       yes)	rubydir= ;;
       no)	AC_MSG_ERROR(rubydir is not available) ;;
       *)	rubydir=${withval} ;;
     esac], rubydir=)
  AC_MSG_CHECKING([path to ruby library])
  if test "x$rubydir" = x; then
    changequote(<<, >>)
    rubydir=`ruby -rrbconfig -e 'puts Config::CONFIG["sitelibdir"]'`
    changequote([, ])
  fi
  AC_MSG_RESULT($rubydir)
  AC_SUBST(rubydir)

  AC_ARG_WITH(rubyarchdir,
    AC_HELP_STRING([--with-rubyarchdir=PATH],[path to ruby binary library]),
    [case "${withval}" in
       yes)	rubyarchdir= ;;
       no)	AC_MSG_ERROR(rubyarchdir is not available) ;;
       *)	rubyarchdir=${withval} ;;
     esac], rubyarchdir=)
  AC_MSG_CHECKING([path to ruby binary library])
  if test "x$rubyarchdir" = x; then
    changequote(<<, >>)
    rubyarchdir=`ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]'`
    changequote([, ])
  fi
  AC_MSG_RESULT($rubyarchdir)
  AC_SUBST(rubyarchdir)

  changequote(<<, >>)
  RUBY_CC="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["CC"]'`"
  RUBY_LDSHARED="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["LDSHARED"]'`"
  RUBY_CFLAGS="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["CCDLFLAGS"] + " " + Config::MAKEFILE_CONFIG["CFLAGS"]'`"
  RUBY_DLEXT="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["DLEXT"]'`"
  RUBY_DLDFLAGS="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["DLDFLAGS"]'`"
  RUBY_LIBS="`ruby -rmkmf -e 'puts Config::MAKEFILE_CONFIG["LIBS"]'`"
  RUBY_HDRHDIR="`ruby -rmkmf -e 'puts Config::CONFIG["archdir"]'`"
  RUBY_CPPFLAGS='-I. -I$(RUBY_HDRHDIR)'
  changequote([, ])

  AC_SUBST(RUBY_CC)
  AC_SUBST(RUBY_LDSHARED)
  AC_SUBST(RUBY_CFLAGS)
  AC_SUBST(RUBY_DLEXT)
  AC_SUBST(RUBY_DLDFLAGS)
  AC_SUBST(RUBY_LIBS)
  AC_SUBST(RUBY_HDRHDIR)
  AC_SUBST(RUBY_CPPFLAGS)
])


AC_DEFUN([AM_CHECK_RUBY_LIB],
 [dnl # 
  dnl # Check a library for Ruby
  dnl #
  LIB="$1"
  URL="$2"
  AC_MSG_CHECKING([$LIB for ruby...])
  if ruby -r$LIB -e '' 2>/dev/null; then
    AC_MSG_RESULT(found)
  else
    AC_MSG_RESULT(not found)
    if test "$URL"; then
        AC_MSG_RESULT($LIB is available at <$URL>)
    fi
    AC_MSG_ERROR($LIB for ruby not found)
  fi])