mpg123: mpg123-1.31.0

From cd6cf37deee0683eaac8a4c130c840e0b2944368 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 28 Oct 2022 22:39:00 +0300
Subject: [PATCH] mpg123-1.31.0

---
 Makefile.am                              |   1 +
 Makefile.in                              |  55 ++--
 NEWS                                     |  47 +++
 configure                                | 313 ++++++++++++-------
 configure.ac                             | 142 +++++----
 man1/mpg123.1                            |   4 +
 mpg123.spec                              |   2 +-
 ports/README                             |  12 +-
 ports/cmake/linux_i686.toolchain.cmake   |   7 +
 ports/cmake/src/CMakeLists.txt           |  17 +-
 ports/cmake/src/config.cmake.h.in        |   7 +-
 ports/cmake/src/libmpg123/CMakeLists.txt |   3 +
 src/Makemodule.am                        |  10 +-
 src/common.c                             |   4 +-
 src/config.h.in                          |  21 +-
 src/control_generic.c                    |  43 ++-
 src/getlopt.c                            |  24 +-
 src/getlopt.h                            |   1 +
 src/httpget.c                            | 287 ++----------------
 src/httpget.h                            |   9 +-
 src/intsym.h                             |   6 +-
 src/libmpg123/dct36_3dnow.S              |  24 +-
 src/libmpg123/dct36_3dnowext.S           |  24 +-
 src/libmpg123/dct64_3dnow.S              |  10 +-
 src/libmpg123/dct64_mmx.S                |   2 +-
 src/libmpg123/dct64_sse.S                |   2 +-
 src/libmpg123/dct64_sse_float.S          |   2 +-
 src/libmpg123/mangle.h                   |   5 +
 src/libout123/buffer.c                   |  48 ++-
 src/libout123/buffer.h                   |   9 -
 src/libout123/libout123.c                |  53 +---
 src/libout123/modules/win32.c            |  27 +-
 src/libout123/out123_int.h               |   4 -
 src/local.c                              |   2 +-
 src/mpg123.c                             |  30 +-
 src/mpg123app.h                          |   1 +
 src/net123.h                             |  33 +-
 src/net123_exec.c                        |  99 +++---
 src/net123_winhttp.c                     |  81 +++--
 src/net123_wininet.c                     | 140 +++++----
 src/out123.c                             |   3 +
 src/playlist.c                           |   4 +-
 src/streamdump.c                         | 370 +++++++++++++++++++----
 src/streamdump.h                         |   4 +-
 src/term.c                               | 117 ++++---
 src/term.h                               |   4 +-
 src/term_none.c                          |   2 +-
 src/term_posix.c                         |  11 +-
 src/term_win32.c                         |   4 +-
 src/terms.h                              |   2 +-
 src/tests/seek_accuracy.c                |   2 +-
 src/win32_net.c                          | 341 +--------------------
 src/win32_support.h                      |  27 +-
 53 files changed, 1274 insertions(+), 1228 deletions(-)
 create mode 100644 ports/cmake/linux_i686.toolchain.cmake

diff --git a/Makefile.am b/Makefile.am
index 09dc0da..044611a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,6 +58,7 @@ EXTRA_DIST += \
   NEWS.libout123 \
   NEWS.libsyn123 \
   ports/cmake/CMakeLists.txt \
+  ports/cmake/linux_i686.toolchain.cmake \
   ports/cmake/mpg123-config.cmake.in \
   ports/cmake/cmake/search_libs.cmake \
   ports/cmake/cmake/read_api_version.cmake \
diff --git a/Makefile.in b/Makefile.in
index fc42a4e..1ea1286 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -375,20 +375,21 @@ check_PROGRAMS = src/tests/decode_fixed$(EXEEXT) \
 @TERM_POSIX_TRUE@am__append_98 = src/term_posix.c
 @TERM_WIN32_TRUE@am__append_99 = src/term_win32.c
 @TERM_NONE_TRUE@am__append_100 = src/term_none.c
-@NET123_EXEC_TRUE@am__append_101 = src/net123.h src/net123_exec.c
-@NET123_WINHTTP_TRUE@am__append_102 = src/net123.h src/net123_winhttp.c
-@NET123_WINHTTP_TRUE@am__append_103 = -lwinhttp
-@NET123_WININET_TRUE@am__append_104 = src/net123.h src/net123_wininet.c
-@NET123_WININET_TRUE@am__append_105 = -lwininet
-@WIN32_CODES_TRUE@am__append_106 = \
+@NET123_TRUE@am__append_101 = src/net123.h
+@NET123_EXEC_TRUE@am__append_102 = src/net123_exec.c
+@NET123_WINHTTP_TRUE@am__append_103 = src/net123_winhttp.c
+@NET123_WINHTTP_TRUE@am__append_104 = -lwinhttp
+@NET123_WININET_TRUE@am__append_105 = src/net123_wininet.c
+@NET123_WININET_TRUE@am__append_106 = -lwininet
+@WIN32_CODES_TRUE@am__append_107 = \
 @WIN32_CODES_TRUE@  src/win32_support.c
 
