From ba98d73f188333f75ab01fc396c8a17afcd7e8be Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 31 Mar 2003 17:36:01 +0000 Subject: [PATCH] * ltmain.in: New flag -version-number to be used for maintaining compatability with a previously non-Libtool versioning scheme. * doc/libtool.texi: Document it. --- ChangeLog | 6 ++++++ doc/libtool.texi | 8 ++++++++ ltmain.in | 53 +++++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index b8f4a21e..4eba5812 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-03-31 Keith Packard + + * ltmain.in: New flag -version-number to be used for maintaining + compatability with a previously non-Libtool versioning scheme. + * doc/libtool.texi: Document it. + 2003-03-31 Naofumi Yasufuku * ltmain.in (win32_libid): Fixed sed expression error in diff --git a/doc/libtool.texi b/doc/libtool.texi index 2cd0fa39..76034694 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -1307,6 +1307,14 @@ information @var{current}, @var{revision}, and @var{age} to build it (@pxref{Versioning}). Do @strong{not} use this flag to specify package release information, rather see the @samp{-release} flag. +@item -version-number @var{major}[:@var{minor}[:@var{revision}]] +If @var{output-file} is a libtool library, compute interface version +information so that the resulting library uses the specified major, minor and +revision numbers. This is designed to permit libtool to be used with +existing projects where identical version numbers are already used across +operating systems. New projects should use the @samp{-version-info} flag +instead. + @item -Wl,@var{flag} @itemx -Xlinker @var{flag} Pass a linker specific flag directly to the linker. diff --git a/ltmain.in b/ltmain.in index f4aa90d5..5ac8f8a8 100644 --- a/ltmain.in +++ b/ltmain.in @@ -878,6 +878,7 @@ EOF temp_rpath= thread_safe=no vinfo= + vinfo_number=no # We need to know -static, to get the right output filenames. for arg @@ -1400,6 +1401,11 @@ EOF prev=vinfo continue ;; + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; -Wc,*) args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` @@ -2715,7 +2721,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 fi if test -n "$release"; then @@ -2792,7 +2798,7 @@ EOF fi if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 fi if test -n "$release"; then @@ -2811,9 +2817,46 @@ EOF exit 1 fi - current="$2" - revision="$3" - age="$4" + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$2" + number_minor="$3" + number_revision="$4" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows) + current=`expr $number_major + $number_minor` + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + current=`expr $number_major + $number_minor - 1` + age="$number_minor" + revision="$number_minor" + ;; + esac + ;; + no) + current="$2" + revision="$3" + age="$4" + ;; + esac # Check that each of the things are valid numbers. case $current in