summaryrefslogtreecommitdiff
path: root/bootstrap.conf
blob: c3491b5b455637e377fc4764e9b725cca5c133c9 (plain)
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
# bootstrap.conf (GNU Libtool) version 2011-11-11
#
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
# Written by Gary V. Vaughan, 2010

# This is free software; see the source for copying conditions.  There is NO
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# GNU Libtool 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 2 of
# the License, or (at your option) any later version.
#
# GNU Libtool 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 GNU Libtool; see the file COPYING.  If not, a copy
# can be downloaded from  http://www.gnu.org/licenses/gpl.html,
# or obtained by writing to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


## -------------------------------- ##
## User overrideable command paths. ##
## -------------------------------- ##

: "${MAKE=make}"

export MAKE



## -------------- ##
## Configuration. ##
## -------------- ##

# File that should exist in the top directory of a checked out hierarchy,
# but not in a distribution tarball.
checkout_only_file=HACKING

# List of programs (and minimum versions) required to bootstrap, maintain
# and release Libtool.
buildreq="
        help2man   1.29        http://www.gnu.org/software/help2man
        makeinfo   4.8         http://www.gnu.org/software/texinfo
        xz         4.999.8beta http://tukaani.org/xz
"

# Instructions on how to install packages in $buildreq.
buildreq_readme=HACKING

# Non-default gnulib directory options.
local_gl_dir=gl

# Additional gnulib-tool options to use.
gnulib_tool_options=$gnulib_tool_options"
        --avoid=dummy
        --libtool
        --macro-prefix=GL
"

# gnulib modules used by this package.
gnulib_modules='
        announce-gen
        do-release-commit-and-tag
        gendocs
        git-version-gen
        gitlog-to-changelog
        gnu-web-doc-update
        gnupload
        maintainer-makefile
        readme-release
'

# Extra gnulib files that are not in modules, which override files of
# the same name installed by other bootstrap tools.
gnulib_non_module_files=$gnulib_non_module_files'
        doc/COPYINGv2
        doc/fdl.texi
'

# What ignore files to maintain.
vc_ignore=.gitignore

# Running the installed `libtoolize' will trash the local (newer) libtool.m4
# among others.  Don't use `:', since autoreconf can't exec it!
LIBTOOLIZE=true

# List of file droppings from old releases of Libtool.
libtool_obsolete_files="
        acinclude.m4
        argz.c
        libltdl/config.h
        lt__dirent.c
        lt__strl.c
"

# The not-synced with gnulib warning is bogus until upstream adopts
# the saner bootstrap script.
require_bootstrap_uptodate=:


## ------------------- ##
## Override functions. ##
## ------------------- ##

# func_reconfigure
# ------------------
# In addition to needing to autoreconf several directories, Libtool
# provides `libtoolize' and doesn't use `autopoint', so we can use a
# somewhat simpler `func_reconfigure' implementation.
func_reconfigure ()
{
    $debug_cmd

    $require_autoheader
    $require_build_aux
    $require_macro_dir

    # Only need this from the top level directory
    func_gnulib_tool

    export LIBTOOLIZE
    func_verbose "export LIBTOOLIZE='$LIBTOOLIZE'"

    # Also bootstrap any additional directories that were specified with
    # `reconfdirs' in the environment.
    save_IFS=$IFS
    IFS=,
    for sub in $opt_reconf_dirs; do
      IFS=$save_IFS
      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 $sub" \
        'exit $?'
    done
    IFS=$save_IFS
}



## --------------- ##
## Hook functions. ##
## --------------- ##

# `bootstrap' itself takes care of the arguments it recognises, so we only
# have to handle additional options here.  Setting exit_cmd to anything
# other than `:', will tell `bootstrap' to exit after printing it's own
# option loop parser errors.  Best not to use any time-consuming $require_
# functions here, otherwise they will be run even if we only need to
# process `--version'.

# libtool_options_prep [ARG...]
# -----------------------------
# Preparation for supporting additional options in Libtool bootstrap,
# before the option parsing loop.
libtool_options_prep ()
{
    $debug_cmd

    # Extend the existing usage message
    usage_message=$usage_message'
Libtool Specific Options:
  -r, --reconf-dirs=DIR1,DIR2,...
                          limit the directories to be bootstrapped to
                          the comma-delimited list of DIR1,DIR2,...
'

    # autoreconf all directories by default
    test -n "$reconfdirs" \
      || reconfdirs=". libltdl `ls -1d tests/*demo tests/*demo[0-9]`"

    # pass back the list of options we consumed
    func_quote_for_eval ${1+"$@"}
    libtool_options_prep_result=$func_quote_for_eval_result
}
func_add_hook func_options_prep libtool_options_prep


