From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#39953: 27.0.50; [PATCH] explicitly fail if Emacs was configured with but cannot compile native JSON support Date: Sat, 11 Apr 2020 09:47:34 -0400 Message-ID: <87blny3zih.fsf@gmail.com> References: <83sgilpjpl.fsf@gnu.org> <87v9nd6jo4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="84631"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.90 (gnu/linux) Cc: =?UTF-8?Q?St=C3=A9phane?= Maniaci , 39953@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Apr 11 15:48:15 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNGUW-000Lru-Sa for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Apr 2020 15:48:12 +0200 Original-Received: from localhost ([::1]:52134 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNGUV-0001QW-VX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Apr 2020 09:48:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36697) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNGUN-0001QH-6A for bug-gnu-emacs@gnu.org; Sat, 11 Apr 2020 09:48:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNGUL-0002zT-Rj for bug-gnu-emacs@gnu.org; Sat, 11 Apr 2020 09:48:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNGUL-0002zP-OW for bug-gnu-emacs@gnu.org; Sat, 11 Apr 2020 09:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNGUL-0007vS-Mb for bug-gnu-emacs@gnu.org; Sat, 11 Apr 2020 09:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Apr 2020 13:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39953 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 39953-submit@debbugs.gnu.org id=B39953.158661287130449 (code B ref 39953); Sat, 11 Apr 2020 13:48:01 +0000 Original-Received: (at 39953) by debbugs.gnu.org; 11 Apr 2020 13:47:51 +0000 Original-Received: from localhost ([127.0.0.1]:56234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNGUB-0007v3-7l for submit@debbugs.gnu.org; Sat, 11 Apr 2020 09:47:51 -0400 Original-Received: from mail-qk1-f193.google.com ([209.85.222.193]:40657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNGU8-0007uj-5k for 39953@debbugs.gnu.org; Sat, 11 Apr 2020 09:47:50 -0400 Original-Received: by mail-qk1-f193.google.com with SMTP id w70so695443qkb.7 for <39953@debbugs.gnu.org>; Sat, 11 Apr 2020 06:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=n2xsIlhYF9a67IN1l+QBd0NPu4/Bm6A/6ORFGfiPHOo=; b=l641pIb2huK/AKJFBLx+b9Wxmpb5TcR/CKRDdUAw+HqBCwCJ+rZe+d+HcgjF304EyO p4nwXYhZ2fbyuP0Biu+pIwn5oXSfGzVsvIr4pDuo14N6sXreL5WYScTL+c87dboRgacW sFBGnXym+rkYjr9I30iV/m9TsWotxGEFhwXn6ePZdZGj7R4nWtdW/+Nlh56OcfJE9qMr Zd+CcDKseLs7+h/s3lp0FVwk1QMrEC5PXYPkAixBG/MtYiq1R3Lv3TWi/CYT5zSP5ylt niEvstzLIRGRcE1KIggyZ20QwFoD9K0xb9RKOjGy/2LondHv7UaIlYvvygUJfy1LiyOw fQhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=n2xsIlhYF9a67IN1l+QBd0NPu4/Bm6A/6ORFGfiPHOo=; b=nAB2qdvs5G669ZjjSLQtDb7n8KQ+mM2etthdjKeMWObipxPhUhViiM1oTf0G68jtjh +ZWTRXrxTqjrhSvYtSvFvkw+Hc4TdPA6wC+l4ObUleC7STQIF7M1+Ayu6hVwn42dN3d8 Z7MdiApylXQMUca+VKdeRgCarvN7aCT/VdFnkwDa7KoQ/OwBfn/4SxwYAinzUMtq7uJJ FOjTFlHdwL+fVIzAnCAHkSBGsVhYWAgfVAy3lJNTsHjfkrwTjoZT+WINIVsDJz2XOF8Z DyhOmCuBZfzJR071u30dHDZ3mKjUmG6UCi5uXtslo64gJC9jX8a3vzq4/5O0/MOqNPq6 hVfg== X-Gm-Message-State: AGi0PuaSdSeIjN6K9xcTAP4CvCUhMV0EAFVeRJUCXZZQSZAFuSBnTAYK 3odS9uA9IPki8VLU0TzCtDVB5ot5 X-Google-Smtp-Source: APiQypKKipYxemJ2mtay4aqI+0ckt8DlI+aMTEi0eAtBVvaVoCXKwd0rr06Dje80QkNW8rtFT4w1Jg== X-Received: by 2002:a37:65c3:: with SMTP id z186mr8316630qkb.484.1586612862423; Sat, 11 Apr 2020 06:47:42 -0700 (PDT) Original-Received: from minid (cbl-45-2-119-47.yyz.frontiernetworks.ca. [45.2.119.47]) by smtp.gmail.com with ESMTPSA id n92sm3841566qtd.68.2020.04.11.06.47.41 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 11 Apr 2020 06:47:41 -0700 (PDT) In-Reply-To: <87v9nd6jo4.fsf@gmail.com> (Noam Postavsky's message of "Mon, 09 Mar 2020 22:14:03 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178203 Archived-At: --=-=-= Content-Type: text/plain Noam Postavsky writes: >>> This patch explicitly fails ./configure if `--with-json' is passed but >>> cannot be fulfilled. Which means users without the Jansson headers >>> won't be able to compile Emacs unless explicitly disabling it with >>> `--without-json'; I don't know if that is too extreme, > > This seems a bit too extreme to me, but I think giving an error on > missing Jansson headers only if --with-json is explicitly passed would > be okay. I was reminded about this from some reddit posts: https://old.reddit.com/r/emacs/comments/fwgpkd/weekly_tipstricketc_thread/fmo9d5v/ Here's a proposed patch implementing my suggestion above. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-with-json-imply-than-jansson-support-is-mandato.patch Content-Description: patch >From 7161e9ae2e55d2624ec60d33a467af6d9960d6bb Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 11 Apr 2020 09:33:20 -0400 Subject: [PATCH] Make --with-json imply than jansson support is mandatory (Bug#39953) Currently, it is easy to miss that jansson support was not included, since configure succeeds if the jansson development files (headers, etc) are missing. Failing when jansson is missing by default would be a bit extreme, so this is a compromise; we only fail if --with-json was explicitly passed. * configure.ac (OPTION_DEFAULT_IFAVAILABLE): New macro. Use it to define the --with-json option. Add with_json and HAVE_JSON to the 'MISSING' checks. --- configure.ac | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 73243001ba..f4b01e833b 100644 --- a/configure.ac +++ b/configure.ac @@ -219,6 +219,21 @@ AC_DEFUN m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=no])dnl ])dnl +dnl OPTION_DEFAULT_IFAVAILABLE(NAME, HELP-STRING) +dnl Create a new --with option that defaults to 'ifavailable'. +dnl NAME is the base name of the option. The shell variable with_NAME +dnl will be set to either the user's value (if the option is +dnl specified; 'yes' for a plain --with-NAME) or to 'ifavailable' (if the +dnl option is not specified). Note that the shell variable name is +dnl constructed as autoconf does, by replacing non-alphanumeric +dnl characters with "_". +dnl HELP-STRING is the help text for the option. +AC_DEFUN([OPTION_DEFAULT_IFAVAILABLE], [dnl + AC_ARG_WITH([$1],[AS_HELP_STRING([--with-$1],[$2])],[],[dnl + m4_bpatsubst([with_$1], [[^0-9a-z]], [_])=ifavailable])dnl +])dnl + + dnl OPTION_DEFAULT_ON(NAME, HELP-STRING) dnl Create a new --with option that defaults to $with_features. dnl NAME is the base name of the option. The shell variable with_NAME @@ -433,7 +448,7 @@ AC_DEFUN OPTION_DEFAULT_OFF([cairo],[compile with Cairo drawing]) OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support]) OPTION_DEFAULT_OFF([imagemagick],[compile with ImageMagick image support]) -OPTION_DEFAULT_ON([json], [don't compile with native JSON support]) +OPTION_DEFAULT_IFAVAILABLE([json], [don't compile with native JSON support]) OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts]) OPTION_DEFAULT_ON([harfbuzz],[don't use HarfBuzz for text shaping]) @@ -2950,7 +2965,7 @@ AC_DEFUN HAVE_JSON=no JSON_OBJ= -if test "${with_json}" = yes; then +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 @@ -3893,6 +3908,11 @@ AC_DEFUN *) 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 if test "X${MISSING}" != X; then AC_MSG_ERROR([The following required libraries were not found: $MISSING -- 2.11.0 --=-=-=--