From cce2a81e85d9693a83ac30e9e58f732b59759a88 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 12 Apr 2012 11:06:05 +0800 Subject: change DATADIR to INSTALL_DATADIR solve mingw conflict Based on work from Radu Sorici Signed-off-by: Andy Green --- lib/Makefile.am | 2 +- lib/Makefile.in | 2 +- lib/client-handshake.c | 1 - test-server/Makefile.am | 10 +++++----- test-server/Makefile.in | 22 +++++++++++++--------- test-server/test-fraggle.c | 2 +- test-server/test-server-extpoll.c | 2 +- test-server/test-server.c | 2 +- win32port/win32helpers/websock-w32.h | 9 ++++++++- 9 files changed, 31 insertions(+), 21 deletions(-) diff --git a/lib/Makefile.am b/lib/Makefile.am index 60567b9..87c2c43 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -31,7 +31,7 @@ libwebsockets_la_LDFLAGS+= -version-info 0:3 endif libwebsockets_la_CFLAGS+= -c \ - -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" + -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" libwebsockets_la_LDFLAGS+= -lz all-local: diff --git a/lib/Makefile.in b/lib/Makefile.in index a0ea159..af1121c 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -240,7 +240,7 @@ dist_libwebsockets_la_SOURCES = libwebsockets.c handshake.c parsers.c \ extension-deflate-stream.c private-libwebsockets.h \ $(am__append_1) $(am__append_2) libwebsockets_la_CFLAGS := -Wall -std=gnu99 -pedantic $(am__append_3) \ - $(am__append_5) -c -DDATADIR=\"@datadir@\" \ + $(am__append_5) -c -DINSTALL_DATADIR=\"@datadir@\" \ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" libwebsockets_la_LDFLAGS := $(am__append_4) $(am__append_6) -lz all: all-am diff --git a/lib/client-handshake.c b/lib/client-handshake.c index 58761ca..6bff052 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -1,7 +1,6 @@ #include "private-libwebsockets.h" #include - struct libwebsocket *__libwebsocket_client_connect_2( struct libwebsocket_context *context, struct libwebsocket *wsi diff --git a/test-server/Makefile.am b/test-server/Makefile.am index cfbeacc..09da2e9 100644 --- a/test-server/Makefile.am +++ b/test-server/Makefile.am @@ -26,10 +26,10 @@ libwebsockets_test_server_extpoll_CFLAGS:= -Werror libwebsockets_test_fraggle_CFLAGS:= -Werror endif -libwebsockets_test_server_CFLAGS+= -Wall -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" -libwebsockets_test_client_CFLAGS+= -Wall -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" -libwebsockets_test_server_extpoll_CFLAGS+= -Wall -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" -libwebsockets_test_fraggle_CFLAGS+= -Wall -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +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@\" +libwebsockets_test_fraggle_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" if NOPING @@ -37,7 +37,7 @@ 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 -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +libwebsockets_test_ping_CFLAGS:= -Wall -Werror -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" endif diff --git a/test-server/Makefile.in b/test-server/Makefile.in index f13f9de..5beb753 100644 --- a/test-server/Makefile.in +++ b/test-server/Makefile.in @@ -256,36 +256,40 @@ libwebsockets_test_fraggle_SOURCES = test-fraggle.c libwebsockets_test_fraggle_LDADD = -L../lib -lwebsockets \ $(am__append_4) @MINGW_FALSE@libwebsockets_test_server_CFLAGS := -Werror -Wall \ -@MINGW_FALSE@ -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_TRUE@libwebsockets_test_server_CFLAGS := -w \ @MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ -@MINGW_TRUE@ -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_FALSE@libwebsockets_test_client_CFLAGS := -Werror -Wall \ -@MINGW_FALSE@ -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_TRUE@libwebsockets_test_client_CFLAGS := -w \ @MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ -@MINGW_TRUE@ -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_FALSE@libwebsockets_test_server_extpoll_CFLAGS := -Werror -Wall \ -@MINGW_FALSE@ -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_TRUE@libwebsockets_test_server_extpoll_CFLAGS := -w \ @MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ -@MINGW_TRUE@ -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_FALSE@libwebsockets_test_fraggle_CFLAGS := -Werror -Wall \ -@MINGW_FALSE@ -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_FALSE@ -std=gnu99 -pedantic \ +@MINGW_FALSE@ -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_FALSE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @MINGW_TRUE@libwebsockets_test_fraggle_CFLAGS := -w \ @MINGW_TRUE@ -I../win32port/win32helpers -Wall -std=gnu99 \ -@MINGW_TRUE@ -pedantic -DDATADIR=\"@datadir@\" \ +@MINGW_TRUE@ -pedantic -DINSTALL_DATADIR=\"@datadir@\" \ @MINGW_TRUE@ -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" @NOPING_FALSE@libwebsockets_test_ping_SOURCES = test-ping.c @NOPING_FALSE@libwebsockets_test_ping_LDADD = -L../lib -lwebsockets -@NOPING_FALSE@libwebsockets_test_ping_CFLAGS := -Wall -Werror -std=gnu99 -pedantic -DDATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" +@NOPING_FALSE@libwebsockets_test_ping_CFLAGS := -Wall -Werror -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\" all: all-am .SUFFIXES: diff --git a/test-server/test-fraggle.c b/test-server/test-fraggle.c index 873bee3..1c77d59 100644 --- a/test-server/test-fraggle.c +++ b/test-server/test-fraggle.c @@ -28,7 +28,7 @@ #include "../lib/libwebsockets.h" -#define LOCAL_RESOURCE_PATH DATADIR"/libwebsockets-test-server" +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" static int client; static int terminate; diff --git a/test-server/test-server-extpoll.c b/test-server/test-server-extpoll.c index f550ff6..1ad3fb5 100644 --- a/test-server/test-server-extpoll.c +++ b/test-server/test-server-extpoll.c @@ -68,7 +68,7 @@ enum demo_protocols { }; -#define LOCAL_RESOURCE_PATH DATADIR"/libwebsockets-test-server" +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" /* this protocol server (always the first one) just knows how to do HTTP */ diff --git a/test-server/test-server.c b/test-server/test-server.c index f054b16..dae0a8d 100644 --- a/test-server/test-server.c +++ b/test-server/test-server.c @@ -57,7 +57,7 @@ enum demo_protocols { }; -#define LOCAL_RESOURCE_PATH DATADIR"/libwebsockets-test-server" +#define LOCAL_RESOURCE_PATH INSTALL_DATADIR"/libwebsockets-test-server" /* this protocol server (always the first one) just knows how to do HTTP */ diff --git a/win32port/win32helpers/websock-w32.h b/win32port/win32helpers/websock-w32.h index 2d2bb4a..2483a8f 100644 --- a/win32port/win32helpers/websock-w32.h +++ b/win32port/win32helpers/websock-w32.h @@ -50,6 +50,13 @@ extern INT WSAAPI emulated_poll(LPWSAPOLLFD fdarray, ULONG nfds, INT timeout); /* override configure because we are not using Makefiles */ #define LWS_NO_FORK -#define DATADIR "." + +/* windows can't cope with this idea, needs assets in cwd */ + +#ifdef INSTALL_DATADIR +#undef INSTALL_DATADIR +#endif + +#define INSTALL_DATADIR "." #endif -- cgit v1.2.3