Skip to content

Commit

Permalink
sb5.40: detect if USE_NO_MINGW_SETJMP_TWO_ARGS is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
dk committed Aug 15, 2024
1 parent 098ffdb commit 26f077e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
32 changes: 32 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,37 @@ GLIBC
$DEFINES{HAS_GLIBC} = 1 if $rc;
}

sub find_setjmp
{
printlog "Checking for setjmp... ";
my $response = 'no';
my $rc = compile( <<'SET1');
#ifdef __MINGW32__
# include <setjmp.h>
# include <intrin.h>
#endif
int main() { return 0; }
SET1
if ( !$rc ) {
$rc = compile( <<'SET2');
#include <setjmp.h>
#ifdef __MINGW32__
# include <setjmp.h>
# define USE_NO_MINGW_SETJMP_TWO_ARGS
# include <intrin.h>
#endif
int main() { return 0; }
SET2
if ( $rc ) {
$DEFINES{USE_NO_MINGW_SETJMP_TWO_ARGS} = 1;
$response = 'two-args hack';
}
} else {
$response = 'yes';
}
printlog "$response\n";
}

sub setup_compiler
{
printlog "Compiler: $compiler_type\n";
Expand Down Expand Up @@ -1136,6 +1167,7 @@ sub setup_defines
}
find_inline();
find_glibc;
find_setjmp if $^O =~ /win32/i;
}

sub setup_dl_loadflags
Expand Down
1 change: 0 additions & 1 deletion img/codec_jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ and _setjmp is not equivaluent to setjmp anymore
#pragma push_macro("setjmp")
#pragma push_macro("longjmp")
#endif
#define USE_NO_MINGW_SETJMP_TWO_ARGS
#include "img.h"
#include "img_conv.h"
#include "Image.h"
Expand Down
1 change: 0 additions & 1 deletion img/codec_png.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ and _setjmp is not equivaluent to setjmp anymore
#pragma push_macro("setjmp")
#pragma push_macro("longjmp")
#endif
#define USE_NO_MINGW_SETJMP_TWO_ARGS
#include "generic/config.h"
#define Z_PREFIX
#include <png.h>
Expand Down

0 comments on commit 26f077e

Please sign in to comment.