From 852d25c6fea13f6ffce0e48a17c50817d439c9c0 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Wed, 27 Feb 2019 13:35:39 -0500 Subject: [PATCH] Fix build with more recent libmodplug. Modern versions of libmodplug no longer put -I${includedir}/libmodplug in the pkg-config file, which breaks our files that #include . Seems the expectation is for packges to #include instead, which should work totally fine with old versions too. The new libmodplug helper macro in dxcommon uses that, so just update the the rest of the code accordingly. --- Makefile.am | 2 +- common | 2 +- configure.ac | 27 ++++--------- m4/dxutils.m4 | 78 -------------------------------------- m4/libmodplug.m4 | 41 -------------------- src/engine/music-modplug.c | 4 +- 6 files changed, 11 insertions(+), 143 deletions(-) delete mode 100644 m4/dxutils.m4 delete mode 100644 m4/libmodplug.m4 diff --git a/Makefile.am b/Makefile.am index 60474a5..01ab6f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -# Copyright © 2009-2012, 2015 Nick Bowler +# Copyright © 2009-2012, 2015, 2019 Nick Bowler # # License WTFPL2: Do What The Fuck You Want To Public License, version 2. # This is free software: you are free to do what the fuck you want to. diff --git a/common b/common index 8ff6f88..92a8970 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 8ff6f88c85fd93411fc013dc8eb2b54d2cf80a0d +Subproject commit 92a89700c65e52fac8c2cace51a7112d60b3f42f diff --git a/configure.ac b/configure.ac index 030e9fa..752343f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -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. @@ -34,26 +34,13 @@ AC_ARG_WITH([modlib], [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]) diff --git a/m4/dxutils.m4 b/m4/dxutils.m4 deleted file mode 100644 index 6df2438..0000000 --- a/m4/dxutils.m4 +++ /dev/null @@ -1,78 +0,0 @@ -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]) -]) diff --git a/m4/libmodplug.m4 b/m4/libmodplug.m4 deleted file mode 100644 index d19bcd0..0000000 --- a/m4/libmodplug.m4 +++ /dev/null @@ -1,41 +0,0 @@ -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 -], [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 -]) diff --git a/src/engine/music-modplug.c b/src/engine/music-modplug.c index 867caff..449a480 100644 --- a/src/engine/music-modplug.c +++ b/src/engine/music-modplug.c @@ -1,6 +1,6 @@ /* * upkg: tool for manipulating Unreal Tournament packages. - * Copyright © 2009-2011 Nick Bowler + * Copyright © 2009-2011, 2019 Nick Bowler * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ #include #include -#include +#include #include "modplug-types.h" #include "music-module.h" -- 2.43.0