From 1135ce461d188869e0294af45641edc2cbfacbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Sat, 30 Mar 2024 15:13:24 +0100 Subject: [PATCH] Always enable native JSON support and remove Jansson references * src/json.c (Fjson__available_p): Remove. * lisp/subr.el (json-available-p): Always return t. * admin/nt/dist-build/build-dep-zips.py: * configure.ac: * doc/lispref/text.texi (Parsing JSON): * java/INSTALL: * java/org/gnu/emacs/EmacsNative.java (EmacsNative): * lisp/term/w32-win.el (dynamic-library-alist): * m4/ndk-build.m4 (ndk_INIT): * msdos/sed1v2.inp: * nt/INSTALL: * nt/INSTALL.W64: * src/Makefile.in: * src/emacs.c (main): * src/lisp.h: Remove JSON configuration options and references to it and Jansson from documentation and build files. * etc/NEWS: Announce. --- admin/nt/dist-build/build-dep-zips.py | 2 -- configure.ac | 32 +-------------------------- doc/lispref/text.texi | 14 ++++-------- etc/NEWS | 6 +++++ java/INSTALL | 8 ------- java/org/gnu/emacs/EmacsNative.java | 2 +- lisp/subr.el | 5 ++--- lisp/term/w32-win.el | 1 - m4/ndk-build.m4 | 2 +- msdos/sed1v2.inp | 3 --- nt/INSTALL | 8 ------- nt/INSTALL.W64 | 1 - src/Makefile.in | 10 +++------ src/emacs.c | 3 --- src/json.c | 9 -------- src/lisp.h | 2 -- 16 files changed, 18 insertions(+), 90 deletions(-) diff --git a/admin/nt/dist-build/build-dep-zips.py b/admin/nt/dist-build/build-dep-zips.py index fb0aca87731..0b1cc4d8695 100755 --- a/admin/nt/dist-build/build-dep-zips.py +++ b/admin/nt/dist-build/build-dep-zips.py @@ -32,7 +32,6 @@ EMACS_MAJOR_VERSION="28" PKG_REQ='''mingw-w64-x86_64-giflib mingw-w64-x86_64-gnutls mingw-w64-x86_64-harfbuzz -mingw-w64-x86_64-jansson mingw-w64-x86_64-lcms2 mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libpng @@ -44,7 +43,6 @@ mingw-w64-x86_64-xpm-nox'''.split() DLL_REQ='''libgif libgnutls libharfbuzz -libjansson liblcms2 libturbojpeg libpng diff --git a/configure.ac b/configure.ac index bd678ea52a3..b1dbaa13155 100644 --- a/configure.ac +++ b/configure.ac @@ -548,7 +548,6 @@ OPTION_DEFAULT_OFF([cairo-xcb], [use XCB surfaces for Cairo support]) OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support]) OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support]) OPTION_DEFAULT_ON([native-image-api], [don't use native image APIs (GDI+ on Windows)]) -OPTION_DEFAULT_IFAVAILABLE([json], [compile with native JSON support]) OPTION_DEFAULT_IFAVAILABLE([tree-sitter], [compile with tree-sitter]) OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts]) @@ -1216,7 +1215,6 @@ package will likely install on older systems but crash on startup.]) passthrough="$passthrough --with-png=$with_png" passthrough="$passthrough --with-webp=$with_webp" passthrough="$passthrough --with-gif=$with_gif" - passthrough="$passthrough --with-json=$with_json" passthrough="$passthrough --with-jpeg=$with_jpeg" passthrough="$passthrough --with-xml2=$with_xml2" passthrough="$passthrough --with-sqlite3=$with_sqlite3" @@ -1305,7 +1303,6 @@ if test "$ANDROID" = "yes"; then with_png=no with_webp=no with_gif=no - with_json=no with_jpeg=no with_xml2=no with_sqlite3=no @@ -4005,27 +4002,6 @@ fi AC_SUBST([LIBSYSTEMD_LIBS]) AC_SUBST([LIBSYSTEMD_CFLAGS]) -HAVE_JSON=no -JSON_OBJ= - -if test "${with_json}" != no; then - EMACS_CHECK_MODULES([JSON], [jansson >= 2.7], - [HAVE_JSON=yes], [HAVE_JSON=no]) - if test "${HAVE_JSON}" = yes; then - AC_DEFINE([HAVE_JSON], [1], [Define if using Jansson.]) - JSON_OBJ=json.o - fi - - # Windows loads libjansson dynamically - if test "${opsys}" = "mingw32"; then - JSON_LIBS= - fi -fi - -AC_SUBST([JSON_LIBS]) -AC_SUBST([JSON_CFLAGS]) -AC_SUBST([JSON_OBJ]) - HAVE_TREE_SITTER=no TREE_SITTER_OBJ= NEED_DYNLIB=no @@ -5470,11 +5446,6 @@ case $with_gnutls,$HAVE_GNUTLS in *) MISSING="$MISSING gnutls" WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gnutls=ifavailable";; esac -case $with_json,$HAVE_JSON in - no,* | ifavailable,* | *,yes) ;; - *) MISSING="$MISSING json" - WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-json=ifavailable";; -esac case $with_tree_sitter,$HAVE_TREE_SITTER in no,* | ifavailable,* | *,yes) ;; *) MISSING="$MISSING tree-sitter" @@ -7655,7 +7626,7 @@ Configured for '${canonical}'. optsep= emacs_config_features= for opt in ACL BE_APP CAIRO DBUS FREETYPE GCONF GIF GLIB GMP GNUTLS GPM GSETTINGS \ - HARFBUZZ IMAGEMAGICK JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \ + HARFBUZZ IMAGEMAGICK JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 \ M17N_FLT MODULES NATIVE_COMP NOTIFY NS OLDXMENU PDUMPER PGTK PNG RSVG SECCOMP \ SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER \ UNEXEC WEBP X11 XAW3D XDBE XFT XIM XINPUT2 XPM XWIDGETS X_TOOLKIT \ @@ -7731,7 +7702,6 @@ AS_ECHO([" Does Emacs use -lXaw3d? ${HAVE_XAW3D Does Emacs use -lotf? ${HAVE_LIBOTF} Does Emacs use -lxft? ${HAVE_XFT} Does Emacs use -lsystemd? ${HAVE_LIBSYSTEMD} - Does Emacs use -ljansson? ${HAVE_JSON} Does Emacs use -ltree-sitter? ${HAVE_TREE_SITTER} Does Emacs use the GMP library? ${HAVE_GMP} Does Emacs directly use zlib? ${HAVE_ZLIB} diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 3d14a5ad8be..90e2c6ce882 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi @@ -5752,10 +5752,10 @@ non-@code{nil}, indent the @acronym{HTML}/@acronym{XML} logically. @cindex JSON @cindex JavaScript Object Notation - When Emacs is compiled with @acronym{JSON} (@dfn{JavaScript Object -Notation}) support, it provides several functions to convert -between Lisp objects and JSON values. Any JSON value can be converted -to a Lisp object, but not vice versa. Specifically: + The Emacs @acronym{JSON} (@dfn{JavaScript Object Notation}) support +provides several functions to convert between Lisp objects and JSON +values. Any JSON value can be converted to a Lisp object, but not vice +versa. Specifically: @itemize @item @@ -5790,12 +5790,6 @@ represents @code{@{@}}, the empty JSON object; not @code{null}, @code{false}, or an empty array, all of which are different JSON values. -@defun json-available-p -This predicate returns non-@code{nil} if Emacs has been built with -@acronym{JSON} support, and the library is available on the current -system. -@end defun - If some Lisp object can't be represented in JSON, the serialization functions will signal an error of type @code{wrong-type-argument}. The parsing functions can also signal the following errors: diff --git a/etc/NEWS b/etc/NEWS index feb128bc2de..8ccf04276f6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -43,6 +43,12 @@ external packages and to resolve potential incompatibilities between Linux and BSD versions of ALSA. Use '--with-sound=alsa' to build with ALSA on these operating systems instead. +--- +** Native JSON support is now always available; libjansson is no longer used. +No external library is required. The '--with-json' configure option has +been removed. 'json-available-p' now always returns non-nil and is only +kept for compatibility. + * Startup Changes in Emacs 30.1 diff --git a/java/INSTALL b/java/INSTALL index f1063b40c25..6daef59084e 100644 --- a/java/INSTALL +++ b/java/INSTALL @@ -307,14 +307,6 @@ Many of these dependencies have been migrated over to the However, the old ``Android.mk'' Makefiles are still present in older branches, and can be easily adapted to newer versions. -In addition, some Emacs dependencies provide `ndk-build' support -themselves: - - libjansson - https://github.com/akheron/jansson - (You must add LOCAL_EXPORT_INCLUDES := $(LOCAL_C_INCLUDES) before - its Android.mk includes $(BUILD_SHARED_LIBRARY), then copy - android/jansson_config.h to android/jansson_private_config.h.) - Emacs developers have ported the following dependencies to ARM Android systems: diff --git a/java/org/gnu/emacs/EmacsNative.java b/java/org/gnu/emacs/EmacsNative.java index 654e94b1a7d..24440bd5953 100644 --- a/java/org/gnu/emacs/EmacsNative.java +++ b/java/org/gnu/emacs/EmacsNative.java @@ -337,7 +337,7 @@ public final class EmacsNative "gnutls_emacs", "gmp_emacs", "nettle_emacs", "p11-kit_emacs", "tasn1_emacs", "hogweed_emacs", - "jansson_emacs", "jpeg_emacs", + "jpeg_emacs", "tiff_emacs", "xml2_emacs", "icuuc_emacs", "harfbuzz_emacs", "tree-sitter_emacs", }; diff --git a/lisp/subr.el b/lisp/subr.el index 90dbfc75d52..50487e2c734 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -7346,9 +7346,8 @@ sentence (see Info node `(elisp) Documentation Tips')." (internal--fill-string-single-line (apply #'format string objects))) (defun json-available-p () - "Return non-nil if Emacs has libjansson support." - (and (fboundp 'json--available-p) - (json--available-p))) + "Return non-nil if Emacs has native JSON support." + t) (defun ensure-list (object) "Return OBJECT as a list. diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 9b696475c34..3c0acf368f4 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el @@ -288,7 +288,6 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") '(libxml2 "libxml2-2.dll" "libxml2.dll") '(zlib "zlib1.dll" "libz-1.dll") '(lcms2 "liblcms2-2.dll") - '(json "libjansson-4.dll") '(gccjit "libgccjit-0.dll") ;; MSYS2 distributes libtree-sitter.dll, without API version ;; number... diff --git a/m4/ndk-build.m4 b/m4/ndk-build.m4 index 7012471e046..abe06063ab0 100644 --- a/m4/ndk-build.m4 +++ b/m4/ndk-build.m4 @@ -69,7 +69,7 @@ AS_CASE(["$ndk_ABI"], # This is a map between pkg-config style package names and Android # ones. -ndk_package_map="libwebpdemux:webpdemux libxml-2.0:libxml2 jansson:libjansson" +ndk_package_map="libwebpdemux:webpdemux libxml-2.0:libxml2" ndk_package_map="$ndk_package_map sqlite3:libsqlite_static_minimal" ndk_package_map="$ndk_package_map MagickWand:libmagickwand-7 lcms2:liblcms2" diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp index 632c45a16b6..da056067548 100644 --- a/msdos/sed1v2.inp +++ b/msdos/sed1v2.inp @@ -175,9 +175,6 @@ s/ *@WEBP_LIBS@// /^CANNOT_DUMP *=/s/@CANNOT_DUMP@/no/ /^W32_OBJ *=/s/@W32_OBJ@// /^W32_LIBS *=/s/@W32_LIBS@// -/^JSON_OBJ *=/s/@JSON_OBJ@// -/^JSON_CFLAGS *=/s/@JSON_CFLAGS@// -/^JSON_LIBS *=/s/@JSON_LIBS@// /^LIBGCCJIT_OBJ *=/s/@LIBGCCJIT_OBJ@// /^LIBGCCJIT_CFLAGS *=/s/@LIBGCCJIT_CFLAGS@// /^LIBGCCJIT_LIBS *=/s/@LIBGCCJIT_LIBS@// diff --git a/nt/INSTALL b/nt/INSTALL index 77626f8a343..6167365169b 100644 --- a/nt/INSTALL +++ b/nt/INSTALL @@ -508,7 +508,6 @@ build should run on Windows 9X and newer systems). Does Emacs use -lotf? no Does Emacs use -lxft? no Does Emacs use -lsystemd? no - Does Emacs use -ljansson? yes Does Emacs use the GMP library? yes Does Emacs directly use zlib? yes Does Emacs have dynamic modules support? yes @@ -830,13 +829,6 @@ build should run on Windows 9X and newer systems). Prebuilt binaries of lcms2 DLL (for 32-bit builds of Emacs) are available from the ezwinports site and from the MSYS2 project. -* Optional support for JSON - - Emacs can provide built-in support for JSON parsing and - serialization using the libjansson library. Prebuilt binaries of - the libjansson DLL (for 32-bit builds of Emacs) are available from - the ezwinports site and from the MSYS2 project. - * Optional support for HarfBuzzz shaping library Emacs supports display of complex scripts and Arabic shaping. The diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64 index 2aa05ea0062..d25fc2e18af 100644 --- a/nt/INSTALL.W64 +++ b/nt/INSTALL.W64 @@ -55,7 +55,6 @@ packages (you can copy and paste it into the shell with Shift + Insert): mingw-w64-x86_64-librsvg \ mingw-w64-x86_64-libwebp \ mingw-w64-x86_64-lcms2 \ - mingw-w64-x86_64-jansson \ mingw-w64-x86_64-libxml2 \ mingw-w64-x86_64-zlib \ mingw-w64-x86_64-harfbuzz \ diff --git a/src/Makefile.in b/src/Makefile.in index de45b2290f1..f58a3a7761e 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -361,10 +361,6 @@ LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -JSON_LIBS = @JSON_LIBS@ -JSON_CFLAGS = @JSON_CFLAGS@ -JSON_OBJ = @JSON_OBJ@ - TREE_SITTER_LIBS = @TREE_SITTER_LIBS@ TREE_SITTER_CFLAGS = @TREE_SITTER_CFLAGS@ @@ -438,7 +434,7 @@ EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ $(XINPUT_CFLAGS) $(WEBP_CFLAGS) $(WEBKIT_CFLAGS) $(LCMS2_CFLAGS) \ $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \ $(HARFBUZZ_CFLAGS) $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \ - $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) $(XSYNC_CFLAGS) $(TREE_SITTER_CFLAGS) \ + $(LIBSYSTEMD_CFLAGS) $(XSYNC_CFLAGS) $(TREE_SITTER_CFLAGS) \ $(LIBGNUTLS_CFLAGS) $(NOTIFY_CFLAGS) $(CAIRO_CFLAGS) \ $(WERROR_CFLAGS) $(HAIKU_CFLAGS) $(XCOMPOSITE_CFLAGS) $(XSHAPE_CFLAGS) \ $(ANDROID_BUILD_CFLAGS) $(GIF_CFLAGS) $(JPEG_CFLAGS) $(SQLITE3_CFLAGS) \ @@ -479,7 +475,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ itree.o \ $(if $(HYBRID_MALLOC),sheap.o) \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ - $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) $(JSON_OBJ) \ + $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) \ $(HAIKU_OBJ) $(PGTK_OBJ) $(ANDROID_OBJ) doc_obj = $(base_obj) $(NS_OBJC_OBJ) obj = $(doc_obj) $(HAIKU_CXX_OBJ) @@ -604,7 +600,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(PGTK_LIBS) $(LIBX_BASE) $(LIBIMAGE $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(HARFBUZZ_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LCMS2_LIBS) \ $(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \ - $(JSON_LIBS) $(LIBGMP) $(LIBGCCJIT_LIBS) $(XINPUT_LIBS) $(HAIKU_LIBS) \ + $(LIBGMP) $(LIBGCCJIT_LIBS) $(XINPUT_LIBS) $(HAIKU_LIBS) \ $(TREE_SITTER_LIBS) $(SQLITE3_LIBS) $(XCOMPOSITE_LIBS) $(XSHAPE_LIBS) \ $(ANDROID_LIBS) diff --git a/src/emacs.c b/src/emacs.c index 4a34bb06425..1cb1e70ac65 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2475,10 +2475,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem syms_of_threads (); syms_of_profiler (); syms_of_pdumper (); - -#ifdef HAVE_JSON syms_of_json (); -#endif keys_of_keyboard (); diff --git a/src/json.c b/src/json.c index 5bc63069624..43b2d1cb4f8 100644 --- a/src/json.c +++ b/src/json.c @@ -98,14 +98,6 @@ json_parse_args (ptrdiff_t nargs, } } -/* FIXME: Remove completely. */ -DEFUN ("json--available-p", Fjson__available_p, Sjson__available_p, 0, 0, NULL, - doc: /* Return non-nil if libjansson is available (internal use only). */) - (void) -{ - return Qt; -} - /* JSON encoding context. */ typedef struct { char *buf; @@ -1966,7 +1958,6 @@ syms_of_json (void) DEFSYM (Qplist, "plist"); DEFSYM (Qarray, "array"); - defsubr (&Sjson__available_p); defsubr (&Sjson_serialize); defsubr (&Sjson_insert); defsubr (&Sjson_parse_string); diff --git a/src/lisp.h b/src/lisp.h index 7c4bd435cd8..43a29489a25 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -4325,10 +4325,8 @@ extern void init_fringe_once (void); extern int x_bitmap_mask (struct frame *, ptrdiff_t); extern void syms_of_image (void); -#ifdef HAVE_JSON /* Defined in json.c. */ extern void syms_of_json (void); -#endif /* Defined in insdel.c. */ extern void move_gap_both (ptrdiff_t, ptrdiff_t);