538 |
$opt_debug |
$opt_debug |
539 |
my_filename="$1" |
my_filename="$1" |
540 |
my_macro_regex="$2" |
my_macro_regex="$2" |
541 |
my_sed_serial='/^# serial [1-9][0-9]*[ ]*'"$my_macro_regex"'[ ]*$/ { |
my_sed_serial=['/^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ { |
542 |
s,^# serial \([1-9][0-9]*\).*$,\1,; q; |
s,^# serial \([1-9][0-9.]*\).*$,\1,; q; |
543 |
}; d' |
}; d'] |
544 |
|
|
545 |
# Search FILENAME and all the files it m4_includes for a serial number |
# Search FILENAME and all the files it m4_includes for a serial number |
546 |
# in the file that AC_DEFUNs MACRO_REGEX. |
# in the file that AC_DEFUNs MACRO_REGEX. |
560 |
$ECHO $my_serial |
$ECHO $my_serial |
561 |
} |
} |
562 |
|
|
563 |
|
|
564 |
|
# func_serial_max serial1 serial2 |
565 |
|
# Compare (possibly multi-part, '.' delimited) serial numbers, and |
566 |
|
# return the largest in $func_serial_max_result. If they are the |
567 |
|
# same, func_serial_max_result will be empty. |
568 |
|
func_serial_max () |
569 |
|
{ |
570 |
|
$opt_debug |
571 |
|
my_serial1="$1" |
572 |
|
my_serial2="$2" |
573 |
|
|
574 |
|
my_sed_dot='s/\..*$//g' |
575 |
|
my_sed_rest='s/^[[0-9]][[1-9]]*\.*//' |
576 |
|
my_sed_digits='s/[[^0-9.]]//g' |
577 |
|
|
578 |
|
# Incase they turn out to be the same, we'll set it to empty |
579 |
|
func_serial_max_result= |
580 |
|
|
581 |
|
test "X$1$2" = X`$ECHO "X$1$2" | $Xsed -e "$my_sed_digits"` || { |
582 |
|
func_error "serial numbers \`$1' or \`$2' contain non-digit chars" |
583 |
|
return |
584 |
|
} |
585 |
|
|
586 |
|
while test -n "$my_serial1$my_serial2"; do |
587 |
|
my_serial1_part=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_dot"` |
588 |
|
my_serial2_part=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_dot"` |
589 |
|
|
590 |
|
test -z "$my_serial1_part$my_serial2_part" \ |
591 |
|
&& break |
592 |
|
|
593 |
|
test -z "$my_serial1_part" \ |
594 |
|
&& { func_serial_max_result="$2"; break; } |
595 |
|
|
596 |
|
test -z "$my_serial2_part" \ |
597 |
|
&& { func_serial_max_result="$1"; break; } |
598 |
|
|
599 |
|
test "$my_serial1_part" -gt "$my_serial2_part" \ |
600 |
|
&& { func_serial_max_result="$1"; break; } |
601 |
|
|
602 |
|
test "$my_serial2_part" -gt "$my_serial1_part" \ |
603 |
|
&& { func_serial_max_result="$2"; break; } |
604 |
|
|
605 |
|
my_serial1=`$ECHO "X$my_serial1" | $Xsed -e "$my_sed_rest"` |
606 |
|
my_serial2=`$ECHO "X$my_serial2" | $Xsed -e "$my_sed_rest"` |
607 |
|
done |
608 |
|
} |
609 |
|
|
610 |
|
|
611 |
|
# func_serial_update_check srcfile src_serial destfile dest_serial |
612 |
|
# Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check |
613 |
|
# to 'false'. |
614 |
|
func_serial_update_check () |
615 |
|
{ |
616 |
|
$opt_debug |
617 |
|
my_srcfile="$1" |
618 |
|
my_src_serial="$2" |
619 |
|
my_destfile="$3" |
620 |
|
my_dest_serial="$4" |
621 |
|
my_update_p=: |
622 |
|
|
623 |
|
if test -f "$my_destfile"; then |
624 |
|
test "X$my_src_serial" = "X0" && { |
625 |
|
func_error "warning: no serial number on \`$my_srcfile', not copying." |
626 |
|
return |
627 |
|
} |
628 |
|
|
629 |
|
# Determine whether the destination has an older serial. |
630 |
|
func_serial_max "$my_src_serial" "$my_dest_serial" |
631 |
|
test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false |
632 |
|
|
633 |
|
test "X$my_src_serial" = "X$func_serial_max_result" \ |
634 |
|
&& func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'" |
635 |
|
|
636 |
|
if test "X$my_dest_serial" = "X$func_serial_max_result"; then |
637 |
|
func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'" |
638 |
|
$opt_force \ |
639 |
|
|| func_error "\`$my_destfile' is newer: use \`--force' to overwrite" |
640 |
|
fi |
641 |
|
fi |
642 |
|
|
643 |
|
func_serial_update_check_result="$my_update_p" |
644 |
|
} |
645 |
|
|
646 |
|
|
647 |
# func_serial_update filename srcdirs destdir [macro_regex] [old_macro_regex] |
# func_serial_update filename srcdirs destdir [macro_regex] [old_macro_regex] |
648 |
# Copy the first file named FILENAME from a directory listed in the |
# Copy the first file named FILENAME from a directory listed in the |
649 |
# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has |
# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has |
660 |
my_old_macro_regex="$5" |
my_old_macro_regex="$5" |
661 |
|
|
662 |
my_return_status=1 |
my_return_status=1 |
|
my_update_p=: |
|
663 |
func_filename_path_search "$my_filename" "$my_srcdirs" |
func_filename_path_search "$my_filename" "$my_srcdirs" |
664 |
my_srcfile="$func_filename_path_search_result" |
my_srcfile="$func_filename_path_search_result" |
665 |
my_destfile="$my_destdir/$my_filename" |
my_destfile="$my_destdir/$my_filename" |
671 |
my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"` |
my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"` |
672 |
# Strictly, this libtoolize ought not to have to deal with ancient |
# Strictly, this libtoolize ought not to have to deal with ancient |
673 |
# serial formats, but we accept them here to be complete: |
# serial formats, but we accept them here to be complete: |
674 |
test "$my_src_serial" -eq 0 && |
test "X$my_src_serial" = "X0" && |
675 |
my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"` |
my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"` |
676 |
|
|
677 |
my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"` |
test "X$my_dest_serial" = "X0" && |
|
test "$my_dest_serial" -eq 0 && |
|
678 |
my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"` |
my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"` |
679 |
|
|
680 |
test "$my_src_serial" -eq 0 && { |
func_serial_update_check \ |
681 |
func_error "warning: no serial number on \`$my_srcfile', not copying." |
"$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" |
682 |
return |
my_update_p="$func_serial_update_check_result" |
|
} |
|
|
|
|
|
# Only perform the file update if the destination has an older serial. |
|
|
test "$my_src_serial" -gt "$my_dest_serial" || my_update_p=false |
|
|
|
|
|
test "$my_src_serial" -gt "$my_dest_serial" \ |
|
|
&& func_verbose "\`$my_srcfile' is serial $my_srcserial, greater than $my_destserial in \`$my_destfile'" |
|
|
|
|
|
if test "$my_src_serial" -lt "$my_dest_serial"; then |
|
|
func_error "\`$my_srcfile' is serial $my_srcserial, less than $my_destserial in \`$my_destfile'" |
|
|
$opt_force \ |
|
|
|| func_fatal_error "Use \`--force' to replace newer libtool files with this version." |
|
|
fi |
|
683 |
fi |
fi |
684 |
|
|
685 |
if $my_update_p || $opt_force; then |
if $my_update_p || $opt_force; then |
686 |
func_copy "$my_srcfile" "$my_destfile" |
func_copy "$my_srcfile" "$my_destfile" |
687 |
my_return_status=$? |
my_return_status=$? |
688 |
else |
elif test "X$my_dest_serial" = "X$my_src_serial"; then |
689 |
$opt_quiet \ |
$opt_quiet \ |
690 |
|| func_echo "\`$my_destfile' is already up to date." |
|| func_echo "\`$my_destfile' is already up to date." |
691 |
fi |
fi |
694 |
# it has `m4_include([DESTFILE])', so the copy effectively already |
# it has `m4_include([DESTFILE])', so the copy effectively already |
695 |
# updated `aclocal.m4'. |
# updated `aclocal.m4'. |
696 |
$use_aclocal || if test -f aclocal.m4; then |
$use_aclocal || if test -f aclocal.m4; then |
697 |
test "$my_src_serial" -gt `func_serial aclocal.m4 "$my_macro_regex"` \ |
func_serial_max \ |
698 |
|
"$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"` |
699 |
|
test "X$my_src_serial" = "X$func_serial_max_result" \ |
700 |
&& func_echo "You should add the contents of \'$my_destfile' to \`aclocal.m4'." |
&& func_echo "You should add the contents of \'$my_destfile' to \`aclocal.m4'." |
701 |
fi |
fi |
702 |
|
|
703 |
return $my_return_status |
return $my_return_status |
704 |
} |
} |
705 |
|
|
|
# func_check_macros |
|
|
# Sanity check macros from aclocal.m4 against installed versions. |
|
|
func_check_macros () |
|
|
{ |
|
|
$opt_debug |
|
|
# Don't trace for this, we're just checking the user didn't invoke it |
|
|
# directly from configure.ac. |
|
|
$SED 's,[d]nl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \ |
|
|
&& func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'" |
|
|
|
|
|
$seen_libtool \ |
|
|
|| func_echo "Remember to add \`LT_INIT' to \`$configure_ac'." |
|
|
|
|
|
# FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release |
|
|
} |
|
706 |
|
|
707 |
# func_ltmain_update filename srcdirs destdir |
# func_ltmain_update filename srcdirs destdir |
708 |
# Copy the first file named FILENAME from a directory listed in the |
# Copy the first file named FILENAME from a directory listed in the |
719 |
func_filename_path_search "$my_filename" "$my_srcdirs" |
func_filename_path_search "$my_filename" "$my_srcdirs" |
720 |
my_srcfile="$func_filename_path_search_result" |
my_srcfile="$func_filename_path_search_result" |
721 |
my_destfile="$my_destdir/$my_filename" |
my_destfile="$my_destdir/$my_filename" |
|
my_sed_ltmain=' |
|
|
s,^VERSION=[[^0-9]]*\(.*\)[[ ]]*$,\1,; t |
|
|
s,^TIMESTAMP=[[^0-9]]*\([[.0-9]]*\) .*$,\1,; t |
|
|
d' |
|
|
|
|
|
if test -n "$my_srcfile"; then |
|
|
|
|
|
# FIXME: check versions, and only downgrade with --force |
|
|
cmp -s "$my_srcfile" "$my_destfile" |
|
|
if test "$?" -ne 0 || $opt_force; then |
|
|
func_copy "$my_srcfile" "$my_destfile" |
|
|
else |
|
|
$opt_quiet \ |
|
|
|| func_echo "\`$my_destfile' is already up to date." |
|
|
fi |
|
722 |
|
|
723 |
else |
my_update_p=: |
724 |
func_error "\`$my_filename' not found in \`$my_srcdirs'." |
my_sed_ltmain=['/^package_revision=[0-9][1-9.]*/ { |
725 |
|
s,^package_revision=\([0-9.]*\)[ ]*$,\1,; p; |
726 |
|
}; d'] |
727 |
|
|
728 |
|
test -f "$my_srcfile" || { |
729 |
|
func_error "\`$my_srcfile' does not exist." |
730 |
|
return |
731 |
|
} |
732 |
|
|
733 |
|
if test -f "$my_destfile"; then |
734 |
|
my_src_serial=`$SED -e "$my_sed_ltmain" "$my_srcfile"` |
735 |
|
test -z "$my_src_serial" && { |
736 |
|
func_error "warning: no serial number in \`$my_srcfile', not copying." |
737 |
|
return |
738 |
|
} |
739 |
|
|
740 |
|
my_dest_serial=`$SED -e "$my_sed_ltmain" "$my_destfile"` |
741 |
|
test -n "$my_dest_serial" || my_dest_serial=0 |
742 |
|
|
743 |
|
func_serial_update_check \ |
744 |
|
"$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" |
745 |
|
my_update_p="$func_serial_update_check_result" |
746 |
|
fi |
747 |
|
|
748 |
|
if $my_update_p || $opt_force; then |
749 |
|
func_copy "$my_srcfile" "$my_destfile" |
750 |
|
elif test "X$my_dest_serial" = "X$my_src_serial"; then |
751 |
|
$opt_quiet \ |
752 |
|
|| func_echo "\`$my_destfile' is already up to date." |
753 |
fi |
fi |
754 |
} |
} |
755 |
|
|
756 |
|
|
757 |
# func_config_update filename srcdirs destdir |
# func_config_update filename srcdirs destdir |
758 |
# Copy the first file named FILENAME from a directory listed in the |
# Copy the first file named FILENAME from a directory listed in the |
759 |
# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has |
# ':' delimited SRCDIRS to DESTFILE provided that either FILENAME has |
769 |
func_filename_path_search "$my_filename" "$my_srcdirs" |
func_filename_path_search "$my_filename" "$my_srcdirs" |
770 |
my_srcfile="$func_filename_path_search_result" |
my_srcfile="$func_filename_path_search_result" |
771 |
my_destfile="$my_destdir/$my_filename" |
my_destfile="$my_destdir/$my_filename" |
|
my_sed_config='s,^timestamp=[[^0-9]]*\([[.0-9-]]*\)[[^0-9]].*$,\1,; t; d' |
|
772 |
|
|
773 |
if test -n "$my_srcfile"; then |
my_update_p=: |
774 |
|
my_sed_config=['/^timestamp='\''\?[0-9][1-9-]*'\''\?/ { |
775 |
|
s,^timestamp='\''\?\([0-9-]*\)'\''\?,\1,; s/-/./g; p; |
776 |
|
}; d'] |
777 |
|
|
778 |
|
test -f "$my_srcfile" || { |
779 |
|
func_error "\`$my_srcfile' does not exist." |
780 |
|
return |
781 |
|
} |
782 |
|
|
783 |
# FIXME: check versions, and only downgrade with --force |
if test -f "$my_destfile"; then |
784 |
cmp -s "$my_srcfile" "$my_destfile" |
my_src_serial=`$SED -e "$my_sed_config" "$my_srcfile"` |
785 |
if test "$?" -ne 0 || $opt_force; then |
test -z "$my_src_serial" && { |
786 |
func_copy "$my_srcfile" "$my_destfile" |
func_error "warning: no serial number in \`$my_srcfile', not copying." |
787 |
else |
return |
788 |
$opt_quiet \ |
} |
789 |
|| func_echo "\`$my_destfile' is already up to date." |
|
790 |
fi |
my_dest_serial=`$SED -e "$my_sed_config" "$my_destfile"` |
791 |
|
test -n "$my_dest_serial" || my_dest_serial=0 |
792 |
|
|
793 |
else |
func_serial_update_check \ |
794 |
func_error "\`$my_filename' not found in \`$my_srcdirs'." |
"$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" |
795 |
|
my_update_p="$func_serial_update_check_result" |
796 |
fi |
fi |
797 |
|
|
798 |
|
if $my_update_p || $opt_force; then |
799 |
|
func_copy "$my_srcfile" "$my_destfile" |
800 |
|
elif test "X$my_dest_serial" = "X$my_src_serial"; then |
801 |
|
$opt_quiet \ |
802 |
|
|| func_echo "\`$my_destfile' is already up to date." |
803 |
|
fi |
804 |
|
} |
805 |
|
|
806 |
|
|
807 |
|
# func_check_macros |
808 |
|
# Sanity check macros from aclocal.m4 against installed versions. |
809 |
|
func_check_macros () |
810 |
|
{ |
811 |
|
$opt_debug |
812 |
|
# Don't trace for this, we're just checking the user didn't invoke it |
813 |
|
# directly from configure.ac. |
814 |
|
$SED 's,[d]nl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB \ |
815 |
|
&& func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'" |
816 |
|
|
817 |
|
$seen_libtool \ |
818 |
|
|| func_echo "Remember to add \`LT_INIT' to \`$configure_ac'." |
819 |
|
|
820 |
|
# FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release |
821 |
} |
} |
822 |
|
|
823 |
|
|
854 |
$opt_quiet || if test "$auxdir" != .; then |
$opt_quiet || if test "$auxdir" != .; then |
855 |
func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'." |
func_echo "putting files in AC_CONFIG_AUX_DIR, \`$auxdir'." |
856 |
fi |
fi |
857 |
if $opt_install || $opt_force; then |
if $opt_install; then |
858 |
func_copy_all_from_path . "$pkgvdatadirs" \ |
func_copy_all_from_path . "$pkgvdatadirs" \ |
859 |
"$auxdir" "$glob_exclude_pkgaux_files" |
"$auxdir" "$glob_exclude_pkgaux_files" |
860 |
func_config_update config.guess "$pkgvdatadirs" "$auxdir" |
func_config_update config.guess "$pkgvdatadirs" "$auxdir" |