I want to test the version of some package (e.g PCRE) in a configure.in script, and define C++ variables in a Makefile accordingly. I thought that the autoconf function m4\_version\_compare would do the trick, but I can't get it to work. I am sure I am not using it correctly.
I have the following in configure.in:

```
AC_INIT([MyPackage], 0.4)
# Checks for common programs using default macros
AC_PROG_CC

PCREVERSION=`pcre-config --version`
AC_MSG_RESULT([Detected PCRE version ${PCREVERSION}])
PCRE_POST_8_0=m4_version_compare([PCREVERSION], [8.0])
AC_MSG_RESULT([PCRE version >= 8.0: ${PCRE_POST_8_0}])

AC_SUBST(PCRE_POST_8_0)
AC_OUTPUT(src/Makevars)

```

then autoconf + ./configure produces the following output:

```
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Detected PCRE version 8.12
PCRE version >= 8.0: -1
configure: creating ./config.status
config.status: creating src/Makevars

```

What am I doing wrong? It seems that m4\_version\_compare sees the variable PCREVERSION as being 0. Should I define this variable in another way? How?
Thank you.

Renaud