# libtool_parse_options [ARG...]
# ------------------------------
# Provide handling for additional Libtool options inside the main option
# parsing loop.
libtool_parse_options ()
{
    $debug_cmd

    # this inner loop lets us handle `-r.' in a single iteration
    while test $# -gt 0; do
      opt=$1
      shift

      case $opt in
        --reconf-dirs|--reconfdirs|-r)
              test $# = 0 && func_missing_arg $opt && break
              # squash spaces so that delimiter is just `,' and nothing else
              opt_reconf_dirs=`echo "$1" |$SED 's|,  *|,|g'`
              shift
              ;;

        # Separate arguments to short options:
        -r*)  func_split_short_opt "$opt"
              set dummy "$func_split_short_opt_name" "$func_split_short_opt_arg" ${1+"$@"}
              shift
              ;;

        *)    set dummy "$opt" ${1+"$@"}; shift; break ;;
      esac
    done

    # pass back the list of options we consumed
    func_quote_for_eval ${1+"$@"}
    libtool_parse_options_result=$func_quote_for_eval_result
}
func_add_hook func_parse_options libtool_parse_options


# libtool_validate_options [ARG...]
# ---------------------------------
# Validation of additional Libtool bootstrap options, after the main option
# parsing loop.
libtool_validate_options ()
{
    # support the old interface too: `reconfdirs='. libltdl' ./bootstrap'
    test -n "$opt_reconf_dirs" \
      || opt_reconf_dirs=`echo $reconfdirs |$SED 's|  *|,|g'`

    # validate $opt_reconf_dirs
    save_IFS=$IFS
    IFS=,
    for reconfdir in $opt_reconf_dirs; do
      IFS=$save_IFS
      test -d "$reconfdir" || {
        func_error "bad reconf directory \`$reconfdir': directory does not exist"
        exit_cmd=exit
      }
    done
    IFS=$save_IFS

    # pass back the list of options we consumed
    func_quote_for_eval ${1+"$@"}
    libtool_validate_options_result=$func_quote_for_eval_result
}
func_add_hook func_validate_options libtool_validate_options


## ---------------------------- ##
## Libtool bootstrap functions. ##
## ---------------------------- ##

# libtool_prep
# ------------
# Libtool bootstrap initialisation after successful option parse and
# validation.
libtool_prep ()
{
    # initial clean-up of checked out tree
    find . -depth \( -name autom4te.cache -o -name libtool \) -print \
      | grep -v '{arch}' \
      | xargs rm -rf

    # remove obsolete file droppings from old Libtool versions
    for file in $libtool_obsolete_files; do
      rm -f $file
    done
}
func_add_hook func_prep libtool_prep


# libtool_add_libltdl_copying
# ---------------------------
# Use the canonical COPYING.LESSERv2 from gnulib.
libtool_add_libltdl_copying ()
{
    $debug_cmd

    func_gnulib_tool_copy_file doc/COPYING.LESSERv2 libltdl/COPYING.LIB
}
func_add_hook func_gnulib_tool libtool_add_libltdl_copying


# libtool_build_prerequisites
# ---------------------------
# Libtool generates some files that are required before any autotools
# can be run successfully.
libtool_build_prerequisites ()
{
    $debug_cmd

    $require_build_aux
    $require_macro_dir
    $require_package
    $require_package_bugreport
    $require_package_name
    $require_package_url
    $require_package_version

    func_extract_trace LT_CONFIG_LTDL_DIR

    save_ifs=$IFS
    IFS=:
    set dummy $func_extract_trace_result
    IFS=$save_ifs
    shift

    ltdl_dir=$1
    func_check_configuration ltdl_dir \
        "LT_CONFIG_LTDL_DIR([name of your libltdl directory])"
    func_verbose "ltdl_dir='$ltdl_dir'"

    # Whip up a dirty Makefile:
    makes='Makefile.am libltdl/ltdl.mk'
    rm -f Makefile
    {
      echo "aux_dir = $build_aux"
      echo "ltdl_dir = $ltdl_dir"
      echo "macro_dir = $macro_dir"
      $SED '/^if /,/^endif$/d;/^else$/,/^endif$/d;/^include /d' $makes
    } > Makefile

    # Building distributed files from configure is bad for automake, so we
    # generate them here, and have Makefile rules to keep them up to date.
    func_echo "running: $MAKE bootstrap-deps ..."
    $opt_dry_run || {
    output=`$MAKE bootstrap-deps  \
        M4SH="$AUTOM4TE --language=m4sh" PACKAGE="$package" \
        PACKAGE_BUGREPORT="$package_bugreport" PACKAGE_NAME="$package_name" \
        PACKAGE_URL="$package_url" SED="$SED" srcdir=. \
        VERSION="$package_version" 2>&1`
    }
    status=$?

    test 0 -eq "$status" || echo "$output"
    rm -f Makefile
    test 0 -eq "$status" ||exit $EXIT_FAILURE
}
func_add_hook func_gnulib_tool libtool_build_prerequisites


