annotate bootstrap @ 10314:07ebe522dac2

untabify liboctave C++ sources
author John W. Eaton <jwe@octave.org>
date Thu, 11 Feb 2010 12:23:32 -0500
parents 55061c7c8d6e
children dcee31e49f86
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9946
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
1 #! /bin/sh
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
3 # Bootstrap this package from checked-out sources.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
4
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
5 # Copyright (C) 2003-2009 Free Software Foundation, Inc.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
6
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
7 # This program is free software: you can redistribute it and/or modify
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
8 # it under the terms of the GNU General Public License as published by
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
9 # the Free Software Foundation, either version 3 of the License, or
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
10 # (at your option) any later version.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
11
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
12 # This program is distributed in the hope that it will be useful,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
15 # GNU General Public License for more details.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
16
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
19
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
20 # Written by Paul Eggert.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
21
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
22 nl='
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
23 '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
24
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
25 # Ensure file names are sorted consistently across platforms.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
26 LC_ALL=C
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
27 export LC_ALL
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
28
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
29 local_gl_dir=gl
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
30
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
31 # Temporary directory names.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
32 bt='._bootmp'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
33 bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
34 bt2=${bt}2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
35
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
36 usage() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
37 cat <<EOF
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
38 Usage: $0 [OPTION]...
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
39 Bootstrap this package from the checked-out sources.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
40
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
41 Options:
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
42 --gnulib-srcdir=DIRNAME Specify the local directory where gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
43 sources reside. Use this if you already
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
44 have gnulib sources on your machine, and
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
45 do not want to waste your bandwidth downloading
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
46 them again.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
47 --copy Copy files instead of creating symbolic links.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
48 --force Attempt to bootstrap even if the sources seem
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
49 not to have been checked out.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
50 --skip-po Do not download po files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
51
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
52 If the file $0.conf exists in the same directory as this script, its
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
53 contents are read as shell variables to configure the bootstrap.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
54
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
55 For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
56 are honored.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
57
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
58 Running without arguments will suffice in most cases.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
59 EOF
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
60 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
61
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
62 # Configuration.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
63
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
64 # Name of the Makefile.am
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
65 gnulib_mk=gnulib.mk
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
66
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
67 # List of gnulib modules needed.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
68 gnulib_modules=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
69
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
70 # Any gnulib files needed that are not in modules.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
71 gnulib_files=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
72
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
73 # A function to be called after everything else in this script.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
74 # Override it via your own definition in bootstrap.conf.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
75 bootstrap_epilogue() { :; }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
76
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
77 # The command to download all .po files for a specified domain into
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
78 # a specified directory. Fill in the first %s is the domain name, and
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
79 # the second with the destination directory. Use rsync's -L and -r
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
80 # options because the latest/%s directory and the .po files within are
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
81 # all symlinks.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
82 po_download_command_format=\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
83 "rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
84
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
85 extract_package_name='
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
86 /^AC_INIT(/{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
87 /.*,.*,.*, */{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
88 s///
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
89 s/[][]//g
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
90 s/)$//
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
91 p
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
92 q
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
93 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
94 s/AC_INIT(\[*//
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
95 s/]*,.*//
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
96 s/^GNU //
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
97 y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
98 s/[^A-Za-z0-9_]/-/g
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
99 p
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
100 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
101 '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
102 package=`sed -n "$extract_package_name" configure.ac` || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
103 gnulib_name=lib$package
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
104
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
105 build_aux=build-aux
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
106 source_base=lib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
107 m4_base=m4
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
108 doc_base=doc
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
109 tests_base=tests
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
110
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
111 # Extra files from gnulib, which override files from other sources.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
112 gnulib_extra_files="
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
113 $build_aux/install-sh
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
114 $build_aux/missing
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
115 $build_aux/mdate-sh
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
116 $build_aux/texinfo.tex
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
117 $build_aux/depcomp
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
118 $build_aux/config.guess
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
119 $build_aux/config.sub
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
120 doc/INSTALL
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
121 "
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
122
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
123 # Additional gnulib-tool options to use. Use "\newline" to break lines.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
124 gnulib_tool_option_extras=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
125
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
126 # Other locale categories that need message catalogs.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
127 EXTRA_LOCALE_CATEGORIES=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
128
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
129 # Additional xgettext options to use. Use "\\\newline" to break lines.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
130 XGETTEXT_OPTIONS='\\\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
131 --flag=_:1:pass-c-format\\\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
132 --flag=N_:1:pass-c-format\\\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
133 --flag=error:3:c-format --flag=error_at_line:5:c-format\\\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
134 '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
135
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
136 # Package bug report address for gettext files
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
137 MSGID_BUGS_ADDRESS=bug-$package@gnu.org
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
138
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
139 # Files we don't want to import.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
140 excluded_files=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
141
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
142 # File that should exist in the top directory of a checked out hierarchy,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
143 # but not in a distribution tarball.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
144 checkout_only_file=README-hacking
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
145
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
146 # Whether to use copies instead of symlinks.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
147 copy=false
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
148
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
149 # Set this to '.cvsignore .gitignore' in bootstrap.conf if you want
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
150 # those files to be generated in directories like lib/, m4/, and po/.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
151 # Or set it to 'auto' to make this script select which to use based
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
152 # on which version control system (if any) is used in the source directory.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
153 vc_ignore=auto
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
154
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
155 # find_tool ENVVAR NAMES...
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
156 # -------------------------
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
157 # Search for a required program. Use the value of ENVVAR, if set,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
158 # otherwise find the first of the NAMES that can be run (i.e.,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
159 # supports --version). If found, set ENVVAR to the program name,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
160 # die otherwise.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
161 find_tool ()
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
162 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
163 # Find sha1sum, named gsha1sum on MacPorts.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
164 find_tool_envvar=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
165 shift
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
166 find_tool_names=$@
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
167 eval "find_tool_res=\$$find_tool_envvar"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
168 if test x"$find_tool_res" = x; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
169 for i
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
170 do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
171 if ($i --version </dev/null) >/dev/null 2>&1; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
172 find_tool_res=$i
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
173 break
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
174 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
175 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
176 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
177 find_tool_error_prefix="\$$find_tool_envvar: "
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
178 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
179 if test x"$find_tool_res" = x; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
180 echo >&2 "$0: one of these is required: $find_tool_names"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
181 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
182 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
183 ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
184 echo >&2 "$0: ${find_tool_error_prefix}cannot run $find_tool_res --version"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
185 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
186 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
187 eval "$find_tool_envvar=\$find_tool_res"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
188 eval "export $find_tool_envvar"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
189 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
190
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
191 # Find sha1sum, named gsha1sum on MacPorts.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
192 find_tool SHA1SUM sha1sum gsha1sum
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
193
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
194 # Override the default configuration, if necessary.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
195 # Make sure that bootstrap.conf is sourced from the current directory
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
196 # if we were invoked as "sh bootstrap".
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
197 case "$0" in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
198 */*) test -r "$0.conf" && . "$0.conf" ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
199 *) test -r "$0.conf" && . ./"$0.conf" ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
200 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
201
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
202
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
203 if test "$vc_ignore" = auto; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
204 vc_ignore=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
205 test -d .git && vc_ignore=.gitignore
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
206 test -d CVS && vc_ignore="$vc_ignore .cvsignore"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
207 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
208
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
209 # Translate configuration into internal form.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
210
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
211 # Parse options.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
212
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
213 for option
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
214 do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
215 case $option in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
216 --help)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
217 usage
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
218 exit;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
219 --gnulib-srcdir=*)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
220 GNULIB_SRCDIR=`expr "X$option" : 'X--gnulib-srcdir=\(.*\)'`;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
221 --skip-po)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
222 SKIP_PO=t;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
223 --force)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
224 checkout_only_file=;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
225 --copy)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
226 copy=true;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
227 *)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
228 echo >&2 "$0: $option: unknown option"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
229 exit 1;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
230 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
231 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
232
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
233 if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
234 echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
235 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
236 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
237
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
238 # If $STR is not already on a line by itself in $FILE, insert it,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
239 # sorting the new contents of the file and replacing $FILE with the result.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
240 insert_sorted_if_absent() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
241 file=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
242 str=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
243 test -f $file || touch $file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
244 echo "$str" | sort -u - $file | cmp - $file > /dev/null \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
245 || echo "$str" | sort -u - $file -o $file \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
246 || exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
247 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
248
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
249 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
250 found_aux_dir=no
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
251 grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
252 >/dev/null && found_aux_dir=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
253 grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
254 >/dev/null && found_aux_dir=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
255 if test $found_aux_dir = no; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
256 echo "$0: expected line not found in configure.ac. Add the following:" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
257 echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
258 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
259 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
260
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
261 # If $build_aux doesn't exist, create it now, otherwise some bits
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
262 # below will malfunction. If creating it, also mark it as ignored.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
263 if test ! -d $build_aux; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
264 mkdir $build_aux
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
265 for dot_ig in x $vc_ignore; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
266 test $dot_ig = x && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
267 insert_sorted_if_absent $dot_ig $build_aux
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
268 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
269 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
270
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
271 # Note this deviates from the version comparison in automake
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
272 # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
273 # but this should suffice as we won't be specifying old
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
274 # version formats or redundant trailing .0 in bootstrap.conf.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
275 # If we did want full compatibility then we should probably
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
276 # use m4_version_compare from autoconf.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
277 sort_ver() { # sort -V is not generally available
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
278 ver1="$1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
279 ver2="$2"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
280
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
281 # split on '.' and compare each component
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
282 i=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
283 while : ; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
284 p1=$(echo "$ver1" | cut -d. -f$i)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
285 p2=$(echo "$ver2" | cut -d. -f$i)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
286 if [ ! "$p1" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
287 echo "$1 $2"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
288 break
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
289 elif [ ! "$p2" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
290 echo "$2 $1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
291 break
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
292 elif [ ! "$p1" = "$p2" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
293 if [ "$p1" -gt "$p2" ] 2>/dev/null; then # numeric comparison
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
294 echo "$2 $1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
295 elif [ "$p2" -gt "$p1" ] 2>/dev/null; then # numeric comparison
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
296 echo "$1 $2"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
297 else # numeric, then lexicographic comparison
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
298 lp=$(printf "$p1\n$p2\n" | LANG=C sort -n | tail -n1)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
299 if [ "$lp" = "$p2" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
300 echo "$1 $2"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
301 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
302 echo "$2 $1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
303 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
304 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
305 break
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
306 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
307 i=$(($i+1))
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
308 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
309 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
310
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
311 get_version() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
312 app=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
313
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
314 $app --version >/dev/null 2>&1 || return 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
315
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
316 $app --version 2>&1 |
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
317 sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
318 t done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
319 d
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
320 :done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
321 q'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
322 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
324 check_versions() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 ret=0
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
326
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327 while read app req_ver; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
328 # Honor $APP variables ($TAR, $AUTOCONF, etc.)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
329 appvar=`echo $app | tr '[a-z]' '[A-Z]'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
330 test "$appvar" = TAR && appvar=AMTAR
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
331 eval "app=\${$appvar-$app}"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
332 inst_ver=$(get_version $app)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
333 if [ ! "$inst_ver" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334 echo "Error: '$app' not found" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
335 ret=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336 elif [ ! "$req_ver" = "-" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
337 latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
338 if [ ! "$latest_ver" = "$inst_ver" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
339 echo "Error: '$app' version == $inst_ver is too old" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340 echo " '$app' version >= $req_ver is required" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
341 ret=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
343 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
345
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346 return $ret
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
347 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
348
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
349 print_versions() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
350 echo "Program Min_version"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
351 echo "----------------------"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
352 printf "$buildreq"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
353 echo "----------------------"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
354 # can't depend on column -t
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
355 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
356
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
357 if ! printf "$buildreq" | check_versions; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
358 test -f README-prereq &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
359 echo "See README-prereq for notes on obtaining these prerequisite programs:" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
360 echo
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361 print_versions
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
362 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
363 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
365 echo "$0: Bootstrapping from checked-out $package sources..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
366
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
367 # See if we can use gnulib's git-merge-changelog merge driver.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
368 if test -d .git && (git --version) >/dev/null 2>/dev/null ; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
369 if git config merge.merge-changelog.driver >/dev/null ; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
370 :
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
371 elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
372 echo "initializing git-merge-changelog driver"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
373 git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
374 git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
375 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376 echo "consider installing git-merge-changelog from gnulib"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
377 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
378 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
379
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
380
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
381 cleanup_gnulib() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
382 status=$?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
383 rm -fr gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
384 exit $status
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
385 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
386
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387 git_modules_config () {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388 test -f .gitmodules && git config --file .gitmodules "$@"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
389 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
390
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
391 # Get gnulib files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
393 case ${GNULIB_SRCDIR--} in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
394 -)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395 if git_modules_config submodule.gnulib.url >/dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
396 echo "$0: getting gnulib files..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397 git submodule init || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
398 git submodule update || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
399
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
400 elif [ ! -d gnulib ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401 echo "$0: getting gnulib files..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
402
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
403 trap cleanup_gnulib 1 2 13 15
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
404
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
405 git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
406 git clone $shallow git://git.sv.gnu.org/gnulib ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
407 cleanup_gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
409 trap - 1 2 13 15
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
410 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
411 GNULIB_SRCDIR=gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
412 ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
413 *)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414 # Redirect the gnulib submodule to the directory on the command line
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415 # if possible.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416 if test -d "$GNULIB_SRCDIR"/.git && \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
417 git_modules_config submodule.gnulib.url >/dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418 git submodule init
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419 GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420 git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
421 echo "$0: getting gnulib files..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
422 git submodule update || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
423 GNULIB_SRCDIR=gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
424 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425 ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
426 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
427
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
428 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
429 <$gnulib_tool || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
431 # Get translations.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
432
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
433 download_po_files() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
434 subdir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
435 domain=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
436 echo "$0: getting translations into $subdir for $domain..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
437 cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
438 eval "$cmd"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
439 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
440
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
441 # Download .po files to $po_dir/.reference and copy only the new
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442 # or modified ones into $po_dir. Also update $po_dir/LINGUAS.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
443 update_po_files() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
444 # Directory containing primary .po files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445 # Overwrite them only when we're sure a .po file is new.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
446 po_dir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447 domain=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
448
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449 # Download *.po files into this dir.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
450 # Usually contains *.s1 checksum files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
451 ref_po_dir="$po_dir/.reference"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
452
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
453 test -d $ref_po_dir || mkdir $ref_po_dir || return
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
454 download_po_files $ref_po_dir $domain \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
455 && ls "$ref_po_dir"/*.po 2>/dev/null |
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
456 sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
457
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
458 langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
459 test "$langs" = '*' && langs=x
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
460 for po in $langs; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
461 case $po in x) continue;; esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
462 new_po="$ref_po_dir/$po.po"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463 cksum_file="$ref_po_dir/$po.s1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
464 if ! test -f "$cksum_file" ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
465 ! test -f "$po_dir/$po.po" ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
466 ! $SHA1SUM -c --status "$cksum_file" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
467 < "$new_po" > /dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
468 echo "updated $po_dir/$po.po..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
469 cp "$new_po" "$po_dir/$po.po" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470 && $SHA1SUM < "$new_po" > "$cksum_file"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
471 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
472 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
473 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
474
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475 case $SKIP_PO in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
476 '')
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477 if test -d po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
478 update_po_files po $package || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
479 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
480
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
481 if test -d runtime-po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
482 update_po_files runtime-po $package-runtime || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
483 fi;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
484 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
485
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
486 symlink_to_dir()
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
487 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
488 src=$1/$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
489 dst=${3-$2}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
490
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
491 test -f "$src" && {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
492
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
493 # If the destination directory doesn't exist, create it.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
494 # This is required at least for "lib/uniwidth/cjk.h".
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
495 dst_dir=`dirname "$dst"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
496 if ! test -d "$dst_dir"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497 mkdir -p "$dst_dir"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
498
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
499 # If we've just created a directory like lib/uniwidth,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500 # tell version control system(s) it's ignorable.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
501 # FIXME: for now, this does only one level
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
502 parent=`dirname "$dst_dir"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503 for dot_ig in x $vc_ignore; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
504 test $dot_ig = x && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
505 ig=$parent/$dot_ig
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
506 insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
507 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
508 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
509
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
510 if $copy; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
511 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512 test ! -h "$dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
513 echo "$0: rm -f $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
514 rm -f "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
516 } &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
517 test -f "$dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
518 cmp -s "$src" "$dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519 echo "$0: cp -fp $src $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
520 cp -fp "$src" "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
521 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
522 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523 test -h "$dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
524 src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525 dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
526 test "$src_i" = "$dst_i" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
527 dot_dots=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
528 case $src in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
529 /*) ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530 *)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
531 case /$dst/ in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
532 *//* | */../* | */./* | /*/*/*/*/*/)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
534 exit 1;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
535 /*/*/*/*/) dot_dots=../../../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
536 /*/*/*/) dot_dots=../../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
537 /*/*/) dot_dots=../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
538 esac;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
540
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
541 echo "$0: ln -fs $dot_dots$src $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
542 ln -fs "$dot_dots$src" "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
543 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
544 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
545 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
546 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
547
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
548 cp_mark_as_generated()
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
549 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
550 cp_src=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
551 cp_dst=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
552
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
553 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554 symlink_to_dir "$GNULIB_SRCDIR" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
555 elif cmp -s "$cp_src" "$local_gl_dir/$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
556 symlink_to_dir $local_gl_dir "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
557 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558 case $cp_dst in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
559 *.[ch]) c1='/* '; c2=' */';;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
560 *.texi) c1='@c '; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
561 *.m4|*/Make*|Make*) c1='# ' ; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
562 *) c1= ; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
563 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
565 # If the destination directory doesn't exist, create it.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
566 # This is required at least for "lib/uniwidth/cjk.h".
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
567 dst_dir=`dirname "$cp_dst"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
568 test -d "$dst_dir" || mkdir -p "$dst_dir"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
569
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
570 if test -z "$c1"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
571 cmp -s "$cp_src" "$cp_dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
572 # Copy the file first to get proper permissions if it
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
573 # doesn't already exist. Then overwrite the copy.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
574 echo "$0: cp -f $cp_src $cp_dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
575 rm -f "$cp_dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
576 cp "$cp_src" "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
577 sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
578 mv -f "$cp_dst-t" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
579 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
580 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
581 # Copy the file first to get proper permissions if it
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
582 # doesn't already exist. Then overwrite the copy.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
583 cp "$cp_src" "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
584 (
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
585 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
586 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
587 sed "s!$bt_regex/!!g" "$cp_src"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
588 ) > $cp_dst-t &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
589 if cmp -s "$cp_dst-t" "$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
590 rm -f "$cp_dst-t"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
591 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
592 echo "$0: cp $cp_src $cp_dst # with edits" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
593 mv -f "$cp_dst-t" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
594 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
595 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
597 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
599 version_controlled_file() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
600 dir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
601 file=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
602 found=no
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
603 if test -d CVS; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
604 grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
605 grep '^/[^/]*/[0-9]' > /dev/null && found=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
606 elif test -d .git; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
607 git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
608 elif test -d .svn; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
609 svn log -r HEAD "$dir/$file" > /dev/null 2>&1 && found=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
610 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
611 echo "$0: no version control for $dir/$file?" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
612 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
613 test $found = yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
614 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
615
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
616 slurp() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
617 for dir in . `(cd $1 && find * -type d -print)`; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
618 copied=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
619 sep=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
620 for file in `ls -a $1/$dir`; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
621 case $file in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
622 .|..) continue;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
623 .*) continue;; # FIXME: should all file names starting with "." be ignored?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
624 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
625 test -d $1/$dir/$file && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
626 for excluded_file in $excluded_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
627 test "$dir/$file" = "$excluded_file" && continue 2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
628 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
629 if test $file = Makefile.am; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
630 copied=$copied${sep}$gnulib_mk; sep=$nl
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
631 remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
632 sed "$remove_intl" $1/$dir/$file | cmp - $dir/$gnulib_mk > /dev/null || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
633 echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
634 rm -f $dir/$gnulib_mk &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
635 sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
636 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
637 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
638 version_controlled_file $dir $file; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
639 echo "$0: $dir/$file overrides $1/$dir/$file"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
640 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
641 copied=$copied$sep$file; sep=$nl
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
642 if test $file = gettext.m4; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
643 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
644 rm -f $dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
645 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
646 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
647 AC_DEFUN([AM_INTL_SUBDIR], [
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
648 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
649 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
650 $a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
651 AC_DEFUN([gl_LOCK_EARLY], [])
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
652 ' $1/$dir/$file >$dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
653 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
654 cp_mark_as_generated $1/$dir/$file $dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
655 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
656 fi || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
657 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
658
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
659 for dot_ig in x $vc_ignore; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
660 test $dot_ig = x && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
661 ig=$dir/$dot_ig
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
662 if test -n "$copied"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
663 insert_sorted_if_absent $ig "$copied"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
664 # If an ignored file name ends with .in.h, then also add
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
665 # the name with just ".h". Many gnulib headers are generated,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
666 # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
667 # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
668 f=`echo "$copied"|sed 's/\.in\.h$/.h/;s/\.sin$/.sed/;s/\.y$/.c/;s/\.gperf$/.h/'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
669 insert_sorted_if_absent $ig "$f"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
670
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
671 # For files like sys_stat.in.h and sys_time.in.h, record as
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
672 # ignorable the directory we might eventually create: sys/.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
673 f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
674 insert_sorted_if_absent $ig "$f"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
675 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
676 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
677 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
678 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
679
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
680
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
681 # Create boot temporary directories to import from gnulib and gettext.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
682 rm -fr $bt $bt2 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
683 mkdir $bt $bt2 || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
684
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
685 # Import from gnulib.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
686
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
687 gnulib_tool_options="\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
688 --import\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
689 --no-changelog\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
690 --aux-dir $bt/$build_aux\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
691 --doc-base $bt/$doc_base\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
692 --lib $gnulib_name\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
693 --m4-base $bt/$m4_base/\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
694 --source-base $bt/$source_base/\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
695 --tests-base $bt/$tests_base\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
696 --local-dir $local_gl_dir\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
697 $gnulib_tool_option_extras\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
698 "
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
699 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
700 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
701 slurp $bt || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
702
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
703 for file in $gnulib_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
704 symlink_to_dir "$GNULIB_SRCDIR" $file || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
705 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
706
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
707
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
708 # Import from gettext.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
709 with_gettext=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
710 grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
711 with_gettext=no
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
712
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
713 if test $with_gettext = yes; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
714 echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
715 cp configure.ac $bt2 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
716 (cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
717 slurp $bt2 $bt || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
718 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
719 rm -fr $bt $bt2 || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
720
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
721 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
722 # gnulib-populated directories. Such .m4 files would cause aclocal to fail.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
723 # The following requires GNU find 4.2.3 or newer. Considering the usual
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
724 # portability constraints of this script, that may seem a very demanding
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
725 # requirement, but it should be ok. Ignore any failure, which is fine,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
726 # since this is only a convenience to help developers avoid the relatively
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
727 # unusual case in which a symlinked-to .m4 file is git-removed from gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
728 # between successive runs of this script.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
729 find "$m4_base" "$source_base" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
730 -depth \( -name '*.m4' -o -name '*.[ch]' \) \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
731 -type l -xtype l -delete > /dev/null 2>&1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
732
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
733 # Reconfigure, getting other files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
734
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
735 # Skip autoheader if it's not needed.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
736 grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
737 AUTOHEADER=true
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
738
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
739 for command in \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
740 libtool \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
741 "${ACLOCAL-aclocal} --force -I m4" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
742 "${AUTOCONF-autoconf} --force" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
743 "${AUTOHEADER-autoheader} --force" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
744 "${AUTOMAKE-automake} --add-missing --copy --force-missing"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
745 do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
746 if test "$command" = libtool; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
747 use_libtool=0
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
748 # We'd like to use grep -E, to see if any of LT_INIT,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
749 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
750 # but that's not portable enough (e.g., for Solaris).
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
751 grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
752 && use_libtool=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
753 grep '^[ ]*LT_INIT' configure.ac >/dev/null \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
754 && use_libtool=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
755 test $use_libtool = 0 \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
756 && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
757 command="${LIBTOOLIZE-libtoolize} -c -f"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
758 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
759 echo "$0: $command ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
760 $command || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
761 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
762
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
763
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
764 # Get some extra files from gnulib, overriding existing files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
765 for file in $gnulib_extra_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
766 case $file in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
767 */INSTALL) dst=INSTALL;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
768 build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
769 *) dst=$file;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
770 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
771 symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
772 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
773
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
774 if test $with_gettext = yes; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
775 # Create gettext configuration.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
776 echo "$0: Creating po/Makevars from po/Makevars.template ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
777 rm -f po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
778 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
779 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
780 /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
781 /^XGETTEXT_OPTIONS *=/{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
782 s/$/ \\/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
783 a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
784 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
785 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
786 ' po/Makevars.template >po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
787
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
788 if test -d runtime-po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
789 # Similarly for runtime-po/Makevars, but not quite the same.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
790 rm -f runtime-po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
791 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
792 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
793 /^subdir *=.*/s/=.*/= runtime-po/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
794 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
795 /^XGETTEXT_OPTIONS *=/{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
796 s/$/ \\/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
797 a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
798 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
799 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
800 ' <po/Makevars.template >runtime-po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
801
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
802 # Copy identical files from po to runtime-po.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
803 (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
804 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
805 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
806
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
807 bootstrap_epilogue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
808
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
809 echo "$0: done. Now you can run './configure'."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
810
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
811 # Local Variables:
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
812 # indent-tabs-mode: nil
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
813 # End: