1 dnl Zebra, Index Data ApS, 1995-2007
2 dnl $Id: configure.ac,v 1.69 2007-12-19 13:38:21 adam Exp $
5 AC_INIT([idzebra],[2.0.20],[zebra-help@indexdata.dk])
6 AC_CONFIG_SRCDIR(configure.ac)
7 AC_CONFIG_AUX_DIR(config)
8 AM_INIT_AUTOMAKE([1.8])
10 AC_SUBST(PACKAGE_SUFFIX)
11 dnl http://www.gnu.org/software/libtool/manual.html#Versioning
12 ZEBRALIBS_VERSION_INFO=0:1:0
13 AC_SUBST(ZEBRALIBS_VERSION_INFO)
14 main_zebralib=index/libidzebra${PACKAGE_SUFFIX}.la
15 AC_SUBST(main_zebralib)
16 dnl ------ Substitutions
19 AC_SUBST(READLINE_LIBS)
20 AC_SUBST(ZEBRA_CFLAGS)
22 dnl ------ Checking programs
26 AC_DEFINE_UNQUOTED(HOST_TRIPLET,"${host}")
29 AC_CHECK_HEADERS([sys/resource.h sys/time.h sys/wait.h sys/utsname.h unistd.h])
31 AC_CHECK_LIB([crypt],[crypt])
32 if test "$ac_cv_lib_crypt_crypt" = "yes"; then
33 AC_CHECK_HEADERS(crypt.h)
37 YAZ_INIT([server icu],[3.0.17])
38 if test "$YAZVERSION" = "NONE"; then
39 AC_MSG_ERROR([YAZ development libraries required])
42 dnl ------ Look for Tcl
43 dnl See if user has specified location of tclConfig.sh; otherwise
44 dnl see if tclConfig.sh exists in same prefix lcoation as tclsh; otherwise
49 AC_ARG_WITH(tclconfig, [ --with-tclconfig=DIR tclConfig.sh in DIR], [tclconfig=$withval])
50 if test "x$tclconfig" = xNONE; then
52 AC_PREFIX_PROGRAM(tclsh)
53 tclconfig=${prefix}/lib
55 if test ! -r ${tclconfig}/tclConfig.sh; then
56 # Not found, try search for Tcl on Debian systems.
57 for d in /usr/lib/tcl*; do
58 if test -f $d/tclConfig.sh; then
64 AC_MSG_CHECKING(for Tcl)
65 if test -r ${tclconfig}/tclConfig.sh; then
66 . ${tclconfig}/tclConfig.sh
67 if test -r ${tclconfig}/../generic/tcl.h; then
68 TCL_INCLUDE=-I${tclconfig}/../generic
69 TCL_LIB="$TCL_BUILD_LIB_SPEC $TCL_LIBS"
70 elif test -d ${TCL_PREFIX}/include/tcl${TCL_VERSION}; then
71 TCL_INCLUDE=-I${TCL_PREFIX}/include/tcl${TCL_VERSION}
72 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
74 TCL_INCLUDE=-I${TCL_PREFIX}/include
75 TCL_LIB="$TCL_LIB_SPEC $TCL_LIBS"
77 TCL_LIB=`echo $TCL_LIB|sed 's%-L/usr/lib%%g'`
78 SHLIB_CFLAGS=$TCL_SHLIB_CFLAGS
79 SHLIB_LD=$TCL_SHLIB_LD
80 SHLIB_SUFFIX=$TCL_SHLIB_SUFFIX
81 SHLIB_VERSION=$TCL_SHLIB_VERSION
82 AC_MSG_RESULT($TCL_VERSION)
84 old_CPPFLAGS=$CPPFLAGS
85 CPPFLAGS="${TCL_INCLUDE} $CPPFLAGS"
86 AC_CHECK_HEADERS(tcl.h)
87 CPPFLAGS=${old_CPPFLAGS}
89 # The Mac OSX -framework causes problems with Libtool
90 # and dependancy libs.. so apply Tcl libs everywhere bug #461
93 LIBS="$LIBS $TCL_LIB";
98 AC_MSG_RESULT(Not found)
99 AC_DEFINE(HAVE_TCL_H,0)
102 dnl ------ various functions
103 AC_CHECK_FUNCS(mkstemp atoll)
105 dnl ------ GNU Readline
106 READLINE_SHARED_LIBADD=""
107 AC_CHECK_LIB(ncurses, tgetent, [READLINE_SHARED_LIBADD="-lncurses"],
108 AC_CHECK_LIB(termcap, tgetent, [READLINE_SHARED_LIBADD="-ltermcap"])
111 AC_CHECK_LIB(readline, readline, [READLINE_LIBS="$READLINE_LIBS -lreadline $READLINE_SHARED_LIBADD"],,$READLINE_SHARED_LIBADD)
112 AC_CHECK_LIB(history, add_history, [READLINE_LIBS="$READLINE_LIBS -lhistory"])
113 if test "$ac_cv_lib_readline_readline" = "yes"; then
114 AC_CHECK_HEADERS(readline/readline.h readline/history.h)
116 LIBS="$LIBS $READLINE_LIBS"
119 #include <readline/readline.h>
121 rl_attempted_completion_over = 0;
122 ],AC_DEFINE(HAVE_READLINE_COMPLETION_OVER))
125 #include <readline/readline.h>
127 rl_completion_matches (0, 0);
128 ],AC_DEFINE(HAVE_READLINE_RL_COMPLETION_MATCHES))
133 AC_ARG_WITH(iconv, [ --with-iconv[=DIR] iconv library in DIR])
134 if test "$with_iconv" != "no"; then
135 AC_MSG_CHECKING(for iconv)
137 oldCPPFLAGS="${CPPFLAGS}"
138 if test "$with_iconv" != "yes" -a "$with_iconv" != ""; then
139 LIBS="$LIBS -L${with_iconv}/lib"
140 CPPFLAGS="${CPPFLAGS} -I${with_iconv}/include"
145 iconv_t t = iconv_open("", "");
147 AC_DEFINE(HAVE_ICONV_H)
154 iconv_t t = iconv_open("", "");
156 AC_DEFINE(HAVE_ICONV_H)
160 CPPFLAGS="$oldCPPFLAGS"
167 AC_CHECK_LIB(bz2,bzCompressInit)
168 if test "$ac_cv_lib_bz2_bzCompressInit" = "yes"; then
169 AC_CHECK_HEADERS(bzlib.h)
171 AC_CHECK_LIB(bz2,BZ2_bzCompressInit)
172 if test "$ac_cv_lib_bz2_BZ2_bzCompressInit" = "yes"; then
173 AC_CHECK_HEADERS(bzlib.h)
180 AC_CHECK_LIB(dl,dlopen)
185 AC_ARG_WITH(expat, [ --with-expat[=DIR] EXPAT library in DIR],[expat=$withval])
186 if test "$expat" != "no"; then
189 if test "$expat" != "yes"; then
190 EXPAT_CFLAGS="-I$expat/include"
191 EXPAT_LIBS="-L$expat/lib"
192 CFLAGS="$EXPAT_CFLAGS $CFLAGS"
193 LIBS="$EXPAT_LIBS $LIBS"
195 AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="$EXPAT_LIBS -lexpat"])
196 if test "$ac_cv_lib_expat_XML_ParserCreate" = "yes"; then
197 AC_CHECK_HEADERS(expat.h)
203 dnl ------- 64 bit files
205 AC_CHECK_TYPES([long long])
206 if test "${ac_cv_type_long_long}" = "yes"; then
211 ZEBRA_CFLAGS="-DZEBRA_ZINT=${ZINT_VALUE}"
212 AC_DEFINE_UNQUOTED(ZEBRA_ZINT,${ZINT_VALUE})
214 AC_SUBST(SHARED_MODULE_LA)
216 AC_SUBST(STATIC_MODULE_OBJ)
218 AC_SUBST(STATIC_MODULE_LADD)
219 STATIC_MODULE_LADD=""
220 AC_DEFUN([ZEBRA_MODULE],[
221 AC_ARG_ENABLE(mod-$1,[$3],[myen=$enableval],[myen=$2])
222 AC_MSG_CHECKING([for module $1])
223 if test "$myen" = "yes"; then
226 if test "$enable_shared" != "yes"; then
227 if test "$myen" = "shared"; then
232 if test "$myen" = "no" -o "$myen" = "disabled"; then
233 AC_MSG_RESULT([disabled])
234 elif test "$2" = "disabled"; then
235 AC_MSG_RESULT([disabled])
236 AC_MSG_ERROR([Cannot enable mod-$1 because of missing libs (XML, etc)])
237 elif test "$myen" = "shared"; then
238 AC_MSG_RESULT([shared])
239 SHARED_MODULE_LA="${SHARED_MODULE_LA} mod-$1.la"
240 elif test "$myen" = "static"; then
241 AC_MSG_RESULT([static])
242 STATIC_MODULE_OBJ="${STATIC_MODULE_OBJ} \$(mod_${m}_la_OBJECTS)"
243 STATIC_MODULE_LADD="${STATIC_MODULE_LADD} \$(mod_${m}_la_LADD)"
244 modcpp=`echo $1|tr abcdefghijklmnopqrstuvwxyz- ABCDEFGHIJKLMNOPQRSTUVWXYZ_`
245 AC_DEFINE_UNQUOTED([IDZEBRA_STATIC_$modcpp])
247 AC_MSG_RESULT([$myen])
248 AC_MSG_ERROR([invalid --enable-mod-$1 value. Use on,off,static or shared])
252 AC_DEFINE(IDZEBRA_STATIC_GRS_SGML)
253 ZEBRA_MODULE(text,shared, [ --enable-mod-text Text filter])
254 ZEBRA_MODULE(grs-regx,shared,[ --enable-mod-grs-regx REGX/TCL filter])
255 ZEBRA_MODULE(grs-marc,shared,[ --enable-mod-grs-marc MARC filter])
256 if test "$ac_cv_header_expat_h" = "yes"; then
261 ZEBRA_MODULE(grs-xml,[$def], [ --enable-mod-grs-xml XML filter (Expat based)])
262 oldCPPFLAGS="$CPPFLAGS"
263 CPPFLAGS="$CPPFLAGS $YAZINC"
267 #include <libxml/xmlversion.h>
268 #include <libxml/parser.h>
269 #include <libxml/tree.h>
270 #include <libxml/xmlIO.h>
271 #include <libxslt/transform.h>
272 #include <libxslt/xsltutils.h>
274 #error Libxml2 not available
277 #if LIBXML_VERSION < 20615
278 #error Libxml2 version < 2.6.15. xmlreader not reliable/present
283 CPPFLAGS=$oldCPPFLAGS
284 ZEBRA_MODULE(dom,[$def], [ --enable-mod-dom XML/XSLT filter (Requires libxslt)])
285 ZEBRA_MODULE(alvis,[$def], [ --enable-mod-alvis ALVIS filter (Requires libxslt)])
286 ZEBRA_MODULE(safari,shared,[ --enable-mod-safari Safari filter (DBC)])
288 dnl ------ ANSI C Header files
290 if test "$ac_cv_header_stdc" = "no"; then
291 AC_MSG_WARN(Your system doesn't seem to support ANSI C)
293 AC_SUBST(IDZEBRA_SRC_ROOT)
294 AC_SUBST(IDZEBRA_BUILD_ROOT)
295 IDZEBRA_SRC_ROOT=`cd ${srcdir}; pwd`
296 IDZEBRA_BUILD_ROOT=`pwd`
297 dnl ------ Create Makefiles
310 include/Makefile include/idzebra/Makefile
316 test/Makefile test/gils/Makefile test/usmarc/Makefile test/api/Makefile
319 test/rusmarc/Makefile test/cddb/Makefile test/malxml/Makefile
321 test/config/Makefile test/sort2/Makefile
323 test/dmoz/Makefile test/sort/Makefile test/zsh/Makefile
324 test/marcxml/Makefile test/charmap/Makefile test/codec/Makefile
326 test/filters/Makefile
327 examples/Makefile examples/gils/Makefile examples/zthes/Makefile
328 examples/marc21/Makefile examples/marcxml/Makefile
329 examples/alvis-oai/Makefile
333 ],[sed s%echo_source=yes%echo_source=no%g < idzebra-config-2.0 > util/idzebra-config-2.0 && chmod +x idzebra-config-2.0 util/idzebra-config-2.0])
336 "------------------------------------------------------------------------
338 ZEBRA Package: ${PACKAGE}
339 ZEBRA Version: ${VERSION}
340 Source code location: ${srcdir}
341 C Preprocessor: ${CPP}
342 C Preprocessor flags: ${CPPFLAGS}
344 C Compiler flags: ${CFLAGS}
345 Linker flags: ${LDFLAGS}
347 Host System Type: ${host}
348 Install path: ${prefix}
349 Automake: ${AUTOMAKE}
352 YAZ Version: ${YAZVERSION}
353 YAZ Include: ${YAZINC}
354 YAZ La Lib: ${YAZLALIB}
356 Bugreport: ${PACKAGE_BUGREPORT}
358 ------------------------------------------------------------------------"
360 dnl mode:shell-script
362 dnl sh-basic-offset: 4