# libtool_readme_release_package_substitutions
# --------------------------------------------
# Show our own package details instead of generic strings.
libtool_readme_release_package_substitutions ()
{
    $debug_cmd

    $require_build_aux
    $require_package

    my_readme=README-release

    test -f "$my_readme" \
        || func_fatal_error "error: \`$my_readme' does not exist"

    # Perform substitutions to a temporary file
    $SED -e "\
        s,\@PACKAGE\@,$package,g
    " "$my_readme" > "${my_readme}T" \
        && mv "${my_readme}T" "$my_readme"
}
func_add_hook func_fini libtool_readme_release_package_substitutions


# libtool_fudge_timestamps
# ------------------------
# Autoheader valiantly tries to prevent needless reconfigurations by
# not changing the timestamp of config-h.in unless the file contents
# are updated.  Unfortunately config-h.in depends on aclocal.m4 which
# *is* updated, so running 'libtoolize --ltdl=. && configure && make'
# causes autoheader to be called... undesireable for users that do not
# have it!  Fudge the timestamp to prevent that:
libtool_fudge_timestamps ()
{
    $debug_cmd

    sleep 2 && touch libltdl/config-h.in
}
func_add_hook func_fini libtool_fudge_timestamps


# libtool_cleanup
# ---------------
libtool_cleanup ()
{
    $debug_cmd

    # These files can cause an infinite configure loop if left behind.
    rm -f Makefile libltdl/Makefile libtool vcl.tmp
}
func_add_hook func_fini libtool_cleanup


# libtool_check_for_bogus_macros
# ------------------------------
# Try to catch the case where `aclocal' pulls installed libtool macro
# file contents from another version of libtool into the current package
# `aclocal.m4'.
libtool_check_for_bogus_macros ()
{
    $debug_cmd

    $opt_dry_run ||
        for macro in LT_INIT AC_PROG_LIBTOOL AM_PROG_LIBTOOL; do
          if grep $macro aclocal.m4 libltdl/aclocal.m4; then
            func_fatal_error "Bogus $macro macro contents in an aclocal.m4 file"
          else :; fi
        done
}
func_add_hook func_fini libtool_check_for_bogus_macros


# libtool_cleanup_empty_dirs
# --------------------------
# Gnulib leaves behind a few files we don't need.
libtool_cleanup_empty_dirs ()
{
    $debug_cmd

    my_gnulib_source=${source_base-'lib'}
    if test -d "$my_gnulib_source"; then
      rm -f "$my_gnulib_source/.gitignore" "$my_gnulib_source/Makefile.am" || exit 1
      rmdir "$my_gnulib_source" || exit 1
    fi
}
func_add_hook func_fini libtool_cleanup_empty_dirs



## -------------------- ##
## Resource management. ##
## -------------------- ##

# require_package_url
# -------------------
# Ensure that package_url has a sensible default.
require_package_url=libtool_require_package_url
libtool_require_package_url ()
{
    $require_configure_ac

    func_extract_trace AC_INIT

    save_IFS=$IFS
    IFS=:
    set dummy $func_extract_trace_result
    IFS=$save_IFS
    shift

    test -n "$package_url " || package_url=$5
    test -n "$package_url" || {
      # How to extract the parameters for `make bootstrap-deps' from
      # configure.ac.  This is very specific to the way Libtool's
      # configure.ac layout.
      sed_extract_package_url='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
        /AC_SUBST([[]*PACKAGE_URL/{
            s|.*AC_SUBST([[	 ]*PACKAGE_URL[]	 ]*,[[	 ]*|package_url="|
            s|[])	 ]*$|"|
            p
        }'

      # Extract package_url setting from configure.ac.
      eval `$SED -n "$sed_extract_package_url" < configure.ac`
    }

    test -n "$package_url" \
      || func_fatal_error "unable to determine \`package_url' from \`$configure_ac'."

    func_verbose "package_url='$package_url'"

    require_package_url=:
}


# Local variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "# bootstrap.conf (GNU Libtool) version "
# time-stamp-format: "%:y-%02m-%02d"
# time-stamp-end: "$"
# End: