1 /* -*- Mode: C; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /* Copyright (c) 2007, Google Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  *     * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *     * Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following disclaimer
13  * in the documentation and/or other materials provided with the
14  * distribution.
15  *     * Neither the name of Google Inc. nor the names of its
16  * contributors may be used to endorse or promote products derived from
17  * this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30  *
31  * ---
32  * Author: Craig Silverstein
33  *
34  * MinGW is an interesting mix of unix and windows.  We use a normal
35  * configure script, but still need the windows port.h to define some
36  * stuff that MinGW doesn't support, like pthreads.
37  */
38 
39 #ifndef GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_
40 #define GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_
41 
42 #ifdef __MINGW32__
43 
44 // Older version of the mingw msvcrt don't define _aligned_malloc
45 #if __MSVCRT_VERSION__ < 0x0700
46 # define PERFTOOLS_NO_ALIGNED_MALLOC 1
47 #endif
48 
49 // This must be defined before the windows.h is included.  We need at
50 // least 0x0400 for mutex.h to have access to TryLock, and at least
51 // 0x0501 for patch_functions.cc to have access to GetModuleHandleEx.
52 // (This latter is an optimization we could take out if need be.)
53 #ifndef _WIN32_WINNT
54 # define _WIN32_WINNT 0x0501
55 #endif
56 
57 #define HAVE_SNPRINTF 1
58 
59 // Some mingw distributions have a pthreads wrapper, but it doesn't
60 // work as well as native windows spinlocks (at least for us).  So
61 // pretend the pthreads wrapper doesn't exist, even when it does.
62 #ifndef HAVE_PTHREAD_DESPITE_ASKING_FOR
63 #undef HAVE_PTHREAD
64 #endif
65 
66 #define HAVE_PID_T
67 
68 #include "windows/port.h"
69 
70 #endif  /* __MINGW32__ */
71 
72 #endif  /* GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_ */
73