1 ## $Id: yaz.m4,v 1.6 2004-02-05 14:15:42 adam Exp $
3 # Use this m4 funciton for autoconf if you use YAZ in your own
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
19 if test "x$srcdir" = "x"; then
24 for i in ${yazsrcdir}/../yaz* ${yazsrcdir}/../yaz ../yaz* ../yaz; do
26 if test -r $i/yaz-config; then
27 yazconfig=$i/yaz-config
31 if test "x$yazconfig" = "xNONE"; then
32 AC_PATH_PROG(yazconfig, yaz-config, NONE)
35 AC_MSG_CHECKING(for YAZ)
36 if $yazconfig --version >/dev/null 2>&1; then
37 YAZLIB=`$yazconfig --libs $1`
38 # if this is empty, it's a simple version YAZ 1.6 script
39 # so we have to source it instead...
40 if test "X$YAZLIB" = "X"; then
43 YAZLALIB=`$yazconfig --lalibs $1`
44 YAZINC=`$yazconfig --cflags $1`
45 YAZVERSION=`$yazconfig --version`
47 AC_MSG_RESULT([$yazconfig])
49 AC_MSG_RESULT(Not found)
52 if test "X$YAZVERSION" != "XNONE"; then
53 AC_MSG_CHECKING([for YAZ version])
54 AC_MSG_RESULT([$YAZVERSION])
56 have_yaz_version=`echo "$YAZVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
57 req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
58 if test "$have_yaz_version" -lt "$req_yaz_version"; then
59 AC_MSG_ERROR([$YAZVERSION. Requires $2 or later])