Split autogen.sh into autopull.sh and autogen.sh.

* autopull.sh: New file, based on autogen.sh.
* autogen.sh: Remove code that was moved to autopull.sh. Remove
--skip-gnulib option.
* Makefile.devel (all): Remove srclib/Makefile.gnulib.
* Makefile.in (SOURCE_FILES): Add autogen.sh.
* HACKING: Mention autopull.sh.
diff --git a/.gitignore b/.gitignore
index 74300e4..7f388a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -250,7 +250,7 @@
 /libcharset/build-aux/install-sh
 /libcharset/build-aux/mkinstalldirs
 
-# Other files brought in by autogen.sh:
+# Other files brought in by autopull.sh:
 /build-aux/config.guess
 /build-aux/config.sub
 /libcharset/build-aux/config.guess
diff --git a/ChangeLog b/ChangeLog
index 658fb63..b21cc7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-07-17  Bruno Haible  <bruno@clisp.org>
+
+	Split autogen.sh into autopull.sh and autogen.sh.
+	* autopull.sh: New file, based on autogen.sh.
+	* autogen.sh: Remove code that was moved to autopull.sh. Remove
+	--skip-gnulib option.
+	* Makefile.devel (all): Remove srclib/Makefile.gnulib.
+	* Makefile.in (SOURCE_FILES): Add autogen.sh.
+	* HACKING: Mention autopull.sh.
+
 2022-05-22  Bruno Haible  <bruno@clisp.org>
 
 	Add GNU Project notice.
diff --git a/HACKING b/HACKING
index 8e5a63e..933cc3c 100644
--- a/HACKING
+++ b/HACKING
@@ -50,7 +50,7 @@
 
 After fetching the sources from the Git repository, peek at the comments in
 autogen.sh, then run
-  ./gitsub.sh pull
+  ./autopull.sh
   ./autogen.sh
 Then you can proceed with "./configure" as usual.
 
diff --git a/Makefile.devel b/Makefile.devel
index 3102ad2..5535acc 100644
--- a/Makefile.devel
+++ b/Makefile.devel
@@ -16,7 +16,7 @@
 RM = rm -f
 
 
-all : srclib/Makefile.gnulib srclib/Makefile.in \
+all : srclib/Makefile.in \
       configures config.h.in \
       include/iconv.h.build.in \
       lib/aliases.h lib/aliases_sysaix.h lib/aliases_syshpux.h lib/aliases_sysosf1.h lib/aliases_syssolaris.h \
diff --git a/Makefile.in b/Makefile.in
index 4fb5eea..475a93b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -149,7 +149,7 @@
 SOURCE_FILES = \
   README DEPENDENCIES INSTALL.windows HACKING AUTHORS NEWS JOIN-GNU \
   DESIGN NOTES THANKS \
-  ChangeLog Makefile.devel configure.ac Makefile.in \
+  ChangeLog autogen.sh Makefile.devel configure.ac Makefile.in \
   include/export.h include/iconv.h.in \
   gnulib-local/lib/alloca.in.h \
   gnulib-local/lib/error.h.diff \
diff --git a/autogen.sh b/autogen.sh
index 5f65529..90fc9f9 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -5,13 +5,10 @@
 # with new versions of autoconf or automake.
 #
 # This script requires autoconf-2.63..2.71 and automake-1.11..1.16 in the PATH.
-# If not used from a released tarball, it also requires either
-#   - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout, or
-#   - a preceding invocation of './gitsub.sh pull'.
 # It also requires
 #   - the gperf program.
 
-# Copyright (C) 2003-2012, 2016, 2018-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2012, 2016, 2018-2022 Free Software Foundation, Inc.
 #
 # 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
@@ -26,57 +23,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# Usage: ./autogen.sh [--skip-gnulib]
-
-skip_gnulib=false
-while :; do
-  case "$1" in
-    --skip-gnulib) skip_gnulib=true; shift;;
-    *) break ;;
-  esac
-done
-
-# ========== Copy files from gnulib, automake, or the internet. ==========
-
-if test $skip_gnulib = false; then
-  if test -n "$GNULIB_SRCDIR"; then
-    test -d "$GNULIB_SRCDIR" || {
-      echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2
-      exit 1
-    }
-  else
-    GNULIB_SRCDIR=`pwd`/gnulib
-    test -d "$GNULIB_SRCDIR" || {
-      echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2
-      exit 1
-    }
-  fi
-  # Now it should contain a gnulib-tool.
-  GNULIB_TOOL="$GNULIB_SRCDIR/gnulib-tool"
-  test -f "$GNULIB_TOOL" || {
-    echo "*** gnulib-tool not found." 1>&2
-    exit 1
-  }
-  for file in build-aux/compile build-aux/ar-lib; do
-    $GNULIB_TOOL --copy-file $file || exit $?
-    chmod a+x $file || exit $?
-  done
-  make -f Makefile.devel \
-       gnulib-clean srclib/Makefile.gnulib gnulib-imported-files srclib/Makefile.in \
-       GNULIB_TOOL="$GNULIB_TOOL"
-fi
-
-# Copy files into the libcharset subpackage, so that libcharset/autogen.sh
-# does not need to invoke gnulib-tool nor automake.
-for file in INSTALL.generic; do
-  cp -p $file libcharset/$file || exit $?
-done
-for file in config.guess config.libpath config.sub install-sh libtool-reloc mkinstalldirs; do
-  cp -p build-aux/$file libcharset/build-aux/$file || exit $?
-done
-for file in codeset.m4 fcntl-o.m4 lib-ld.m4 relocatable.m4 relocatable-lib.m4 visibility.m4; do
-  cp -p srcm4/$file libcharset/m4/$file || exit $?
-done
+# Prerequisite (if not used from a released tarball): ./autopull.sh
+# Usage: ./autogen.sh
 
 # ========== Generate files. ==========
 
