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, 2006 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 # Libtoolize 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 # Libtoolize 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
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with libtoolize; see the file COPYING. If not, a copy
24 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
25 # or obtained by writing to the Free Software Foundation, Inc.,
26 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 # Usage: $progname [OPTION]...
30 # Prepare a package to use libtool.
32 # -c, --copy copy files rather than symlinking them
33 # --debug enable verbose shell tracing
34 # -n, --dry-run print commands rather than running them
35 # -f, --force replace existing files
36 # -i, --install copy missing auxiliary files
37 # --ltdl[=DIR] install libltdl sources [default: libltdl]
38 # --nonrecursive prepare ltdl for non-recursive make
39 # -q, --quiet work silently
40 # --recursive prepare ltdl for recursive make
41 # --subproject prepare ltdl to configure and build independently
42 # -v, --verbose verbosely report processing
43 # --version print version information and exit
44 # -h, --help print short or long help message
46 # You must `cd' to the top directory of your package before you run
49 # When reporting a bug, please describe a test case to reproduce it and
50 # include the following information:
52 # host-triplet: @host_triplet@
53 # $progname: (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
54 # automake: $automake_version
55 # autoconf: $autoconf_version
57 # Report bugs to <bug-libtool@gnu.org>.
66 m4_include([getopt.m4sh])
69 # test EBCDIC or ASCII
70 case `echo X|tr X '\101'` in
71 A) # ASCII based system
72 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
74 NL2SP='tr \015\012 \040\040'
76 *) # EBCDIC based system
78 NL2SP='tr \r\n \100\100'
83 # Command line options:
94 # ltdl can be installed to be self-contained (subproject, the default);
95 # or to be configured by a parent project, either with a recursive or
96 # nonrecursive automake driven make:
99 # Locations for important files:
102 pkgdatadir=@pkgdatadir@
103 pkgltdldir=@pkgdatadir@
104 aclocaldir=@aclocaldir@
108 configure_ac=configure.in
111 # Parse options once, thoroughly. This comes as soon as possible in
112 # the script to make things like `libtoolize --version' happen quickly.
115 my_sed_single_opt='1s/^\(..\).*$/\1/;q'
116 my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
117 my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
118 my_sed_long_arg='1s/^--[^=]*=//'
120 while test "$#" -gt 0; do
124 --copy|-c) opt_link=false ;;
126 --debug) func_echo "enabling shell trace mode"
131 --dry-run|-n) if $opt_dry_run; then :; else
134 test -n "$LN_S" && LN_S="$ECHO $LN_S"
141 --force|-f) opt_force=: ;;
143 --install|-i) opt_install=: ;;
146 if test "$#" -gt 0; then
149 *) ltdldir=`$ECHO "X$1" | $Xsed -e 's,/*$,,'`
156 --nonrecursive|--non-recursive)
157 ltdl_mode=nonrecursive
160 --quiet|--automake|-q) # --automake is for 1.5 compatibility
164 --recursive) ltdl_mode=recursive ;;
166 --subproject) ltdl_mode=subproject ;;
168 --verbose|-v) opt_verbose=: ;;
170 # Separate optargs to long options:
172 arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_arg"`
173 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_long_opt"`
174 set dummy "$opt" "$arg" ${1+"$@"}
178 # Separate optargs to short options:
180 # arg=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
181 # opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
182 # set dummy "$opt" "$arg" ${1+"$@"}
186 # Separate non-argument short options:
187 -c*|-f*|-i*|-n*|-q*|-v*)
188 rest=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_rest"`
189 opt=`$ECHO "X$opt" | $Xsed -e "$my_sed_single_opt"`
190 set dummy "$opt" "-$rest" ${1+"$@"}
194 -\?|-h) func_usage ;;
196 --version) func_version ;;
198 -*) func_fatal_help "unrecognized option \`$opt'" ;;
199 *) func_fatal_help "too many arguments" ;;
205 # func_copy srcfile destfile
206 # A wrapper for func_copy_cb that accepts arguments in the same order
207 # as the cp(1) shell command.
213 { func_error "\`$1' not copied: not a regular file"; return 1; }
215 my_f1=`$ECHO "X$1" | $Xsed -e "$basename"`
217 if test -d "$2"; then
219 func_copy_cb "$my_f1" \
220 `$ECHO "X$1" | $Xsed -e "$dirname"` "$2"
224 # Supporting this would mean changing the timestamp:
225 test "X$my_f1" = X`$ECHO "X$2" | $Xsed -e "$basename"` \
226 || func_fatal_error "func_copy() cannot change filename on copy"
228 func_copy_cb "$my_f1" \
229 `$ECHO "X$1" | $Xsed -e "$dirname"` \
230 `$ECHO "X$2" | $Xsed -e "$dirname"`
234 return $copy_return_status # set in func_copy_cb
238 # func_copy_cb filename srcdir destdir
239 # If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails,
240 # then try to copy SRCFILE to DESTFILE (without changing the timestamp if
250 # Libtool is probably misinstalled if this happens:
251 test -f "$my_srcdir/$my_file" ||
252 func_fatal_error "\`$my_file' not found in \`$my_srcdir'"
255 false) my_copy_msg="file \`$my_destdir/$my_file'" ;;
256 *) my_copy_msg="file from \`$my_srcdir/$my_file'" ;;
258 func_mkdir_p `$ECHO "X$my_destdir/$my_file" | $Xsed -e "$dirname"`
260 $RM "$my_destdir/$my_file"
262 if test "$my_file" = "aclocal.m4"; then
263 if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
264 | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; }
266 $opt_quiet || func_echo "copying $my_copy_msg"
270 if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then
271 $opt_quiet || func_echo "linking $my_copy_msg"
276 if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \
277 | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \
278 && touch "$my_destdir/$my_file"; then
279 $opt_quiet || func_echo "copying $my_copy_msg"
283 if test "$copy_return_status" != 0; then
284 func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'"
285 exit_status=$EXIT_FAILURE
290 # func_copy_some_files srcfile_spec srcdir destdir [copy_cb=func_copy_cb]
291 # Call COPY_CB for each regular file in SRCDIR named by the ':' delimited
292 # names in SRCFILE_SPEC. The odd calling convention is needed to allow
293 # spaces in file and directory names.
294 func_copy_some_files ()
300 my_copy_cb="${4-func_copy_cb}"
304 for my_filename in $my_srcfile_spec; do
306 if test -f "$my_srcdir/$my_filename"; then
307 if test "X$my_copy_cb" = Xfunc_copy_cb; then
308 $opt_force || if test -f "$my_destdir/$my_filename"; then
310 || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite"
315 func_fatal_error "\`$my_filename' not found in \`$my_srcdir'"
318 $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir"
323 # func_fixup_Makefile srcfile srcdir destdir
324 func_fixup_Makefile ()
329 my_fixup_non_subpackage_script="\
330 s,libltdl/configure.ac,,
331 s,libltdl/configure,,
332 s,libltdl/aclocal.m4,,
333 s,libltdl/config-h.in,,
334 s,libltdl/Makefile.am,,
335 s,libltdl/Makefile.in,,
339 my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" | \
341 my_fixup_inc_paths_script= ;;
344 repl_uscore=`$ECHO "X$repl" | $Xsed -e 's,[/.+-],_,g'`
345 my_fixup_inc_paths_script="\
346 s,libltdl_,@repl_uscore@_,
348 s,: libltdl/,: @repl@/,
349 s, -Ilibltdl , -I@repl@ ,
350 s,\\\$(libltdl_,\$(@repl_uscore@_,
351 s,)/libltdl ,)/@repl@ ,
352 s,@repl_uscore@,${repl_uscore},g
357 $RM "$my_destdir/$my_filename" 2>/dev/null
358 $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'"
359 if $opt_dry_run; then :;
361 $SED "$my_fixup_non_subpackage_script
362 $my_fixup_inc_paths_script" \
363 < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" ||
364 func_fatal_error "cannot create $my_destdir/$my_filename"
369 # Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl
370 # and libtool. Possibly running some of these tools if necessary.
371 # Libtoolize affects the contents of aclocal.m4, and should be run before
372 # aclocal, so we can't use configure --trace which relies on a consistent
373 # configure.(ac|in) and aclocal.m4.
377 # Prefer configure.ac to configure.in
378 test -f configure.ac && configure_ac=configure.ac
379 test -f "$configure_ac" || configure_ac=
381 # Set local variables to reflect contents of configure.ac
382 my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,;
384 s,^.*$,seen_autoconf=:,
388 test -z "$configure_ac" \
389 || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"`
393 test -n "$configure_ac" && my_configure_ac="$configure_ac: "
394 func_verbose "${my_configure_ac}not using Autoconf"
396 # Make sure ltdldir is set, even though we return early here:
397 test -n "$ltdldir" || ltdldir=libltdl
401 # ---------------------------------------------------- #
402 # Probe macro usage in configure.ac and/or aclocal.m4. #
403 # ---------------------------------------------------- #
405 my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,
406 s,^.*AC_REQUIRE(.*$,,; s,^.*m4_require(.*$,,; s,^.*m4_define(.*$,,
407 s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4_defun(.*$,,
408 /AC_CONFIG_AUX_DIR(/ {
409 s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,auxdir=\1,
412 /AC_CONFIG_MACRO_DIR(/ {
413 s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^])]*\).*$,macrodir=\1,
416 /_LT_CONFIG_LTDL_DIR(/d
417 /LT_CONFIG_LTDL_DIR(/ {
418 s/^.*LT_CONFIG_LTDL_DIR([[ ]*\([^]),]*\)[^,]*/ac_ltdldir=\1%%/
419 s/%%[[, ]*\([^])]*\).*$/ ac_ltdl_mode=\1%%/
423 /A[CM]_PROG_LIBTOOL/ {
424 s,^.*$,seen_libtool=:,
428 s,^.*$,seen_libtool=:,
448 eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"`
451 # ----------------- #
452 # Validate ltdldir. #
453 # ----------------- #
455 ac_ltdldir=`$ECHO "X$ac_ltdldir" | $Xsed -e 's,/*$,,'`
457 # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its
458 # arguments were not given in terms of a shell variable!
459 case "$ac_ltdldir$ac_ltdl_mode" in
461 func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR"
465 # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
466 # `libltdl'. If both are specified, they must be the same. Otherwise,
467 # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified
468 # we suggest adding it later in this code.)
469 case x$ac_ltdldir,x$ltdldir in
470 x,x) ltdldir=libltdl ;;
471 x*,x) ltdldir=$ac_ltdldir ;;
472 x,x*) ltdldir=$ltdldir ;;
474 test x"$ac_ltdldir" = x"$ltdldir" || \
475 func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)"
480 # ------------------- #
481 # Validate ltdl_mode. #
482 # ------------------- #
484 test -n "$ac_ltdl_mode" && seen_ltdl=:
486 # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to
487 # `subproject'. If both are specified, they must be the same. Otherwise,
488 # take the one that is given!
489 case x$ac_ltdl_mode,x$ltdl_mode in
490 x,x) ltdl_mode=subproject ;;
491 x*,x) ltdl_mode=$ac_ltdl_mode ;;
492 x,x*) ltdl_mode=$ltdl_mode ;;
494 test x"$ac_ltdl_mode" = x"$ltdl_mode" || \
495 func_fatal_error "--$ltdl_mode does not match LT_CONFIG_LTDL_DIR($ac_ltdldir, $ac_ltdl_mode)"
504 if test -n "$auxdir"; then
505 # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was
506 # not given in terms of a shell variable!
509 func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR"
514 # Try to discover auxdir the same way it is discovered by configure.
515 # Note that we default to the current directory.
516 for dir in . .. ../..; do
517 if test -f "$dir/install-sh"; then
520 elif test -f "$dir/install.sh"; then
527 # Just use the current directory if all else fails.
528 test -n "$auxdir" || auxdir=.
531 # ------------------------------ #
532 # Find local m4 macro directory. #
533 # ------------------------------ #
535 # If AC_CONFIG_MACRO_DIR turned nothing up, we hunt for ACLOCAL_AMFLAGS
536 # in `Makefile.am' for a `-I' argument.
538 my_sed_aclocal_flags='
539 /^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=/ {
540 s,^[^=]*=[ ]*\(.*\), \1,
545 if test ! -n "$m4dir" && test -f Makefile.am; then
546 my_m4dir_is_next=false
547 for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do
548 if $my_m4dir_is_next; then
552 if test "X$arg" = "X-I"; then
555 my_m4dir_is_next=false
562 # func_included_files searchfile
563 # Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE.
564 func_included_files ()
571 /^m4_include(\[.*\])$/ {
572 s,^m4_include(\[\(.*\)\])$,\1,
577 if test -f "$my_searchfile"; then
578 $ECHO "X$my_searchfile" | $Xsed
580 # Only recurse when we don't care if all the variables we use get
581 # trashed, since they are in global scope.
582 for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do
583 func_included_files $my_filename
589 # func_serial filename [macro_regex]
590 # Output the value of the serial number comment in FILENAME, where the
591 # comment line must also match MACRO_REGEX, if given.
598 /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ {
599 s,^# serial \([1-9][0-9.]*\).*$,\1,
604 # Search FILENAME and all the files it m4_includes for a serial number
605 # in the file that AC_DEFUNs MACRO_REGEX.
607 for my_file in `func_included_files "$my_filename"`; do
608 if test -z "$my_macro_regex" ||
609 test "$my_filename" = aclocal.m4 ||
610 test "$my_macro_regex" = `echo "$my_filename" | $SED "$basename"` ||
611 func_grep '^AC_DEFUN(\@<:@'"$my_macro_regex" "$my_file"
613 my_serial=`$SED -e "$my_sed_serial" "$my_file"`
618 # If the file has no serial number, we assume it's ancient.
619 test -n "$my_serial" || my_serial=0
625 # func_serial_max serial1 serial2
626 # Compare (possibly multi-part, '.' delimited) serial numbers, and
627 # return the largest in $func_serial_max_result. If they are the
628 # same, func_serial_max_result will be empty.
635 my_sed_dot='s/\..*$//g'
636 my_sed_rest='s/^[0-9][1-9]*\.*//'
637 my_sed_digits='s/[^0-9.]//g'
639 # Incase they turn out to be the same, we'll set it to empty
640 func_serial_max_result=
642 test "X$1$2" = X`$ECHO "X$1$2" | $Xsed -e "$my_sed_digits"` || {
643 func_error "serial numbers \`$1' or \`$2' contain non-digit chars"
647 while test -n "$my_serial1$my_serial2"; do
648 my_serial1_part=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_dot"`
649 my_serial2_part=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_dot"`
651 test -z "$my_serial1_part$my_serial2_part" \
654 test -z "$my_serial1_part" \
655 && { func_serial_max_result="$2"; break; }
657 test -z "$my_serial2_part" \
658 && { func_serial_max_result="$1"; break; }
660 test "$my_serial1_part" -gt "$my_serial2_part" \
661 && { func_serial_max_result="$1"; break; }
663 test "$my_serial2_part" -gt "$my_serial1_part" \
664 && { func_serial_max_result="$2"; break; }
666 my_serial1=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_rest"`
667 my_serial2=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_rest"`
672 # func_serial_update_check srcfile src_serial destfile dest_serial
673 # Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check
675 func_serial_update_check ()
684 if test -f "$my_destfile"; then
685 test "X$my_src_serial" = "X0" && {
686 func_error "warning: no serial number on \`$my_srcfile', not copying."
690 # Determine whether the destination has an older serial.
691 func_serial_max "$my_src_serial" "$my_dest_serial"
692 test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false
694 test "X$my_src_serial" = "X$func_serial_max_result" \
695 && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'"
697 if test "X$my_dest_serial" = "X$func_serial_max_result"; then
698 func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'"
700 || func_error "\`$my_destfile' is newer: use \`--force' to overwrite"
704 func_serial_update_check_result="$my_update_p"
708 # func_serial_update filename srcdir destdir [macro_regex] [old_macro_regex]
709 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
710 # has a newer serial number, or DESTFILE does not yet exist, or the user
711 # specified `--force' at the command line. If given, MACRO_REGEX or
712 # OLD_MACRO_REGEX must match any text after "# serial N" in both files.
713 func_serial_update ()
720 my_old_macro_regex="$5"
724 my_srcfile="$my_srcdir/$my_filename"
725 my_destfile="$my_destdir/$my_filename"
727 test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
729 if test -f "$my_destfile"; then
730 my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"`
731 my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"`
733 # Strictly, this libtoolize ought not to have to deal with ancient
734 # serial formats, but we accept them here to be complete:
735 test "X$my_src_serial" = "X0" &&
736 my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"`
738 test "X$my_dest_serial" = "X0" &&
739 my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"`
741 func_serial_update_check \
742 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
743 my_serial_update_p="$func_serial_update_check_result"
746 if $my_serial_update_p || $opt_force; then
747 func_copy "$my_srcfile" "$my_destfile"
749 elif test "X$my_dest_serial" = "X$my_src_serial"; then
751 || func_echo "\`$my_destfile' is already up to date."
754 # Do this after the copy for hand maintained `aclocal.m4', incase
755 # it has `m4_include([DESTFILE])', so the copy effectively already
756 # updated `aclocal.m4'.
757 my_included_files=`func_included_files aclocal.m4`
758 case `echo " $my_included_files " | $NL2SP` in
760 # Skip included files:
761 *" $my_destfile "*) ;;
763 # Otherwise compare to aclocal.m4 serial number (func_serial
764 # returns 0 for older macro serial numbers before we provided
765 # serial tags, so the update message will be correctly given
766 # if aclocal.m4 contains an untagged --i.e older-- macro file):
768 if test -f aclocal.m4; then
770 "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"`
771 test "X$my_src_serial" = "X$func_serial_max_result" \
772 && func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'."
776 return $my_return_status
780 # func_keyword_update filename srcdir destdir sed_script
781 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
782 # has a newer revision according to the serial number extracted by
783 # SED_SCRIPT, or DESTFILE does not yet exist, or the user specified
784 # `--force' at the command line.
785 func_keyword_update ()
793 my_srcfile="$my_srcdir/$my_filename"
794 my_destfile="$my_destdir/$my_filename"
796 my_keyword_update_p=:
798 test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist."
800 if test -f "$my_destfile"; then
801 my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"`
802 test -z "$my_src_serial" && {
803 func_error "warning: no serial number in \`$my_srcfile', not copying."
807 my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"`
808 test -n "$my_dest_serial" || my_dest_serial=0
810 func_serial_update_check \
811 "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial"
812 my_keyword_update_p="$func_serial_update_check_result"
815 if $my_keyword_update_p || $opt_force; then
816 func_copy "$my_srcfile" "$my_destfile"
817 elif test "X$my_dest_serial" = "X$my_src_serial"; then
819 || func_echo "\`$my_destfile' is already up to date."
824 # func_ltmain_update filename srcdir destdir
825 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
826 # has a newer revision, or DESTFILE does not yet exist, or the user
827 # specified `--force' at the command line.
828 func_ltmain_update ()
832 /^package_revision='\''*[0-9][1-9.]*'\''*/ {
833 s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1,
838 func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain"
840 return $my_return_status
844 # func_config_update filename srcdir destdir
845 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
846 # has a newer timestamp, or DESTFILE does not yet exist, or the user
847 # specified `--force' at the command line.
848 func_config_update ()
852 /^timestamp='\''*[0-9][1-9-]*'\''*/ {
853 s,^timestamp='\''*\([0-9-]*\)'\''*,\1,
859 func_keyword_update "$1" "$2" "$3" "$my_sed_config"
861 return $my_return_status
865 # func_install_update filename srcdir destdir
866 # Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME
867 # has a newer timestamp, or DESTFILE does not yet exist, or the user
868 # specified `--force' at the command line.
869 func_install_update ()
873 /^scriptversion='\''*[0-9][1-9.-]*'\''*/ {
874 s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1,
880 func_keyword_update "$1" "$2" "$3" "$my_sed_install"
882 return $my_return_status
887 # Sanity check macros from aclocal.m4 against installed versions.
891 ac_config_macro_dir_advised=false
893 $seen_autoconf || return
895 # Suggest modern idioms for storing autoconf macros:
896 if test -z "$macrodir$ltdldir"; then
897 if test x"$m4dir" = x.; then
898 func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and rerunning"
899 func_echo " libtoolize, to keep the correct libtool macros in-tree."
901 func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$m4dir])'to $configure.ac,"
902 func_echo "and rerunning libtoolize."
904 elif test -z "$m4dir"; then
905 if $opt_ltdl && test "${ltdlprefix}m4" != "$m4dir"; then
906 acmacrodir="${ltdlprefix}m4"
908 acmacrodir="$aclocaldir"
911 func_echo "You should add the contents of the following files to \`aclocal.m4':"
912 for need in libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4; do
913 func_echo " \`$acmacrodir/$need'"
915 if $seen_ltdl || $opt_ltdl; then
916 for need in argz.m4 ltdl.m4; do
917 func_echo " \`$acmacrodir/$need'"
920 if test "$acmacrodir" != "$aclocaldir"; then
921 func_echo "or else add \`AC_CONFIG_MACRO_DIR([$acmacrodir])' to $configure_ac."
922 ac_config_macro_dir_advised=:
927 func_echo "Remember to add \`LT_INIT' to $configure_ac."
931 # Suggest using LT_WITH_LTDL if appropriate:
933 func_echo "Consider adding \`LT_WITH_LTDL' to $configure_ac"
935 # Remind the user to call LT_CONFIG_LTDL_DIR:
936 test -n "$ac_ltdldir" ||
937 func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([$ltdldir])' to \`$configure_ac'."
939 # Offer some suggestions for avoiding duplicate files in a project
941 test "${ltdlprefix}config" = "$auxdir" ||
942 func_echo "Consider using \`AC_CONFIG_AUX_DIR([${ltdlprefix}config])' in $configure_ac."
943 $ac_config_macro_dir_advised || test "${ltdlprefix}m4" = "$m4dir" ||
944 func_echo "Consider using \`AC_CONFIG_MACRO_DIR([${ltdlprefix}m4])' in $configure_ac."
946 # Don't trace for this, we're just checking the user didn't invoke it
947 # directly from configure.ac.
948 $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB &&
949 func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'"
952 # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release
956 # func_massage_aclocal_DATA [glob_exclude]
957 # @aclocal_DATA\@ is substituted as per its value in Makefile.am;
958 # this function massages it into a suitable format for func_copy_some_files.
959 func_massage_aclocal_DATA ()
961 pkgmacro_files= # GLOBAL VAR
965 # Massage a value for pkgmacro_files from the value used in Makefile.am.
966 for my_filename in @aclocal_DATA@; do
967 my_filename=`$ECHO "X$my_filename" | $Xsed -e "$basename"`
969 # ignore excluded filenames
970 if test -n "$my_glob_exclude"; then
972 eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
976 pkgmacro_files="$pkgmacro_files:$my_filename"
979 # strip spurious leading `:'
980 pkgmacro_files=`$ECHO "X$pkgmacro_files" | $Xsed -e 's,^:*,,'`
984 # func_massage_pkgltdl_files [glob_exclude]
985 # @pkgltdl_files\@ is substituted as per its value in Makefile.am; this
986 # function massages it into a suitable format for func_copy_some_files.
987 func_massage_pkgltdl_files ()
989 pkgltdl_files= # GLOBAL VAR
993 # Massage a value for pkgltdl_files from the value used in Makefile.am
994 for my_filename in @pkgltdl_files@; do
996 # Strip surplus leading 'libltdl/':
997 my_filename=`expr "X$my_filename" : 'Xlibltdl/\(.*\)'`
999 # ignore excluded filenames
1000 if test -n "$my_glob_exclude"; then
1002 eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
1003 $my_cont && continue
1007 case :$pkgltdl_files: in
1008 *:$my_filename:*) ;;
1009 *) pkgltdl_files="$pkgltdl_files:$my_filename" ;;
1013 # strip spurious leading `:'
1014 pkgltdl_files=`$ECHO "X$pkgltdl_files" | $Xsed -e 's,^:*,,'`
1018 # func_massage_pkgconfig_files [glob_exclude]
1019 # @pkgconfig_files\@ is substituted as per its value in Makefile.am; this
1020 # function massages it into a suitable format for func_copy_some_files.
1021 func_massage_pkgconfig_files ()
1023 pkgconfig_files= # GLOBAL VAR
1025 my_glob_exclude="$1"
1027 # Massage a value for pkgconfig_files from the value used in Makefile.am
1028 for my_filename in @pkgconfig_files@; do
1030 # ignore excluded filenames
1031 if test -n "$my_glob_exclude"; then
1033 eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac'
1034 $my_cont && continue
1038 case :$pkgconfig_files: in
1039 *:$my_filename:*) ;;
1040 *) pkgconfig_files="$pkgconfig_files:$my_filename" ;;
1044 # strip spurious leading `:'
1045 pkgconfig_files=`$ECHO "X$pkgconfig_files" | $Xsed -e 's,^:*,,'`
1049 # func_nonemptydir_p dirvar
1050 # DIRVAR is the name of a variable to evaluate. Unless DIRVAR names
1051 # a directory that exists and is non-empty abort with a diagnostic.
1052 func_nonemptydir_p ()
1056 my_dir=`eval echo "\\\$$my_dirvar"`
1058 # Is it a directory at all?
1060 || func_fatal_error "\$$my_dirvar not a directory: \`$my_dir'"
1062 # check that the directories contents can be ls'ed
1063 test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \
1064 || func_fatal_error "can not list files: \`$my_dir'"
1075 # Allow the user to override the master libtoolize repository:
1076 if test -n "$_lt_pkgdatadir"; then
1077 pkgltdldir="$_lt_pkgdatadir"
1078 pkgdatadir="$_lt_pkgdatadir/libltdl"
1079 aclocaldir="$_lt_pkgdatadir/libltdl/m4"
1081 func_nonemptydir_p pkgltdldir
1082 func_nonemptydir_p pkgdatadir
1083 func_nonemptydir_p aclocaldir
1089 *) ltdlprefix=$ltdldir/ ;;
1092 # Unless we share CONFIG_AUX_DIR with the libltdl subproject, then
1093 # if they are newer, copy all the installed utility files to the
1094 # auxiliary directory if `--install' was passed, or else copy just
1096 if test -n "$auxdir"; then
1097 if test "${ltdlprefix}config" != "$auxdir"; then
1098 $opt_quiet || if test "$auxdir" != .; then
1099 func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'."
1101 if $opt_install; then
1102 func_config_update config.guess "$pkgdatadir/config" "$auxdir"
1103 func_config_update config.sub "$pkgdatadir/config" "$auxdir"
1104 func_install_update install-sh "$pkgdatadir/config" "$auxdir"
1106 func_ltmain_update ltmain.sh "$pkgdatadir/config" "$auxdir"
1109 func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary files."
1112 # argz.m4, libtool.m4 and ltdl.m4 were handled specially above
1113 func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4'
1115 # Copy libtool's m4 macros to the macro directory, if they are newer
1116 # (keep these in alphabetical order to maintain sanity in testsuite):
1117 if test -n "$m4dir"; then
1118 $opt_quiet || func_echo "putting macros in AC_CONFIG_MACRO_DIR, \`$m4dir'."
1121 func_serial_update argz.m4 "$aclocaldir" "$m4dir" argz.m4
1123 func_verbose "Not copying \`$m4dir/argz.m4', libltdl not used."
1126 func_serial_update libtool.m4 "$aclocaldir" "$m4dir" \
1127 LT_INIT 'A[CM]_PROG_LIBTOOL'
1130 func_serial_update ltdl.m4 "$aclocaldir" "$m4dir" 'LTDL_INIT'
1132 func_verbose "Not copying \`$m4dir/ltdl.m4', libltdl not used."
1137 for file in $pkgmacro_files; do
1139 func_serial_update $file "$aclocaldir" "$m4dir" "$file"
1144 # These files are handled specially, depending on ltdl_mode:
1147 glob_exclude_pkgltdl_files='Makefile.am|Makefile.in*|aclocal.m4|config*'
1150 glob_exclude_pkgltdl_files='Makefile.inc'
1154 func_massage_pkgltdl_files "$glob_exclude_pkgltdl_files"
1155 func_massage_pkgconfig_files
1157 # Copy all the files from installed libltdl to this project, if the
1158 # user specified `--ltdl'.
1161 # Unless we share CONFIG_MACRO_DIR with our parent project,
1163 if test "${ltdlprefix}m4" != "$m4dir"; then
1164 func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \
1165 "$aclocaldir" "${ltdlprefix}m4"
1168 func_copy_some_files "$pkgltdl_files" "$pkgltdldir/libltdl" "$ltdldir"
1170 # For recursive ltdl modes, copy a suitable Makefile.{am,inc}:
1172 recursive) func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" "$ltdldir" ;;
1173 nonrecursive) func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" "$ltdldir" ;;
1176 # Copy config aux files into libltdl.
1177 func_copy_some_files "$pkgconfig_files" "$pkgdatadir" "$ltdldir"
1180 $opt_quiet || func_check_macros