darin | 707988e | 2006-01-16 01:29:54 +0000 | [diff] [blame] | 1 | /* |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 2 | * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. |
darin | 707988e | 2006-01-16 01:29:54 +0000 | [diff] [blame] | 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library General Public License |
| 15 | * along with this library; see the file COPYING.LIB. If not, write to |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
darin | 707988e | 2006-01-16 01:29:54 +0000 | [diff] [blame] | 18 | * |
| 19 | */ |
| 20 | |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 21 | /* This prefix file is for use on Mac OS X and Windows only. It should contain only: |
| 22 | * 1) files to precompile on Mac OS X and Windows for faster builds |
weinig | ab5f09e | 2006-07-29 23:15:25 +0000 | [diff] [blame] | 23 | * 2) in one case at least: OS-X-specific performance bug workarounds |
| 24 | * 3) the special trick to catch us using new or delete without including "config.h" |
| 25 | * The project should be able to build without this header, although we rarely test that. |
| 26 | */ |
darin | 707988e | 2006-01-16 01:29:54 +0000 | [diff] [blame] | 27 | |
weinig | ab5f09e | 2006-07-29 23:15:25 +0000 | [diff] [blame] | 28 | /* Things that need to be defined globally should go into "config.h". */ |
darin | 707988e | 2006-01-16 01:29:54 +0000 | [diff] [blame] | 29 | |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 30 | #if defined(__APPLE__) |
darin | 276f427 | 2003-10-27 06:31:02 +0000 | [diff] [blame] | 31 | #ifdef __cplusplus |
| 32 | #define NULL __null |
| 33 | #else |
| 34 | #define NULL ((void *)0) |
| 35 | #endif |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 36 | #endif |
| 37 | |
| 38 | #if defined(WIN32) || defined(_WIN32) |
| 39 | |
| 40 | #ifndef _WIN32_WINNT |
| 41 | #define _WIN32_WINNT 0x0500 |
| 42 | #endif |
| 43 | |
| 44 | #ifndef WINVER |
| 45 | #define WINVER 0x0500 |
| 46 | #endif |
| 47 | |
| 48 | #ifndef _WINSOCKAPI_ |
| 49 | #define _WINSOCKAPI_ // Prevent inclusion of winsock.h in windows.h |
| 50 | #endif |
| 51 | |
| 52 | // If we don't define these, they get defined in windef.h. |
| 53 | // We want to use std::min and std::max |
| 54 | #ifdef __cplusplus |
| 55 | #define max max |
| 56 | #define min min |
| 57 | #endif |
| 58 | |
aroben@apple.com | 691dd2c | 2008-03-11 19:59:04 +0000 | [diff] [blame] | 59 | #else |
| 60 | #include <pthread.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 61 | #endif // defined(WIN32) || defined(_WIN32) |
darin | 276f427 | 2003-10-27 06:31:02 +0000 | [diff] [blame] | 62 | |
vicki | f92901a | 2003-11-11 18:34:40 +0000 | [diff] [blame] | 63 | #include <sys/types.h> |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 64 | #include <fcntl.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 65 | #if defined(__APPLE__) |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 66 | #include <regex.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 67 | #endif |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 68 | #include <setjmp.h> |
| 69 | #include <signal.h> |
| 70 | #include <stdarg.h> |
| 71 | #include <stddef.h> |
| 72 | #include <stdio.h> |
| 73 | #include <stdlib.h> |
| 74 | #include <string.h> |
darin | 767b371 | 2003-01-13 05:53:59 +0000 | [diff] [blame] | 75 | #include <time.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 76 | #if defined(__APPLE__) |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 77 | #include <unistd.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 78 | #endif |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 79 | |
| 80 | #ifdef __cplusplus |
| 81 | |
darin | 767b371 | 2003-01-13 05:53:59 +0000 | [diff] [blame] | 82 | #include <algorithm> |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 83 | #include <cstddef> |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 84 | #include <new> |
| 85 | |
| 86 | #endif |
| 87 | |
| 88 | #include <sys/types.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 89 | #if defined(__APPLE__) |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 90 | #include <sys/param.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 91 | #endif |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 92 | #include <sys/stat.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 93 | #if defined(__APPLE__) |
kocienda | e98828e | 2002-05-21 14:50:11 +0000 | [diff] [blame] | 94 | #include <sys/time.h> |
| 95 | #include <sys/resource.h> |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 96 | #endif |
kocienda | e98828e | 2002-05-21 14:50:11 +0000 | [diff] [blame] | 97 | |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 98 | #include <time.h> |
| 99 | |
| 100 | #include <CoreFoundation/CoreFoundation.h> |
| 101 | #include <CoreServices/CoreServices.h> |
| 102 | |
bdakin | 08b0dce | 2006-12-12 04:27:17 +0000 | [diff] [blame] | 103 | #include <AvailabilityMacros.h> |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 104 | |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 105 | #if defined(__APPLE__) |
thatcher | 697713a | 2006-09-22 23:34:07 +0000 | [diff] [blame] | 106 | #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4 |
| 107 | #define BUILDING_ON_TIGER 1 |
mrowe@apple.com | 1433736 | 2008-04-25 01:29:21 +0000 | [diff] [blame] | 108 | #elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 |
| 109 | #define BUILDING_ON_LEOPARD 1 |
thatcher | 697713a | 2006-09-22 23:34:07 +0000 | [diff] [blame] | 110 | #endif |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 111 | #endif |
thatcher | 697713a | 2006-09-22 23:34:07 +0000 | [diff] [blame] | 112 | |
bdakin | 08b0dce | 2006-12-12 04:27:17 +0000 | [diff] [blame] | 113 | #ifdef __OBJC__ |
| 114 | #import <Cocoa/Cocoa.h> |
darin | ad4bde3 | 2002-05-06 23:40:45 +0000 | [diff] [blame] | 115 | #endif |
mjs | b64c50a | 2005-10-03 21:13:12 +0000 | [diff] [blame] | 116 | |
| 117 | #ifdef __cplusplus |
| 118 | #define new ("if you use new/delete make sure to include config.h at the top of the file"()) |
| 119 | #define delete ("if you use new/delete make sure to include config.h at the top of the file"()) |
| 120 | #endif |
eseidel | 42aeffc | 2005-11-21 04:02:02 +0000 | [diff] [blame] | 121 | |
ap@webkit.org | 2834b3e | 2008-11-19 17:57:00 +0000 | [diff] [blame] | 122 | /* Work around a bug with C++ library that screws up Objective-C++ when exception support is disabled. */ |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 123 | #if defined(__APPLE__) |
justing | 2510ccf | 2005-12-20 23:05:44 +0000 | [diff] [blame] | 124 | #undef try |
| 125 | #undef catch |
aroben | fee2e82 | 2007-06-12 21:50:34 +0000 | [diff] [blame] | 126 | #endif |