Hi David,

On Tue, Nov 29, 2005 at 08:31:20AM -0500, David Roundy wrote:
> On Mon, Nov 28, 2005 at 11:55:46PM -0800, Steve Langasek wrote:
> > Yes, curl-config is messed up in the sense that curl-config is *always*
> > messed up for purposes of dynamic linking on GNU systems.  In the present
> > case, curl-config spits out -lkrb5 and other library options, but is
> > missing a dependency on libkrb5-dev.  This is bug #340784, and should be
> > fixed reasonably soon.

> > On the darcs side, this is fixable by changing the Debian package to not
> > use curl-config -- as described at
> > <http://lists.debian.org/debian-devel-announce/2005/11/msg00016.html>.
> > It's understandable that upstream would not want to accept such a patch,
> > since it's not portable to platforms which use non-GNU linkers; but for
> > Debian's purposes, until curl-config adds a --static option to split
> > these other garbage linker options out, it's far better to replace
> > `curl-config --libs` with -lcurl as this is much less likely to lead to
> > future build failures as a result of curl bugs.

> Is there some sort of autoconf trickery we could use upstream to check if
> the gnu linker is present and fall back on curl-config if it isn't?

Hmm, interesting question.  Following the autoconf principle of "test for
features, not for platforms", I would probably do something like this:

AC_DEFUN([CHECK_SHARED_LIBS],[
  AC_LANG_PUSH([C])
  AC_LANG_CONFTEST([
int liba_dosomething() {
        return 0;
}
  ])
  if $CC -shared -o libconftest-a.so conftest.$ac_ext
  then
    [AC_LANG_CONFTEST([
extern int liba_dosomething();

int libb_dosomething() {
        return liba_dosomething();
}
     ])
    if $CC -shared -o libconftest-b.so conftest.$ac_ext -L. -lconftest-a
    then
      save_LDFLAGS="$LDFLAGS"
      LDFLAGS="$LDFLAGS -L."
      save_LIBS="$LIBS"
      LIBS="-lconftest-b"
      AC_LINK_IFELSE([
        AC_LANG_PROGRAM([extern int libb_dosomething();],
          [return libb_dosomething();])
        ],[ac_gnu_style_elf=yes],[ac_gnu_style_elf=no])
      LIBS="$save_LIBS"
      LDFLAGS="$save_LDFLAGS"
    else
      ac_gnu_style_elf=no
    fi
  else
    ac_gnu_style_elf=no
  fi

  rm conftest* libconftest*
  AC_LANG_POP
])

And then you could add CHECK_SHARED_LIBS to configure.in and check the value
of $ac_gnu_style_elf afterwards; but there are some problems with this
approach, such as losing any -L options provided by curl-config.  If I were
you, I would just put pressure on curl upstream to split the curl-config
output between --libs and --libs --static, so you can make it their problem
to sort out what the correct flags are for a given platform. :)

Cheers,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
[EMAIL PROTECTED]                                   http://www.debian.org/

Attachment: signature.asc
Description: Digital signature

Reply via email to