-@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__append_107 = src/win32_net.c
-@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__append_108 = -lws2_32
-@WIN32_CODES_TRUE@am__append_109 = \
+@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__append_108 = src/win32_net.c
+@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__append_109 = -lws2_32
+@WIN32_CODES_TRUE@am__append_110 = \
 @WIN32_CODES_TRUE@  src/win32_support.c
 
-@WIN32_CODES_TRUE@am__append_110 = \
+@WIN32_CODES_TRUE@am__append_111 = \
 @WIN32_CODES_TRUE@  src/win32_support.c
 
 subdir = .
@@ -1128,11 +1129,12 @@ am__src_mpg123_SOURCES_DIST = src/audio.c src/audio.h src/common.c \
 @TERM_POSIX_TRUE@am__objects_70 = src/term_posix.$(OBJEXT)
 @TERM_WIN32_TRUE@am__objects_71 = src/term_win32.$(OBJEXT)
 @TERM_NONE_TRUE@am__objects_72 = src/term_none.$(OBJEXT)
-@NET123_EXEC_TRUE@am__objects_73 = src/net123_exec.$(OBJEXT)
-@NET123_WINHTTP_TRUE@am__objects_74 = src/net123_winhttp.$(OBJEXT)
-@NET123_WININET_TRUE@am__objects_75 = src/net123_wininet.$(OBJEXT)
-@WIN32_CODES_TRUE@am__objects_76 = src/win32_support.$(OBJEXT)
-@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__objects_77 = src/win32_net.$(OBJEXT)
+am__objects_73 =
+@NET123_EXEC_TRUE@am__objects_74 = src/net123_exec.$(OBJEXT)
+@NET123_WINHTTP_TRUE@am__objects_75 = src/net123_winhttp.$(OBJEXT)
+@NET123_WININET_TRUE@am__objects_76 = src/net123_wininet.$(OBJEXT)
+@WIN32_CODES_TRUE@am__objects_77 = src/win32_support.$(OBJEXT)
+@NETWORK_WINSOCK_TRUE@@WIN32_CODES_TRUE@am__objects_78 = src/win32_net.$(OBJEXT)
 am_src_mpg123_OBJECTS = src/audio.$(OBJEXT) src/common.$(OBJEXT) \
 	src/sysutil.$(OBJEXT) src/control_generic.$(OBJEXT) \
 	src/equalizer.$(OBJEXT) src/getlopt.$(OBJEXT) \
@@ -1142,7 +1144,8 @@ am_src_mpg123_OBJECTS = src/audio.$(OBJEXT) src/common.$(OBJEXT) \
 	src/playlist.$(OBJEXT) src/streamdump.$(OBJEXT) \
 	src/term.$(OBJEXT) $(am__objects_70) $(am__objects_71) \
 	$(am__objects_72) $(am__objects_73) $(am__objects_74) \
-	$(am__objects_75) $(am__objects_76) $(am__objects_77)
+	$(am__objects_75) $(am__objects_76) $(am__objects_77) \
+	$(am__objects_78)
 src_mpg123_OBJECTS = $(am_src_mpg123_OBJECTS)
 am__DEPENDENCIES_1 =
 src_mpg123_DEPENDENCIES = src/compat/libcompat.la \
@@ -1155,7 +1158,7 @@ src_mpg123_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 am__src_mpg123_id3dump_SOURCES_DIST = src/mpg123-id3dump.c \
 	src/getlopt.c src/getlopt.h src/win32_support.c
 am_src_mpg123_id3dump_OBJECTS = src/mpg123-id3dump.$(OBJEXT) \
-	src/getlopt.$(OBJEXT) $(am__objects_76)
+	src/getlopt.$(OBJEXT) $(am__objects_77)
 src_mpg123_id3dump_OBJECTS = $(am_src_mpg123_id3dump_OBJECTS)
 src_mpg123_id3dump_DEPENDENCIES = src/compat/libcompat.la \
 	src/libmpg123/libmpg123.la
