1 dnl Copyright © 2011, 2015 Nick Bowler
3 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
4 dnl This is free software: you are free to do what the fuck you want to.
5 dnl There is NO WARRANTY, to the extent permitted by law.
7 dnl DX_LIB_LIBMODPLUG([action-if-ok], [action-if-failed])
9 dnl Search for libmodplug. This library does not expose version information
10 dnl so min-version checks are not supported.
12 dnl If a working library is found, appropriate compiler and linker flags are
13 dnl stored in LIBMODPLUG_CFLAGS and LIBMODPLUG_LIBS, respectively, and the
14 dnl action-if-ok is performed (may be empty). If no such library is found,
15 dnl then action-if-failed is performed if non-empty; otherwise configure will
16 dnl stop with a fatal error.
17 AC_DEFUN([DX_LIB_LIBMODPLUG],
18 [DX_LIB_SETUP([libmodplug])dnl
19 DX_LIB_PKGCONFIG_FLAGS([libmodplug])
20 AC_MSG_CHECKING([for libmodplug])
21 DX_LIB_SEARCH_LINK([libmodplug], [_DX_LIB_LIBMODPLUG_TEST],
22 [ [[$LIBMODPLUG_CFLAGS], [$LIBMODPLUG_LIBS]],
23 [[$dx_cv_libmodplug_pkg_cflags], [$dx_cv_libmodplug_pkg_libs],
24 [test x"$dx_cv_libmodplug_pkg_found" = x"yes"]],
26 AS_IF([test x"$dx_cv_libmodplug_lib_found" = x"yes"], [$1],
27 [m4_default([$2], [AC_MSG_FAILURE([dnl
28 libmodplug is required. The latest version may be found at
29 <http://modplug-xmms.sourceforge.net>.
30 m4_newline([DX_LIB_USERFLAG_BLURB([libmodplug])])
31 m4_newline([DX_LIB_PKGCONFIG_BLURB([libmodplug])])
34 dnl Internal test program for libmodplug.
35 m4_define([_DX_LIB_LIBMODPLUG_TEST], [AC_LANG_PROGRAM([dnl
36 #include <libmodplug/modplug.h>
38 unsigned char buf[[128]];
39 ModPlugFile *f = ModPlug_Load(buf, sizeof buf);