yanglint BUILD optional interactive yanglint
Detected also based on ioctl.h presence.
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index b92f80c..0e1ee17 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,6 +1,16 @@
+include(CheckIncludeFile)
+
# config file for tools
configure_file(${PROJECT_SOURCE_DIR}/tools/config.h.in ${PROJECT_BINARY_DIR}/tools/config.h @ONLY)
+# find ioctl
+check_include_file("sys/ioctl.h" HAVE_IOCTL)
+if(NOT HAVE_IOCTL)
+ message(STATUS "Disabling interactive yanglint, sys/ioctl.h not found...")
+ set(ENABLE_YANGLINT_INTERACTIVE OFF)
+endif()
+
+# find getopt library on WIN32
if(WIN32)
find_library(GETOPT_LIBRARY NAMES getopt REQUIRED)
find_path(GETOPT_INCLUDE_DIR NAMES getopt.h REQUIRED)
diff --git a/tools/lint/CMakeLists.txt b/tools/lint/CMakeLists.txt
index 14f8b76..059305e 100644
--- a/tools/lint/CMakeLists.txt
+++ b/tools/lint/CMakeLists.txt
@@ -1,11 +1,4 @@
# yanglint
-
-if(WIN32)
- set(YANGLINT_INTERACTIVE OFF)
-else()
- set(YANGLINT_INTERACTIVE ON)
-endif()
-
set(lintsrc
main_ni.c
cmd.c
@@ -25,7 +18,8 @@
yl_schema_features.c
common.c
)
-if(YANGLINT_INTERACTIVE)
+
+if(ENABLE_YANGLINT_INTERACTIVE)
set(lintsrc ${lintsrc}
main.c
completion.c