@@ -1170,7 +1173,7 @@ am__src_out123_SOURCES_DIST = src/sysutil.c src/sysutil.h src/common.h \
 	src/win32_support.h src/win32_support.c
 am_src_out123_OBJECTS = src/sysutil.$(OBJEXT) src/getlopt.$(OBJEXT) \
 	src/local.$(OBJEXT) src/filters.$(OBJEXT) src/out123.$(OBJEXT) \
-	$(am__objects_76)
+	$(am__objects_77)
 src_out123_OBJECTS = $(am_src_out123_OBJECTS)
 src_out123_DEPENDENCIES = src/compat/libcompat.la \
 	src/libsyn123/libsyn123.la src/libout123/libout123.la
@@ -2031,7 +2034,9 @@ EXTRA_DIST = src/tests/testtext.sh src/tests/decode_fixed.sh \
 	doc/examples/dump_seekindex.c doc/examples/extract_frames.c \
 	doc/examples/Makefile mpg123.spec makedll.sh windows-builds.sh \
 	equalize.dat NEWS.libmpg123 NEWS.libout123 NEWS.libsyn123 \
-	ports/cmake/CMakeLists.txt ports/cmake/mpg123-config.cmake.in \
+	ports/cmake/CMakeLists.txt \
+	ports/cmake/linux_i686.toolchain.cmake \
+	ports/cmake/mpg123-config.cmake.in \
 	ports/cmake/cmake/search_libs.cmake \
 	ports/cmake/cmake/read_api_version.cmake \
 	ports/cmake/cmake/CheckCPUArch.cmake \
@@ -2880,8 +2885,8 @@ src_libsyn123_libsyn123_la_SOURCES = \
 
 src_mpg123_LDADD = src/compat/libcompat.la src/libmpg123/libmpg123.la \
 	src/libout123/libout123.la src/libsyn123/libsyn123.la \
-	@PROG_LIBS@ $(am__append_103) $(am__append_105) \
-	$(am__append_108)
+	@PROG_LIBS@ $(am__append_104) $(am__append_106) \
+	$(am__append_109)
 src_mpg123_LDFLAGS = @EXEC_LT_LDFLAGS@
 src_out123_LDADD = \
   src/compat/libcompat.la \
@@ -2911,16 +2916,16 @@ src_mpg123_SOURCES = src/audio.c src/audio.h src/common.c src/common.h \
 	src/playlist.h src/streamdump.h src/streamdump.c src/term.c \
 	src/term.h src/terms.h src/win32_support.h $(am__append_98) \
 	$(am__append_99) $(am__append_100) $(am__append_101) \
-	$(am__append_102) $(am__append_104) $(am__append_106) \
-	$(am__append_107)
+	$(am__append_102) $(am__append_103) $(am__append_105) \
+	$(am__append_107) $(am__append_108)
 
 # Replace common.h by sysutil.h!
 src_out123_SOURCES = src/sysutil.c src/sysutil.h src/common.h \
 	src/getlopt.c src/getlopt.h src/local.h src/local.c \
 	src/filters.h src/filters.c src/out123.c src/mpg123app.h \
-	src/win32_support.h $(am__append_109)
+	src/win32_support.h $(am__append_110)
 src_mpg123_id3dump_SOURCES = src/mpg123-id3dump.c src/getlopt.c \
-	src/getlopt.h $(am__append_110)
+	src/getlopt.h $(am__append_111)
 src_mpg123_strip_SOURCES = \
   src/mpg123-strip.c \
   src/getlopt.c \
