SDL_image: build: Use POSIX 1003.1-2001 tar archives for make dist

From a291357d0b88884c5610e848d02a21ee26f405c7 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 13 Apr 2021 00:10:00 +0300
Subject: [PATCH] build: Use POSIX 1003.1-2001 tar archives for make dist

c.f.: https://github.com/libsdl-org/SDL_ttf/pull/125
c.f.: https://github.com/libsdl-org/SDL_ttf/issues/124
---
 Makefile.am  |   1 -
 Makefile.in  |   1 -
 configure    | 193 ++++++++++++++++++++++++++++++++++++---------------
 configure.ac |  49 ++++++-------
 4 files changed, 162 insertions(+), 82 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 7965f18..4ba3618 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,5 @@
 # Makefile.am for the SDL sample image loading library and viewer
 ACLOCAL_AMFLAGS = -I acinclude
-AUTOMAKE_OPTIONS= foreign
 
 lib_LTLIBRARIES = libSDL2_image.la
 
diff --git a/Makefile.in b/Makefile.in
index 3bf8c73..c3b8603 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -427,7 +427,6 @@ top_srcdir = @top_srcdir@
 
 # Makefile.am for the SDL sample image loading library and viewer
 ACLOCAL_AMFLAGS = -I acinclude
-AUTOMAKE_OPTIONS = foreign
 lib_LTLIBRARIES = libSDL2_image.la
 libSDL2_imageincludedir = $(includedir)/SDL2
 libSDL2_imageinclude_HEADERS = \
diff --git a/configure b/configure
index 60b8f8c..f169e1f 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,8 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
+# Generated by GNU Autoconf 2.69 for SDL2_image 2.0.6.
+#
+# Report bugs to <https://github.com/libsdl-org/SDL_image/issues>.
 #
 #
 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -264,10 +266,11 @@ fi
     $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
     $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
-    $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: https://github.com/libsdl-org/SDL_image/issues about
+$0: your system, including any error possibly output before
+$0: this message. Then install a modern shell, or manually
+$0: run the script under such a shell if you do have one."
   fi
   exit 1
 fi
@@ -724,12 +727,12 @@ MFLAGS=
 MAKEFLAGS=
 
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
+PACKAGE_NAME='SDL2_image'
+PACKAGE_TARNAME='SDL2_image'
+PACKAGE_VERSION='2.0.6'
+PACKAGE_STRING='SDL2_image 2.0.6'
+PACKAGE_BUGREPORT='https://github.com/libsdl-org/SDL_image/issues'
+PACKAGE_URL=''
 
 ac_unique_file="IMG.c"
 # Factoring default headers for most tests.
@@ -823,6 +826,7 @@ AUTOHEADER
 AUTOMAKE
 AUTOCONF
 ACLOCAL
+VERSION
 PACKAGE
 CYGPATH_W
 am__isrc
@@ -871,7 +875,6 @@ LIBTOOL
 OBJDUMP
 DLLTOOL
 AS
-VERSION
 BINARY_AGE
 INTERFACE_AGE
 MICRO_VERSION
@@ -1011,7 +1014,7 @@ sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
 infodir='${datarootdir}/info'
 htmldir='${docdir}'
 dvidir='${docdir}'
