-dnl Copyright © 2009-2012, 2015 Nick Bowler
+dnl Copyright © 2009-2012, 2015, 2019 Nick Bowler
dnl
dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
dnl This is free software: you are free to do what the fuck you want to.
[with_modlib=$withval],
[with_modlib=auto])
-case $with_modlib in
-no|none)
- use_modlib=none
-;;
-modplug)
- DX_CHECK_LIBMODPLUG([use_modlib=modplug], [])
-;;
-auto)
- DX_CHECK_LIBMODPLUG([have_libmodplug=yes], [have_libmodplug=no])
+use_modlib=none
+AS_CASE([$with_modlib],
+ [no|none], [:],
+ [modplug], [DX_LIB_LIBMODPLUG([use_modlib=modplug])],
+ [auto], [DX_LIB_LIBMODPLUG([use_modlib=modplug], [:])],
+ [AC_MSG_ERROR([Invalid argument to --with-modlib: $with_modlib])])
- if test x$have_libmodplug = xyes; then
- use_modlib=modplug
- else
- use_modlib=none
- fi
-;;
-*)
- AC_MSG_ERROR([Invalid argument to --with-modlib: $with_modlib])
-;;
-esac
AC_MSG_CHECKING([which module library to use])
AC_MSG_RESULT([$use_modlib])
+++ /dev/null
-dnl Copyright (C) 2010 Nick Bowler
-dnl Copying and distribution of this file, with or without modification,
-dnl are permitted in any medium without royalty provided the copyright
-dnl notice and this notice are preserved. This file is offered as-is,
-dnl without any warranty.
-
-m4_pattern_forbid([^_?DX_])
-
-dnl DX_PKG_CONFIG(env-base, [pkg-id], [pkg-help])
-AC_DEFUN([DX_PKG_CONFIG], [dnl
-AC_ARG_VAR(m4_toupper([$1])[_CFLAGS], [C compiler flags for ]ifelse(
- [$3], [], [$1], [$3]))dnl
-AC_ARG_VAR(m4_toupper([$1])[_LIBS], [linker flags for ]ifelse(
- [$3], [], [$1], [$3]))dnl
-
-ifelse([$2], [], [], [dnl
-AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test x"$PKG_CONFIG" != x; then
- AC_MSG_CHECKING([pkg-config database for $2])
- pkg_failed=no
- _PKG_CONFIG(m4_tolower([$1])[_cflags], [cflags], [$2])
- _PKG_CONFIG(m4_tolower([$1])[_libs], [libs], [$2])
- if test x$pkg_failed = xyes; then
- errors=`$PKG_CONFIG --errors-to-stdout --print-errors $2`
- echo "$errors" >&AS_MESSAGE_LOG_FD
- AC_MSG_RESULT([no])
- else
- AC_MSG_RESULT([yes])
- fi
-fi])])
-
-dnl _DX_CHECK_LIB(env-base, check-func, [cflags], [libs], [test])
-AC_DEFUN([_DX_CHECK_LIB], [dnl
-if test x"$dx_cv_[]m4_tolower([$1])_found" = x"no"; then
-if ifelse([$5], [], [:], [$5]); then
- CFLAGS="$3 $dx_old_cflags"
- LIBS="$4 $dx_old_libs"
-
- $2([dnl
- dx_cv_[]m4_tolower([$1])_found="yes"
- dx_cv_[]m4_tolower([$1])_cflags="$3"
- dx_cv_[]m4_tolower([$1])_libs="$4"
- ])
-fi
-fi
-])
-
-dnl DX_CHECK_LIB_EXT(env-base, message, check-func,
-dnl [[[cflags1],[libs1],[test1]],[[cflags2],[libs2],[test2]],...])
-AC_DEFUN([DX_CHECK_LIB_EXT], [dnl
-AC_LANG_PUSH([C])
-dx_old_cflags=$CFLAGS
-dx_old_libs=$LIBS
-
-AC_CACHE_CHECK([$2], [dx_cv_]m4_tolower([$1])[_found], [dnl
-AC_CACHE_VAL([dx_cv_]m4_tolower([$1])[_libs], [dnl
-AC_CACHE_VAL([dx_cv_]m4_tolower([$1])[_cflags], [dnl
- dx_cv_[]m4_tolower([$1])_found=no
- m4_foreach([dx_tuple], [$4], [_DX_CHECK_LIB([$1], [$3], dx_tuple)])
-])])])
-
-if test x"$dx_cv_[]m4_tolower([$1])_found" = x"yes"; then
- m4_toupper([$1])_CFLAGS=$dx_cv_[]m4_tolower([$1])_cflags
- m4_toupper([$1])_LIBS=$dx_cv_[]m4_tolower([$1])_libs
- AC_SUBST(m4_toupper([$1])[_CFLAGS])
- AC_SUBST(m4_toupper([$1])[_LIBS])
-fi
-
-CFLAGS=$dx_old_cflags
-LIBS=$dx_old_libs
-AC_LANG_POP([C])
-])
-
-dnl DX_CHECK_LIB(env-base, message, test-program,
-dnl [[[cflags1],[libs1],[test1]],[[cflags2],[libs2],[test2]],...])
-AC_DEFUN([DX_CHECK_LIB], [dnl
- DX_CHECK_LIB_EXT([$1], [$2], [m4_curry([AC_LINK_IFELSE], [$3])], [$4])
-])
+++ /dev/null
-dnl Copyright © 2011 Nick Bowler
-dnl
-dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-dnl This is free software: you are free to do what the fuck you want to.
-dnl There is NO WARRANTY, to the extent permitted by law.
-
-AC_DEFUN([_DX_LIBMODPLUG_TEST_PROGRAM], [AC_LANG_PROGRAM([dnl
-#include <modplug.h>
-], [dnl
-unsigned char buf@<:@128@:>@ = {0};
-ModPlugFile *f = ModPlug_Load(buf, sizeof buf);
-ModPlug_Unload(f);
-])])
-
-dnl DX_CHECK_LIBMODPLUG([action-if-ok], [action-if-fail])
-AC_DEFUN([DX_CHECK_LIBMODPLUG],
-[DX_PKG_CONFIG([libmodplug], [libmodplug], [libmodplug])
-
-DX_CHECK_LIB([libmodplug],
- [for libmodplug], [_DX_LIBMODPLUG_TEST_PROGRAM], [dnl
- [[$LIBMODPLUG_CFLAGS], [$LIBMODPLUG_LIBS]],
- [[$pkg_cv_libmodplug_cflags], [$pkg_cv_libmodplug_libs],
- [test ! x"$pkg_failed" = x"yes"]],
- [[], [-lmodplug]],
- ])
-
-if test x"$dx_cv_libmodplug_found" = x"yes"; then
- ifelse([$1], [], [:], [$1])
-else
- ifelse([$2], [], [AC_MSG_FAILURE([dnl
-libmodplug is required. The latest
-version can be obtained from http://modplug-xmms.sourceforge.net/.
-
-If libmodplug is installed but was not found by this configure script,
-consider adjusting LIBMODPLUG_CFLAGS and/or LIBMODPLUG_LIBS as necessary.
-
-If pkg-config is installed, it may help to adjust PKG_CONFIG_PATH if
-libmodplug is installed in a non-standard prefix.
-])], [$2])
-fi
-])