[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Getting filenames for libraries
From: |
Jason Curl |
Subject: |
Re: Getting filenames for libraries |
Date: |
Tue, 09 Dec 2008 20:47:35 +0100 |
User-agent: |
Thunderbird 2.0.0.18 (Windows/20081105) |
Brian Dessent wrote:
Jason Curl wrote:
I can't move over to libtool 2.2.x just yet (most distros I support
still have 1.5.26 - sorry) and I'm generating libraries.
FWIW, most distros have a way to use upstream packages without
re-libtoolizing and re-autoreconfing them.
I'm using Ubuntu 8.04, SuSE 11.0, Cygwin 1.5.x. I'm a little afraid of
having both libtool 1.5.x and 2.x installed simultaneously and don't
want to uninstall 1.5.x in fear of breaking things. This newsgroup has
enough reports about mixing releases, especially libtool.
I think what Ralf meant was that you said "most distros I support" as if
to imply that shipping a tarball generated with 2.2 would also require
end-users to have 2.2 installed to build it. But the whole point of the
"make dist" tarball is that it's standalone and the user shouldn't need
any special developer tools to build it, other than a shell, compiler,
and make.
Brian
Thanks Brian, I wasn't 100% sure of what Ralf meant. I'm not as clear as
I'd like to be, these are the platforms I develop with in various
environments and testing (but I hope that's understood now :)
I've attached a sample of the macros if there are comments.
e.g.
configure.ac (only the interesting bits)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
LX_PACKAGE_LIBVERSION([WINLIB], [1], [0], [0], [libmywindll.la])
LX_PROG_RC
AC_CONFIG_FILES([src/rsrc.rc])
Makefile.am
lib_LTLIBRARIES = libmywindll.la
FILES = libmain.c version.c
if HAVE_WINRC
FILES+=rsrc.rc
endif
libmywindll_la_SOURCES=$(FILES)
.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=CC
--mode=compile $(RC) $(RCFLAGS) $< -o $@
libwin_la_LDFLAGS = -no-undefined -version-info @WINLIB_VERSION_INFO@
@SHLIB_VERSION_ARG@
# LX_PACKAGE_LIBVERSION([LIBNAME], [CURRENT], [REVISION], [AGE], [LA FILE])
# -------------------------------------------------------------------------
# For a particular library, define 5 variables:
# LIBNAME_VERSION_INFO
# LIBNAME_MAJOR
# LIBNAME_MINOR
# LIBNAME_REVISION
# LIBNAME_BUILD
# LIBNAME_FILENAME
#
# We will probably break on the following:
# irix, nonstopux, osf (versioning schemes)
# beos, pw32*
#
# We don't support -release or other versioning schemes. We assume
# -version-info c:r:a
#
# Tested on:
# - sparc-sun-solaris2.10
# - i686-pc-linux-gnu
# - i686-pc-cygwin
# - i686-pc-mingw32
AC_DEFUN([LX_PACKAGE_LIBVERSION],
[AC_MSG_CHECKING([Library version $1])
$1_VERSION_INFO="$2:$3:$4"
outputname=$5
case $outputname in
lib*)
name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
AC_MSG_ERROR([
***
*** There's a problem in your configure script. Library names must
*** start with 'lib'
***])
;;
esac
release=""
current=$2
revision=$3
age=$4
case $version_type in
darwin)
major=.`expr $current - $age`
versuffix="$major.$age.$revision"
;;
freebsd-aout)
major=".$current"
versuffix=".$current.$revision";
;;
freebsd-elf)
major=".$current"
versuffix=".$current";
;;
linux)
major=.`expr $current - $age`
versuffix="$major.$age.$revision"
;;
sunos)
major=".$current"
versuffix=".$current.$revision"
;;
windows)
major=`expr $current - $age`
versuffix="-$major"
;;
*)
AC_MSG_WARN([Your library versioning scheme isn't supported])
major=""
versuffix=""
;;
esac
# Generate the filename $1_FILENAME
case $target_os in
*cygwin* | mingw*)
eval $1_FILENAME=\"$soname_spec\"
;;
*)
eval library_names=\"$library_names_spec\"
set dummy $library_names
$1_FILENAME="${2}"
;;
esac
$1_MAJOR=`expr $current - $age`
$1_MINOR=$age
$1_REVISION=$revision
if test -e ${srcdir}/version.txt; then
. ${srcdir}/version.txt
else
PACKAGE_BUILD=0
fi
$1_BUILD="$PACKAGE_BUILD"
version=`echo ${$1_MAJOR}.${$1_MINOR}.${$1_REVISION}.${$1_BUILD}`
AC_SUBST([$1_VERSION_INFO])
AC_SUBST([$1_MAJOR])
AC_SUBST([$1_MINOR])
AC_SUBST([$1_REVISION])
AC_SUBST([$1_BUILD])
AC_SUBST([$1_FILENAME])
AC_MSG_RESULT([${$1_FILENAME} ($version)])
])
# LX_PROG_RC
# ----------
# Looks for the program 'windres'. Checks that it physically resides in the
# place provided by $RC if before
#
# If found,
# - ac_cv_prog_rc=yes
# - RC=/path/to/id/program
# - RCFLAGS=
# If not found,
# - ac_cv_prog_rc=no
#
# To compile with Libtool, you'll have to add the following to your
Makefile.am
#
# .rc.lo:
# $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=CC
--mode=compile $(RC) $(RCFLAGS) $< -o $@
#
# TODO:
# - To do, we should check more instances, in particular based on the
triplets
# for GNU compiler tools
# - Should we disable shared libraries? Probably not, leave that to the
user.
AC_DEFUN([LX_TEST_RC],
[if test x$ac_cv_prog_rc != xyes; then
type $1 >/dev/null 2>/dev/null
if test $? -eq 0; then
# The system could find the program (an alias or whatever)
ac_cv_prog_rc=yes
RC=`echo $1`
if test x$RCFLAGS = x; then
RCFLAGS=''
else
RCFLAGS=`echo $2`
fi
else
ac_cv_prog_rc=no
fi
fi
])
AC_DEFUN([LX_PROG_RC],
[AC_MSG_CHECKING([for rc])
if test x$RC != x; then
LX_TEST_AR([$RC],[$RCFLAGS])
fi
# TODO: Check the host triplets for the compiler
# Check the default
LX_TEST_RC([windres],[])
AM_CONDITIONAL([HAVE_WINRC], [test x$ac_cv_prog_rc = xyes])
if test x$ac_cv_prog_rc = xyes; then
AC_MSG_RESULT([$RC $RCFLAGS])
AC_SUBST(RC)
AC_SUBST(RCFLAGS)
else
AC_MSG_RESULT([Not found])
fi
])