@@ -1511,7 +1514,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 this package to adapt to many kinds of systems.
+\`configure' configures SDL2_image 2.0.6 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1559,7 +1562,7 @@ Fine tuning of the installation directories:
   --infodir=DIR           info documentation [DATAROOTDIR/info]
   --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
   --mandir=DIR            man documentation [DATAROOTDIR/man]
-  --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/SDL2_image]
   --htmldir=DIR           html documentation [DOCDIR]
   --dvidir=DIR            dvi documentation [DOCDIR]
   --pdfdir=DIR            pdf documentation [DOCDIR]
@@ -1580,7 +1583,9 @@ _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
-
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of SDL2_image 2.0.6:";;
+   esac
   cat <<\_ACEOF
 
 Optional Features:
@@ -1660,7 +1665,7 @@ Some influential environment variables:
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
-Report bugs to the package provider.
+Report bugs to <https://github.com/libsdl-org/SDL_image/issues>.
 _ACEOF
 ac_status=$?
 fi
@@ -1723,7 +1728,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-configure
+SDL2_image configure 2.0.6
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2106,6 +2111,10 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
 $as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------------------------- ##
+## Report this to https://github.com/libsdl-org/SDL_image/issues ##
+## ------------------------------------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
     ;;
 esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
@@ -2126,7 +2135,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 $as_me, which was
+It was created by SDL2_image $as_me 2.0.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2477,27 +2486,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-
-# Making releases:
-#   MICRO_VERSION += 1;
-#   INTERFACE_AGE += 1;
-#   BINARY_AGE += 1;
-# if any functions have been added, set INTERFACE_AGE to 0.
-# if backwards compatibility has been broken,
-# set BINARY_AGE and INTERFACE_AGE to 0.
-
 MAJOR_VERSION=2
-MINOR_VERSION=0
-MICRO_VERSION=6
-INTERFACE_AGE=0
-BINARY_AGE=6
-VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
-
-
 
+MINOR_VERSION=0
 
+MICRO_VERSION=6
 
+INTERFACE_AGE=0
 
+BINARY_AGE=6
 
 
 # libtool versioning
@@ -4061,13 +4058,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:4064: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4061: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4067: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4064: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4070: output\"" >&5)
+  (eval echo "\"\$as_me:4067: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5278,7 +5275,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5281 "configure"' > conftest.$ac_ext
+  echo '#line 5278 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7108,11 +7105,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:7111: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7108: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7115: \$? = $ac_status" >&5
+   echo "$as_me:7112: \$? = $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.
@@ -7447,11 +7444,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:7450: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7447: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7454: \$? = $ac_status" >&5
+   echo "$as_me:7451: \$? = $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.
@@ -7552,11 +7549,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:7555: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7552: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7559: \$? = $ac_status" >&5
+   echo "$as_me:7556: \$? = $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
@@ -7607,11 +7604,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:7610: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7607: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7614: \$? = $ac_status" >&5
+   echo "$as_me:7611: \$? = $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
@@ -9977,7 +9974,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 9980 "configure"
+#line 9977 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10073,7 +10070,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10076 "configure"
+#line 10073 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10853,9 +10850,8 @@ fi
 
 
 # Define the identity of the package.
-
- PACKAGE=SDL2_image
- VERSION=$VERSION
+ PACKAGE='SDL2_image'
+ VERSION='2.0.6'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -10899,7 +10895,92 @@ AMTAR='$${TAR-tar}'
 # We'll loop over all known methods to create a tar archive until one works.
 _am_tools='gnutar  pax cpio none'
 
-am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a pax tar archive" >&5
+$as_echo_n "checking how to create a pax tar archive... " >&6; }
+
+  # Go ahead even if we have the value already cached.  We do so because we
+  # need to set the values for the 'am__tar' and 'am__untar' variables.
+  _am_tools=${am_cv_prog_tar_pax-$_am_tools}
+
+  for _am_tool in $_am_tools; do
+    case $_am_tool in
+    gnutar)
+      for _am_tar in tar gnutar gtar; do
+        { echo "$as_me:$LINENO: $_am_tar --version" >&5
+   ($_am_tar --version) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); } && break
+      done
+      am__tar="$_am_tar --format=posix -chf - "'"$$tardir"'
+      am__tar_="$_am_tar --format=posix -chf - "'"$tardir"'
+      am__untar="$_am_tar -xf -"
+      ;;
+    plaintar)
+      # Must skip GNU tar: if it does not support --format= it doesn't create
+      # ustar tarball either.
+      (tar --version) >/dev/null 2>&1 && continue
+      am__tar='tar chf - "$$tardir"'
+      am__tar_='tar chf - "$tardir"'
+      am__untar='tar xf -'
+      ;;
+    pax)
+      am__tar='pax -L -x pax -w "$$tardir"'
+      am__tar_='pax -L -x pax -w "$tardir"'
+      am__untar='pax -r'
+      ;;
+    cpio)
+      am__tar='find "$$tardir" -print | cpio -o -H pax -L'
+      am__tar_='find "$tardir" -print | cpio -o -H pax -L'
+      am__untar='cpio -i -H pax -d'
+      ;;
+    none)
+      am__tar=false
+      am__tar_=false
+      am__untar=false
+      ;;
+    esac
+
+    # If the value was cached, stop now.  We just wanted to have am__tar
+    # and am__untar set.
+    test -n "${am_cv_prog_tar_pax}" && break
+
+    # tar/untar a dummy directory, and stop if the command works.
+    rm -rf conftest.dir
+    mkdir conftest.dir
+    echo GrepMe > conftest.dir/file
+    { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
+   (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+    rm -rf conftest.dir
+    if test -s conftest.tar; then
+      { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
+   ($am__untar <conftest.tar) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+      { echo "$as_me:$LINENO: cat conftest.dir/file" >&5
+   (cat conftest.dir/file) >&5 2>&5
+   ac_status=$?
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   (exit $ac_status); }
+      grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+    fi
+  done
+  rm -rf conftest.dir
+
+  if ${am_cv_prog_tar_pax+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  am_cv_prog_tar_pax=$_am_tool
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_pax" >&5
+$as_echo "$am_cv_prog_tar_pax" >&6; }
 
 
 
@@ -14081,7 +14162,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by $as_me, which was
+This file was extended by SDL2_image $as_me 2.0.6, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -14132,13 +14213,13 @@ $config_files
 Configuration commands:
 $config_commands
 
-Report bugs to the package provider."
+Report bugs to <https://github.com/libsdl-org/SDL_image/issues>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-config.status
+SDL2_image config.status 2.0.6
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/configure.ac b/configure.ac
index cc764d6..6043ef8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,31 +1,32 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT
-AC_CONFIG_MACRO_DIR([acinclude])
-AC_CONFIG_SRCDIR([IMG.c])
 
 dnl Set various version strings - taken gratefully from the GTk sources
-
 # Making releases:
-#   MICRO_VERSION += 1;
-#   INTERFACE_AGE += 1;
-#   BINARY_AGE += 1;
-# if any functions have been added, set INTERFACE_AGE to 0.
+#   MICRO_VERSION_MACRO += 1;
+#   INTERFACE_AGE_MACRO += 1;
+#   BINARY_AGE_MACRO += 1;
+# if any functions have been added, set INTERFACE_AGE_MACRO to 0.
 # if backwards compatibility has been broken,
-# set BINARY_AGE and INTERFACE_AGE to 0.
-
-MAJOR_VERSION=2
-MINOR_VERSION=0
-MICRO_VERSION=6
-INTERFACE_AGE=0
-BINARY_AGE=6
-VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
-
-AC_SUBST(MAJOR_VERSION)
-AC_SUBST(MINOR_VERSION)
-AC_SUBST(MICRO_VERSION)
-AC_SUBST(INTERFACE_AGE)
-AC_SUBST(BINARY_AGE)
-AC_SUBST(VERSION)
+# set BINARY_AGE_MACRO and INTERFACE_AGE_MACRO to 0.
+m4_define([MAJOR_VERSION_MACRO], [2])
+m4_define([MINOR_VERSION_MACRO], [0])
+m4_define([MICRO_VERSION_MACRO], [6])
+m4_define([INTERFACE_AGE_MACRO], [0])
+m4_define([BINARY_AGE_MACRO], [6])
+
+AC_INIT([SDL2_image],
+        MAJOR_VERSION_MACRO.MINOR_VERSION_MACRO.MICRO_VERSION_MACRO,
+        [https://github.com/libsdl-org/SDL_image/issues],
+        [SDL2_image])
+AC_CONFIG_MACRO_DIR([acinclude])
+AC_CONFIG_SRCDIR([IMG.c])
+
+AC_SUBST([MAJOR_VERSION], MAJOR_VERSION_MACRO)
+AC_SUBST([MINOR_VERSION], MINOR_VERSION_MACRO)
+AC_SUBST([MICRO_VERSION], MICRO_VERSION_MACRO)
+AC_SUBST([INTERFACE_AGE], INTERFACE_AGE_MACRO)
+AC_SUBST([BINARY_AGE], BINARY_AGE_MACRO)
+dnl VERSION is AC_SUBST'd by AC_INIT
 
 # libtool versioning
 LT_INIT([win32-dll])
@@ -44,7 +45,7 @@ dnl Detect the canonical build and host environments
 AC_CANONICAL_HOST
 
 dnl Setup for automake
-AM_INIT_AUTOMAKE(SDL2_image, $VERSION)
+AM_INIT_AUTOMAKE([foreign tar-pax])
 
 dnl Check for tools
 AC_PROG_CC