Skip to content

Commit ebef41c

Browse files
committed
Modify DEFINE, not CCFLAGS
Makefile.PL was initializing MakeMaker's CCFLAGS argument to $Config{ccflags}, then manually appending -D switches to it. That is not portable since not all compilers use that syntax for defines. Luckily, MakeMaker knows how to parse compiler flags and inject defines passed in -D format via its DEFINE argument. So use DEFINE instead of CCFLAGS.
1 parent 53b94e4 commit ebef41c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Makefile.PL

+5-7
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,16 @@ my %eumm_args = (
111111
ssleay(),
112112
);
113113

114-
# CCFLAGS is used internally by Makefile.PL to define various C preprocessor
115-
# macros (as opposed to DEFINE, which is user-facing).
116-
$eumm_args{CCFLAGS} = $Config{ccflags};
114+
$eumm_args{DEFINE} = '';
117115

118116
# Expose the current Perl version to the C preprocessor. This is used in
119117
# SSLeay.xs before perl.h is included (and therefore before its PERL_VERSION_*
120118
# macros are available).
121-
add_ccflag( $eumm_args{CCFLAGS}, "-DNET_SSLEAY_PERL_VERSION=" . $] * 1e6 );
119+
add_define( $eumm_args{DEFINE}, "-DNET_SSLEAY_PERL_VERSION=" . $] * 1e6 );
122120

123121
# Suppress deprecation warnings during compilation.
124122
# https://www.openssl.org/docs/manmaster/man7/openssl_user_macros.html
125-
add_ccflag( $eumm_args{CCFLAGS}, '-DOPENSSL_API_COMPAT=908' );
123+
add_define( $eumm_args{DEFINE}, '-DOPENSSL_API_COMPAT=908' );
126124

127125
# See if integers are only 32 bits long. If they are, add a flag to
128126
# CCFLAGS. Since OpenSSL 1.1.0, a growing number of APIs are using 64
@@ -133,7 +131,7 @@ add_ccflag( $eumm_args{CCFLAGS}, '-DOPENSSL_API_COMPAT=908' );
133131
# use this define, do it so that 64bit case is the default whenever
134132
# possible. This is safer for future library and Net::SSLeay releases.
135133
if ( !defined $Config{use64bitint} || $Config{use64bitint} ne 'define' ) {
136-
add_ccflag( $eumm_args{CCFLAGS}, '-DNET_SSLEAY_32BIT_INT_PERL' );
134+
add_define( $eumm_args{DEFINE}, '-DNET_SSLEAY_32BIT_INT_PERL' );
137135
}
138136

139137
# This can go when EU::MM older than 6.58 are gone
@@ -153,7 +151,7 @@ MAKE
153151

154152
# Prepends the C compiler flag in the second parameter to the string of compiler
155153
# flags in the first parameter.
156-
sub add_ccflag {
154+
sub add_define {
157155
substr $_[0], 0, 0, $_[1] . ( length $_[0] ? ' ' : '' );
158156
}
159157

0 commit comments

Comments
 (0)