llvm.org GIT mirror llvm / 6192928
Build with _XOPEN_SOURCE defined on AIX Summary: It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open and POSIX compatibility mode, to work around stray macros and other bugs in the headers provided by the system and build compiler. This patch adds the config to cmake to build with _XOPEN_SOURCE defined on AIX with a few exceptions. Google Test internals require access to platform specific thread info constructs on AIX so in that case we build with _ALL_SOURCE defined instead. Libclang also uses header which needs _ALL_SOURCE on AIX so we leave that as is as well. We also add building on AIX with the large file API and doing CMake header checks with X/OPEN definitions so the results are consistent with the environment that will be present in the build. Reviewers: hubert.reinterpretcast, xingxue, andusy Reviewed By: hubert.reinterpretcast Subscribers: mgorny, jsji, cfe-commits, llvm-commits Tags: #llvm, #clang Differential Revision: https://reviews.llvm.org/D62533 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362808 91177308-0d34-0410-b5e6-96231b3b80d8 David Tenty a month ago
3 changed file(s) with 20 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
818818 "${CMAKE_MODULE_LINKER_FLAGS} -Wl,-lto_library -Wl,${DARWIN_LTO_LIBRARY}")
819819 endif()
820820
821 # Build with _XOPEN_SOURCE on AIX, as stray macros in _ALL_SOURCE mode tend to
822 # break things. In this case we need to enable the large-file API as well.
823 if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
824 add_definitions("-D_XOPEN_SOURCE=700")
825 add_definitions("-D_LARGE_FILE_API")
826 endif()
827
821828 # Work around a broken bfd ld behavior. When linking a binary with a
822829 # foo.so library, it will try to find any library that foo.so uses and
823830 # check its symbols. This is wasteful (the check was done when foo.so
2020 if( CMAKE_SYSTEM MATCHES "FreeBSD-9.2-RELEASE" AND
2121 CMAKE_SIZEOF_VOID_P EQUAL 8 )
2222 list(APPEND CMAKE_REQUIRED_LIBRARIES "cxxrt")
23 endif()
24
25 # Do checks with _XOPEN_SOURCE and large-file API on AIX, because we will build
26 # with those too.
27 if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
28 list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_XOPEN_SOURCE=700")
29 list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
2330 endif()
2431
2532 # include checks
2525
2626 if(WIN32)
2727 add_definitions(-DGTEST_OS_WINDOWS=1)
28 endif()
29
30 # Google Test requires headers which need _ALL_SOURCE to build on AIX
31 if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
32 remove_definitions("-D_XOPEN_SOURCE=700")
33 add_definitions("-D_ALL_SOURCE")
2834 endif()
2935
3036 if(SUPPORTS_VARIADIC_MACROS_FLAG)