diff --git a/NEWS b/NEWS
index ea49031..6228b81 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,50 @@
+1.31.0
+------
+
+- mpg123:
+-- Finally make terminal control work on Windows, for real. Building it
+   was broken in 1.30.x.
+-- The --control / -C switch will make mpg123 abort now if terminal
+   control cannot be enabled.
+-- Revert to internal network code for plain HTTP to ensure continued
+   support for original shoutcast servers that do not talk proper HTTP.
+   External backends are built at the same time and can be enforced using
+   --network <backend>.
+-- Try-witout-port for internal network code is gone. We do not need to
+   keep each ancient hack for specific hosts.
+-- Handle redirections independently of the backend behind net123. 
+-- Set proxy environment variables when --proxy is specified, for net123
+   backends to use.
+-- Continue reading for long commands in generic control, avoiding
+   unnecessary unfinished command errors.
+-- Change error message from 'unknown command' to
+   'unknown command with arguments' to avoid confusion why 'help foo'
+   is unknown, as opposed to 'help'.
+-- Reduce CPU load while just waiting for terminal input
+   (thanks to bolshoytoster on github).
+-- Condense terminal control help output and excessive vertical whitespace
+   in printouts (inspired by Volkmar Klatt).
+-- Fix interaction of pause (looping) with buffer, adding --pauseloop
+   to set the loop interval.
+-- Numeric option arguments are strictly checked now for conversion errors.
+   This also catches -devbuffer, which was interpretd as -d 0 before. This
+   also applies to out123.
+- libout123:
+-- Add same interruption handling to out123_write() as to
+   unintr_write(), adding EAGAIN to fix bug 342 (thanks to Steffen Nurpmeso)
+   for certain ALSA setups.
+-- Add --devbuffer support to win32 output and change default to 0.25 seconds.
+-- Fix race condition to deadlock on buffer_sync_param() where parameters after
+   the command byte got read as more commands. This got triggered easily by
+   using the pause key in terminal mode with buffer (which was discouraged
+   before because of buffer flushing). Generally, changing parameters with
+   active buffer process was dangerous since libout123 entered the scene.
+- some build fixes for compiler pickyness
+- Disable largefile renames also for non-sensitive POSIX systems
+  (in some distant future, the alias symbols could go away, then …
+  bug 330).
+- Fix Android NDK x86 builds with GLOBAL_VAR_PTR use in assembly (bug 345).
+
 1.30.2
 ------
 - Only use EWOULDBLOCK if the macro is defined (FreeBSD misses it for
diff --git a/configure b/configure
index 7630b08..eca6fe5 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for mpg123 1.30.2.
+# Generated by GNU Autoconf 2.69 for mpg123 1.31.0.
 #
 # Report bugs to <maintainer@mpg123.org>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mpg123'
 PACKAGE_TARNAME='mpg123'
-PACKAGE_VERSION='1.30.2'
-PACKAGE_STRING='mpg123 1.30.2'
+PACKAGE_VERSION='1.31.0'
+PACKAGE_STRING='mpg123 1.31.0'
 PACKAGE_BUGREPORT='maintainer@mpg123.org'
 PACKAGE_URL=''
 
@@ -653,6 +653,8 @@ NET123_WINHTTP_FALSE
 NET123_WINHTTP_TRUE
 NET123_EXEC_FALSE
 NET123_EXEC_TRUE
+NET123_FALSE
+NET123_TRUE
 NETWORK_WINSOCK_FALSE
 NETWORK_WINSOCK_TRUE
 WIN32_CODES_FALSE
@@ -793,9 +795,7 @@ SUN_LDFLAGS
 SUN_LIBS
 HAVE_SNDIO_FALSE
 HAVE_SNDIO_TRUE
-SNDIO_CFLAGS
 SNDIO_LDFLAGS
-SNDIO_LIBS
 HAVE_COREAUDIO_FALSE
 HAVE_COREAUDIO_TRUE
 COREAUDIO_CFLAGS
@@ -821,6 +821,8 @@ HAVE_TINYALSA_TRUE
 TINYALSA_CFLAGS
 TINYALSA_LDFLAGS
 TINYALSA_LIBS
+SNDIO_LIBS
+SNDIO_CFLAGS
 SDL_LIBS
 SDL_CFLAGS
 ESD_LIBS
@@ -888,10 +890,10 @@ HAVE_FLOATDCT_TRUE
 INCLUDE_SYS_TYPE_H
 INCLUDE_STDLIB_H
 INCLUDE_STDIO_H
-BUILD_NO_LARGENAME
 HAVE_LFS_ALIAS_FALSE
 HAVE_LFS_ALIAS_TRUE
 LFS_ALIAS_BITS
+BUILD_NO_LARGENAME
 HAVE_LFS_WRAP_FALSE
 HAVE_LFS_WRAP_TRUE
 YASMFLAGS
@@ -1132,7 +1134,9 @@ PULSE_LIBS
 ESD_CFLAGS
 ESD_LIBS
 SDL_CFLAGS
-SDL_LIBS'
+SDL_LIBS
+SNDIO_CFLAGS
+SNDIO_LIBS'
 
 
 # Initialize some variables set by options.
@@ -1683,7 +1687,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mpg123 1.30.2 to adapt to many kinds of systems.
+\`configure' configures mpg123 1.31.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1754,7 +1758,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mpg123 1.30.2:";;
+     short | recursive ) echo "Configuration of mpg123 1.31.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1891,8 +1895,12 @@ Optional Packages:
   --with-seektable=<size> choose size of seek index table (0 disables it), default 1000
 
   --with-network=<type>   Available options, depending on platform, are auto,
-                          none, internal, winhttp, wininet, and exec (wget or
-                          curl binaries).
+                          none, internal, winhttp, wininet (or wininethttp for
+                          both), and exec (wget or curl binaries). The
+                          internal code is always built in addition to
+                          external options for plain HTTP (esp. Shoutcast v1)
+                          support. The external option is for HTTPS by
+                          default, but can be used for HTTP, too.
 
 Some influential environment variables:
   CC          C compiler command
@@ -1921,6 +1929,9 @@ Some influential environment variables:
   ESD_LIBS    linker flags for ESD, overriding pkg-config
   SDL_CFLAGS  C compiler flags for SDL, overriding pkg-config
   SDL_LIBS    linker flags for SDL, overriding pkg-config
+  SNDIO_CFLAGS
+              C compiler flags for SNDIO, overriding pkg-config
+  SNDIO_LIBS  linker flags for SNDIO, overriding pkg-config
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
@@ -1988,7 +1999,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mpg123 configure 1.30.2
+mpg123 configure 1.31.0
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2594,7 +2605,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mpg123 $as_me 1.30.2, which was
+It was created by mpg123 $as_me 1.31.0, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2947,7 +2958,7 @@ API_VERSION=47
 LIB_PATCHLEVEL=0
 
 OUTAPI_VERSION=4
-OUTLIB_PATCHLEVEL=4
+OUTLIB_PATCHLEVEL=7
 
 SYNAPI_VERSION=1
 SYNLIB_PATCHLEVEL=4
@@ -3553,7 +3564,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mpg123'
- VERSION='1.30.2'
+ VERSION='1.31.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -15594,8 +15605,10 @@ fi
 
 if test "x$ac_cv_sys_file_offset_bits" = x || echo "$ac_cv_sys_file_offset_bits" | $GREP  '[^0-9]' > /dev/null; then
 		largefile_sensitive=no
+	BUILD_NO_LARGENAME=1
 else
 	largefile_sensitive=yes
+	BUILD_NO_LARGENAME=0
 fi
 # Add dual-mode wrapper code.
  if  test x"$largefile_sensitive" = xyes  ; then
@@ -15606,6 +15619,8 @@ else
   HAVE_LFS_WRAP_FALSE=
 fi
 
+# Any non-sensitive platform does not bother with off_t-based function renaming.
+
 
 # Using the lower level macros instead of AC_TYPE_* for compatibility with not freshest autoconf.
 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
@@ -16021,7 +16036,6 @@ done
 
 fi
 
-term_type=none
 # Check if system supports termios
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking POSIX termios" >&5
 $as_echo_n "checking POSIX termios... " >&6; }
@@ -16054,6 +16068,34 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_posix_termios" >&5
 $as_echo "$ac_cv_sys_posix_termios" >&6; }
 
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have wincon.h" >&5
+$as_echo_n "checking if we have wincon.h... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <windows.h>
+#include <wincon.h>
+void *v = &ReadConsoleInput;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_wincon_h=yes
+else
+  ac_cv_header_wincon_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_wincon_h" >&5
+$as_echo "$ac_cv_header_wincon_h" >&6; }
+if test "x$ac_cv_header_wincon_h" = "xyes"; then :
+
+else
+
+$as_echo "#define HAVE_WINCON_H 1" >>confdefs.h
+
+fi
+
+term_type=none
 if test "x$ac_cv_sys_posix_termios" = "xyes"; then
 
 cat >>confdefs.h <<_ACEOF
@@ -16061,9 +16103,12 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
   term_type=posix
+elif test "x$ac_cv_header_windows_h" = "xyes" &&
+     test "x$ac_cv_header_wincon_h"  = "xyes"; then
+  term_type=win32
 fi
 
-for ac_func in random
+for ac_func in random setenv unsetenv
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -16396,13 +16441,6 @@ fi
 done
 
 
-# A Hack for MSVC builds by cmake: Disable largefile hackery.
-# Maybe one time we support hat wretched environment directly, but
-# for now configure lives in a world where large file support is
-# properly defined and served by off_t.
-BUILD_NO_LARGENAME=0
-
-
 # Substitutions for the installable mpg123.h header
 if test "x$ac_cv_header_stdio_h" = "xyes"; then
 	INCLUDE_STDIO_H="#include <stdio.h>"
@@ -18114,63 +18152,77 @@ $as_echo "$HAVE_WIN32_WASAPI" >&6; }
 			fi
 		;;
 		sndio)
-			SNDIO_LIBS=-lsndio
-			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sio_open in -lsndio" >&5
-$as_echo_n "checking for sio_open in -lsndio... " >&6; }
-if ${ac_cv_lib_sndio_sio_open+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsndio  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char sio_open ();
-int
-main ()
-{
-return sio_open ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_sndio_sio_open=yes
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SNDIO" >&5
+$as_echo_n "checking for SNDIO... " >&6; }
+
+if test -n "$SNDIO_CFLAGS"; then
+    pkg_cv_SNDIO_CFLAGS="$SNDIO_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "sndio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SNDIO_CFLAGS=`$PKG_CONFIG --cflags "sndio" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
 else
-  ac_cv_lib_sndio_sio_open=no
+  pkg_failed=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ else
+    pkg_failed=untried
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sndio_sio_open" >&5
-$as_echo "$ac_cv_lib_sndio_sio_open" >&6; }
-if test "x$ac_cv_lib_sndio_sio_open" = xyes; then :
-  for ac_header in sndio.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sndio.h" "ac_cv_header_sndio_h" "$ac_includes_default"
-if test "x$ac_cv_header_sndio_h" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SNDIO_H 1
-_ACEOF
- output_modules="$output_modules sndio" HAVE_SNDIO="yes"
+if test -n "$SNDIO_LIBS"; then
+    pkg_cv_SNDIO_LIBS="$SNDIO_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"sndio\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "sndio") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_SNDIO_LIBS=`$PKG_CONFIG --libs "sndio" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
 fi
 
-done
 
 
+if test $pkg_failed = yes; then
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
 fi
+        if test $_pkg_short_errors_supported = yes; then
+	        SNDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "sndio" 2>&1`
+        else
+	        SNDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "sndio" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$SNDIO_PKG_ERRORS" >&5
 
