-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·2530 lines (2018 loc) · 70.2 KB
/
bootstrap
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
# Source required external libraries.
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"build-aux/options-parser"
. `echo "$0" |${SED-sed} 's|[^/]*$||'`"build-aux/extract-trace"
# Set a version string for *this* script.
scriptversion=2011-11-21.09; # UTC
# Bootstrap this package from checked-out sources.
# Written by Gary V. Vaughan, 2010
# Copyright (C) 2010, 2011 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.
#
##### PLEASE CHECK `--version' WORKS AFTER EDITING THE ABOVE COPYRIGHT #####
# 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', `M4', `SHA1SUM' and some others 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="grep -E"}
: ${FGREP="grep -F"}
: ${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
export CONFIG_SHELL
## -------------- ##
## Configuration. ##
## -------------- ##
# 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=
## ------------------- ##
## Hookable functions. ##
## ------------------- ##
# After `bootstrap.conf' has been sourced, execution proceeds by calling
# `func_bootstrap'. Wherever 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+"$@"}
_G_saved_positional_parameters=$func_quote_for_eval_result
# Initialisation.
func_init
# Option processing.
eval func_options "$_G_saved_positional_parameters"
# Post-option preparation.
func_prep
# Ensure ChangeLog presence.
func_ifcontains "$gnulib_modules" gitlog-to-changelog \
func_ensure_changelog
# Reconfigure the package.
func_reconfigure
# Ensure .version is up-to-date.
func_update_dotversion
# 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_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.
# The embedded echo is to squash whitespace before globbing.
case `echo " "$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 " --symlink"
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 $?'
}
# Use `gnulib-tool --copy-file' to install non-module files.
func_install_gnulib_non_module_files
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_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.
_G_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\
'"$_G_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" || {
_G_libtoolize_options=
$opt_copy && func_append _G_libtoolize_options " --copy"
$opt_force && func_append _G_libtoolize_options " --force"
$opt_verbose || func_append _G_libtoolize_options " --quiet"
func_show_eval "$LIBTOOLIZE$_G_libtoolize_options" 'exit $?'
}
}
# func_gnulib_tool_copy_file SRC DEST
# -----------------------------------
# Copy SRC, a path relative to the gnulib sub-tree, to DEST, a path
# relative to the top-level source directory using gnulib-tool so that
# any patches or replacements in $local_gl_dir are applied.
func_gnulib_tool_copy_file ()
{
$debug_cmd
$require_gnulib_path
$require_gnulib_tool
$require_patch
gnulib_copy_cmd="$gnulib_tool --copy-file"
$opt_copy || func_append gnulib_copy_cmd " --symlink"
if test true = "$gnulib_tool"; then
# If gnulib-tool is not available (e.g. bootstrapping in a
# distribution tarball), make sure that at least we have some
# version of the required file already in place.
test -f "$2" || func_fatal_error "\
Can't find, copy or download \`$2', a required
gnulib supplied file, 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."
else
test -f "$gnulib_path/$1" || {
func_error "\`$gnulib_path/$1' does not exist"
return 1
}
$gnulib_copy_cmd $1 $2
fi
}
# 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_tool
test -n "$gnulib_non_module_files" && {
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
func_gnulib_tool_copy_file "$file" "$dest" \
|| maybe_exit_cmd="exit $EXIT_FAILURE"
done
$maybe_exit_cmd
}
}
# func_ensure_changelog
# ---------------------
# Even with 'gitlog-to-changelog' generated ChangeLogs, automake
# will not run to completion with no ChangeLog file.
func_ensure_changelog ()
{
$debug_cmd
test -f ChangeLog && mv -f ChangeLog ChangeLog~
cat >ChangeLog <<'EOT'
## ---------------------- ##
## DO NOT EDIT THIS FILE! ##
## ---------------------- ##
ChangeLog is generated by gitlog-to-changelog.
EOT
_G_message="creating dummy \`ChangeLog'"
test -f ChangeLog~ \
&& func_append _G_message ' (backup in ChangeLog~)'
func_verbose "$_G_message"
return 0
}
# 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
_G_autoreconf_options=
$opt_copy || func_append _G_autoreconf_options " --symlink"
$opt_force && func_append _G_autoreconf_options " --force"
$opt_verbose && func_append _G_autoreconf_options " --verbose"
func_show_eval "$AUTORECONF$_G_autoreconf_options --install" 'exit $?'
AUTOPOINT=$save_AUTOPOINT
LIBTOOLIZE=$save_LIBTOOLIZE
}
# func_check_configuration VARNAME [CONFIGURE_MACRO]
# --------------------------------------------------
# Exit with a suitable diagnostic for an important configuration change
# that needs to be made before bootstrap can run correctly.
func_check_configuration ()
{
$debug_cmd
$require_configure_ac
eval 'test -n "$'$1'"' || {
_G_error_msg="please set \`$1' in \`bootstrap.conf'"
if test -n "$configure_ac" && test -n "$2"; then
func_append _G_error_msg "
or add the following (or similar) to your \`$configure_ac':
$2"
fi
func_fatal_error "$_G_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
# git-removed from gnulib between successive runs of this script.
func_clean_dangling_symlinks ()
{
$debug_cmd
$require_macro_dir
$require_source_base
func_verbose "cleaning dangling symlinks"
find "$macro_dir" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
}
# func_clean_unused_macros
# ------------------------
# Autopoint can result in over-zealously adding macros into $macro_dir
# even though they are not actually used, for example tests to help
# build the `intl' directory even though you have specified
# `AM_GNU_GETTEXT([external])' in your configure.ac. This function
# looks removes any macro files that can be found in gnulib, but
# are not `m4_include'd by `aclocal.m4'.
func_clean_unused_macros ()
{
$debug_cmd
$require_gnulib_path
$require_macro_dir
test -n "$gnulib_path" && test -f aclocal.m4 && {
aclocal_m4s=`find . -name aclocal.m4 -print`
# We use `ls|grep' instead of `ls *.m4' to avoid exceeding
# command line length limits in some shells.
for file in `cd "$macro_dir" && ls -1 |grep '\.m4$'`; do
# Remove a macro file when aclocal.m4 does not m4_include it...
func_grep_q 'm4_include([[]'$macro_dir/$file'])' $aclocal_m4s \
|| test ! -f "$gnulib_path/m4/$file" || {
# ...and there is an identical file in gnulib...
if func_cmp_s "$gnulib_path/m4/$file" "$macro_dir/$file"; then
# ...and it's not in the precious list (`echo' is needed
# here to squash whitespace for the match expression).
case " "`echo $gnulib_precious`" " in
*" $file "*) ;;
*) rm -f "$macro_dir/$file"
func_verbose \
"removing unused gnulib file \`$macro_dir/$file'"
esac
fi
}
done
}
}
# func_skip_po_recommendation
# ---------------------------
# If there is a po directory, and `--skip-po' wasn't passed, let the
# user know that they can use `--skip-po' on subsequent invocations.
func_skip_po_recommendation ()
{
$debug_cmd
test ! -d po \
|| $opt_skip_po \
|| func_warning recommend "\
If your pofiles are up-to-date, you can rerun bootstrap
as \`$progname --skip-po' to avoid redownloading."
}
# func_update_dotversion
# ----------------------
# Even with 'gitlog-to-changelog' generated ChangeLogs, automake
# will not run to completion with no ChangeLog file.
func_update_dotversion ()
{
$debug_cmd
test -f "$build_aux/git-version-gen" && {
_G_message="updating .version"
test -f .version && {
mv .version .version~
func_append _G_message " (backup in .version~)"
}
func_verbose "updating .version"
$build_aux/git-version-gen dummy-arg > .version
}
}
## -------------------- ##
## Resource management. ##
## -------------------- ##
# This section contains definitions for functions that each ensure a
# particular resource (a file, or a non-empty configuration variable for
# example) is available, and if appropriate to extract default values
# from pertinent package files. Where a variable already has a non-
# empty value (as set by the package's `bootstrap.conf'), that value is
# used in preference to deriving the default. Call them using their
# associated `require_*' variable to ensure that they are executed, at
# most, once.
# require_checkout_only_file
# --------------------------
# Bail out if this package only bootstraps properly from a repository
# checkout.
require_checkout_only_file=func_require_checkout_only_file
func_require_checkout_only_file ()
{
$debug_cmd
$opt_force || {
test -n "$checkout_only_file" && test ! -f "$checkout_only_file" \
&& func_fatal_error "\
Bootstrapping from a non-checked-out distribution is risky.
If you wish to bootstrap anyway, use the \`--force' option."
}
require_checkout_only_file=:
}
# require_aclocal_amflags
# -----------------------
# Ensure `$aclocal_amflags' has a sensible default, extracted from
# `Makefile.am' if necessary.
require_aclocal_amflags=func_require_aclocal_amflags
func_require_aclocal_amflags ()
{
$debug_cmd
$require_makefile_am
_G_sed_extract_aclocal_amflags='s|#.*$||
/^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
s|^.*=[ ]*\(.*\)|aclocal_amflags="\1"|
p
}'
_G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
"$makefile_am"`
eval "$_G_aclocal_flags_cmd"
func_verbose "ACLOCAL_AMFLAGS='$aclocal_amflags'"
require_aclocal_amflags=:
}
# require_autoheader
# ------------------
# Skip autoheader if it's not needed.
require_autoheader=func_require_autoheader
func_require_autoheader ()
{
$debug_cmd
test true = "$AUTOHEADER" || {
func_extract_trace AC_CONFIG_HEADERS
test -n "$func_extract_trace_result" \
|| func_extract_trace AC_CONFIG_HEADER
test -n "$func_extract_trace_result" || {
AUTOHEADER=true
func_verbose "export AUTOHEADER='$AUTOHEADER'"
# Make sure the search result is visible to subshells
export AUTOHEADER
}
}
require_autoheader=:
}
# require_autopoint
# -----------------
# Skip autopoint if it's not needed.
require_autopoint=func_require_autopoint
func_require_autopoint ()
{
$debug_cmd
test true = "$AUTOPOINT" || {
func_extract_trace AM_GNU_GETTEXT_VERSION
test -n "$func_extract_trace_result" || {
AUTOPOINT=true
func_verbose "export AUTOPOINT='$AUTOPOINT'"
# Make sure the search result is visible to subshells
export AUTOPOINT
}
}
require_autopoint=:
}
# require_bootstrap_uptodate
# --------------------------
# Complain if the version of bootstrap in the gnulib directory differs
# from the one we are running.
require_bootstrap_uptodate=func_require_bootstrap_uptodate
func_require_bootstrap_uptodate ()
{
$debug_cmd
$require_gnulib_path
test x = x"$gnulib_path" \
|| func_cmp_s $progpath $gnulib_path/build-aux/bootstrap \
|| func_warning upgrade "\
\`$progpath' differs from \`./$gnulib_path/build-aux/bootstrap',
please consider adopting the canonical version from gnulib."
require_bootstrap_uptodate=:
}
# require_build_aux
# -----------------
# Ensure that `$build_aux' is set, and if it doesn't already point to an
# existing directory, create one.
require_build_aux=func_require_build_aux
func_require_build_aux ()
{
$debug_cmd
test -n "$build_aux" || {
func_extract_trace AC_CONFIG_AUX_DIR
build_aux=$func_extract_trace_result
func_check_configuration build_aux \
"AC_CONFIG_AUX_DIR([name of a directory for build scripts])"
func_verbose "build_aux='$build_aux'"
}
$require_vc_ignore_files
# If the build_aux directory doesn't exist, create it now, and mark it
# as ignored for the VCS.
if test ! -d "$build_aux"; then
func_show_eval "mkdir '$build_aux'"
test -n "$vc_ignore_files" \
|| func_insert_sorted_if_absent "$build_aux" $vc_ignore_files
fi
require_build_aux=:
}
# require_buildreq_autobuild
# --------------------------
# Try to find whether the bootstrap requires autobuild.
require_buildreq_autobuild=func_require_buildreq_autobuild
func_require_buildreq_autobuild ()
{
$debug_cmd
$require_macro_dir
test -f "$macro_dir/autobuild.m4" \
|| printf '%s\n' "$buildreq" |func_grep_q '^[ ]*autobuild' \
|| {
func_extract_trace AB_INIT
test -n "$func_extract_trace_result" && {
func_append buildreq 'autobuild - http://josefsson.org/autobuild/
'
func_verbose "auto-adding \`autobuild' to build requirements"
}
}
require_buildreq_autobuild=:
}
# require_buildreq_autoconf
# require_buildreq_autopoint
# require_buildreq_libtoolize
# ---------------------------
# Try to find the minimum compatible version of autoconf/libtool