annotate bootstrap @ 11117:3cbc0d77db48 ss-3-3-53

update version info for snapshot
author John W. Eaton <jwe@octave.org>
date Tue, 19 Oct 2010 02:25:32 -0400
parents dcee31e49f86
children 00fe5069b70e
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
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
5 # Copyright (C) 2003-2010 Free Software Foundation, Inc.
9946
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
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
191 # Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
192 find_tool SHA1SUM sha1sum gsha1sum shasum
9946
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 |
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
317 sed -n '# extract version within line
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
318 s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
319 t done
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
320
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
321 # extract version at start of line
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
322 s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
9946
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
323 t done
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
324
9946
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
325 d
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
326
9946
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
327 :done
10347
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
328 #the following essentially does s/5.005/5.5/
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
329 s/\.0*\([1-9]\)/.\1/g
dcee31e49f86 update bootstrap script from gnulib/build-aux/bootstrap
John W. Eaton <jwe@octave.org>
parents: 9946
diff changeset
330 p
9946
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
331 q'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
332 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
333
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
334 check_versions() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
335 ret=0
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
336
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
337 while read app req_ver; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
338 # Honor $APP variables ($TAR, $AUTOCONF, etc.)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
339 appvar=`echo $app | tr '[a-z]' '[A-Z]'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
340 test "$appvar" = TAR && appvar=AMTAR
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
341 eval "app=\${$appvar-$app}"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
342 inst_ver=$(get_version $app)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
343 if [ ! "$inst_ver" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
344 echo "Error: '$app' not found" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
345 ret=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
346 elif [ ! "$req_ver" = "-" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
347 latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
348 if [ ! "$latest_ver" = "$inst_ver" ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
349 echo "Error: '$app' version == $inst_ver is too old" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
350 echo " '$app' version >= $req_ver is required" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
351 ret=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
352 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
353 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
354 done
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 return $ret
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
357 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
358
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
359 print_versions() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
360 echo "Program Min_version"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
361 echo "----------------------"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
362 printf "$buildreq"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
363 echo "----------------------"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
364 # can't depend on column -t
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
365 }
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 if ! printf "$buildreq" | check_versions; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
368 test -f README-prereq &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
369 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
370 echo
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
371 print_versions
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
372 exit 1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
373 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
374
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
375 echo "$0: Bootstrapping from checked-out $package sources..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
376
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
377 # 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
378 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
379 if git config merge.merge-changelog.driver >/dev/null ; then
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 elif (git-merge-changelog --version) >/dev/null 2>/dev/null ; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
382 echo "initializing git-merge-changelog driver"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
383 git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
384 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
385 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
386 echo "consider installing git-merge-changelog from gnulib"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
387 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
388 fi
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 cleanup_gnulib() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
392 status=$?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
393 rm -fr gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
394 exit $status
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
395 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
396
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
397 git_modules_config () {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
398 test -f .gitmodules && git config --file .gitmodules "$@"
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
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
401 # Get 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 case ${GNULIB_SRCDIR--} in
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 if git_modules_config submodule.gnulib.url >/dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
406 echo "$0: getting gnulib files..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
407 git submodule init || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
408 git submodule update || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
409
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
410 elif [ ! -d gnulib ]; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
411 echo "$0: getting gnulib files..."
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 trap cleanup_gnulib 1 2 13 15
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
414
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
415 git clone --help|grep depth > /dev/null && shallow='--depth 2' || shallow=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
416 git clone $shallow git://git.sv.gnu.org/gnulib ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
417 cleanup_gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
418
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
419 trap - 1 2 13 15
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
420 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
421 GNULIB_SRCDIR=gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
422 ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
423 *)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
424 # Redirect the gnulib submodule to the directory on the command line
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
425 # if possible.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
426 if test -d "$GNULIB_SRCDIR"/.git && \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
427 git_modules_config submodule.gnulib.url >/dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
428 git submodule init
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
429 GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
430 git_modules_config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
431 echo "$0: getting gnulib files..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
432 git submodule update || exit $?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
433 GNULIB_SRCDIR=gnulib
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
434 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
435 ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
436 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
437
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
438 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
439 <$gnulib_tool || exit
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 # Get translations.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
442
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
443 download_po_files() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
444 subdir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
445 domain=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
446 echo "$0: getting translations into $subdir for $domain..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
447 cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
448 eval "$cmd"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
449 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
450
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
451 # 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
452 # or modified ones into $po_dir. Also update $po_dir/LINGUAS.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
453 update_po_files() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
454 # Directory containing primary .po files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
455 # 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
456 po_dir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
457 domain=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
458
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
459 # Download *.po files into this dir.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
460 # Usually contains *.s1 checksum files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
461 ref_po_dir="$po_dir/.reference"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
462
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
463 test -d $ref_po_dir || mkdir $ref_po_dir || return
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
464 download_po_files $ref_po_dir $domain \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
465 && ls "$ref_po_dir"/*.po 2>/dev/null |
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
466 sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
467
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
468 langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
469 test "$langs" = '*' && langs=x
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
470 for po in $langs; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
471 case $po in x) continue;; esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
472 new_po="$ref_po_dir/$po.po"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
473 cksum_file="$ref_po_dir/$po.s1"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
474 if ! test -f "$cksum_file" ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
475 ! test -f "$po_dir/$po.po" ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
476 ! $SHA1SUM -c --status "$cksum_file" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
477 < "$new_po" > /dev/null; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
478 echo "updated $po_dir/$po.po..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
479 cp "$new_po" "$po_dir/$po.po" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
480 && $SHA1SUM < "$new_po" > "$cksum_file"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
481 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
482 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
483 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
484
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
485 case $SKIP_PO in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
486 '')
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
487 if test -d po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
488 update_po_files po $package || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
489 fi
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 if test -d runtime-po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
492 update_po_files runtime-po $package-runtime || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
493 fi;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
494 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
495
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
496 symlink_to_dir()
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
497 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
498 src=$1/$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
499 dst=${3-$2}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
500
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
501 test -f "$src" && {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
502
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
503 # If the destination directory doesn't exist, create it.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
504 # This is required at least for "lib/uniwidth/cjk.h".
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
505 dst_dir=`dirname "$dst"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
506 if ! test -d "$dst_dir"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
507 mkdir -p "$dst_dir"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
508
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
509 # If we've just created a directory like lib/uniwidth,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
510 # tell version control system(s) it's ignorable.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
511 # FIXME: for now, this does only one level
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
512 parent=`dirname "$dst_dir"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
513 for dot_ig in x $vc_ignore; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
514 test $dot_ig = x && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
515 ig=$parent/$dot_ig
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
516 insert_sorted_if_absent $ig `echo "$dst_dir"|sed 's,.*/,,'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
517 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
518 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
519
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
520 if $copy; then
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 test ! -h "$dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
523 echo "$0: rm -f $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
524 rm -f "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
525 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
526 } &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
527 test -f "$dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
528 cmp -s "$src" "$dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
529 echo "$0: cp -fp $src $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
530 cp -fp "$src" "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
531 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
532 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
533 test -h "$dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
534 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
535 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
536 test "$src_i" = "$dst_i" || {
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 case $src in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
539 /*) ;;
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 case /$dst/ in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
542 *//* | */../* | */./* | /*/*/*/*/*/)
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
543 echo >&2 "$0: invalid symlink calculation: $src -> $dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
544 exit 1;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
545 /*/*/*/*/) dot_dots=../../../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
546 /*/*/*/) dot_dots=../../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
547 /*/*/) dot_dots=../;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
548 esac;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
549 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
550
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
551 echo "$0: ln -fs $dot_dots$src $dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
552 ln -fs "$dot_dots$src" "$dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
553 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
554 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
555 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
556 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
557
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
558 cp_mark_as_generated()
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
559 {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
560 cp_src=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
561 cp_dst=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
562
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
563 if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
564 symlink_to_dir "$GNULIB_SRCDIR" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
565 elif cmp -s "$cp_src" "$local_gl_dir/$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
566 symlink_to_dir $local_gl_dir "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
567 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
568 case $cp_dst in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
569 *.[ch]) c1='/* '; c2=' */';;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
570 *.texi) c1='@c '; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
571 *.m4|*/Make*|Make*) c1='# ' ; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
572 *) c1= ; c2= ;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
573 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
574
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
575 # If the destination directory doesn't exist, create it.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
576 # This is required at least for "lib/uniwidth/cjk.h".
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
577 dst_dir=`dirname "$cp_dst"`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
578 test -d "$dst_dir" || mkdir -p "$dst_dir"
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 if test -z "$c1"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
581 cmp -s "$cp_src" "$cp_dst" || {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
582 # Copy the file first to get proper permissions if it
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
583 # doesn't already exist. Then overwrite the copy.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
584 echo "$0: cp -f $cp_src $cp_dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
585 rm -f "$cp_dst" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
586 cp "$cp_src" "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
587 sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
588 mv -f "$cp_dst-t" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
589 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
590 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
591 # Copy the file first to get proper permissions if it
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
592 # doesn't already exist. Then overwrite the copy.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
593 cp "$cp_src" "$cp_dst-t" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
594 (
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
595 echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
596 echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
597 sed "s!$bt_regex/!!g" "$cp_src"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
598 ) > $cp_dst-t &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
599 if cmp -s "$cp_dst-t" "$cp_dst"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
600 rm -f "$cp_dst-t"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
601 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
602 echo "$0: cp $cp_src $cp_dst # with edits" &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
603 mv -f "$cp_dst-t" "$cp_dst"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
604 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
605 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
606 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
607 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
608
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
609 version_controlled_file() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
610 dir=$1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
611 file=$2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
612 found=no
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
613 if test -d CVS; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
614 grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
615 grep '^/[^/]*/[0-9]' > /dev/null && found=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
616 elif test -d .git; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
617 git rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
618 elif test -d .svn; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
619 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
620 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
621 echo "$0: no version control for $dir/$file?" >&2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
622 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
623 test $found = yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
624 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
625
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
626 slurp() {
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
627 for dir in . `(cd $1 && find * -type d -print)`; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
628 copied=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
629 sep=
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
630 for file in `ls -a $1/$dir`; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
631 case $file in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
632 .|..) continue;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
633 .*) continue;; # FIXME: should all file names starting with "." be ignored?
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
634 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
635 test -d $1/$dir/$file && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
636 for excluded_file in $excluded_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
637 test "$dir/$file" = "$excluded_file" && continue 2
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
638 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
639 if test $file = Makefile.am; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
640 copied=$copied${sep}$gnulib_mk; sep=$nl
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
641 remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
642 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
643 echo "$0: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
644 rm -f $dir/$gnulib_mk &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
645 sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
646 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
647 elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
648 version_controlled_file $dir $file; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
649 echo "$0: $dir/$file overrides $1/$dir/$file"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
650 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
651 copied=$copied$sep$file; sep=$nl
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
652 if test $file = gettext.m4; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
653 echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
654 rm -f $dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
655 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
656 /^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
657 AC_DEFUN([AM_INTL_SUBDIR], [
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
658 /^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
659 AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
660 $a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
661 AC_DEFUN([gl_LOCK_EARLY], [])
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
662 ' $1/$dir/$file >$dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
663 else
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
664 cp_mark_as_generated $1/$dir/$file $dir/$file
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
665 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
666 fi || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
667 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
668
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
669 for dot_ig in x $vc_ignore; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
670 test $dot_ig = x && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
671 ig=$dir/$dot_ig
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
672 if test -n "$copied"; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
673 insert_sorted_if_absent $ig "$copied"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
674 # 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
675 # the name with just ".h". Many gnulib headers are generated,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
676 # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
677 # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
678 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
679 insert_sorted_if_absent $ig "$f"
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 # 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
682 # ignorable the directory we might eventually create: sys/.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
683 f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
684 insert_sorted_if_absent $ig "$f"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
685 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
686 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
687 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
688 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
689
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
690
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
691 # Create boot temporary directories to import from gnulib and gettext.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
692 rm -fr $bt $bt2 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
693 mkdir $bt $bt2 || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
694
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
695 # Import from gnulib.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
696
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
697 gnulib_tool_options="\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
698 --import\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
699 --no-changelog\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
700 --aux-dir $bt/$build_aux\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
701 --doc-base $bt/$doc_base\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
702 --lib $gnulib_name\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
703 --m4-base $bt/$m4_base/\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
704 --source-base $bt/$source_base/\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
705 --tests-base $bt/$tests_base\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
706 --local-dir $local_gl_dir\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
707 $gnulib_tool_option_extras\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
708 "
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
709 echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
710 $gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
711 slurp $bt || exit
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 for file in $gnulib_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
714 symlink_to_dir "$GNULIB_SRCDIR" $file || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
715 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
716
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
717
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
718 # Import from gettext.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
719 with_gettext=yes
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
720 grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
721 with_gettext=no
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
722
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
723 if test $with_gettext = yes; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
724 echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
725 cp configure.ac $bt2 &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
726 (cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
727 slurp $bt2 $bt || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
728 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
729 rm -fr $bt $bt2 || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
730
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
731 # Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
732 # gnulib-populated directories. Such .m4 files would cause aclocal to fail.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
733 # 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
734 # portability constraints of this script, that may seem a very demanding
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
735 # 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
736 # 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
737 # 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
738 # between successive runs of this script.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
739 find "$m4_base" "$source_base" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
740 -depth \( -name '*.m4' -o -name '*.[ch]' \) \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
741 -type l -xtype l -delete > /dev/null 2>&1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
742
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
743 # Reconfigure, getting other files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
744
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
745 # Skip autoheader if it's not needed.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
746 grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
747 AUTOHEADER=true
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
748
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
749 for command in \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
750 libtool \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
751 "${ACLOCAL-aclocal} --force -I m4" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
752 "${AUTOCONF-autoconf} --force" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
753 "${AUTOHEADER-autoheader} --force" \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
754 "${AUTOMAKE-automake} --add-missing --copy --force-missing"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
755 do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
756 if test "$command" = libtool; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
757 use_libtool=0
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
758 # 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
759 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
760 # but that's not portable enough (e.g., for Solaris).
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
761 grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
762 && use_libtool=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
763 grep '^[ ]*LT_INIT' configure.ac >/dev/null \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
764 && use_libtool=1
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
765 test $use_libtool = 0 \
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
766 && continue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
767 command="${LIBTOOLIZE-libtoolize} -c -f"
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
768 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
769 echo "$0: $command ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
770 $command || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
771 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
772
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 # Get some extra files from gnulib, overriding existing files.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
775 for file in $gnulib_extra_files; do
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
776 case $file in
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
777 */INSTALL) dst=INSTALL;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
778 build-aux/*) dst=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
779 *) dst=$file;;
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
780 esac
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
781 symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
782 done
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
783
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
784 if test $with_gettext = yes; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
785 # Create gettext configuration.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
786 echo "$0: Creating po/Makevars from po/Makevars.template ..."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
787 rm -f po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
788 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
789 /^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
790 /^MSGID_BUGS_ADDRESS *=/s/=.*/= '"$MSGID_BUGS_ADDRESS"'/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
791 /^XGETTEXT_OPTIONS *=/{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
792 s/$/ \\/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
793 a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
794 '"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
795 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
796 ' po/Makevars.template >po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
797
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
798 if test -d runtime-po; then
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
799 # Similarly for runtime-po/Makevars, but not quite the same.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
800 rm -f runtime-po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
801 sed '
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
802 /^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
803 /^subdir *=.*/s/=.*/= runtime-po/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
804 /^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
805 /^XGETTEXT_OPTIONS *=/{
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
806 s/$/ \\/
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
807 a\
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
808 '"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
809 }
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
810 ' <po/Makevars.template >runtime-po/Makevars
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
811
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
812 # Copy identical files from po to runtime-po.
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
813 (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
814 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
815 fi
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
816
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
817 bootstrap_epilogue
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
818
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
819 echo "$0: done. Now you can run './configure'."
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
820
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
821 # Local Variables:
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
822 # indent-tabs-mode: nil
55061c7c8d6e start using gnulib
John W. Eaton <jwe@octave.org>
parents:
diff changeset
823 # End: