1*4ba319b5SDimitry Andric //===-- lldb-python.h -------------------------------------------*- C++ -*-===//
29f2f44ceSEd Maste //
39f2f44ceSEd Maste //                     The LLVM Compiler Infrastructure
49f2f44ceSEd Maste //
59f2f44ceSEd Maste // This file is distributed under the University of Illinois Open Source
69f2f44ceSEd Maste // License. See LICENSE.TXT for details.
79f2f44ceSEd Maste //
89f2f44ceSEd Maste //===----------------------------------------------------------------------===//
99f2f44ceSEd Maste 
109f2f44ceSEd Maste #ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
119f2f44ceSEd Maste #define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
129f2f44ceSEd Maste 
13435933ddSDimitry Andric // Python.h needs to be included before any system headers in order to avoid
14435933ddSDimitry Andric // redefinition of macros
159f2f44ceSEd Maste 
169f2f44ceSEd Maste #ifdef LLDB_DISABLE_PYTHON
179f2f44ceSEd Maste // Python is disabled in this build
189f2f44ceSEd Maste #else
19435933ddSDimitry Andric #include "llvm/Support/Compiler.h"
20*4ba319b5SDimitry Andric #if defined(_WIN32)
21435933ddSDimitry Andric // If anyone #includes Host/PosixApi.h later, it will try to typedef pid_t.  We
22435933ddSDimitry Andric // need to ensure this doesn't happen.  At the same time, Python.h will also try
23435933ddSDimitry Andric // to redefine a bunch of stuff that PosixApi.h defines.  So define it all now
24435933ddSDimitry Andric // so that PosixApi.h doesn't redefine it.
25435933ddSDimitry Andric #define NO_PID_T
26435933ddSDimitry Andric #endif
279f2f44ceSEd Maste #if defined(__linux__)
289f2f44ceSEd Maste // features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined.  This value
299f2f44ceSEd Maste // may be different from the value that Python defines it to be which results
309f2f44ceSEd Maste // in a warning.  Undefine _POSIX_C_SOURCE before including Python.h  The same
319f2f44ceSEd Maste // holds for _XOPEN_SOURCE.
329f2f44ceSEd Maste #undef _POSIX_C_SOURCE
339f2f44ceSEd Maste #undef _XOPEN_SOURCE
349f2f44ceSEd Maste #endif
359f2f44ceSEd Maste 
369f2f44ceSEd Maste // Include python for non windows machines
379f2f44ceSEd Maste #include <Python.h>
389f2f44ceSEd Maste #endif // LLDB_DISABLE_PYTHON
399f2f44ceSEd Maste 
409f2f44ceSEd Maste #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
41