1dnl 2dnl The contents of this file are subject to the Mozilla Public 3dnl License Version 1.1 (the "License"); you may not use this file 4dnl except in compliance with the License. You may obtain a copy of 5dnl the License at http://www.mozilla.org/MPL/ 6dnl 7dnl Software distributed under the License is distributed on an "AS 8dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 9dnl implied. See the License for the specific language governing 10dnl rights and limitations under the License. 11dnl 12dnl The Original Code is the Charlie project. 13dnl 14dnl The Initial Developer of the Original Code is Ginger Alliance Ltd. 15dnl Portions created by Ginger Alliance are 16dnl Copyright (C) 1999-2002 Ginger Alliance Ltd. 17dnl All Rights Reserved. 18dnl 19dnl Contributor(s): 20dnl 21dnl Alternatively, the contents of this file may be used under the 22dnl terms of the GNU General Public License Version 2 or later (the 23dnl "GPL"), in which case the provisions of the GPL are applicable 24dnl instead of those above. If you wish to allow use of your 25dnl version of this file only under the terms of the GPL and not to 26dnl allow others to use your version of this file under the MPL, 27dnl indicate your decision by deleting the provisions above and 28dnl replace them with the notice and other provisions required by 29dnl the GPL. If you do not delete the provisions above, a recipient 30dnl may use your version of this file under either the MPL or the 31dnl GPL. 32dnl 33 34AC_INIT() 35 36PKG_NAME=Sablot 37PKG_VERSION=1.0.3 38 39dnl -------------------------------------------------- 40dnl common initialization stuff 41dnl !!! keep synchronized with other files !!! 42dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 43 44dnl for better portability we need higher version of autoconf 45dnl on most platforms it may work w/ lower version number 46AC_PREREQ( 2.56 ) 47AC_CONFIG_AUX_DIR(autocfg) 48 49AM_INIT_AUTOMAKE($PKG_NAME, $PKG_VERSION, 'z') 50AM_CONFIG_HEADER( autocfg/config.h:autocfg/config.h.in ) 51 52dnl automake stuff 53AC_PROG_LIBTOOL 54 55dnl C/C++ stuff 56dnl AC_LANG_C() 57dnl AC_PROG_CC() 58dnl AC_PROG_CPP() 59AC_LANG_CPLUSPLUS() 60AC_PROG_CXX($EXTRA_CXX) 61AC_PROG_CXXCPP() 62 63dnl switch checking 64dnl default no warnings 65CXXWARNING_FLAGS= 66AC_ARG_ENABLE(warnings, 67[ --enable-warnings display all warning while compiling]) 68if test -z "$enable_warnings"; then 69 enable_warnings=no 70fi 71if test x$enable_warnings != xno; then 72 CXXWARNING_FLAGS='-Wall -W -Winline -Wno-unused-parameter' 73 AC_MSG_CHECKING([Whether $CXX accepts -Wno-unused-parameter]) 74 old_cxxflags="$CXXFLAGS" 75 CXXFLAGS="$old_cxxflags $CXXWARNING_FLAGS" 76 AC_TRY_COMPILE([ ], [return 0;], [AC_MSG_RESULT(yes)], 77 [ AC_MSG_RESULT(no) 78 CXXWARNING_FLAGS="-Wall -W -Winline" 79 ]) 80 CXXFLAGS="$old_cxxflags" 81fi 82AC_SUBST(CXXWARNING_FLAGS) 83 84AC_ARG_ENABLE(abort-on-error, 85[ --enable-abort-on-error abort processor on XSLT error], 86 AC_DEFINE(SABLOT_ABORT_ON_ERROR, 1, 87 [abort on XSLT error])) 88 89AC_ARG_ENABLE(adding-meta, 90[ --disable-adding-meta do not output the META html tag]) 91if test x$enable_adding_meta = xno; then 92 AC_DEFINE(SABLOT_DISABLE_ADDING_META, 1, 93 [define if don't want to generate the META html tag]) 94fi 95 96AC_ARG_ENABLE(document-errors, 97[ --disable-document-errors ignore errors in the document() function]) 98if test x$enable_document_errors = xno; then 99 AC_DEFINE(SABLOT_DISABLE_DOC_ERRORS, 1, 100 [define if don't want to produce errors in the document() function]) 101fi 102 103js_done=0 104js_enabled=0 105js_prefix=none 106AC_ARG_WITH(js, AC_HELP_STRING(--with-js, [enable JavaScript extension]), 107 [if test x$withval = "xyes"; then 108 js_enabled=1 109 elif test x$withval = "xno"; then 110 js_enabled=0 111 else 112 js_enabled=1 113 js_prefix=$withval 114 fi 115 js_done=1 116 ]) 117dnl we try this just for backward compatibility 118if test $js_done = 0; then 119 AC_ARG_ENABLE(javascript, 120 [ --enable-javascript enable JavaScript extensions (e.g. exslt.org)]) 121 if test x$enable_javascript = xyes; then 122 js_enabled=1 123 else 124 js_enabled=0 125 fi 126fi 127 128if test $js_enabled = "1"; then 129 AC_DEFINE(ENABLE_JS, 1, [define, whether to build the JS extension]) 130 AC_ARG_ENABLE(js-threads, 131 [ --enable-js-threads enable JS threading support], 132 [ if x$enableval = "xyes"; then 133 AC_DEFINE(ENABLE_JS_THREADS, 1, [defined if JS threading is enabled]) 134 fi ]) 135fi 136dnl now check the prefix for JS 137if test x$js_prefix = "xnone"; then 138AC_ARG_WITH(js-prefix, 139 AC_HELP_STRING([--with-js-prefix=DIR], 140 [set alternate JavaScript prefix (obsolete)]), 141 [if test ! x$withval = "xyes"; then js_prefix=$withval; fi]) 142fi 143 144if test ! x$js_prefix = "xnone"; then 145 AC_MSG_CHECKING(for JS installation integrity) 146 if test -x $js_prefix; then 147 #on Redhat js header files are in include/js 148 if test -x $js_prefix/include/js ; then 149 CFLAGS="$CFLAGS -I$js_prefix/include/js" 150 CXXFLAGS="$CXXFLAGS -I$js_prefix/include/js" 151 CPPFLAGS="$CPPFLAGS -I$js_prefix/include/js" 152 else 153 if test -x $js_prefix/include ; then 154 CFLAGS="$CFLAGS -I$js_prefix/include" 155 CPPFLAGS="$CPPFLAGS -I$js_prefix/include" 156 CXXFLAGS="$CXXFLAGS -I$js_prefix/include" 157 else 158 AC_MSG_ERROR([prefix for JavaScript not valid (include dir)]) 159 fi 160 fi 161 if test -x $js_prefix/lib ; then 162 LDFLAGS="$LDFLAGS -L$js_prefix/lib" 163 else 164 AC_MSG_ERROR([prefix for JavaScript library invalid (libdir)]) 165 fi 166 else 167 AC_MSG_ERROR([prefix for JavaScript library invalid (not a directory)]) 168 fi 169 AC_MSG_RESULT(ok) 170fi 171 172dnl make it easier to link with expat and iconv 173expat_prefix=none 174AC_ARG_WITH(expat, AC_HELP_STRING(--with-expat, set the expat directory), 175 [if test ! x$withval = "xyes"; then expat_prefix=$withval; fi]) 176 177if test x$expat_prefix = "xnone"; then 178 AC_ARG_WITH(expat-prefix, 179 AC_HELP_STRING(--with-expat-prefix, 180 [set alternate expat prefix (obsolete)]), 181 [if test ! x$withval = "xyes"; then expat_prefix=$withval; fi]) 182fi 183 184if test ! x$expat_prefix = "xnone"; then 185 AC_MSG_CHECKING(for Expat installation integrity) 186 if test -x $expat_prefix ; then 187 if test -x $expat_prefix/include ; then 188 CFLAGS="$CFLAGS -I$expat_prefix/include" 189 CPPFLAGS="$CPPFLAGS -I$expat_prefix/include" 190 CXXFLAGS="$CXXFLAGS -I$expat_prefix/include" 191 else 192 AC_MSG_ERROR([prefix for Expat not valid (include dir)]) 193 fi 194 if test -x $expat_prefix/lib ; then 195 LDFLAGS="$LDFLAGS -L$expat_prefix/lib" 196 else 197 AC_MSG_ERROR([prefix for Expat library invalid (libdir)]) 198 fi 199 else 200 AC_MSG_ERROR([prefix for Expat library invalid (not a directory)]) 201 fi 202 AC_MSG_RESULT(ok) 203fi 204 205iconv_prefix=none 206iconv_done=0 207iconv_enabled=1 208AC_ARG_WITH(iconv, AC_HELP_STRING(--with-iconv, build with an iconv library), 209 [if test x$withval = "xyes"; then 210 iconv_enabled=1 211 elif test x$withval = "xno"; then 212 iconv_enabled=0 213 else 214 iconv_prefix=$withval 215 iconv_enabled=1 216 fi 217 iconv_done=1]) 218 219if test x$iconv_prefix = "xnone"; then 220 AC_ARG_WITH(iconv-prefix, 221 AC_HELP_STRING(--with-iconv-prefix, 222 [DIR set alternate iconv prefix (obsolete)]), 223 [if test ! x$withval = "xyes"; then iconv_prefix=$withval; fi]) 224fi 225 226if ! test x$iconv_prefix = "xnone"; then 227 AC_MSG_CHECKING(for Iconv installation integrity) 228 if test -x $iconv_prefix ; then 229 if test -x $iconv_prefix/include ; then 230 CFLAGS="$CFLAGS -I$iconv_prefix/include" 231 CXXFLAGS="$CXXFLAGS -I$iconv_prefix/include" 232 CPPFLAGS="$CPPFLAGS -I$iconv_prefix/include" 233 else 234 AC_MSG_ERROR([prefix for Iconv not valid (include dir)]) 235 fi 236 if test -x $iconv_prefix/lib ; then 237 LDFLAGS="$LDFLAGS -L$iconv_prefix/lib" 238 else 239 AC_MSG_ERROR([prefix for Iconv library invalid (libdir)]) 240 fi 241 else 242 AC_MSG_ERROR([prefix for Iconv library invalid (not a directory)]) 243 fi 244 AC_MSG_RESULT(ok) 245fi 246 247dnl PH removed this to keep the compatibility with pre 2.5 autoconf 248dnl AC_ARG_VAR(PERL, [ 249dnl path to perl binary to be used in various scripts 250dnl to build documentation]) 251 252dnl environment PERL_PROG is used instead 253 254AC_ARG_WITH(perl, 255[ --with-perl=PATH use perl binary to install apidocs], 256 [if test -x $withval ; then 257 AC_MSG_CHECKING([perl version of $withval]) 258 perlv=`$withval -v | sed -n -e "s%^This is perl, v\(ersion \)\?\(5.*\) built.*$%\2%p"` 259 if test -z "$perlv" ; then 260 AC_MSG_ERROR([You need to provide a path to perl 5]) 261 else 262 AC_MSG_RESULT([$perlv ok]) 263 AC_SUBST(PERL_PROG, [$withval]) 264 fi 265 else 266 AC_MSG_ERROR([Perl $withval is not executable]) 267 fi 268 ], 269 [AC_PATH_PROG([PERL_PROG], [perl], [/usr/bin/perl])] 270) 271AC_MSG_CHECKING([XML::Parser perl module]) 272PERL_SOURCE='eval { require XML::Parser; }; print "yes" unless $@; ' 273BUILD_APIDOCS=`echo $PERL_SOURCE | $PERL_PROG` 274if test "x$BUILD_APIDOCS" = "xyes"; then 275 AC_MSG_RESULT([yes]) 276else 277 AC_MSG_RESULT([no: documentation requires XML::Parser module and will not be built.]) 278fi 279AC_SUBST([BUILD_APIDOCS]) 280 281 282AC_ARG_WITH(html-dir, 283[ --with-html-dir=DIR path to install HTML documentation (defaults to docdir)], 284 [AC_MSG_CHECKING([html dir]) 285 HTML_DIR=$withval 286 if test -x $withval ; then 287 AC_SUBST(HTML_DIR) 288 AC_MSG_RESULT($withval) 289 else 290 AC_SUBST(HTML_DIR) 291 AC_MSG_WARN([Directory $withval does not exist and will be created]) 292 fi 293 ], 294 [if test "x$BUILD_APIDOCS" = "xyes"; then 295 AC_MSG_NOTICE([Setting html dir to $datadir/doc/html]) 296 HTML_DIR=$datadir/doc/html 297 fi 298 AC_SUBST(HTML_DIR) 299 ] 300) 301 302AC_ARG_ENABLE(perlconnect, 303[ --enable-perlconnect enable JS engine perlconnect)]) 304if test x$enable_perlconnect = xyes; then 305 perlconnect_enabled=1 306else 307 perlconnect_enabled=0 308fi 309 310AC_ARG_ENABLE(iconv-typecast, 311[ --enable-iconv-typecast typecast the second parameter of iconv to char**]) 312if test x$enable_iconv_typecast = xyes; then 313 force_iconv_typecast=1 314fi 315 316AC_ARG_ENABLE(check-leaks, 317[ --enable-check-leaks enable memory leak checking (optional)]) 318if test x$enable_check_leaks = xyes; then 319 AC_DEFINE(CHECK_LEAKS, 1, [define whether to check for memory leaks]) 320fi 321 322dnl dom 323AC_ARG_ENABLE(dom, 324[ --disable-dom disable the DOM interface (smaller)], 325__dom_given=1, __dom_given=0) 326 327__has_dom=0 328if test x$__dom_given = x1; then 329 if test x$enable_dom = xyes; then 330 AC_DEFINE(ENABLE_DOM, 1, [define if we want to publish the DOM interface]) 331 __has_dom=1 332 else 333 AC_DEFINE(DISABLE_DOM, 1, 334 [define if we want to supress the DOM interface (needed in sdom.h)]) 335 fi 336else 337 AC_DEFINE(ENABLE_DOM, 1, [define if we want to publish the DOM interface]) 338 __has_dom=1 339fi 340 341dnl consitence check 342if test x$enable_javascript = xyes -a x$__has_dom = x0; then 343 AC_MSG_ERROR(--disable-dom must not be specified with --enable-javascript) 344fi 345 346 347 348dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 349dnl end of initialization stuff 350dnl -------------------------------------------------- 351 352dnl -------------------------------------------------- 353dnl miscellaneous - initial 354dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 355 356dnl here we collect needed libraries 357OTHER_LIBS= 358 359AC_MSG_CHECKING(whether to build under GPL) 360if test ! x$SABLOT_GPL = 'x'; then 361 AC_DEFINE(SABLOT_GPL, 1, [define if we want to build under GPL]) 362 AC_MSG_RESULT(yes) 363else 364 AC_MSG_RESULT(no) 365fi 366 367dnl debugger 368 369AC_MSG_CHECKING(whether to build the debugger) 370AC_ARG_ENABLE(debugger, 371[ --enable-debugger enable xslt debugger]) 372if test x$enable_debugger = xyes; then 373 AC_MSG_RESULT(yes) 374 AC_DEFINE(SABLOT_DEBUGGER, 1, [define if we want to build the debugger]) 375 AC_ARG_WITH(readline, 376 [ --with-readline use the GNU readline in the debugger], 377 userl=1, userl=0) 378 if test x$userl = x1; then 379 if test x$SABLOT_GPL = 'x'; then 380 AC_MSG_ERROR(you must compile under GNU's GPL to use the debugger) 381 fi 382 AC_CHECK_LIB(ncurses, initscr, 383 [__rllib=-lncurses; OTHER_LIBS="$OTHER_LIBS -lncurses"], 384 __rllib=) 385 __rl=1 386 AC_CHECK_LIB(readline, readline, [OTHER_LIBS="$OTHER_LIBS -lreadline"], 387 __rl=0, $__rllib) 388 AC_CHECK_HEADERS(readline/readline.h readline/history.h) 389 fi 390 391dnl EMACS_SITE_LISP='undefined' 392dnl AC_CHECK_PROG(has_emacs, emacs, yes, no) 393dnl if test $has_emacs = yes; then 394dnl EMACS_SITE_LISP=`emacs --batch --load=emacs/config.el --funcall=find-path` 395dnl fi 396dnl AC_SUBST(EMACS_SITE_LISP) 397 398else 399 AC_MSG_RESULT(no) 400fi 401 402 403dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 404dnl end of miscellaneous - initial 405dnl -------------------------------------------------- 406 407dnl -------------------------------------------------- 408dnl Expat stuff - keep in sysc 409dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 410 411dnl check for presence of the new Expat library 412AC_MSG_CHECKING(where to find xml parser) 413dnl steal the output descriptor 414exec 6>/dev/null 415 416AC_CHECK_LIB(expat, XML_Parse, [xmle=1; EXPAT_LIBS=-lexpat], xmle=0) 417 418if test $xmle = 0; then 419 AC_CHECK_LIB(xmlparse, XML_Parse, 420 [xmlp=1; EXPAT_LIBS="EXPAT_LIBS=-lxmlparse -lxmltok"], 421 xmlp=0, -lxmltok) 422fi 423 424dnl return output descriptor 425if test ! x$silent = xyes; then 426 exec 6>&1 427fi 428 429panic=0 430if test $xmle = 1; then 431 resmsg='expat (new)' 432elif $xmlp = 1; then 433 resmsg='expat (old)' 434else 435 resmsg='not found (panic)' 436 panic=1 437fi 438 439AC_MSG_RESULT($resmsg); 440if test $panic = 1; then 441 AC_MSG_ERROR(Couldn't find the expat libraries) 442fi 443 444dnl Expat headers location (according Linux distribution etc.) 445dnl different headers for different library version required 446if test $xmle = 1; then 447 AC_CHECK_HEADERS( expat.h, has_expat_headers=1, has_expat_headers=0 ) 448else 449 AC_CHECK_HEADERS( xmlparse.h xmltok/xmlparse.h, has_expat_headers=1, 450 has_expat_headers=0 ) 451fi 452 453if test $has_expat_headers = 0; then 454 AC_MSG_ERROR(Couldn't find the expat header file(s)) 455fi 456 457dnl check wheter expat.h can be included (1.95.6 is broken - bad bad boys) 458AC_MSG_CHECKING(whether expat.h is broken) 459AC_TRY_COMPILE([ 460#include <expat.h> 461],[ 462return 1; 463],[ 464 AC_MSG_RESULT(no) 465],[ 466 AC_MSG_RESULT(yes) 467 AC_MSG_ERROR([You probably have expat version 1.95.6. Please refer to: 468 http://sourceforge.net/tracker/index.php?func=detail&aid=676844&group_id=10127&atid=110127 469 for a description of the problem.]) 470]) 471 472dnl check XML_SetReturnNSTriplet 473AC_CHECK_LIB(expat, XML_SetReturnNSTriplet, has_extrip=1, has_extrip=0) 474 475if test $has_extrip = 1; then 476 AC_MSG_CHECKING(whether XML_SetReturnNSTriplet works) 477 save_libs=$LIBS 478 LIBS=-lexpat 479 AC_TRY_RUN([ 480#include <expat.h> 481#include <string.h> 482const char* xml = "<?xml version='1.0'?><a:b xmlns:a='http'/>"; 483int cnt = 0; 484void tcStartElement(void *data, const char *elName, const char **atts) 485{ 486 const char *q = elName; 487 do { 488 q = strchr(q, '|'); 489 if (q) { cnt++; q++; } 490 } while (q); 491} 492void tcEndElement(void *data, const char *elName) {} 493int main (int argc, char* argv[]) 494{ 495 XML_Parser theParser = XML_ParserCreateNS(NULL, '|'); 496 XML_SetElementHandler(theParser, tcStartElement, tcEndElement); 497 XML_SetReturnNSTriplet(theParser, 1); 498 XML_Parse(theParser, xml, strlen(xml), 1); 499 XML_ParserFree(theParser); 500 return cnt == 2 ? 0 : 1; 501}], extrip_ok=1, extrip_ok=0, extrip_ok=0) 502 503 LIBS=$save_libs 504 505 if test $extrip_ok = 1; then 506 AC_MSG_RESULT(yes) 507 AC_DEFINE(EXPAT_SUPPORTS_TRIPLETS, 1, 508 [define whether Expat supports (working) XML_SetReturnNSTriplet]) 509 else 510 AC_MSG_RESULT(no) 511 fi 512fi 513 514dnl AC_SUBST(EXPAT_DIR) 515AC_SUBST(EXPAT_LIBS) 516 517dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 518dnl end of expat stuff 519dnl -------------------------------------------------- 520 521dnl -------------------------------------------------- 522dnl headers, functions, libraries, keep in sync. state 523dnl for easier maintenance - keep synchronized!! 524dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 525 526AC_CHECK_HEADER( sys/types.h, sabcfg_types_h=1, sabcfg_types_h=0 ) 527dnl sabcfg_types_h=koko 528AC_SUBST(sabcfg_types_h) 529 530AC_CHECK_HEADERS( timeb.h sys/timeb.h sys/time.h \ 531 unistd.h ieeefp.h sunmath.h limits.h) 532 533dnl check wheter iconv is the part of libc. 534has_iconv=0 535if test "$iconv_enabled" = 1; then 536AC_CHECK_HEADERS( iconv.h, has_iconv=1, has_iconv=0) 537fi 538 539dnl if we have iconv library, we have to decide if it 540dnl is present in libc 541 542ICONV_LIB= 543if test $has_iconv = 1; then 544 AC_MSG_CHECKING(where to find iconv_open) 545 exec 6>/dev/null 546 AC_CHECK_FUNCS(iconv_open, iconv_in_libc=1, iconv_in_libc=0) 547 AC_CHECK_LIB(iconv, iconv_open, iconv_in_iconv=1, iconv_in_iconv=0) 548 AC_CHECK_LIB(iconv, libiconv_open, libiconv_in_iconv=1, libiconv_in_iconv=0) 549 if test ! x$silent = xyes; then 550 exec 6>&1 551 fi 552 #standalone library rules over libc 553 if test $iconv_in_iconv = 1 -o $libiconv_in_iconv = 1; then 554 AC_MSG_RESULT(libiconv) 555 ICONV_LIB=-liconv 556 elif test $iconv_in_libc = 1; then 557 AC_MSG_RESULT(libc) 558 else 559 AC_MSG_RESULT(not found (panic)) 560 AC_MSG_ERROR([iconv.h found, while iconv library not found]) 561 fi 562 #we have iconv at this moment, so we'll check out the need of 563 #typecast in the call of iconv 564 AC_MSG_CHECKING(whether to typecast in iconv) 565 if test x$force_iconv_typecast = x1; then 566 AC_MSG_RESULT(forced) 567 AC_DEFINE(SABLOT_ICONV_CAST_OK, 1, 568 [define whether second param of iconv has to be typecasted]) 569 else 570 AC_TRY_COMPILE([#include <iconv.h>],[ 571 { 572 const char *src = "nothing"; 573 char *outbuf; 574 size_t insize = 0; 575 size_t outsize = 0; 576 iconv_t cd; 577 iconv(cd, &src, &insize, &outbuf, &outsize); 578 }], 579 iconv_cast=0, iconv_cast=1) 580 if test $iconv_cast = 1; then 581 AC_MSG_RESULT(yes) 582 AC_DEFINE(SABLOT_ICONV_CAST_OK, 1, 583 [define whether second param of iconv has to be typecasted]) 584 else 585 AC_MSG_RESULT(no) 586 fi 587 fi 588fi 589AC_SUBST(ICONV_LIB) 590 591dnl check for the need of -lm library spec. 592AC_MSG_CHECKING(whether to force -lm switch) 593AC_TRY_LINK([#include <math.h>], 594 { double foo; foo = ceil(1.234); }, 595 link_libm=0, link_libm=1) 596if test $link_libm = 1; then 597 AC_MSG_RESULT(yes) 598 OTHER_LIBS="$OTHER_LIBS -lm" 599 __need_lm=1 600else 601 AC_MSG_RESULT(no) 602 __need_lm=0 603fi 604 605dnl javascript stuff 606if test $js_enabled = 1; then 607 dnl get default libname 608 if test x$SABLOT_JSLIB = x; then 609 SABLOT_JSLIB=js 610 fi 611 dnl check library and header 612 dnl we have to specify perl libraries for Charlie 613 dnl PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts) 614 if test $perlconnect_enabled = 1; then 615 AC_CHECK_PROG(has_perl, perl, yes, no) 616 if test $has_perl = yes; then 617 PERLLDFLAGS=`perl -MExtUtils::Embed -e ldopts` 618 dnl perl erroneously reports compiler flag -rdynamic (interpreted by ld 619 dnl as -r) when it really meant -export-dynamic. 620 PERLLDFLAGS=`echo $PERLLDFLAGS | perl -pe 's/-rdynamic/-export-dynamic/'` 621 fi 622 else 623 PERLLDFLAGS= 624 fi 625 626 AC_CHECK_LIB($SABLOT_JSLIB, js_NewContext, 627 [has_js=1; OTHER_LIBS="$OTHER_LIBS -l$SABLOT_JSLIB $PERLLDFLAGS"], 628 has_js=0, $PERLLDFLAGS) 629 if test $has_js = 1; then 630 echo '#define XP_UNIX' >> confdefs.h 631 AC_CHECK_HEADERS( jsapi.h, has_js_header=1, has_js_header=0 ) 632 if test $has_js_header = 0; then 633 AC_MSG_ERROR(required file jsapi.h not found) 634 fi 635 else 636 AC_MSG_ERROR(JavaScript library not found) 637 fi 638fi 639 640dnl check for the presence of miscellaneous functions 641AC_CHECK_FUNCS( ftime gettimeofday , break ) 642AC_CHECK_FUNCS( mtrace ) 643 644dnl I/O operations 645AC_CHECK_FUNCS( setvbuf ) 646 647dnl check for isnan etc...in the std. way and try link if not found 648dnl this is due HPUX, where isnan & Co. are defined as macros 649 650AC_CHECK_FUNC( isnan, [has_isnan=1; AC_DEFINE(HAVE_ISNAN, 1, isnan)], has_isnan=0) 651AC_CHECK_FUNC( isinf, [has_isinf=1; AC_DEFINE(HAVE_ISINF, 1, isinf)], has_isinf=0) 652AC_CHECK_FUNC( finite,[has_finite=1;AC_DEFINE(HAVE_FINITE, 1, finite)], has_finite=0) 653dnl Needed for IRIX 654AC_CHECK_FUNC( isnand, [hash_isnand=1; AC_DEFINE(HAVE_ISNAND, 1, isnand)], hash_isnand=0) 655 656dnl it is a bit too complicated, but we can live with this 657__save_LIBS=$LIBS 658if test "$__need_lm" = 1; then 659 LIBS=-lm 660else 661 LIBS= 662fi 663dnl check for macro isnan in math 664if test $has_isnan = 0; then 665 AC_MSG_CHECKING(for macro isnan) 666 AC_TRY_LINK( [#include <math.h>], [{int foo; foo = isnan(0);}], 667 has_isnan=1, has_isnan=0 ) 668 if test $has_isnan = 1; then 669 AC_MSG_RESULT(yes) 670 AC_DEFINE(HAVE_ISNAN, 1, isnan) 671 else 672 AC_MSG_RESULT(no) 673 fi 674fi 675 676dnl check for macro isinf in math 677if test $has_isinf = 0; then 678 AC_MSG_CHECKING(for macro isinf) 679 AC_TRY_LINK( [#include <math.h>], [{int foo; foo = isinf(0);}], 680 has_isinf=1, has_isinf=0 ) 681 if test $has_isinf = 1; then 682 AC_MSG_RESULT(yes) 683 AC_DEFINE(HAVE_ISINF, 1, isinf) 684 else 685 AC_MSG_RESULT(no) 686 fi 687fi 688 689dnl check for macro finite in math 690if test $has_finite = 0; then 691 AC_MSG_CHECKING(for macro finite) 692 AC_TRY_LINK( [#include <math.h>], [{int foo; foo = finite(0);}], 693 has_finite=1, has_finite=0 ) 694 if test $has_finite = 1; then 695 AC_MSG_RESULT(yes) 696 AC_DEFINE(HAVE_FINITE, 1, finite) 697 else 698 AC_MSG_RESULT(no) 699 fi 700fi 701dnl put the LIBS orgiginal value back !!! 702LIBS=$__save_LIBS 703 704dnl wchar.h (not present on FreeBSD) 705AC_CHECK_HEADER( wchar.h, has_wchar=1, has_wchar=0) 706 707if test $has_wchar = 1; then 708 AC_DEFINE(HAVE_WCHAR_H, 1, [define if you have wchar.h header]) 709 AC_CHECK_FUNCS( wcsxfrm wcscmp ) 710fi 711 712dnl string manipulation 713AC_CHECK_FUNC(snprintf, , 714 AC_MSG_ERROR([Function snprintf not found. 715See the system documentation and try to fix it manually.])) 716 717dnl if test $has_wchar = 0; then 718dnl AC_MSG_ERROR(The header <wchar.h> not found. This problem occurs on 719dnl certain platforms (e.g. FreeBSD). Please check your system configuration.) 720dnl fi 721 722AC_SUBST(OTHER_LIBS) 723 724dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 725dnl end of headers etc. 726dnl -------------------------------------------------- 727 728dnl -------------------------------------------------- 729dnl output files 730dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 731 732AC_OUTPUT( src/engine/sabcfg.h 733 Makefile src/Makefile src/engine/Makefile 734 src/command/Makefile src/command/sablot-config 735 doc/Makefile doc/man/Makefile doc/misc/Makefile 736 doc/apidoc/Makefile utils/Makefile 737 utils/apidoc/Makefile ) 738dnl emacs/Makefile ) 739 740dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 741dnl end of output files 742dnl -------------------------------------------------- 743 744dnl -------------------------------------------------- 745dnl notices and messages 746dnl vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv 747 748if test $has_wchar = 0; then 749 AC_MSG_WARN([Your system doesn't support standard widechar library (wchar.h), result of the <xsl:sort> instruction may be undefined]) 750fi 751 752dnl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 753dnl end of file 754dnl -------------------------------------------------- 755 756dnl vim600: ts=2 sw=2 et nocin nosi 757