Doxygen comments
[idzebra-moved-to-github.git] / yaz.m4
1 # Use this m4 function for autoconf if you use YAZ in your own
2 # configure script.
3
4 dnl ----- Setup Docbook documentation for YAZ
5 AC_DEFUN([YAZ_DOC],
6 [
7 AC_SUBST(DTD_DIR)       
8 AC_ARG_WITH(docbook-dtd, [  --with-docbook-dtd[=DIR]  use docbookx.dtd in DIR],
9 [
10         if test -f "$withval/docbookx.dtd"; then
11                 DTD_DIR=$withval
12         fi
13 ],[
14         AC_MSG_CHECKING(for docbookx.dtd)
15         DTD_DIR=""
16         for d in /usr/share/sgml/docbook/dtd/xml/4.1.2 \
17                 /usr/share/sgml/docbook/xml-dtd-4.1.2* \
18                 /usr/share/sgml/docbook/xml-dtd-4.1 \
19                 /usr/share/sgml/docbook/dtd/xml/4.0 \
20                 /usr/lib/sgml/dtd/docbook-xml 
21         do
22                 if test -f $d/docbookx.dtd; then
23                         AC_MSG_RESULT($d)
24                         DTD_DIR=$d
25                         break
26                 fi
27         done
28         if test -z "$DTD_DIR"; then
29                 AC_MSG_RESULT(Not found)
30         fi
31 ])
32 AC_SUBST(DSSSL_DIR)
33 AC_ARG_WITH(docbook-dsssl,[  --with-docbook-dsssl[=DIR] use Docbook DSSSL in DIR/{html,print}/docbook.dsl],
34 [
35         if test -f "$withval/html/docbook.dsl"; then
36                 DSSSL_DIR=$withval
37         fi
38 ],[
39         AC_MSG_CHECKING(for docbook.dsl)
40         DSSSL_DIR=""
41         for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
42                 /usr/share/sgml/docbook/dsssl-stylesheets-1.* \
43                 /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh 
44         do
45                 if test -f $d/html/docbook.dsl; then
46                         AC_MSG_RESULT($d)
47                         DSSSL_DIR=$d
48                         break
49                 fi
50         done
51         if test -z "$DSSSL_DIR"; then
52                 AC_MSG_RESULT(Not found)
53         fi
54 ])
55 AC_SUBST(XSL_DIR)
56 AC_ARG_WITH(docbook-xsl,[  --with-docbook-xsl[=DIR]  use Docbook XSL in DIR/{htmlhelp,xhtml}],
57 [
58         if test -f "$withval/htmlhelp/htmlhelp.xsl"; then
59                 XSL_DIR=$withval
60         fi
61 ],[
62         AC_MSG_CHECKING(for htmlhelp.xsl)
63         for d in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh \
64                 /usr/share/sgml/docbook/xsl-stylesheets-1.* 
65         do
66                 if test -f $d/htmlhelp/htmlhelp.xsl; then
67                         AC_MSG_RESULT($d)
68                         XSL_DIR=$d
69                         break
70                 fi
71         done
72         if test -z "$XSL_DIR"; then
73                 AC_MSG_RESULT(Not found)
74         fi
75 ])
76 ]) 
77
78 AC_DEFUN([YAZ_INIT],
79 [
80         AC_SUBST(YAZLIB)
81         AC_SUBST(YAZLALIB)
82         AC_SUBST(YAZINC)
83         AC_SUBST(YAZVERSION)
84         yazconfig=NONE
85         yazpath=NONE
86         AC_ARG_WITH(yaz, [  --with-yaz=DIR          use yaz-config in DIR (example /home/yaz-1.7)], [yazpath=$withval])
87         if test "x$yazpath" != "xNONE"; then
88                 yazconfig=$yazpath/yaz-config
89         else
90                 if test "x$srcdir" = "x"; then
91                         yazsrcdir=.
92                 else
93                         yazsrcdir=$srcdir
94                 fi
95                 for i in ${yazsrcdir}/../../yaz ${yazsrcdir}/../yaz* ${yazsrcdir}/../yaz; do
96                         if test -d $i; then
97                                 if test -r $i/yaz-config; then
98                                         yazconfig=$i/yaz-config
99                                 fi
100                         fi
101                 done
102                 if test "x$yazconfig" = "xNONE"; then
103                         AC_PATH_PROG(yazconfig, yaz-config, NONE)
104                 fi
105         fi
106         AC_MSG_CHECKING(for YAZ)
107         if $yazconfig --version >/dev/null 2>&1; then
108                 YAZLIB=`$yazconfig --libs $1`
109                 # if this is empty, it's a simple version YAZ 1.6 script
110                 # so we have to source it instead...
111                 if test "X$YAZLIB" = "X"; then
112                         . $yazconfig
113                 else
114                         YAZLALIB=`$yazconfig --lalibs $1`
115                         YAZINC=`$yazconfig --cflags $1`
116                         YAZVERSION=`$yazconfig --version`
117                 fi
118                 AC_MSG_RESULT([$yazconfig])
119         else
120                 AC_MSG_RESULT(Not found)
121                 YAZVERSION=NONE
122         fi
123         if test "X$YAZVERSION" != "XNONE"; then
124                 AC_MSG_CHECKING([for YAZ version])
125                 AC_MSG_RESULT([$YAZVERSION])
126                 if test "$2"; then
127                         have_yaz_version=`echo "$YAZVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
128                         req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
129                         if test "$have_yaz_version" -lt "$req_yaz_version"; then
130                                 AC_MSG_ERROR([$YAZVERSION. Requires $2 or later])
131                         fi
132                         if test "$req_yaz_version" -gt "2000028"; then
133                                 YAZINC="$YAZINC -DYAZ_USE_NEW_LOG=1"
134                         fi
135                 fi
136         fi
137 ]) 
138