Upd YAZ_VERSIONL check for YAZ version 4
[phpyaz-moved-to-github.git] / config.m4
1 dnl
2 dnl $Id: config.m4,v 1.19 2007/05/16 07:10:38 dickmeiss Exp $
3 dnl
4
5 PHP_ARG_WITH(yaz,for YAZ support,
6 [  --with-yaz[=DIR]        Include YAZ support (ANSI/NISO Z39.50). 
7                           DIR is the YAZ bin install directory.])
8
9
10 if test "$PHP_YAZ" != "no"; then
11   yazconfig=NONE
12   if test "$PHP_YAZ" = "yes"; then
13     AC_PATH_PROG(yazconfig, yaz-config, NONE)
14   else
15     if test -r ${PHP_YAZ}/yaz-config; then
16       yazconfig=${PHP_YAZ}/yaz-config
17     else
18       yazconfig=${PHP_YAZ}/bin/yaz-config
19     fi
20   fi
21
22   if test -f $yazconfig; then
23     AC_DEFINE(HAVE_YAZ,1,[Whether you have YAZ])
24     . $yazconfig
25
26     AC_MSG_CHECKING([for YAZ version])
27     yaz_version=`echo $YAZVERSION | awk 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
28     if test "$yaz_version" -ge 3000002; then
29       AC_MSG_RESULT([$YAZVERSION])
30     else
31       AC_MSG_ERROR([YAZ version 3.0.2 or later required.])
32     fi
33
34     for c in $YAZLIB; do
35       case $c in
36        -L*)
37          dir=`echo $c|cut -c 3-|sed 's%/\.libs%%g'`
38          PHP_ADD_LIBPATH($dir,YAZ_SHARED_LIBADD)
39         ;;
40        -l*)
41          lib=`echo $c|cut -c 3-`
42          PHP_ADD_LIBRARY($lib,,YAZ_SHARED_LIBADD)
43         ;;
44       esac
45     done
46     PHP_EVAL_INCLINE($YAZINC)
47     PHP_NEW_EXTENSION(yaz, php_yaz.c, $ext_shared)
48     PHP_SUBST(YAZ_SHARED_LIBADD)
49   else
50     AC_MSG_ERROR([YAZ not found (missing $yazconfig)])
51   fi
52 fi