1 From f53fc85ee9734dd21447ea3438b7ba1edcd1bcf8 Mon Sep 17 00:00:00 2001
2 From: Michael Heimpold <mhei@heimpold.de>
3 Date: Tue, 21 Nov 2023 23:27:45 +0100
4 Subject: [PATCH] Revert ax_pkg_swig.m4 to latest vanilla version
6 And instead of extending the macro, we can use the already
7 create variable 'available_swig_vernum' to compare the
8 required version number.
10 Signed-off-by: Michael Heimpold <mhei@heimpold.de>
12 configure.ac | 26 ++++++++++++--------------
13 m4/ax_pkg_swig.m4 | 20 +++++++++-----------
14 2 files changed, 21 insertions(+), 25 deletions(-)
18 @@ -1956,21 +1956,19 @@ AC_CHECK_LIB(nsl, main, [HAVE_LIBNSL=1;
23 +available_swig_vernum=0
24 if test "x$tryswig" = "xyes"; then
25 if test "x$swigprog" != "x"; then
28 - AX_PKG_SWIG([1.3.21])
29 - if test "x$SWIG" != "x"; then
30 - AC_DEFINE([HAVE_SWIG], [], [Have swig installed])
32 - if test $SWIG_NUMVERSION -ge 40100; then
35 - AC_MSG_WARN([SWIG version >= 4.1.0 is required for C++ swig.])
40 + AC_DEFINE([HAVE_SWIG], [], [Have swig installed])
44 + AC_MSG_WARN([SWIG version >= 4.1.0 is required for C++ swig.])
48 AC_SUBST(SWIG_CPP_DIR)
49 @@ -2055,7 +2053,7 @@ AC_SUBST(PYTHON_UNDEF_LIBS)
50 PYTHON_EXECUTABLE="${PYTHON}"
51 AC_SUBST(PYTHON_EXECUTABLE)
53 -if test $SWIG_NUMVERSION -ge 40100 -a "${enable_shared}" = yes; then
54 +if test $available_swig_vernum -ge 40100 -a "${enable_shared}" = yes; then
58 @@ -2076,7 +2074,7 @@ AC_ARG_WITH(go,
62 -if test $trygo = yes -a $SWIG_NUMVERSION -lt 40100; then
63 +if test $trygo = yes -a $available_swig_vernum -lt 40100; then
64 AC_MSG_ERROR([Go enabled, but swig version must be >= 4.1.0 for that])
67 @@ -2363,7 +2361,7 @@ pr_op " shared libraries: " $enable_sh
68 pr_op " sctp sendv: " $ac_cv_lib_sctp_sctp_sendv
69 pr_vop " python: " "$ax_python_version"
70 if test "$SWIG_CPP_DIR" = "swig"; then
71 - prrw " swig: " "$SWIG_NUMVERSION"
72 + prrw " swig: " "$available_swig_vernum"
76 --- a/m4/ax_pkg_swig.m4
77 +++ b/m4/ax_pkg_swig.m4
79 # 1.3.17), AX_PKG_SWIG checks that the swig package is this version number
82 -# If successful, SWIG_NUMVERSION is set to a numeric value for the
83 -# version found in the format NNnnpp where NN is the major version,
84 -# nn is the minor version, and pp is the patch version. This is
85 -# easy to directly compare with a number.
87 # As usual, action-if-found is executed if SWIG is found, otherwise
88 # action-if-not-found is executed.
91 # Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
92 # Copyright (c) 2008 Andrew Collier
93 # Copyright (c) 2011 Murray Cumming <murrayc@openismus.com>
94 +# Copyright (c) 2018 Reini Urban <rurban@cpan.org>
95 +# Copyright (c) 2021 Vincent Danjean <Vincent.Danjean@ens-lyon.org>
97 # This program is free software; you can redistribute it and/or modify it
98 # under the terms of the GNU General Public License as published by the
100 # modified version of the Autoconf Macro, you may extend this special
101 # exception to the GPL to apply to your modified version as well.
106 AC_DEFUN([AX_PKG_SWIG],[
107 # Find path to the "swig" executable.
108 AC_PATH_PROGS([SWIG],[swig swig3.0 swig2.0])
109 if test -z "$SWIG" ; then
110 m4_ifval([$3],[$3],[:])
111 - elif test -n "$1" ; then
112 + elif test -z "$1" ; then
113 + m4_ifval([$2],[$2],[:])
115 AC_MSG_CHECKING([SWIG version])
116 [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'`]
117 AC_MSG_RESULT([$swig_version])
118 @@ -86,12 +85,12 @@ AC_DEFUN([AX_PKG_SWIG],[
119 if test -z "$required_major" ; then
122 - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
123 + [required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
124 [required_minor=`echo $required | sed 's/[^0-9].*//'`]
125 if test -z "$required_minor" ; then
128 - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
129 + [required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
130 [required_patch=`echo $required | sed 's/[^0-9].*//'`]
131 if test -z "$required_patch" ; then
133 @@ -126,10 +125,9 @@ AC_DEFUN([AX_PKG_SWIG],[
134 m4_ifval([$3],[$3],[])
136 AC_MSG_CHECKING([for SWIG library])
137 - SWIG_LIB=`$SWIG -swiglib | tail -1`
138 + SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '`
139 AC_MSG_RESULT([$SWIG_LIB])
140 m4_ifval([$2],[$2],[])
141 - SWIG_NUMVERSION=$available_swig_vernum
144 AC_MSG_WARN([cannot determine SWIG version])