Annotation of embedaddon/php/win32/build/config.w32, revision 1.1.1.1

1.1       misho       1: // vim:ft=javascript
                      2: // $Id: config.w32 309779 2011-03-28 10:55:34Z pajoye $
                      3: // "Master" config file; think of it as a configure.in
                      4: // equivalent.
                      5: 
                      6: ARG_WITH('cygwin', 'Path to cygwin utilities on your system', '\\cygwin');
                      7: PHP_CL = PATH_PROG('cl', null, 'PHP_CL');
                      8: if (!PHP_CL) {
                      9:        ERROR("MS C++ compiler is required");
                     10: }
                     11: 
                     12: /* For the record here: */
                     13: // 1200 is VC6
                     14: // 1300 is vs.net 2002
                     15: // 1310 is vs.net 2003
                     16: // 1400 is vs.net 2005
                     17: // 1500 is vs.net 2008
                     18: // 1600 is vs.net 2010
                     19: // Which version of the compiler do we have?
                     20: VCVERS = probe_binary(PHP_CL).substr(0, 5).replace('.', '');
                     21: STDOUT.WriteLine("  Detected compiler " + VC_VERSIONS[VCVERS]);
                     22: AC_DEFINE('COMPILER', VC_VERSIONS[VCVERS], "Detected compiler version");
                     23: DEFINE("PHP_COMPILER_SHORT", VC_VERSIONS_SHORT[VCVERS]);
                     24: AC_DEFINE('PHP_COMPILER_ID', VC_VERSIONS_SHORT[VCVERS], "Compiler compatibility ID");
                     25: 
                     26: // do we use x64 or 80x86 version of compiler?
                     27: X64 = probe_binary(PHP_CL, 64, null, 'PHP_CL');
                     28: if (X64) {
                     29:        STDOUT.WriteLine("  Detected 64-bit compiler");
                     30: } else {
                     31:        STDOUT.WriteLine("  Detected 32-bit compiler");
                     32: }
                     33: AC_DEFINE('ARCHITECTURE', X64 ? 'x64' : 'x86', "Detected compiler architecture");
                     34: DEFINE("PHP_ARCHITECTURE", X64 ? 'x64' : 'x86');
                     35: 
                     36: // cygwin now ships with link.exe.  Avoid searching the cygwin path
                     37: // for this, as we want the MS linker, not the fileutil
                     38: PATH_PROG('link', WshShell.Environment("Process").Item("PATH"));
                     39: PATH_PROG('nmake');
                     40: 
                     41: // we don't want to define LIB, as that will override the default library path
                     42: // that is set in that env var
                     43: PATH_PROG('lib', null, 'MAKE_LIB');
                     44: if (!PATH_PROG('bison')) {
                     45:        ERROR('bison is required')
                     46: }
                     47: 
                     48: // There's a minimum requirement for re2c..
                     49: MINRE2C = "0.13.4";
                     50: 
                     51: RE2C = PATH_PROG('re2c');
                     52: if (RE2C) {
                     53:        var intvers, intmin;
                     54:        var pattern = /\./g;
                     55: 
                     56:        RE2CVERS = probe_binary(RE2C, "version");
                     57:        STDOUT.WriteLine('  Detected re2c version ' + RE2CVERS);
                     58: 
                     59:        intvers = RE2CVERS.replace(pattern, '') - 0;
                     60:        intmin = MINRE2C.replace(pattern, '') - 0;
                     61: 
                     62:        if (intvers < intmin) {
                     63:                STDOUT.WriteLine('WARNING: The minimum RE2C version requirement is ' + MINRE2C);
                     64:                STDOUT.WriteLine('Parsers will not be generated. Upgrade your copy at http://sf.net/projects/re2c');
                     65:                DEFINE('RE2C', '');
                     66:        } else {
                     67:                DEFINE('RE2C_FLAGS', '');
                     68:        }
                     69: } else {
                     70:        STDOUT.WriteLine('Parsers will not be regenerated');
                     71: }
                     72: PATH_PROG('zip');
                     73: PATH_PROG('lemon');
                     74: 
                     75: // avoid picking up midnight commander from cygwin
                     76: PATH_PROG('mc', WshShell.Environment("Process").Item("PATH"));
                     77: 
                     78: // Try locating manifest tool
                     79: if (VCVERS > 1200) {
                     80:        PATH_PROG('mt', WshShell.Environment("Process").Item("PATH"));
                     81: }
                     82: 
                     83: // stick objects somewhere outside of the source tree
                     84: ARG_ENABLE('object-out-dir', 'Alternate location for binary objects during build', '');
                     85: if (PHP_OBJECT_OUT_DIR.length) {
                     86:        PHP_OBJECT_OUT_DIR = FSO.GetAbsolutePathName(PHP_OBJECT_OUT_DIR);
                     87:        if (!FSO.FolderExists(PHP_OBJECT_OUT_DIR)) {
                     88:                ERROR('you chosen output directory ' + PHP_OBJECT_OUT_DIR + ' does not exist');
                     89:        }
                     90:        PHP_OBJECT_OUT_DIR += '\\';
                     91: } else if (X64) {
                     92:        if (!FSO.FolderExists("x64")) {
                     93:                FSO.CreateFolder("x64");
                     94:        }
                     95:        PHP_OBJECT_OUT_DIR = 'x64\\';
                     96: }
                     97: 
                     98: ARG_ENABLE('debug', 'Compile with debugging symbols', "no");
                     99: ARG_ENABLE('debug-pack', 'Release binaries with external debug symbols (--enable-debug must not be specified)', 'no');
                    100: if (PHP_DEBUG == "yes" && PHP_DEBUG_PACK == "yes") {
                    101:        ERROR("Use of both --enable-debug and --enable-debug-pack not allowed.");
                    102: }
                    103: ARG_ENABLE('zts', 'Thread safety', 'yes');
                    104: // Configures the hard-coded installation dir
                    105: ARG_WITH('prefix', 'where PHP will be installed', '');
                    106: if (PHP_PREFIX == '') {
                    107:        PHP_PREFIX = "C:\\php";
                    108:        if (PHP_DEBUG == "yes")
                    109:                PHP_PREFIX += "\\debug";
                    110: }
                    111: DEFINE('PHP_PREFIX', PHP_PREFIX);
                    112: 
                    113: DEFINE("BASE_INCLUDES", "/I . /I main /I Zend /I TSRM /I ext ");
                    114: 
                    115: // CFLAGS for building the PHP dll
                    116: DEFINE("CFLAGS_PHP", "/D _USRDLL /D PHP5DLLTS_EXPORTS /D PHP_EXPORTS \
                    117: /D LIBZEND_EXPORTS /D TSRM_EXPORTS /D SAPI_EXPORTS /D WINVER=0x500");
                    118: 
                    119: DEFINE('CFLAGS_PHP_OBJ', '$(CFLAGS_PHP) $(STATIC_EXT_CFLAGS)');
                    120: 
                    121: // General CFLAGS for building objects
                    122: DEFINE("CFLAGS", "/nologo /FD $(BASE_INCLUDES) /D _WINDOWS \
                    123: /D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _MBCS /W3 ");
                    124: 
                    125: if (VCVERS < 1400) {
                    126:        // Enable automatic precompiled headers
                    127:        ADD_FLAG('CFLAGS', ' /YX ');
                    128: 
                    129:        if (PHP_DEBUG == "yes") {
                    130:                // Set some debug/release specific options
                    131:                ADD_FLAG('CFLAGS', ' /GZ ');
                    132:        }
                    133: }
                    134: 
                    135: if (VCVERS >= 1400) {
                    136:        // fun stuff: MS deprecated ANSI stdio and similar functions
                    137:        // disable annoying warnings.  In addition, time_t defaults
                    138:        // to 64-bit.  Ask for 32-bit.
                    139:        if (X64) {
                    140:                ADD_FLAG('CFLAGS', ' /wd4996 /Wp64 ');
                    141:        } else {
                    142:                ADD_FLAG('CFLAGS', ' /wd4996 /D_USE_32BIT_TIME_T=1 ');
                    143:        }
                    144: 
                    145:        if (PHP_DEBUG == "yes") {
                    146:                // Set some debug/release specific options
                    147:                ADD_FLAG('CFLAGS', ' /RTC1 ');
                    148:        }
                    149: }
                    150: 
                    151: ARG_WITH('mp', 'Tell VC9+ use up to [n,auto,disable] processes for compilation', 'auto');
                    152: if (VCVERS >= 1500 && PHP_MP != 'disable') {
                    153:                // no from disable-all 
                    154:                if(PHP_MP == 'auto' || PHP_MP == 'no') {
                    155:                         ADD_FLAG('CFLAGS', ' /MP ');
                    156:                } else {
                    157:                        if(parseInt(PHP_MP) != 0) {
                    158:                                ADD_FLAG('CFLAGS', ' /MP'+ PHP_MP +' ');
                    159:                        } else {
                    160:                                STDOUT.WriteLine('WARNING: Invalid argument for MP: ' + PHP_MP);
                    161:                        }
                    162:                }
                    163: }
                    164: 
                    165: // General link flags
                    166: DEFINE("LDFLAGS", "/nologo /version:" +
                    167:        PHP_VERSION + "." + PHP_MINOR_VERSION + "." + PHP_RELEASE_VERSION);
                    168: 
                    169: // General DLL link flags
                    170: DEFINE("DLL_LDFLAGS", "/dll ");
                    171: 
                    172: // PHP DLL link flags
                    173: DEFINE("PHP_LDFLAGS", "$(DLL_LDFLAGS)");
                    174: 
                    175: // General libs
                    176: // urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib
                    177: DEFINE("LIBS", "kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib Dnsapi.lib");
                    178: 
                    179: // Set some debug/release specific options
                    180: if (PHP_DEBUG == "yes") {
                    181:        ADD_FLAG("CFLAGS", "/LDd /MDd /W3 /Gm /Od /D _DEBUG /D ZEND_DEBUG=1 " +
                    182:                (X64?"/Zi":"/ZI"));
                    183:        ADD_FLAG("LDFLAGS", "/debug");
                    184:        // Avoid problems when linking to release libraries that use the release
                    185:        // version of the libc
                    186:        ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:msvcrt");
                    187: } else {
                    188:        // Generate external debug files when --enable-debug-pack is specified
                    189:        if (PHP_DEBUG_PACK == "yes") {
                    190:                ADD_FLAG("CFLAGS", "/Zi");
                    191:                ADD_FLAG("LDFLAGS", "/incremental:no /debug /opt:ref,icf");
                    192:        }
                    193:        // Equivalent to Release_TSInline build -> best optimization
                    194:        ADD_FLAG("CFLAGS", "/LD /MD /W3 /Ox /D NDebug /D NDEBUG /D ZEND_WIN32_FORCE_INLINE /GF /D ZEND_DEBUG=0");
                    195: 
                    196:        // if you have VS.Net /GS hardens the binary against buffer overruns
                    197:        // ADD_FLAG("CFLAGS", "/GS");
                    198: }
                    199: 
                    200: if (PHP_ZTS == "yes") {
                    201:        ADD_FLAG("CFLAGS", "/D ZTS=1");
                    202:        ADD_FLAG("ZTS", "1");
                    203: } else {
                    204:        ADD_FLAG("ZTS", "0");
                    205: }
                    206: 
                    207: DEFINE("PHP_ZTS_ARCHIVE_POSTFIX", PHP_ZTS == "yes" ? '' : "-nts");
                    208: 
                    209: 
                    210: // we want msvcrt in the PHP DLL
                    211: ADD_FLAG("PHP_LDFLAGS", "/nodefaultlib:libcmt");
                    212: 
                    213: // set up the build dir and DLL name
                    214: if (PHP_DEBUG == "yes" && PHP_ZTS == "yes") {
                    215:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug_TS");
                    216:        DEFINE("PHPDLL", "php" + PHP_VERSION + "ts_debug.dll");
                    217:        DEFINE("PHPLIB", "php" + PHP_VERSION + "ts_debug.lib");
                    218: } else if (PHP_DEBUG == "yes" && PHP_ZTS == "no") {
                    219:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Debug");
                    220:        DEFINE("PHPDLL", "php" + PHP_VERSION + "_debug.dll");
                    221:        DEFINE("PHPLIB", "php" + PHP_VERSION + "_debug.lib");
                    222: } else if (PHP_DEBUG == "no" && PHP_ZTS == "yes") {
                    223:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release_TS");
                    224:        DEFINE("PHPDLL", "php" + PHP_VERSION + "ts.dll");
                    225:        DEFINE("PHPLIB", "php" + PHP_VERSION + "ts.lib");
                    226: } else if (PHP_DEBUG == "no" && PHP_ZTS == "no") {
                    227:        DEFINE("BUILD_DIR", PHP_OBJECT_OUT_DIR + "Release");
                    228:        DEFINE("PHPDLL", "php" + PHP_VERSION + ".dll");
                    229:        DEFINE("PHPLIB", "php" + PHP_VERSION + ".lib");
                    230: }
                    231: 
                    232: // Find the php_build dir - it contains headers and libraries
                    233: // that we need
                    234: 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');
                    235: 
                    236: if (PHP_PHP_BUILD == 'no') {
                    237:        if (FSO.FolderExists("..\\deps")) {
                    238:                PHP_PHP_BUILD = "..\\deps";
                    239:        } else {
                    240:                if (FSO.FolderExists("..\\php_build")) {
                    241:                        PHP_PHP_BUILD = "..\\php_build";
                    242:                } else {
                    243:                        if (X64) {
                    244:                                if (FSO.FolderExists("..\\win64build")) {
                    245:                                        PHP_PHP_BUILD = "..\\win64build";
                    246:                                } else if (FSO.FolderExists("..\\php-win64-dev\\php_build")) {
                    247:                                        PHP_PHP_BUILD = "..\\php-win64-dev\\php_build";
                    248:                                }
                    249:                        } else {
                    250:                                if (FSO.FolderExists("..\\win32build")) {
                    251:                                        PHP_PHP_BUILD = "..\\win32build";
                    252:                                } else if (FSO.FolderExists("..\\php-win32-dev\\php_build")) {
                    253:                                        PHP_PHP_BUILD = "..\\php-win32-dev\\php_build";
                    254:                                }
                    255:                        }
                    256:                }
                    257:        }
                    258:        PHP_PHP_BUILD = FSO.GetAbsolutePathName(PHP_PHP_BUILD);
                    259: }
                    260: DEFINE("PHP_BUILD", PHP_PHP_BUILD);
                    261: 
                    262: ARG_WITH('extra-includes', 'Extra include path to use when building everything', '');
                    263: ARG_WITH('extra-libs', 'Extra library path to use when linking everything', '');
                    264: 
                    265: var php_usual_include_suspects = PHP_PHP_BUILD+"\\include";
                    266: var php_usual_lib_suspects = PHP_PHP_BUILD+"\\lib";
                    267: 
                    268: ADD_FLAG("CFLAGS", '/I "' + php_usual_include_suspects + '" ');
                    269: ADD_FLAG("LDFLAGS", '/libpath:"' + php_usual_lib_suspects + '" ');
                    270: 
                    271: // Poke around for some headers
                    272: function probe_basic_headers()
                    273: {
                    274:        var p;
                    275: 
                    276:        if (PHP_PHP_BUILD != "no") {
                    277:                php_usual_include_suspects += ";" + PHP_PHP_BUILD + "\\include";
                    278:                php_usual_lib_suspects += ";" + PHP_PHP_BUILD + "\\lib";
                    279:        }
                    280: }
                    281: 
                    282: function add_extra_dirs()
                    283: {
                    284:        var path, i, f;
                    285: 
                    286:        if (PHP_EXTRA_INCLUDES.length) {
                    287:                path = PHP_EXTRA_INCLUDES.split(';');
                    288:                for (i = 0; i < path.length; i++) {
                    289:                        f = FSO.GetAbsolutePathName(path[i]);
                    290:                        if (FSO.FolderExists(f)) {
                    291:                                ADD_FLAG("CFLAGS", '/I "' + f + '" ');
                    292:                        }
                    293:                }
                    294:        }
                    295:        if (PHP_EXTRA_LIBS.length) {
                    296:                path = PHP_EXTRA_LIBS.split(';');
                    297:                for (i = 0; i < path.length; i++) {
                    298:                        f = FSO.GetAbsolutePathName(path[i]);
                    299:                        if (FSO.FolderExists(f)) {
                    300:                                if (VCVERS <= 1200 && f.indexOf(" ") >= 0) {
                    301:                                        ADD_FLAG("LDFLAGS", '/libpath:"\\"' + f + '\\"" ');
                    302:                                } else {
                    303:                                        ADD_FLAG("LDFLAGS", '/libpath:"' + f + '" ');
                    304:                                }
                    305:                        }
                    306:                }
                    307:        }
                    308: 
                    309: }
                    310: 
                    311: probe_basic_headers();
                    312: add_extra_dirs();
                    313: 
                    314: //DEFINE("PHP_BUILD", PHP_PHP_BUILD);
                    315: 
                    316: STDOUT.WriteBlankLines(1);
                    317: STDOUT.WriteLine("Build dir: " + get_define('BUILD_DIR'));
                    318: STDOUT.WriteLine("PHP Core:  " + get_define('PHPDLL') + " and " + get_define('PHPLIB'));
                    319: 
                    320: ADD_SOURCES("Zend", "zend_language_parser.c zend_language_scanner.c \
                    321:        zend_ini_parser.c zend_ini_scanner.c zend_alloc.c zend_compile.c \
                    322:        zend_constants.c zend_dynamic_array.c zend_exceptions.c \
                    323:        zend_execute_API.c zend_highlight.c \
                    324:        zend_llist.c zend_opcode.c zend_operators.c zend_ptr_stack.c \
                    325:        zend_stack.c zend_variables.c zend.c zend_API.c zend_extensions.c \
                    326:        zend_hash.c zend_list.c zend_indent.c zend_builtin_functions.c \
                    327:        zend_sprintf.c zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c \
                    328:        zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
                    329:        zend_object_handlers.c zend_objects_API.c \
                    330:        zend_default_classes.c zend_execute.c zend_strtod.c zend_gc.c zend_closures.c \
                    331:        zend_float.c zend_canary.c zend_alloc_canary.c");
                    332: 
                    333: if (VCVERS == 1200) {
                    334:        AC_DEFINE('ZEND_DVAL_TO_LVAL_CAST_OK', 1);
                    335: }
                    336: 
                    337: ADD_SOURCES("main", "main.c snprintf.c spprintf.c safe_mode.c getopt.c fopen_wrappers.c \
                    338:        php_scandir.c php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
                    339:        strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c network.c \
                    340:        php_open_temporary_file.c php_logos.c output.c internal_functions.c php_sprintf.c");
                    341: ADD_SOURCES("win32", "inet.c fnmatch.c sockets.c");
                    342: 
                    343: // Newer versions have it
                    344: if (VCVERS <= 1300) {
                    345:        ADD_SOURCES("win32", "strtoi64.c");
                    346: }
                    347: if (VCVERS >= 1400) {
                    348:        AC_DEFINE('HAVE_STRNLEN', 1);
                    349: }
                    350: 
                    351: ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c plain_wrapper.c \
                    352:        userspace.c transports.c xp_socket.c mmap.c glob_wrapper.c");
                    353: 
                    354: ADD_SOURCES("win32", "glob.c readdir.c \
                    355:        registry.c select.c sendmail.c time.c winutil.c wsyslog.c globals.c");
                    356: 
                    357: PHP_INSTALL_HEADERS("", "Zend/ TSRM/ main/ main/streams/ win32/");
                    358: 
                    359: STDOUT.WriteBlankLines(1);
                    360: 
                    361: /* Can we build with IPv6 support? */
                    362: ARG_ENABLE("ipv6", "Disable IPv6 support (default is turn it on if available)", "yes");
                    363: 
                    364: var main_network_has_ipv6 = 0;
                    365: if (PHP_IPV6 == "yes") {
                    366:        main_network_has_ipv6 = CHECK_HEADER_ADD_INCLUDE("wspiapi.h", "CFLAGS") ? 1 : 0;
                    367: }
                    368: if (main_network_has_ipv6) {
                    369:        STDOUT.WriteLine("Enabling IPv6 support");
                    370: }
                    371: AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
                    372: AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
                    373: AC_DEFINE('HAVE_IPV6', main_network_has_ipv6);
                    374: 
                    375: /* this allows up to 256 sockets to be select()ed in a single
                    376:  * call to select(), instead of the usual 64 */
                    377: ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256");
                    378: ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE));
                    379: 
                    380: ARG_ENABLE("zend-multibyte", "Enable Zend multibyte encoding support", "no");
                    381: if (PHP_ZEND_MULTIBYTE == "yes") {
                    382:    STDOUT.WriteLine("Enabling Zend multibyte encoding support");
                    383:    AC_DEFINE('ZEND_MULTIBYTE', 1);
                    384: }
                    385:  
                    386: AC_DEFINE('HAVE_USLEEP', 1);
                    387: AC_DEFINE('HAVE_STRCOLL', 1);
                    388: AC_DEFINE('SUHOSIN_PATCH', 1);
                    389: 
                    390: /* For snapshot builders, where can we find the additional
                    391:  * files that make up the snapshot template? */
                    392: ARG_WITH("snapshot-template", "Path to snapshot builder template dir", "no");
                    393: 
                    394: if (PHP_SNAPSHOT_TEMPLATE == "no") {
                    395:        /* default is as a sibling of the php_build dir */
                    396:        if (FSO.FolderExists(PHP_PHP_BUILD + "\\template")) {
                    397:                PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\template");
                    398:        } else if (FSO.FolderExists(PHP_PHP_BUILD + "\\..\\template")) {
                    399:                PHP_SNAPSHOT_TEMPLATE = FSO.GetAbsolutePathName(PHP_PHP_BUILD + "\\..\\template");
                    400:        }
                    401: }
                    402: 
                    403: DEFINE('SNAPSHOT_TEMPLATE', PHP_SNAPSHOT_TEMPLATE);
                    404: 
                    405: if (PHP_DSP != "no") {
                    406:        if (FSO.FolderExists("tmp")) {
                    407:                FSO.DeleteFolder("tmp");
                    408:        }
                    409:        FSO.CreateFolder("tmp");
                    410: }
                    411: 
                    412: ARG_ENABLE("security-flags", "Enable the compiler security flags", "no");
                    413: if (PHP_SECURITY_FLAGS == "yes") {
                    414:        ADD_FLAG("LDFLAGS", "/NXCOMPAT /DYNAMICBASE ");
                    415: }
                    416: 
                    417: ARG_ENABLE("static-analyze", "Enable the VC compiler static analyze", "no");
                    418: if (PHP_STATIC_ANALYZE == "yes") {
                    419:        ADD_FLAG("CFLAGS", " /analyze ");
                    420:        ADD_FLAG("CFLAGS", " /wd6308 ");
                    421: }

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