From 2265dee9143f4a6a7562d29ad23068ca830c366c Mon Sep 17 00:00:00 2001 From: Krisztian Litkey Date: Fri, 1 Feb 2013 21:29:26 +0200 Subject: [PATCH] build-sys: fix to compile again without websockets. --- configure.ac | 37 ++++++++++++++++++++++++++++++++++++- src/Makefile.am | 18 ++++++++++++++++-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 08bd8a4..fbf08ad 100644 --- a/configure.ac +++ b/configure.ac @@ -287,7 +287,7 @@ AC_ARG_ENABLE(websockets, [enable_websockets=$enableval], [enable_websockets=auto]) if test "$enable_websockets" != "no"; then - PKG_CHECK_MODULES(WEBSOCKETS, [libwebsockets json] , + PKG_CHECK_MODULES(WEBSOCKETS, [libwebsockets json], [have_websockets=yes], [have_websockets=no]) if test "$have_websockets" = "no" -a "$enable_websockets" = "yes"; then AC_MSG_ERROR([libwebsockets or json-c development libraries not found.]) @@ -300,12 +300,45 @@ fi if test "$enable_websockets" = "yes"; then AC_DEFINE([WEBSOCKETS_ENABLED], 1, [Enable websockets support ?]) + enable_json=yes + AC_DEFINE([JSON_ENABLED], 1, [Enable JSON encoding/decoding support ?]) +else + enable_json=no fi AM_CONDITIONAL(WEBSOCKETS_ENABLED, [test "$enable_websockets" = "yes"]) AC_SUBST(WEBSOCKETS_ENABLED) AC_SUBST(WEBSOCKETS_CFLAGS) AC_SUBST(WEBSOCKETS_LIBS) +# If websockets is not enabled/available check if JSON was asked for. +if test "$enable_json" = "no"; then + AC_ARG_ENABLE(json, + [--enable-json enable JSON encoding/decoding support], + [enable_json=$enableval], [enable_json=auto]) + + if test "$enable_json" != "no"; then + PKG_CHECK_MODULES(JSON, [json], + [have_json=yes], [have_json=no]) + if test "$have_json" = "no" -a "$enable_json" = "yes"; then + AC_MSG_ERROR([json-c development libraries not found.]) + fi + + enable_json="$have_json" + else + AC_MSG_NOTICE([JSON support is disabled.]) + fi + + if test "$enable_json" = "yes"; then + AC_DEFINE([JSON_ENABLED], 1, [Enable json support ?]) + fi + AC_SUBST(JSON_ENABLED) + AC_SUBST(JSON_CFLAGS) + AC_SUBST(JSON_LIBS) +fi + +AM_CONDITIONAL(JSON_ENABLED, [test "$enable_json" = "yes"]) + + # Set up murphy CFLAGS and LIBS. MURPHY_CFLAGS="" MURPHY_LIBS="" @@ -542,6 +575,8 @@ echo "glib mainloop support: $enable_glib" echo "Qt mainloop support: $enable_qt" echo "Murphy console plugin and client: $enable_console" echo "Resource management support: $with_resources" +echo "Websockets support: $enable_websockets" +echo "JSON encoding/decoding support: $enable_json" echo "Plugins:" echo " - linked-in:" for plugin in ${INTERNAL_PLUGINS:-none}; do diff --git a/src/Makefile.am b/src/Makefile.am index 81f3668..3951b68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,6 +54,7 @@ libmurphy_common_la_HEADERS = \ common/file-utils.h \ common/msg.h \ common/refcnt.h \ + common/fragbuf.h \ common/transport.h libmurphy_common_la_REGULAR_SOURCES = \ @@ -65,6 +66,7 @@ libmurphy_common_la_REGULAR_SOURCES = \ common/utils.c \ common/file-utils.c \ common/msg.c \ + common/fragbuf.c \ common/transport.c \ common/stream-transport.c \ common/internal-transport.c \ @@ -91,13 +93,11 @@ libcommoninclude_HEADERS = $(libmurphy_common_la_HEADERS) if WEBSOCKETS_ENABLED libmurphy_common_la_HEADERS += \ - common/fragbuf.h \ common/websocklib.h \ common/websocket.h \ common/json.h libmurphy_common_la_REGULAR_SOURCES += \ - common/fragbuf.c \ common/websocklib.c \ common/websocket.c \ common/wsck-transport.c \ @@ -108,6 +108,20 @@ libmurphy_common_la_CFLAGS += \ libmurphy_common_la_LIBADD += \ $(WEBSOCKETS_LIBS) +else +if JSON_ENABLED +libmurphy_common_la_HEADERS += \ + common/json.h + +libmurphy_common_la_REGULAR_SOURCES += \ + common/json.c + +libmurphy_common_la_CFLAGS += \ + $(JSON_CFLAGS) + +libmurphy_common_la_LIBADD += \ + $(JSON_LIBS) +endif endif -- 2.7.4