Modified date.
[idzebra-moved-to-github.git] / yaz.m4
1 ## $Id: yaz.m4,v 1.2 2001-02-21 11:05:58 adam Exp $
2 ## 
3 # Use this m4 funciton for autoconf if you use YAZ in your own
4 # configure script.
5 # YAZ_INIT
6
7 AC_DEFUN([YAZ_INIT],
8 [
9         AC_SUBST(YAZLIB)
10         AC_SUBST(YAZLALIB)
11         AC_SUBST(YAZINC)
12         AC_SUBST(YAZVERSION)
13         yazconfig=NONE
14         yazpath=NONE
15         AC_ARG_WITH(yazconfig, [  --with-yazconfig=DIR    yaz-config in DIR (example /home/yaz-1.7)], [yazpath=$withval])
16         if test "x$yazpath" != "xNONE"; then
17                 yazconfig=$yazpath/yaz-config
18         else
19                 for i in ../yaz* ../yaz; do
20                         if test -d $i; then
21                                 if test -r $i/yaz-config; then
22                                         yazconfig=$i/yaz-config
23                                 fi
24                         fi
25                 done
26                 if test "x$yazconfig" = "xNONE"; then
27                         AC_PATH_PROG(yazconfig, yaz-config, NONE)
28                 fi
29         fi
30         AC_MSG_CHECKING(for YAZ)
31         if $yazconfig --version >/dev/null 2>&1; then
32                 YAZLIB=`$yazconfig --libs $1`
33                 # if this is empty, it's a simple version YAZ 1.6 script
34                 # so we have to source it instead...
35                 if test "X$YAZLIB" = "X"; then
36                         . $yazconfig
37                 else
38                         YAZLALIB=`$yazconfig --lalibs $1`
39                         YAZINC=`$yazconfig --cflags $1`
40                         YAZVERSION=`$yazconfig --version`
41                 fi
42                 AC_MSG_RESULT($yazconfig)
43         else
44                 AC_MSG_RESULT(Not found)
45                 YAZVERSION=NONE
46         fi
47 ])
48