cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: configure-macro fiddling

From: Lars J. Aas <larsa_at_sim.no>
Date: Mon, 8 May 2000 10:29:39 +0200

From [curl_at_contactor.se]:
On Mon, May 08, 2000 at 10:07:12AM +0200, Daniel Stenberg wrote:
: Hi
:
: It turns out that there are systems (NCR MP-RAS (svr4)) that require TWO libs
: for gethostbyname() and connect() should compile/build properly. The current
: configure rule only checks for one lib at a time and thus both checks fails
: on this system and it won't build properly.
:
: Yes, you can enter the libs manually when running configure but I would of
: course prefer a solution that works automatically.
:
: Today, the configure.in line looks like:
:
: AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
:
: ... and it seems as if the AC_CHECK_LIB() macro only can deal with a single
: lib at a time.
:
: Does anyone have a good fix for this?
:
: --
: Daniel Stenberg - http://www.contactor.se/~dast - +46-705-44 31 77
: ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol

I use AC_TRY_LINK directly for these kinds of things. It would go something
like this:

my_ac_save_LIBS=$LIBS
LIBS="-llib1 -llib2"
AC_TRY_LINK( [#include <whatever>],
             [gethostbyname();],
             my_ac_link_result=success,
             my_ac_link_result=failure )
LIBS=$my_ac_save_LIBS

if test "$my_ac_link_result" = "failure"; then
  AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
else
  LIBS="-llib1 -llib2 $LIBS"
fi

This is of course the two-lib test, which should be used as a fallback when
the normal one-library test fail.

  Lars J
Received on 2000-05-08