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