]> git.draconx.ca Git - upkg.git/blob - m4/libmodplug.m4
libupkg: Make decodeindex test accept an empty string.
[upkg.git] / m4 / libmodplug.m4
1 dnl Copyright © 2011 Nick Bowler
2 dnl
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.
6
7 AC_DEFUN([_DX_LIBMODPLUG_TEST_PROGRAM], [AC_LANG_PROGRAM([dnl
8 #include <modplug.h>
9 ], [dnl
10 unsigned char buf@<:@128@:>@ = {0};
11 ModPlugFile *f = ModPlug_Load(buf, sizeof buf);
12 ModPlug_Unload(f);
13 ])])
14
15 dnl DX_CHECK_LIBMODPLUG([action-if-ok], [action-if-fail])
16 AC_DEFUN([DX_CHECK_LIBMODPLUG],
17 [DX_PKG_CONFIG([libmodplug], [libmodplug], [libmodplug])
18
19 DX_CHECK_LIB([libmodplug],
20         [for libmodplug], [_DX_LIBMODPLUG_TEST_PROGRAM], [dnl
21                 [[$LIBMODPLUG_CFLAGS], [$LIBMODPLUG_LIBS]],
22                 [[$pkg_cv_libmodplug_cflags], [$pkg_cv_libmodplug_libs],
23                         [test ! x"$pkg_failed" = x"yes"]],
24                 [[], [-lmodplug]],
25                 ])
26
27 if test x"$dx_cv_libmodplug_found" = x"yes"; then
28         ifelse([$1], [], [:], [$1])
29 else
30         ifelse([$2], [], [AC_MSG_FAILURE([dnl
31 libmodplug is required.  The latest
32 version can be obtained from http://modplug-xmms.sourceforge.net/.
33
34 If libmodplug is installed but was not found by this configure script,
35 consider adjusting LIBMODPLUG_CFLAGS and/or LIBMODPLUG_LIBS as necessary.
36
37 If pkg-config is installed, it may help to adjust PKG_CONFIG_PATH if
38 libmodplug is installed in a non-standard prefix.
39 ])], [$2])
40 fi
41 ])