This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: autoconf usage : -DHAVE_GSL ?


On Fri, Sep 07, 2001 at 09:01:31PM -0400, Peter Teuben wrote:
> I'd like to have a macro HAVE_GSL, so i can #ifdef my code. I followed some of
> the instructions in section 2.4 on automake, and added the gsl.m4 to my
> aclocal.m4 and did something like the following in configure.in :
> 
> AM_PATH_GSL(0.9.2, ok=yes, ok=no)
> if test "$ok" = "yes"; then
>     AC_MSG_RESULT(ok, i found GSL)
>     NEMO_CFLAGS="$NEMO_CFLAGS $GSL_CFLAGS -DHAVE_GSL"
>     NEMO_LIBS="$NEMO_LIBS $GSL_LIBS"
> else
>     AC_MSG_WARN(could not find GSL library)
> fi

That's gross. Much better might be:

  AM_PATH_GSL(0.9.2,[
    AC_MSG_RESULT([found GSL])
    NEMO_CFLAGS="$NEMO_CFLAGS $GSL_CFLAGS -DHAVE_GSL"
    NEMO_LIBS="$NEMO_LIBS $GSL_LIBS"],[
    AC_MSG_WARN([unable to locate GSL library])])

> My question is about the kludgie looking -DHAVE_GSL. I wanted to use
> something like
> 
> 
> AC_CHECK_LIB(gsl,gsl_version)
> 
> but that fails, gsl_version seems to needs -lgslcblas! (which is actually odd,
> if I look at the output of nm..... -static will fix that dependancy, but
> AC_CHECK_LIB does not do that) I'd like to know which function/static would be
> the one that doesn't need another library. Can that be done with AC_CHECK_LIB?
> If so, perhaps this should be added to section 2.4 on the automake macros. Or
> perhaps is there a better way to get the HAVE_GSL macro?

Then you should do something like:
  AC_CHECK_LIB(gslcblas, VARIABLE, [
    AC_CHECK_LIB(gsl, gsl_version)])

-- 
albert chin (china@thewrittenword.com)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]