1 dnl Copyright (C) 2006-2016 CEA/DEN, EDF R&D
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License, or (at your option) any later version.
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 dnl Lesser General Public License for more details.
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 dnl @synopsis AC_PROG_SWIG([major.minor.micro])
21 dnl This macro searches for a SWIG installation on your system. If found you
22 dnl should) SWIG via $(SWIG). You can use the optional first argument to check
23 dnl if the version of the available SWIG is greater than or equal to the
24 dnl value of the argument. It should have the format: N[.N[.N]] (N is a
25 dnl number between 0 and 999. Only the first N is mandatory.)
26 dnl If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that the
27 dnl swig package is this version number or higher.
28 dnl In configure.in, use as:
29 dnl AC_PROG_SWIG(1.3.17)
31 dnl SWIG_MULTI_MODULE_SUPPORT
33 dnl @authors Sebastian Huber <address@hidden>, Alan W. Irwin
34 dnl <address@hidden>, Rafael Laboissiere <address@hidden> and
35 dnl Andrew Collier <address@hidden>.
37 AC_DEFUN([AC_PROG_SWIG],[
38 AC_PATH_PROG([SWIG],[swig])
39 if test -z "$SWIG" ; then
40 AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org])
41 SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false'
42 elif test -n "$1" ; then
43 AC_MSG_CHECKING([for SWIG version])
44 [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'`]
45 AC_MSG_RESULT([$swig_version])
46 if test -n "$swig_version" ; then
47 # Calculate the required version number components
49 [required_major=`echo $required | sed 's/[^0-9].*//'`]
50 if test -z "$required_major" ; then
53 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
54 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
55 if test -z "$required_minor" ; then
58 [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
59 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
60 if test -z "$required_patch" ; then
63 # Calculate the available version number components
64 [available=$swig_version]
65 [available_major=`echo $available | sed 's/[^0-9].*//'`]
66 if test -z "$available_major" ; then
69 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
70 [available_minor=`echo $available | sed 's/[^0-9].*//'`]
71 if test -z "$available_minor" ; then
74 [available=`echo $available | sed 's/[0-9]*[^0-9]//'`]
75 [available_patch=`echo $available | sed 's/[^0-9].*//'`]
76 if test -z "$available_patch" ; then
79 if test $available_major -ne $required_major \
80 -o $available_minor -ne $required_minor \
81 -o $available_patch -lt $required_patch ; then
82 AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org])
83 SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false'
85 AC_MSG_NOTICE([SWIG executable is '$SWIG'])
86 SWIG_LIB=`$SWIG -swiglib`
87 AC_MSG_NOTICE([SWIG runtime library directory is '$SWIG_LIB'])
90 AC_MSG_WARN([cannot determine SWIG version])
91 SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false'
99 # Enable SWIG C++ support. This affects all invocations of $(SWIG).
100 AC_DEFUN([SWIG_ENABLE_CXX],[
101 AC_REQUIRE([AC_PROG_SWIG])
102 AC_REQUIRE([AC_PROG_CXX])
106 # SWIG_MULTI_MODULE_SUPPORT()
108 # Enable support for multiple modules. This effects all invocations
109 # of $(SWIG). You have to link all generated modules against the
110 # appropriate SWIG runtime library. If you want to build Python
111 # modules for example, use the SWIG_PYTHON() macro and link the
112 # modules against $(SWIG_PYTHON_LIBS).
113 AC_DEFUN([SWIG_MULTI_MODULE_SUPPORT],[
114 AC_REQUIRE([AC_PROG_SWIG])
118 # SWIG_PYTHON([use-shadow-classes = {no, yes}])
120 # Checks for Python and provides the $(SWIG_PYTHON_CPPFLAGS),
121 # $(SWIG_PYTHON_LIBS) and $(SWIG_PYTHON_OPT) output variables.
122 # $(SWIG_PYTHON_OPT) contains all necessary SWIG options to generate
123 # code for Python. Shadow classes are enabled unless the value of the
124 # optional first argument is exactly 'no'. If you need multi module
125 # support (provided by the SWIG_MULTI_MODULE_SUPPORT() macro) use
126 # $(SWIG_PYTHON_LIBS) to link against the appropriate library. It
127 # contains the SWIG Python runtime library that is needed by the type
128 # check system for example.
129 AC_DEFUN([SWIG_PYTHON],[
130 AC_REQUIRE([AC_PROG_SWIG])
131 AC_REQUIRE([AC_PYTHON_DEVEL])
132 test "x$1" != "xno" || swig_shadow=" -noproxy"
133 AC_SUBST([SWIG_PYTHON_OPT],[-python$swig_shadow])
134 AC_SUBST([SWIG_PYTHON_CPPFLAGS],[$PYTHON_CPPFLAGS])
135 AC_SUBST([SWIG_PYTHON_LIBS],["-L$SWIG_LIB -lswigpy"])
139 dnl @synopsis AC_LIB_WAD
141 dnl This macro searches for installed WAD library.
143 AC_DEFUN([AC_LIB_WAD],
145 AC_REQUIRE([AC_PYTHON_DEVEL])
147 AC_HELP_STRING([--enable-wad], [enable wad module]),
149 case "${enableval}" in
151 *) if test "x${enableval}" = xyes;
158 if test -n "$check_wad";
160 AC_CHECK_LIB(wadpy, _init, [WADPY=-lwadpy], [], $PYTHON_LDFLAGS $PYTHON_EXTRA_LIBS)