Skip to content

Commit 041cef4

Browse files
committed
Add a DISABLE_EXTRA_LIBS option to skip using libbsd, per @neheb's request on issue json-c#692/commit 0f61f69.
1 parent f787810 commit 041cef4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ option(DISABLE_WERROR "Avoid treating compiler warnings as fatal
9797
option(ENABLE_RDRAND "Enable RDRAND Hardware RNG Hash Seed." OFF)
9898
option(ENABLE_THREADING "Enable partial threading support." OFF)
9999
option(OVERRIDE_GET_RANDOM_SEED "Override json_c_get_random_seed() with custom code." OFF)
100+
option(DISABLE_EXTRA_LIBS "Avoid linking against extra libraries, such as libbsd." OFF)
100101

101102

102103
if (UNIX OR MINGW OR CYGWIN)
@@ -171,7 +172,7 @@ check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
171172
check_symbol_exists(vprintf "stdio.h" HAVE_VPRINTF)
172173

173174
check_symbol_exists(arc4random "stdlib.h" HAVE_ARC4RANDOM)
174-
if (NOT HAVE_ARC4RANDOM)
175+
if (NOT HAVE_ARC4RANDOM AND DISABLE_EXTRA_LIBS STREQUAL "OFF")
175176
check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H)
176177
if (HAVE_BSD_STDLIB_H)
177178
list(APPEND CMAKE_REQUIRED_LIBRARIES "-lbsd")

cmake-configure

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ $0 [<configure_options>] [-- [<cmake options>]]
3030
--enable-static build static libraries [default=yes]
3131
--disable-Bsymbolic Avoid linking with -Bsymbolic-function
3232
--disable-werror Avoid treating compiler warnings as fatal errors
33+
--disable-extra-libs Avoid linking against extra libraries, such as libbsd
3334
3435
EOF
3536
exit
@@ -73,6 +74,9 @@ while [ $# -gt 0 ] ; do
7374
--disable-werror)
7475
FLAGS+=(-DDISABLE_WERROR=ON)
7576
;;
77+
--disable-extra-libs)
78+
FLAGS+=(-DDISABLE_EXTRA_LIBS=ON)
79+
;;
7680
--)
7781
shift
7882
break

0 commit comments

Comments
 (0)