-			if test "x$HAVE_SNDIO" != xyes; then
-				check_failed=yes
-			fi
+	HAVE_SNDIO="no" check_failed=yes
+elif test $pkg_failed = untried; then
+     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	HAVE_SNDIO="no" check_failed=yes
+else
+	SNDIO_CFLAGS=$pkg_cv_SNDIO_CFLAGS
+	SNDIO_LIBS=$pkg_cv_SNDIO_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	output_modules="$output_modules sndio" HAVE_SNDIO="yes"
+fi
 		;;
 		sun)
 			for ac_header in sun/audioio.h sys/audioio.h asm/audioio.h sys/audio.h
@@ -18805,11 +18857,11 @@ fi
 #for i in dummy tinyalsa alsa qsa coreaudio esd jack nas oss portaudio pulse sdl sndio sun win32 win32_wasapi aix alib arts hp os2 sgi mint openal
 #do echo $i; done |
 #perl -ne 'chomp; $big = uc($_); print <<EOT;
-#AM_CONDITIONAL([BUILD_${big}], [ test "$_" = \$default_output_module ])
+#AM_CONDITIONAL([BUILD_${big}], [ test "$_" = "\$default_output_module" ])
 #EOT
 #'
 
- if  test "dummy" = $default_output_module ; then
+ if  test "dummy" = "$default_output_module" ; then
   BUILD_DUMMY_TRUE=
   BUILD_DUMMY_FALSE='#'
 else
