Skip to content
Snippets Groups Projects
Commit 4f4a38ba authored by Joakim Söderberg's avatar Joakim Söderberg Committed by Andy Green
Browse files

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__
parent 68e8d730
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment