unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: What's the right way to detect libxml2?
Date: Tue, 24 Oct 2017 14:38:33 +0100	[thread overview]
Message-ID: <vz18tg0vf6u.fsf@gmail.com> (raw)
In-Reply-To: 7f80cde1944261b7ee29020ff953f14c.squirrel@cloud103.planethippo.com

On Sun 22 Oct 2017, Phillip Lord wrote:

> On Sun, October 22, 2017 2:14 pm, Clément Pit-Claudel wrote:
>> Hi emacs-devel,
>>
>>
>> In Flycheck we use ``libxml-parse-region`` if available, and fall back to
>
>> ``xml-parse-region`` otherwise.  We recently realized that our libxml
>> detection code was wrong, however.
>>
>> We used to write ``(if (fboundp 'libxml-parse-region)
>> (libxml-parse-region …) (xml-parse-region …))``, but this isn't
>> sufficient on Windows, where ``fboundp`` succeeds if Emacs was compiled
>> with libxml support, even if the appropriate DLL isn't installed on the
>> user's system.
>>
>> What's the proper way to autodetect libxml? We're thinking of doing this
>> instead::
>>
>>
>> (if (and (fboundp 'libxml-parse-region)
>> (with-temp-buffer
>> (insert "<xml/>")
>> (libxml-parse-region (point-min) (point-max))))
>> (libxml-parse-region …)
>> (xml-parse-region …))
>>
>>
>> Do we have better options?
>
> We need a better option, as it happens. I have the same problem when
> building the windows binary package. I've got no way of testing whether
> libxml (or any of the other DLLs) are present or work.

M-x list-dynamic-libraries shows the loaded DLLs, but you still need to
perform some work that causes the relevant libraries to loaded
beforehand.

For libxml2, try using (shr-render-buffer) on an HTML/XML buffer to get
the library loaded.

For some other libraries there are helpers:
  (gnutls-available-p)
  (image-type-available-p 'gif)
  (image-type-available-p 'imagemagick)
  (image-type-available-p 'jpeg)
  (image-type-available-p 'png)
  (image-type-available-p 'svg)
  (image-type-available-p 'tiff)
  (image-type-available-p 'xpm)
  (lcms2-available-p)
  (zlib-available-p)

Adding predicates for the remaining dynamic libraries would be useful.

    AndyM






  reply	other threads:[~2017-10-24 13:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-22 14:14 What's the right way to detect libxml2? Clément Pit-Claudel
2017-10-22 16:27 ` Phillip Lord
2017-10-24 13:38   ` Andy Moreton [this message]
2017-10-24 14:01     ` Clément Pit-Claudel
2017-10-24 15:33       ` Andy Moreton
2017-10-24 17:04         ` Robert Pluim
2017-10-24 17:46           ` Andy Moreton
2017-10-25 11:24             ` Robert Pluim
2017-10-28  9:10               ` Eli Zaretskii
2017-10-30  8:49                 ` Robert Pluim
2017-10-30 18:07                   ` Eli Zaretskii
2017-10-30 18:10                     ` Eli Zaretskii
2017-11-03  9:36                   ` Eli Zaretskii
2017-11-03 17:17                     ` Robert Pluim
2017-10-24 21:49     ` Richard Stallman
2017-10-24 22:32       ` John Wiegley
2017-10-25  1:45         ` Stefan Monnier
2017-10-25 22:05           ` Paul Eggert
2017-10-26  3:42           ` Richard Stallman
2017-10-25  4:39         ` Werner LEMBERG
2017-10-25  7:19       ` To Tramp or not to Tramp (was: What's the right way to detect libxml2?) Michael Albinus
2017-10-25 10:56         ` Kaushal Modi
2017-10-26  7:56         ` To Tramp or not to Tramp martin rudalics
2017-10-27  2:44           ` Richard Stallman
2017-10-27  4:01             ` John Wiegley
2017-10-27 20:58               ` Richard Stallman
2017-10-25 22:29       ` What's the right way to detect libxml2? Richard Copley
2017-10-26 10:48       ` Marcin Borkowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vz18tg0vf6u.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).