Use new yaz.m4
[ir-tcl-moved-to-github.git] / aclocal.m4
1 # generated automatically by aclocal 1.7.9 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14 # Use this m4 funciton for autoconf if you use YAZ in your own
15 # configure script.
16 # YAZ_INIT
17
18 AC_DEFUN([YAZ_INIT],
19 [
20         AC_SUBST(YAZLIB)
21         AC_SUBST(YAZLALIB)
22         AC_SUBST(YAZINC)
23         AC_SUBST(YAZVERSION)
24         yazconfig=NONE
25         yazpath=NONE
26         AC_ARG_WITH(yazconfig, [  --with-yazconfig=DIR    yaz-config in DIR (example /home/yaz-1.7)], [yazpath=$withval])
27         if test "x$yazpath" != "xNONE"; then
28                 yazconfig=$yazpath/yaz-config
29         else
30                 if test "x$srcdir" = "x"; then
31                         yazsrcdir=.
32                 else
33                         yazsrcdir=$srcdir
34                 fi
35                 for i in ${yazsrcdir}/../yaz* ${yazsrcdir}/../yaz ../yaz* ../yaz; do
36                         if test -d $i; then
37                                 if test -r $i/yaz-config; then
38                                         yazconfig=$i/yaz-config
39                                 fi
40                         fi
41                 done
42                 if test "x$yazconfig" = "xNONE"; then
43                         AC_PATH_PROG(yazconfig, yaz-config, NONE)
44                 fi
45         fi
46         AC_MSG_CHECKING(for YAZ)
47         if $yazconfig --version >/dev/null 2>&1; then
48                 YAZLIB=`$yazconfig --libs $1`
49                 # if this is empty, it's a simple version YAZ 1.6 script
50                 # so we have to source it instead...
51                 if test "X$YAZLIB" = "X"; then
52                         . $yazconfig
53                 else
54                         YAZLALIB=`$yazconfig --lalibs $1`
55                         YAZINC=`$yazconfig --cflags $1`
56                         YAZVERSION=`$yazconfig --version`
57                 fi
58                 AC_MSG_RESULT([$yazconfig])
59         else
60                 AC_MSG_RESULT(Not found)
61                 YAZVERSION=NONE
62         fi
63         if test "X$YAZVERSION" != "XNONE"; then
64                 AC_MSG_CHECKING([for YAZ version])
65                 AC_MSG_RESULT([$YAZVERSION])
66                 if test "$2"; then
67                         have_yaz_version=`echo "$YAZVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
68                         req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
69                         if test "$have_yaz_version" -lt "$req_yaz_version"; then
70                                 AC_MSG_ERROR([$YAZVERSION. Requires $2 or later])
71                         fi
72                 fi
73         fi
74 ]) 
75