Skip to content

Commit

Permalink
Merge pull request elastic#66 from talien/f/json-submodule
Browse files Browse the repository at this point in the history
json: Added json-c as git submodule
  • Loading branch information
bazsi committed Jan 16, 2014
2 parents 10e2d8c + 0cb3714 commit 6104588
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 31 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "modules/afamqp/rabbitmq-c"]
path = modules/afamqp/rabbitmq-c
url = https://github.com/alanxz/rabbitmq-c.git
[submodule "lib/jsonc"]
path = lib/jsonc
url = https://github.com/json-c/json-c.git
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This script is needed to setup build environment from checked out
# source tree.
#
SUBMODULES="lib/ivykis modules/afmongodb/libmongo-client modules/afamqp/rabbitmq-c"
SUBMODULES="lib/ivykis modules/afmongodb/libmongo-client modules/afamqp/rabbitmq-c lib/jsonc"
GIT=`which git`

autogen_submodules()
Expand Down
73 changes: 46 additions & 27 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ AC_ARG_WITH(libmongo-client,
Link against the system supplied or the built-in libmongo-client library.]
,,with_libmongo_client="internal")

AC_ARG_WITH(jsonc,
[ --with-jsonc=[system/internal/auto/no]
Link against the system supplied or the built-in jsonc library or explicitly disable it. (default:auto)]
,,with_jsonc="auto")

AC_ARG_ENABLE(json,
[ --enable-json=[yes/no] Enable JSON support (default: yes)]
,[if test "x$enableval" != "xno"; then with_jsonc="system"; else with_jsonc="no"; fi],)

AC_ARG_ENABLE(amqp,
[ --enable-amqp Enable amqp destination (default: auto)]
,,enable_amqp="auto")
Expand All @@ -182,10 +191,6 @@ AC_ARG_WITH(ivykis,
Link against the system supplied or the built-in ivykis library.]
,,with_ivykis="internal")

AC_ARG_ENABLE(json,
[ --disable-json Disable JSON support (default: auto)]
,,enable_json="auto")

AC_ARG_ENABLE(smtp,
[ --disable-smtp Disable SMTP support (default: auto)]
,,enable_smtp="auto")
Expand Down Expand Up @@ -695,23 +700,6 @@ if test "x$linking_mode" != "xdynamic" -a "x$blb_cv_static_glib" = "xno"; then
AC_MSG_ERROR([static GLib libraries not found (a file named libglib-2.0.a), either link GLib dynamically using the --enable-dynamic-linking or install a static GLib])
fi

dnl ***************************************************************************
dnl json headers/libraries
dnl ***************************************************************************
if test "x$enable_json" = "xyes" || test "x$enable_json" = "xauto"; then
_with_json="yes"
PKG_CHECK_MODULES(JSON_C, json-c >= $JSON_C_MIN_VERSION,, [JSON_C_LIBS=""; _with_json="no"])
if test "x$_with_json" = "xno"; then
_with_json="yes"
PKG_CHECK_MODULES(JSON_C, json >= $JSON_C_MIN_VERSION,, [JSON_C_LIBS=""; _with_json="no"])
fi

if test "x$enable_json" = "xyes" && test "x$_with_json" = "xno"; then
AC_MSG_ERROR([Could not find json-c, and json support was explicitly enabled.])
fi
enable_json="$_with_json"
fi

dnl ***************************************************************************
dnl geoip headers/libraries
dnl ***************************************************************************
Expand Down Expand Up @@ -866,10 +854,43 @@ else
IVYKIS_NO_LIBTOOL_LIBS="$IVYKIS_LIBS"
fi

dnl ***************************************************************************
dnl json headers/libraries
dnl ***************************************************************************

enable_json="no"

if test "x$with_jsonc" = "xsystem" -o "x$with_jsonc" = "xauto"; then
enable_json="yes"
PKG_CHECK_EXISTS(json-c, json_module_name="json-c",
PKG_CHECK_EXISTS(json, json_module_name="json"))
PKG_CHECK_MODULES(JSON, $json_module_name >= $JSON_C_MIN_VERSION,[with_jsonc="system"], [JSON_LIBS=""; enable_json="no"])
if test "x$with_jsonc" = "xsystem" -a "x$enable_json" = "xno"; then
AC_MSG_ERROR([json-c library development files cannot be not found on system!])
fi
fi
if test "x$with_jsonc" = "xinternal" -o "x$with_jsonc" = "xauto"; then
AC_MSG_CHECKING(for JSON)
if test -f "$srcdir/lib/jsonc/json.h"; then
AC_CONFIG_SUBDIRS([lib/jsonc])
JSON_LIBS="\$(top_builddir)/lib/jsonc/libjson-c.la"
JSON_DEPENDENCY="$JSON_LIBS"
JSON_CFLAGS="-I\$(top_srcdir)/lib/jsonc -I\$(top_builddir)/lib/jsonc"
JSON_SUBDIRS="lib/jsonc"
enable_json="yes"
with_jsonc="internal"
else
AC_MSG_WARN([Internal jsonc sources not found in lib/jsonc])
enable_json="no"
fi
AC_MSG_RESULT($enable_json)
fi

dnl ***************************************************************************
dnl libmongo headers/libraries
dnl ***************************************************************************


