Add several fixed files for swig.

Workaround for broken swig, which allows old swig versions to work too.

These files should be removed when fixed swig is released.

Thanks to Juvenal for suggestion.
This commit is contained in:
Alexey Sokolov
2012-08-15 01:42:46 +07:00
parent 6b550f214d
commit cc52a7d2be
10 changed files with 3190 additions and 16 deletions
+38 -10
View File
@@ -55,13 +55,28 @@ AC_DEFUN([AC_PROG_SWIG],[
# for "python 3 abc set" and "PyInt_FromSize_t in python3" checks
cat <<-END > conftest.i
cat <<-END > conftest-python.i
%module conftest;
%include <pyabc.i>
%include <std_set.i>
%template(SInt) std::set<int>;
END
AC_CACHE_CHECK([for SWIG which produces working output], [znc_cv_path_SWIG], [
# check if perl has std::...::size_type defined. Don't add new tests to this .i; it'll break this test due to check for "NewPointerObj(("
cat <<-END > conftest-perl.i
%module conftest;
%include <std_vector.i>
%include <std_list.i>
%include <std_deque.i>
%template() std::vector<int>;
%template() std::list<int>;
%template() std::deque<int>;
std::vector<int>::size_type checkVector();
std::list<int>::size_type checkList();
std::deque<int>::size_type checkDeque();
END
AC_CACHE_CHECK([for SWIG], [znc_cv_path_SWIG], [
AC_PATH_PROGS_FEATURE_CHECK([SWIG], [swig swig2.0], [
echo trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD
$ac_path_SWIG -version >&AS_MESSAGE_LOG_FD
@@ -102,18 +117,31 @@ AC_DEFUN([AC_PROG_SWIG],[
fi
if test $swig_right_version -eq 1; then
# "python 3 abc set" and "PyInt_FromSize_t in python3" checks
echo "checking behavior of SWIG" >&AS_MESSAGE_LOG_FD
# "python 3 abc set", "PyInt_FromSize_t in python3" and "perl size_type" checks
echo "checking behavior of this SWIG" >&AS_MESSAGE_LOG_FD
$ac_path_SWIG -python -py3 -c++ -shadow conftest.i >&AS_MESSAGE_LOG_FD && \
echo "wrapper created" >&AS_MESSAGE_LOG_FD && \
$ac_path_SWIG -python -py3 -c++ -shadow -I"$srcdir"/swig_lib/python conftest-python.i >&AS_MESSAGE_LOG_FD && \
echo "python wrapper created" >&AS_MESSAGE_LOG_FD && \
echo "testing std::set... ">&AS_MESSAGE_LOG_FD && \
grep SInt_discard conftest.py >& /dev/null && \
echo "std::set works" >&AS_MESSAGE_LOG_FD && \
grep '#define PyInt_FromSize_t' conftest_wrap.cxx >& /dev/null && \
echo "testing PyInt_FromSize_t..." >&AS_MESSAGE_LOG_FD && \
grep '#define PyInt_FromSize_t' conftest-python_wrap.cxx >& /dev/null && \
echo "PyInt_FromSize_t is defined" >&AS_MESSAGE_LOG_FD && \
znc_cv_path_SWIG=$ac_path_SWIG \
$ac_path_SWIG -perl -c++ -shadow -I"$srcdir"/swig_lib/perl5 conftest-perl.i >&AS_MESSAGE_LOG_FD && \
echo "perl wrapper created" >&AS_MESSAGE_LOG_FD && \
echo "testing size_type..." >&AS_MESSAGE_LOG_FD && \
test 0 -eq `grep -c 'NewPointerObj((' conftest-perl_wrap.cxx` && \
echo "size_type work" >&AS_MESSAGE_LOG_FD && \
znc_cv_path_SWIG=$ac_path_SWIG \
ac_path_SWIG_found=:
rm -f conftest_wrap.cxx conftest.py
if test "x$ac_path_SWIG_found" != "x:"; then
echo "fail" >&AS_MESSAGE_LOG_FD
fi
rm -f conftest-python_wrap.cxx conftest.py
rm -f conftest-perl_wrap.cxx conftest.pm
else
echo "SWIG version >= $1 is required. You have '$swig_version'" >&AS_MESSAGE_LOG_FD
fi
@@ -121,7 +149,7 @@ AC_DEFUN([AC_PROG_SWIG],[
echo end trying $ac_path_SWIG >&AS_MESSAGE_LOG_FD
])
])
rm -f conftest.i
rm -f conftest-python.i conftest-perl.i
AC_SUBST([SWIG], [$znc_cv_path_SWIG])
if test -n "$SWIG"; then