In this patch we will fix an issue during compilation on systems, which
have ImageMagick version 7, and slightly more recent version of
compiler. If we define USE_MAGICK with null value, compilation will fail
on preprocessor check on such defined variable.
wrlib: Fix typo in macro containing ImageMagick version
It's USE_MAGICK, not USE_MAGIC. Also, we wrap the if/else statement
in an ifdef. This doesn't really affect anything since load_magick.c
won't be compiled if USE_MAGICK is undefined because of an if statement
in the Makefile. But in the off chance that it is somehow, then we will
try to load a nonexistent version 6 header file since USE_MAGICK will
be interprested as 0 and 0 < 7 is true.
Unescaped curly braces have been deprecated since Perl 5.26 and are
illegal in Perl 5.30. I copied the relevant lines from the latest kernel
source, so we'll inherit a couple other improvements as well.
The abs() function should take an int as argument, but there were
several instances in the code where it was taking an unsigned int or a
double. In these case, we took one of the following approaches:
* If the argument was a double, use fabs() instead.
* If the argument was unsigned and was certainly going to be positive
(i.e,. no subtraction), then drop abs() altogether.
* If the argument was unsigned as result of adding or subtracting signed
and unsigned ints, then we cast all the unsigned ints to signed ints.
We dropped ImageMagick 6 support in 0.95.9. However, ImageMagick 6 is
still widespread (e.g., ImageMagick 7 has not been packaged in Debian
yet), and upstream plans on maintaining it until at least 2028 [1].
In this patch, we detect the version of the MagickWand library installed
on the user's system and include the appropriate header file when
building wrlib.
Note: I've only tested this with ImageMagick 6, so I'd appreciate
confirmation that it works with ImageMagick 7.
We use the AC_PATH_XTRA macro to find all the X library paths during
build, but we weren't actually using the variables it generated for
building wmlib. Instead, we just hardcoded the linker flag "-lX11",
which may or may not actually work.