2 # Convenience script for regenerating all autogeneratable files that are
3 # omitted from the version control repository. In particular, this script
4 # also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
5 # with new versions of autoconf or automake.
7 # This script requires autoconf-2.63..2.72 and automake-1.11..1.17 in the PATH.
11 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 3 of the License, or
16 # (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <https://www.gnu.org/licenses/>.
26 # Prerequisite (if not used from a released tarball): either
27 # - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout, or
28 # - a preceding invocation of './autopull.sh'.
30 # Usage: ./autogen.sh [--skip-gnulib]
33 # --skip-gnulib Avoid fetching files from Gnulib.
34 # This option is useful
35 # - when you are working from a released tarball (possibly
36 # with modifications), or
37 # - as a speedup, if the set of gnulib modules did not
38 # change since the last time you ran this script.
43 --skip-gnulib) skip_gnulib
=true
; shift;;
48 # ========== Copy files from gnulib, automake, or the internet. ==========
51 if test -n "${MAKE}" && test "`${MAKE} --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
54 if test "`make --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
57 if test "`gmake --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
60 echo "*** - GNU Make not found" 1>&2
66 if test $skip_gnulib = false
; then
67 if test -n "$GNULIB_SRCDIR"; then
68 test -d "$GNULIB_SRCDIR" ||
{
69 echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2
73 GNULIB_SRCDIR
=`pwd`/gnulib
74 test -d "$GNULIB_SRCDIR" ||
{
75 echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2
79 # Now it should contain a gnulib-tool.
80 GNULIB_TOOL
="$GNULIB_SRCDIR/gnulib-tool"
81 test -f "$GNULIB_TOOL" ||
{
82 echo "*** gnulib-tool not found." 1>&2
85 for file in build-aux
/compile build-aux
/ar-lib
; do
86 $GNULIB_TOOL --copy-file $file ||
exit $?
87 chmod a
+x
$file ||
exit $?
89 $GMAKE -f Makefile.devel \
90 gnulib-clean srclib
/Makefile.gnulib gnulib-imported-files srclib
/Makefile.
in \
91 GNULIB_TOOL
="$GNULIB_TOOL"
94 # Copy files into the libcharset subpackage, so that libcharset/autogen.sh
95 # does not need to invoke gnulib-tool nor automake.
96 for file in INSTALL.generic
; do
97 cp -p $file libcharset
/$file ||
exit $?
99 for file in config.guess config.libpath config.sub install-sh libtool-reloc mkinstalldirs
; do
100 cp -p build-aux
/$file libcharset
/build-aux
/$file ||
exit $?
112 cp -p srcm
4/$file libcharset
/m
4/$file ||
exit $?
115 # ========== Generate files. ==========
117 $GMAKE -f Makefile.devel totally-clean all ||
exit $?
120 .
/autogen.sh ||
exit $?
123 echo "$0: done. Now you can run './configure'."