1*0fca6ea1SDimitry Andric // -*- C++ -*- 2*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===// 3*0fca6ea1SDimitry Andric // 4*0fca6ea1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*0fca6ea1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 6*0fca6ea1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*0fca6ea1SDimitry Andric // 8*0fca6ea1SDimitry Andric //===----------------------------------------------------------------------===// 9*0fca6ea1SDimitry Andric 10*0fca6ea1SDimitry Andric #ifndef _LIBCPP___CONFIGURATION_PLATFORM_H 11*0fca6ea1SDimitry Andric #define _LIBCPP___CONFIGURATION_PLATFORM_H 12*0fca6ea1SDimitry Andric 13*0fca6ea1SDimitry Andric #include <__config_site> 14*0fca6ea1SDimitry Andric 15*0fca6ea1SDimitry Andric #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER 16*0fca6ea1SDimitry Andric # pragma GCC system_header 17*0fca6ea1SDimitry Andric #endif 18*0fca6ea1SDimitry Andric 19*0fca6ea1SDimitry Andric #if defined(__ELF__) 20*0fca6ea1SDimitry Andric # define _LIBCPP_OBJECT_FORMAT_ELF 1 21*0fca6ea1SDimitry Andric #elif defined(__MACH__) 22*0fca6ea1SDimitry Andric # define _LIBCPP_OBJECT_FORMAT_MACHO 1 23*0fca6ea1SDimitry Andric #elif defined(_WIN32) 24*0fca6ea1SDimitry Andric # define _LIBCPP_OBJECT_FORMAT_COFF 1 25*0fca6ea1SDimitry Andric #elif defined(__wasm__) 26*0fca6ea1SDimitry Andric # define _LIBCPP_OBJECT_FORMAT_WASM 1 27*0fca6ea1SDimitry Andric #elif defined(_AIX) 28*0fca6ea1SDimitry Andric # define _LIBCPP_OBJECT_FORMAT_XCOFF 1 29*0fca6ea1SDimitry Andric #else 30*0fca6ea1SDimitry Andric // ... add new file formats here ... 31*0fca6ea1SDimitry Andric #endif 32*0fca6ea1SDimitry Andric 33*0fca6ea1SDimitry Andric // Need to detect which libc we're using if we're on Linux. 34*0fca6ea1SDimitry Andric #if defined(__linux__) 35*0fca6ea1SDimitry Andric # include <features.h> 36*0fca6ea1SDimitry Andric # if defined(__GLIBC_PREREQ) 37*0fca6ea1SDimitry Andric # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) 38*0fca6ea1SDimitry Andric # else 39*0fca6ea1SDimitry Andric # define _LIBCPP_GLIBC_PREREQ(a, b) 0 40*0fca6ea1SDimitry Andric # endif // defined(__GLIBC_PREREQ) 41*0fca6ea1SDimitry Andric #endif // defined(__linux__) 42*0fca6ea1SDimitry Andric 43*0fca6ea1SDimitry Andric #ifndef __BYTE_ORDER__ 44*0fca6ea1SDimitry Andric # error \ 45*0fca6ea1SDimitry Andric "Your compiler doesn't seem to define __BYTE_ORDER__, which is required by libc++ to know the endianness of your target platform" 46*0fca6ea1SDimitry Andric #endif 47*0fca6ea1SDimitry Andric 48*0fca6ea1SDimitry Andric #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 49*0fca6ea1SDimitry Andric # define _LIBCPP_LITTLE_ENDIAN 50*0fca6ea1SDimitry Andric #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 51*0fca6ea1SDimitry Andric # define _LIBCPP_BIG_ENDIAN 52*0fca6ea1SDimitry Andric #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ 53*0fca6ea1SDimitry Andric 54*0fca6ea1SDimitry Andric #endif // _LIBCPP___CONFIGURATION_PLATFORM_H 55