Fix boost not found on debian-testing MP-628
[m4-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 dnl autoconf < 2.60 does not define docdir
8 if test -n "$docdir"; then
9         docdir="${datadir}/doc/${PACKAGE}"
10         AC_SUBST([docdir])
11 fi
12 AC_SUBST(XSLTPROC_COMPILE)
13 XSLTPROC_COMPILE='xsltproc --xinclude -path ".:$(srcdir)"'
14 AC_SUBST(MAN_COMPILE)
15 MAN_COMPILE='$(XSLTPROC_COMPILE) $(srcdir)/common/id.man.xsl'
16 AC_SUBST(HTML_COMPILE)
17 HTML_COMPILE='$(XSLTPROC_COMPILE) $(srcdir)/common/id.htmlhelp.xsl'
18 AC_SUBST(TKL_COMPILE)
19 TKL_COMPILE='$(XSLTPROC_COMPILE) $(srcdir)/common/id.tkl.xsl'
20 AC_SUBST(PDF_COMPILE)
21 PDF_COMPILE='dblatex -P latex.class.options=a4paper,12pt,twoside,openright'
22
23 AC_SUBST(DTD_DIR)       
24 AC_ARG_WITH(docbook-dtd,[[  --with-docbook-dtd=DIR  use docbookx.dtd in DIR]],
25 [
26         if test -f "$withval/docbookx.dtd"; then
27                 DTD_DIR=$withval
28         fi
29 ],[
30         AC_MSG_CHECKING(for docbookx.dtd)
31         DTD_DIR=""
32         for d in /usr/lib/sgml/dtd/docbook-xml \
33                  /usr/share/sgml/docbook/dtd/4.2 \
34                  /usr/share/sgml/docbook/dtd/xml/4.* \
35                  /usr/share/sgml/docbook/xml-dtd-4.* \
36                 /usr/local/share/xml/docbook/4.*
37         do
38                 if test -f $d/docbookx.dtd; then
39                         DTD_DIR=$d
40                 fi
41         done
42         if test -z "$DTD_DIR"; then
43                 AC_MSG_RESULT(Not found)
44         else
45                 AC_MSG_RESULT($d)
46         fi
47 ])
48 AC_SUBST(DSSSL_DIR)
49 AC_ARG_WITH(docbook-dsssl,[[  --with-docbook-dsssl=DIR use Docbook DSSSL in DIR/{html,print}/docbook.dsl]],
50 [
51         if test -f "$withval/html/docbook.dsl"; then
52                 DSSSL_DIR=$withval
53         fi
54 ],[
55         AC_MSG_CHECKING(for docbook.dsl)
56         DSSSL_DIR=""
57         for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
58                 /usr/share/sgml/docbook/dsssl-stylesheets-1.* \
59                 /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh \
60                 /usr/local/share/sgml/docbook/dsssl/modular
61         do
62                 if test -f $d/html/docbook.dsl; then
63                         AC_MSG_RESULT($d)
64                         DSSSL_DIR=$d
65                         break
66                 fi
67         done
68         if test -z "$DSSSL_DIR"; then
69                 AC_MSG_RESULT(Not found)
70         fi
71 ])
72 AC_SUBST(XSL_DIR)
73 AC_ARG_WITH(docbook-xsl,[[  --with-docbook-xsl=DIR  use Docbook XSL in DIR/{htmlhelp,xhtml}]],
74 [
75         if test -f "$withval/htmlhelp/htmlhelp.xsl"; then
76                 XSL_DIR=$withval
77         fi
78 ],[
79         AC_MSG_CHECKING(for htmlhelp.xsl)
80         for d in /usr/share/sgml/docbook/stylesheet/xsl/nwalsh \
81                 /usr/local/share/xsl/docbook \
82                 /usr/share/sgml/docbook/xsl-stylesheets-1.* 
83         do
84                 if test -f $d/htmlhelp/htmlhelp.xsl; then
85                         AC_MSG_RESULT($d)
86                         XSL_DIR=$d
87                         break
88                 fi
89         done
90         if test -z "$XSL_DIR"; then
91                 AC_MSG_RESULT(Not found)
92         fi
93 ])
94 ]) 
95
96 AC_DEFUN([YAZ_INIT],
97 [
98         AC_SUBST(YAZLIB)
99         AC_SUBST(YAZLALIB)
100         AC_SUBST(YAZINC)
101         AC_SUBST(YAZVERSION)
102         yazconfig=NONE
103         yazpath=NONE
104         AC_ARG_WITH(yaz, [  --with-yaz=DIR          use yaz-config in DIR (example /home/yaz-1.7)], [yazpath=$withval])
105         if test "x$yazpath" != "xNONE"; then
106                 yazconfig=$yazpath/yaz-config
107         else
108                 if test "x$srcdir" = "x"; then
109                         yazsrcdir=.
110                 else
111                         yazsrcdir=$srcdir
112                 fi
113                 for i in ${yazsrcdir}/../../yaz ${yazsrcdir}/../yaz-* ${yazsrcdir}/../yaz; do
114                         if test -d $i; then
115                                 if test -r $i/yaz-config; then
116                                         yazconfig=$i/yaz-config
117                                 fi
118                         fi
119                 done
120                 if test "x$yazconfig" = "xNONE"; then
121                         AC_PATH_PROG(yazconfig, yaz-config, NONE)
122                 fi
123         fi
124         AC_MSG_CHECKING(for YAZ)
125         if $yazconfig --version >/dev/null 2>&1; then
126                 YAZLIB=`$yazconfig --libs $1`
127                 # if this is empty, it's a simple version YAZ 1.6 script
128                 # so we have to source it instead...
129                 if test "X$YAZLIB" = "X"; then
130                         . $yazconfig
131                 else
132                         YAZLALIB=`$yazconfig --lalibs $1`
133                         YAZINC=`$yazconfig --cflags $1`
134                         YAZVERSION=`$yazconfig --version`
135                 fi
136                 AC_MSG_RESULT([$yazconfig])
137         else
138                 AC_MSG_RESULT(Not found)
139                 YAZVERSION=NONE
140         fi
141         if test "X$YAZVERSION" != "XNONE"; then
142                 AC_MSG_CHECKING([for YAZ version])
143                 AC_MSG_RESULT([$YAZVERSION])
144                 if test "$2"; then
145                         have_yaz_version=`echo "$YAZVERSION" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
146                         req_yaz_version=`echo "$2" | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`
147                         if test "$have_yaz_version" -lt "$req_yaz_version"; then
148                                 AC_MSG_ERROR([$YAZVERSION. Requires YAZ $2 or later])
149                         fi
150                 fi
151         fi
152 ]) 
153