mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix build with SWIG 4.4
SWIG 4.4 has dropped the usage of SWIG_NULLPTR again, which means we can't rely on its presence to identify SWIG >= 4.2.0 Generate a swig_version.h by parsing the output of `swig -version` and writing this in a hex representation Fixes #1979
This commit is contained in:
committed by
Alexey Sokolov
parent
18416d7df6
commit
49af1c8d53
@@ -49,6 +49,8 @@ print $out <<'EOF';
|
||||
* Don't change it manually. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "swig_version.h"
|
||||
|
||||
namespace {
|
||||
inline swig_type_info* ZNC_SWIG_pchar_descriptor(void) {
|
||||
static int init = 0;
|
||||
@@ -60,11 +62,8 @@ namespace {
|
||||
return info;
|
||||
}
|
||||
|
||||
// SWIG 4.2.0 replaced SWIG_Python_str_AsChar with SWIG_PyUnicode_AsUTF8AndSize.
|
||||
// SWIG doesn't provide any good way to detect SWIG version (other than parsing
|
||||
// `swig -version`), but it also introduced SWIG_NULLPTR in 4.2.0.
|
||||
// So let's abuse that define to do different code for new SWIG.
|
||||
#ifdef SWIG_NULLPTR
|
||||
// SWIG_VERSION is defined as 0x040200 for 4.2.0.
|
||||
#if defined(SWIG_VERSION) && SWIG_VERSION >= 0x040200
|
||||
// This is copied/adapted from SWIG 4.2.0 from pystrings.swg
|
||||
inline int ZNC_SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) {
|
||||
#if PY_VERSION_HEX>=0x03000000
|
||||
|
||||
Reference in New Issue
Block a user