@@ -18817,7 +18869,7 @@ else
   BUILD_DUMMY_FALSE=
 fi
 
- if  test "tinyalsa" = $default_output_module ; then
+ if  test "tinyalsa" = "$default_output_module" ; then
   BUILD_TINYALSA_TRUE=
   BUILD_TINYALSA_FALSE='#'
 else
@@ -18825,7 +18877,7 @@ else
   BUILD_TINYALSA_FALSE=
 fi
 
- if  test "alsa" = $default_output_module ; then
+ if  test "alsa" = "$default_output_module" ; then
   BUILD_ALSA_TRUE=
   BUILD_ALSA_FALSE='#'
 else
@@ -18833,7 +18885,7 @@ else
   BUILD_ALSA_FALSE=
 fi
 
- if  test "qsa" = $default_output_module ; then
+ if  test "qsa" = "$default_output_module" ; then
   BUILD_QSA_TRUE=
   BUILD_QSA_FALSE='#'
 else
@@ -18841,7 +18893,7 @@ else
   BUILD_QSA_FALSE=
 fi
 
- if  test "coreaudio" = $default_output_module ; then
+ if  test "coreaudio" = "$default_output_module" ; then
   BUILD_COREAUDIO_TRUE=
   BUILD_COREAUDIO_FALSE='#'
 else
@@ -18849,7 +18901,7 @@ else
   BUILD_COREAUDIO_FALSE=
 fi
 
- if  test "esd" = $default_output_module ; then
+ if  test "esd" = "$default_output_module" ; then
   BUILD_ESD_TRUE=
   BUILD_ESD_FALSE='#'
 else
