root/gnuradio/branches/releases/3.1/config/gr_swig.m4
| Revision 6044 (checked in by eb, 1 year ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | dnl |
| 2 | dnl Copyright 2003 Free Software Foundation, Inc. |
| 3 | dnl |
| 4 | dnl This file is part of GNU Radio |
| 5 | dnl |
| 6 | dnl GNU Radio is free software; you can redistribute it and/or modify |
| 7 | dnl it under the terms of the GNU General Public License as published by |
| 8 | dnl the Free Software Foundation; either version 3, or (at your option) |
| 9 | dnl any later version. |
| 10 | dnl |
| 11 | dnl GNU Radio is distributed in the hope that it will be useful, |
| 12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | dnl GNU General Public License for more details. |
| 15 | dnl |
| 16 | dnl You should have received a copy of the GNU General Public License |
| 17 | dnl along with GNU Radio; see the file COPYING. If not, write to |
| 18 | dnl the Free Software Foundation, Inc., 51 Franklin Street, |
| 19 | dnl Boston, MA 02110-1301, USA. |
| 20 | dnl |
| 21 | |
| 22 | # SWIG_PROG([required-version]) |
| 23 | # |
| 24 | # Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG). |
| 25 | # You can use the optional first argument to check if the version of the available SWIG |
| 26 | # is greater or equal to the value of the argument. It should have the format: |
| 27 | # N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.) |
| 28 | AC_DEFUN([SWIG_PROG],[ |
| 29 | AC_REQUIRE([AC_PROG_MAKE_SET]) |
| 30 | AC_CHECK_PROG(SWIG,swig,[`which swig`]) |
| 31 | if test -z "$SWIG" ; then |
| 32 | AC_MSG_ERROR([Cannot find 'swig' program. SWIG version >= $1 required]) |
| 33 | SWIG=false |
| 34 | elif test -n "$1" ; then |
| 35 | AC_MSG_CHECKING([for SWIG version]) |
| 36 | swig_version=`$SWIG -version 2>&1 | \ |
| 37 | awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'` |
| 38 | AC_MSG_RESULT([$swig_version]) |
| 39 | if test -n "$swig_version" ; then |
| 40 | swig_version=`echo $swig_version | \ |
| 41 | awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` |
| 42 | swig_required_version=`echo $1 | \ |
| 43 | awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null` |
| 44 | if test $swig_required_version -gt $swig_version ; then |
| 45 | AC_MSG_ERROR([SWIG version >= $1 required]) |
| 46 | fi |
| 47 | else |
| 48 | AC_MSG_ERROR([cannot determine SWIG version]) |
| 49 | fi |
| 50 | fi |
| 51 | ]) |
| 52 | |
| 53 | # SWIG_ENABLE_CXX() |
| 54 | # |
| 55 | # Enable swig C++ support. This effects all invocations of $(SWIG). |
| 56 | AC_DEFUN([SWIG_ENABLE_CXX],[ |
| 57 | AC_REQUIRE([SWIG_PROG]) |
| 58 | AC_REQUIRE([AC_PROG_CXX]) |
| 59 | if test "$SWIG" != "false" ; then |
| 60 | SWIG="$SWIG -c++" |
| 61 | fi |
| 62 | ]) |
| 63 | |
| 64 | # SWIG_PYTHON([use-shadow-classes]) |
| 65 | # |
| 66 | # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS), |
| 67 | # $(SWIG_PYTHON_LIB) and $(SWIG_PYTHON_OPT) output variables. |
| 68 | # $(SWIG_PYTHON_OPT) contains all necessary swig options to generate |
| 69 | # code for Python. If you need multi module support use |
| 70 | # $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT() |
| 71 | # macro) to link against the appropriate library. It contains the |
| 72 | # SWIG Python runtime library that is needed by the type check system |
| 73 | # for example. |
| 74 | |
| 75 | AC_DEFUN([SWIG_PYTHON],[ |
| 76 | AC_REQUIRE([SWIG_PROG]) |
| 77 | AC_REQUIRE([PYTHON_DEVEL]) |
| 78 | if test "$SWIG" != "false" ; then |
| 79 | AC_SUBST(SWIG_PYTHON_LIB,[-lswigpy]) |
| 80 | dnl test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow="" |
| 81 | dnl AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow]) |
| 82 | AC_SUBST(SWIG_PYTHON_OPT,[-python]) |
| 83 | fi |
| 84 | AC_SUBST(SWIG_PYTHON_CPPFLAGS,[$PYTHON_CPPFLAGS]) |
| 85 | ]) |
Note: See TracBrowser for help on using the browser.
