1 AC_DEFUN([DX_LIB_LIBDISCID],
2 [DX_LIB_SETUP([libdiscid])dnl
3 DX_LIB_PKGCONFIG_FLAGS([libdiscid])
4 AC_MSG_CHECKING([for libdiscid[]m4_ifnblank([$1], [ at least version $1])])
5 DX_LIB_SEARCH_LINK([libdiscid],
6 [m4_apply([_DX_LIB_LIBDISCID_TEST], m4_split([$1], [\.]))],
7 [ [[$LIBDISCID_CFLAGS], [$LIBDISCID_LIBS]],
8 [[$dx_cv_libdiscid_pkg_cflags], [$dx_cv_libdiscid_pkg_libs],
9 [test x"$dx_cv_libdiscid_pkg_found" = x"yes"]],
11 AS_IF([test x"$dx_cv_libdiscid_lib_found" = x"yes"], [$2],
12 [m4_default([$3], [AC_MSG_FAILURE(
13 [libdiscid[]m4_ifnblank([$1], [ version $1 or newer]) is required. The latest
14 version may be found at <https://musicbrainz.org/doc/libdiscid>.
15 m4_newline([DX_LIB_USERFLAG_BLURB([libdiscid])])
16 m4_newline([DX_LIB_PKGCONFIG_BLURB([libdiscid])])
19 dnl Internal test program for libdiscid. Check that the version numbers in the
20 dnl header are sufficient and that some important functions are defined.
21 m4_define([_DX_LIB_LIBDISCID_TEST], [AC_LANG_PROGRAM(
22 [#include <discid/discid.h>
23 m4_ifnblank([$1], [dnl
24 #if DISCID_VERSION_MAJOR < $1
25 DX_LIB_COMPILE_ERROR([major version insufficient])
26 m4_ifnblank([$2], [dnl
27 #elif DISCID_VERSION_MAJOR == $1
28 # if DISCID_VERSION_MINOR < $2
29 DX_LIB_COMPILE_ERROR([minor version insufficient])
30 m4_ifnblank([$3], [dnl
31 # elif DISCID_VERSION_MINOR == $2
32 # if DISCID_VERSION_PATCH < $3
33 DX_LIB_COMPILE_ERROR([patch version insufficient])
39 ])], [discid_free(discid_new());])])