diff --git a/autopull.sh b/autopull.sh
new file mode 100755
index 0000000..a0016a7
--- /dev/null
+++ b/autopull.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Convenience script for fetching auxiliary files that are omitted from
+# the version control repository of this package.
+#
+# This script requires either
+#   - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout, or
+#   - a preceding invocation of './gitsub.sh pull'.
+
+# Copyright (C) 2003-2012, 2016, 2018-2022 Free Software Foundation, Inc.
+#
+# 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Usage: ./autopull.sh
+
+./gitsub.sh pull
+
+# ========== Copy files from gnulib, automake, or the internet. ==========
+
+if test -n "$GNULIB_SRCDIR"; then
+  test -d "$GNULIB_SRCDIR" || {
+    echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2
+    exit 1
+  }
+else
+  GNULIB_SRCDIR=`pwd`/gnulib
+  test -d "$GNULIB_SRCDIR" || {
+    echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2
+    exit 1
+  }
+fi
+# Now it should contain a gnulib-tool.
+GNULIB_TOOL="$GNULIB_SRCDIR/gnulib-tool"
+test -f "$GNULIB_TOOL" || {
+  echo "*** gnulib-tool not found." 1>&2
+  exit 1
+}
+for file in build-aux/compile build-aux/ar-lib; do
+  $GNULIB_TOOL --copy-file $file || exit $?
+  chmod a+x $file || exit $?
+done
+make -f Makefile.devel \
+     gnulib-clean srclib/Makefile.gnulib gnulib-imported-files srclib/Makefile.in \
+     GNULIB_TOOL="$GNULIB_TOOL"
+
+# Copy files into the libcharset subpackage, so that libcharset/autogen.sh
+# does not need to invoke gnulib-tool nor automake.
+for file in INSTALL.generic; do
+  cp -p $file libcharset/$file || exit $?
+done
+for file in config.guess config.libpath config.sub install-sh libtool-reloc mkinstalldirs; do
+  cp -p build-aux/$file libcharset/build-aux/$file || exit $?
+done
+for file in codeset.m4 fcntl-o.m4 lib-ld.m4 relocatable.m4 relocatable-lib.m4 visibility.m4; do
+  cp -p srcm4/$file libcharset/m4/$file || exit $?
+done
+
+echo "$0: done.  Now you can run './autogen.sh'."
diff --git a/libcharset/ChangeLog b/libcharset/ChangeLog
index 9a9912b..456aa71 100644
--- a/libcharset/ChangeLog
+++ b/libcharset/ChangeLog
@@ -1,3 +1,10 @@
+2022-07-17  Bruno Haible  <bruno@clisp.org>
+
+	Split autogen.sh into autopull.sh and autogen.sh.
+	* autopull.sh: New file.
+	* autogen.sh: Mention it.
+	* HACKING: Likewise.
+
 2022-05-15  Bruno Haible  <bruno@clisp.org>
 
 	Switch to libtool 2.4.7.
diff --git a/libcharset/HACKING b/libcharset/HACKING
index b99dcaa..847ab5b 100644
--- a/libcharset/HACKING
+++ b/libcharset/HACKING
@@ -33,6 +33,8 @@
 https://savannah.gnu.org/git/?group=libiconv .
 
 After fetching the sources from the Git repository, peek at the comments in
-autogen.sh, then run "./autogen.sh"; then you can proceed with "./configure"
-as usual.
+autogen.sh, then run
+  ./autopull.sh
+  ./autogen.sh
+Then you can proceed with "./configure" as usual.
 
diff --git a/libcharset/autogen.sh b/libcharset/autogen.sh
index fb271b2..bfc9691 100755
--- a/libcharset/autogen.sh
+++ b/libcharset/autogen.sh
@@ -4,7 +4,7 @@
 #
 # This script requires autoconf-2.63..2.71 and automake-1.11..1.16 in the PATH.
 
-# Copyright (C) 2003-2007, 2009-2010, 2016, 2020-2021 Free Software Foundation, Inc.
+# Copyright (C) 2003-2007, 2009-2010, 2016, 2020-2022 Free Software Foundation, Inc.
 #
 # 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
@@ -19,6 +19,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-# Usage: ./autogen.sh
+# Prerequisite: ./autopull.sh
+# Usage:        ./autogen.sh
 
 make -f Makefile.devel totally-clean all
diff --git a/libcharset/autopull.sh b/libcharset/autopull.sh
new file mode 100755
index 0000000..c6a1b82
--- /dev/null
+++ b/libcharset/autopull.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Convenience script for fetching auxiliary files that are omitted from
+# the version control repository of this package.
+
+# Copyright (C) 2022 Free Software Foundation, Inc.
+#
+# 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Usage: ./autopull.sh
+
+echo "$0: done.  Now you can run './autogen.sh'."