From 7ffda2f99be5cc63753479fc389d6a5c5caada20 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 22 May 2022 20:55:10 +0300
Subject: [PATCH] autotools: simplified libmikmod detection
---
configure | 114 +++++++++++++++++++++++++--------------------------
configure.ac | 53 ++++++++++--------------
2 files changed, 77 insertions(+), 90 deletions(-)
diff --git a/configure b/configure
index 021149bd..ca3d8fa2 100755
--- a/configure
+++ b/configure
@@ -797,6 +797,8 @@ FLUIDSYNTH_LIBS
FLUIDSYNTH_CFLAGS
XMP_LIBS
XMP_CFLAGS
+LIBMIKMOD_LIBS
+LIBMIKMOD_CFLAGS
LIBMIKMOD_CONFIG
MODPLUG_LIBS
MODPLUG_CFLAGS
@@ -4140,13 +4142,13 @@ if ${lt_cv_nm_interface+:} false; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:4143: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4145: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:4146: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4148: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:4149: output\"" >&5)
+ (eval echo "\"\$as_me:4151: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -5360,7 +5362,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5363 "configure"' > conftest.$ac_ext
+ echo '#line 5365 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7185,11 +7187,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7188: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7190: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7192: \$? = $ac_status" >&5
+ echo "$as_me:7194: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7534,11 +7536,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7537: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7539: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7541: \$? = $ac_status" >&5
+ echo "$as_me:7543: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7639,11 +7641,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7642: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7644: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7646: \$? = $ac_status" >&5
+ echo "$as_me:7648: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -7694,11 +7696,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7697: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7699: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7701: \$? = $ac_status" >&5
+ echo "$as_me:7703: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10129,7 +10131,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10132 "configure"
+#line 10134 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10225,7 +10227,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10228 "configure"
+#line 10230 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -13469,11 +13471,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13472: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13474: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13476: \$? = $ac_status" >&5
+ echo "$as_me:13478: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13568,11 +13570,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13571: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13573: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13575: \$? = $ac_status" >&5
+ echo "$as_me:13577: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -13620,11 +13622,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13623: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13625: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13627: \$? = $ac_status" >&5
+ echo "$as_me:13629: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -15994,13 +15996,6 @@ else
fi
if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = xyes; then
- have_libmikmod=no
- libmikmod_maj=3
- libmikmod_min=1
- libmikmod_rev=10
- libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
- CFLAGS_SAVED="$CFLAGS"
- LIBS_SAVED="$LIBS"
# Extract the first word of "libmikmod-config", so it can be a program name with args.
set dummy libmikmod-config; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -16042,43 +16037,46 @@ $as_echo "no" >&6; }
fi
+
+
if test "$LIBMIKMOD_CONFIG" != "no" ; then
- CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
- LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
- have_libmikmod=yes
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmikmod - version >= $libmikmod_ver" >&5
-$as_echo_n "checking for libmikmod - version >= $libmikmod_ver... " >&6; }
- if test "$cross_compiling" = yes; then :
- echo $ac_n "cross compiling; assumed OK... $ac_c"
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ test -z "$LIBMIKMOD_CFLAGS" && LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG --cflags`
+ test -z "$LIBMIKMOD_LIBS" && LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG --libs`
+ fi
+ CFLAGS_SAVED="$CFLAGS"
+ LIBS_SAVED="$LIBS"
+ CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
+ LIBS="$LIBS $LIBMIKMOD_LIBS"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmikmod >= 3.1.10" >&5
+$as_echo_n "checking for libmikmod >= 3.1.10... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
+#include <mikmod.h>
+int
+main ()
+{
-#include "mikmod.h"
-#include "stdio.h"
+#if (LIBMIKMOD_VERSION < 0x03010a)
+choke me
+#endif
+Player_LoadGeneric(NULL,0,0);
-int main(int argc, char **argv)
-{
- long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
- if (ver>=((maj<<16)|(min<<8)|(rev))) {
- printf("yes\n");
- return 0;
- }
- printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
- return 1;
+ ;
+ return 0;
}
-
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
+if ac_fn_c_try_link "$LINENO"; then :
+ have_libmikmod=yes
else
have_libmikmod=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
- fi
+ CFLAGS="$CFLAGS_SAVED"
+ LIBS="$LIBS_SAVED"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_libmikmod" >&5
+$as_echo "$have_libmikmod" >&6; }
if test x$have_libmikmod = xyes; then
case "$host" in
@@ -16095,20 +16093,18 @@ fi
fi
;;
esac
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MIKMOD `$LIBMIKMOD_CONFIG --cflags`"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MIKMOD $LIBMIKMOD_CFLAGS"
if test x$enable_music_mod_mikmod_shared = xyes && test x$mikmod_lib != x; then
echo "-- dynamic libmikmod -> $mikmod_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMIKMOD_DYNAMIC=\\\"$mikmod_lib\\\""
else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
- PC_LIBS="$PC_LIBS `$LIBMIKMOD_CONFIG --libs`"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBMIKMOD_LIBS"
+ PC_LIBS="$PC_LIBS $LIBMIKMOD_LIBS"
fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: *** Unable to find MikMod library (http://mikmod.sourceforge.net/)" >&5
$as_echo "$as_me: WARNING: *** Unable to find MikMod library (http://mikmod.sourceforge.net/)" >&2;}
fi
- LIBS="$LIBS_SAVED"
- CFLAGS="$CFLAGS_SAVED"
fi
# Check whether --enable-music-mod-xmp was given.
diff --git a/configure.ac b/configure.ac
index f48a832a..6ed61d91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -359,35 +359,28 @@ AC_ARG_ENABLE([music-mod-mikmod-shared],
[AS_HELP_STRING([--enable-music-mod-mikmod-shared], [dynamically load mikmod library [default=yes]])],
[], [enable_music_mod_mikmod_shared=yes])
if test x$enable_music_mod = xyes -a x$enable_music_mod_mikmod = xyes; then
- have_libmikmod=no
- libmikmod_maj=3
- libmikmod_min=1
- libmikmod_rev=10
- libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
- CFLAGS_SAVED="$CFLAGS"
- LIBS_SAVED="$LIBS"
AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
+ AC_SUBST(LIBMIKMOD_CFLAGS)
+ AC_SUBST(LIBMIKMOD_LIBS)
if test "$LIBMIKMOD_CONFIG" != "no" ; then
- CFLAGS="$CFLAGS `$LIBMIKMOD_CONFIG --cflags`"
- LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
- have_libmikmod=yes
- AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include "mikmod.h"
-#include "stdio.h"
-
-int main(int argc, char **argv)
-{
- long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
- if (ver>=((maj<<16)|(min<<8)|(rev))) {
- printf("yes\n");
- return 0;
- }
- printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
- return 1;
-}
-]])], [],[have_libmikmod=no],[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+ test -z "$LIBMIKMOD_CFLAGS" && LIBMIKMOD_CFLAGS=`$LIBMIKMOD_CONFIG --cflags`
+ test -z "$LIBMIKMOD_LIBS" && LIBMIKMOD_LIBS=`$LIBMIKMOD_CONFIG --libs`
fi
+ CFLAGS_SAVED="$CFLAGS"
+ LIBS_SAVED="$LIBS"
+ CFLAGS="$CFLAGS $LIBMIKMOD_CFLAGS"
+ LIBS="$LIBS $LIBMIKMOD_LIBS"
+ AC_MSG_CHECKING([for libmikmod >= 3.1.10])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <mikmod.h>]],[[
+#if (LIBMIKMOD_VERSION < 0x03010a)
+choke me
+#endif
+Player_LoadGeneric(NULL,0,0);
+]])], [have_libmikmod=yes],[have_libmikmod=no])
+
+ CFLAGS="$CFLAGS_SAVED"
+ LIBS="$LIBS_SAVED"
+ AC_MSG_RESULT($have_libmikmod)
if test x$have_libmikmod = xyes; then
case "$host" in
@@ -404,19 +397,17 @@ int main(int argc, char **argv)
fi
;;
esac
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MIKMOD `$LIBMIKMOD_CONFIG --cflags`"
+ EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MOD_MIKMOD $LIBMIKMOD_CFLAGS"
if test x$enable_music_mod_mikmod_shared = xyes && test x$mikmod_lib != x; then
echo "-- dynamic libmikmod -> $mikmod_lib"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DMIKMOD_DYNAMIC=\\\"$mikmod_lib\\\""
else
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
- PC_LIBS="$PC_LIBS `$LIBMIKMOD_CONFIG --libs`"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBMIKMOD_LIBS"
+ PC_LIBS="$PC_LIBS $LIBMIKMOD_LIBS"
fi
else
AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.sourceforge.net/)])
fi
- LIBS="$LIBS_SAVED"
- CFLAGS="$CFLAGS_SAVED"
fi
AC_ARG_ENABLE([music-mod-xmp],