mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Added check for inline keyword availability.
Both to CMake project and Autoconf. inline will be defined to whatever inline replacement exists on the system, such as __inline or __inline__
This commit is contained in:
parent
68e8d730b8
commit
4f4a38bae0
4 changed files with 31 additions and 10 deletions
|
@ -87,6 +87,27 @@ endif()
|
|||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
include_directories(${PROJECT_BINARY_DIR})
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
# Check for different inline keyword versions.
|
||||
foreach(KEYWORD "inline" "__inline__" "__inline")
|
||||
set(CMAKE_REQUIRED_DEFINITIONS "-DKEYWORD=${KEYWORD}")
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"
|
||||
#include <stdio.h>
|
||||
KEYWORD void a() {}
|
||||
int main(int argc, char **argv) { a(); return 0; }
|
||||
" HAVE_${KEYWORD})
|
||||
endforeach()
|
||||
|
||||
if (NOT HAVE_inline)
|
||||
if (HAVE___inline__)
|
||||
set(inline __inline__)
|
||||
elseif(HAVE___inline)
|
||||
set(inline __inline)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Put the libaries and binaries that get built into directories at the
|
||||
# top of the build tree rather than in hard-to-find leaf directories.
|
||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
||||
|
|
|
@ -162,3 +162,6 @@
|
|||
|
||||
/* Define as `fork' if `vfork' does not work. */
|
||||
//#cmakedefine vfork
|
||||
|
||||
/* Define if the inline keyword doesn't exist. */
|
||||
#cmakedefine inline
|
||||
|
|
|
@ -22,6 +22,9 @@ applyhash='CFLAGS+= -DLWS_LIBRARY_VERSION=\"$(PACKAGE_VERSION)\" -DLWS_BUILD_HAS
|
|||
AC_SUBST([applyhash])
|
||||
AM_SUBST_NOTMAKE([applyhash])
|
||||
|
||||
# Check for existance of the inline keyword.
|
||||
AC_C_INLINE
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
*/
|
||||
#ifdef CMAKE_BUILD
|
||||
#include "lws_config.h"
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000 || defined(_WIN32)
|
||||
|
@ -47,14 +49,6 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef inline
|
||||
#ifdef __inline
|
||||
#define inline __inline
|
||||
#elif defined(__inline__)
|
||||
#define inline __inline__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define LWS_NO_DAEMONIZE
|
||||
|
||||
|
@ -398,8 +392,8 @@ struct libwebsocket {
|
|||
};
|
||||
|
||||
#ifndef LWS_LATENCY
|
||||
static void lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi, const char *action, int ret, int completion) { while (0); }
|
||||
static void lws_latency_pre(struct libwebsocket_context *context, struct libwebsocket *wsi) { while (0); }
|
||||
static inline void lws_latency(struct libwebsocket_context *context, struct libwebsocket *wsi, const char *action, int ret, int completion) { while (0); }
|
||||
static inline void lws_latency_pre(struct libwebsocket_context *context, struct libwebsocket *wsi) { while (0); }
|
||||
#else
|
||||
#define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)
|
||||
extern void
|
||||
|
|
Loading…
Add table
Reference in a new issue