blob: aaa6a0f4ff167761b81fa8a72b8ded4109d81f00 [file] [log] [blame]
darin707988e2006-01-16 01:29:54 +00001/*
arobenfee2e822007-06-12 21:50:34 +00002 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc.
darin707988e2006-01-16 01:29:54 +00003 *
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
ddkilzerc8eccec2007-09-26 02:29:57 +000016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
darin707988e2006-01-16 01:29:54 +000018 *
19 */
20
arobenfee2e822007-06-12 21:50:34 +000021/* 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
weinigab5f09e2006-07-29 23:15:25 +000023 * 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 */
darin707988e2006-01-16 01:29:54 +000027
weinigab5f09e2006-07-29 23:15:25 +000028/* Things that need to be defined globally should go into "config.h". */
darin707988e2006-01-16 01:29:54 +000029
arobenfee2e822007-06-12 21:50:34 +000030#if defined(__APPLE__)
darin276f4272003-10-27 06:31:02 +000031#ifdef __cplusplus
32#define NULL __null
33#else
34#define NULL ((void *)0)
35#endif
arobenfee2e822007-06-12 21:50:34 +000036#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.com691dd2c2008-03-11 19:59:04 +000059#else
60#include <pthread.h>
arobenfee2e822007-06-12 21:50:34 +000061#endif // defined(WIN32) || defined(_WIN32)
darin276f4272003-10-27 06:31:02 +000062
vickif92901a2003-11-11 18:34:40 +000063#include <sys/types.h>
darinad4bde32002-05-06 23:40:45 +000064#include <fcntl.h>
arobenfee2e822007-06-12 21:50:34 +000065#if defined(__APPLE__)
darinad4bde32002-05-06 23:40:45 +000066#include <regex.h>
arobenfee2e822007-06-12 21:50:34 +000067#endif
darinad4bde32002-05-06 23:40:45 +000068#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>
darin767b3712003-01-13 05:53:59 +000075#include <time.h>
arobenfee2e822007-06-12 21:50:34 +000076#if defined(__APPLE__)
darinad4bde32002-05-06 23:40:45 +000077#include <unistd.h>
arobenfee2e822007-06-12 21:50:34 +000078#endif
darinad4bde32002-05-06 23:40:45 +000079
80#ifdef __cplusplus
81
darin767b3712003-01-13 05:53:59 +000082#include <algorithm>
darinad4bde32002-05-06 23:40:45 +000083#include <cstddef>
darinad4bde32002-05-06 23:40:45 +000084#include <new>
85
86#endif
87
88#include <sys/types.h>
arobenfee2e822007-06-12 21:50:34 +000089#if defined(__APPLE__)
darinad4bde32002-05-06 23:40:45 +000090#include <sys/param.h>
arobenfee2e822007-06-12 21:50:34 +000091#endif
darinad4bde32002-05-06 23:40:45 +000092#include <sys/stat.h>
arobenfee2e822007-06-12 21:50:34 +000093#if defined(__APPLE__)
kociendae98828e2002-05-21 14:50:11 +000094#include <sys/time.h>
95#include <sys/resource.h>
arobenfee2e822007-06-12 21:50:34 +000096#endif
kociendae98828e2002-05-21 14:50:11 +000097
darinad4bde32002-05-06 23:40:45 +000098#include <time.h>
99
100#include <CoreFoundation/CoreFoundation.h>
101#include <CoreServices/CoreServices.h>
102
bdakin08b0dce2006-12-12 04:27:17 +0000103#include <AvailabilityMacros.h>
darinad4bde32002-05-06 23:40:45 +0000104
arobenfee2e822007-06-12 21:50:34 +0000105#if defined(__APPLE__)
thatcher697713a2006-09-22 23:34:07 +0000106#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
107#define BUILDING_ON_TIGER 1
mrowe@apple.com14337362008-04-25 01:29:21 +0000108#elif MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
109#define BUILDING_ON_LEOPARD 1
thatcher697713a2006-09-22 23:34:07 +0000110#endif
arobenfee2e822007-06-12 21:50:34 +0000111#endif
thatcher697713a2006-09-22 23:34:07 +0000112
bdakin08b0dce2006-12-12 04:27:17 +0000113#ifdef __OBJC__
114#import <Cocoa/Cocoa.h>
darinad4bde32002-05-06 23:40:45 +0000115#endif
mjsb64c50a2005-10-03 21:13:12 +0000116
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
eseidel42aeffc2005-11-21 04:02:02 +0000121
ap@webkit.org2834b3e2008-11-19 17:57:00 +0000122/* Work around a bug with C++ library that screws up Objective-C++ when exception support is disabled. */
arobenfee2e822007-06-12 21:50:34 +0000123#if defined(__APPLE__)
justing2510ccf2005-12-20 23:05:44 +0000124#undef try
125#undef catch
arobenfee2e822007-06-12 21:50:34 +0000126#endif