Skip to content

Commit 8aa6d5a

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Implement FR #77230: Support custom CFLAGS and LDFLAGS from environment
2 parents 8e22d7c + 338e1b2 commit 8aa6d5a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

win32/build/confutils.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ can be built that way. \
431431
}
432432
STDOUT.WriteLine(" " + arg.arg + pad + word_wrap_and_indent(max_width + 5, arg.helptext));
433433
}
434+
STDOUT.WriteBlankLines(1);
435+
STDOUT.WriteLine("Some influential environment variables:");
436+
STDOUT.WriteLine(" CFLAGS C compiler flags");
437+
STDOUT.WriteLine(" LDFLAGS linker flags");
434438
WScript.Quit(1);
435439
}
436440

@@ -3207,6 +3211,8 @@ function toolset_setup_linker()
32073211

32083212
function toolset_setup_common_cflags()
32093213
{
3214+
var envCFLAGS = WshShell.Environment("PROCESS").Item("CFLAGS");
3215+
32103216
// CFLAGS for building the PHP dll
32113217
DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP7DLLTS_EXPORTS /D PHP_EXPORTS \
32123218
/D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=" + WINVER);
@@ -3218,6 +3224,10 @@ function toolset_setup_common_cflags()
32183224
/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 \
32193225
/D _USE_MATH_DEFINES");
32203226

3227+
if (envCFLAGS) {
3228+
ADD_FLAG("CFLAGS", envCFLAGS);
3229+
}
3230+
32213231
if (VS_TOOLSET) {
32223232
ADD_FLAG("CFLAGS", " /FD ");
32233233

@@ -3368,6 +3378,8 @@ function toolset_setup_intrinsic_cflags()
33683378

33693379
function toolset_setup_common_ldlags()
33703380
{
3381+
var envLDFLAGS = WshShell.Environment("PROCESS").Item("LDFLAGS");
3382+
33713383
// General DLL link flags
33723384
DEFINE("DLL_LDFLAGS", "/dll ");
33733385

@@ -3376,6 +3388,10 @@ function toolset_setup_common_ldlags()
33763388

33773389
DEFINE("LDFLAGS", "/nologo ");
33783390

3391+
if (envLDFLAGS) {
3392+
ADD_FLAG("LDFLAGS", envLDFLAGS);
3393+
}
3394+
33793395
// we want msvcrt in the PHP DLL
33803396
ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
33813397

0 commit comments

Comments
 (0)