1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

getifaddrs missing more user friendly in CMake.

Don't require the user to enable using the built-in BSD getifaddrs implementation on systems such as uclibc that lacks it manually.

Instead if getifaddrs doesn't exist, use the BSD one automatically, except if the user explicitly tells the user not to do this using WITHOUT_BUILTIN_GETIFADDRS (which will result in a compilation error, but at least with a nice error message explaining why).
This commit is contained in:
Joakim Soderberg 2013-02-22 09:28:02 +08:00 committed by Andy Green
parent 3baa08cac3
commit fcec61c576

View file

@ -31,7 +31,7 @@ endif()
option(WITH_SSL "Include SSL support (default OpenSSL, CyaSSL if USE_CYASSL is set)" ON)
option(USE_EXTERNAL_ZLIB "Search the system for ZLib instead of using the included one (on Windows)" OFF)
option(USE_CYASSL "Use CyaSSL replacement for OpenSSL. When settings this, you also need to specify CYASSL_LIB and CYASSL_INCLUDE_DIRS" OFF)
option(WITH_BUILTIN_GETIFADDRS "Use BSD getifaddrs implementation from libwebsockets... default is your libc provides it" OFF)
option(WITHOUT_BUILTIN_GETIFADDRS "Don't use BSD getifaddrs implementation from libwebsockets if it is missing (this will result in a compilation error) ... Default is your libc provides it. On some systems such as uclibc it doesn't exist." OFF)
option(WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF)
option(WITHOUT_CLIENT "Don't build the client part of the library" OFF)
option(WITHOUT_SERVER "Don't build the server part of the library" OFF)
@ -146,10 +146,11 @@ CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR)
CHECK_FUNCTION_EXISTS(vfork HAVE_VFORK)
CHECK_FUNCTION_EXISTS(getifaddrs HAVE_GETIFADDRS)
if (WITH_BUILTIN_GETIFADDRS)
if (HAVE_GETIFADDRS)
warning("getifaddrs already exists on the system, are you sure you want to build using the BSD version? (This is normally only needed on systems running uclibc)")
if (NOT HAVE_GETIFADDRS)
if (WITHOUT_BUILTIN_GETIFADDRS)
message(FATAL_ERROR "No getifaddrs was found on the system. Turn off the WITHOUT_BUILTIN_GETIFADDRS compile option to use the supplied BSD version.")
endif()
set(LWS_BUILTIN_GETIFADDRS 1)
endif()
@ -264,7 +265,7 @@ else()
endif()
if (UNIX)
if (NOT WITH_BUILTIN_GETIFADDRS)
if (NOT HAVE_GETIFADDRS)
list(APPEND HDR_PRIVATE lib/getifaddrs.h)
list(APPEND SOURCES lib/getifaddrs.c)
endif()