3 # Prepare a package to use libtool.
4 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
6 # Copyright (C) 2003-2015 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'.
97 long_help_message=$long_help_message"
98 'environment' show warnings about LIBTOOLIZE_OPTIONS content
99 'file' show warnings about file copying and linking
101 The following space or comma delimited options can be passed to $progname
102 via the environment variable LIBTOOLIZE_OPTIONS, unknown environment
105 --debug enable verbose shell tracing
106 --no-warnings don't display warning messages
107 --quiet work silently
108 --verbose verbosely report processing
110 You must 'cd' to the top directory of your package before you run
113 When reporting a bug, please describe a test case to reproduce it and
114 include the following information:
116 host-triplet: @host_triplet@
117 version: $progname (GNU @PACKAGE@) @VERSION@
118 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
119 autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
121 Report bugs to <@PACKAGE_BUGREPORT@>.
122 GNU @PACKAGE@ home page: <@PACKAGE_URL@>.
123 General help using GNU software: <http://www.gnu.org/gethelp/>.
126 warning_categories='environment file'
129 # libtoolize_environment_options [ARG]...
130 # ---------------------------------------
131 # Parse environment options.
132 libtoolize_environment_options ()
136 my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q'
137 my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q'
139 while test -n "$LIBTOOLIZE_OPTIONS"; do
140 opt=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_opt"`
141 LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | $SED "$my_sed_env_rest"`
144 --debug|--no-warn|--no-warning|--no-warnings|--quiet|--verbose)
145 envopts="${envopts+$envopts }$opt" ;;
146 --*) env_warning="${env_warning+$env_warning
147 }unrecognized environment option '$opt'" ;;
148 *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near '$opt'" ;;
152 # Pass back the updated list of options.
153 if test -n "$envopts"; then
154 func_quote_for_eval "$envopts" ${1+"$@"}
156 func_quote_for_eval ${1+"$@"}
158 libtoolize_environment_options_result=$func_quote_for_eval_result
160 func_add_hook func_options_prep libtoolize_environment_options
163 # libtoolize_options_prep [ARG]...
164 # --------------------------------
165 # Preparation for options parsed by libtoolize.
166 libtoolize_options_prep ()
176 opt_nonrecursive=false
183 # Pass back the list of options.
184 func_quote_for_eval ${1+"$@"}
185 libtoolize_options_prep_result=$func_quote_for_eval_result
187 func_add_hook func_options_prep libtoolize_options_prep
190 # libtoolize_parse_options [ARG]...
191 # ---------------------------------
192 # Provide handling for libtoolize specific options.
193 libtoolize_parse_options ()
197 # Perform our own loop to consume as many options as possible in
199 while test $# -gt 0; do
203 --copy|-c) opt_copy=: ;;
205 --dry-run|--dryrun|-n)
208 CP="func_echo_all $CP"
209 test -n "$LN_S" && LN_S="func_echo_all $LN_S"
210 MKDIR="func_echo_all $MKDIR"
211 RM="func_echo_all $RM"
215 --force|-f) opt_force=: ;;
217 --install|-i) opt_install=: ;;
220 if test 0 -lt $#; then
223 *) ltdl_dir=`$ECHO "$1" | $SED 's|/*$||'`
230 --nonrecursive|--non-recursive)
234 --quiet|--automake|-q) # --automake is for 1.5 compatibility
237 --recursive) opt_recursive=: ;;
239 --subproject) opt_subproject=: ;;
241 # Separate non-argument short options:
243 func_split_short_opt "$_G_opt"
244 set dummy "$func_split_short_opt_name" \
245 "-$func_split_short_opt_arg" ${1+"$@"}
249 # An option not handled by this hook function:
250 *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
254 # save modified positional parameters for caller
255 func_quote_for_eval ${1+"$@"}
256 libtoolize_parse_options_result=$func_quote_for_eval_result
258 func_add_hook func_parse_options libtoolize_parse_options
261 # libtoolize_validate_options [ARG]...
262 # ------------------------------------
263 # Perform any sanity checks on option settings and/or unconsumed
265 libtoolize_validate_options ()
267 # show any warnings saved by LIBTOOLIZE_OPTIONS parsing
268 test -n "$env_warning" && func_warning environment "$env_warning"
270 # validate $opt_nonrecursive, $opt_recursive and $opt_subproject
271 if $opt_nonrecursive; then
272 if $opt_recursive || $opt_subproject; then
273 func_error "you can have at most one of --non-recursive, --recursive and --subproject"
275 ltdl_mode=nonrecursive
276 elif $opt_recursive; then
278 func_error "you can have at most one of --non-recursive, --recursive and --subproject"
280 elif $opt_subproject; then
284 # any remaining arguments are an error
286 func_fatal_help "unknown additional arguments: '${1+$@}'"
288 # Pass back the empty argument list
289 func_quote_for_eval ${1+"$@"}
290 libtoolize_validate_options_result=$func_quote_for_eval_result
292 func_add_hook func_validate_options libtoolize_validate_options
295 # Process options as early as possible so that --help and --version
296 # can return quickly.
297 func_options ${1+"$@"}
298 eval set dummy "$func_options_result"; shift
301 # func_notquiet_once MSG_VAR
302 # --------------------------
303 # Call func_notquiet with the value of MSG_VAR, and then set MSG_VAR='' so
304 # that subsequent calls will have no effect.
305 func_notquiet_once ()
309 if test -n "$1"; then
312 if test -n "$my_msg"; then
313 func_notquiet "$my_msg"
320 # func_notquiet_hdr MSG_VAR ARG...
321 # --------------------------------
322 # With at least 1 non-empty ARG, call func_notquiet_once with MSG_VAR,
323 # and then func_notquiet with the remaining arguments.
329 test -n "$*" || return
331 func_notquiet_once "$my_msg_var"
336 # func_notquiet_error_hdr MSG_VAR ARG...
337 # --------------------------------------
338 # Much the same as func_notquiet_header, but for (non-fatal) error
340 func_notquiet_error_hdr ()
345 test -n "$*" || return
347 func_notquiet_once "$my_msg_var"
350 exit_status=$EXIT_FAILURE
354 # func_copy FILENAME SRCDIR DESTDIR [MSG_VAR [FILTER]]
355 # ----------------------------------------------------
356 # If option '--copy' was specified, or soft-linking SRCFILE to DESTFILE
357 # fails, then try to copy SRCFILE to DESTFILE (making sure to update the
358 # timestamp so that a series of files with dependencies can be copied
359 # in the right order that their timestamps won't trigger rebuilds). If
360 # FILTER is non-empty, it is a sed script to apply to SRCFILE as it is
361 # copied. MSG_VAR names a variable for use with func_notquiet_hdr.
372 my_srcfile=$my_srcdir/$my_filename
373 my_destfile=$my_destdir/$my_filename
375 # Libtool is probably misinstalled if this happens:
376 test -f "$my_srcfile" || {
377 func_notquiet_error_hdr "$my_msg_var" "'$my_srcfile' not found"
381 # Require --force to remove existing $my_destfile.
382 $opt_force && $RM "$my_destfile"
383 test -f "$my_destfile" && {
384 func_notquiet_error_hdr "$my_msg_var" \
385 "'$my_destfile' exists: use '--force' to overwrite"
389 # Be careful to support 'func_copy dir/target srcbase destbase'.
390 func_dirname "$my_destfile"
391 func_mkdir_p "$func_dirname_result"
393 # Filters always take priority.
394 if test -n "$my_filter"; then
395 if $opt_dry_run || $SED -e "$my_filter" "$my_srcfile" > "$my_destfile" 2>/dev/null
397 func_notquiet_once "$my_msg_var"
398 if $opt_verbose; then
399 func_notquiet "$SED -e '$my_filter' $my_srcfile > $my_destfile"
401 func_notquiet "creating file '$my_destfile'"
404 func_notquiet_error_hdr "$my_msg_var" "creating '$my_destfile' from '$my_srcfile' failed"
410 # Otherwise copy or link according to '--copy' option.
418 my_copy_msg="$my_copy_type file '$my_destfile'"
419 $opt_verbose && my_copy_msg="$my_copycmd $my_srcfile $my_destdir"
421 if $opt_dry_run || $my_copycmd "$my_srcfile" "$my_destfile" 2>/dev/null
423 func_notquiet_hdr "$my_msg_var" "$my_copy_msg"
425 func_notquiet_error_hdr "$my_msg_var" \
426 "$my_copy_type '$my_srcdir/$my_filename' to '$my_destdir/' failed"
432 # func_included_files SEARCHFILE
433 # ------------------------------
434 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
435 func_included_files ()
443 /^m4_include(\[.*\])$/ {
444 s|^m4_include(\[\(.*\)\])$|\1|
449 if test -f "$my_searchfile"; then
450 $ECHO "$my_searchfile"
452 # Only recurse when we don't care if all the variables we use get
453 # trashed, since they are in global scope.
454 for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
455 func_included_files $my_filename
461 # func_serial FILENAME [MACRO_REGEX]
462 # ----------------------------------
463 # Output the value of the serial number comment in FILENAME, where the
464 # comment line must also match MACRO_REGEX, if given.
472 /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
473 s|^# serial \([1-9][0-9.]*\).*$|\1|
478 # Search FILENAME and all the files it m4_includes for a serial number
479 # in the file that AC_DEFUNs MACRO_REGEX.
481 func_dirname_and_basename "$my_filename"
482 my_filebase=$func_basename_result
483 for my_file in `func_included_files "$my_filename"`; do
484 if test -z "$my_macro_regex" ||
485 test aclocal.m4 = "$my_filename" ||
486 test "X$my_macro_regex" = "X$my_filebase" ||
487 func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file"
489 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
494 # If the file has no serial number, we assume it's ancient.
495 test -n "$my_serial" || my_serial=0
501 # func_serial_max SERIAL1 SERIAL2
502 # -------------------------------
503 # Compare (possibly multi-part, '.' delimited) serial numbers, and
504 # return the largest in $func_serial_max_result. If they are the
505 # same, func_serial_max_result will be empty.
513 my_sed_dot='s/\..*$//g'
514 my_sed_rest='s/^[0-9][1-9]*\.*//'
515 my_sed_digits='s/[^0-9.]//g'
517 # Incase they turn out to be the same, we'll set it to empty
518 func_serial_max_result=
520 test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || {
521 func_error "serial numbers '$1' or '$2' contain non-digit chars"
525 while test -n "$my_serial1$my_serial2"; do
526 my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"`
527 my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"`
529 test -z "$my_serial1_part$my_serial2_part" \
532 test -z "$my_serial1_part" \
533 && { func_serial_max_result=$2; break; }
535 test -z "$my_serial2_part" \
536 && { func_serial_max_result=$1; break; }
538 test "$my_serial1_part" -gt "$my_serial2_part" \
539 && { func_serial_max_result=$1; break; }
541 test "$my_serial2_part" -gt "$my_serial1_part" \
542 && { func_serial_max_result=$2; break; }
544 my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"`
545 my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"`
550 # func_serial_update_check SRCFILE SRC_SERIAL DESTFILE DEST_SERIAL
551 # ----------------------------------------------------------------
552 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
554 func_serial_update_check ()
559 $require_ac_macro_dir
567 if test -f "$my_destfile"; then
568 test 0 = "$my_src_serial" && {
569 func_warning file "no serial number on '$my_srcfile', not copying."
573 # Determine whether the destination has an older serial.
574 func_serial_max "$my_src_serial" "$my_dest_serial"
575 test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
577 test "X$my_src_serial" = "X$func_serial_max_result" \
578 && func_verbose "'$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in '$my_destfile'"
580 if test "X$my_dest_serial" = "X$func_serial_max_result"; then
581 func_verbose "'$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in '$my_destfile'"
582 $opt_force || if test -n "$ac_macro_dir$ac_ltdl_dir"; then
583 func_error "'$my_destfile' is newer: use '--force' to overwrite"
588 func_serial_update_check_result=$my_update_p
592 # func_aclocal_update_check FILENAME
593 # ----------------------------------
594 # Unless serial number of FILENAME is newer than the matching serial number
595 # in aclocal.m4, set $func_aclocal_update_check to 'false'.
596 func_aclocal_update_check ()
602 my_srcfile=$aclocaldir/$1
603 my_destfile=aclocal.m4
607 my_src_serial=`func_serial "$my_srcfile" LT_INIT`
608 my_dest_serial=`func_serial "$my_destfile" LT_INIT`
610 # Strictly, this libtoolize ought not to have to deal with ancient
611 # serial formats, but we accept them here to be complete:
612 test 0 = "$my_src_serial" &&
613 my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'`
614 test 0 = "$my_dest_serial" &&
615 my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'`
618 my_src_serial=`func_serial "$my_srcfile" LTDL_INIT`
619 my_dest_serial=`func_serial "$my_destfile" LTDL_INIT`
622 my_src_serial=`func_serial "$my_srcfile" "$my_filename"`
623 my_dest_serial=`func_serial "$my_destfile" "$my_filename"`
627 func_serial_update_check \
628 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
630 func_aclocal_update_check_result=$func_serial_update_check_result
634 # func_serial_update FILENAME SRCDIR DESTDIR [MSG_VAR] [MACRO_RE] [OLD_MACRO_RE]
635 # ------------------------------------------------------------------------------
636 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
637 # has a newer serial number, or DESTFILE does not yet exist, or the user
638 # specified '--force' at the command line. If given, MACRO_REGEX or
639 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
640 func_serial_update ()
649 my_old_macro_regex=$6
653 my_srcfile=$my_srcdir/$my_filename
654 my_destfile=$my_destdir/$my_filename
656 test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
658 if test -f "$my_destfile"; then
659 my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
660 my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
662 # Strictly, this libtoolize ought not to have to deal with ancient
663 # serial formats, but we accept them here to be complete:
664 test 0 = "$my_src_serial" &&
665 my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
667 test 0 = "$my_dest_serial" &&
668 my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
670 func_serial_update_check \
671 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
672 my_serial_update_p=$func_serial_update_check_result
675 if $my_serial_update_p || $opt_force; then
677 func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
679 elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
680 func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
683 # Do this after the copy for hand maintained 'aclocal.m4', incase
684 # it has 'm4_include([DESTFILE])', so the copy effectively already
685 # updated 'aclocal.m4'.
686 my_included_files=`func_included_files aclocal.m4`
687 case `echo " "$my_included_files" "` in
689 # Skip included files:
690 *" $my_destfile "*) ;;
692 # Otherwise compare to aclocal.m4 serial number (func_serial
693 # returns 0 for older macro serial numbers before we provided
694 # serial tags, so the update message will be correctly given
695 # if aclocal.m4 contains an untagged --i.e older-- macro file):
697 if test -f aclocal.m4; then
699 "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
700 if test "X$my_src_serial" = "X$func_serial_max_result"; then
701 func_notquiet_hdr "$my_msg_var" \
702 "You should add the contents of '$my_destfile' to 'aclocal.m4'."
707 return $my_return_status
711 # func_keyword_update FILENAME SRCDIR DESTDIR SED_SCRIPT [MSG_VAR]
712 # ----------------------------------------------------------------
713 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
714 # has a newer revision according to the serial number extracted by
715 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
716 # '--force' at the command line.
717 func_keyword_update ()
727 my_srcfile=$my_srcdir/$my_filename
728 my_destfile=$my_destdir/$my_filename
730 my_keyword_update_p=:
732 test -f "$my_srcfile" || func_fatal_error "'$my_srcfile' does not exist."
734 if test -f "$my_destfile"; then
735 my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
736 test -z "$my_src_serial" && {
737 func_warning file "no serial number in '$my_srcfile', not copying."
741 my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
742 test -n "$my_dest_serial" || my_dest_serial=0
744 func_serial_update_check \
745 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
746 my_keyword_update_p=$func_serial_update_check_result
749 if $my_keyword_update_p || $opt_force; then
751 func_copy "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var"
752 elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then
753 func_notquiet_hdr "$my_msg_var" "'$my_destfile' is already up to date."
758 # func_ltmain_update FILENAME SRCDIR DESTDIR [MSG_VAR]
759 # ----------------------------------------------------
760 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
761 # has a newer revision, or DESTFILE does not yet exist, or the user
762 # specified '--force' at the command line.
763 func_ltmain_update ()
768 /^package_revision='\''*[0-9][1-9.]*'\''*/ {
769 s|^package_revision='\''*\([0-9.]*\)'\''*[ ]*$|\1|
774 func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4"
776 return $my_return_status
780 # func_config_update FILENAME SRCDIR DESTDIR [MSG_VAR]
781 # ----------------------------------------------------
782 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
783 # has a newer timestamp, or DESTFILE does not yet exist, or the user
784 # specified '--force' at the command line.
785 func_config_update ()
790 /^timestamp='\''*[0-9][1-9-]*'\''*/ {
791 s|^timestamp='\''*\([0-9-]*\)'\''*|\1|
797 func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4"
799 return $my_return_status
803 # func_install_update FILENAME SRCDIR DESTDIR [MSG_VAR]
804 # -----------------------------------------------------
805 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
806 # has a newer timestamp, or DESTFILE does not yet exist, or the user
807 # specified '--force' at the command line.
808 func_install_update ()
813 /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
815 s|^scriptversion='\''*\([0-9.-]*\)'\''*|\1|
821 func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4"
823 return $my_return_status
827 # func_install_pkgmacro_files
828 # ---------------------------
829 # Install copies of the libtool and libltdl m4 macros into this package.
830 func_install_pkgmacro_files ()
834 $require_ac_macro_dir
835 $require_am_macro_dir
839 $opt_ltdl || test -n "$ac_macro_dir$am_macro_dir" || return
841 # Remove any lingering files that my have been installed by some
842 # previous libtoolize release:
843 $opt_force && for file in $all_pkgmacro_files; do
844 test -f "$macro_dir/$file" && func_verbose "rm -f '$macro_dir/$file'"
845 rm -f "$macro_dir/$file"
848 # Install the libltdl autoconf macros to this project's source tree.
849 $opt_quiet || if test -n "$ac_macro_dir"; then
850 my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIRS, '$ac_macro_dir'."
852 my_pkgmacro_header="putting macros in '$macro_dir'."
855 for file in $pkgmacro_files; do
858 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
859 my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL'
863 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
864 my_pkgmacro_header 'LTDL_INIT'
866 func_verbose "Not copying '$macro_dir/$file', libltdl not used."
869 ltoptions.m4|ltsugar.m4|ltversion.m4|lt~obsolete.m4)
870 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
871 my_pkgmacro_header "$file"
875 func_serial_update "$file" "$aclocaldir" "$macro_dir" \
876 my_pkgmacro_header "$file"
878 func_verbose "Not copying '$macro_dir/$file', libltdl not used."
886 # func_install_pkgltdl_files
887 # --------------------------
888 # Install copies of the libltdl files into this package. Any auxiliary
889 # or m4 macro files needed in the libltdl tree will also be copied by
890 # func_install_pkgaux_files and func_install_pkgmacro_files resp.
891 func_install_pkgltdl_files ()
901 # Remove any lingering files that my have been installed by some
902 # previous libtoolize release:
903 $opt_force && for file in $all_pkgltdl_files; do
904 test -f "$ltdl_dir/$file" && func_verbose "rm -f '$ltdl_dir/$file'"
905 rm -f "$ltdl_dir/$file"
908 # Copy all the files from installed libltdl to this project, if the
909 # user specified '--ltdl'.
910 $opt_quiet || if test -n "$ac_ltdl_dir"; then
911 pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, '$ac_ltdl_dir'."
913 pkgltdl_header="putting libltdl files in '$ltdl_dir'."
916 $require_filter_Makefile_am
917 $require_filter_ltdl_mk
919 # Copy ltdl sources appropriate to the requested ltdl_mode.
920 for file in $pkgltdl_files; do
923 Makefile.am|Makefile.in)
924 test nonrecursive = "$ltdl_mode" && continue
925 my_copy_filter=$filter_Makefile_am
929 test nonrecursive = "$ltdl_mode" || continue
930 my_copy_filter=$filter_ltdl_mk
934 test subproject = "$ltdl_mode" && {
935 $require_filter_aclocal_m4
937 # Always copy aclocal.m4, otherwise regenerating it can
938 # overwrite the destination if it is symlinked.
940 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
941 pkgltdl_header "$filter_aclocal_m4"
948 test subproject = "$ltdl_mode" || continue
952 test subproject = "$ltdl_mode" && {
953 $require_filter_configure_ac
955 # Always copy configure, otherwise regenerating it can
956 # overwrite the destination if it is symlinked.
958 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
959 pkgltdl_header "$filter_configure_ac"
966 test subproject = "$ltdl_mode" || continue
967 $require_filter_configure_ac
968 my_copy_filter=$filter_configure_ac
972 # Still here? Copy the file then, with selected filters.
973 func_copy "$file" "$pkgltdldir" "$ltdl_dir" \
974 pkgltdl_header "$my_copy_filter"
976 # FIXME: Remove in 2013
977 # (along with deprecation warning in func_check_macros)
978 test ltdl.mk = "$file" \
979 && func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am \
980 && mv "$ltdl_dir/$file" "$ltdl_dir/Makefile.inc" \
981 && func_notquiet "renaming file '$ltdl_dir/Makefile.inc'"
986 # func_install_pkgaux_files
987 # -------------------------
988 # Install copies of the auxiliary files into this package according to
989 # the whether libltdl is included as a subproject, and whether the parent
990 # shares the AC_CONFIG_AUX_DIR setting.
991 func_install_pkgaux_files ()
997 $require_configure_ac
1000 # Remove any lingering files that my have been installed by some
1001 # previous libtoolize release:
1002 $opt_force && for file in $all_pkgaux_files; do
1003 test -f "$aux_dir/$file" && func_verbose "rm -f '$aux_dir/$file'"
1004 rm -f "$aux_dir/$file"
1007 if test -n "$ac_aux_dir"; then
1008 pkgaux_header="putting auxiliary files in AC_CONFIG_AUX_DIR, '$ac_aux_dir'."
1010 pkgaux_header="putting auxiliary files in '$aux_dir'."
1013 for file in $pkgaux_files; do
1015 config.guess|config.sub)
1016 $opt_install || test subproject = "$ltdl_mode" || continue
1017 func_config_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1020 $opt_install || test subproject = "$ltdl_mode" || continue
1021 func_install_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1024 func_ltmain_update "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1027 test subproject = "$ltdl_mode" || continue
1028 func_copy "$file" "$pkgauxdir" "$aux_dir" pkgaux_header
1033 # If the parent project is using Autoconf and linking with Libtool,
1034 # even if subproject libltdl already has a copy, the parent project
1035 # will still need to build libtool for its own purposes, and might
1036 # need another copy of ltmain.sh if the parent didn't declare an
1037 # AC_CONFIG_AUX_DIR.
1038 pkgaux_hdr="putting another copy of auxiliary files in '.'"
1039 test -f "$configure_ac" \
1040 && test -z "$ac_aux_dir" \
1041 && test subproject = "$ltdl_mode" \
1042 && test "$aux_dir" = "$ltdl_dir" \
1043 && func_ltmain_update "$file" "$pkgauxdir" . pkgaux_hdr
1045 # FIXME: Remove in 2013.
1046 # Very old parent projects using 'libtoolize --install --ltdl', and
1047 # a top-level $configure_ac to build the ltdl subproject, but not
1048 # using Automake themselves, might still be relying on the old
1049 # behaviour of libtoolize to put a second copy of some 'Auxiliary
1050 # Programs' needed by the top-level configure (instead of using
1051 # the recommended method: 'automake --add-missing').
1052 test -f "$configure_ac" \
1053 && test subproject = "$ltdl_mode" \
1054 && test "$aux_dir" = "$ltdl_dir" \
1055 && func_config_update config.guess "$pkgauxdir" . pkgaux_hdr \
1056 && func_config_update config.sub "$pkgauxdir" . pkgaux_hdr \
1057 && func_install_update install-sh "$pkgauxdir" . pkgaux_hdr
1061 # func_nonemptydir_p DIRVAR
1062 # -------------------------
1063 # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
1064 # a directory that exists and is non-empty abort with a diagnostic.
1065 func_nonemptydir_p ()
1070 my_dir=`eval echo "\\\$$my_dirvar"`
1072 # Is it a directory at all?
1074 || func_fatal_error "\$$my_dirvar is not a directory: '$my_dir'"
1076 # check that the directories contents can be ls'ed
1077 test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
1078 || func_fatal_error "cannot list files: '$my_dir'"
1084 # Sanity check macros from aclocal.m4 against installed versions.
1085 func_check_macros ()
1089 $require_ac_ltdl_dir
1090 $require_ac_macro_dir
1091 $require_am_macro_dir
1093 $require_configure_ac
1098 $require_seen_libtool
1100 $opt_quiet && return
1101 test -n "$configure_ac" || return
1103 ac_config_macro_dir_advised=false
1105 if test -z "$ac_macro_dir$am_macro_dir"; then
1107 for file in $pkgmacro_files; do
1109 ltargz.m4|ltdl.m4) $opt_ltdl || continue ;;
1111 if test -f "aclocal.m4"; then
1112 func_aclocal_update_check $file
1113 $func_aclocal_update_check_result || continue
1115 my_missing="$my_missing $file"
1118 if test -n "$my_missing"; then
1119 func_echo "You should add the contents of the following files to 'aclocal.m4':"
1120 for need in $my_missing; do
1121 func_echo " '$aclocaldir/$need'"
1126 ## ---------------------------------------------------------- ##
1127 ## Since we return early here when --no-warn was given: ##
1128 ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ##
1129 ## ---------------------------------------------------------- ##
1131 test " none" = "$opt_warning_types" && return
1134 func_echo "Remember to add 'LT_INIT' to $configure_ac."
1136 # Suggest using LTDL_INIT if appropriate:
1137 $opt_ltdl && if test : != "$seen_ltdl"; then
1139 subproject) ltdl_init_args= ;;
1140 *) ltdl_init_args="([$ltdl_mode])" ;;
1142 func_echo "Remember to add 'LTDL_INIT$ltdl_init_args' to $configure_ac."
1146 # Remind the user to call LT_CONFIG_LTDL_DIR:
1147 test -n "$ac_ltdl_dir" ||
1148 func_echo "Remember to add 'LT_CONFIG_LTDL_DIR([$ltdl_dir])' to '$configure_ac'."
1150 # For nonrecursive mode, warn about continued use of Makefile.inc:
1151 # FIXME: Remove in 2013
1152 # (along with last minute rename in func_install_pkgltdl_files)
1153 if test nonrecursive = "$ltdl_mode"; then
1154 if func_grep "^-\?include $ltdl_dir/Makefile.inc\$" Makefile.am;
1156 func_error "Use of 'include $ltdl_dir/Makefile.inc' is deprecated!"
1157 func_echo "Consider updating to use of 'include $ltdl_dir/ltdl.mk' in Makefile.am."
1162 # Suggest modern idioms for storing autoconf macros:
1163 $ac_config_macro_dir_advised || if test -z "$macro_dir" || test . = "$macro_dir"; then
1164 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to $configure_ac and"
1165 func_echo "rerunning $progname, to keep the correct libtool macros in-tree."
1166 ac_config_macro_dir_advised=:
1168 elif test -z "$ac_macro_dir"; then
1169 func_echo "Consider adding 'AC_CONFIG_MACRO_DIRS([$macro_dir])' to $configure_ac,"
1170 func_echo "and rerunning $progname and aclocal."
1171 ac_config_macro_dir_advised=:
1174 if test -z "$am_macro_dir$ac_macro_dir"; then
1175 func_echo "Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
1177 elif test -z "$am_macro_dir"; then
1178 func_echo "Consider adding '-I $macro_dir' to ACLOCAL_AMFLAGS in Makefile.am."
1181 # Don't trace for this, we're just checking the user didn't invoke it
1182 # directly from configure.ac.
1183 $SED 's|dnl .*$||; s|# .*$||' "$configure_ac" | $GREP AC_PROG_RANLIB >/dev/null &&
1184 func_echo "'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'"
1186 # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
1191 ## ------------------##
1192 ## Helper functions. ##
1193 ## ------------------##
1195 # This section contains the helper functions used by the rest of
1199 # func_autoconf_configure MAYBE-CONFIGURE-FILE
1200 # --------------------------------------------
1201 # Ensure that MAYBE-CONFIGURE-FILE is the name of a file in the current
1202 # directory that contains an uncommented call to AC_INIT.
1203 func_autoconf_configure ()
1207 _G_sed_no_comment='s|#.*$||; s|^dnl .*$||; s| dnl .*$||;'
1210 # If we were passed a genuine file, make sure it calls AC_INIT.
1212 && _G_ac_init=`$SED "$_G_sed_no_comment" "$1" |$GREP AC_INIT`
1214 # Otherwise it is not a genuine Autoconf input file.
1215 test -n "$_G_ac_init"
1218 test 0 -ne "$_G_status" \
1219 && func_verbose "'$1' not using Autoconf"
1225 # func_make_relative_dir_filter CURRDIR SRCDIR DESTDIR [PREFIX [SUFFIX]]
1226 # ----------------------------------------------------------------------
1227 # Make a sed script suitable for appending to a copy filter, which will
1228 # replace occurrences of CURRDIR with the relative path from SRCDIR to
1229 # DESTDIR if they are different, otherwise the result is the empty
1232 # func_make_relative_dir_filter ltdl config ../build-aux
1233 # => 's|\.\./build-aux|../config|g'
1234 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4
1235 # => 's|\.\./m4|m4|g'
1236 # func_make_relative_dir_filter libltdl build-aux ../build-aux
1239 # If PREFIX (and SUFFIX) are passed they are prepended (and appended)
1240 # to the match and replacement expressions literally:
1242 # func_make_relative_dir_filter ltdl ltdl/m4 ../m4 '-I ' ' '
1243 # => 's|-I \.\./m4 |-I m4 |g'
1244 func_make_relative_dir_filter ()
1252 func_relative_path "$my_srcdir" "$my_destdir"
1254 if test "$my_currdir" = "$func_relative_path_result"; then
1255 func_make_relative_dir_filter_result=
1257 my_match_currdir=`$ECHO "$my_currdir" |$SED "$sed_make_literal_regex"`
1259 # Avoid substituting with 'dir/./file' when current dir is '.'.
1260 if test . = "$my_currdir"; then
1261 func_make_relative_dir_filter_result="
1262 s|$4$my_match_currdir/$5|$4$5|g"
1264 func_make_relative_dir_filter_result="
1265 s|$4$my_match_currdir$5|$4$func_relative_path_result$5|g"
1270 # func_make_relative_ltdl_filter CURRDIR DESTDIR [PREFIX [SUFFIX]]
1271 # ----------------------------------------------------------------
1272 # As 'func_make_relative_dir_filter' optimised for the common case where
1273 # SRCDIR is '$ltdl_dir'.
1274 func_make_relative_ltdl_filter ()
1280 func_make_relative_dir_filter "$1" "$ltdl_dir" "$2" "$3" "$4"
1281 func_make_relative_ltdl_filter_result=$func_make_relative_dir_filter_result
1285 ## -------------------- ##
1286 ## Resource management. ##
1287 ## -------------------- ##
1289 # This section contains definitions for functions that each ensure a
1290 # particular resource (a file, or a non-empty configuration variable for
1291 # example) is available, and if appropriate to extract default values
1292 # from pertinent package files. Where a variable already has a non-
1293 # empty value (as set by the package's 'bootstrap.conf'), that value is
1294 # used in preference to deriving the default. Call them using their
1295 # associated 'require_*' variable to ensure that they are executed, at
1298 # Some of the require functions are very similar, so we generate those
1299 # as this file is sourced. They look complicated, but they are the same
1300 # as normal function declarations wrapped in "eval '<definition>'", so
1301 # that embedded single quotes need to be escaped, and wherever a symbol
1302 # is generated, we drop out of the single quotes and expand a variable
1303 # that holds the symbol.
1305 # After that, the rest appear in asciibetical order.
1307 for base in '' ltdl_; do
1308 if test ltdl_ = "$base"; then p='$pkgltdldir/'; else p=; fi
1310 # require_Makefile_am
1311 # require_ltdl_Makefile_am
1312 # ------------------------
1313 # If not already set, set Makefile_am to 'Makefile.am' if that file is
1314 # present in the current directory, and similarly for
1315 # '$pkgltdldir/Makefile.am'.
1316 r=${base}Makefile_am
1324 test -n "$'$r'" || '$r'='$p'Makefile.am
1326 if test -f "$'$r'"; then
1327 func_verbose "found '\'\$$r\''"
1337 # require_aclocal_amflags
1338 # require_ltdl_aclocal_amflags
1339 # ----------------------------
1340 # Extract '$aclocal_amflags' from 'Makefile.am' if present, and
1341 # similarly for 'libltdl/Makefile.am'.
1342 r=${base}aclocal_amflags
1352 test -n "$'$o'" && {
1353 _G_sed_extract_aclocal_amflags='\''s|#.*$||
1354 /^[ ]*ACLOCAL_AMFLAGS[ ]*=/ {
1355 s|^.*=[ ]*\(.*\)|'$r'="\1"|
1359 _G_aclocal_flags_cmd=`$SED -n "$_G_sed_extract_aclocal_amflags" \
1361 eval "$_G_aclocal_flags_cmd"
1363 test -n "$'$r'" && func_verbose "'$r'='\$$r\''"
1371 # require_am_macro_dir
1372 # require_ltdl_am_macro_dir
1373 # -------------------------
1374 # Set am_macro_dir to the first directory specified in
1375 # ACLOCAL_AMFLAGS from 'Makefile.am', and similarly for
1376 # 'libltdl/Makefile.am'.
1377 r=${base}am_macro_dir
1387 _G_minus_I_seen=false
1388 for _G_arg in $'$o'; do
1389 case $_G_minus_I_seen,$_G_arg in
1390 :,*) '$r'=$_G_arg; break ;;
1391 *,-I) _G_minus_I_seen=: ;;
1392 *,-I*) '$r'=`expr x$_G_arg : '\''x-I\(.*\)$'\''`; break ;;
1396 test -n "$'$r'" && func_verbose "'$r'='\'\$$r\''"
1405 # require_ac_aux_dir
1406 # ------------------
1407 # Extract ac_aux_dir from AC_CONFIG_AUX_DIR.
1408 require_ac_aux_dir=func_require_ac_aux_dir
1409 func_require_ac_aux_dir ()
1413 $require_configure_ac
1415 test -n "$configure_ac" && {
1416 func_extract_trace_first AC_CONFIG_AUX_DIR
1417 ac_aux_dir=$func_extract_trace_first_result
1422 cannot expand unknown variable in AC_CONFIG_AUX_DIR argument."
1427 test -n "$ac_aux_dir" && func_verbose "ac_aux_dir='$ac_aux_dir'"
1429 require_ac_aux_dir=:
1433 # require_ac_ltdl_dir
1434 # -------------------
1435 # Extract ac_ltdl_dir from LT_CONFIG_LTDL_DIR.
1436 require_ac_ltdl_dir=func_require_ac_ltdl_dir
1437 func_require_ac_ltdl_dir ()
1441 $require_configure_ac
1443 if test -n "$configure_ac"; then
1444 func_extract_trace_first LT_CONFIG_LTDL_DIR
1445 ac_ltdl_dir=$func_extract_trace_first_result
1447 case $ac_ltdl_dir in
1450 cannot expand unknown variable in LT_CONFIG_LTDL_DIR argument."
1455 # Strip trailing slashes.
1456 ac_ltdl_dir=`echo "$ac_ltdl_dir" |$SED 's|/*$||'`
1458 require_ac_ltdl_dir=:
1462 # require_ac_ltdl_mode
1463 # --------------------
1464 # Extract mode name from LTDL_INIT options.
1465 require_ac_ltdl_mode=func_require_ac_ltdl_mode
1466 func_require_ac_ltdl_mode ()
1470 $require_ac_ltdl_options
1472 case " $ac_ltdl_options " in
1473 *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;;
1474 *" recursive "*) ac_ltdl_mode=recursive ;;
1475 *" subproject "*) ac_ltdl_mode=subproject ;;
1478 require_ac_ltdl_mode=:
1482 # require_ac_ltdl_options
1483 # -----------------------
1484 # Extract ac_ltdl_options from LTDL_INIT.
1485 require_ac_ltdl_options=func_require_ac_ltdl_options
1486 func_require_ac_ltdl_options ()
1490 $require_configure_ac
1492 if test -n "$configure_ac"; then
1493 func_extract_trace_first LTDL_INIT
1494 ac_ltdl_options=$func_extract_trace_first_result
1496 case $ac_ltdl_options in
1499 cannot expand unknown variable in LTDL_INIT argument."
1504 require_ac_ltdl_mode=:
1508 # require_ac_macro_dir
1509 # --------------------
1510 # Extract ac_macro_dir from AC_CONFIG_MACRO_DIRS.
1511 require_ac_macro_dir=func_require_ac_macro_dir
1512 func_require_ac_macro_dir ()
1516 $require_configure_ac
1518 if test -n "$configure_ac"; then
1519 func_extract_trace_first AC_CONFIG_MACRO_DIRS
1520 ac_macro_dir=`expr "x$func_extract_trace_first_result" : 'x\([^ ]*\)'`
1522 test -n "$ac_macro_dir" || {
1523 func_extract_trace_first AC_CONFIG_MACRO_DIR
1524 ac_macro_dir=$func_extract_trace_first_result
1528 require_ac_macro_dir=:
1534 # Set aux_dir according to AC_CONFIG_AUX_DIR or else use the same
1535 # heuristics as Autoconf to intuit an appropriate setting.
1536 require_aux_dir=func_require_aux_dir
1537 func_require_aux_dir ()
1543 test -z "$aux_dir" && aux_dir=$ac_aux_dir
1545 # Subproject ltdl without $configure_ac keeps pkgauxfiles in
1546 # specified --ltdl optarg directory.
1547 test -z "$aux_dir" && $opt_ltdl && {
1548 $require_configure_ac
1550 test -n "$configure_ac" || {
1554 test subproject = "$ltdl_mode" && aux_dir=$ltdl_dir
1558 test -z "$aux_dir" && {
1559 # Try to intuit aux_dir using the same heuristic as Autoconf.
1560 for _G_dir in . .. ../..; do
1561 if test -f "$_G_dir/install-sh" || test -f "$_G_dir/install.sh"
1569 # Use the current directory if all else fails.
1570 test -z "$aux_dir" && aux_dir=.
1576 # require_configure_ac
1577 # --------------------
1578 # Ensure that there is a 'configure.ac' or 'configure.in' file in this
1579 # directory, and that '$configure_ac' contains its name.
1580 require_configure_ac=func_require_configure_ac
1581 func_require_configure_ac ()
1585 test -z "$configure_ac" \
1586 && func_autoconf_configure configure.ac && configure_ac=configure.ac
1587 test -z "$configure_ac" \
1588 && func_autoconf_configure configure.in && configure_ac=configure.in
1589 test -z "$configure_ac" \
1590 || func_verbose "found '$configure_ac'"
1592 require_configure_ac=:
1596 # require_filter_Makefile_am
1597 # --------------------------
1598 # Set 'filter_Makefile_am' ready for passing to func_copy when libltdl's
1599 # stock Makefile.am contents need to be filtered to work in recursive
1601 require_filter_Makefile_am=func_require_filter_Makefile_am
1602 func_require_filter_Makefile_am ()
1610 filter_Makefile_am='
1612 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1613 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1618 # Adjust default relative macro_dir paths.
1619 $require_ltdl_am_macro_dir
1621 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" '-I '
1622 test -z "$func_make_relative_ltdl_filter_result" || {
1623 func_append filter_Makefile_am "
1624 /^ACLOCAL_AMFLAGS = /{
1625 $func_make_relative_ltdl_filter_result
1628 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir" 'dir)'
1629 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1631 # Adjust default relative aux_dir paths.
1632 $require_ltdl_ac_aux_dir
1633 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1634 func_append filter_Makefile_am "$func_make_relative_ltdl_filter_result"
1638 require_filter_Makefile_am=:
1642 # require_filter_aclocal_m4
1643 # -------------------------
1644 # Set 'filter_aclocal_m4' ready for passing to func_copy when libltdl's
1645 # stock aclocal.m4 contents need to be filtered to work in recursive
1647 require_filter_aclocal_m4=func_require_filter_aclocal_m4
1648 func_require_filter_aclocal_m4 ()
1652 $require_ltdl_am_macro_dir
1654 func_make_relative_ltdl_filter "$ltdl_am_macro_dir" "$macro_dir"
1656 test -z "$func_make_relative_ltdl_filter_result" || {
1657 func_append filter_aclocal_m4 "
1659 $func_make_relative_ltdl_filter_result
1663 require_filter_aclocal_m4=:
1667 # require_filter_configure_ac
1668 # ---------------------------
1669 # Set 'filter_configure_ac' ready for passing to func_copy when
1670 # libltdl's stock configure.ac contents need to be filtered to work in
1672 require_filter_configure_ac=func_require_filter_configure_ac
1673 func_require_filter_configure_ac ()
1677 $require_ltdl_ac_aux_dir
1679 func_make_relative_ltdl_filter "$ltdl_ac_aux_dir" "$aux_dir"
1680 func_append filter_configure_ac "$func_make_relative_ltdl_filter_result"
1682 require_filter_configure_ac=:
1686 # require_filter_ltdl_mk
1687 # ----------------------
1688 # Set 'filter_ltdl_mk' ready for passing to func_copy in order for the
1689 # contents of ltdl.mk to match the nonrecursive libltdl directory into
1690 # which it is copied.
1691 require_filter_ltdl_mk=func_require_filter_ltdl_mk
1692 func_require_filter_ltdl_mk ()
1698 # Note that we strip comments right here, rather than rely on
1699 # using a $SED that allows comments.
1700 my_uscore=`$ECHO "$ltdl_dir" | $SED 's|[/.+-]|_|g'`
1701 filter_ltdl_mk=`$ECHO '
1704 # Use only libltdl conditional objects.
1705 s|(LIBOBJS)|(ltdl_LIBOBJS)|g
1706 s|(LTLIBOBJS)|(ltdl_LTLIBOBJS)|g
1708 # Convert libltdl path and variable sections to $ltdl_dir.
1709 s|libltdl_|@my_uscore@_|
1710 s|libltdl/|@ltdl_dir@/|
1711 s|: libltdl/|: @ltdl_dir@/|
1712 s| -Ilibltdl | -I@ltdl_dir@ |
1713 s|\$(libltdl_|\$(@my_uscore@_|
1714 s|)/libltdl |)/@ltdl_dir@ |
1715 s|@my_uscore@|'"$my_uscore"'|g
1716 s|@ltdl_dir@|'"$ltdl_dir"'|g
1718 }' | $SED '/^[ ]*#/d;/^$/d'`
1720 require_filter_ltdl_mk=:
1724 # require_ltdl_ac_aux_dir
1725 # -----------------------
1726 # This needs to work in subproject mode, when GNU M4 may not be
1727 # available and hence extract-trace can't be used. But since we
1728 # installed libltdl/configure.ac, then we already know what value
1730 require_ltdl_ac_aux_dir=func_require_ltdl_ac_aux_dir
1731 func_require_ltdl_ac_aux_dir ()
1735 ltdl_ac_aux_dir="@ltdl_ac_aux_dir@"
1736 func_verbose "ltdl_ac_aux_dir='$ltdl_ac_aux_dir'"
1738 require_ltdl_ac_aux_dir=:
1744 # If both are specified, ensure both --ltdl=LTDL_DIR and
1745 # LT_CONFIG_LTDL_DIR agree, and set ltdl_dir to the value of either.
1746 require_ltdl_dir=func_require_ltdl_dir
1747 func_require_ltdl_dir ()
1751 $require_ac_ltdl_dir
1753 test -z "$ltdl_dir" && ltdl_dir=$ac_ltdl_dir
1754 test -z "$ltdl_dir" && $opt_ltdl && ltdl_dir=libltdl
1756 if test -n "$ac_ltdl_dir"; then
1757 test "$ac_ltdl_dir" = "$ltdl_dir" || func_fatal_error "\
1758 --ltdl='$ltdl_dir' does not match LT_CONFIG_LTDL_DIR($ac_ltdl_dir)"
1767 # If both are specified, ensure both command line setting and LTDL_INIT
1768 # option agree, and set ltdl_mode to the value of either.
1769 require_ltdl_mode=func_require_ltdl_mode
1770 func_require_ltdl_mode ()
1774 $require_ac_ltdl_mode
1776 test -z "$ltdl_mode" && ltdl_mode=$ac_ltdl_mode
1777 test -z "$ltdl_mode" && {
1780 test -n "$ltdl_dir" && ltdl_mode=subproject
1783 if test -n "$ac_ltdl_mode"; then
1784 test "$ac_ltdl_mode" = "$ltdl_mode" || func_fatal_error "\
1785 --$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)"
1788 func_verbose "ltdl mode='$ltdl_mode'"
1796 # If both are specified, ensure both ACLOCAL_AMFLAGS and
1797 # AC_CONFIG_MACRO_DIRS agree, and set macro_dir to the value of either.
1798 require_macro_dir=func_require_macro_dir
1799 func_require_macro_dir ()
1803 $require_ac_macro_dir
1804 $require_am_macro_dir
1806 # AC_CONFIG_MACRO_DIRS takes precedence.
1807 macro_dir=$ac_macro_dir
1809 # Followed by first -I optarg from ACLOCAL_AMFLAGS.
1810 test -z "$macro_dir" && macro_dir=$am_macro_dir
1812 # Subproject ltdl without either of the above keeps macros in
1813 # specified --ltdl optarg subdirectory.
1814 test -z "$macro_dir" && $opt_ltdl && {
1818 test subproject = "$ltdl_mode" && macro_dir=$ltdl_dir/m4
1821 # Use ./m4 as the last resort.
1822 test -z "$macro_dir" && macro_dir=m4
1824 # Diagnose conflicts.
1825 if test -n "$ac_macro_dir" && test -n "$am_macro_dir"; then
1826 test "$ac_macro_dir" = "$am_macro_dir" || func_fatal_error "\
1827 AC_CONFIG_MACRO_DIRS([$ac_macro_dir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macro_dir."
1836 # Determine from contents of $configure_ac whether this project contains
1838 require_seen_ltdl=func_require_seen_ltdl
1839 func_require_seen_ltdl ()
1843 $require_configure_ac
1845 if test -n "$configure_ac"; then
1846 func_extract_trace AC_LIB_LTDL,AC_WITH_LTDL,LT_WITH_LTDL,LTDL_INIT
1847 test -n "$func_extract_trace_result" && seen_ltdl=:
1849 test -n "$seen_ltdl" || seen_ltdl=false
1851 $seen_ltdl && func_verbose "found LTDL_INIT invocation"
1857 # require_seen_libtool
1858 # --------------------
1859 # Determine from contents of $configure_ac whether this project is using
1860 # Libtool to compile (some of) its objects.
1861 require_seen_libtool=func_require_seen_libtool
1862 func_require_seen_libtool ()
1866 $require_configure_ac
1868 if test -n "$configure_ac"; then
1869 func_extract_trace AM_PROG_LIBTOOL,AC_PROG_LIBTOOL,LT_INIT
1870 test -n "$func_extract_trace_result" && seen_libtool=:
1872 test -n "$seen_libtool" || seen_libtool=false
1874 $seen_libtool && func_verbose "found LT_INIT invocation"
1876 require_seen_libtool=:
1886 # Lists of all files libtoolize has ever installed. These are removed
1887 # before installing the latest files when --force was passed to help
1888 # ensure a clean upgrade.
1889 # Do not remove config.guess, config.sub or install-sh, we don't
1890 # install them without --install, and the project may not be using
1891 # Automake. Similarly, do not remove Gnulib files.
1892 all_pkgaux_files="compile depcomp missing ltmain.sh"
1893 all_pkgmacro_files="libtool.m4 ltargz.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4"
1894 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"
1896 # Files installed by func_install_*, some files are missing from these
1897 # lists deliberately because their respective func_install has to handle
1898 # the missing filenames specially.
1899 pkgaux_files="@pkgaux_files@"
1900 pkgltdl_files="@pkgltdl_files@"
1901 pkgmacro_files="@pkgmacro_files@"
1903 # Locations for important files:
1906 pkgauxdir="@pkgauxdir@"
1907 pkgltdldir="@pkgdatadir@"
1908 aclocaldir="@aclocaldir@"
1910 # Allow the user to override the master libtoolize repository:
1911 if test -n "$_lt_pkgdatadir"; then
1912 pkgauxdir=$_lt_pkgdatadir/build-aux
1913 pkgltdldir=$_lt_pkgdatadir/libltdl
1914 aclocaldir=$_lt_pkgdatadir/m4
1916 func_nonemptydir_p pkgauxdir
1917 func_nonemptydir_p pkgltdldir
1918 func_nonemptydir_p aclocaldir
1920 extract_trace=$pkgauxdir/extract-trace
1922 # :::BE CAREFUL HERE:::
1923 # func_check_macros needs to check whether --ltdl was specified when
1924 # LTDL_INIT was not seen, so we can't just use one variable for both
1925 # conditions, or that check will be impossible. No need to clutter the
1926 # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN
1927 # safely set opt_ltdl to true if LTDL_INIT was seen:
1929 $seen_ltdl && opt_ltdl=:
1931 func_install_pkgaux_files
1932 func_install_pkgmacro_files
1933 func_install_pkgltdl_files