autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conditionally using libtool


From: Russ Allbery
Subject: Re: conditionally using libtool
Date: Fri, 28 Apr 2006 21:05:02 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) XEmacs/21.4.18 (linux)

Bob Rossi <address@hidden> writes:

> I would like to have my package create a single static library and a
> single program by default.

> However, if the user does --enable-tcl-extension, then I would like to
> create a shared library using libtool.

> Can I do something in configure.in that says 
>   if .. 
>     AM_LIBTOOL
>   fi;

> or is this invalid?

Here's what I do for INN.  It seems to work well enough.  I then use
@LIBTOOLCC@ and @LIBTOOLLD@ (well, a variable set to that) before the
actual compile and link commands where appropriate in Makefiles.


dnl A few tests need to happen before any of the libtool tests in order to
dnl avoid error messages.  We therefore lift them up to the top of the file.
AC_PROG_CC
AC_AIX
AC_ISC_POSIX
AC_CANONICAL_HOST

dnl Check to see if the user wants to use libtool.  We only invoke the libtool
dnl setup macros if they do.  Keep this call together with the libtool setup
dnl so that the arguments to configure will be together in configure --help.
inn_use_libtool=no
AC_ARG_ENABLE(libtool,
    [  --enable-libtool        Use libtool for lib generation [default=no]],
    if test "$enableval" = yes ; then
        inn_use_libtool=yes
    fi)
if test x"$inn_use_libtool" = xyes ; then
    AC_PROG_LIBTOOL
    EXTLIB='la'
    EXTOBJ='lo'
    LIBTOOL='$(top)/libtool'
    LIBTOOLCC='$(top)/libtool --mode=compile'
    LIBTOOLLD='$(top)/libtool --mode=link'
else
    EXTLIB='a'
    EXTOBJ='o'
    LIBTOOL=''
    LIBTOOLCC=''
    LIBTOOLLD=''
    AC_SUBST(LIBTOOL)
fi
AC_SUBST(EXTLIB)
AC_SUBST(EXTOBJ)
AC_SUBST(LIBTOOLCC)
AC_SUBST(LIBTOOLLD)

-- 
Russ Allbery (address@hidden)             <http://www.eyrie.org/~eagle/>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]