-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·3107 lines (2500 loc) · 85.7 KB
/
Copy pathbootstrap
File metadata and controls
executable file
·3107 lines (2500 loc) · 85.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#! /bin/sh
# Print a version string.
scriptversion=2011-08-19.18; # UTC
# Bootstrap this package from checked-out sources.
# Written by Gary V. Vaughan, 2010
# Copyright (C) 2010 Free Software Foundation, Inc.
# This is free software; see the source for copying conditions. There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Originally written by Paul Eggert. The canonical version of this
# script is maintained as build-aux/bootstrap in gnulib, however, to
# be useful to your project, you should place a copy of it under
# version control in the top-level directory of your project. The
# intent is that all customization can be done with a bootstrap.conf
# file also maintained in your version control; gnulib comes with a
# template build-aux/bootstrap.conf to get you started.
# Please report bugs or propose patches to bug-gnulib@gnu.org.
## ================================================================== ##
## ##
## DO NOT EDIT THIS FILE, CUSTOMIZE IT USING A BOOTSTRAP.CONF ##
## ##
## ================================================================== ##
## ------------------------------- ##
## User overridable command paths. ##
## ------------------------------- ##
# All uppercase denotes values stored in the environment. These
# variables should generally be overridden by the user - however, we do
# set them to `true' in some parts of this script to prevent them being
# called at the wrong time by other tools that we call (`autoreconf',
# for example).
#
# We also allow `LIBTOOLIZE' and `M4' to be overridden, and export the
# result for child processes, but they are handled by the function
# `func_find_tool' and not defaulted in this section.
: "${ACLOCAL=aclocal}"
: "${AUTOCONF=autoconf}"
: "${AUTOHEADER=autoheader}"
: "${AUTOM4TE=autom4te}"
: "${AUTOHEADER=autoheader}"
: "${AUTOMAKE=automake}"
: "${AUTOPOINT=autopoint}"
: "${AUTORECONF=autoreconf}"
: "${CMP=cmp}"
: "${CONFIG_SHELL=/bin/sh}"
: "${DIFF=diff}"
: "${EGREP=egrep}"
: "${FGREP=fgrep}"
: "${GIT=git}"
: "${GREP=grep}"
: "${LN_S=ln -s}"
: "${RM=rm}"
: "${SED=sed}"
export ACLOCAL
export AUTOCONF
export AUTOHEADER
export AUTOM4TE
export AUTOHEADER
export AUTOMAKE
export AUTOPOINT
export AUTORECONF
## -------------- ##
## Configuration. ##
## -------------- ##
# Short help message in response to `-h'. Add to this in `bootstrap.conf'
# if you accept any additional options.
usage_message="Bootstrap this package from the checked-out sources.
Common Bootstrap Options:
-c, --copy copy files instead of creating symbolic links.
--debug enable verbose shell tracing
-n, --dry-run print commands rather than running them
-f, --force attempt to bootstrap even if the sources seem not to have
been checked out.
--gnulib-srcdir=DIRNAME
specify a local directory where gnulib sources reside.
Use this if you already have the gnulib sources on your
machine, and don't want to waste your bandwidth
downloading them again. Defaults to \$GNULIB_SRCDIR.
--skip-git do not fetch files from remote repositories
--skip-po do not download po files.
-v, --verbose verbosely report processing
--version print version information and exit
-W, --warnings=CATEGORY
report the warnings falling in CATEGORY [all]
-h, --help print short or long help message and exit
"
# Warning categories used by `bootstrap', append others if you use them
# in your `bootstrap.conf'.
warning_categories="recommend settings upgrade"
# Additional text appended to `usage_message' in response to `--help'.
long_help_message="
Warning categories include:
\`all' show all warnings
\`none' turn off all the warnings
\`error' warnings are treated as fatal errors
\`recommend' show warnings about missing recommended packages
\`settings' show warnings about missing \`bootstrap.conf' settings
\`upgrade' show warnings about out-dated files
If the file $progpath.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Running without arguments will suffice in most cases.
"
# A newline delimited list of triples of programs (that respond to
# --version), the minimum version numbers required (or just `-' in the
# version field if any version will be sufficient) and homepage URLs
# to help locate missing packages.
buildreq=
# Name of a file containing instructions on installing missing packages
# required in `buildreq'.
buildreq_readme=README-hacking
# These are extracted from AC_INIT in configure.ac, though you can
# override those values in `bootstrap.conf' if you prefer.
build_aux=
macro_dir=
package=
package_name=
package_version=
package_bugreport=
# These are extracted from `gnulib-cache.m4', or else fall-back
# automatically on the gnulib defaults; unless you set the values
# manually in `bootstrap.conf'.
doc_base=
gnulib_mk=
gnulib_name=
local_gl_dir=
source_base=
tests_base=
# The list of gnulib modules required at `gnulib-tool' time. If you
# check `gnulib-cache.m4' into your repository, then this list will be
# extracted automatically.
gnulib_modules=
# Extra gnulib files that are not in modules, which override files of
# the same name installed by other bootstrap tools.
gnulib_non_module_files="
build-aux/compile
build-aux/install-sh
build-aux/missing
build-aux/mdate-sh
build-aux/texinfo.tex
build-aux/depcomp
build-aux/config.guess
build-aux/config.sub
doc/INSTALL
"
# Relative path to the local gnulib submodule, and url to the upstream
# git repository. If you have a gnulib entry in your .gitmodules file,
# these values are ignored.
gnulib_path=
gnulib_url=
# Additional gnulib-tool options to use.
gnulib_tool_options="
--no-changelog
"
# bootstrap removes any macro-files that are not included by aclocal.m4,
# except for files listed in this variable which are always kept.
gnulib_precious="
gnulib-tool.m4
"
# When truncating long commands for display, always allow at least this
# many characters before truncating.
min_cmd_len=160
# The command to download all .po files for a specified domain into
# a specified directory. Fill in the first %s is the domain name, and
# the second with the destination directory. Use rsync's -L and -r
# options because the latest/%s directory and the .po files within are
# all symlinks.
po_download_command_format=\
"rsync --delete --exclude '*.s1' -Lrtvz \
'translationproject.org::tp/latest/%s/' '%s'"
# Other locale categories that need message catalogs.
extra_locale_categories=
# Additional xgettext options to use. Gnulib might provide you with an
# extensive list of additional options to append to this, but gettext
# 0.16.1 and newer appends them automaticaly, so you can safely ignore
# the complaints from `gnulib-tool' if your $configure_ac states:
#
# AM_GNU_GETTEXT_VERSION([0.16.1])
xgettext_options="
--flag=_:1:pass-c-format
--flag=N_:1:pass-c-format
"
# Package copyright holder for gettext files. Defaults to FSF if unset.
copyright_holder=
# File that should exist in the top directory of a checked out hierarchy,
# but not in a distribution tarball.
checkout_only_file=
# Whether to use copies instead of symlinks by default (if set to true,
# the --copy option has no effect).
copy=false
# Set this to ".cvsignore .gitignore" in `bootstrap.conf' if you want
# those files to be generated in directories like `lib/', `m4/', and `po/',
# or set it to "auto" to make this script select which to use based
# on which version control system (if any) is used in the source directory.
# Or set it to "none" to ignore VCS ignore files entirely. Default is
# "auto".
vc_ignore=
## -------------------- ##
## Shell normalisation. ##
## -------------------- ##
# NLS nuisances.
LANGUAGE=C
export LANGUAGE
# Ensure file names are sorted consistently across platforms.
LC_ALL=C
export LC_ALL
# CDPATH.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
## ------------------------- ##
## Hook function management. ##
## ------------------------- ##
# This section contains functions for adding, removing, and running hooks
# to the main code. A hook is just a named list of of function, that can
# be run in order later on.
# func_append VAR VALUE
# ---------------------
# Append VALUE onto the existing contents of VAR.
if (eval 'x=a; x+=" b"; test "x$x" = "xa b"') 2>/dev/null
then
# This is an XSI compatible shell, allowing a faster implementation...
eval 'func_append ()
{
$debug_cmd
eval "$1+=\$2"
}'
else
# ...otherwise fall back to using expr, which is often a shell builtin.
func_append ()
{
$debug_cmd
eval "$1=\$$1\$2"
}
fi
# func_hookable FUNC_NAME
# -----------------------
# Declare that FUNC_NAME will run hooks added with
# `func_add_hook FUNC_NAME ...'.
func_hookable ()
{
$debug_cmd
func_append hookable_funcs " $1"
}
# func_add_hook FUNC_NAME HOOK_FUNC
# ---------------------------------
# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must
# first have been declared "hookable" by a coll to `func_hookable'.
func_add_hook ()
{
$debug_cmd
case " $hookable_funcs " in
*" $1 "*) ;;
*) func_fatal_error "Error: \`$1' does not accept hook functions." ;;
esac
eval func_append ${1}_hooks '" $2"'
}
# func_remove_hook FUNC_NAME HOOK_FUNC
# ------------------------------------
# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
func_remove_hook ()
{
$debug_cmd
eval ${1}_hooks='`echo "\$'$1'_hooks" |$SED "s| '$2'||"`'
}
# func_run_hooks FUNC_NAME [ARG]...
# ---------------------------------
# Run all hook functions registered to FUNC_NAME.
func_run_hooks ()
{
$debug_cmd
case " $hookable_funcs " in
*" $1 "*) ;;
*) func_fatal_error "Error: \`$1' does not support hook funcions.n" ;;
esac
eval hook_funcs="\$$1_hooks"
# shift away the first argument (FUNC_NAME)
shift
func_run_hooks_result=${1+"$@"}
for hook_func in $hook_funcs; do
eval $hook_func '"$@"'
# store returned options list back into positional
# parameters for next `cmd' execution.
eval set dummy "$func_run_hooks_result"; shift
done
}
## ------------------- ##
## Hookable functions. ##
## ------------------- ##
# After `bootstrap.conf' has been sourced, execution proceeds by calling
# `func_bootstrap'. Where a function is decorated with `func_hookable
# func_name', you will find a matching `func_run_hooks func_name' which
# executes all functions added with `func_add_hook func_name my_func'.
#
# You might notice that many of these functions begin with a series of
# `$require_foo' lines. See the docu-comments at the start of the
# `Resource management' section for a description of what these are.
# func_bootstrap [ARG]...
# -----------------------
# All the functions called inside func_bootstrap are hookable. See the
# the individual implementations for details.
func_bootstrap ()
{
$debug_cmd
# Save the current positional parameters to prevent them being
# corrupted by calls to `set' in `func_init'.
func_quote_for_eval ${1+"$@"}
my_saved_positional_parameters="$func_quote_for_eval_result"
# initialisation
func_init
# option processing
eval func_options "$my_saved_positional_parameters"
# post-option preparation
func_prep
# reconfigure the package
func_reconfigure
# finalisation
func_fini
}
# func_init
# ---------
# Any early initialisations can be hooked to this function. Consider
# whether you can hook onto `func_prep' instead, because if you hook
# any slow to execute code in here, it will also add to the time before
# `./bootstrap --version' can respond.
func_hookable func_init
func_init ()
{
$debug_cmd
func_run_hooks func_init
}
# func_options [ARG]...
# ---------------------
# All the functions called inside func_options are hookable. See the
# individual implementations for details.
func_hookable func_options
func_options ()
{
$debug_cmd
func_options_prep ${1+"$@"}
eval func_parse_options \
${func_options_prep_result+"$func_options_prep_result"}
eval func_validate_options \
${func_parse_options+"$func_parse_options_result"}
eval func_run_hooks func_options \
${func_validate_options_result+"$func_validate_options_result"}
# save modified positional parameters for caller
func_options_result="$func_run_hooks_result"
}
# func_options_prep [ARG]...
# --------------------------
# All initialisations required before starting the option parse loop.
# Note that when calling hook functions, we pass through the list of
# positional parameters. If a hook function modifies that list, and
# needs to propogate that back to rest of this script, then the complete
# modified list must be put in `func_run_hooks_result' before
# returning.
func_hookable func_options_prep
func_options_prep ()
{
$debug_cmd
warning_func=func_error
# Option defaults:
opt_copy=${copy-false}
opt_dry_run=false
opt_force=false
opt_gnulib_srcdir="$GNULIB_SRCDIR"
opt_skip_git=false
opt_skip_po=false
opt_warning=
opt_verbose=false
func_run_hooks func_options_prep ${1+"$@"}
# save modified positional parameters for caller
func_options_prep_result="$func_run_hooks_result"
}
# func_parse_options [ARG]...
# ---------------------------
# The main option parsing loop.
#
# In order to add your own option parsing hooks, you must accept the
# full positional parameter list in your hook function, remove any
# options that you action, and then pass back the remaining unprocessed
# options in `func_run_hooks_result', escaped suitably for `eval'. Like
# this:
#
# my_silent_option ()
# {
# $debug_cmd
#
# case $1 in
# --silent|-s) opt_silent=:; shift ;;
# esac
#
# func_quote_for_eval ${1+"$@"}
# func_run_hooks_result="$func_quote_for_eval_result"
# }
# func_add_hook func_parse_options my_silent_option
#
func_hookable func_parse_options
func_parse_options ()
{
$debug_cmd
func_parse_options_result=
# this just eases exit handling
while test $# -gt 0; do
# Defer to hook functions for initial option parsing, so they
# get priority in the event of reusing an option name.
func_run_hooks func_parse_options ${1+"$@"}
# Adjust func_parse_options positional parameters to match
eval set dummy "$func_run_hooks_result"; shift
opt="$1"
shift
case $opt in
--debug|-x) debug_cmd='set -x'
func_echo "enabling shell trace mode"
$debug_cmd
;;
--dry-run|--dryrun|-n)
opt_dry_run=: ;;
--copy|-c) opt_copy=: ;;
--force|-f) opt_force=: ;;
--gnulib-srcdir)
test $# = 0 && func_missing_arg $opt && break
opt_gnulib_srcdir="$1"
shift
;;
--skip-git) opt_skip_git=: ;;
--skip-po) opt_skip_po=: ;;
--verbose|-v) opt_verbose=: ;;
--warnings|--warning|-W)
test $# = 0 && func_missing_arg $opt && break
case " $1 " in
" all ")
opt_warning=" $warning_categories"
;;
" none ")
opt_warning=" none"
warning_func=:
;;
" error ")
warning_func=func_fatal_error
;;
*" $warning_categories "*)
func_append_u opt_warning " $1"
;;
*)
func_fatal_error \
"Error: unsupported warning category: \`$1'"
;;
esac
shift
;;
--version) func_version ;;
-\?|-h) func_usage ;;
--help) func_help ;;
# Separate optargs to long options:
--*=*)
func_split_equals "$opt"
set dummy "$func_split_equals_lhs" \
"$func_split_equals_rhs" ${1+"$@"}
shift
;;
# Separate optargs to short options:
-W*)
func_split_short_opt "$opt"
set dummy "$func_split_short_opt_name" \
"$func_split_short_opt_arg" ${1+"$@"}
shift
;;
# Separate non-argument short options:
-\?*|-h*|-c*|-f*|-n*|-v*|-x*)
func_split_short_opt "$opt"
set dummy "$func_split_short_opt_name" \
"-$func_split_short_opt_arg" ${1+"$@"}
shift
;;
--) set dummy "$opt"; shift; break ;;
-*) func_fatal_help "unrecognised option: \`$opt'" ;;
*) set dummy "$opt"; shift; break ;;
esac
done
# save modified positional parameters for caller
func_quote_for_eval ${1+"$@"}
func_parse_options_result="$func_quote_for_eval_result"
}
# func_validate_options [ARG]...
# ------------------------------
# Perform any sanity checks on option settings and/or unconsumed
# arguments.
func_hookable func_validate_options
func_validate_options ()
{
$debug_cmd
# display all warnings if -W was not given
test -n "$opt_warning" || opt_warning="$warning_categories"
func_run_hooks func_validate_options ${1+"$@"}
# Validate options.
test $# -gt 0 \
&& func_fatal_help "too many arguments"
# Bail if the options were screwed!
$exit_cmd $EXIT_FAILURE
# save modified positional parameters for caller
func_quote_for_eval ${1+"$@"}
func_validate_options_result="$func_quote_for_eval_result"
}
# func_prep
# ---------
# Function to perform preparation for remaining bootstrap process. If
# your hooked code relies on the outcome of `func_options' hook it here
# rather than to `func_init'.
#
# All the functions called inside func_prep are hookable. See the
# individual implementations for details.
func_hookable func_prep
func_prep ()
{
$debug_cmd
$require_bootstrap_uptodate
$require_buildtools_uptodate
$require_checkout_only_file
$require_gnulib_merge_changelog
# fetch update files from the translation project
func_update_translations
func_run_hooks func_prep
}
# func_update_translations
# ------------------------
# Update package po files and translations.
func_hookable func_update_translations
func_update_translations ()
{
$debug_cmd
$opt_skip_po || {
test -d po && {
$require_package
func_update_po_files po $package || exit $?
}
func_run_hooks func_update_translations
}
}
# func_reconfigure
# ----------------
# Reconfigure the current package by running the appropriate autotools in a
# suitable order.
func_hookable func_reconfigure
func_reconfigure ()
{
$debug_cmd
# Released `autopoint' has the tendency to install macros that have
# been obsoleted in current `gnulib., so run this before `gnulib-tool'.
func_autopoint
# Autoreconf runs `aclocal' before `libtoolize', which causes spurious
# warnings if the initial `aclocal' is confused by the libtoolized
# (or worse: out-of-date) macro directory.
func_libtoolize
# If you need to do anything after `gnulib-tool' is done, but before
# `autoreconf' runs, you don't need to override this whole function,
# because `func_gnulib_tool' is hookable.
func_gnulib_tool
func_autoreconf
func_run_hooks func_reconfigure
}
# func_gnulib_tool
# ----------------
# Run `gnulib-tool' to fetch gnulib modules into the current package.
#
# It's assumed that since you are using gnulib's `bootstrap' script,
# you're also using gnulib elsewhere in your package. If not, then
# you can replace this function in `bootstrap.conf' with:
#
# func_gnulib_tool () { :; }
#
# (although the function returns immediately if $gnulib_tool is set to
# true in any case).
func_hookable func_gnulib_tool
func_gnulib_tool ()
{
$debug_cmd
$require_gnulib_tool
$require_libtoolize
test true = "$gnulib_tool" || {
if test -n "$gnulib_modules"; then
$require_gnulib_cache
$require_build_aux
$require_macro_dir
# Try not to pick up any stale values from `gnulib-cache.m4'.
rm -f "$gnulib_cache"
gnulib_mode="--import"
# `gnulib_modules' and others are maintained in `bootstrap.conf`:
# Use `gnulib --import` to fetch gnulib modules.
test -n "$build_aux" \
&& func_append_u gnulib_tool_options " --aux-dir=$build_aux"
test -n "$macro_dir" \
&& func_append_u gnulib_tool_options " --m4-base=$macro_dir"
test -n "$doc_base" \
&& func_append_u gnulib_tool_options " --doc-base=$doc_base"
test -n "$gnulib_name" \
&& func_append_u gnulib_tool_options " --lib=$gnulib_name"
test -n "$local_gl_dir" \
&& func_append_u gnulib_tool_options " --local-dir=$local_gl_dir"
test -n "$source_base" \
&& func_append_u gnulib_tool_options " --source-base=$source_base"
test -n "$gnulib_mk" \
&& func_append_u gnulib_tool_options " --makefile-name=$gnulib_mk"
test -n "$tests_base" && {
func_append_u gnulib_tool_options " --tests-base=$tests_base"
func_append_u gnulib_tool_options " --with-tests"
}
else
# `gnulib_modules' and others are cached in `gnulib-cache.m4':
# Use `gnulib --update' to fetch gnulib modules.
gnulib_mode="--update"
fi
# Add a sensible default libtool option to gnulib_tool_options.
case " $gnulib_tool_options " in
*" --no-libtool "*|*" --libtool "*) ;;
*) if test true = "$LIBTOOLIZE"; then
func_append_u gnulib_tool_options " --no-libtool"
else
func_append_u gnulib_tool_options " --libtool"
fi
;;
esac
$opt_copy || func_append_u gnulib_tool_options " --symbolic"
func_append_u gnulib_tool_options " $gnulib_mode"
func_append gnulib_tool_options " $gnulib_modules"
# The embedded echo is to squash whitespace before display.
gnulib_cmd=`echo $gnulib_tool $gnulib_tool_options`
func_show_eval "$gnulib_cmd" 'exit $?'
}
func_run_hooks func_gnulib_tool
}
# func_fini
# ---------
# Function to perform all finalisation for the bootstrap process.
func_hookable func_fini
func_fini ()
{
$debug_cmd
func_install_gnulib_non_module_files
func_gettext_configuration
func_clean_dangling_symlinks
func_clean_unused_macros
func_skip_po_recommendation
func_run_hooks func_fini
func_echo "Done. Now you can run './configure'."
}
# func_gettext_configuration
# --------------------------
# Edit configuration values into po/Makevars.
func_hookable func_gettext_configuration
func_gettext_configuration ()
{
$debug_cmd
$require_autopoint
test true = "$AUTOPOINT" || {
$require_copyright_holder
$require_extra_locale_categories
$require_package_bugreport
# Escape xgettext options for sed Makevars generation below.
# We have to delete blank lines in a separate script so that we don't
# append \\\ to the penultimate line, and then delete the last empty
# line, which messes up the variable substitution later in this
# function. Note that adding a literal \\\ requires double escaping
# here, once for the execution subshell, and again for the assignment,
# which is why there are actually 12 (!!) backslashes in the script.
my_xgettext_options=`echo "$xgettext_options$nl" |$SED '/^$/d' |$SED '
$b
s|$| \\\\\\\\\\\\|'`
# Create gettext configuration.
func_echo "Creating po/Makevars from po/Makevars.template ..."
$RM -f po/Makevars
$SED '
/^EXTRA_LOCALE_CATEGORIES *=/s|=.*|= '"$extra_locale_categories"'|
/^COPYRIGHT_HOLDER *=/s|=.*|= '"$copyright_holder"'|
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$package_bugreport"'|
/^XGETTEXT_OPTIONS *=/{
s|$| \\|
a\
'"$my_xgettext_options"' \\\
$${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars || exit 1
}
func_run_hooks func_gettext_configuration
}
## --------------- ##
## Core functions. ##
## --------------- ##
# This section contains the main functions called from the `Hookable
# functions' (shown above), and are the ones you're most likely
# to want to replace with your own implementations in `bootstrap.conf'.
# func_autopoint
# --------------
# If this package uses gettext, then run `autopoint'.
func_autopoint ()
{
$debug_cmd
$require_autopoint
test true = "$AUTOPOINT" \
|| func_show_eval "$AUTOPOINT --force" 'exit $?'
}
# func_libtoolize
# ---------------
# If this package uses libtool, then run `libtoolize'.
func_libtoolize ()
{
$debug_cmd
$require_libtoolize
test true = "$LIBTOOLIZE" || {
my_libtoolize_options=
$opt_copy && func_append my_libtoolize_options " --copy"
$opt_force && func_append my_libtoolize_options " --force"
$opt_verbose || func_append my_libtoolize_options " --quiet"
func_show_eval "$LIBTOOLIZE$my_libtoolize_options" 'exit $?'
}
}
# func_autoreconf
# ---------------
# Being careful not to re-run `autopoint' or `libtoolize', and not to
# try to run `autopoint', `libtoolize' or `autoheader' on packages that
# don't use them, defer to `autoreconf' for execution of the remaining
# autotools to bootstrap this package.
func_autoreconf ()
{
$debug_cmd
$require_autoheader
$require_build_aux # automake and others put files in here
$require_macro_dir # aclocal and others put files in here
# We ran these manually already, and autoreconf won't exec `:'
save_AUTOPOINT="$AUTOPOINT"; AUTOPOINT=true
save_LIBTOOLIZE="$LIBTOOLIZE"; LIBTOOLIZE=true
my_autoreconf_options=
$opt_copy || func_append my_autoreconf_options " --symlink"
$opt_force && func_append my_autoreconf_options " --force"
$opt_verbose && func_append my_autoreconf_options " --verbose"
func_show_eval "$AUTORECONF$my_autoreconf_options --install" 'exit $?'
AUTOPOINT="$save_AUTOPOINT"
LIBTOOLIZE="$save_LIBTOOLIZE"
}
# func_install_gnulib_non_module_files
# ------------------------------------
# Get additional non-module files from gnulib, overriding existing files.
func_install_gnulib_non_module_files ()
{
$debug_cmd
$require_build_aux
$require_gnulib_path
test -n "$gnulib_non_module_files" && {
if test -n "$gnulib_path"; then
maybe_exit_cmd=:
for file in $gnulib_non_module_files; do
case $file in
*/COPYING*) dest=COPYING;;
*/INSTALL) dest=INSTALL;;
build-aux/*) dest=$build_aux/`expr "$file" : 'build-aux/\(.*\)'`;;
*) dest=$file;;
esac
# Be sure to show all copying errors before bailing out
if test -f "$gnulib_path/$file"; then
func_symlink_to_dir "$gnulib_path" $file $dest
else
func_error "Error: \`$gnulib_path/$file' does not exist"
maybe_exit_cmd="exit $EXIT_FAILURE"
fi
done
$maybe_exit_cmd
else
func_warning recommend "\
Unable to link \`\$gnulib_non_module_files', please provide the
location of a complete \`gnulib' tree by setting \`gnulib_path' in
your \`bootstrap.conf' or with the \`--gnulib-srcdir' option - or
else specify the location of your \`git' binary by setting \`GIT'
in the environment so that a fresh \`gnulib' submodule can be cloned."
fi
}
}
# func_check_configuration VARNAME [CONFIGURE_MACRO]
# --------------------------------------------------
func_check_configuration ()
{
$debug_cmd
$require_configure_ac
eval 'test -n "$'$1'"' || {
my_error_msg="Error: please set \`$1' in \`bootstrap.conf'"
test -n "$2" \
&& func_append my_error_msg "
or add the following (or similar) to your \`$configure_ac':
$2"
func_fatal_error "$my_error_msg"
}
}
# func_clean_dangling_symlinks
# ----------------------------
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to
# fail. The following requires GNU find 4.2.3 or newer. Considering
# the usual portability constraints of this script, that may seem a very
# demanding requirement, but it should be ok. Ignore any failure,
# which is fine, since this is only a convenience to help developers
# avoid the relatively unusual case in which a symlinked-to .m4 file is