help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Compatibility with old and new inline functions in GSL


From: Peter Johansson
Subject: Re: [Help-gsl] Compatibility with old and new inline functions in GSL
Date: Fri, 28 May 2010 11:38:15 -0400
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

Joseph Wakeling wrote:
I did wonder about that before.  It's easy to use,

    AC_CHECK_HEADER([gsl/gsl_inline.h],[AC_DEFINE([HAVE_GSL_INLINE],
     [1],[Define if gsl/gsl_inline.h header exists])])
OK
... but a question: what about the actual header file (not source file)
that includes the above,

    #ifdef HAVE_GSL_INLINE
    #include<gsl/gsl_inline.h>
    #else
    #define INLINE_FUN extern inline
    #endif

... since the above only makes sense for code that will be compiled, not
a header that may be included by others -- no?
It make sense as long as HAVE_GSL_INLINE is defined/undefined accurately. If the header file is only used within your package there should be no problem. If you install the header file it is a bit trickier. Then you need to provide a file that defined/undefined HAVE_GSL_INLINE. In that case I would do as follows

In configure.ac:
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([public_config.h])

Create a file `public_config.h.in' with
/* Define if gsl/gsl_inline.h header exists */
#undef HAVE_GSL_INLINE

Include this file early in your header file with

#include <public_config.h>
#ifdef HAVE_GSL_INLINE
#include<gsl/gsl_inline.h>
#else
#define INLINE_FUN extern inline
#endif

The header file public_config.h should obviously be installed while config.h should typically not be installed.

Hope that helps

Cheers,
Peter


--
Peter Johansson

svndigest maintainer, http://dev.thep.lu.se/svndigest
yat maintainer,       http://dev.thep.lu.se/yat




reply via email to

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