diff options
author | Sage Weil <sage@newdream.net> | 2008-03-12 19:36:54 -0700 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2008-03-12 19:36:54 -0700 |
commit | 57db9eba54f50b56b5201a2115f1002a97589456 (patch) | |
tree | 56f6b30683791c9844f02ccdb3de33eb7fc12369 /m4 | |
parent | 05611eb377eea5a7ea182f2e0810e7ca9406abce (diff) | |
download | ceph-57db9eba54f50b56b5201a2115f1002a97589456.tar.gz |
libcrushwrapper.so now builds, yay
Diffstat (limited to 'm4')
-rw-r--r-- | m4/swig.m4 | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/m4/swig.m4 b/m4/swig.m4 new file mode 100644 index 00000000000..a024b7459e9 --- /dev/null +++ b/m4/swig.m4 @@ -0,0 +1,95 @@ +dnl check to see if SWIG is current enough. +dnl +dnl if it is, then check to see if we have the correct version of python. +dnl +dnl if we do, then set up the appropriate SWIG_ variables to build the +dnl python bindings. + +AC_DEFUN([CEPH_CHECK_SWIG], +[ + AC_ARG_WITH(swig, + AS_HELP_STRING([--with-swig=PATH], + [Try to use 'PATH/bin/swig' to build the + swig bindings. If PATH is not specified, + look for a 'swig' binary in your PATH.]), + [ + case "$withval" in + "no") + SWIG_SUITABLE=no + CEPH_FIND_SWIG(no) + ;; + "yes") + CEPH_FIND_SWIG(check) + ;; + *) + CEPH_FIND_SWIG($withval) + ;; + esac + ], + [ + CEPH_FIND_SWIG(check) + ]) +]) + +AC_DEFUN([CEPH_FIND_SWIG], +[ + where=$1 + + if test $where = no; then + AC_PATH_PROG(SWIG, none, none) + elif test $where = check; then + AC_PATH_PROG(SWIG, swig, none) + else + if test -f "$where"; then + SWIG="$where" + else + SWIG="$where/bin/swig" + fi + if test ! -f "$SWIG" || test ! -x "$SWIG"; then + AC_MSG_ERROR([Could not find swig binary at $SWIG]) + fi + fi + + if test "$SWIG" != "none"; then + AC_MSG_CHECKING([swig version]) + SWIG_VERSION_RAW="`$SWIG -version 2>&1 | \ + sed -ne 's/^.*Version \(.*\)$/\1/p'`" + # We want the version as an integer so we can test against + # which version we're using. SWIG doesn't provide this + # to us so we have to come up with it on our own. + # The major is passed straight through, + # the minor is zero padded to two places, + # and the patch level is zero padded to three places. + # e.g. 1.3.24 becomes 103024 + SWIG_VERSION="`echo \"$SWIG_VERSION_RAW\" | \ + sed -e 's/[[^0-9\.]].*$//' \ + -e 's/\.\([[0-9]]\)$/.0\1/' \ + -e 's/\.\([[0-9]][[0-9]]\)$/.0\1/' \ + -e 's/\.\([[0-9]]\)\./0\1/; s/\.//g;'`" + AC_MSG_RESULT([$SWIG_VERSION_RAW]) + # If you change the required swig version number, don't forget to update: + # subversion/bindings/swig/INSTALL + # packages/rpm/redhat-8+/subversion.spec + # packages/rpm/redhat-7.x/subversion.spec + # packages/rpm/rhel-3/subversion.spec + # packages/rpm/rhel-4/subversion.spec + SWIG_SUITABLE=yes + fi + + if test "$PERL" != "none"; then + AC_MSG_CHECKING([perl version]) + dnl Note that the q() bit is there to avoid unbalanced brackets + dnl which m4 really doesn't like. + PERL_VERSION="`$PERL -e 'q([[); print $]] * 1000000,$/;'`" + AC_MSG_RESULT([$PERL_VERSION]) + if test "$PERL_VERSION" -ge "5008000"; then + SWIG_PL_INCLUDES="\$(SWIG_INCLUDES) `$PERL -MExtUtils::Embed -e ccopts`" + else + AC_MSG_WARN([perl bindings require perl 5.8.0 or newer.]) + fi + fi + + + AC_SUBST(SWIG) + AC_SUBST(SWIG_PL_INCLUDES) +]) |