-bin_PROGRAMS=libwebsockets-test-server libwebsockets-test-client libwebsockets-test-server-extpoll libwebsockets-test-fraggle
+bin_PROGRAMS=
+
+if NO_CLIENT
+else
+bin_PROGRAMS+= libwebsockets-test-client
+if NO_SERVER
+else
+bin_PROGRAMS+= libwebsockets-test-fraggle
+endif
+endif
+
+if NO_SERVER
+else
+bin_PROGRAMS+=libwebsockets-test-server libwebsockets-test-server-extpoll
+endif
+
+if NO_SERVER
+else
libwebsockets_test_server_SOURCES=test-server.c
+libwebsockets_test_server_CFLAGS=
libwebsockets_test_server_LDADD=-L../lib -lwebsockets
+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
+endif
+if NO_CLIENT
+else
libwebsockets_test_client_SOURCES=test-client.c
+libwebsockets_test_client_CFLAGS=
libwebsockets_test_client_LDADD=-L../lib -lwebsockets
-libwebsockets_test_server_extpoll_SOURCES=test-server-extpoll.c
-libwebsockets_test_server_extpoll_LDADD=-L../lib -lwebsockets
+if NO_SERVER
+else
libwebsockets_test_fraggle_SOURCES=test-fraggle.c
+libwebsockets_test_fraggle_CFLAGS=
libwebsockets_test_fraggle_LDADD=-L../lib -lwebsockets
+endif
+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
-libwebsockets_test_fraggle_CFLAGS:= -w -I../win32port/win32helpers
+if MINGW
+if NO_SERVER
+else
+libwebsockets_test_server_CFLAGS+= -w -I../win32port/win32helpers
+libwebsockets_test_server_extpoll_CFLAGS+= -w -I../win32port/win32helpers
+endif
+if NO_CLIENT
+else
+libwebsockets_test_client_CFLAGS+= -w -I../win32port/win32helpers
+if NO_SERVER
+else
+libwebsockets_test_fraggle_CFLAGS+= -w -I../win32port/win32helpers
+endif
+endif
-libwebsockets_test_server_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lpthread -ldl -lws2_32 -lz -L../win32port/win32helpers/ -lwebsock-w32
-libwebsockets_test_client_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lpthread -ldl -lws2_32 -lz -L../win32port/win32helpers/ -lwebsock-w32
-libwebsockets_test_server_extpoll_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lpthread -ldl -lws2_32 -lz -L../win32port/win32helpers/ -lwebsock-w32
-libwebsockets_test_fraggle_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lpthread -ldl -lws2_32 -lz -L../win32port/win32helpers/ -lwebsock-w32
+if NO_SERVER
+else
+libwebsockets_test_server_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
+libwebsockets_test_server_extpoll_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
+endif
+if NO_CLIENT
+else
+libwebsockets_test_client_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
+if NO_SERVER
+else
+libwebsockets_test_fraggle_LDADD+= -lm -luser32 -ladvapi32 -lkernel32 -lgcc -lws2_32 -lz
+endif
+endif
else
-libwebsockets_test_server_CFLAGS:= -Werror
-libwebsockets_test_client_CFLAGS:= -Werror
-libwebsockets_test_server_extpoll_CFLAGS:= -Werror
-libwebsockets_test_fraggle_CFLAGS:= -Werror
+if NO_SERVER
+else
+libwebsockets_test_server_CFLAGS+= -Werror
+libwebsockets_test_server_extpoll_CFLAGS+= -Werror
+endif
+if NO_CLIENT
+else
+libwebsockets_test_client_CFLAGS+= -Werror
+if NO_SERVER
+else
+libwebsockets_test_fraggle_CFLAGS+= -Werror
+endif
+endif
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@\"
-
+if NO_SERVER
+else
+libwebsockets_test_server_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@\"
+endif
+if NO_CLIENT
+else
+libwebsockets_test_client_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
+if NO_SERVER
+else
+libwebsockets_test_fraggle_CFLAGS+= -Wall -std=gnu99 -pedantic -DINSTALL_DATADIR=\"@datadir@\" -DLWS_OPENSSL_CLIENT_CERTS=\"@clientcertdir@\"
+endif
+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 -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
endif
+EXTRA_DIST=test.html favicon.ico libwebsockets.org-logo.png
#
# cook a random test cert and key
install-data-local:libwebsockets-test-server.key.pem libwebsockets-test-server.pem
mkdir -p $(DESTDIR)$(datadir)/libwebsockets-test-server
- cp -a test.html favicon.ico libwebsockets-test-server.key.pem libwebsockets-test-server.pem \
+ cp -a $(EXTRA_DIST) libwebsockets-test-server.key.pem libwebsockets-test-server.pem \
$(DESTDIR)$(datadir)/libwebsockets-test-server