This is necessary for building with older Perl.
I got following error when building with older Perls(< 5.22.0) which enables -Dusethreads.
% ./Build
Building Mouse
Generate Mouse::Tiny ...
done.
xs-src/MouseAccessor.xs => xs-src/MouseAccessor.c
xs-src/MouseAttribute.xs => xs-src/MouseAttribute.c
xs-src/MouseTypeConstraints.xs => xs-src/MouseTypeConstraints.c
xs-src/MouseUtil.xs => xs-src/MouseUtil.c
cc -I. -Ixs-src -I/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE -fPIC -Wall -Wextra -Wdeclaration-after-statement -Wc++-compat -c -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o xs-src/MouseTypeConstraints.o xs-src/MouseTypeConstraints.c
In file included from ./xshelper.h:36:0,
from ./mouse.h:6,
from xs-src/MouseTypeConstraints.xs:7:
./mouse.h: In function ‘MOUSE_get_magic’:
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/perl.h:155:16: error: ‘my_perl’ undeclared (first use in this function)
# define aTHX my_perl
^
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/perl.h:168:18: note: in expansion of macro ‘aTHX’
# define aTHX_ aTHX,
^
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/embed.h:318:43: note: in expansion of macro ‘aTHX_’
#define mg_findext(a,b,c) Perl_mg_findext(aTHX_ a,b,c)
^
./mouse.h:114:12: note: in expansion of macro ‘mg_findext’
return mg_findext((SV*)cv, PERL_MAGIC_ext, vtbl);
^
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/perl.h:155:16: note: each undeclared identifier is reported only once for each function it appears in
# define aTHX my_perl
^
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/perl.h:168:18: note: in expansion of macro ‘aTHX’
# define aTHX_ aTHX,
^
/home/syohei/.plenv/versions/5.20.2/lib/perl5/5.20.2/x86_64-linux-thread-multi/CORE/embed.h:318:43: note: in expansion of macro ‘aTHX_’
#define mg_findext(a,b,c) Perl_mg_findext(aTHX_ a,b,c)
^
./mouse.h:114:12: note: in expansion of macro ‘mg_findext’
return mg_findext((SV*)cv, PERL_MAGIC_ext, vtbl);
This is necessary for building with older Perl. I got following error when building with older Perls(< 5.22.0) which enables
-Dusethreads
.