1AC_INIT(libgdome/gdome.c)
2
3VERSION=0.8.1
4PACKAGE=gdome2
5GDOME_VERSION_INFO=`echo $VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`
6AC_SUBST(GDOME_VERSION_INFO)
7
8AM_CONFIG_HEADER(config.h)
9AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
10AM_MAINTAINER_MODE
11
12
13dnl
14dnl The following new parameters were added to offer
15dnl the ability to specify the location of the libxml
16dnl library during linking and compilation.
17dnl Mathieu Lacage 30/03/2000
18dnl
19LIBXML_PREFIX=""
20AC_ARG_WITH(libxml-prefix,
21        [  --with-libxml-prefix=[PFX]		Specify location of libxml],
22	LIBXML_PREFIX=$withval
23)
24
25AC_ARG_WITH(libxml-include-prefix,
26        [  --with-libxml-include-prefix=[PFX]	Specify location of libxml headers],
27        LIBXML_CFLAGS="-I$withval"
28)
29
30AC_ARG_WITH(libxml-libs-prefix,
31        [  --with-libxml-libs-prefix=[PFX]	Specify location of libxml libs],
32        LIBXML_LIBS="-L$withval -lxml2 -lz"
33)
34
35AC_ARG_WITH(html-dir, [  --with-html-dir=DIR	Specify the path to install html docs])
36AC_ARG_WITH(ref_debug, [  --with-ref-debug      Add the reference counting debugging module [default=no]])
37
38dnl
39dnl Check the environment
40dnl
41
42AC_ISC_POSIX
43AC_PROG_CC
44AC_PROG_INSTALL
45AC_STDC_HEADERS
46AC_ARG_PROGRAM
47AM_PROG_LIBTOOL
48dnl AC_PROG_CXX
49dnl AM_PROG_LEX
50dnl AC_PROG_YACC
51
52AC_SUBST(CFLAGS)
53AC_SUBST(CPPFLAGS)
54AC_SUBST(LDFLAGS)
55
56dnl
57dnl find glib
58dnl
59
60GLIB_1="no"
61AC_ARG_ENABLE(glib-1,
62        [  --enable-glib-1=[no]	            Specify if you want to use glib 1],
63	GLIB_1=yes
64)
65
66if test "x$GLIB_1" = "xyes"
67then
68	PKG_CHECK_MODULES(GLIB, glib)
69	GLIB_REQUIRED="glib"
70	GLIB_MIN_VERSION=1.2.10
71        AM_PATH_GLIB($GLIB_MIN_VERSION,,AC_MSG_ERROR(Could not find GLIB (see config.log for details).))
72else
73	PKG_CHECK_MODULES(GLIB, glib-2.0)
74	GLIB_REQUIRED="glib-2.0"
75	GLIB_MIN_VERSION=2.2.0
76        AM_PATH_GLIB_2_0($GLIB_MIN_VERSION,,AC_MSG_ERROR(Could not find GLIB (see config.log for details).))
77fi
78AC_SUBST(GLIB_MIN_VERSION)
79AC_SUBST(GLIB_LIBS)
80AC_SUBST(GLIB_REQUIRED)
81
82dnl
83dnl find libxml
84dnl
85XML_CONFIG="xml2-config"
86XML_MIN_VERSION=2.4.26
87AC_MSG_CHECKING(for GnomeXML libraries >= $XML_MIN_VERSION)
88if test "x$LIBXML_PREFIX" != "x"
89then
90	if ${LIBXML_PREFIX}/bin/$XML_CONFIG --version > /dev/null 2>&1
91	then
92		XML_CONFIG=${LIBXML_PREFIX}/bin/$XML_CONFIG
93        elif ! $XML_CONFIG --version > /dev/null 2>&1
94        then
95		AC_MSG_ERROR(Could not find libxml2 anywhere (see config.log for details).)
96	fi
97fi
98
99dnl
100dnl test version and init our variables
101dnl
102vers=`$XML_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
103minvers=`echo $XML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'`
104if test "$vers" -ge "$minvers"
105then
106        LIBXML_LIBS="`$XML_CONFIG --libs`"
107        LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
108        AC_MSG_RESULT(found)
109else
110        AC_MSG_ERROR(You need at least libxml2 $XML_MIN_VERSION for this version of $PACKAGE)
111fi
112
113if test "x$with_html_dir" = "x" ; then
114  HTML_DIR='$(prefix)/share/gtk-doc/html'
115else
116  HTML_DIR=$with_html_dir
117fi
118
119if test "$with_ref_debug" = "yes" ; then
120    echo Enabling reference counting debug support
121    WITH_REF_DEBUG=1
122    AC_DEFINE(DEBUG_REFCNT)
123else
124    WITH_REF_DEBUG=0
125fi
126AC_SUBST(XML_CONFIG)
127AC_SUBST(LIBXML_LIBS)
128AC_SUBST(LIBXML_CFLAGS)
129AC_SUBST(XML_MIN_VERSION)
130
131GDOME_LIBDIR='-L${libdir}'
132GDOME_INCLUDEDIR="-I${includedir} -I${includedir}/libgdome $GLIB_CFLAGS $LIBXML_CFLAGS"
133GDOME_LIBS="-lgdome $GLIB_LIBS $LIBXML_LIBS"
134
135AC_SUBST(GDOME_LIBDIR)
136AC_SUBST(GDOME_INCLUDEDIR)
137AC_SUBST(GDOME_LIBS)
138
139AC_SUBST(HTML_DIR)
140
141AC_OUTPUT([
142Makefile
143libgdome/Makefile
144libgdome/gdomecore/Makefile
145libgdome/events/Makefile
146libgdome/xpath/Makefile
147test/Makefile
148test/apigen/Makefile
149gtk-doc/Makefile
150gdome-config
151gdome2.spec
152gdome-config.1
153gdome2.pc
154])
155