source: m4/ac_pkg_swig.m4

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file was 47de0aa, checked in by Daniel Lawson <dlawson@…>, 15 years ago
  • Cosmetic changes to trace_help() output
  • inclusion of some m4 handlers to deal with swig and python, lifted from http://autoconf-archive.cryp.to/. These are GPLd, which needs to be taken into account if libtrace licensing changes!
  • updated the swig bindings for python. Mostly api compliant now. Still possibly a memory leak to do with displaying ip addresses - I haven't touched this particular part of the code yet.
  • Property mode set to 100644
File size: 6.7 KB
Line 
1dnl @synopsis AC_PROG_SWIG([major.minor.micro])
2dnl
3dnl This macro searches for a SWIG installation on your system. If
4dnl found you should call SWIG via $(SWIG). You can use the optional
5dnl first argument to check if the version of the available SWIG is
6dnl greater than or equal to the value of the argument. It should have
7dnl the format: N[.N[.N]] (N is a number between 0 and 999. Only the
8dnl first N is mandatory.)
9dnl
10dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks
11dnl that the swig package is this version number or higher.
12dnl
13dnl In configure.in, use as:
14dnl
15dnl             AC_PROG_SWIG(1.3.17)
16dnl             SWIG_ENABLE_CXX
17dnl             SWIG_MULTI_MODULE_SUPPORT
18dnl             SWIG_PYTHON
19dnl
20dnl @category InstalledPackages
21dnl @author Sebastian Huber <sebastian-huber@web.de>
22dnl @author Alan W. Irwin <irwin@beluga.phys.uvic.ca>
23dnl @author Rafael Laboissiere <rafael@laboissiere.net>
24dnl @author Andrew Collier <abcollier@yahoo.com>
25dnl @version 2004-09-20
26dnl @license GPLWithACException
27
28AC_DEFUN([AC_PROG_SWIG],[
29        AC_PATH_PROG([SWIG],[swig])
30        if test -z "$SWIG" ; then
31                AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
32                SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
33        elif test -n "$1" ; then
34                AC_MSG_CHECKING([for SWIG version])
35                [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
36                AC_MSG_RESULT([$swig_version])
37                if test -n "$swig_version" ; then
38                        # Calculate the required version number components
39                        [required=$1]
40                        [required_major=`echo $required | sed 's/[^0-9].*//'`]
41                        if test -z "$required_major" ; then
42                                [required_major=0]
43                        fi
44                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
45                        [required_minor=`echo $required | sed 's/[^0-9].*//'`]
46                        if test -z "$required_minor" ; then
47                                [required_minor=0]
48                        fi
49                        [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
50                        [required_patch=`echo $required | sed 's/[^0-9].*//'`]
51                        if test -z "$required_patch" ; then
52                                [required_patch=0]
53                        fi
54                        # Calculate the available version number components
55                        [available=$swig_version]
56                        [available_major=`echo $available | sed 's/[^0-9].*//'`]
57                        if test -z "$available_major" ; then
58                                [available_major=0]
59                        fi
60                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
61                        [available_minor=`echo $available | sed 's/[^0-9].*//'`]
62                        if test -z "$available_minor" ; then
63                                [available_minor=0]
64                        fi
65                        [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
66                        [available_patch=`echo $available | sed 's/[^0-9].*//'`]
67                        if test -z "$available_patch" ; then
68                                [available_patch=0]
69                        fi
70                        if test $available_major -ne $required_major \
71                                -o $available_minor -ne $required_minor \
72                                -o $available_patch -lt $required_patch ; then
73                                AC_MSG_WARN([SWIG version >= $1 is required.  You have $swig_version.  You should look at http://www.swig.org])
74                                SWIG='echo "Error: SWIG version >= $1 is required.  You have '"$swig_version"'.  You should look at http://www.swig.org" ; false'
75                        else
76                                AC_MSG_NOTICE([SWIG executable is '$SWIG'])
77                                SWIG_LIB=`$SWIG -swiglib`
78                                AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB'])
79                        fi
80                else
81                        AC_MSG_WARN([cannot determine SWIG version])
82                        SWIG='echo "Error: Cannot determine SWIG version.  You should look at http://www.swig.org" ; false'
83                fi
84        fi
85        AC_SUBST([SWIG_LIB])
86])
87
88# SWIG_ENABLE_CXX()
89#
90# Enable SWIG C++ support.  This affects all invocations of $(SWIG).
91AC_DEFUN([SWIG_ENABLE_CXX],[
92        AC_REQUIRE([AC_PROG_SWIG])
93        AC_REQUIRE([AC_PROG_CXX])
94        SWIG="$SWIG -c++"
95])
96
97# SWIG_MULTI_MODULE_SUPPORT()
98#
99# Enable support for multiple modules.  This effects all invocations
100# of $(SWIG).  You have to link all generated modules against the
101# appropriate SWIG runtime library.  If you want to build Python
102# modules for example, use the SWIG_PYTHON() macro and link the
103# modules against $(SWIG_PYTHON_LIBS).
104#
105AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
106        AC_REQUIRE([AC_PROG_SWIG])
107        SWIG="$SWIG -noruntime"
108])
109
110# SWIG_PYTHON([use-shadow-classes = {no, yes}])
111#
112# Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
113# and $(SWIG_PYTHON_OPT) output variables.
114#
115# $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
116# code for Python.  Shadow classes are enabled unless the value of the
117# optional first argument is exactly 'no'.  If you need multi module
118# support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
119# $(SWIG_PYTHON_LIBS) to link against the appropriate library.  It
120# contains the SWIG Python runtime library that is needed by the type
121# check system for example.
122AC_DEFUN([SWIG_PYTHON],[
123        AC_REQUIRE([AC_PROG_SWIG])
124        AC_REQUIRE([AC_PYTHON_DEVEL])
125        test "x$1" != "xno" || swig_shadow=" -noproxy"
126        AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
127        AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
128])
129
130
131dnl @synopsis AC_LIB_WAD
132dnl
133dnl This macro searches for installed WAD library.
134dnl
135AC_DEFUN([AC_LIB_WAD],
136[
137        AC_REQUIRE([AC_PYTHON_DEVEL])
138        AC_ARG_ENABLE(wad,
139        AC_HELP_STRING([--enable-wad], [enable wad module]),
140        [
141                case "${enableval}" in
142                        no)     ;;
143                        *)      if test "x${enableval}" = xyes;
144                                then
145                                        check_wad="yes"
146                                fi ;;
147                esac
148        ], [])
149
150        if test -n "$check_wad";
151        then
152                AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)
153                AC_SUBST(WADPY)
154        fi
155])
Note: See TracBrowser for help on using the repository browser.