Skip to content

Commit

Permalink
iiod: Use WITH_AIO instead of ENABLE_AIO
Browse files Browse the repository at this point in the history
The code already checked for the WITH_AIO macro, and almost all
configurable options in libiio and IIOD use the "WITH" prefix.

Signed-off-by: Paul Cercueil <[email protected]>
  • Loading branch information
pcercuei committed May 11, 2021
1 parent 6d49eec commit d0ca69e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion iio-config.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#cmakedefine01 WITH_NETWORK_EVENTFD
#cmakedefine01 WITH_IIOD_USBD
#cmakedefine01 WITH_LOCAL_CONFIG
#cmakedefine01 WITH_AIO
#cmakedefine01 HAVE_DNS_SD
#cmakedefine01 HAVE_AVAHI
#cmakedefine01 ENABLE_AIO
#cmakedefine01 WITH_ZSTD

#cmakedefine HAS_PIPE2
Expand Down
11 changes: 5 additions & 6 deletions iiod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ find_library(LIBAIO_LIBRARIES aio)
find_path(LIBAIO_INCLUDE_DIR libaio.h)

if (LIBAIO_LIBRARIES AND LIBAIO_INCLUDE_DIR)
option(ENABLE_AIO "Build IIOD with async. I/O support" ON)
option(WITH_AIO "Build IIOD with async. I/O support" ON)
endif ()

include(CheckTypeSize)
Expand All @@ -33,12 +33,12 @@ check_type_size("struct usb_functionfs_descs_head_v2" FUNCTIONFS_V2)
set(CMAKE_EXTRA_INCLUDE_FILES)

if (HAVE_FUNCTIONFS_V2)
OPTION(WITH_IIOD_USBD "Add support for USB through FunctionFS within IIOD" ${ENABLE_AIO})
OPTION(WITH_IIOD_USBD "Add support for USB through FunctionFS within IIOD" ${WITH_AIO})

if (WITH_IIOD_USBD)
if (NOT ENABLE_AIO)
if (NOT WITH_AIO)
message(SEND_ERROR "USB support in IIOD requires async. I/O support")
endif (NOT ENABLE_AIO)
endif (NOT WITH_AIO)

set(IIOD_CFILES ${IIOD_CFILES} usbd.c)
endif (WITH_IIOD_USBD)
Expand All @@ -52,8 +52,7 @@ set_target_properties(iiod PROPERTIES
)
target_link_libraries(iiod iio ${PTHREAD_LIBRARIES} ${AVAHI_LIBRARIES})

if (ENABLE_AIO)
add_definitions(-DWITH_AIO=1)
if (WITH_AIO)
include_directories(${LIBAIO_INCLUDE_DIR})
target_link_libraries(iiod ${LIBAIO_LIBRARIES})
endif ()
Expand Down
2 changes: 1 addition & 1 deletion iiod/iiod.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ int main(int argc, char **argv)
interactive = true;
break;
case 'a':
if (!ENABLE_AIO) {
if (!WITH_AIO) {
IIO_ERROR("IIOD was not compiled with AIO support.\n");
return EXIT_FAILURE;
}
Expand Down

0 comments on commit d0ca69e

Please sign in to comment.