source: branches/1.4/cf/ax_ruby_dev_flags.m4 @ 5291

Last change on this file since 5291 was 1081, checked in by gah, 16 years ago

fix for perl, ruby bindings; visviewer SendBytes? method sends all data at once

File size: 2.5 KB
Line 
1
2AC_DEFUN([AX_RUBY_DEV_FLAGS],[
3    #
4    # Check for Ruby include path
5    #
6    AC_MSG_CHECKING([for Ruby include path])
7    if test -z "$RUBY_CPPFLAGS"; then
8        ruby_path=`$RUBY -rmkmf -e 'print Config::CONFIG[["archdir"]]'`
9        if test -n "${ruby_path}"; then
10                ruby_path="-I$ruby_path"
11        fi
12        RUBY_CPPFLAGS=$ruby_path
13    fi
14    AC_MSG_RESULT([$RUBY_CPPFLAGS])
15    AC_SUBST([RUBY_CPPFLAGS])
16
17    #
18    # Check for Ruby library path
19    #
20    AC_MSG_CHECKING([for Ruby library path])
21    if test -z "$RUBY_LDFLAGS"; then
22        RUBY_LDFLAGS=`$RUBY -rmkmf -e 'print Config::CONFIG[["LIBRUBYARG_SHARED"]]'`
23    fi
24    AC_MSG_RESULT([$RUBY_LDFLAGS])
25    AC_SUBST([RUBY_LDFLAGS])
26
27    #
28    # Check for site packages
29    #
30    AC_MSG_CHECKING([for Ruby site-packages path])
31    if test -z "$RUBY_SITE_PKG"; then
32        RUBY_SITE_PKG=`$RUBY -rmkmf -e 'print Config::CONFIG[["sitearchdir"]]'`
33    fi
34    AC_MSG_RESULT([$RUBY_SITE_PKG])
35    AC_SUBST([RUBY_SITE_PKG])
36
37    #
38    # libraries which must be linked in when embedding
39    #
40    AC_MSG_CHECKING(ruby extra libraries)
41    if test -z "$RUBY_EXTRA_LIBS"; then
42       RUBY_EXTRA_LIBS=`$RUBY -rmkmf -e 'print Config::CONFIG[["SOLIBS"]]'`
43    fi
44    AC_MSG_RESULT([$RUBY_EXTRA_LIBS])
45    AC_SUBST(RUBY_EXTRA_LIBS)
46
47    #
48    # linking flags needed when embedding
49    # (is it even needed for Ruby?)
50    #
51    # AC_MSG_CHECKING(ruby extra linking flags)
52    # if test -z "$RUBY_EXTRA_LDFLAGS"; then
53    # RUBY_EXTRA_LDFLAGS=`$RUBY -rmkmf -e 'print Config::CONFIG[["LINKFORSHARED"]]'`
54    # fi
55    # AC_MSG_RESULT([$RUBY_EXTRA_LDFLAGS])
56    # AC_SUBST(RUBY_EXTRA_LDFLAGS)
57
58    # this flags breaks ruby.h, and is sometimes defined by KDE m4 macros
59    CFLAGS="`echo "$CFLAGS" | sed -e 's/-std=iso9899:1990//g;'`"
60    #
61    # final check to see if everything compiles alright
62    #
63    AC_MSG_CHECKING([consistency of all components of ruby development environment])
64    AC_LANG_PUSH([C])
65    # save current global flags
66    ac_save_LIBS="$LIBS"
67    LIBS="$ac_save_LIBS $RUBY_LDFLAGS"
68    ac_save_CPPFLAGS="$CPPFLAGS"
69    CPPFLAGS="$ac_save_CPPFLAGS $RUBY_CPPFLAGS"
70    AC_TRY_LINK([
71        #include <ruby.h>
72    ],[
73        ruby_init();
74    ],[rubyexists=yes],[rubyexists=no])
75
76    AC_MSG_RESULT([$rubyexists])
77
78    if test "$rubyexists" = "no"; then
79      HAVE_RUBY_DEVEL="no"
80    fi
81    AC_LANG_POP
82    # turn back to default flags
83    CPPFLAGS="$ac_save_CPPFLAGS"
84    LIBS="$ac_save_LIBS"
85
86    #
87    # all done!
88    #
89])
Note: See TracBrowser for help on using the repository browser.