Annotation of embedaddon/php/win32/build/config.w32.phpize.in, revision 1.1.1.2

1.1       misho       1: // vim:ft=javascript
1.1.1.2 ! misho       2: // $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $
1.1       misho       3: // "Master" config file; think of it as a configure.in
                      4: // equivalent.
                      5: 
                      6: var PHP_CYGWIN="notset";
                      7: PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
                      8: if (!PHP_CL) {
                      9:        ERROR("MS C++ compiler is required");
                     10: }
                     11: /* For the record here: */
                     12: // 1200 is VC6
                     13: // 1300 is vs.net 2002
                     14: // 1310 is vs.net 2003
                     15: // 1400 is vs.net 2005
                     16: // 1500 is vs.net 2008
                     17: // 1600 is vs.net 2010
                     18: // Which version of the compiler do we have?
                     19: VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
                     20: STDOUT.WriteLine("  Detected compiler " + VC_VERSIONS[VCVERS]);
1.1.1.2 ! misho      21: 
        !            22: if (VCVERS < 1500) {
        !            23:        ERROR("Unsupported MS C++ Compiler, VC9 (2008) minimum is required");
        !            24: }
        !            25: 
1.1       misho      26: AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
                     27: DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
                     28: AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
                     29: 
                     30: // do we use x64 or 80x86 version of compiler?
                     31: X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
                     32: if (X64) {
                     33:        STDOUT.WriteLine("  Detected 64-bit compiler");
                     34: } else {
                     35:        STDOUT.WriteLine("  Detected 32-bit compiler");
                     36: }
                     37: AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
                     38: DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
                     39: 
                     40: // cygwin now ships with link.exe.  Avoid searching the cygwin path
                     41: // for this, as we want the MS linker, not the fileutil
                     42: PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
                     43: PATH_PROG('nmake');
                     44: 
                     45: // we don't want to define LIB, as that will override the default library path
                     46: // that is set in that env var
                     47: PATH_PROG('lib', null, 'MAKE_LIB');
                     48: if (!PATH_PROG('bison')) {
                     49:        ERROR('bison is required')
                     50: }
                     51: 
                     52: // There's a minimum requirement for re2c..
                     53: MINRE2C = "0.13.4";
                     54: 
                     55: RE2C = PATH_PROG('re2c');
                     56: if (RE2C) {
                     57:        var intvers, intmin;
                     58:        var pattern = /\./g;
                     59: 
                     60:        RE2CVERS = probe_binary(RE2C, "version");
                     61:        STDOUT.WriteLine('  Detected re2c version ' + RE2CVERS);
                     62: 
                     63:        intvers = RE2CVERS.replace(pattern, '') - 0;
                     64:        intmin = MINRE2C.replace(pattern, '') - 0;
                     65: 
                     66:        if (intvers < intmin) {
                     67:                STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
                     68:                STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
                     69:                DEFINE('RE2C', '');
                     70:        } else {
                     71:                DEFINE('RE2C_FLAGS', '');
                     72:        }
                     73: } else {
                     74:        STDOUT.WriteLine('Parsers will not be regenerated');
                     75: }
                     76: PATH_PROG('zip');
                     77: PATH_PROG('lemon');
                     78: 
                     79: // avoid picking up midnight commander from cygwin
                     80: PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
                     81: 
                     82: // Try locating manifest tool
                     83: if (VCVERS > 1200) {
                     84:        PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
                     85: }
                     86: 
                     87: // stick objects somewhere outside of the source tree
                     88: ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
                     89: if (PHP_OBJECT_OUT_DIR.length) {
                     90:        PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
                     91:        if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
                     92:                ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
                     93:        }
                     94:        PHP_OBJECT_OUT_DIR += '\\';
                     95: } else if (X64) {
                     96:        if (!FSO.FolderExists("x64")) {
                     97:                FSO.CreateFolder("x64");
                     98:        }
                     99:        PHP_OBJECT_OUT_DIR = 'x64\\';
                    100: }
                    101: 
                    102: ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
                    103: ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
                    104: if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
                    105:        ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
                    106: }
                    107: 
                    108: DEFINE('PHP_PREFIX', PHP_PREFIX);
                    109: 
                    110: DEFINE("BASE_INCLUDES", "/I " + PHP_DIR + "/include /I " + PHP_DIR + "/include/main /I " + PHP_DIR + "/include/Zend /I " + PHP_DIR + "/include/TSRM /I " + PHP_DIR + "/include/ext ");
                    111: 
                    112: // CFLAGS for building the PHP dll
                    113: DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
                    114: /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
                    115: 
                    116: DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
                    117: 
                    118: // General CFLAGS for building objects
                    119: DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
                    120: /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
                    121: 
                    122: if (VCVERS < 1400) {
                    123:        // Enable automatic precompiled headers
                    124:        ADD_FLAG('CFLAGS', ' /YX ');
                    125: 
                    126:        if (PHP_DEBUG == "yes") {
                    127:                // Set some debug/release specific options
                    128:                ADD_FLAG('CFLAGS', ' /GZ ');
                    129:        }
                    130: }
                    131: 
                    132: if (VCVERS >= 1400) {
                    133:        // fun stuff: MS deprecated ANSI stdio and similar functions
                    134:        // disable annoying warnings.  In addition, time_t defaults
                    135:        // to 64-bit.  Ask for 32-bit.
                    136:        if (X64) {
                    137:                ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
                    138:        } else {
                    139:                ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
                    140:        }
                    141: 
                    142:        if (PHP_DEBUG == "yes") {
                    143:                // Set some debug/release specific options
                    144:                ADD_FLAG('CFLAGS', ' /RTC1 ');
                    145:        }
                    146: }
                    147: 
                    148: ARG_WITH('prefix', 'PHP installation prefix', '');
                    149: ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
                    150: if (VCVERS >= 1500 && PHP_MP != 'disable') {
                    151:                // no from disable-all 
                    152:                if(PHP_MP == 'auto' || PHP_MP == 'no') {
                    153:                         ADD_FLAG('CFLAGS', ' /MP ');
                    154:                } else {
                    155:                        if(parseInt(PHP_MP) != 0) {
                    156:                                ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
                    157:                        } else {
                    158:                                STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
                    159:                        }
                    160:                }
                    161: }
                    162: 
                    163: /* For snapshot builders, where can we find the additional
                    164:  * files that make up the snapshot template? */
                    165: ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
                    166: 
                    167: // General DLL link flags
                    168: DEFINE("DLL_LDFLAGS", "/dll ");
                    169: 
                    170: // PHP DLL link flags
                    171: DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
                    172: 
                    173: // General libs
                    174: // urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
                    175: DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
                    176: 
                    177: // Set some debug/release specific options
                    178: if (PHP_DEBUG == "yes") {
                    179:        ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
                    180:                (X64?"/Zi":"/ZI"));
                    181:        ADD_FLAG("LDFLAGS", "/debug");
                    182:        // Avoid problems when linking to release libraries that use the release
                    183:        // version of the libc
                    184:        ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
                    185: } else {
                    186:        // Generate external debug files when --enable-debug-pack is specified
                    187:        if (PHP_DEBUG_PACK == "yes") {
                    188:                ADD_FLAG("CFLAGS", "/Zi");
                    189:                ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
                    190:        }
                    191:        // Equivalent to Release_TSInline build -> best optimization
                    192:        ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
                    193: 
                    194:        // if you have VS.Net /GS hardens the binary against buffer overruns
                    195:        // ADD_FLAG("CFLAGS", "/GS");
                    196: }
                    197: 
                    198: if (PHP_ZTS == "yes") {
                    199:        ADD_FLAG("CFLAGS", "/D ZTS=1");
                    200: }
                    201: 
                    202: DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
                    203: 
                    204: 
                    205: // we want msvcrt in the PHP DLL
                    206: ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
                    207: 
                    208: // set up the build dir and DLL name
                    209: if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
                    210:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
                    211:        if (!MODE_PHPIZE) {
                    212:                DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
                    213:                DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
                    214:        }
                    215: } else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
                    216:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
                    217:        if (!MODE_PHPIZE) {
                    218:                DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
                    219:                DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
                    220:        }
                    221: } else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
                    222:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
                    223:        if (!MODE_PHPIZE) {
                    224:                DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
                    225:                DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
                    226:        }
                    227: } else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
                    228:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
                    229:        if (!MODE_PHPIZE) {
                    230:                DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
                    231:                DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
                    232:        }
                    233: }
                    234: 
                    235: if (MODE_PHPIZE) {
                    236:        DEFINE("PHPDLL", PHP_DLL);
                    237:        DEFINE("PHPLIB", PHP_DLL_LIB);
                    238: }
                    239: 
                    240: // Find the php_build dir - it contains headers and libraries
                    241: // that we need
                    242: ARG_WITH('php-build', 'Path to where you extracted the development libraries (http://wiki.php.net/internals/windows/libs). Assumes that it is a sibling of this source dir (..\\deps) if not specified', 'no');
                    243: 
                    244: if (PHP_PHP_BUILD == 'no') {
                    245:        if (FSO.FolderExists("..\\deps")) {
                    246:                PHP_PHP_BUILD = "..\\deps";
                    247:        } else {
                    248:                if (FSO.FolderExists("..\\php_build")) {
                    249:                        PHP_PHP_BUILD = "..\\php_build";
                    250:                } else {
                    251:                        if (X64) {
                    252:                                if (FSO.FolderExists("..\\win64build")) {
                    253:                                        PHP_PHP_BUILD = "..\\win64build";
                    254:                                } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
                    255:                                        PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
                    256:                                }
                    257:                        } else {
                    258:                                if (FSO.FolderExists("..\\win32build")) {
                    259:                                        PHP_PHP_BUILD = "..\\win32build";
                    260:                                } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
                    261:                                        PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
                    262:                                }
                    263:                        }
                    264:                }
                    265:        }
                    266:        PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
                    267: }
                    268: DEFINE("PHP_BUILD", PHP_PHP_BUILD);
                    269: 
                    270: ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
                    271: ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
                    272: 
                    273: var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
                    274: var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
                    275: 
                    276: ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
                    277: ADD_FLAG("LDFLAGS", '/libpath:"\\"' + php_usual_lib_suspects + '\\"" ');
                    278: 
                    279: // Poke around for some headers
                    280: function probe_basic_headers()
                    281: {
                    282:        var p;
                    283: 
                    284:        if (PHP_PHP_BUILD != "no") {
                    285:                php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
                    286:                php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
                    287:        }
                    288: }
                    289: 
                    290: function add_extra_dirs()
                    291: {
                    292:        var path, i, f;
                    293: 
                    294:        if (PHP_EXTRA_INCLUDES.length) {
                    295:                path = PHP_EXTRA_INCLUDES.split(';');
                    296:                for (i = 0; i < path.length; i++) {
                    297:                        f = FSO.GetAbsolutePathName(path[i]);
                    298:                        if (FSO.FolderExists(f)) {
                    299:                                ADD_FLAG("CFLAGS", '/I "' + f + '" ');
                    300:                        }
                    301:                }
                    302:        }
                    303:        if (PHP_EXTRA_LIBS.length) {
                    304:                path = PHP_EXTRA_LIBS.split(';');
                    305:                for (i = 0; i < path.length; i++) {
                    306:                        f = FSO.GetAbsolutePathName(path[i]);
                    307:                        if (FSO.FolderExists(f)) {
                    308:                                if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
                    309:                                        ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
                    310:                                } else {
                    311:                                        ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
                    312:                                }
                    313:                        }
                    314:                }
                    315:        }
                    316: 
                    317: }
                    318: 
                    319: probe_basic_headers();
                    320: add_extra_dirs();
                    321: 
                    322: //DEFINE("PHP_BUILD", PHP_PHP_BUILD);
                    323: 
                    324: STDOUT.WriteBlankLines(1);
                    325: STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
                    326: STDOUT.WriteLine("PHP Core:  " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
                    327: 
                    328: 
                    329: if (VCVERS == 1200) {
                    330:        AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
                    331: }
                    332: 
                    333: if (VCVERS >= 1400) {
                    334:        AC_DEFINE('HAVE_STRNLEN', 1);
                    335: }
                    336: 
                    337: STDOUT.WriteBlankLines(1);
                    338: 
                    339: if (PHP_SNAPSHOT_TEMPLATE == "no") {
                    340:        /* default is as a sibling of the php_build dir */
                    341:        if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
                    342:                PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
                    343:        } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
                    344:                PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
                    345:        }
                    346: }
                    347: 
                    348: DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
                    349: 
                    350: if (PHP_DSP != "no") {
                    351:        if (FSO.FolderExists("tmp")) {
                    352:                FSO.DeleteFolder("tmp");
                    353:        }
                    354:        FSO.CreateFolder("tmp");
                    355: }
                    356: 
                    357: AC_DEFINE("PHP_DIR", PHP_DIR);
                    358: DEFINE("PHP_DIR", PHP_DIR);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>