mpg123: backport mainstream svn revisions 5019 to 5023.

From 0b973cd5d6de30c98d957aade824807d846049ee Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 23 May 2022 17:24:02 +0300
Subject: [PATCH] backport mainstream svn revisions 5019 to 5023.

---
 configure                                | 18 +++++++++++++-----
 configure.ac                             | 18 +++++++++++++-----
 ports/cmake/cmake/read_api_version.cmake |  2 +-
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index d3404be..5bd3933 100755
--- a/configure
+++ b/configure
@@ -17047,7 +17047,10 @@ output_modules=
 check_forced=no
 check_failed=no
 if test "x$with_audio" != "x"; then
-	check_modules="`echo $with_audio|tr , ' '` dummy"
+	check_modules=`echo $with_audio|tr , ' '`
+	if ! echo "$check_modules" | grep -qw dummy; then
+		check_modules="$check_modules dummy"
+	fi
 	echo "Limiting outputs to build according to your preference: $check_modules"
 	check_forced=yes
 fi
@@ -18760,6 +18763,15 @@ fi
 
 default_output_module=`first_word $default_output_modules`
 
+# Without actual modules, there is only the builtin one.
+if test x"$modules" = xdisabled; then
+  # Module-less build needs _some_ default module.
+  if test -z "$default_output_module"; then
+    default_output_module=dummy
+  fi
+  default_output_modules=$default_output_module
+fi
+
 # Setup the static build.
 # The conditionals always need to be defined by configure, even if
 # HAVE_MODULES is FALSE!
@@ -18964,10 +18976,6 @@ else
 fi
 
 
-# Without actual modules, there is only the builtin one.
-if test x"$modules" = xdisabled; then
-  default_output_modules=$default_output_module
-fi
 default_modstring=`echo "$default_output_modules"|tr ' ' ,`
 
 cat >>confdefs.h <<_ACEOF
diff --git a/configure.ac b/configure.ac
index 3ca8766..da4f0d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1675,7 +1675,10 @@ output_modules=
 check_forced=no
 check_failed=no
 if test "x$with_audio" != "x"; then
-	check_modules="`echo $with_audio|tr , ' '` dummy"
+	check_modules=`echo $with_audio|tr , ' '`
+	if ! echo "$check_modules" | grep -qw dummy; then
+		check_modules="$check_modules dummy"
+	fi
 	echo "Limiting outputs to build according to your preference: $check_modules"
 	check_forced=yes
 fi
@@ -2186,6 +2189,15 @@ fi
 
 default_output_module=`first_word $default_output_modules`
 
+# Without actual modules, there is only the builtin one.
+if test x"$modules" = xdisabled; then
+  # Module-less build needs _some_ default module.
+  if test -z "$default_output_module"; then
+    default_output_module=dummy
+  fi
+  default_output_modules=$default_output_module
+fi
+
 # Setup the static build.
 # The conditionals always need to be defined by configure, even if
 # HAVE_MODULES is FALSE!
@@ -2222,10 +2234,6 @@ AM_CONDITIONAL([BUILD_SGI], [ test "sgi" = $default_output_module ])
 AM_CONDITIONAL([BUILD_MINT], [ test "mint" = $default_output_module ])
 AM_CONDITIONAL([BUILD_OPENAL], [ test "openal" = $default_output_module ])
 
-# Without actual modules, there is only the builtin one.
-if test x"$modules" = xdisabled; then
-  default_output_modules=$default_output_module
-fi
 default_modstring=`echo "$default_output_modules"|tr ' ' ,`
 AC_DEFINE_UNQUOTED( DEFAULT_OUTPUT_MODULE, "$default_modstring", [The default audio output module(s) to use] )
 
diff --git a/ports/cmake/cmake/read_api_version.cmake b/ports/cmake/cmake/read_api_version.cmake
index a2b12b4..131d973 100644
--- a/ports/cmake/cmake/read_api_version.cmake
+++ b/ports/cmake/cmake/read_api_version.cmake
@@ -1,6 +1,6 @@
 function(read_api_version project_version api_version outapi_version synapi_version )
 
-    file( READ "${CMAKE_SOURCE_DIR}/../../configure.ac" configure_ac )
+    file( READ "${CMAKE_CURRENT_SOURCE_DIR}/../../configure.ac" configure_ac )
 
     string( REGEX MATCH "AC_INIT\\(\\[mpg123\\], \\[([0-9\\.]+)" result ${configure_ac} )
     set( ${project_version} ${CMAKE_MATCH_1} PARENT_SCOPE )