mirror of
https://github.com/neovim/neovim.git
synced 2025-10-18 15:51:50 +00:00
Merge pull request #4755 from jszakmeister/fix-endian-h-on-bsd
Fix be64toh() detection on BSDs.
This commit is contained in:
@@ -67,6 +67,14 @@ if(HAVE_LANGINFO_H)
|
|||||||
check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
|
check_symbol_exists(CODESET "langinfo.h" HAVE_NL_LANGINFO_CODESET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
check_include_files("endian.h" HAVE_ENDIAN_H)
|
||||||
|
check_include_files("sys/endian.h" HAVE_SYS_ENDIAN_H)
|
||||||
|
|
||||||
|
set(ENDIAN_INCLUDE_FILE "endian.h")
|
||||||
|
if(HAVE_SYS_ENDIAN_H AND NOT HAVE_ENDIAN_H)
|
||||||
|
set(ENDIAN_INCLUDE_FILE "sys/endian.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(SI "#include <stdint.h>\n")
|
set(SI "#include <stdint.h>\n")
|
||||||
set(MS "int main(int argc,char**argv)\n{\n uint64_t i=0x0102030405060708ULL;")
|
set(MS "int main(int argc,char**argv)\n{\n uint64_t i=0x0102030405060708ULL;")
|
||||||
set(ME "}")
|
set(ME "}")
|
||||||
@@ -74,7 +82,7 @@ check_c_source_compiles("
|
|||||||
#define _BSD_SOURCE 1
|
#define _BSD_SOURCE 1
|
||||||
#define _DEFAULT_SOURCE 1
|
#define _DEFAULT_SOURCE 1
|
||||||
${SI}
|
${SI}
|
||||||
#include <endian.h>
|
#include <${ENDIAN_INCLUDE_FILE}>
|
||||||
#ifndef be64toh
|
#ifndef be64toh
|
||||||
# error No be64toh macros
|
# error No be64toh macros
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,5 +57,6 @@
|
|||||||
|
|
||||||
#cmakedefine HAVE_BE64TOH
|
#cmakedefine HAVE_BE64TOH
|
||||||
#cmakedefine ORDER_BIG_ENDIAN
|
#cmakedefine ORDER_BIG_ENDIAN
|
||||||
|
#define ENDIAN_INCLUDE_FILE <@ENDIAN_INCLUDE_FILE@>
|
||||||
|
|
||||||
#endif // AUTO_CONFIG_H
|
#endif // AUTO_CONFIG_H
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
#ifdef HAVE_BE64TOH
|
#ifdef HAVE_BE64TOH
|
||||||
# define _BSD_SOURCE 1
|
# define _BSD_SOURCE 1
|
||||||
# define _DEFAULT_SOURCE 1
|
# define _DEFAULT_SOURCE 1
|
||||||
# include <endian.h>
|
# include ENDIAN_INCLUDE_FILE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Note: when using bufset hash pointers are intentionally casted to uintptr_t
|
// Note: when using bufset hash pointers are intentionally casted to uintptr_t
|
||||||
|
Reference in New Issue
Block a user