1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-01 21:45:45 +01:00

wrlib: grouped the detection of ImageMagick in the CHECK_MAGICK macro

Took the opportunity to expand the WM_LIB_CHECK macro because it is not
suited for the case where compilation flags can be queried but was meant
for the case when they have to be guessed

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-08 20:16:01 +02:00
committed by Carlos R. Mafra
parent 9a0c3ab737
commit 698cffacc5
2 changed files with 43 additions and 32 deletions

View File

@@ -322,11 +322,6 @@ dnl ==========
dnl AC_ARG_VAR(PKGCONFIG, [pkg-config command])
AC_CHECK_PROG(PKGCONFIG, pkg-config, pkg-config)
dnl MagickWand-config
dnl ==========
dnl AC_ARG_VAR(MAGICKWCONFIG, [MagickWand-config command])
AC_CHECK_PROG(MAGICKWCONFIG, MagickWand-config, MagickWand-config)
dnl gettext
dnl =======
@@ -564,26 +559,6 @@ else
fi
AC_SUBST(FCLIBS)
dnl
dnl libMagickWand
dnl
AC_MSG_CHECKING([for libmagickwand header])
MAGICKFLAGS=`$MAGICKWCONFIG --cflags`
if test "x$MAGICKFLAGS" = "x" ; then
AC_MSG_RESULT([not found])
else
AC_MSG_RESULT([found])
fi
AC_SUBST(MAGICKFLAGS)
AC_MSG_CHECKING([for libmagickwand library])
MAGICKLIBS=`$MAGICKWCONFIG --ldflags`
if test "x$MAGICKLIBS" = "x" ; then
AC_MSG_RESULT([not found])
else
AC_MSG_RESULT([found])
fi
AC_SUBST(MAGICKLIBS)
dnl Xft2 antialiased font support
dnl =============================

View File

@@ -259,11 +259,47 @@ AM_CONDITIONAL([USE_XPM], [test "x$enable_xpm" != "xno"])dnl
# and MAGICKLIBS, and append info to the variable 'supported_gfx'
# When not found, append info to variable 'unsupported'
AC_DEFUN_ONCE([WM_IMGFMT_CHECK_MAGICK],
[WM_LIB_CHECK([MAGICK], ["$MAGICKLIBS"], [MagickGetImagePixels], [$XLFLAGS $XLIBS],
[wm_save_CFLAGS="$CFLAGS $MAGICKLIBS"
AS_IF([wm_fn_lib_try_compile "wand/magick_wand.h" "" "return 0" ""],
[],
[AC_MSG_ERROR([found $CACHEVAR but could not find appropriate header - are you missing libmagickwand package?])])
CFLAGS="$wm_save_CFLAGS"],
[supported_gfx], [GFXLIBS])dnl
[AC_REQUIRE([_WM_LIB_CHECK_FUNCTS])
AS_IF([test "x$enable_magick" = "xno"],
[unsupported="$unsupported Magick"],
[AC_CHECK_PROG([MAGICKWCONFIG], [MagickWand-config], [MagickWand-config])
AS_IF([test "x$MAGICKWCONFIG" = "x"],
[AS_IF([test "x$enable_magick" = "xyes"],
[AC_MSG_ERROR([explicit Magick support requested but MagickWand-config not found])])
enable_magick=no
unsupported="$unsupported Magick"],
[AC_CACHE_CHECK([for Magick support library], [wm_cv_libchk_magick],
[wm_cv_libchk_magick=no
wm_cv_libchk_magick_cflags=`$MAGICKWCONFIG --cflags`
wm_cv_libchk_magick_libs=`$MAGICKWCONFIG --ldflags`
wm_save_LIBS="$LIBS"
dnl
dnl We check that the library is available
AS_IF([wm_fn_lib_try_link "MagickGetImagePixels" "$wm_cv_libchk_magick_libs"],
[wm_cv_libchk_magick=maybe])
LIBS="$wm_save_LIBS"
AS_IF([test "x$enable_magick$wm_cv_libchk_magick" = "xyesno"],
[AC_MSG_ERROR([explicit Magick support requested but library does not link])])
dnl
dnl The library was found, check if header is available and compiles
AS_IF([test "x$wm_cv_libchk_magick" != "xno"],
[wm_save_CFLAGS="$CFLAGS"
AS_IF([wm_fn_lib_try_compile "wand/magick_wand.h" "" "return 0" "$wm_cv_libchk_magick_cflags"],
[wm_cv_libchk_magick="$wm_cv_libchk_magick_cflags % $wm_cv_libchk_magick_libs"],
[AC_MSG_ERROR([found Magick library but could not compile appropriate header - are you missing libmagickwand-dev package?])])
CFLAGS="$wm_save_CFLAGS"])
])
AS_IF([test "x$wm_cv_libchk_magick" = "xno"],
[unsupported="$unsupported Magick"
enable_magick="no"],
[supported_gfx="$supported_gfx Magick"
MAGICKFLAGS=`echo "$wm_cv_libchk_magick" | sed -e 's, *%.*$,,' `
MAGICKLIBS=`echo "$wm_cv_libchk_magick" | sed -e 's,^.*% *,,' `
AC_DEFINE([USE_MAGICK], [1],
[defined when MagickWand library with header was found])])
])dnl AS_IF(MAGICKWCONFIG != "")
])
AM_CONDITIONAL([USE_MAGICK], [test "x$enable_magick" != "xno"])dnl
AC_SUBST(MAGICKFLAGS)dnl
AC_SUBST(MAGICKLIBS)dnl
]) dnl AC_DEFUN