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. 6# 7# This script requires autoconf-2.63..2.69 and automake-1.11..1.16 in the PATH. 8# If not used from a released tarball, it also requires 9# - the GNULIB_SRCDIR environment variable pointing to a gnulib checkout. 10 11# Copyright (C) 2003-2020 Free Software Foundation, Inc. 12# 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. 17# 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. 22# 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/>. 25 26# Usage: ./autogen.sh [--skip-gnulib] 27# 28# Usage from a git checkout: ./autogen.sh 29# This uses an up-to-date gnulib checkout. 30# 31# Usage from a released tarball: ./autogen.sh --skip-gnulib 32# This does not use a gnulib checkout. 33 34skip_gnulib=false 35while :; do 36 case "$1" in 37 --skip-gnulib) skip_gnulib=true; shift;; 38 *) break ;; 39 esac 40done 41 42TEXINFO_VERSION=6.5 43 44if test $skip_gnulib = false; then 45 mkdir -p build-aux 46 # texinfo.tex 47 # The most recent snapshot of it is available in the gnulib repository. 48 # But this is a snapshot, with all possible dangers. 49 # A stable release of it is available through "automake --add-missing --copy", 50 # but that depends on the Automake version. So take the version which matches 51 # the latest stable texinfo release. 52 if test ! -f build-aux/texinfo.tex; then 53 { wget -q --timeout=5 -O build-aux/texinfo.tex.tmp 'https://git.savannah.gnu.org/gitweb/?p=texinfo.git;a=blob_plain;f=doc/texinfo.tex;hb=refs/tags/texinfo-'"$TEXINFO_VERSION" \ 54 && mv build-aux/texinfo.tex.tmp build-aux/texinfo.tex; \ 55 } || rm -f build-aux/texinfo.tex.tmp 56 fi 57 58 if test -n "$GNULIB_SRCDIR"; then 59 test -d "$GNULIB_SRCDIR" || { 60 echo "*** GNULIB_SRCDIR is set but does not point to an existing directory." 1>&2 61 exit 1 62 } 63 else 64 GNULIB_SRCDIR=`pwd`/gnulib 65 test -d "$GNULIB_SRCDIR" || { 66 echo "*** Subdirectory 'gnulib' does not yet exist. Use './gitsub.sh pull' to create it, or set the environment variable GNULIB_SRCDIR." 1>&2 67 exit 1 68 } 69 fi 70 # Now it should contain a gnulib-tool. 71 GNULIB_TOOL="$GNULIB_SRCDIR/gnulib-tool" 72 test -f "$GNULIB_TOOL" || { 73 echo "*** gnulib-tool not found." 1>&2 74 exit 1 75 } 76 GNULIB_MODULES=' 77 ostream 78 fd-ostream 79 file-ostream 80 html-ostream 81 iconv-ostream 82 memory-ostream 83 term-ostream 84 styled-ostream 85 html-styled-ostream 86 noop-styled-ostream 87 term-styled-ostream 88 filename 89 isatty 90 largefile 91 vasprintf-posix 92 xalloc 93 xconcat-filename 94 95 memory-ostream-tests 96 term-ostream-tests 97 ' 98 $GNULIB_TOOL --lib=libtextstyle --source-base=lib --m4-base=gnulib-m4 --tests-base=tests \ 99 --macro-prefix=lts \ 100 --makefile-name=Makefile.gnulib --libtool \ 101 --local-dir=gnulib-local --local-dir=../gnulib-local \ 102 --import $GNULIB_MODULES 103 $GNULIB_TOOL --copy-file build-aux/config.guess; chmod a+x build-aux/config.guess 104 $GNULIB_TOOL --copy-file build-aux/config.sub; chmod a+x build-aux/config.sub 105 $GNULIB_TOOL --copy-file build-aux/declared.sh lib/declared.sh; chmod a+x lib/declared.sh 106 $GNULIB_TOOL --copy-file build-aux/run-test; chmod a+x build-aux/run-test 107 $GNULIB_TOOL --copy-file build-aux/test-driver.diff 108 # If we got no texinfo.tex so far, take the snapshot from gnulib. 109 if test ! -f build-aux/texinfo.tex; then 110 $GNULIB_TOOL --copy-file build-aux/texinfo.tex 111 fi 112 # For use by the example programs. 113 $GNULIB_TOOL --copy-file m4/libtextstyle.m4 114fi 115 116# Copy some files from gettext. 117cp -p ../INSTALL.windows . 118mkdir -p m4 119cp -p ../m4/libtool.m4 m4/ 120cp -p ../m4/lt*.m4 m4/ 121cp -p ../m4/woe32-dll.m4 m4/ 122cp -p ../build-aux/ltmain.sh build-aux/ 123cp -p ../build-aux/texi2html build-aux/ 124cp -p ../gettext-tools/m4/exported.m4 m4/ 125cp -p ../gettext-tools/libgettextpo/exported.sh.in lib/ 126 127aclocal -I m4 -I gnulib-m4 128autoconf 129autoheader && touch config.h.in 130touch ChangeLog 131# Make sure we get new versions of files brought in by automake. 132(cd build-aux && rm -f ar-lib compile depcomp install-sh mdate-sh missing test-driver) 133automake --add-missing --copy 134# Support environments where sh exists but not /bin/sh (Android). 135patch build-aux/test-driver < build-aux/test-driver.diff 136# Get rid of autom4te.cache directory. 137rm -rf autom4te.cache 138