ltmain.in: Use func_warning for all warnings
[libtool.git] / libtoolize.in
blob336fc81bd5ea5aea162e941bebd4a453a453fa58
1 #! /usr/bin/env sh
3 # Prepare a package to use libtool.
4 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
6 # Copyright (C) 2003-2019, 2021-2024 Free Software Foundation, Inc.
7 # This is free software; see the source for copying conditions. There is NO
8 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # Libtoolize is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # Libtoolize is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 ## ------ ##
25 ## Usage. ##
26 ## ------ ##
28 # Run './libtoolize --help' for help with using this script from the
29 # command line.
32 ## ------------------------------- ##
33 ## User overridable command paths. ##
34 ## ------------------------------- ##
36 # After configure completes, it has a better idea of some of the
37 # shell tools we need than the defaults used by the functions shared
38 # with bootstrap, so set those here where they can still be over-
39 # ridden by the user, but otherwise take precedence.
41 : ${AUTOCONF="autoconf"}
42 : ${AUTOMAKE="automake"}
43 : ${EGREP="@EGREP@"}
44 : ${FGREP="@FGREP@"}
45 : ${GREP="@GREP@"}
46 : ${LN_S="@LN_S@"}
47 : ${SED="@SED@"}
50 ## -------------------------- ##
51 ## Source external libraries. ##
52 ## -------------------------- ##
54 # Much of our low-level functionality needs to be sourced from external
55 # libraries, which are installed to $pkgauxdir under normal use, though
56 # we also need to be able to find them in $srcdir during testing, or if
57 # executed directly from the build tree.
59 . "@auxscriptsdir@/funclib.sh"
60 . "@auxscriptsdir@/options-parser"
61 . "@auxscriptsdir@/extract-trace"
63 # Set a version string.
64 scriptversion='(GNU @PACKAGE@) @VERSION@'
67 ## ---------------- ##
68 ## Options parsing. ##
69 ## ---------------- ##
71 # Hook in the functions to make sure our own options are parsed during
72 # the option parsing loop.
74 usage='$progpath [OPTION]...'
76 # Short help message in response to '-h'.
77 usage_message="Options:
78 -c, --copy copy files rather than symlinking them
79 --debug enable verbose shell tracing
80 -n, --dry-run print commands rather than running them
81 -f, --force replace existing files
82 -i, --install copy missing auxiliary files
83 --ltdl[=DIR] install libltdl sources [default: libltdl]
84 --no-warnings equivalent to '-Wnone'
85 --nonrecursive prepare ltdl for non-recursive make
86 -q, --quiet work silently
87 --recursive prepare ltdl for recursive make
88 --subproject prepare ltdl to configure and build independently
89 -v, --verbose verbosely report processing
90 --version print version information and exit
91 -W, --warnings=CATEGORY
92 report the warnings falling in CATEGORY [all]
93 -h, --help print short or long help message
96 # Additional text appended to 'usage_message' in response to '--help'.
97 func_help ()
99 $debug_cmd
101 func_usage_message
102 $ECHO "$long_help_message
103 'environment' show warnings about LIBTOOLIZE_OPTIONS content
104 'file' show warnings about file copying and linking
106 The following space or comma delimited options can be passed to $progname
107 via the environment variable LIBTOOLIZE_OPTIONS, unknown environment
108 options are ignored:
110 --debug enable verbose shell tracing
111 --no-warnings don't display warning messages
112 --quiet work silently
113 --verbose verbosely report processing
115 You must 'cd' to the top directory of your package before you run
116 '$progname'.
118 When reporting a bug, please describe a test case to reproduce it and
119 include the following information:
121 host-triplet: @host_triplet@
122 version: $progname (GNU @PACKAGE@) @VERSION@
123 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
124 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
126 Report bugs to <@PACKAGE_BUGREPORT@>.
127 GNU @PACKAGE@ home page: <@PACKAGE_URL@>.
128 General help using GNU software: <https://www.gnu.org/gethelp/>."
129 exit 0
132 warning_categories='environment file'
135 # libtoolize_environment_options [ARG]...
136 # ---------------------------------------
137 # Parse environment options.
138 libtoolize_environment_options ()
140 $debug_mode
142 my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q'
143 my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q'
145 while test -n "$LIBTOOLIZE_OPTIONS"; do
146 opt=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_opt"`
147 LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_rest"`
149 case $opt in
150 --debug|--no-warn|--no-warning|--no-warnings|--quiet|--verbose)
151 envopts="${envopts+$envopts }$opt" ;;
152 --*) env_warning="${env_warning+$env_warning
153 }unrecognized environment option '$opt'" ;;
154 *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near '$opt'" ;;
155 esac
156 done
158 # Pass back the updated list of options.
159 if test -n "$envopts"; then
160 func_quote eval "$envopts" ${1+"$@"}
161 else
162 func_quote eval ${1+"$@"}
164 libtoolize_environment_options_result=$func_quote_result
166 func_add_hook func_options_prep libtoolize_environment_options
169 # libtoolize_options_prep [ARG]...
170 # --------------------------------
171 # Preparation for options parsed by libtoolize.
172 libtoolize_options_prep ()
174 $debug_cmd
176 # Option defaults:
177 opt_copy=false
178 opt_dry_run=false
179 opt_force=false
180 opt_install=false
181 opt_ltdl=false
182 opt_nonrecursive=false
183 opt_quiet=false
184 opt_recursive=false
185 opt_subproject=false
187 ltdl_mode=
189 func_add_hook func_options_prep libtoolize_options_prep
192 # libtoolize_parse_options [ARG]...
193 # ---------------------------------
194 # Provide handling for libtoolize specific options.
195 libtoolize_parse_options ()
197 $debug_cmd
199 # Perform our own loop to consume as many options as possible in
200 # each iteration.
201 while test $# -gt 0; do
202 _G_opt=$1
203 shift
204 case $_G_opt in
205 --copy|-c) opt_copy=: ;;
207 --dry-run|--dryrun|-n)
208 $opt_dry_run || {
209 opt_dry_run=:
210 CP="func_echo_all $CP"
211 test -n "$LN_S" && LN_S="func_echo_all $LN_S"
212 MKDIR="func_echo_all $MKDIR"
213 RM="func_echo_all $RM"
217 --force|-f) opt_force=: ;;
219 --install|-i) opt_install=: ;;
221 --ltdl) opt_ltdl=:
222 if test 0 -lt $#; then
223 case $1 in
224 -*) ;;
225 *) ltdl_dir=`$ECHO "$1" | $SED 's|/*$||'`
226 shift
228 esac
232 --nonrecursive|--non-recursive)
233 opt_nonrecursive=:
236 --quiet|--automake|-q) # --automake is for 1.5 compatibility
237 opt_quiet=: ;;
239 --recursive) opt_recursive=: ;;
241 --subproject) opt_subproject=: ;;
243 # Separate non-argument short options:
244 -c*|-f*|-i*|-n*|-q*)
245 func_split_short_opt "$_G_opt"
246 set dummy "$func_split_short_opt_name" \
247 "-$func_split_short_opt_arg" ${1+"$@"}
248 shift
251 # An option not handled by this hook function:
252 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
253 esac
254 done
256 # save modified positional parameters for caller
257 func_quote eval ${1+"$@"}
258 libtoolize_parse_options_result=$func_quote_result
260 func_add_hook func_parse_options libtoolize_parse_options
263 # libtoolize_validate_options [ARG]...
264 # ------------------------------------
265 # Perform any sanity checks on option settings and/or unconsumed
266 # arguments.
267 libtoolize_validate_options ()
269 # show any warnings saved by LIBTOOLIZE_OPTIONS parsing
270 test -n "$env_warning" && func_warning environment "$env_warning"
272 # validate $opt_nonrecursive, $opt_recursive and $opt_subproject
273 if $opt_nonrecursive; then
274 if $opt_recursive || $opt_subproject; then
275 func_error "you can have at most one of --non-recursive, --recursive and --subproject"
277 ltdl_mode=nonrecursive
278 elif $opt_recursive; then
279 $opt_subproject &&
280 func_error "you can have at most one of --non-recursive, --recursive and --subproject"
281 ltdl_mode=recursive
282 elif $opt_subproject; then
283 ltdl_mode=subproject
286 # any remaining arguments are an error
287 test 0 -lt $# &&
288 func_fatal_help "unknown additional arguments: '${1+$@}'"
290 # Pass back the empty argument list
291 func_quote eval ${1+"$@"}
292 libtoolize_validate_options_result=$func_quote_result
294 func_add_hook func_validate_options libtoolize_validate_options
297 # Process options as early as possible so that --help and --version
298 # can return quickly.
299 func_options ${1+"$@"}
300 eval set dummy "$func_options_result"; shift
303 # func_notquiet_once MSG_VAR
304 # --------------------------
305 # Call func_notquiet with the value of MSG_VAR, and then set MSG_VAR='' so
306 # that subsequent calls will have no effect.
307 func_notquiet_once ()
309 $debug_cmd
311 if test -n "$1"; then
312 eval my_msg=\$$1
314 if test -n "$my_msg"; then
315 func_notquiet "$my_msg"
316 eval $1=
322 # func_notquiet_hdr MSG_VAR ARG...
323 # --------------------------------
324 # With at least 1 non-empty ARG, call func_notquiet_once with MSG_VAR,
325 # and then func_notquiet with the remaining arguments.
326 func_notquiet_hdr ()
328 $debug_cmd
330 my_msg_var=$1; shift
331 test -n "$*" || return
333 func_notquiet_once "$my_msg_var"
334 func_notquiet "$*"
338 # func_notquiet_error_hdr MSG_VAR ARG...
339 # --------------------------------------
340 # Much the same as func_notquiet_header, but for (non-fatal) error
341 # messages.
342 func_notquiet_error_hdr ()
344 $debug_cmd
346 my_msg_var=$1; shift
347 test -n "$*" || return
349 func_notquiet_once "$my_msg_var"
350 func_error "$*"
352 exit_status=$EXIT_FAILURE
356 # func_copy FILENAME SRCDIR DESTDIR [MSG_VAR [FILTER]]
357 # ----------------------------------------------------
358 # If option '--copy' was specified, or soft-linking SRCFILE to DESTFILE
359 # fails, then try to copy SRCFILE to DESTFILE (making sure to update the
360 # timestamp so that a series of files with dependencies can be copied
361 # in the right order that their timestamps won't trigger rebuilds). If
362 # FILTER is non-empty, it is a sed script to apply to SRCFILE as it is
363 # copied. MSG_VAR names a variable for use with func_notquiet_hdr.
364 func_copy ()
366 $debug_cmd
368 my_filename=$1
369 my_srcdir=$2
370 my_destdir=$3
371 my_msg_var=$4
372 my_filter=$5
374 my_srcfile=$my_srcdir/$my_filename
375 my_destfile=$my_destdir/$my_filename
377 # Libtool is probably misinstalled if this happens:
378 test -f "$my_srcfile" || {
379 func_notquiet_error_hdr "$my_msg_var" "'$my_srcfile' not found"
380 return 1
383 # Require --force to remove existing $my_destfile.
384 $opt_force && $RM "$my_destfile"
385 test -f "$my_destfile" && {
386 func_notquiet_error_hdr "$my_msg_var" \
387 "'$my_destfile' exists: use '--force' to overwrite"
388 return 1
391 # Be careful to support 'func_copy dir/target srcbase destbase'.
392 func_dirname "$my_destfile"
393 func_mkdir_p "$func_dirname_result"
395 # Filters always take priority.
396 if test -n "$my_filter"; then
397 if $opt_dry_run || $SED -e "$my_filter" "$my_srcfile" > "$my_destfile" 2>/dev/null
398 then
399 func_notquiet_once "$my_msg_var"
400 if $opt_verbose; then
401 func_notquiet "$SED -e '$my_filter' $my_srcfile > $my_destfile"
402 else
403 func_notquiet "creating file '$my_destfile'"
405 else
406 func_notquiet_error_hdr "$my_msg_var" "creating '$my_destfile' from '$my_srcfile' failed"
407 return 1
409 return 0
412 # Otherwise copy or link according to '--copy' option.
413 if $opt_copy; then
414 my_copycmd=$CP
415 my_copy_type=copying
416 else
417 my_copycmd=$LN_S
418 my_copy_type=linking
420 my_copy_msg="$my_copy_type file '$my_destfile'"
421 $opt_verbose && my_copy_msg="$my_copycmd $my_srcfile $my_destdir"
423 if $opt_dry_run || $my_copycmd "$my_srcfile" "$my_destfile" 2>/dev/null
424 then
425 func_notquiet_hdr "$my_msg_var" "$my_copy_msg"
426 else
427 func_notquiet_error_hdr "$my_msg_var" \
428 "$my_copy_type '$my_srcdir/$my_filename' to '$my_destdir/' failed"
429 return 1
434 # func_included_files SEARCHFILE
435 # ------------------------------
436 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
437 func_included_files ()
439 $debug_cmd
441 my_searchfile=$1
443 my_include_regex=
444 my_sed_include='
445 /^m4_include(\[.*\])$/ {
446 s|^m4_include(\[\(.*\)\])$|\1|
451 if test -f "$my_searchfile"; then
452 $ECHO "$my_searchfile"
454 # Only recurse when we don't care if all the variables we use get
455 # trashed, since they are in global scope.
456 for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
457 func_included_files $my_filename
458 done
463 # func_serial FILENAME [MACRO_REGEX]
464 # ----------------------------------
465 # Output the value of the serial number comment in FILENAME, where the
466 # comment line must also match MACRO_REGEX, if given.
467 func_serial ()
469 $debug_cmd
471 my_filename=$1
472 my_macro_regex=$2
473 my_sed_serial='
474 /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
475 s|^# serial \([1-9][0-9.]*\).*$|\1|
480 # Search FILENAME and all the files it m4_includes for a serial number
481 # in the file that AC_DEFUNs MACRO_REGEX.
482 my_serial=
483 func_dirname_and_basename "$my_filename"
484 my_filebase=$func_basename_result
485 for my_file in `func_included_files "$my_filename"`; do
486 if test -z "$my_macro_regex" ||
487 test aclocal.m4 = "$my_filename" ||
488 test "X$my_macro_regex" = "X$my_filebase" ||
489 func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file"
490 then
491 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
492 break
494 done
496 # If the file has no serial number, we assume it's ancient.
497 test -n "$my_serial" || my_serial=0
499 $ECHO "$my_serial"
503 # func_serial_max SERIAL1 SERIAL2
504 # -------------------------------
505 # Compare (possibly multi-part, '.' delimited) serial numbers, and
506 # return the largest in $func_serial_max_result. If they are the
507 # same, func_serial_max_result will be empty.
508 func_serial_max ()
510 $debug_cmd
512 my_serial1=$1
513 my_serial2=$2
515 my_sed_dot='s/\..*$//g'
516 my_sed_rest='s/^[0-9][1-9]*\.*//'
517 my_sed_digits='s/[^0-9.]//g'
519 # In case they turn out to be the same, we'll set it to empty
520 func_serial_max_result=
522 test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || {
523 func_error "serial numbers '$1' or '$2' contain non-digit chars"
524 return
527 while test -n "$my_serial1$my_serial2"; do
528 my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"`
529 my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"`
531 test -z "$my_serial1_part$my_serial2_part" \
532 && break
534 test -z "$my_serial1_part" \
535 && { func_serial_max_result=$2; break; }
537 test -z "$my_serial2_part" \
538 && { func_serial_max_result=$1; break; }
540 test "$my_serial1_part" -gt "$my_serial2_part" \
541 && { func_serial_max_result=$1; break; }
543 test "$my_serial2_part" -gt "$my_serial1_part" \
544 && { func_serial_max_result=$2; break; }
546 my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"`
547 my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"`
548 done
552 # func_serial_update_check SRCFILE SRC_SERIAL DESTFILE DEST_SERIAL
553 # ----------------------------------------------------------------
554 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
555 # to 'false'.
556 func_serial_update_check ()
558 $debug_cmd
560 $require_ac_ltdl_dir
561 $require_ac_macro_dir
563 my_srcfile=$1
564 my_src_serial=$2
565 my_destfile=$3
566 my_dest_serial=$4
567 my_update_p=:
569 if test -f "$my_destfile"; then
570 test 0 = "$my_src_serial" && {
571 func_warning file "no serial number on '$my_srcfile', not copying."
572 return
575 # Determine whether the destination has an older serial.
576 func_serial_max "$my_src_serial" "$my_dest_serial"
577 test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
579 test "X$my_src_serial" = "X$func_serial_max_result" \
580 && func_verbose "'$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in '$my_destfile'"
582 if test "X$my_dest_serial" = "X$func_serial_max_result"; then
583 func_verbose "'$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in '$my_destfile'"
584 $opt_force || if test -n "$ac_macro_dir$ac_ltdl_dir"; then
585 func_error "'$my_destfile' is newer: use '--force' to overwrite"
590 func_serial_update_check_result=$my_update_p
594 # func_aclocal_update_check FILENAME
595 # ----------------------------------
596 # Unless serial number of FILENAME is newer than the matching serial number
597 # in aclocal.m4, set $func_aclocal_update_check to 'false'.
598 func_aclocal_update_check ()
600 $debug_cmd
602 my_filename=$1
604 my_srcfile=$aclocaldir/$1
605 my_destfile=aclocal.m4
607 case $my_filename in
608 libtool.m4)
609 my_src_serial=`func_serial "$my_srcfile" LT_INIT`
610 my_dest_serial=`func_serial "$my_destfile" LT_INIT`
612 # Strictly, this libtoolize ought not to have to deal with ancient
613 # serial formats, but we accept them here to be complete:
614 test 0 = "$my_src_serial" &&
615 my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'`
616 test 0 = "$my_dest_serial" &&
617 my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'`
619 ltdl.m4)
620 my_src_serial=`func_serial "$my_srcfile" LTDL_INIT`
621 my_dest_serial=`func_serial "$my_destfile" LTDL_INIT`
624 my_src_serial=`func_serial "$my_srcfile" "$my_filename"`
625 my_dest_serial=`func_serial "$my_destfile" "$my_filename"`
627 esac
629 func_serial_update_check \
630 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
632 func_aclocal_update_check_result=$func_serial_update_check_result
636 # func_serial_update FILENAME SRCDIR DESTDIR [MSG_VAR] [MACRO_RE] [OLD_MACRO_RE]
637 # ------------------------------------------------------------------------------
638 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
639 # has a newer serial number, or DESTFILE does not yet exist, or the user
640 # specified '--force' at the command line. If given, MACRO_REGEX or
641 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
642 func_serial_update ()
644 $debug_cmd
646 my_filename=$1
647 my_srcdir=$2
648 my_destdir=$3
649 my_msg_var=$4
650 my_macro_regex=$5
651 my_old_macro_regex=$6
653 my_serial_update_p=:
654 my_return_status=1
655 my_srcfile=$my_srcdir/$my_filename
656 my_destfile=$my_destdir/$my_filename
658 test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
660 if test -f "$my_destfile"; then
661 my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
662 my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
664 # Strictly, this libtoolize ought not to have to deal with ancient
665 # serial formats, but we accept them here to be complete:
666 test 0 = "$my_src_serial" &&
667 my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
669 test 0 = "$my_dest_serial" &&
670 my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
672 func_serial_update_check \
673 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
674 my_serial_update_p=$func_serial_update_check_result
677 if $my_serial_update_p || $opt_force; then
678 $RM "$my_destfile"
679 func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
680 my_return_status=$?
681 elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
682 func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
685 # Do this after the copy for hand maintained 'aclocal.m4', in case
686 # it has 'm4_include([DESTFILE])', so the copy effectively already
687 # updated 'aclocal.m4'.
688 my_included_files=`func_included_files aclocal.m4`
689 case `echo " "$my_included_files" "` in
691 # Skip included files:
692 *" $my_destfile "*) ;;
694 # Otherwise compare to aclocal.m4 serial number (func_serial
695 # returns 0 for older macro serial numbers before we provided
696 # serial tags, so the update message will be correctly given
697 # if aclocal.m4 contains an untagged --i.e older-- macro file):
699 if test -f aclocal.m4; then
700 func_serial_max \
701 "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
702 if test "X$my_src_serial" = "X$func_serial_max_result"; then
703 func_notquiet_hdr "$my_msg_var" \
704 "You should add the contents of '$my_destfile' to 'aclocal.m4'."
708 esac
709 return $my_return_status
713 # func_keyword_update FILENAME SRCDIR DESTDIR SED_SCRIPT [MSG_VAR]
714 # ----------------------------------------------------------------
715 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
716 # has a newer revision according to the serial number extracted by
717 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
718 # '--force' at the command line.
719 func_keyword_update ()
721 $debug_cmd
723 my_filename=$1
724 my_srcdir=$2
725 my_destdir=$3
726 my_sed_script=$4
727 my_msg_var=$5
729 my_srcfile=$my_srcdir/$my_filename
730 my_destfile=$my_destdir/$my_filename
732 my_keyword_update_p=:
734 test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
736 if test -f "$my_destfile"; then
737 my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
738 test -z "$my_src_serial" && {
739 func_warning file "no serial number in '$my_srcfile', not copying."
740 return
743 my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
744 test -n "$my_dest_serial" || my_dest_serial=0
746 func_serial_update_check \
747 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
748 my_keyword_update_p=$func_serial_update_check_result
751 if $my_keyword_update_p || $opt_force; then
752 $RM "$my_destfile"
753 func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
754 elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
755 func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
760 # func_ltmain_update FILENAME SRCDIR DESTDIR [MSG_VAR]
761 # ----------------------------------------------------
762 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
763 # has a newer revision, or DESTFILE does not yet exist, or the user
764 # specified '--force' at the command line.
765 func_ltmain_update ()
767 $debug_cmd
769 my_sed_ltmain='
770 /^package_revision='\''*[0-9][1-9.]*'\''*/ {
771 s|^package_revision='\''*\([0-9.]*\)'\''*[ ]*$|\1|
776 func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4"
778 return $my_return_status
782 # func_config_update FILENAME SRCDIR DESTDIR [MSG_VAR]
783 # ----------------------------------------------------
784 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
785 # has a newer timestamp, or DESTFILE does not yet exist, or the user
786 # specified '--force' at the command line.
787 func_config_update ()
789 $debug_cmd
791 my_sed_config='
792 /^timestamp='\''*[0-9][1-9-]*'\''*/ {
793 s|^timestamp='\''*\([0-9-]*\)'\''*|\1|
794 s|-|.|g
799 func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4"
801 return $my_return_status
805 # func_install_update FILENAME SRCDIR DESTDIR [MSG_VAR]
806 # -----------------------------------------------------
807 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
808 # has a newer timestamp, or DESTFILE does not yet exist, or the user
809 # specified '--force' at the command line.
810 func_install_update ()
812 $debug_cmd
814 my_sed_install='
815 /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
816 s|[#;].*||
817 s|^scriptversion='\''*\([0-9.-]*\)'\''*|\1|
818 s|-|.|g
823 func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4"
825 return $my_return_status
829 # func_install_pkgmacro_files
830 # ---------------------------
831 # Install copies of the libtool and libltdl m4 macros into this package.
832 func_install_pkgmacro_files ()
834 $debug_cmd
836 $require_ac_macro_dir
837 $require_am_macro_dir
838 $require_ltdl_mode
839 $require_macro_dir
841 $opt_ltdl || test -n "$ac_macro_dir$am_macro_dir" || return
843 # Remove any lingering files that my have been installed by some
844 # previous libtoolize release:
845 $opt_force && for file in $all_pkgmacro_files; do
846 test -f "$macro_dir/$file" && func_verbose "rm -f '$macro_dir/$file'"
847 rm -f "$macro_dir/$file"
848 done
850 # Install the libltdl autoconf macros to this project's source tree.
851 $opt_quiet || if test -n "$ac_macro_dir"; then
852 my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIRS, '$ac_macro_dir'."
853 else
854 my_pkgmacro_header="putting macros in '$macro_dir'."
857 for file in $pkgmacro_files; do
858 case $file in
859 libtool.m4)
860 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
861 my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
863 ltdl.m4)
864 if $opt_ltdl; then
865 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
866 my_pkgmacro_header 'LTDL_INIT'
867 else
868 func_verbose "Not copying '$macro_dir/$file', libltdl not used."
871 ltoptions.m4|ltsugar.m4|ltversion.m4|lt~obsolete.m4)
872 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
873 my_pkgmacro_header "$file"
876 if $opt_ltdl; then
877 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
878 my_pkgmacro_header "$file"
879 else
880 func_verbose "Not copying '$macro_dir/$file', libltdl not used."
883 esac
884 done
888 # func_install_pkgltdl_files
889 # --------------------------
890 # Install copies of the libltdl files into this package. Any auxiliary
891 # or m4 macro files needed in the libltdl tree will also be copied by
892 # func_install_pkgaux_files and func_install_pkgmacro_files resp.
893 func_install_pkgltdl_files ()
895 $debug_cmd
897 $opt_ltdl || return
899 $require_ac_ltdl_dir
900 $require_ltdl_dir
901 $require_ltdl_mode
903 # Remove any lingering files that my have been installed by some
904 # previous libtoolize release:
905 $opt_force && for file in $all_pkgltdl_files; do
906 test -f "$ltdl_dir/$file" && func_verbose "rm -f '$ltdl_dir/$file'"
907 rm -f "$ltdl_dir/$file"
908 done
910 # Copy all the files from installed libltdl to this project, if the
911 # user specified '--ltdl'.
912 $opt_quiet || if test -n "$ac_ltdl_dir"; then
913 pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, '$ac_ltdl_dir'."
914 else
915 pkgltdl_header="putting libltdl files in '$ltdl_dir'."
918 $require_filter_Makefile_am
919 $require_filter_ltdl_mk
921 # Copy ltdl sources appropriate to the requested ltdl_mode.
922 for file in $pkgltdl_files; do
923 my_copy_filter=
924 case $file in
925 Makefile.am|Makefile.in)
926 test nonrecursive = "$ltdl_mode" && continue
927 my_copy_filter=$filter_Makefile_am
930 ltdl.mk)
931 test nonrecursive = "$ltdl_mode" || continue
932 my_copy_filter=$filter_ltdl_mk
935 aclocal.m4)
936 test subproject = "$ltdl_mode" && {
937 $require_filter_aclocal_m4
939 # Always copy aclocal.m4, otherwise regenerating it can
940 # overwrite the destination if it is symlinked.
941 ( opt_copy=:
942 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
943 pkgltdl_header "$filter_aclocal_m4"
946 continue
949 config-h.in)
950 test subproject = "$ltdl_mode" && {
951 # Always copy config-h.in, otherwise automake's autoheader rules
952 # will change the destination's timestamp if it is symlinked.
953 ( opt_copy=:
954 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
955 pkgltdl_header "$my_copy_filter"
958 continue
961 configure)
962 test subproject = "$ltdl_mode" && {
963 $require_filter_configure_ac
965 # Always copy configure, otherwise regenerating it can
966 # overwrite the destination if it is symlinked.
967 ( opt_copy=:
968 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
969 pkgltdl_header "$filter_configure_ac"
972 continue
975 configure.ac)
976 test subproject = "$ltdl_mode" || continue
977 $require_filter_configure_ac
978 my_copy_filter=$filter_configure_ac
980 esac
982 # Still here? Copy the file then, with selected filters.
983 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
984 pkgltdl_header "$my_copy_filter"
986 # FIXME: Remove in 2013
987 # (along with deprecation warning in func_check_macros)
988 test ltdl.mk = "$file" \
989 && func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am \
990 && mv "$ltdl_dir/$file" "$ltdl_dir/Makefile.inc" \
991 && func_notquiet "renaming file '$ltdl_dir/Makefile.inc'"
992 done
996 # func_install_pkgaux_files
997 # -------------------------
998 # Install copies of the auxiliary files into this package according to
999 # the whether libltdl is included as a subproject, and whether the parent
1000 # shares the AC_CONFIG_AUX_DIR setting.
1001 func_install_pkgaux_files ()
1003 $debug_cmd
1005 $require_ac_aux_dir
1006 $require_aux_dir
1007 $require_configure_ac
1008 $require_ltdl_mode
1010 # Remove any lingering files that my have been installed by some
1011 # previous libtoolize release:
1012 $opt_force && for file in $all_pkgaux_files; do
1013 test -f "$aux_dir/$file" && func_verbose "rm -f '$aux_dir/$file'"
1014 rm -f "$aux_dir/$file"
1015 done
1017 if test -n "$ac_aux_dir"; then
1018 pkgaux_header="putting auxiliary files in AC_CONFIG_AUX_DIR, '$ac_aux_dir'."
1019 else
1020 pkgaux_header="putting auxiliary files in '$aux_dir'."
1023 for file in $pkgaux_files; do
1024 case $file in
1025 config.guess|config.sub)
1026 $opt_install || test subproject = "$ltdl_mode" || continue
1027 func_config_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1029 install-sh)
1030 $opt_install || test subproject = "$ltdl_mode" || continue
1031 func_install_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1033 ltmain.sh)
1034 func_ltmain_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1037 test subproject = "$ltdl_mode" || continue
1038 func_copy "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1040 esac
1041 done
1043 # If the parent project is using Autoconf and linking with Libtool,
1044 # even if subproject libltdl already has a copy, the parent project
1045 # will still need to build libtool for its own purposes, and might
1046 # need another copy of ltmain.sh if the parent didn't declare an
1047 # AC_CONFIG_AUX_DIR.
1048 pkgaux_hdr="putting another copy of auxiliary files in '.'"
1049 test -f "$configure_ac" \
1050 && test -z "$ac_aux_dir" \
1051 && test subproject = "$ltdl_mode" \
1052 && test "$aux_dir" = "$ltdl_dir" \
1053 && func_ltmain_update "$file" "$pkgauxdir" . pkgaux_hdr
1055 # FIXME: Remove in 2013.
1056 # Very old parent projects using 'libtoolize --install --ltdl', and
1057 # a top-level $configure_ac to build the ltdl subproject, but not
1058 # using Automake themselves, might still be relying on the old
1059 # behaviour of libtoolize to put a second copy of some 'Auxiliary
1060 # Programs' needed by the top-level configure (instead of using
1061 # the recommended method: 'automake --add-missing').
1062 test -f "$configure_ac" \
1063 && test subproject = "$ltdl_mode" \
1064 && test "$aux_dir" = "$ltdl_dir" \
1065 && func_config_update config.guess "$pkgauxdir" . pkgaux_hdr \
1066 && func_config_update config.sub "$pkgauxdir" . pkgaux_hdr \
1067 && func_install_update install-sh "$pkgauxdir" . pkgaux_hdr
1071 # func_nonemptydir_p DIRVAR
1072 # -------------------------
1073 # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
1074 # a directory that exists and is non-empty abort with a diagnostic.
1075 func_nonemptydir_p ()
1077 $debug_cmd
1079 my_dirvar=$1
1080 my_dir=`eval echo "\\\$$my_dirvar"`
1082 # Is it a directory at all?
1083 test -d "$my_dir" \
1084 || func_fatal_error "\$$my_dirvar is not a directory: '$my_dir'"
1086 # check that the directories contents can be ls'ed
1087 test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
1088 || func_fatal_error "cannot list files: '$my_dir'"
1092 # func_check_macros
1093 # -----------------
1094 # Sanity check macros from aclocal.m4 against installed versions.
1095 func_check_macros ()
1097 $debug_cmd
1099 $require_ac_ltdl_dir
1100 $require_ac_macro_dir
1101 $require_am_macro_dir
1102 $require_aux_dir
1103 $require_configure_ac
1104 $require_ltdl_dir
1105 $require_ltdl_mode
1106 $require_macro_dir
1107 $require_seen_ltdl
1108 $require_seen_libtool
1110 $opt_quiet && return
1111 test -n "$configure_ac" || return
1113 ac_config_macro_dir_advised=false
1115 if test -z "$ac_macro_dir$am_macro_dir"; then
1116 my_missing=
1117 for file in $pkgmacro_files; do
1118 case $file in
1119 ltargz.m4|ltdl.m4) $opt_ltdl || continue ;;
1120 esac
1121 if test -f "aclocal.m4"; then
1122 func_aclocal_update_check $file
1123 $func_aclocal_update_check_result || continue
1125 my_missing="$my_missing $file"
1126 done
1128 if test -n "$my_missing"; then
1129 func_echo "You should add the contents of the following files to 'aclocal.m4':"
1130 for need in $my_missing; do
1131 func_echo " '$aclocaldir/$need'"
1132 done
1136 ## ---------------------------------------------------------- ##
1137 ## Since we return early here when --no-warn was given: ##
1138 ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ##
1139 ## ---------------------------------------------------------- ##
1141 test " none" = "$opt_warning_types" && return
1143 $seen_libtool ||
1144 func_echo "Remember to add 'LT_INIT' to $configure_ac."
1146 # Suggest using LTDL_INIT if appropriate:
1147 $opt_ltdl && if test : != "$seen_ltdl"; then
1148 case $ltdl_mode in
1149 subproject) ltdl_init_args= ;;
1150 *) ltdl_init_args="([$ltdl_mode])" ;;
1151 esac
1152 func_echo "Remember to add 'LTDL_INIT$ltdl_init_args' to $configure_ac."
1155 if $opt_ltdl; then
1156 # Remind the user to call LT_CONFIG_LTDL_DIR:
1157 test -n "$ac_ltdl_dir" ||
1158 func_echo "Remember to add 'LT_CONFIG_LTDL_DIR([$ltdl_dir])' to '$configure_ac'."
1160 # For nonrecursive mode, warn about continued use of Makefile.inc:
1161 # FIXME: Remove in 2013
1162 # (along with last minute rename in func_install_pkgltdl_files)
1163 if test nonrecursive = "$ltdl_mode"; then
1164 if func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am;
1165 then
1166 func_error "Use of 'include $ltdl_dir/Makefile.inc' is deprecated!"
1167 func_echo "Consider updating to use of 'include $ltdl_dir/ltdl.mk' in Makefile.am."
1172 # Suggest modern idioms for storing autoconf macros:
1173 $ac_config_macro_dir_advised || if test -z "$macro_dir" || test . = "$macro_dir"; then
1174 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to $configure_ac and"
1175 func_echo "rerunning $progname, to keep the correct libtool macros in-tree."
1176 ac_config_macro_dir_advised=:
1178 elif test -z "$ac_macro_dir"; then
1179 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([$macro_dir])' to $configure_ac,"
1180 func_echo "and rerunning $progname and aclocal."
1181 ac_config_macro_dir_advised=:
1184 if test -z "$am_macro_dir$ac_macro_dir"; then
1185 func_echo "Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
1187 elif test -z "$am_macro_dir"; then
1188 func_echo "Consider adding '-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am."
1191 # Don't trace for this, we're just checking the user didn't invoke it
1192 # directly from configure.ac.
1193 $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | $GREP AC_PROG_RANLIB >/dev/null &&
1194 func_echo "'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'"
1196 # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
1201 ## ------------------##
1202 ## Helper functions. ##
1203 ## ------------------##
1205 # This section contains the helper functions used by the rest of
1206 # this script.
1209 # func_autoconf_configure MAYBE-CONFIGURE-FILE
1210 # --------------------------------------------
1211 # Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
1212 # directory that contains an uncommented call to AC_INIT.
1213 func_autoconf_configure ()
1215 $debug_cmd
1217 _G_sed_no_comment='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
1218 _G_ac_init=
1220 # If we were passed a genuine file, make sure it calls AC_INIT.
1221 test -f "$1" \
1222 && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
1224 # Otherwise it is not a genuine Autoconf input file.
1225 test -n "$_G_ac_init"
1226 _G_status=$?
1228 test 0 -ne "$_G_status" \
1229 && func_verbose "'$1' not using Autoconf"
1231 (exit $_G_status)
1235 # func_make_relative_dir_filter CURRDIR SRCDIR DESTDIR [PREFIX [SUFFIX]]
1236 # ----------------------------------------------------------------------
1237 # Make a sed script suitable for appending to a copy filter, which will
1238 # replace occurrences of CURRDIR with the relative path from SRCDIR to
1239 # DESTDIR if they are different, otherwise the result is the empty
1240 # string:
1242 # func_make_relative_dir_filter ltdl config ../build-aux
1243 # => 's|\.\./build-aux|../config|g'
1244 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4
1245 # => 's|\.\./m4|m4|g'
1246 # func_make_relative_dir_filter libltdl build-aux ../build-aux
1247 # => ''
1249 # If PREFIX (and SUFFIX) are passed they are prepended (and appended)
1250 # to the match and replacement expressions literally:
1252 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4 '-I ' ' '
1253 # => 's|-I \.\./m4 |-I m4 |g'
1254 func_make_relative_dir_filter ()
1256 $debug_cmd
1258 my_currdir=$1
1259 my_srcdir=$2
1260 my_destdir=$3
1262 func_relative_path "$my_srcdir" "$my_destdir"
1264 if test "$my_currdir" = "$func_relative_path_result"; then
1265 func_make_relative_dir_filter_result=
1266 else
1267 my_match_currdir=`$ECHO "$my_currdir" |$SED "$sed_make_literal_regex"`
1269 # Avoid substituting with 'dir/./file' when current dir is '.'.
1270 if test . = "$my_currdir"; then
1271 func_make_relative_dir_filter_result="
1272 s|$4$my_match_currdir/$5|$4$5|g"
1273 else
1274 func_make_relative_dir_filter_result="
1275 s|$4$my_match_currdir$5|$4$func_relative_path_result$5|g"
1280 # func_make_relative_ltdl_filter CURRDIR DESTDIR [PREFIX [SUFFIX]]
1281 # ----------------------------------------------------------------
1282 # As 'func_make_relative_dir_filter' optimised for the common case where
1283 # SRCDIR is '$ltdl_dir'.
1284 func_make_relative_ltdl_filter ()
1286 $debug_cmd
1288 $require_ltdl_dir
1290 func_make_relative_dir_filter "$1" "$ltdl_dir" "$2" "$3" "$4"
1291 func_make_relative_ltdl_filter_result=$func_make_relative_dir_filter_result
1295 ## -------------------- ##
1296 ## Resource management. ##
1297 ## -------------------- ##
1299 # This section contains definitions for functions that each ensure a
1300 # particular resource (a file, or a non-empty configuration variable for
1301 # example) is available, and if appropriate to extract default values
1302 # from pertinent package files. Where a variable already has a non-
1303 # empty value (as set by the package's 'bootstrap.conf'), that value is
1304 # used in preference to deriving the default. Call them using their
1305 # associated 'require_*' variable to ensure that they are executed, at
1306 # most, once.
1308 # Some of the require functions are very similar, so we generate those
1309 # as this file is sourced. They look complicated, but they are the same
1310 # as normal function declarations wrapped in "eval '<definition>'", so
1311 # that embedded single quotes need to be escaped, and wherever a symbol
1312 # is generated, we drop out of the single quotes and expand a variable
1313 # that holds the symbol.
1315 # After that, the rest appear in asciibetical order.
1317 for base in '' ltdl_; do
1318 if test ltdl_ = "$base"; then p='$pkgltdldir/'; else p=; fi
1320 # require_Makefile_am
1321 # require_ltdl_Makefile_am
1322 # ------------------------
1323 # If not already set, set Makefile_am to 'Makefile.am' if that file is
1324 # present in the current directory, and similarly for
1325 # '$pkgltdldir/Makefile.am'.
1326 r=${base}Makefile_am
1327 v=require_$r
1328 f=func_$v
1329 eval $v'='$f'
1330 '$f' ()
1332 $debug_cmd
1334 test -n "$'$r'" || '$r'='$p'Makefile.am
1336 if test -f "$'$r'"; then
1337 func_verbose "found '\'\$$r\''"
1338 else
1339 '$r'=
1342 '$v'=:
1344 o=$r
1347 # require_aclocal_amflags
1348 # require_ltdl_aclocal_amflags
1349 # ----------------------------
1350 # Extract '$aclocal_amflags' from 'Makefile.am' if present, and
1351 # similarly for 'libltdl/Makefile.am'.
1352 r=${base}aclocal_amflags
1353 v=require_$r
1354 f=func_$v
1355 eval $v'='$f'
1356 '$f' ()
1358 $debug_cmd
1360 $require_'$o'
1362 test -n "$'$o'" && {
1363 _G_sed_extract_aclocal_amflags='\''s|#.*$||
1364 /^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
1365 s|^.*=[ ]*\(.*\)|'$r'="\1"|
1367 }'\''
1369 _G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
1370 "$'$o'"`
1371 eval "$_G_aclocal_flags_cmd"
1373 test -n "$'$r'" && func_verbose "'$r'='\$$r\''"
1376 '$v'=:
1378 o=$r
1381 # require_am_macro_dir
1382 # require_ltdl_am_macro_dir
1383 # -------------------------
1384 # Set am_macro_dir to the first directory specified in
1385 # ACLOCAL_AMFLAGS from 'Makefile.am', and similarly for
1386 # 'libltdl/Makefile.am'.
1387 r=${base}am_macro_dir
1388 v=require_$r
1389 f=func_$v
1390 eval $v'='$f'
1391 '$f' ()
1393 $debug_cmd
1395 $require_'$o'
1397 _G_minus_I_seen=false
1398 for _G_arg in $'$o'; do
1399 case $_G_minus_I_seen,$_G_arg in
1400 :,*) '$r'=$_G_arg; break ;;
1401 *,-I) _G_minus_I_seen=: ;;
1402 *,-I*) '$r'=`expr x$_G_arg : '\''x-I\(.*\)$'\''`; break ;;
1403 esac
1404 done
1406 test -n "$'$r'" && func_verbose "'$r'='\'\$$r\''"
1408 '$v'=:
1410 o=$r
1412 done
1415 # require_ac_aux_dir
1416 # ------------------
1417 # Extract ac_aux_dir from AC_CONFIG_AUX_DIR.
1418 require_ac_aux_dir=func_require_ac_aux_dir
1419 func_require_ac_aux_dir ()
1421 $debug_cmd
1423 $require_configure_ac
1425 test -n "$configure_ac" && {
1426 func_extract_trace_first AC_CONFIG_AUX_DIR
1427 ac_aux_dir=$func_extract_trace_first_result
1429 case $ac_aux_dir in
1430 *\$*)
1431 func_fatal_error "\
1432 cannot expand unknown variable in AC_CONFIG_AUX_DIR argument."
1434 esac
1437 test -n "$ac_aux_dir" && func_verbose "ac_aux_dir='$ac_aux_dir'"
1439 require_ac_aux_dir=:
1443 # require_ac_ltdl_dir
1444 # -------------------
1445 # Extract ac_ltdl_dir from LT_CONFIG_LTDL_DIR.
1446 require_ac_ltdl_dir=func_require_ac_ltdl_dir
1447 func_require_ac_ltdl_dir ()
1449 $debug_cmd
1451 $require_configure_ac
1453 if test -n "$configure_ac"; then
1454 func_extract_trace_first LT_CONFIG_LTDL_DIR
1455 ac_ltdl_dir=$func_extract_trace_first_result
1457 case $ac_ltdl_dir in
1458 *\$*)
1459 func_fatal_error "\
1460 cannot expand unknown variable in LT_CONFIG_LTDL_DIR argument."
1462 esac
1465 # Strip trailing slashes.
1466 ac_ltdl_dir=`echo "$ac_ltdl_dir" |$SED 's|/*$||'`
1468 require_ac_ltdl_dir=:
1472 # require_ac_ltdl_mode
1473 # --------------------
1474 # Extract mode name from LTDL_INIT options.
1475 require_ac_ltdl_mode=func_require_ac_ltdl_mode
1476 func_require_ac_ltdl_mode ()
1478 $debug_cmd
1480 $require_ac_ltdl_options
1482 case " $ac_ltdl_options " in
1483 *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;;
1484 *" recursive "*) ac_ltdl_mode=recursive ;;
1485 *" subproject "*) ac_ltdl_mode=subproject ;;
1486 esac
1488 require_ac_ltdl_mode=:
1492 # require_ac_ltdl_options
1493 # -----------------------
1494 # Extract ac_ltdl_options from LTDL_INIT.
1495 require_ac_ltdl_options=func_require_ac_ltdl_options
1496 func_require_ac_ltdl_options ()
1498 $debug_cmd
1500 $require_configure_ac
1502 if test -n "$configure_ac"; then
1503 func_extract_trace_first LTDL_INIT
1504 ac_ltdl_options=$func_extract_trace_first_result
1506 case $ac_ltdl_options in
1507 *\$*)
1508 func_fatal_error "\
1509 cannot expand unknown variable in LTDL_INIT argument."
1511 esac
1514 require_ac_ltdl_mode=:
1518 # require_ac_macro_dir
1519 # --------------------
1520 # Extract ac_macro_dir from AC_CONFIG_MACRO_DIRS.
1521 require_ac_macro_dir=func_require_ac_macro_dir
1522 func_require_ac_macro_dir ()
1524 $debug_cmd
1526 $require_configure_ac
1528 if test -n "$configure_ac"; then
1529 func_extract_trace_first AC_CONFIG_MACRO_DIRS
1530 ac_macro_dir=`expr "x$func_extract_trace_first_result" : 'x\([^ ]*\)'`
1532 test -n "$ac_macro_dir" || {
1533 func_extract_trace_first AC_CONFIG_MACRO_DIR
1534 ac_macro_dir=$func_extract_trace_first_result
1538 require_ac_macro_dir=:
1542 # require_aux_dir
1543 # ---------------
1544 # Set aux_dir according to AC_CONFIG_AUX_DIR or else use the same
1545 # heuristics as Autoconf to intuit an appropriate setting.
1546 require_aux_dir=func_require_aux_dir
1547 func_require_aux_dir ()
1549 $debug_cmd
1551 $require_ac_aux_dir
1553 test -z "$aux_dir" && aux_dir=$ac_aux_dir
1555 # Subproject ltdl without $configure_ac keeps pkgauxfiles in
1556 # specified --ltdl optarg directory.
1557 test -z "$aux_dir" && $opt_ltdl && {
1558 $require_configure_ac
1560 test -n "$configure_ac" || {
1561 $require_ltdl_dir
1562 $require_ltdl_mode
1564 test subproject = "$ltdl_mode" && aux_dir=$ltdl_dir
1568 test -z "$aux_dir" && {
1569 # Try to intuit aux_dir using the same heuristic as Autoconf.
1570 for _G_dir in . .. ../..; do
1571 if test -f "$_G_dir/install-sh" || test -f "$_G_dir/install.sh"
1572 then
1573 aux_dir=$_G_dir
1574 break
1576 done
1579 # Use the current directory if all else fails.
1580 test -z "$aux_dir" && aux_dir=.
1582 require_aux_dir=:
1586 # require_configure_ac
1587 # --------------------
1588 # Ensure that there is a 'configure.ac' or 'configure.in' file in this
1589 # directory, and that '$configure_ac' contains its name.
1590 require_configure_ac=func_require_configure_ac
1591 func_require_configure_ac ()
1593 $debug_cmd
1595 test -z "$configure_ac" \
1596 && func_autoconf_configure configure.ac && configure_ac=configure.ac
1597 test -z "$configure_ac" \
1598 && func_autoconf_configure configure.in && configure_ac=configure.in
1599 test -z "$configure_ac" \
1600 || func_verbose "found '$configure_ac'"
1602 require_configure_ac=:
1606 # require_filter_Makefile_am
1607 # --------------------------
1608 # Set 'filter_Makefile_am' ready for passing to func_copy when libltdl's
1609 # stock Makefile.am contents need to be filtered to work in recursive
1610 # mode.
1611 require_filter_Makefile_am=func_require_filter_Makefile_am
1612 func_require_filter_Makefile_am ()
1614 $debug_cmd
1616 $require_ltdl_mode
1618 case $ltdl_mode in
1619 recursive)
1620 filter_Makefile_am='
1621 /^[^#]/{
1622 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1623 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1627 subproject)
1628 # Adjust default relative macro_dir paths.
1629 $require_ltdl_am_macro_dir
1631 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" '-I '
1632 test -z "$func_make_relative_ltdl_filter_result" || {
1633 func_append filter_Makefile_am "
1634 /^ACLOCAL_AMFLAGS = /{
1635 $func_make_relative_ltdl_filter_result
1638 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" 'dir)'
1639 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1641 # Adjust default relative aux_dir paths.
1642 $require_ltdl_ac_aux_dir
1643 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1644 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1646 esac
1648 require_filter_Makefile_am=:
1652 # require_filter_aclocal_m4
1653 # -------------------------
1654 # Set 'filter_aclocal_m4' ready for passing to func_copy when libltdl's
1655 # stock aclocal.m4 contents need to be filtered to work in recursive
1656 # mode.
1657 require_filter_aclocal_m4=func_require_filter_aclocal_m4
1658 func_require_filter_aclocal_m4 ()
1660 $debug_cmd
1662 $require_ltdl_am_macro_dir
1664 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir"
1666 test -z "$func_make_relative_ltdl_filter_result" || {
1667 func_append filter_aclocal_m4 "
1668 /^[m]4_include(/{
1669 $func_make_relative_ltdl_filter_result
1673 require_filter_aclocal_m4=:
1677 # require_filter_configure_ac
1678 # ---------------------------
1679 # Set 'filter_configure_ac' ready for passing to func_copy when
1680 # libltdl's stock configure.ac contents need to be filtered to work in
1681 # subproject mode.
1682 require_filter_configure_ac=func_require_filter_configure_ac
1683 func_require_filter_configure_ac ()
1685 $debug_cmd
1687 $require_ltdl_ac_aux_dir
1689 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1690 func_append filter_configure_ac "$func_make_relative_ltdl_filter_result"
1692 require_filter_configure_ac=:
1696 # require_filter_ltdl_mk
1697 # ----------------------
1698 # Set 'filter_ltdl_mk' ready for passing to func_copy in order for the
1699 # contents of ltdl.mk to match the nonrecursive libltdl directory into
1700 # which it is copied.
1701 require_filter_ltdl_mk=func_require_filter_ltdl_mk
1702 func_require_filter_ltdl_mk ()
1704 $debug_cmd
1706 $require_ltdl_dir
1708 # Note that we strip comments right here, rather than rely on
1709 # using a $SED that allows comments.
1710 my_uscore=`$ECHO "$ltdl_dir" | $SED 's|[/.+-]|_|g'`
1711 filter_ltdl_mk=`$ECHO '
1712 /^[^#]/{
1714 # Use only libltdl conditional objects.
1715 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1716 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1718 # Convert libltdl path and variable sections to $ltdl_dir.
1719 s|libltdl_|@my_uscore@_|
1720 s|libltdl/|@ltdl_dir@/|
1721 s|: libltdl/|: @ltdl_dir@/|
1722 s| -Ilibltdl | -I@ltdl_dir@ |
1723 s|\$(libltdl_|\$(@my_uscore@_|
1724 s|)/libltdl |)/@ltdl_dir@ |
1725 s|@my_uscore@|'"$my_uscore"'|g
1726 s|@ltdl_dir@|'"$ltdl_dir"'|g
1728 }' | $SED '/^[ ]*#/d;/^$/d'`
1730 require_filter_ltdl_mk=:
1734 # require_ltdl_ac_aux_dir
1735 # -----------------------
1736 # This needs to work in subproject mode, when GNU M4 may not be
1737 # available and hence extract-trace can't be used. But since we
1738 # installed libltdl/configure.ac, then we already know what value
1739 # we used.
1740 require_ltdl_ac_aux_dir=func_require_ltdl_ac_aux_dir
1741 func_require_ltdl_ac_aux_dir ()
1743 $debug_cmd
1745 ltdl_ac_aux_dir="@ltdl_ac_aux_dir@"
1746 func_verbose "ltdl_ac_aux_dir='$ltdl_ac_aux_dir'"
1748 require_ltdl_ac_aux_dir=:
1752 # require_ltdl_dir
1753 # ----------------
1754 # If both are specified, ensure both --ltdl=LTDL_DIR and
1755 # LT_CONFIG_LTDL_DIR agree, and set ltdl_dir to the value of either.
1756 require_ltdl_dir=func_require_ltdl_dir
1757 func_require_ltdl_dir ()
1759 $debug_cmd
1761 $require_ac_ltdl_dir
1763 test -z "$ltdl_dir" && ltdl_dir=$ac_ltdl_dir
1764 test -z "$ltdl_dir" && $opt_ltdl && ltdl_dir=libltdl
1766 if test -n "$ac_ltdl_dir"; then
1767 test "$ac_ltdl_dir" = "$ltdl_dir" || func_fatal_error "\
1768 --ltdl='$ltdl_dir' does not match LT_CONFIG_LTDL_DIR($ac_ltdl_dir)"
1771 require_ltdl_dir=:
1775 # require_ltdl_mode
1776 # -----------------
1777 # If both are specified, ensure both command line setting and LTDL_INIT
1778 # option agree, and set ltdl_mode to the value of either.
1779 require_ltdl_mode=func_require_ltdl_mode
1780 func_require_ltdl_mode ()
1782 $debug_cmd
1784 $require_ac_ltdl_mode
1786 test -z "$ltdl_mode" && ltdl_mode=$ac_ltdl_mode
1787 test -z "$ltdl_mode" && {
1788 $require_ltdl_dir
1790 test -n "$ltdl_dir" && ltdl_mode=subproject
1793 if test -n "$ac_ltdl_mode"; then
1794 test "$ac_ltdl_mode" = "$ltdl_mode" || func_fatal_error "\
1795 --$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
1798 func_verbose "ltdl mode='$ltdl_mode'"
1800 require_ltdl_mode=:
1804 # require_macro_dir
1805 # -----------------
1806 # If both are specified, ensure both ACLOCAL_AMFLAGS and
1807 # AC_CONFIG_MACRO_DIRS agree, and set macro_dir to the value of either.
1808 require_macro_dir=func_require_macro_dir
1809 func_require_macro_dir ()
1811 $debug_cmd
1813 $require_ac_macro_dir
1814 $require_am_macro_dir
1816 # AC_CONFIG_MACRO_DIRS takes precedence.
1817 macro_dir=$ac_macro_dir
1819 # Followed by first -I optarg from ACLOCAL_AMFLAGS.
1820 test -z "$macro_dir" && macro_dir=$am_macro_dir
1822 # Subproject ltdl without either of the above keeps macros in
1823 # specified --ltdl optarg subdirectory.
1824 test -z "$macro_dir" && $opt_ltdl && {
1825 $require_ltdl_dir
1826 $require_ltdl_mode
1828 test subproject = "$ltdl_mode" && macro_dir=$ltdl_dir/m4
1831 # Use ./m4 as the last resort.
1832 test -z "$macro_dir" && macro_dir=m4
1834 # Diagnose conflicts.
1835 if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then
1836 test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\
1837 AC_CONFIG_MACRO_DIRS([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
1840 require_macro_dir=:
1844 # require_seen_ltdl
1845 # -----------------
1846 # Determine from contents of $configure_ac whether this project contains
1847 # libltdl.
1848 require_seen_ltdl=func_require_seen_ltdl
1849 func_require_seen_ltdl ()
1851 $debug_cmd
1853 $require_configure_ac
1855 if test -n "$configure_ac"; then
1856 func_extract_trace AC_LIB_LTDL,AC_WITH_LTDL,LT_WITH_LTDL,LTDL_INIT
1857 test -n "$func_extract_trace_result" && seen_ltdl=:
1859 test -n "$seen_ltdl" || seen_ltdl=false
1861 $seen_ltdl && func_verbose "found LTDL_INIT invocation"
1863 require_seen_ltdl=:
1867 # require_seen_libtool
1868 # --------------------
1869 # Determine from contents of $configure_ac whether this project is using
1870 # Libtool to compile (some of) its objects.
1871 require_seen_libtool=func_require_seen_libtool
1872 func_require_seen_libtool ()
1874 $debug_cmd
1876 $require_configure_ac
1878 if test -n "$configure_ac"; then
1879 func_extract_trace AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
1880 test -n "$func_extract_trace_result" && seen_libtool=:
1882 test -n "$seen_libtool" || seen_libtool=false
1884 $seen_libtool && func_verbose "found LT_INIT invocation"
1886 require_seen_libtool=:
1891 ## ----------- ##
1892 ## Main. ##
1893 ## ----------- ##
1896 # Lists of all files libtoolize has ever installed. These are removed
1897 # before installing the latest files when --force was passed to help
1898 # ensure a clean upgrade.
1899 # Do not remove config.guess, config.sub or install-sh, we don't
1900 # install them without --install, and the project may not be using
1901 # Automake. Similarly, do not remove Gnulib files.
1902 all_pkgaux_files="compile depcomp missing ltmain.sh"
1903 all_pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4"
1904 all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__argz.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__argz.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h ltdl.mk slist.c"
1906 # Files installed by func_install_*, some files are missing from these
1907 # lists deliberately because their respective func_install has to handle
1908 # the missing filenames specially.
1909 pkgaux_files="@pkgaux_files@"
1910 pkgltdl_files="@pkgltdl_files@"
1911 pkgmacro_files="@pkgmacro_files@"
1913 # Locations for important files:
1914 prefix="@prefix@"
1915 datadir="@datadir@"
1916 pkgauxdir="@pkgauxdir@"
1917 pkgltdldir="@pkgdatadir@"
1918 aclocaldir="@aclocaldir@"
1920 # Allow the user to override the master libtoolize repository:
1921 if test -n "$_lt_pkgdatadir"; then
1922 pkgauxdir=$_lt_pkgdatadir/build-aux
1923 pkgltdldir=$_lt_pkgdatadir/libltdl
1924 aclocaldir=$_lt_pkgdatadir/m4
1926 func_nonemptydir_p pkgauxdir
1927 func_nonemptydir_p pkgltdldir
1928 func_nonemptydir_p aclocaldir
1930 extract_trace=$pkgauxdir/extract-trace
1932 # :::BE CAREFUL HERE:::
1933 # func_check_macros needs to check whether --ltdl was specified when
1934 # LTDL_INIT was not seen, so we can't just use one variable for both
1935 # conditions, or that check will be impossible. No need to clutter the
1936 # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
1937 # safely set opt_ltdl to true if LTDL_INIT was seen:
1938 $require_seen_ltdl
1939 $seen_ltdl && opt_ltdl=:
1941 func_install_pkgaux_files
1942 func_install_pkgmacro_files
1943 func_install_pkgltdl_files
1945 func_check_macros
1948 exit $exit_status
1950 # Local Variables:
1951 # mode:shell-script
1952 # sh-indentation:2
1953 # End: