mingw.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. #ifndef GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_
  39. #define GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_
  40. #ifdef __MINGW32__
  41. // Older version of the mingw msvcrt don't define _aligned_malloc
  42. #if __MSVCRT_VERSION__ < 0x0700
  43. # define PERFTOOLS_NO_ALIGNED_MALLOC 1
  44. #endif
  45. // This must be defined before the windows.h is included. We need at
  46. // least 0x0400 for mutex.h to have access to TryLock, and at least
  47. // 0x0501 for patch_functions.cc to have access to GetModuleHandleEx.
  48. // (This latter is an optimization we could take out if need be.)
  49. #ifndef _WIN32_WINNT
  50. # define _WIN32_WINNT 0x0501
  51. #endif
  52. #define HAVE_SNPRINTF 1
  53. // Some mingw distributions have a pthreads wrapper, but it doesn't
  54. // work as well as native windows spinlocks (at least for us). So
  55. // pretend the pthreads wrapper doesn't exist, even when it does.
  56. #ifndef HAVE_PTHREAD_DESPITE_ASKING_FOR
  57. #undef HAVE_PTHREAD
  58. #endif
  59. #define HAVE_PID_T
  60. #include "windows/port.h"
  61. #endif /* __MINGW32__ */
  62. #endif /* GOOGLE_PERFTOOLS_WINDOWS_MINGW_H_ */