Update the LGPL text.
[libiconv.git] / autogen.sh
blob51a4468a8e0c061ed50e1dd2b4c093d1441ab8e2
1 #!/bin/sh
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.
8 # It also requires
9 # - the gperf program.
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]
32 # Options:
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.
40 skip_gnulib=false
41 while :; do
42 case "$1" in
43 --skip-gnulib) skip_gnulib=true; shift;;
44 *) break ;;
45 esac
46 done
48 # ========== Copy files from gnulib, automake, or the internet. ==========
50 # Find GNU Make.
51 if test -n "${MAKE}" && test "`${MAKE} --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
52 GMAKE="${MAKE}"
53 else
54 if test "`make --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
55 GMAKE=make
56 else
57 if test "`gmake --version 2>/dev/null | sed -e 's/ [0-9].*//' -e 1q`" = 'GNU Make'; then
58 GMAKE=gmake
59 else
60 echo "*** - GNU Make not found" 1>&2
61 exit 1
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
70 exit 1
72 else
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
76 exit 1
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
83 exit 1
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 $?
88 done
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 $?
98 done
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 $?
101 done
102 for file in \
103 build-to-host.m4 \
104 codeset.m4 \
105 fcntl-o.m4 \
106 host-cpu-c-abi.m4 \
107 lib-ld.m4 \
108 relocatable.m4 \
109 relocatable-lib.m4 \
110 visibility.m4 \
111 ; do
112 cp -p srcm4/$file libcharset/m4/$file || exit $?
113 done
115 # ========== Generate files. ==========
117 $GMAKE -f Makefile.devel totally-clean all || exit $?
119 (cd libcharset
120 ./autogen.sh || exit $?
123 echo "$0: done. Now you can run './configure'."