1 m4_define([_m4_divert(SCRIPT)], 100)
2 m4_divert_push([SCRIPT])#! /bin/sh
5 # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
6 # Written by Gary V. Vaughan <gary@gnu.org>, 2003
8 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
9 # This is free software; see the source for copying conditions. There is NO
10 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, a copy can be downloaded from
24 # http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
25 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
28 # As a special exception to the GNU General Public License, if you
29 # distribute this file as part of a program that contains a
30 # configuration script generated by Autoconf, you may include it under
31 # the same distribution terms that you use for the rest of that program.
33 # Usage: $progname [OPTION]...
35 # Prepare a package to use libtool.
37 # -c, --copy copy files rather than symlinking them
38 # --debug enable verbose shell tracing
39 # -n, --dry-run print commands rather than running them
40 # -f, --force replace existing files
41 # -i, --install copy missing auxiliary files
42 # --ltdl[=DIR] install libltdl in a subdirectory [default: libltdl]
43 # -q, --quiet work silently
44 # -v, --verbose verbosely report processing
45 # --version print version information and exit
46 # -h, --help print short or long help message
48 # You must `cd' to the top directory of your package before you run
51 # When reporting a bug, please describe a test case to reproduce it and
52 # include the following information:
54 # host-triplet: @host_triplet@
55 # $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
56 # automake: $automake_version
57 # autoconf: $autoconf_version
59 # Report bugs to <bug-libtool@gnu.org>.
66 m4_include([getopt.m4sh])
70 # Command line options:
79 # Collect flags to pass into libltdl libtoolize
82 # Locations for important files:
85 pkgdatadir=@pkgdatadir@
86 aclocaldir=@aclocaldir@
90 configure_ac=configure.in
93 # Parse options once, thoroughly. This comes as soon as possible in
94 # the script to make things like `libtoolize --version' happen quickly.
97 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
98 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
99 my_sed_long_opt='1s/^\(--[[^=]]*\)=.*/\1/;q'
100 my_sed_long_arg='1s/^--[[^=]]*=//'
102 while test "$#" -gt 0; do
106 --copy|-c) opt_link=false
107 libtoolize_flags="$libtoolize_flags --copy"
110 --debug) func_echo "enabling shell trace mode"
111 libtoolize_flags="$libtoolize_flags --debug"
116 --dry-run|-n) if $opt_dry_run; then :; else
119 test -n "$LN_S" && LN_S="$ECHO $LN_S"
124 libtoolize_flags="${libtoolize_flags} --dry-run"
127 --force|-f) opt_force=:
128 libtoolize_flags="${libtoolize_flags} --force"
131 --install|-i) opt_install=:
132 libtoolize_flags="${libtoolize_flags} --install"
135 --ltdl) ltdldir=libltdl
136 if test "$#" -gt 0; then
139 *) ltdldir="$1"; shift ;;
144 --quiet|--automake|-q) # --automake is for 1.5 compatibility
146 libtoolize_flags="${libtoolize_flags} --quiet"
149 --verbose|-v) opt_verbose=:
150 libtoolize_flags="${libtoolize_flags} --verbose"
153 # Separate optargs to long options:
155 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
156 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
157 set dummy "$opt" "$arg" ${1+"$@"}
161 # Separate non-argument short options:
162 -c*|-i*|-f*|-n*|-q*|-v*)
163 rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
164 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
165 set dummy "$opt" "-$rest" ${1+"$@"}
169 -\?|-h) func_usage ;;
171 --version) func_version ;;
173 -*) func_fatal_help "unrecognized option \`$opt'" ;;
174 *) func_fatal_help "too many arguments" ;;
180 # func_copy srcfile destfile
181 # A wrapper for func_copy_cb that accepts arguments in the same order
182 # as the cp(1) shell command.
188 { func_error "\`$1' not copied: not a regular file"; return 1; }
190 my_f1=`$ECHO "X$1" | $Xsed -e "$basename"`
192 if test -d "$2"; then
194 func_copy_cb "$my_f1" \
195 `$ECHO "X$1" | $Xsed -e "$dirname"` "$2"
199 # Supporting this would mean changing the timestamp:
200 test "X$my_f1" = X`$ECHO "X$2" | $Xsed -e "$basename"` \
201 || func_fatal_error "func_copy() cannot change filename on copy"
203 func_copy_cb "$my_f1" \
204 `$ECHO "X$1" | $Xsed -e "$dirname"` \
205 `$ECHO "X$2" | $Xsed -e "$dirname"`
209 return $copy_return_status # set in func_copy_cb
213 # func_copy_cb filename srcdir destdir
214 # If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails,
215 # then try to copy SRCFILE to DESTFILE (without changing the timestamp if
225 # Libtool is probably misinstalled if this happens:
226 test -f "$my_srcdir/$my_file" || \
227 { func_error "\`$my_file' not found in \`$my_srcdir'"; return; }
229 func_mkdir_p "$my_destdir"
231 $RM "$my_destdir/$my_file"
232 if $opt_link && $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
233 $opt_quiet || func_echo "copying file \`$my_destdir/$my_file'"
235 elif { ( cd "$my_srcdir" 2>/dev/null && $TAR chf - "$my_file" 2>/dev/null; ) \
236 | ( umask 0 && cd "$my_destdir" 2>/dev/null && "$TAR" xf - >/dev/null 2>&1; ); } ; then
237 $opt_quiet || func_echo "copying file \`$my_destdir/$my_file'"
239 elif $CP -p "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
240 $opt_quiet || func_echo "copying file \`$my_destdir/$my_file'"
243 func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
244 exit_status=$EXIT_FAILURE
249 # func_copy_all_files [-r] srcdir destdir [glob_exclude] [copy_cb=func_copy_cb]
250 # For each file in SRCDIR, then try to copy the file to DESTDIR by calling
251 # COPY_CB with the src and dest files. With the `-r' option, recurse into
252 # subdirectories of srcdir too. If GLOB_EXCLUDE is given, exclude any
253 # matching filenames from the copy. If COPY_CB is passed, then the check
254 # for overwriting without opt_force is the callbacks responsibility: This
255 # allows using callbacks like func_serial_update, which perform their own
256 # checks to decide whether to overwrite the dest file.
257 func_copy_all_files ()
261 if test "X$1" = X-r; then
269 my_copy_cb="${4-func_copy_cb}"
272 my_basedir="$my_srcdir"
273 my_srcdirs="$my_srcdir"
276 while test -n "$my_srcdirs"; do
279 my_srcdir=`$ECHO "X$my_srcdirs" | $Xsed -e 's,:.*,,g'`
280 my_srcdirs=`$ECHO "X$my_srcdirs" | $Xsed -e 's,:*[[^:]][[^:]]*:*,,'`
282 for my_filename in `cd "$my_srcdir" && ls`; do
284 # ignore excluded filenames
285 if test -n "$my_glob_exclude"; then
286 eval 'case $my_filename in '$my_glob_exclude') continue ;; esac'
289 # Add to the appropriate list
290 if test -f "$my_srcdir/$my_filename"; then
291 my_srcfile=`$ECHO "X$my_srcdir/$my_filename" | $Xsed \
292 -e "s,^$my_basedir/*,,"`
293 my_srcfiles="$my_srcfiles${my_srcfiles:+:}$my_srcfile"
294 elif $my_opt_recurse && test -d "$my_srcdir/$my_filename"; then
295 my_srcdirs="$my_srcdirs${my_srcdirs:+:}$my_srcdir/$my_filename"
302 func_copy_some_files "$my_srcfiles" "$my_basedir" \
303 "$my_destdir" "$my_copy_cb"
307 # func_copy_some_files srcfile_spec srcdir destdir [copy_cb=func_copy_cb]
308 # Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
309 # names in SRCFILE_SPEC. The odd calling convention is needed to allow
310 # spaces in file and directory names.
311 func_copy_some_files ()
317 my_copy_cb="${4-func_copy_cb}"
321 for my_filename in $my_srcfile_spec; do
323 if test -f "$my_srcdir/$my_filename"; then
324 if test "X$my_copy_cb" = Xfunc_copy_cb; then
325 $opt_force || if test -f "$my_destdir/$my_filename"; then
327 || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite"
336 $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir"
342 # Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
343 # and libtool. Possibly running some of these tools if necessary.
344 # Libtoolize affects the contents of aclocal.m4, and should be run before
345 # aclocal, so we can't use configure --trace which relies on a consistent
346 # configure.(ac|in) and aclocal.m4.
350 # Prefer configure.ac to configure.in
351 test -f configure.ac && configure_ac=configure.ac
352 test -f "$configure_ac" \
353 || func_fatal_help "\`$configure_ac' does not exist"
355 # Set local variables to reflect contents of configure.ac
356 my_uses_autoconf=false
357 my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
358 /AC_INIT/ { s,^.*$,my_uses_autoconf=:,; p; };
360 eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
362 $my_uses_autoconf || {
363 func_verbose "$configure_ac: not using Autoconf"
367 # ---------------------------------------------------- #
368 # Probe macro usage in configure.ac and/or aclocal.m4. #
369 # ---------------------------------------------------- #
371 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
372 /AC_CONFIG_AUX_DIR[[^_]]/ {
373 s,^.*AC_CONFIG_AUX_DIR([[[ ]*\([^])]]*\).*$,auxdir=\1,; p;
375 /AC_CONFIG_MACRO_DIR/ {
376 s,^.*AC_CONFIG_MACRO_DIR([[[ ]*\([^])]]*\).*$,m4dir=\1,; p;
378 /A[[CM]]_PROG_LIBTOOL/ { s,^.*$,seen_libtool=:,; p; };
379 /LT_INIT/ { s,^.*$,seen_libtool=:,; p; };
380 /LTDL_INIT/ { s,^.*$,seen_ltdl=:,; p; };
381 /LT_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
382 /AC_LIB_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
383 /AC_WITH_LTDL/ { s,^.*$,seen_ltdl=:,; p; };
385 eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
392 if test -n "$auxdir"; then
393 # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
394 # not given in terms of a shell variable!
397 func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR"
402 # Try to discover auxdir the same way it is discovered by configure.
403 # Note that we default to the current directory.
404 for dir in . .. ../..; do
405 if test -f "$dir/install-sh"; then
408 elif test -f "$dir/install.sh"; then
415 # Just use the current directory if all else fails.
416 test -n "$auxdir" || auxdir=.
419 # ------------------------------ #
420 # Find local m4 macro directory. #
421 # ------------------------------ #
423 # If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS
424 # in `Makefile.am' for a `-I' argument.
426 my_sed_aclocal_flags='/^[[ ]]*ACLOCAL_[[A-Z_]]*FLAGS[[ ]]*=/ {
427 s,^[[^=]]*=[[ ]]*\(.*\), \1,; q; };
429 if test ! -n "$m4dir" && test -f Makefile.am; then
430 my_m4dir_is_next=false
431 for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
432 if $my_m4dir_is_next; then
436 if test "X$arg" = "X-I"; then
439 my_m4dir_is_next=false
446 # func_included_files searchfile
447 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
448 func_included_files ()
455 /^[m4]_include(\[[.*\]])$/ { s,^[m4]_include(\[[\(.*\)\]])$,\1,; p; };
458 if test -f "$my_searchfile"; then
459 $ECHO "X$my_searchfile" | $Xsed
462 # Only recurse when we don't care if all the variables we use get
463 # trashed, since they are in global scope.
464 for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
465 func_included_files $my_filename
470 # func_serial filename [macro_regex]
471 # Output the value of the serial number comment in FILENAME, where the
472 # comment line must also match MACRO_REGEX, if given.
478 my_sed_serial=['/^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
479 s,^# serial \([1-9][0-9.]*\).*$,\1,; q;
483 # Search FILENAME and all the files it m4_includes for a serial number
484 # in the file that AC_DEFUNs MACRO_REGEX.
486 for my_file in `func_included_files "$my_filename"`; do
487 if test -z "$my_macro_regex" ||
488 func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
490 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
495 # If the file has no serial number, we assume it's ancient.
496 test -n "$my_serial" || my_serial=0
502 # func_serial_max serial1 serial2
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.
512 my_sed_dot='s/\..*$//g'
513 my_sed_rest='s/^[[0-9]][[1-9]]*\.*//'
514 my_sed_digits='s/[[^0-9.]]//g'
516 # Incase they turn out to be the same, we'll set it to empty
517 func_serial_max_result=
519 test "X$1$2" = X`$ECHO "X$1$2" | $Xsed -e "$my_sed_digits"` || {
520 func_error "serial numbers \`$1' or \`$2' contain non-digit chars"
524 while test -n "$my_serial1$my_serial2"; do
525 my_serial1_part=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_dot"`
526 my_serial2_part=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_dot"`
528 test -z "$my_serial1_part$my_serial2_part" \
531 test -z "$my_serial1_part" \
532 && { func_serial_max_result="$2"; break; }
534 test -z "$my_serial2_part" \
535 && { func_serial_max_result="$1"; break; }
537 test "$my_serial1_part" -gt "$my_serial2_part" \
538 && { func_serial_max_result="$1"; break; }
540 test "$my_serial2_part" -gt "$my_serial1_part" \
541 && { func_serial_max_result="$2"; break; }
543 my_serial1=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_rest"`
544 my_serial2=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_rest"`
549 # func_serial_update_check srcfile src_serial destfile dest_serial
550 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
552 func_serial_update_check ()
561 if test -f "$my_destfile"; then
562 test "X$my_src_serial" = "X0" && {
563 func_error "warning: no serial number on \`$my_srcfile', not copying."
567 # Determine whether the destination has an older serial.
568 func_serial_max "$my_src_serial" "$my_dest_serial"
569 test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
571 test "X$my_src_serial" = "X$func_serial_max_result" \
572 && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'"
574 if test "X$my_dest_serial" = "X$func_serial_max_result"; then
575 func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'"
577 || func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
581 func_serial_update_check_result="$my_update_p"
585 # func_serial_update filename srcdir destdir [macro_regex] [old_macro_regex]
586 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
587 # has a newer serial number, or DESTFILE does not yet exist, or the user
588 # specified `--force' at the command line. If given, MACRO_REGEX or
589 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
590 func_serial_update ()
597 my_old_macro_regex="$5"
601 my_srcfile="$my_srcdir/$my_filename"
602 my_destfile="$my_destdir/$my_filename"
604 test -f "$my_srcfile" || {
605 func_error "\`$my_srcfile' does not exist."
609 if test -f "$my_destfile"; then
610 my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
611 my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
613 # Strictly, this libtoolize ought not to have to deal with ancient
614 # serial formats, but we accept them here to be complete:
615 test "X$my_src_serial" = "X0" &&
616 my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
618 test "X$my_dest_serial" = "X0" &&
619 my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
621 func_serial_update_check \
622 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
623 my_serial_update_p="$func_serial_update_check_result"
626 if $my_serial_update_p || $opt_force; then
627 func_copy "$my_srcfile" "$my_destfile"
629 elif test "X$my_dest_serial" = "X$my_src_serial"; then
631 || func_echo "\`$my_destfile' is already up to date."
634 # Do this after the copy for hand maintained `aclocal.m4', incase
635 # it has `m4_include([DESTFILE])', so the copy effectively already
636 # updated `aclocal.m4'.
637 $use_aclocal || if test -f aclocal.m4; then
639 "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
640 test "X$my_src_serial" = "X$func_serial_max_result" \
641 && func_echo "You should add the contents of \'$my_destfile' to \`aclocal.m4'."
644 return $my_return_status
648 # func_keyword_update filename srcdir destdir sed_script
649 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
650 # has a newer revision according to the serial number extracted by
651 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
652 # `--force' at the command line.
653 func_keyword_update ()
661 my_srcfile="$my_srcdir/$my_filename"
662 my_destfile="$my_destdir/$my_filename"
664 my_keyword_update_p=:
666 test -f "$my_srcfile" || {
667 func_error "\`$my_srcfile' does not exist."
671 if test -f "$my_destfile"; then
672 my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
673 test -z "$my_src_serial" && {
674 func_error "warning: no serial number in \`$my_srcfile', not copying."
678 my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
679 test -n "$my_dest_serial" || my_dest_serial=0
681 func_serial_update_check \
682 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
683 my_keyword_update_p="$func_serial_update_check_result"
686 if $my_keyword_update_p || $opt_force; then
687 func_copy "$my_srcfile" "$my_destfile"
688 elif test "X$my_dest_serial" = "X$my_src_serial"; then
690 || func_echo "\`$my_destfile' is already up to date."
695 # func_ltmain_update filename srcdir destdir
696 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
697 # has a newer revision, or DESTFILE does not yet exist, or the user
698 # specified `--force' at the command line.
699 func_ltmain_update ()
702 my_sed_ltmain=['/^package_revision='\''*[0-9][1-9.]*'\''*/ {
703 s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1,; p;
707 func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
709 return $my_return_status
713 # func_config_update filename srcdir destdir
714 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
715 # has a newer timestamp, or DESTFILE does not yet exist, or the user
716 # specified `--force' at the command line.
717 func_config_update ()
720 my_sed_config=['/^timestamp='\''*[0-9][1-9-]*'\''*/ {
721 s,^timestamp='\''*\([0-9-]*\)'\''*,\1,; s/-/./g; p;
725 func_keyword_update "$1" "$2" "$3" "$my_sed_config"
727 return $my_return_status
731 # func_install_update filename srcdir destdir
732 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
733 # has a newer timestamp, or DESTFILE does not yet exist, or the user
734 # specified `--force' at the command line.
735 func_install_update ()
738 my_sed_install=['/^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
739 s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,; s/-/./g; p;
743 func_keyword_update "$1" "$2" "$3" "$my_sed_install"
745 return $my_return_status
750 # Sanity check macros from aclocal.m4 against installed versions.
754 # Don't trace for this, we're just checking the user didn't invoke it
755 # directly from configure.ac.
756 $SED 's,[d]nl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \
757 && func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'"
760 || func_echo "Remember to add \`LT_INIT' to \`$configure_ac'."
762 # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
766 # func_massage_aclocal_DATA [glob_exclude]
767 # @aclocal_DATA\@ is substituted as per its value in Makefile.am;
768 # this function massages it into a suitable format for func_copy_some_files.
769 func_massage_aclocal_DATA ()
771 pkgmacro_files= # GLOBAL VAR
775 # Massage a value for pkgmacro_files from the value used in Makefile.am.
776 for my_filename in @aclocal_DATA@; do
777 my_filename=`$ECHO "X$my_filename" | $Xsed -e "$basename"`
779 # ignore excluded filenames
780 if test -n "$my_glob_exclude"; then
781 eval 'case $my_filename in '$my_glob_exclude') continue ;; esac'
784 pkgmacro_files="$pkgmacro_files:$my_filename"
787 # strip spurious leading `:'
788 pkgmacro_files=`$ECHO "X$pkgmacro_files" | $Xsed -e 's,^:*,,'`
792 # func_massage_pkgltdl_files [glob_exclude]
793 # @pkgltdl_files\@ is substituted as per its value in Makefile.am; this
794 # function massages it into a suitable format for func_copy_some_files.
795 func_massage_pkgltdl_files ()
797 pkgltdl_files= # GLOBAL VAR
801 # Massage a value for pkgltdl_files from the value used in Makefile.am
802 for my_filename in @pkgltdl_files@; do
804 # ignore excluded filenames
805 if test -n "$my_glob_exclude"; then
806 eval 'case $my_filename in '$my_glob_exclude') continue ;; esac'
810 case :$pkgltdl_files: in
812 *) pkgltdl_files="$pkgltdl_files:$my_filename" ;;
816 # strip spurious leading `:'
817 pkgltdl_files=`$ECHO "X$pkgltdl_files" | $Xsed -e 's,^:*,,'`
821 # func_nonemptydir_p dirvar
822 # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
823 # a directory that exists and is non-empty abort with a diagnostic.
824 func_nonemptydir_p ()
828 my_dir=`eval echo "\\\$$my_dirvar"`
830 # Is it a directory at all?
832 || func_fatal_error "\$$my_dirvar not a directory: \`$my_dir'"
834 # check that the directories contents can be ls'ed
835 test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
836 || func_fatal_error "can not list files: \`$my_dir'"
847 # Allow the user to override the master libtoolize repository:
848 if test -n "$_lt_pkgdatadir"; then
849 pkgdatadir="$_lt_pkgdatadir"
850 aclocaldir="$_lt_pkgdatadir/m4"
852 func_nonemptydir_p pkgdatadir
853 func_nonemptydir_p aclocaldir
855 func_massage_pkgltdl_files
857 # libtool.m4 and ltdl.m4 are handled specially below
858 func_massage_aclocal_DATA 'libtool.m4|ltdl.m4'
860 glob_exclude_pkgaux_files='config.guess|config.sub|install-sh|ltmain.sh'
863 $opt_quiet || func_check_macros
865 # Copy all the files from installed libltdl to this project, if the
866 # user specified `--ltdl'.
867 if test -n "$ltdldir"; then
868 func_copy_some_files "$pkgltdl_files" "$pkgdatadir/libltdl" "$ltdldir"
870 # libtoolize the newly copied libltdl tree
871 ( cd "$ltdldir" && eval "$progpath" $libtoolize_flags ) \
872 || exit $EXIT_FAILURE
875 # Copy all the installed utility files to the auxiliary directory if
876 # `--install' was passed, or else copy just ltmain.sh.
877 $opt_quiet || if test "$auxdir" != .; then
878 func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
880 if $opt_install; then
881 func_config_update config.guess "$pkgdatadir/config" "$auxdir"
882 func_config_update config.sub "$pkgdatadir/config" "$auxdir"
883 func_install_update install-sh "$pkgdatadir/config" "$auxdir"
885 func_ltmain_update ltmain.sh "$pkgdatadir/config" "$auxdir"
887 # Copy libtool's m4 macros to the macro directory, if they are newer.
888 if test -n "$m4dir"; then
889 $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
891 func_serial_update libtool.m4 "$aclocaldir" "$m4dir" \
892 LT_INIT 'A[[CM]]_PROG_LIBTOOL'
895 func_serial_update ltdl.m4 "$aclocaldir" "$m4dir" 'LTDL_INIT'
897 func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
900 func_copy_some_files "$pkgmacro_files" "$aclocaldir" \
901 "$m4dir" func_serial_update
903 func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macro files."