3 # Prepare a package to use libtool.
4 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
6 # Copyright (C) 2003-2019, 2021-2022 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/>.
28 # Run './libtoolize --help' for help with using this script from the
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"}
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'.
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
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
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: <http://www.gnu.org/gethelp/>."
132 warning_categories='environment file'
135 # libtoolize_environment_options [ARG]...
136 # ---------------------------------------
137 # Parse environment options.
138 libtoolize_environment_options ()
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"`
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'" ;;
158 # Pass back the updated list of options.
159 if test -n "$envopts"; then
160 func_quote eval "$envopts" ${1+"$@"}
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 ()
182 opt_nonrecursive=false
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 ()
199 # Perform our own loop to consume as many options as possible in
201 while test $# -gt 0; do
205 --copy|-c) opt_copy=: ;;
207 --dry-run|--dryrun|-n)
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=: ;;
222 if test 0 -lt $#; then
225 *) ltdl_dir=`$ECHO "$1" | $SED 's|/*$||'`
232 --nonrecursive|--non-recursive)
236 --quiet|--automake|-q) # --automake is for 1.5 compatibility
239 --recursive) opt_recursive=: ;;
241 --subproject) opt_subproject=: ;;
243 # Separate non-argument short options:
245 func_split_short_opt "$_G_opt"
246 set dummy "$func_split_short_opt_name" \
247 "-$func_split_short_opt_arg" ${1+"$@"}
251 # An option not handled by this hook function:
252 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
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
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
280 func_error "you can have at most one of --non-recursive, --recursive and --subproject"
282 elif $opt_subproject; then
286 # any remaining arguments are an error
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 ()
311 if test -n "$1"; then
314 if test -n "$my_msg"; then
315 func_notquiet "$my_msg"
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.
331 test -n "$*" || return
333 func_notquiet_once "$my_msg_var"
338 # func_notquiet_error_hdr MSG_VAR ARG...
339 # --------------------------------------
340 # Much the same as func_notquiet_header, but for (non-fatal) error
342 func_notquiet_error_hdr ()
347 test -n "$*" || return
349 func_notquiet_once "$my_msg_var"
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.
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"
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"
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
399 func_notquiet_once "$my_msg_var"
400 if $opt_verbose; then
401 func_notquiet "$SED -e '$my_filter' $my_srcfile > $my_destfile"
403 func_notquiet "creating file '$my_destfile'"
406 func_notquiet_error_hdr "$my_msg_var" "creating '$my_destfile' from '$my_srcfile' failed"
412 # Otherwise copy or link according to '--copy' option.
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
425 func_notquiet_hdr "$my_msg_var" "$my_copy_msg"
427 func_notquiet_error_hdr "$my_msg_var" \
428 "$my_copy_type '$my_srcdir/$my_filename' to '$my_destdir/' failed"
434 # func_included_files SEARCHFILE
435 # ------------------------------
436 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
437 func_included_files ()
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
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.
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.
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"
491 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
496 # If the file has no serial number, we assume it's ancient.
497 test -n "$my_serial" || my_serial=0
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.
515 my_sed_dot='s/\..*$//g'
516 my_sed_rest='s/^[0-9][1-9]*\.*//'
517 my_sed_digits='s/[^0-9.]//g'
519 # Incase 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"
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" \
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"`
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
556 func_serial_update_check ()
561 $require_ac_macro_dir
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."
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 ()
604 my_srcfile=$aclocaldir/$1
605 my_destfile=aclocal.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'`
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"`
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 ()
651 my_old_macro_regex=$6
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
679 func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
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', incase
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
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'."
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 ()
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."
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
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 ()
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 ()
792 /^timestamp='\''*[0-9][1-9-]*'\''*/ {
793 s|^timestamp='\''*\([0-9-]*\)'\''*|\1|
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 ()
815 /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
817 s|^scriptversion='\''*\([0-9.-]*\)'\''*|\1|
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 ()
836 $require_ac_macro_dir
837 $require_am_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"
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'."
854 my_pkgmacro_header="putting macros in '$macro_dir'."
857 for file in $pkgmacro_files; do
860 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
861 my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
865 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
866 my_pkgmacro_header 'LTDL_INIT'
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"
877 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
878 my_pkgmacro_header "$file"
880 func_verbose "Not copying '$macro_dir/$file', libltdl not used."
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 ()
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"
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'."
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
925 Makefile.am|Makefile.in)
926 test nonrecursive = "$ltdl_mode" && continue
927 my_copy_filter=$filter_Makefile_am
931 test nonrecursive = "$ltdl_mode" || continue
932 my_copy_filter=$filter_ltdl_mk
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.
942 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
943 pkgltdl_header "$filter_aclocal_m4"
950 test subproject = "$ltdl_mode" || continue
954 test subproject = "$ltdl_mode" && {
955 $require_filter_configure_ac
957 # Always copy configure, otherwise regenerating it can
958 # overwrite the destination if it is symlinked.
960 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
961 pkgltdl_header "$filter_configure_ac"
968 test subproject = "$ltdl_mode" || continue
969 $require_filter_configure_ac
970 my_copy_filter=$filter_configure_ac
974 # Still here? Copy the file then, with selected filters.
975 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
976 pkgltdl_header "$my_copy_filter"
978 # FIXME: Remove in 2013
979 # (along with deprecation warning in func_check_macros)
980 test ltdl.mk = "$file" \
981 && func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am \
982 && mv "$ltdl_dir/$file" "$ltdl_dir/Makefile.inc" \
983 && func_notquiet "renaming file '$ltdl_dir/Makefile.inc'"
988 # func_install_pkgaux_files
989 # -------------------------
990 # Install copies of the auxiliary files into this package according to
991 # the whether libltdl is included as a subproject, and whether the parent
992 # shares the AC_CONFIG_AUX_DIR setting.
993 func_install_pkgaux_files ()
999 $require_configure_ac
1002 # Remove any lingering files that my have been installed by some
1003 # previous libtoolize release:
1004 $opt_force && for file in $all_pkgaux_files; do
1005 test -f "$aux_dir/$file" && func_verbose "rm -f '$aux_dir/$file'"
1006 rm -f "$aux_dir/$file"
1009 if test -n "$ac_aux_dir"; then
1010 pkgaux_header="putting auxiliary files in AC_CONFIG_AUX_DIR, '$ac_aux_dir'."
1012 pkgaux_header="putting auxiliary files in '$aux_dir'."
1015 for file in $pkgaux_files; do
1017 config.guess|config.sub)
1018 $opt_install || test subproject = "$ltdl_mode" || continue
1019 func_config_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1022 $opt_install || test subproject = "$ltdl_mode" || continue
1023 func_install_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1026 func_ltmain_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1029 test subproject = "$ltdl_mode" || continue
1030 func_copy "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1035 # If the parent project is using Autoconf and linking with Libtool,
1036 # even if subproject libltdl already has a copy, the parent project
1037 # will still need to build libtool for its own purposes, and might
1038 # need another copy of ltmain.sh if the parent didn't declare an
1039 # AC_CONFIG_AUX_DIR.
1040 pkgaux_hdr="putting another copy of auxiliary files in '.'"
1041 test -f "$configure_ac" \
1042 && test -z "$ac_aux_dir" \
1043 && test subproject = "$ltdl_mode" \
1044 && test "$aux_dir" = "$ltdl_dir" \
1045 && func_ltmain_update "$file" "$pkgauxdir" . pkgaux_hdr
1047 # FIXME: Remove in 2013.
1048 # Very old parent projects using 'libtoolize --install --ltdl', and
1049 # a top-level $configure_ac to build the ltdl subproject, but not
1050 # using Automake themselves, might still be relying on the old
1051 # behaviour of libtoolize to put a second copy of some 'Auxiliary
1052 # Programs' needed by the top-level configure (instead of using
1053 # the recommended method: 'automake --add-missing').
1054 test -f "$configure_ac" \
1055 && test subproject = "$ltdl_mode" \
1056 && test "$aux_dir" = "$ltdl_dir" \
1057 && func_config_update config.guess "$pkgauxdir" . pkgaux_hdr \
1058 && func_config_update config.sub "$pkgauxdir" . pkgaux_hdr \
1059 && func_install_update install-sh "$pkgauxdir" . pkgaux_hdr
1063 # func_nonemptydir_p DIRVAR
1064 # -------------------------
1065 # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
1066 # a directory that exists and is non-empty abort with a diagnostic.
1067 func_nonemptydir_p ()
1072 my_dir=`eval echo "\\\$$my_dirvar"`
1074 # Is it a directory at all?
1076 || func_fatal_error "\$$my_dirvar is not a directory: '$my_dir'"
1078 # check that the directories contents can be ls'ed
1079 test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
1080 || func_fatal_error "cannot list files: '$my_dir'"
1086 # Sanity check macros from aclocal.m4 against installed versions.
1087 func_check_macros ()
1091 $require_ac_ltdl_dir
1092 $require_ac_macro_dir
1093 $require_am_macro_dir
1095 $require_configure_ac
1100 $require_seen_libtool
1102 $opt_quiet && return
1103 test -n "$configure_ac" || return
1105 ac_config_macro_dir_advised=false
1107 if test -z "$ac_macro_dir$am_macro_dir"; then
1109 for file in $pkgmacro_files; do
1111 ltargz.m4|ltdl.m4) $opt_ltdl || continue ;;
1113 if test -f "aclocal.m4"; then
1114 func_aclocal_update_check $file
1115 $func_aclocal_update_check_result || continue
1117 my_missing="$my_missing $file"
1120 if test -n "$my_missing"; then
1121 func_echo "You should add the contents of the following files to 'aclocal.m4':"
1122 for need in $my_missing; do
1123 func_echo " '$aclocaldir/$need'"
1128 ## ---------------------------------------------------------- ##
1129 ## Since we return early here when --no-warn was given: ##
1130 ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ##
1131 ## ---------------------------------------------------------- ##
1133 test " none" = "$opt_warning_types" && return
1136 func_echo "Remember to add 'LT_INIT' to $configure_ac."
1138 # Suggest using LTDL_INIT if appropriate:
1139 $opt_ltdl && if test : != "$seen_ltdl"; then
1141 subproject) ltdl_init_args= ;;
1142 *) ltdl_init_args="([$ltdl_mode])" ;;
1144 func_echo "Remember to add 'LTDL_INIT$ltdl_init_args' to $configure_ac."
1148 # Remind the user to call LT_CONFIG_LTDL_DIR:
1149 test -n "$ac_ltdl_dir" ||
1150 func_echo "Remember to add 'LT_CONFIG_LTDL_DIR([$ltdl_dir])' to '$configure_ac'."
1152 # For nonrecursive mode, warn about continued use of Makefile.inc:
1153 # FIXME: Remove in 2013
1154 # (along with last minute rename in func_install_pkgltdl_files)
1155 if test nonrecursive = "$ltdl_mode"; then
1156 if func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am;
1158 func_error "Use of 'include $ltdl_dir/Makefile.inc' is deprecated!"
1159 func_echo "Consider updating to use of 'include $ltdl_dir/ltdl.mk' in Makefile.am."
1164 # Suggest modern idioms for storing autoconf macros:
1165 $ac_config_macro_dir_advised || if test -z "$macro_dir" || test . = "$macro_dir"; then
1166 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to $configure_ac and"
1167 func_echo "rerunning $progname, to keep the correct libtool macros in-tree."
1168 ac_config_macro_dir_advised=:
1170 elif test -z "$ac_macro_dir"; then
1171 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([$macro_dir])' to $configure_ac,"
1172 func_echo "and rerunning $progname and aclocal."
1173 ac_config_macro_dir_advised=:
1176 if test -z "$am_macro_dir$ac_macro_dir"; then
1177 func_echo "Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
1179 elif test -z "$am_macro_dir"; then
1180 func_echo "Consider adding '-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am."
1183 # Don't trace for this, we're just checking the user didn't invoke it
1184 # directly from configure.ac.
1185 $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | $GREP AC_PROG_RANLIB >/dev/null &&
1186 func_echo "'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'"
1188 # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
1193 ## ------------------##
1194 ## Helper functions. ##
1195 ## ------------------##
1197 # This section contains the helper functions used by the rest of
1201 # func_autoconf_configure MAYBE-CONFIGURE-FILE
1202 # --------------------------------------------
1203 # Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
1204 # directory that contains an uncommented call to AC_INIT.
1205 func_autoconf_configure ()
1209 _G_sed_no_comment='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
1212 # If we were passed a genuine file, make sure it calls AC_INIT.
1214 && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
1216 # Otherwise it is not a genuine Autoconf input file.
1217 test -n "$_G_ac_init"
1220 test 0 -ne "$_G_status" \
1221 && func_verbose "'$1' not using Autoconf"
1227 # func_make_relative_dir_filter CURRDIR SRCDIR DESTDIR [PREFIX [SUFFIX]]
1228 # ----------------------------------------------------------------------
1229 # Make a sed script suitable for appending to a copy filter, which will
1230 # replace occurrences of CURRDIR with the relative path from SRCDIR to
1231 # DESTDIR if they are different, otherwise the result is the empty
1234 # func_make_relative_dir_filter ltdl config ../build-aux
1235 # => 's|\.\./build-aux|../config|g'
1236 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4
1237 # => 's|\.\./m4|m4|g'
1238 # func_make_relative_dir_filter libltdl build-aux ../build-aux
1241 # If PREFIX (and SUFFIX) are passed they are prepended (and appended)
1242 # to the match and replacement expressions literally:
1244 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4 '-I ' ' '
1245 # => 's|-I \.\./m4 |-I m4 |g'
1246 func_make_relative_dir_filter ()
1254 func_relative_path "$my_srcdir" "$my_destdir"
1256 if test "$my_currdir" = "$func_relative_path_result"; then
1257 func_make_relative_dir_filter_result=
1259 my_match_currdir=`$ECHO "$my_currdir" |$SED "$sed_make_literal_regex"`
1261 # Avoid substituting with 'dir/./file' when current dir is '.'.
1262 if test . = "$my_currdir"; then
1263 func_make_relative_dir_filter_result="
1264 s|$4$my_match_currdir/$5|$4$5|g"
1266 func_make_relative_dir_filter_result="
1267 s|$4$my_match_currdir$5|$4$func_relative_path_result$5|g"
1272 # func_make_relative_ltdl_filter CURRDIR DESTDIR [PREFIX [SUFFIX]]
1273 # ----------------------------------------------------------------
1274 # As 'func_make_relative_dir_filter' optimised for the common case where
1275 # SRCDIR is '$ltdl_dir'.
1276 func_make_relative_ltdl_filter ()
1282 func_make_relative_dir_filter "$1" "$ltdl_dir" "$2" "$3" "$4"
1283 func_make_relative_ltdl_filter_result=$func_make_relative_dir_filter_result
1287 ## -------------------- ##
1288 ## Resource management. ##
1289 ## -------------------- ##
1291 # This section contains definitions for functions that each ensure a
1292 # particular resource (a file, or a non-empty configuration variable for
1293 # example) is available, and if appropriate to extract default values
1294 # from pertinent package files. Where a variable already has a non-
1295 # empty value (as set by the package's 'bootstrap.conf'), that value is
1296 # used in preference to deriving the default. Call them using their
1297 # associated 'require_*' variable to ensure that they are executed, at
1300 # Some of the require functions are very similar, so we generate those
1301 # as this file is sourced. They look complicated, but they are the same
1302 # as normal function declarations wrapped in "eval '<definition>'", so
1303 # that embedded single quotes need to be escaped, and wherever a symbol
1304 # is generated, we drop out of the single quotes and expand a variable
1305 # that holds the symbol.
1307 # After that, the rest appear in asciibetical order.
1309 for base in '' ltdl_; do
1310 if test ltdl_ = "$base"; then p='$pkgltdldir/'; else p=; fi
1312 # require_Makefile_am
1313 # require_ltdl_Makefile_am
1314 # ------------------------
1315 # If not already set, set Makefile_am to 'Makefile.am' if that file is
1316 # present in the current directory, and similarly for
1317 # '$pkgltdldir/Makefile.am'.
1318 r=${base}Makefile_am
1326 test -n "$'$r'" || '$r'='$p'Makefile.am
1328 if test -f "$'$r'"; then
1329 func_verbose "found '\'\$$r\''"
1339 # require_aclocal_amflags
1340 # require_ltdl_aclocal_amflags
1341 # ----------------------------
1342 # Extract '$aclocal_amflags' from 'Makefile.am' if present, and
1343 # similarly for 'libltdl/Makefile.am'.
1344 r=${base}aclocal_amflags
1354 test -n "$'$o'" && {
1355 _G_sed_extract_aclocal_amflags='\''s|#.*$||
1356 /^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
1357 s|^.*=[ ]*\(.*\)|'$r'="\1"|
1361 _G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
1363 eval "$_G_aclocal_flags_cmd"
1365 test -n "$'$r'" && func_verbose "'$r'='\$$r\''"
1373 # require_am_macro_dir
1374 # require_ltdl_am_macro_dir
1375 # -------------------------
1376 # Set am_macro_dir to the first directory specified in
1377 # ACLOCAL_AMFLAGS from 'Makefile.am', and similarly for
1378 # 'libltdl/Makefile.am'.
1379 r=${base}am_macro_dir
1389 _G_minus_I_seen=false
1390 for _G_arg in $'$o'; do
1391 case $_G_minus_I_seen,$_G_arg in
1392 :,*) '$r'=$_G_arg; break ;;
1393 *,-I) _G_minus_I_seen=: ;;
1394 *,-I*) '$r'=`expr x$_G_arg : '\''x-I\(.*\)$'\''`; break ;;
1398 test -n "$'$r'" && func_verbose "'$r'='\'\$$r\''"
1407 # require_ac_aux_dir
1408 # ------------------
1409 # Extract ac_aux_dir from AC_CONFIG_AUX_DIR.
1410 require_ac_aux_dir=func_require_ac_aux_dir
1411 func_require_ac_aux_dir ()
1415 $require_configure_ac
1417 test -n "$configure_ac" && {
1418 func_extract_trace_first AC_CONFIG_AUX_DIR
1419 ac_aux_dir=$func_extract_trace_first_result
1424 cannot expand unknown variable in AC_CONFIG_AUX_DIR argument."
1429 test -n "$ac_aux_dir" && func_verbose "ac_aux_dir='$ac_aux_dir'"
1431 require_ac_aux_dir=:
1435 # require_ac_ltdl_dir
1436 # -------------------
1437 # Extract ac_ltdl_dir from LT_CONFIG_LTDL_DIR.
1438 require_ac_ltdl_dir=func_require_ac_ltdl_dir
1439 func_require_ac_ltdl_dir ()
1443 $require_configure_ac
1445 if test -n "$configure_ac"; then
1446 func_extract_trace_first LT_CONFIG_LTDL_DIR
1447 ac_ltdl_dir=$func_extract_trace_first_result
1449 case $ac_ltdl_dir in
1452 cannot expand unknown variable in LT_CONFIG_LTDL_DIR argument."
1457 # Strip trailing slashes.
1458 ac_ltdl_dir=`echo "$ac_ltdl_dir" |$SED 's|/*$||'`
1460 require_ac_ltdl_dir=:
1464 # require_ac_ltdl_mode
1465 # --------------------
1466 # Extract mode name from LTDL_INIT options.
1467 require_ac_ltdl_mode=func_require_ac_ltdl_mode
1468 func_require_ac_ltdl_mode ()
1472 $require_ac_ltdl_options
1474 case " $ac_ltdl_options " in
1475 *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;;
1476 *" recursive "*) ac_ltdl_mode=recursive ;;
1477 *" subproject "*) ac_ltdl_mode=subproject ;;
1480 require_ac_ltdl_mode=:
1484 # require_ac_ltdl_options
1485 # -----------------------
1486 # Extract ac_ltdl_options from LTDL_INIT.
1487 require_ac_ltdl_options=func_require_ac_ltdl_options
1488 func_require_ac_ltdl_options ()
1492 $require_configure_ac
1494 if test -n "$configure_ac"; then
1495 func_extract_trace_first LTDL_INIT
1496 ac_ltdl_options=$func_extract_trace_first_result
1498 case $ac_ltdl_options in
1501 cannot expand unknown variable in LTDL_INIT argument."
1506 require_ac_ltdl_mode=:
1510 # require_ac_macro_dir
1511 # --------------------
1512 # Extract ac_macro_dir from AC_CONFIG_MACRO_DIRS.
1513 require_ac_macro_dir=func_require_ac_macro_dir
1514 func_require_ac_macro_dir ()
1518 $require_configure_ac
1520 if test -n "$configure_ac"; then
1521 func_extract_trace_first AC_CONFIG_MACRO_DIRS
1522 ac_macro_dir=`expr "x$func_extract_trace_first_result" : 'x\([^ ]*\)'`
1524 test -n "$ac_macro_dir" || {
1525 func_extract_trace_first AC_CONFIG_MACRO_DIR
1526 ac_macro_dir=$func_extract_trace_first_result
1530 require_ac_macro_dir=:
1536 # Set aux_dir according to AC_CONFIG_AUX_DIR or else use the same
1537 # heuristics as Autoconf to intuit an appropriate setting.
1538 require_aux_dir=func_require_aux_dir
1539 func_require_aux_dir ()
1545 test -z "$aux_dir" && aux_dir=$ac_aux_dir
1547 # Subproject ltdl without $configure_ac keeps pkgauxfiles in
1548 # specified --ltdl optarg directory.
1549 test -z "$aux_dir" && $opt_ltdl && {
1550 $require_configure_ac
1552 test -n "$configure_ac" || {
1556 test subproject = "$ltdl_mode" && aux_dir=$ltdl_dir
1560 test -z "$aux_dir" && {
1561 # Try to intuit aux_dir using the same heuristic as Autoconf.
1562 for _G_dir in . .. ../..; do
1563 if test -f "$_G_dir/install-sh" || test -f "$_G_dir/install.sh"
1571 # Use the current directory if all else fails.
1572 test -z "$aux_dir" && aux_dir=.
1578 # require_configure_ac
1579 # --------------------
1580 # Ensure that there is a 'configure.ac' or 'configure.in' file in this
1581 # directory, and that '$configure_ac' contains its name.
1582 require_configure_ac=func_require_configure_ac
1583 func_require_configure_ac ()
1587 test -z "$configure_ac" \
1588 && func_autoconf_configure configure.ac && configure_ac=configure.ac
1589 test -z "$configure_ac" \
1590 && func_autoconf_configure configure.in && configure_ac=configure.in
1591 test -z "$configure_ac" \
1592 || func_verbose "found '$configure_ac'"
1594 require_configure_ac=:
1598 # require_filter_Makefile_am
1599 # --------------------------
1600 # Set 'filter_Makefile_am' ready for passing to func_copy when libltdl's
1601 # stock Makefile.am contents need to be filtered to work in recursive
1603 require_filter_Makefile_am=func_require_filter_Makefile_am
1604 func_require_filter_Makefile_am ()
1612 filter_Makefile_am='
1614 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1615 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1620 # Adjust default relative macro_dir paths.
1621 $require_ltdl_am_macro_dir
1623 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" '-I '
1624 test -z "$func_make_relative_ltdl_filter_result" || {
1625 func_append filter_Makefile_am "
1626 /^ACLOCAL_AMFLAGS = /{
1627 $func_make_relative_ltdl_filter_result
1630 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" 'dir)'
1631 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1633 # Adjust default relative aux_dir paths.
1634 $require_ltdl_ac_aux_dir
1635 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1636 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1640 require_filter_Makefile_am=:
1644 # require_filter_aclocal_m4
1645 # -------------------------
1646 # Set 'filter_aclocal_m4' ready for passing to func_copy when libltdl's
1647 # stock aclocal.m4 contents need to be filtered to work in recursive
1649 require_filter_aclocal_m4=func_require_filter_aclocal_m4
1650 func_require_filter_aclocal_m4 ()
1654 $require_ltdl_am_macro_dir
1656 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir"
1658 test -z "$func_make_relative_ltdl_filter_result" || {
1659 func_append filter_aclocal_m4 "
1661 $func_make_relative_ltdl_filter_result
1665 require_filter_aclocal_m4=:
1669 # require_filter_configure_ac
1670 # ---------------------------
1671 # Set 'filter_configure_ac' ready for passing to func_copy when
1672 # libltdl's stock configure.ac contents need to be filtered to work in
1674 require_filter_configure_ac=func_require_filter_configure_ac
1675 func_require_filter_configure_ac ()
1679 $require_ltdl_ac_aux_dir
1681 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1682 func_append filter_configure_ac "$func_make_relative_ltdl_filter_result"
1684 require_filter_configure_ac=:
1688 # require_filter_ltdl_mk
1689 # ----------------------
1690 # Set 'filter_ltdl_mk' ready for passing to func_copy in order for the
1691 # contents of ltdl.mk to match the nonrecursive libltdl directory into
1692 # which it is copied.
1693 require_filter_ltdl_mk=func_require_filter_ltdl_mk
1694 func_require_filter_ltdl_mk ()
1700 # Note that we strip comments right here, rather than rely on
1701 # using a $SED that allows comments.
1702 my_uscore=`$ECHO "$ltdl_dir" | $SED 's|[/.+-]|_|g'`
1703 filter_ltdl_mk=`$ECHO '
1706 # Use only libltdl conditional objects.
1707 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1708 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1710 # Convert libltdl path and variable sections to $ltdl_dir.
1711 s|libltdl_|@my_uscore@_|
1712 s|libltdl/|@ltdl_dir@/|
1713 s|: libltdl/|: @ltdl_dir@/|
1714 s| -Ilibltdl | -I@ltdl_dir@ |
1715 s|\$(libltdl_|\$(@my_uscore@_|
1716 s|)/libltdl |)/@ltdl_dir@ |
1717 s|@my_uscore@|'"$my_uscore"'|g
1718 s|@ltdl_dir@|'"$ltdl_dir"'|g
1720 }' | $SED '/^[ ]*#/d;/^$/d'`
1722 require_filter_ltdl_mk=:
1726 # require_ltdl_ac_aux_dir
1727 # -----------------------
1728 # This needs to work in subproject mode, when GNU M4 may not be
1729 # available and hence extract-trace can't be used. But since we
1730 # installed libltdl/configure.ac, then we already know what value
1732 require_ltdl_ac_aux_dir=func_require_ltdl_ac_aux_dir
1733 func_require_ltdl_ac_aux_dir ()
1737 ltdl_ac_aux_dir="@ltdl_ac_aux_dir@"
1738 func_verbose "ltdl_ac_aux_dir='$ltdl_ac_aux_dir'"
1740 require_ltdl_ac_aux_dir=:
1746 # If both are specified, ensure both --ltdl=LTDL_DIR and
1747 # LT_CONFIG_LTDL_DIR agree, and set ltdl_dir to the value of either.
1748 require_ltdl_dir=func_require_ltdl_dir
1749 func_require_ltdl_dir ()
1753 $require_ac_ltdl_dir
1755 test -z "$ltdl_dir" && ltdl_dir=$ac_ltdl_dir
1756 test -z "$ltdl_dir" && $opt_ltdl && ltdl_dir=libltdl
1758 if test -n "$ac_ltdl_dir"; then
1759 test "$ac_ltdl_dir" = "$ltdl_dir" || func_fatal_error "\
1760 --ltdl='$ltdl_dir' does not match LT_CONFIG_LTDL_DIR($ac_ltdl_dir)"
1769 # If both are specified, ensure both command line setting and LTDL_INIT
1770 # option agree, and set ltdl_mode to the value of either.
1771 require_ltdl_mode=func_require_ltdl_mode
1772 func_require_ltdl_mode ()
1776 $require_ac_ltdl_mode
1778 test -z "$ltdl_mode" && ltdl_mode=$ac_ltdl_mode
1779 test -z "$ltdl_mode" && {
1782 test -n "$ltdl_dir" && ltdl_mode=subproject
1785 if test -n "$ac_ltdl_mode"; then
1786 test "$ac_ltdl_mode" = "$ltdl_mode" || func_fatal_error "\
1787 --$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
1790 func_verbose "ltdl mode='$ltdl_mode'"
1798 # If both are specified, ensure both ACLOCAL_AMFLAGS and
1799 # AC_CONFIG_MACRO_DIRS agree, and set macro_dir to the value of either.
1800 require_macro_dir=func_require_macro_dir
1801 func_require_macro_dir ()
1805 $require_ac_macro_dir
1806 $require_am_macro_dir
1808 # AC_CONFIG_MACRO_DIRS takes precedence.
1809 macro_dir=$ac_macro_dir
1811 # Followed by first -I optarg from ACLOCAL_AMFLAGS.
1812 test -z "$macro_dir" && macro_dir=$am_macro_dir
1814 # Subproject ltdl without either of the above keeps macros in
1815 # specified --ltdl optarg subdirectory.
1816 test -z "$macro_dir" && $opt_ltdl && {
1820 test subproject = "$ltdl_mode" && macro_dir=$ltdl_dir/m4
1823 # Use ./m4 as the last resort.
1824 test -z "$macro_dir" && macro_dir=m4
1826 # Diagnose conflicts.
1827 if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then
1828 test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\
1829 AC_CONFIG_MACRO_DIRS([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
1838 # Determine from contents of $configure_ac whether this project contains
1840 require_seen_ltdl=func_require_seen_ltdl
1841 func_require_seen_ltdl ()
1845 $require_configure_ac
1847 if test -n "$configure_ac"; then
1848 func_extract_trace AC_LIB_LTDL,AC_WITH_LTDL,LT_WITH_LTDL,LTDL_INIT
1849 test -n "$func_extract_trace_result" && seen_ltdl=:
1851 test -n "$seen_ltdl" || seen_ltdl=false
1853 $seen_ltdl && func_verbose "found LTDL_INIT invocation"
1859 # require_seen_libtool
1860 # --------------------
1861 # Determine from contents of $configure_ac whether this project is using
1862 # Libtool to compile (some of) its objects.
1863 require_seen_libtool=func_require_seen_libtool
1864 func_require_seen_libtool ()
1868 $require_configure_ac
1870 if test -n "$configure_ac"; then
1871 func_extract_trace AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
1872 test -n "$func_extract_trace_result" && seen_libtool=:
1874 test -n "$seen_libtool" || seen_libtool=false
1876 $seen_libtool && func_verbose "found LT_INIT invocation"
1878 require_seen_libtool=:
1888 # Lists of all files libtoolize has ever installed. These are removed
1889 # before installing the latest files when --force was passed to help
1890 # ensure a clean upgrade.
1891 # Do not remove config.guess, config.sub or install-sh, we don't
1892 # install them without --install, and the project may not be using
1893 # Automake. Similarly, do not remove Gnulib files.
1894 all_pkgaux_files="compile depcomp missing ltmain.sh"
1895 all_pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4"
1896 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"
1898 # Files installed by func_install_*, some files are missing from these
1899 # lists deliberately because their respective func_install has to handle
1900 # the missing filenames specially.
1901 pkgaux_files="@pkgaux_files@"
1902 pkgltdl_files="@pkgltdl_files@"
1903 pkgmacro_files="@pkgmacro_files@"
1905 # Locations for important files:
1908 pkgauxdir="@pkgauxdir@"
1909 pkgltdldir="@pkgdatadir@"
1910 aclocaldir="@aclocaldir@"
1912 # Allow the user to override the master libtoolize repository:
1913 if test -n "$_lt_pkgdatadir"; then
1914 pkgauxdir=$_lt_pkgdatadir/build-aux
1915 pkgltdldir=$_lt_pkgdatadir/libltdl
1916 aclocaldir=$_lt_pkgdatadir/m4
1918 func_nonemptydir_p pkgauxdir
1919 func_nonemptydir_p pkgltdldir
1920 func_nonemptydir_p aclocaldir
1922 extract_trace=$pkgauxdir/extract-trace
1924 # :::BE CAREFUL HERE:::
1925 # func_check_macros needs to check whether --ltdl was specified when
1926 # LTDL_INIT was not seen, so we can't just use one variable for both
1927 # conditions, or that check will be impossible. No need to clutter the
1928 # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
1929 # safely set opt_ltdl to true if LTDL_INIT was seen:
1931 $seen_ltdl && opt_ltdl=:
1933 func_install_pkgaux_files
1934 func_install_pkgmacro_files
1935 func_install_pkgltdl_files