if test "x$with_libmongo_client" = "xinternal"; then
if test -f "$srcdir/modules/afmongodb/libmongo-client/src/mongo.h"; then
AC_CONFIG_SUBDIRS([modules/afmongodb/libmongo-client])
Expand Down Expand Up @@ -1061,12 +1082,6 @@ if test "x$enable_amqp" = "xauto"; then
AC_MSG_RESULT([$enable_amqp])
fi

if test "x$enable_json" != "xno"; then
JSON_LIBS=$JSON_C_LIBS
JSON_CFLAGS=$JSON_C_CFLAGS
enable_json="yes"
fi

if test "x$enable_systemd" = "xauto"; then
if test "$ostype" = "Linux" -a "$blb_cv_c_so_acceptconn" = "yes"; then
enable_systemd=yes
Expand Down Expand Up @@ -1252,6 +1267,7 @@ AM_CONDITIONAL(ENABLE_GEOIP, [test "$enable_geoip" = "yes"])
AM_CONDITIONAL(ENABLE_REDIS, [test "$enable_redis" = "yes"])
AM_CONDITIONAL(WITH_EMBEDDED_CRYPTO, [test "$with_embedded_crypto" = "yes"])
AM_CONDITIONAL(IVYKIS_INTERNAL, [test "x$IVYKIS_SUBDIRS" != "x"])
AM_CONDITIONAL(JSON_INTERNAL, [test "x$JSON_SUBDIRS" != "x"])
AM_CONDITIONAL(LIBMONGO_INTERNAL, [test "x$LIBMONGO_SUBDIRS" != "x"])
AM_CONDITIONAL(LIBRABBITMQ_INTERNAL, [test "x$LIBRABBITMQ_SUBDIRS" != "x"])
AM_CONDITIONAL(ENABLE_MAN_PAGES, [test "x$enable_man_pages" = "xyes"])
Expand Down Expand Up @@ -1292,6 +1308,8 @@ AC_SUBST(LIBRABBITMQ_CFLAGS)
AC_SUBST(LIBRABBITMQ_SUBDIRS)
AC_SUBST(JSON_LIBS)
AC_SUBST(JSON_CFLAGS)
AC_SUBST(JSON_SUBDIRS)
AC_SUBST(JSON_DEPENDENCY)
AC_SUBST(IVYKIS_SUBDIRS)
AC_SUBST(RESOLV_LIBS)
AC_SUBST(CFLAGS_NOWARN_POINTER_SIGN)
Expand Down Expand Up @@ -1325,6 +1343,7 @@ echo " Submodules:"
echo " ivykis : $with_ivykis"
echo " libmongo-client : $with_libmongo_client"
echo " librabbitmq : $with_librabbitmq_client"
echo " jsonc : $with_jsonc"
echo " Features:"
echo " Debug symbols : ${enable_debug:=no}"
echo " GCC profiling : ${enable_gprof:=no}"
Expand Down
13 changes: 12 additions & 1 deletion lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ lib/ivykis/src/libivykis.la:
CLEAN_SUBDIRS += @IVYKIS_SUBDIRS@
endif

if JSON_INTERNAL
lib/jsonc/libjson-c.la:
${MAKE} -C lib/jsonc

CLEAN_SUBDIRS += @JSON_SUBDIRS@
endif

# this is intentionally formatted so conflicts are less likely to arise. one name in every line.
pkginclude_HEADERS += \
lib/afinter.h \
Expand Down Expand Up @@ -217,6 +224,10 @@ if IVYKIS_INTERNAL
lib/ivykis/ ivykis: lib/ivykis/src/libivykis.la
endif

.PHONY: lib/ libsyslog-ng ivykis lib/ivykis/
if JSON_INTERNAL
lib/jsonc/ jsonc: lib/jsonc/libjson-c.la
endif

.PHONY: lib/ libsyslog-ng ivykis lib/ivykis/ lib/jsonc/ jsonc

include lib/tests/Makefile.am
1 change: 1 addition & 0 deletions lib/jsonc
Submodule jsonc added at 064502
3 changes: 2 additions & 1 deletion modules/json/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ modules_json_libjson_plugin_la_CFLAGS = \
$(JSON_CFLAGS)
modules_json_libjson_plugin_la_LIBADD = \
$(MODULE_DEPS_LIBS) $(JSON_LIBS)

modules_json_libjson_plugin_la_LDFLAGS = \
$(MODULE_LDFLAGS)
modules_json_libjson_plugin_la_DEPENDENCIES = \
$(MODULE_DEPS_LIBS)
$(MODULE_DEPS_LIBS) $(JSON_DEPENDENCY)

modules/json modules/json/ mod-json: modules/json/libjson-plugin.la
else
Expand Down
2 changes: 1 addition & 1 deletion modules/json/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ modules_json_tests_test_json_parser_LDFLAGS = \
modules_json_tests_test_json_parser_DEPENDENCIES = $(top_builddir)/modules/json/libjson-plugin.la

modules_json_tests_test_dot_notation_CFLAGS = $(TEST_CFLAGS) $(JSON_CFLAGS) -I$(top_srcdir)/modules/json
modules_json_tests_test_dot_notation_LDADD = $(TEST_LDADD) $(JSON_C_LIBS)
modules_json_tests_test_dot_notation_LDADD = $(TEST_LDADD) $(JSON_LIBS)
modules_json_tests_test_dot_notation_LDFLAGS = \
$(PREOPEN_SYSLOGFORMAT) \
-dlpreopen $(top_builddir)/modules/json/libjson-plugin.la
Expand Down

0 comments on commit 6104588

Please sign in to comment.