Omit result about xml2-config
[m4-moved-to-github.git] / idzebra-2.0.m4
1 ## $Id: idzebra-2.0.m4,v 1.3 2006-08-16 13:32:25 adam Exp $
2 ## 
3 # Use this m4 function for autoconf if you use ID Zebra in your own
4 # configure script.
5
6 AC_DEFUN([IDZEBRA_2_0_INIT],
7 [
8         AC_SUBST(IDZEBRA_LIBS)
9         AC_SUBST(IDZEBRA_LALIBS)
10         AC_SUBST(IDZEBRA_CFLAGS)
11         AC_SUBST(IDZEBRA_VERSION)
12         idzebraconfig=NONE
13         idzebrapath=NONE
14         AC_ARG_WITH(idzebra, [  --with-idzebra=DIR      use idzebra-config in DIR (example /home/idzebra-2.0.0)], [idzebrapath=$withval])
15         if test "x$idzebrapath" != "xNONE"; then
16                 idzebraconfig=$idzebrapath/idzebra-config-2.0
17         else
18                 if test "x$srcdir" = "x"; then
19                         idzebrasrcdir=.
20                 else
21                         idzebrasrcdir=$srcdir
22                 fi
23                 for dir in ${idzebrasrcdir}/../idzebra* ${idzebrasrcdir}/../idzebra ../idzebra* ../zebra; do
24                         if test -d $dir; then
25                                 conf=$dir/idzebra-config-2.0
26                                 if test -r $conf; then
27                                         idzebraconfig=$conf
28                                 fi
29                         fi
30                 done
31                 if test "x$idzebraconfig" = "xNONE"; then
32                         AC_PATH_PROG(idzebraconfig, idzebra-config-2.0, NONE)
33                 fi
34         fi
35         AC_MSG_CHECKING(for idzebra)
36         if $idzebraconfig --version >/dev/null 2>&1; then
37                 IDZEBRA_LIBS=`$idzebraconfig --libs`
38                 IDZEBRA_LALIBS=`$idzebraconfig --lalibs`
39                 IDZEBRA_CFLAGS=`$idzebraconfig --cflags`
40                 IDZEBRA_VERSION=`$idzebraconfig --version`
41                 AC_MSG_RESULT([$idzebraconfig])
42         else
43                 AC_MSG_RESULT(Not found)
44                 IDZEBRA_VERSION=NONE
45         fi
46         if test "X$IDZEBRA_VERSION" != "XNONE"; then
47                 AC_MSG_CHECKING([for idzebra version])
48                 AC_MSG_RESULT([$IDZEBRA_VERSION])
49                 if test "$1"; then
50                         have_idzebra_version=`echo "$IDZEBRA_VERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
51                         req_idzebra_version=`echo "$1" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
52                         if test "$have_idzebra_version" -lt "$req_idzebra_version"; then
53                                 AC_MSG_ERROR([$IDZEBRA_VERSION. Requires idzebra $1 or later])
54                         fi
55                 fi
56         fi
57 ]) 
58