summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Haszlakiewicz <erh+git@nimenees.com>2021-02-15 20:19:56 +0000
committerEric Haszlakiewicz <erh+git@nimenees.com>2021-02-15 20:19:56 +0000
commit041cef434afe0d0c6da8b6ac1d1fa26087246dda (patch)
tree655258ff0ad4537136c4b6bbff5f7d7f7474d573
parentf787810890b91b2b141ce7630d5be85c5f8cfcc3 (diff)
downloadjson-c-041cef434afe0d0c6da8b6ac1d1fa26087246dda.tar.gz
Add a DISABLE_EXTRA_LIBS option to skip using libbsd, per @neheb's request on issue #692/commit 0f61f692.
-rw-r--r--CMakeLists.txt3
-rwxr-xr-xcmake-configure4
2 files changed, 6 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30b4f2d..79038aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,6 +97,7 @@ option(DISABLE_WERROR "Avoid treating compiler warnings as fatal
option(ENABLE_RDRAND "Enable RDRAND Hardware RNG Hash Seed." OFF)
option(ENABLE_THREADING "Enable partial threading support." OFF)
option(OVERRIDE_GET_RANDOM_SEED "Override json_c_get_random_seed() with custom code." OFF)
+option(DISABLE_EXTRA_LIBS "Avoid linking against extra libraries, such as libbsd." OFF)
if (UNIX OR MINGW OR CYGWIN)
@@ -171,7 +172,7 @@ check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
check_symbol_exists(vprintf "stdio.h" HAVE_VPRINTF)
check_symbol_exists(arc4random "stdlib.h" HAVE_ARC4RANDOM)
-if (NOT HAVE_ARC4RANDOM)
+if (NOT HAVE_ARC4RANDOM AND DISABLE_EXTRA_LIBS STREQUAL "OFF")
check_include_file(bsd/stdlib.h HAVE_BSD_STDLIB_H)
if (HAVE_BSD_STDLIB_H)
list(APPEND CMAKE_REQUIRED_LIBRARIES "-lbsd")
diff --git a/cmake-configure b/cmake-configure
index c8e44ae..dc695e5 100755
--- a/cmake-configure
+++ b/cmake-configure
@@ -30,6 +30,7 @@ $0 [<configure_options>] [-- [<cmake options>]]
--enable-static build static libraries [default=yes]
--disable-Bsymbolic Avoid linking with -Bsymbolic-function
--disable-werror Avoid treating compiler warnings as fatal errors
+ --disable-extra-libs Avoid linking against extra libraries, such as libbsd
EOF
exit
@@ -73,6 +74,9 @@ while [ $# -gt 0 ] ; do
--disable-werror)
FLAGS+=(-DDISABLE_WERROR=ON)
;;
+ --disable-extra-libs)
+ FLAGS+=(-DDISABLE_EXTRA_LIBS=ON)
+ ;;
--)
shift
break