]> Dogcows Code - chaz/openbox/blob - m4/swig.m4
new swig build system. much better. yay.
[chaz/openbox] / m4 / swig.m4
1 # SWIG_PROG([required-version])
2 #
3 # Checks for the SWIG program. If found you can (and should) call SWIG via $(SWIG).
4 # You can use the optional first argument to check if the version of the available SWIG
5 # is greater or equal to the value of the argument. It should have the format:
6 # N[.N[.N]] (N is a number between 0 and 999. Only the first N is mandatory.)
7 AC_DEFUN([SWIG_PROG],[
8 AC_REQUIRE([AC_PROG_MAKE_SET])
9 AC_CHECK_PROG(SWIG,swig,[`which swig`])
10 if test -z "$SWIG" ; then
11 AC_MSG_WARN([cannot find 'swig' program])
12 SWIG=false
13 elif test -n "$1" ; then
14 AC_MSG_CHECKING([for SWIG version])
15 swig_version=`$SWIG -version 2>&1 | \
16 awk '/^SWIG Version [[0-9]+\.[0-9]+\.[0-9]]+.*$/ { split($[3],a,"[[^.0-9]]"); print a[[1]] }'`
17 AC_MSG_RESULT([$swig_version])
18 if test -n "$swig_version" ; then
19 swig_version=`echo $swig_version | \
20 awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
21 swig_required_version=`echo $1 | \
22 awk '{ split($[1],a,"\."); print [a[1]*1000000+a[2]*1000+a[3]] }' 2>/dev/null`
23 if test $swig_required_version -gt $swig_version ; then
24 AC_MSG_WARN([SWIG version $1 required])
25 fi
26 else
27 AC_MSG_WARN([cannot determine SWIG version])
28 fi
29 fi
30 ])
31
32 # SWIG_ENABLE_CXX()
33 #
34 # Enable swig C++ support. This effects all invocations of $(SWIG).
35 AC_DEFUN([SWIG_ENABLE_CXX],[
36 AC_REQUIRE([SWIG_PROG])
37 AC_REQUIRE([AC_PROG_CXX])
38 if test "$SWIG" != "false" ; then
39 SWIG="$SWIG -c++"
40 fi
41 ])
42
43 # SWIG_MULTI_MODULE_SUPPORT()
44 #
45 # Enable support for multiple modules. This effects all invocations of $(SWIG).
46 # You have to link all generated modules against the appropriate SWIG library.
47 # If you want to build Python modules for example, use the SWIG_PYTHON() macro
48 # and link the modules against $(SWIG_PYTHON_LIB). The $(SWIG_LDFLAGS) variable
49 # can be used to help the linker to find this library.
50 AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
51 AC_REQUIRE([SWIG_PROG])
52 if test "$SWIG" != "false" ; then
53 SWIG="$SWIG -c"
54
55 # Check for SWIG library path
56 AC_MSG_CHECKING([for SWIG library path])
57 swig_path=${SWIG%/bin*}/lib
58 swig_path=`find $swig_path -type f -name libswig*.a -o -name libswig*.so -print`
59 for i in $swig_path ; do
60 swig_path=${i%/libswig*}
61 break
62 done
63 AC_MSG_RESULT([$swig_path])
64 if test -n "$swig_path" ; then
65 AC_SUBST(SWIG_LDFLAGS,[-L$swig_path])
66 else
67 AC_MSG_WARN([cannot find SWIG library path])
68 fi
69 fi
70 ])
71
72 # SWIG_PYTHON([use-shadow-classes])
73 #
74 # Checks for Python and provides the $(SWIG_PYTHON_CFLAGS), $(SWIG_PYTHON_LIB) and
75 # $(SWIG_PYTHON_OPT) output variables. $(SWIG_PYTHON_OPT) contains all necessary swig
76 # options to generate code for Python. Shadow classes are enabled unless the
77 # value of the optional first argument is exactly 'no'. If you need multi module
78 # support use $(SWIG_PYTHON_LIB) (provided by the SWIG_MULTI_MODULE_SUPPORT() macro)
79 # to link against the appropriate library. It contains the SWIG Python runtime library
80 # that is needed by the type check system for example.
81 AC_DEFUN([SWIG_PYTHON],[
82 AC_REQUIRE([SWIG_PROG])
83 AC_REQUIRE([PYTHON_DEVEL])
84 if test "$SWIG" != "false" ; then
85 AC_SUBST(SWIG_PYTHON_LIB,[`$SWIG -python -ldflags`])
86 test ! "x$1" = "xno" && swig_shadow=" -shadow" || swig_shadow=""
87 AC_SUBST(SWIG_PYTHON_OPT,[-python$swig_shadow])
88 fi
89 AC_SUBST(SWIG_PYTHON_CFLAGS,[$PYTHON_CFLAGS])
90 ])
This page took 0.037359 seconds and 4 git commands to generate.