Re: Disabling Ghostscript support

Bob Friesenhahn <[email protected]> Fri, 24 Jul 2020 08:46:24 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Fri, 24 Jul 2020, Przemysław Sobala wrote:
>>
>
> Hmm... In configure.ac I can see that a test for Ghostscript presence is
> made for a binary not a library:
>
> PSDelegateDefault='gs'
> [...]
> *AC_PATH_PROG*(PSDelegate, "$PSDelegateDefault", "$PSDelegateDefault")
> [...]
> have_gs='no'      ; if test "$with_gs" = "yes" && test "$PSDelegate" !=
> "$PSDelegateDefault"; then have_gs='yes' ; fi
>
> and if I remove /usr/bin/gs from my system, ./configure reports:
>
> Ghostscript       --with-gs=yes                 *no *(gs unknown)
>
> So maybe we could use "*#define **have_gs/have_ps"* to surround:
>
> entry->decoder=(DecoderHandler) ReadPDFImage;
> entry->encoder=(EncoderHandler) WritePDFImage;
>
> and disable postscript-based formats when Ghostscript is not present or
> disabled?

On a normal system, a user may install Ghostscript at any time.  The 
search for Ghostscript (gs) is made in order to remember and possibly 
"freeze" the path to it for later use (e.g. "/usr/bin/gs" vs just 
"gs") as well as to try to find what we still call the Ghostscript 
fonts, which are very useful even without executing Ghostscript.  If 
Ghostscript was not found, then the default "gs" is used in case it is 
installed later.  The configure script tries to test Ghostscript to 
see what output drivers it supports.

The configure script is usually executed on a different system than 
the system that the end user is actually using.  For example, it is 
executed on a Linux distribution maintainer's system which is used to 
build binaries used in the distribuition.

Looking at what gets recorded in config.status I see this:

% fgrep -i psdelegate config.status
S["HasPSDelegate_FALSE"]="#"
S["HasPSDelegate_TRUE"]=""
S["PSDelegate"]="gs"

The HasPSDelegate value is used by the test suite in order to 
determine if a failure is expected.  The PSDelegate definition is used 
to remember the (possibly) frozen path to the binary and its name.  It 
could be changed to something like "/bin/false".

I tried to influence the Autoconf cache variable used for PSDelegate 
but it did not appear to change the behavior.

You are on a correct path in that the coder registration function can 
be used to block use of it.  It would be more correct not to register 
the format at all than to skip the encoder/decoder callback 
function registrations.

Note that there are multiple paths which try to invoke 
Ghostscript.  There is also pdf.c.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help