mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
configure without client
This leverages the refactor patches to introduce the ability to disable building any client side code in the library or the client side test apps. This will be a considerable size saving for embedded server-only case. Signed-off-by: Andy Green <andy.green@linaro.org>
This commit is contained in:
parent
5378b143c3
commit
03674a655d
6 changed files with 67 additions and 17 deletions
|
@ -75,6 +75,10 @@ There are several other possible configure options
|
|||
|
||||
--without-testapps Just build the library not the test apps
|
||||
|
||||
--without-client Don't build the client part of the library nor the
|
||||
test apps that need the client part. Useful to
|
||||
minimize library footprint for embedded server-only
|
||||
case
|
||||
|
||||
Externally configurable important constants
|
||||
-------------------------------------------
|
||||
|
|
12
configure.ac
12
configure.ac
|
@ -82,6 +82,18 @@ AC_ARG_WITH(testapps,
|
|||
|
||||
AM_CONDITIONAL(NO_TESTAPPS, test x$no_testapps = xyes)
|
||||
|
||||
#
|
||||
#
|
||||
#
|
||||
AC_ARG_WITH(client,
|
||||
[ --without-client dont build the client part of the library ],
|
||||
[ no_client=yes
|
||||
])
|
||||
|
||||
if test "x$no_client" = "xyes" ; then
|
||||
CFLAGS="$CFLAGS -DLWS_NO_CLIENT"
|
||||
fi
|
||||
AM_CONDITIONAL(NO_CLIENT, test x$no_client = xyes)
|
||||
|
||||
#
|
||||
#
|
||||
|
|
|
@ -3,17 +3,21 @@ include_HEADERS=libwebsockets.h
|
|||
dist_libwebsockets_la_SOURCES=libwebsockets.c \
|
||||
handshake.c \
|
||||
parsers.c \
|
||||
client.c \
|
||||
client-parser.c \
|
||||
output.c \
|
||||
libwebsockets.h \
|
||||
base64-decode.c \
|
||||
client-handshake.c \
|
||||
output.c \
|
||||
extension.c \
|
||||
extension-deflate-stream.c extension-deflate-stream.h \
|
||||
extension-deflate-frame.c extension-deflate-frame.h\
|
||||
private-libwebsockets.h
|
||||
|
||||
if NO_CLIENT
|
||||
else
|
||||
dist_libwebsockets_la_SOURCES+= client.c \
|
||||
client-parser.c \
|
||||
client-handshake.c
|
||||
endif
|
||||
|
||||
if USE_BUILTIN_GETIFADDRS
|
||||
dist_libwebsockets_la_SOURCES += getifaddrs.c
|
||||
endif
|
||||
|
|
|
@ -561,6 +561,7 @@ libwebsocket_read(struct libwebsocket_context *context,
|
|||
//fwrite(buf, 1, len, stderr);
|
||||
#endif
|
||||
|
||||
#ifndef LWS_NO_CLIENT
|
||||
switch (wsi->mode) {
|
||||
case LWS_CONNMODE_WS_CLIENT_WAITING_PROXY_REPLY:
|
||||
case LWS_CONNMODE_WS_CLIENT_ISSUE_HANDSHAKE:
|
||||
|
@ -574,7 +575,7 @@ libwebsocket_read(struct libwebsocket_context *context,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* LWS_CONNMODE_WS_SERVING */
|
||||
|
||||
for (n = 0; n < len; n++)
|
||||
|
@ -702,6 +703,7 @@ libwebsocket_read(struct libwebsocket_context *context,
|
|||
|
||||
case WSI_STATE_AWAITING_CLOSE_ACK:
|
||||
case WSI_STATE_ESTABLISHED:
|
||||
#ifndef LWS_NO_CLIENT
|
||||
switch (wsi->mode) {
|
||||
case LWS_CONNMODE_WS_CLIENT:
|
||||
for (n = 0; n < len; n++)
|
||||
|
@ -712,7 +714,7 @@ libwebsocket_read(struct libwebsocket_context *context,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* LWS_CONNMODE_WS_SERVING */
|
||||
|
||||
if (libwebsocket_interpret_incoming_packet(wsi, buf, len) < 0)
|
||||
|
|
|
@ -773,8 +773,9 @@ libwebsocket_service_fd(struct libwebsocket_context *context,
|
|||
int more = 1;
|
||||
struct lws_tokens eff_buf;
|
||||
int opt = 1;
|
||||
#ifndef LWS_NO_CLIENT
|
||||
extern int lws_client_socket_service(struct libwebsocket_context *context, struct libwebsocket *wsi, struct pollfd *pollfd);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* you can call us with pollfd = NULL to just allow the once-per-second
|
||||
* global timeout checks; if less than a second since the last check
|
||||
|
@ -1273,7 +1274,11 @@ read_pending:
|
|||
break;
|
||||
|
||||
default:
|
||||
#ifdef LWS_NO_CLIENT
|
||||
break;
|
||||
#else
|
||||
return lws_client_socket_service(context, wsi, pollfd);
|
||||
#endif
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -1,48 +1,71 @@
|
|||
bin_PROGRAMS=libwebsockets-test-server libwebsockets-test-client libwebsockets-test-server-extpoll libwebsockets-test-fraggle
|
||||
bin_PROGRAMS=libwebsockets-test-server libwebsockets-test-server-extpoll
|
||||
|
||||
if NO_CLIENT
|
||||
else
|
||||
bin_PROGRAMS+=libwebsockets-test-client libwebsockets-test-fraggle
|
||||
endif
|
||||
|
||||
libwebsockets_test_server_SOURCES=test-server.c
|
||||
libwebsockets_test_server_CFLAGS=
|
||||
libwebsockets_test_server_LDADD=-L../lib -lwebsockets -lz
|
||||
libwebsockets_test_client_SOURCES=test-client.c
|
||||
libwebsockets_test_client_CFLAGS=
|
||||
libwebsockets_test_client_LDADD=-L../lib -lwebsockets -lz
|
||||
libwebsockets_test_server_extpoll_SOURCES=test-server.c
|
||||
libwebsockets_test_server_extpoll_CFLAGS=$(AM_CFLAGS) -DEXTERNAL_POLL
|
||||
libwebsockets_test_server_extpoll_LDADD=-L../lib -lwebsockets -lz
|
||||
if NO_CLIENT
|
||||
else
|
||||
libwebsockets_test_client_SOURCES=test-client.c
|
||||
libwebsockets_test_client_CFLAGS=
|
||||
libwebsockets_test_client_LDADD=-L../lib -lwebsockets -lz
|
||||
libwebsockets_test_fraggle_SOURCES=test-fraggle.c
|
||||
libwebsockets_test_fraggle_CFLAGS=
|
||||
libwebsockets_test_fraggle_LDADD=-L../lib -lwebsockets -lz
|
||||
|
||||
endif
|
||||
|
||||
if MINGW
|
||||
libwebsockets_test_server_CFLAGS+= -w -I../win32port/win32helpers
|
||||
libwebsockets_test_client_CFLAGS+= -w -I../win32port/win32helpers
|
||||
libwebsockets_test_server_extpoll_CFLAGS+= -w -I../win32port/win32helpers
|
||||
if NO_CLIENT
|
||||
else
|
||||
libwebsockets_test_client_CFLAGS+= -w -I../win32port/win32helpers
|
||||
libwebsockets_test_fraggle_CFLAGS+= -w -I../win32port/win32helpers
|
||||
endif
|
||||
|
||||
libwebsockets_test_server_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
|
||||
libwebsockets_test_client_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
|
||||
libwebsockets_test_server_extpoll_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
|
||||
if NO_CLIENT
|
||||
else
|
||||
libwebsockets_test_client_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
|
||||
libwebsockets_test_fraggle_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
|
||||
endif
|
||||
|
||||
else
|
||||
libwebsockets_test_server_CFLAGS+= -Werror
|
||||
libwebsockets_test_client_CFLAGS+= -Werror
|
||||
libwebsockets_test_server_extpoll_CFLAGS+= -Werror
|
||||
if NO_CLIENT
|
||||
else
|
||||
libwebsockets_test_client_CFLAGS+= -Werror
|
||||
libwebsockets_test_fraggle_CFLAGS+= -Werror
|
||||
endif
|
||||
endif
|
||||
|
||||
libwebsockets_test_server_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
libwebsockets_test_client_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
libwebsockets_test_server_extpoll_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
if NO_CLIENT
|
||||
else
|
||||
libwebsockets_test_client_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
libwebsockets_test_fraggle_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
|
||||
endif
|
||||
|
||||
if NOPING
|
||||
else
|
||||
if NO_CLIENT
|
||||
else
|
||||
bin_PROGRAMS+=libwebsockets-test-ping
|
||||
libwebsockets_test_ping_SOURCES=test-ping.c
|
||||
libwebsockets_test_ping_LDADD=-L../lib -lwebsockets
|
||||
libwebsockets_test_ping_CFLAGS= -Wall -Werror -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
|
||||
endif
|
||||
endif
|
||||
|
||||
EXTRA_DIST=test.html favicon.ico libwebsockets.org-logo.png
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue