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

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

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