Towards 0.7
[yazpp-moved-to-github.git] / configure.in
1 AC_INIT(configure.in)
2 AM_INIT_AUTOMAKE("yaz++",0.7)
3
4 AC_PROG_CC
5 AC_PROG_CPP
6 AC_PROG_CXX
7 AC_HEADER_STDC
8 AM_DISABLE_SHARED
9 AM_PROG_LIBTOOL
10
11 YAZ_INIT(threads)
12
13 dnl
14 dnl ----- libXML2
15 AC_SUBST(XML2_LIBS)
16 AC_SUBST(XML2_CFLAGS)
17 xml2dir=yes
18 AC_ARG_WITH(xml2, [  --with-xml2[=PREFIX]    use libxml2 in PREFIX],[xml2dir=$withval])
19 if test "$xml2dir" = "yes"; then
20         for d in /usr /usr/local; do
21                 if test -x $d/bin/xml2-config; then
22                         xml2dir=$d
23                 fi
24         done
25 fi
26 if test "$xml2dir" != "no"; then
27         AC_MSG_CHECKING(for libXML2)
28         if test -x $xml2dir/bin/xml2-config; then
29                 XML2_LIBS=`$xml2dir/bin/xml2-config --libs`
30                 LIBS="$XML2_LIBS $LIBS"
31                 XML2_CFLAGS=`$xml2dir/bin/xml2-config --cflags`
32                 XML2_VER=`$xml2dir/bin/xml2-config --version`
33                 AC_MSG_RESULT($XML2_VER)
34                 AC_DEFINE(HAVE_XML2)
35         else
36                 AC_MSG_RESULT(Not found)
37         fi
38 fi
39
40 dnl
41 dnl ----- DOCBOOK DTD
42 AC_SUBST(DTD_DIR)
43 AC_ARG_WITH(dtd, [  --with-dtd[=DIR]        Use docbookx.dtd in DIR],
44 [
45    if test -f "$withval/docbookx.dtd"; then
46       DTD_DIR=$withval
47    fi
48 ],[
49    AC_MSG_CHECKING(for docbookx.dtd)
50    for d in /usr/share/sgml/docbook/dtd/xml/4.1.2 \
51          /usr/share/sgml/docbook/xml-dtd-4.1.2* \
52          /usr/share/sgml/docbook/xml-dtd-4.1 \
53          /usr/share/sgml/docbook/dtd/xml/4.0 \
54             /usr/lib/sgml/dtd/docbook-xml 
55    do
56      if test -f $d/docbookx.dtd; then
57        AC_MSG_RESULT($d)
58        DTD_DIR=$d
59        break
60      fi
61    done
62    if test -z "$DTD_DIR"; then
63       AC_MSG_RESULT(Not found)
64    fi
65 ])
66 AC_SUBST(DSSSL_DIR)
67 AC_ARG_WITH(dsssl,[  --with-dsssl[=DIR]      Use DSSSL in DIR/{html,print}/docbook.dsl],
68 [
69    if test -f "$withval/html/docbook.dsl"; then
70       DSSSL_DIR=$withval
71    fi
72 ],[
73    AC_MSG_CHECKING(for docbook.dsl)
74    for d in /usr/share/sgml/docbook/stylesheet/dsssl/modular \
75             /usr/share/sgml/docbook/dsssl-stylesheets-1.* \
76             /usr/lib/sgml/stylesheet/dsssl/docbook/nwalsh 
77    do
78      if test -f $d/html/docbook.dsl; then
79        AC_MSG_RESULT($d)
80        DSSSL_DIR=$d
81        break
82      fi
83    done
84    if test -z "$DSSSL_DIR"; then
85       AC_MSG_RESULT(Not found)
86    fi
87 ])
88 dnl 
89
90 AC_ARG_ENABLE(zoom,[  --disable-zoom          disable ZOOM (for old C++ compilers)],[enable_zoom=$enableval],[enable_zoom=yes])
91 AM_CONDITIONAL(ZOOM, test $enable_zoom = "yes")
92
93 AC_SUBST(YAZPP_SRC_ROOT)
94 AC_SUBST(YAZPP_BUILD_ROOT)
95 YAZPP_SRC_ROOT=`cd ${srcdir}; pwd`
96 YAZPP_BUILD_ROOT=`pwd`
97
98 AC_OUTPUT([
99         Makefile
100         src/Makefile
101         include/Makefile
102         include/yaz++/Makefile
103         yaz++-config
104         zoom/Makefile
105         lib/Makefile
106         doc/Makefile
107         doc/yaz++.xml
108         doc/yazprint.dsl doc/yazphp.dsl doc/yazhtml.dsl
109         doc/tkl.xsl
110 ],[sed s%yaz_echo_source=yes%yaz_echo_source=no%g < yaz++-config >src/yaz++-config && chmod +x yaz++-config src/yaz++-config])