Skip to content
Myr

Add local oniguruma submodule

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Configure should still allow use of prebuilt onigurumas (whether system-installed or in a special prefix). If these are not found, and configure was not called with `--without-oniguruma`, then use the vendored oniguruma module. If configure was called with `--without-oniguruma`, then we do not build regex functionality into jq.

authored by Erik Brinkman · committed by William Langford · parent 9b21790 · Browse files · 6 files+55 added−37 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

6 files+55 added−37 removed

  • other:+55 added−37 removed

6 files+55 added−37 removed

added:modules/onigurumanot shown

Its text is not shown, added.

modified:src/builtin.c+4 added-4 removed
27 unmodified lines
28#include <assert.h>29#include <ctype.h>30#include <limits.h>31#include <math.h>32#ifdef HAVE_ONIGURUMA32#ifdef HAVE_LIBONIG33#include <oniguruma.h>34#endif35#include <string.h>36#include <time.h>
659 unmodified lines
696 return type_error2(input, keys, "cannot be sorted, as they are not both arrays");697 }698}699700#ifdef HAVE_ONIGURUMA700#ifdef HAVE_LIBONIG701static int f_match_name_iter(const UChar* name, const UChar *name_end, int ngroups,702 int *groups, regex_t *reg, void *arg) {703 jv captures = *(jv*)arg;704 for (int i = 0; i < ngroups; ++i) {
195 unmodified lines
900 jv_free(input);901 jv_free(regex);902 return result;903}904#else /* ! HAVE_ONIGURUMA */904#else /* !HAVE_LIBONIG */905static jv f_match(jq_state *jq, jv input, jv regex, jv modifiers, jv testmode) {906 return jv_invalid_with_msg(jv_string("jq was compiled without ONIGURUMA regex libary. match/test/sub and related functions are not available."));907}908#endif /* HAVE_ONIGURUMA */908#endif /* HAVE_LIBONIG */909910static jv minmax_by(jv values, jv keys, int is_min) {911 if (jv_get_kind(values) != JV_KIND_ARRAY)912 return type_error2(values, keys, "cannot be iterated over");
634 unmodified lines
added:.gitmodules+3 added
1[submodule "modules/oniguruma"]2 path = modules/oniguruma3 url = https://github.com/kkos/oniguruma.git
modified:.travis.yml+3 added-3 removed
modified:configure.ac+35 added-29 removed
42 unmodified lines
43 LEX="$SHELL $missing_dir/missing flex"44 fi45fi464748##########################################################################49# check for ONIGURUMA library50##########################################################################5152AC_ARG_WITH([oniguruma],53 [AS_HELP_STRING([--with-oniguruma=prefix],54 [try this for a non-standard install prefix of the oniguruma library])],55 [],56 [with_oniguruma=yes])5758AS_IF([test "x$with_oniguruma" != xno], [59 AS_IF([test "x$with_oniguruma" != xyes], [60 CFLAGS="$CFLAGS -I${with_oniguruma}/include"61 LDFLAGS="$LDFLAGS -L${with_oniguruma}/lib"62 ])63 # check for ONIGURUMA library64 have_oniguruma=065 AC_CHECK_HEADER("oniguruma.h",66 AC_CHECK_LIB([onig],[onig_version],[LIBS="$LIBS -lonig"; have_oniguruma=1;]))67 # handle check results68 AS_IF([test $have_oniguruma = 1], [69 AC_DEFINE([HAVE_ONIGURUMA], 1, [Define to 1 if Oniguruma is installed])70 ], [71 AC_MSG_NOTICE([Oniguruma was not found.])72 AC_MSG_NOTICE([Try setting the location using '--with-oniguruma=PREFIX'])73 ])74])7547dnl Check for valgrind48AC_CHECK_PROGS(valgrind_cmd, valgrind)49if test "x$valgrind_cmd" = "x" ; then50 AC_MSG_WARN([valgrind is required to test jq.])
173 unmodified lines
224 AC_MSG_ERROR(unknown endianess),225 AC_MSG_ERROR(universial endianess not supported)226)227228dnl Oniguruma229AC_ARG_WITH([oniguruma],230 [AS_HELP_STRING([--with-oniguruma=prefix],231 [try this for a non-standard install prefix of the oniguruma library])], ,232 [with_oniguruma=yes])233234build_oniguruma=no235AS_IF([test "x$with_oniguruma" != xno], [236 save_CFLAGS="$CFLAGS"237 save_LDFLAGS="$LDFLAGS"238 AS_IF([test "x$with_oniguruma" != xyes], [239 onig_CFLAGS="-I${with_oniguruma}/include"240 onig_LDFLAGS="-L${with_oniguruma}/lib"241 CFLAGS="$CFLAGS $onig_CFLAGS"242 LDFLAGS="$LDFLAGS $onig_LDFLAGS"243 ])244 # check for ONIGURUMA library245 AC_CHECK_HEADER("oniguruma.h",246 AC_CHECK_LIB([onig],[onig_version]))247 CFLAGS="$save_CFLAGS"248 LDFLAGS="$save_LDFLAGS"249250 # handle check results251 AS_IF([test "x$ac_cv_lib_onig_onig_version" != "xyes"], [252 onig_CFLAGS="-I${srcdir}/modules/oniguruma/src"253 onig_LDFLAGS=254 AC_CONFIG_SUBDIRS([modules/oniguruma])255 build_oniguruma=yes256 AC_MSG_NOTICE([Oniguruma was not found. Will use the packaged oniguruma.])257 ])258 AC_SUBST(onig_CFLAGS)259 AC_SUBST(onig_LDFLAGS)260])261262AM_CONDITIONAL([BUILD_ONIGURUMA], [test "x$build_oniguruma" = xyes])263AC_SUBST([BUNDLER], ["$bundle_cmd"])264265AC_CONFIG_MACRO_DIR([config/m4])266AC_CONFIG_FILES([Makefile])
2 unmodified lines
modified:Makefile.am+10 added-1 removed
46 unmodified lines
4748lib_LTLIBRARIES = libjq.la49libjq_la_SOURCES = ${LIBJQ_SRC}50libjq_la_LIBADD = -lm51libjq_la_LDFLAGS = -export-symbols-regex '^j[qv]_' -version-info 1:4:051libjq_la_LDFLAGS = $(onig_LDFLAGS) -export-symbols-regex '^j[qv]_' -version-info 1:4:05253if WIN3254libjq_la_LIBADD += -lshlwapi55endif
76 unmodified lines
132 $(AM_V_GEN) cp $^ $@133endif134135136### Build oniguruma137138if BUILD_ONIGURUMA139libjq_la_LIBADD += modules/oniguruma/src/.libs/libonig.la140SUBDIRS = modules/oniguruma141endif142143AM_CFLAGS += $(onig_CFLAGS)144145### Packaging146147docs/site.yml: configure.ac148 sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new
56 unmodified lines