autoconf
[Top][All Lists]
Advanced

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

Re: checking twice the same library with AC_CHECK_LIB


From: Vincent Torri
Subject: Re: checking twice the same library with AC_CHECK_LIB
Date: Fri, 18 Mar 2011 15:50:30 +0100 (CET)



On Fri, 18 Mar 2011, Eric Blake wrote:

On 03/18/2011 08:29 AM, Vincent Torri wrote:

Hey,

on Windows, with mingw, libbfd may depend on gettext (libintl, more
precisely). I would like to do something like:

AC_CHECK_LIB([bfd], [bfd_openr],
   [
    have_bfd="yes"
    bfd_libs="-lbfd"
   ],
   [have_bfd="no"])
if test "x$have_bfd" = "xno" ; then
   AC_CHECK_LIB([bfd], [bfd_openr],
      [bfd_libs="-lbfd -lintl"],
      [AC_MSG_ERROR([the symbol bfd_openr can not be found])],
      [-lintl])
fi

According to the autoconf manual, you should rearrange the test order,
and test for libintl first prior to bfd, so that $LIBS will already
include -lintl by the time you are ready to test for -bfd.

It's not what I want. The test I want is:

1) checking if libbfd can be used without libintl. If yes, then setting bfd_libs to "-lbfd"

2) If no, then checking if libbfd can be used with libintl. If yes, then setting bfd_libs to "-lbfd -lintl". If not, I exit.

I want to set bfd_libs like that (because of static linking and .pc files)

Also,
AC_CHECK_LIB has a fifth argument (other-libraries); you may want to try:

AC_CHECK_LIB([bfd], [bfd_openr], [...], [...], [-lintl])

if you haven't already guaranteed that -lintl is in $LIBS.

that's what I use when the first check fails (see above)

Vincent Torri



reply via email to

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