@@ -18857,7 +18909,7 @@ else
   BUILD_ESD_FALSE=
 fi
 
- if  test "jack" = $default_output_module ; then
+ if  test "jack" = "$default_output_module" ; then
   BUILD_JACK_TRUE=
   BUILD_JACK_FALSE='#'
 else
@@ -18865,7 +18917,7 @@ else
   BUILD_JACK_FALSE=
 fi
 
- if  test "nas" = $default_output_module ; then
+ if  test "nas" = "$default_output_module" ; then
   BUILD_NAS_TRUE=
   BUILD_NAS_FALSE='#'
 else
@@ -18873,7 +18925,7 @@ else
   BUILD_NAS_FALSE=
 fi
 
- if  test "oss" = $default_output_module ; then
+ if  test "oss" = "$default_output_module" ; then
   BUILD_OSS_TRUE=
   BUILD_OSS_FALSE='#'
 else
@@ -18881,7 +18933,7 @@ else
   BUILD_OSS_FALSE=
 fi
 
- if  test "portaudio" = $default_output_module ; then
+ if  test "portaudio" = "$default_output_module" ; then
   BUILD_PORTAUDIO_TRUE=
   BUILD_PORTAUDIO_FALSE='#'
 else
@@ -18889,7 +18941,7 @@ else
   BUILD_PORTAUDIO_FALSE=
 fi
 
- if  test "pulse" = $default_output_module ; then
+ if  test "pulse" = "$default_output_module" ; then
   BUILD_PULSE_TRUE=
   BUILD_PULSE_FALSE='#'
 else
@@ -18897,7 +18949,7 @@ else
   BUILD_PULSE_FALSE=
 fi
 
- if  test "sdl" = $default_output_module ; then
+ if  test "sdl" = "$default_output_module" ; then
   BUILD_SDL_TRUE=
   BUILD_SDL_FALSE='#'
 else
@@ -18905,7 +18957,7 @@ else
   BUILD_SDL_FALSE=
 fi
 
- if  test "sndio" = $default_output_module ; then
+ if  test "sndio" = "$default_output_module" ; then
   BUILD_SNDIO_TRUE=
   BUILD_SNDIO_FALSE='#'
 else
@@ -18913,7 +18965,7 @@ else
   BUILD_SNDIO_FALSE=
 fi
 
- if  test "sun" = $default_output_module ; then
+ if  test "sun" = "$default_output_module" ; then
   BUILD_SUN_TRUE=
   BUILD_SUN_FALSE='#'
 else
@@ -18921,7 +18973,7 @@ else
   BUILD_SUN_FALSE=
 fi
 
- if  test "win32" = $default_output_module ; then
+ if  test "win32" = "$default_output_module" ; then
   BUILD_WIN32_TRUE=
   BUILD_WIN32_FALSE='#'
 else
@@ -18929,7 +18981,7 @@ else
   BUILD_WIN32_FALSE=
 fi
 
- if  test "win32_wasapi" = $default_output_module ; then
+ if  test "win32_wasapi" = "$default_output_module" ; then
   BUILD_WIN32_WASAPI_TRUE=
   BUILD_WIN32_WASAPI_FALSE='#'
 else
@@ -18937,7 +18989,7 @@ else
   BUILD_WIN32_WASAPI_FALSE=
 fi
 
- if  test "aix" = $default_output_module ; then
+ if  test "aix" = "$default_output_module" ; then
   BUILD_AIX_TRUE=
   BUILD_AIX_FALSE='#'
 else
@@ -18945,7 +18997,7 @@ else
   BUILD_AIX_FALSE=
 fi
 
- if  test "alib" = $default_output_module ; then
+ if  test "alib" = "$default_output_module" ; then
   BUILD_ALIB_TRUE=
   BUILD_ALIB_FALSE='#'
 else
@@ -18953,7 +19005,7 @@ else
   BUILD_ALIB_FALSE=
 fi
 
- if  test "arts" = $default_output_module ; then
+ if  test "arts" = "$default_output_module" ; then
   BUILD_ARTS_TRUE=
   BUILD_ARTS_FALSE='#'
 else
@@ -18961,7 +19013,7 @@ else
   BUILD_ARTS_FALSE=
 fi
 
- if  test "hp" = $default_output_module ; then
+ if  test "hp" = "$default_output_module" ; then
   BUILD_HP_TRUE=
   BUILD_HP_FALSE='#'
 else
@@ -18969,7 +19021,7 @@ else
   BUILD_HP_FALSE=
 fi
 
