Le jeu 21/01/10 17:58, "Peter Johansson" [email protected] a écrit:
> Hi emannuel,
>
> emmanu
> [email protected] wrote:
> Hi,
> >
> > my software uses an extern library which has its
> version number in it header.h like following:
> #define LIB_VERSION 424242
> >
> > I need to check this version number (because the API
> was changed and this introduced an incompatibility).
>
> > I think about something like
> AC_CHECK_DEFINE_VALUE... bug nothing like that seems to exist.
>
> > Does someone knows how to do that?
> >
> >
> I would use a more low-level macro such as AC_COMPILE_IFELSE, e.g., as
>
follows (not tested)
>
> AC_COMPILE_IFELSE(
> [AC_LANG_PROGRAM([...@%:@include <header.h>],
> [ #if LIB_VERSION >= 424242
> // OK
> #else
> # error version too old
> #endif
> ])
> ],
> [ACTION-IF_OK], ACTION-IF_NOT_OK])
>
> Cheers,
> Peter
Thank you Peter, you helped me a lot.
This is code I have done to check libmicrohttpd version:
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <microhttpd.h>
]],
[[
#if MHD_VERSION >= 0x00040000
// MHD_VERSION is high enough
#else
# MHD_VERSION is to low
#endif
]])],
[], [AC_MSG_ERROR([[The libmicrohttpd
version must be 0.4.0 or higher.]])])
Regards
Emmanuel
_______________________________________________
Autoconf mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/autoconf