Skip to content

Commit 68356bd

Browse files
committed
Add tests for bswap declarations to CMakeLists.txt.
1 parent e0bbb56 commit 68356bd

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ target_include_directories(
168168
target_link_libraries(zone-bench PRIVATE zone)
169169

170170
check_include_file(endian.h HAVE_ENDIAN_H)
171+
check_include_file(sys/endian.h HAVE_SYS_ENDIAN_H)
171172
check_include_file(unistd.h HAVE_UNISTD_H)
173+
set(ENDIAN_INCLUDES "endian.h")
174+
if(HAVE_SYS_ENDIAN_H)
175+
set(ENDIAN_INCLUDES "${ENDIAN_INCLUDES};sys/endian.h")
176+
endif()
177+
check_symbol_exists(bswap16 ${ENDIAN_INCLUDES} HAVE_DECL_BSWAP16)
178+
check_symbol_exists(bswap32 ${ENDIAN_INCLUDES} HAVE_DECL_BSWAP32)
179+
check_symbol_exists(bswap64 ${ENDIAN_INCLUDES} HAVE_DECL_BSWAP64)
172180

173181
set(CMAKE_REQUIRED_DEFINITIONS "-D_DEFAULT_SOURCE=1")
174182
check_symbol_exists(getopt "stdlib.h;unistd.h" HAVE_GETOPT)

src/config.h.in

+12
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@
99
#ifndef CONFIG_H
1010
#define CONFIG_H
1111

12+
/* Define to 1 if you have the declaration of `bswap16', and to 0 if you
13+
don't. */
14+
#cmakedefine01 HAVE_DECL_BSWAP16
15+
16+
/* Define to 1 if you have the declaration of `bswap32', and to 0 if you
17+
don't. */
18+
#cmakedefine01 HAVE_DECL_BSWAP32
19+
20+
/* Define to 1 if you have the declaration of `bswap64', and to 0 if you
21+
don't. */
22+
#cmakedefine01 HAVE_DECL_BSWAP64
23+
1224
/* Define to 1 if you have the <endian.h> header file. */
1325
#cmakedefine HAVE_ENDIAN_H 1
1426

0 commit comments

Comments
 (0)