1bcadb5a3SPavel Labath //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
22c1f46dcSZachary Turner //
32c1f46dcSZachary Turner //                     The LLVM Compiler Infrastructure
42c1f46dcSZachary Turner //
52c1f46dcSZachary Turner // This file is distributed under the University of Illinois Open Source
62c1f46dcSZachary Turner // License. See LICENSE.TXT for details.
72c1f46dcSZachary Turner //
82c1f46dcSZachary Turner //===----------------------------------------------------------------------===//
92c1f46dcSZachary Turner 
102c1f46dcSZachary Turner #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
112c1f46dcSZachary Turner #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
122c1f46dcSZachary Turner 
13b9c1b51eSKate Stone // Python.h needs to be included before any system headers in order to avoid
14b9c1b51eSKate Stone // redefinition of macros
152c1f46dcSZachary Turner 
16*d68983e3SPavel Labath #ifdef LLDB_DISABLE_PYTHON
17*d68983e3SPavel Labath // Python is disabled in this build
18*d68983e3SPavel Labath #else
19f343968fSZachary Turner #include "llvm/Support/Compiler.h"
20b1cb0b79SNico Weber #if defined(_WIN32)
21b9c1b51eSKate Stone // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
225a8ad459SZachary Turner // need to ensure this doesn't happen.  At the same time, Python.h will also try
235a8ad459SZachary Turner // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
245a8ad459SZachary Turner // so that PosixApi.h doesn't redefine it.
25f343968fSZachary Turner #define NO_PID_T
26f343968fSZachary Turner #endif
272c1f46dcSZachary Turner #if defined(__linux__)
282c1f46dcSZachary Turner // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
292c1f46dcSZachary Turner // may be different from the value that Python defines it to be which results
302c1f46dcSZachary Turner // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
312c1f46dcSZachary Turner // holds for _XOPEN_SOURCE.
322c1f46dcSZachary Turner #undef _POSIX_C_SOURCE
332c1f46dcSZachary Turner #undef _XOPEN_SOURCE
342c1f46dcSZachary Turner #endif
352c1f46dcSZachary Turner 
362c1f46dcSZachary Turner // Include python for non windows machines
372c1f46dcSZachary Turner #include <Python.h>
38*d68983e3SPavel Labath #endif // LLDB_DISABLE_PYTHON
392c1f46dcSZachary Turner 
402c1f46dcSZachary Turner #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
41