- if  test "os2" = $default_output_module ; then
+ if  test "os2" = "$default_output_module" ; then
   BUILD_OS2_TRUE=
   BUILD_OS2_FALSE='#'
 else
@@ -18977,7 +19029,7 @@ else
   BUILD_OS2_FALSE=
 fi
 
- if  test "sgi" = $default_output_module ; then
+ if  test "sgi" = "$default_output_module" ; then
   BUILD_SGI_TRUE=
   BUILD_SGI_FALSE='#'
 else
@@ -18985,7 +19037,7 @@ else
   BUILD_SGI_FALSE=
 fi
 
- if  test "mint" = $default_output_module ; then
+ if  test "mint" = "$default_output_module" ; then
   BUILD_MINT_TRUE=
   BUILD_MINT_FALSE='#'
 else
@@ -18993,7 +19045,7 @@ else
   BUILD_MINT_FALSE=
 fi
 
- if  test "openal" = $default_output_module ; then
+ if  test "openal" = "$default_output_module" ; then
   BUILD_OPENAL_TRUE=
   BUILD_OPENAL_FALSE='#'
 else
@@ -19524,6 +19576,11 @@ $as_echo "winhttp" >&6; }
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: wininet" >&5
 $as_echo "wininet" >&6; }
         ;;
+      wininethttp)
+        network_type="wininethttp"
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: wininethttp" >&5
+$as_echo "wininethttp" >&6; }
+        ;;
       internal)
         network_type="internal"
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: internal" >&5
@@ -19559,7 +19616,7 @@ $as_echo_n "checking for automatic network support... " >&6; }
   if test "x$have_fork" = "xyes"; then
     network_type=exec
   elif test "x$win32_specific_codes" = "xenabled"; then
-    network_type=wininet
+    network_type=wininethttp
   elif test "x$have_network" = "xyes"; then
     network_type="internal"
   else
@@ -19578,7 +19635,7 @@ fi
 if test x$network_type = xexec -a x$have_fork != xyes; then
   as_fn_error $? "exec network support selected but fork not available" "$LINENO" 5
 fi
-if test x$network_type = xwininet -o x$network_type = xwinhttp && test x$win32_specific_codes != xenabled; then
+if test x$network_type = xwininet -o x$network_type = xwinhttp -o x$network_type = xwininethttp && test x$win32_specific_codes != xenabled; then
   as_fn_error $? "wininet or winhttp is currently only for Windows" "$LINENO" 5
 fi
 
@@ -19595,7 +19652,7 @@ fi
 if test x"$ipv6" = xauto; then
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking IPv6 use" >&5
 $as_echo_n "checking IPv6 use... " >&6; }
-	if test x"$have_ipv6" = xyes -a x"$network_type" = xinternal; then
+	if test x"$have_ipv6" = xyes -a x"$network_type" != xdisabled; then
 		ipv6=enabled
 	else
 		ipv6=disabled
@@ -19604,13 +19661,13 @@ $as_echo_n "checking IPv6 use... " >&6; }
 $as_echo "$ipv6" >&6; }
 fi
 
-if test x$network_type = xinternal -a x$network_internal = xwinsock2; then
+if test x$network_type != xdisabled -a x$network_internal = xwinsock2; then
 
 $as_echo "#define WANT_WIN32_SOCKETS 1" >>confdefs.h
 
 fi
 
- if  test x$network_type = xinternal -a x$network_internal = xwinsock2 ; then
+ if  test x$network_type != xdisabled -a x$network_internal = xwinsock2 ; then
   NETWORK_WINSOCK_TRUE=
   NETWORK_WINSOCK_FALSE='#'
 else
@@ -19618,6 +19675,14 @@ else
   NETWORK_WINSOCK_FALSE=
 fi
 
+ if  test x$network_type != xdisabled ; then
+  NET123_TRUE=
+  NET123_FALSE='#'
+else
+  NET123_TRUE='#'
+  NET123_FALSE=
+fi
+
  if  test x$network_type = xexec ; then
   NET123_EXEC_TRUE=
   NET123_EXEC_FALSE='#'
@@ -19626,7 +19691,7 @@ else
   NET123_EXEC_FALSE=
 fi
 
- if  test x$network_type = xwinhttp ; then
+ if  test x$network_type = xwinhttp || test x$network_type = xwininethttp ; then
   NET123_WINHTTP_TRUE=
   NET123_WINHTTP_FALSE='#'
 else
@@ -19634,7 +19699,7 @@ else
   NET123_WINHTTP_FALSE=
 fi
 
- if  test x$network_type = xwininet ; then
+

(Patch may be truncated, please check the link at the top of this post.)