1#!/bin/sh 2dnl This file is an input file used by the GNU "autoconf" program to 3dnl generate the file "configure", which is run when building Rivet 4dnl to configure the system for the local environment. 5dnl 6dnl You need at least autoconf 2.59 7dnl 8# 9#----------------------------------------------------------------------- 10# Sample configure.in for Tcl Extensions. The only places you should 11# need to modify this file are marked by the string __CHANGE__ 12#----------------------------------------------------------------------- 13 14#----------------------------------------------------------------------- 15# __CHANGE__ 16# Set your package name and version numbers here. 17# 18# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION 19# set as provided. These will also be added as -D defs in your Makefile 20# so you can encode the package version directly into the source files. 21#----------------------------------------------------------------------- 22 23AC_INIT([Rivet],[m4_esyscmd_s([cat VERSION])],[rivet-dev@tcl.apache.org]) 24TEA_INIT([3.9]) 25 26# we are storing here the configure command line, as recursive 27# invocations change the value of the shell variables $0 $* 28 29CONFIGURE_CMD="$0 $*" 30 31AC_CONFIG_AUX_DIR(tclconfig) 32AM_INIT_AUTOMAKE 33AC_CONFIG_HEADERS([config.h]) 34AC_CONFIG_MACRO_DIR([m4]) 35 36# AX_PREFIX_CONFIG_H is a macro taken from the autotools macro archive. 37# The typical configure generated 'config.h' can be renamed and 38# preprocessor symbols in it can be prefixed in order to avoid clashes 39# with Apache's config.h 40# 41# As of today (27 Sept 2008) this macro is not part of autotools and 42# it's in the 'm4' directory 43# 44 45AX_PREFIX_CONFIG_H([rivet_config.h],[rivet]) 46 47#-------------------------------------------------------------------- 48# Call TEA_INIT as the first TEA_ macro to set up initial vars. 49# This will define a ${TEA_PLATFORM} variable == "unix" or "windows" 50# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. 51#-------------------------------------------------------------------- 52 53# 54# Init automake stuff 55# 56AC_DISABLE_STATIC 57AM_INIT_AUTOMAKE([foreign subdir-objects]) 58 59#-------------------------------------------------------------------- 60# Load the tclConfig.sh file 61#-------------------------------------------------------------------- 62 63TEA_PATH_TCLCONFIG 64TEA_LOAD_TCLCONFIG 65 66#-------------------------------------------------------------------- 67# Load the tkConfig.sh file if necessary (Tk extension) 68#-------------------------------------------------------------------- 69 70#TEA_PATH_TKCONFIG 71#TEA_LOAD_TKCONFIG 72 73#----------------------------------------------------------------------- 74# Handle the --prefix=... option by defaulting to what Tcl gave. 75# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. 76#----------------------------------------------------------------------- 77 78TEA_PREFIX 79 80#----------------------------------------------------------------------- 81# Standard compiler checks. 82# This sets up CC by using the CC env var, or looks for gcc otherwise. 83# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create 84# the basic setup necessary to compile executables. 85#----------------------------------------------------------------------- 86 87TEA_SETUP_COMPILER 88 89# 90# For automake to be happy, we also need AC_PROG_LIBTOOL 91# 92# the LIBTOOL_DEPS macro sets up for automatic updating of the 93# libtool script if it becomes out of date, as per libtool docs 94# 95AC_PROG_LIBTOOL 96AC_SUBST(LIBTOOL_DEPS) 97 98#----------------------------------------------------------------------- 99# __CHANGE__ 100# Specify the C source files to compile in TEA_ADD_SOURCES, 101# public headers that need to be installed in TEA_ADD_HEADERS, 102# stub library C source files to compile in TEA_ADD_STUB_SOURCES, 103# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. 104# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS 105# and PKG_TCL_SOURCES. 106#----------------------------------------------------------------------- 107 108# Unused: src/TclWeb.c 109 110#TEA_ADD_SOURCES([src/TclWebcgi.c src/TclWebapache.c src/apache_multipart_buffer.c src/apache_request.c src/mod_rivet.c src/parserPkgInit.c src/rivetChannel.c src/rivetCore.c src/rivetCrypt.c src/rivetList.c src/rivetParser.c src/rivetPkgInit.c src/rivetWWW.c win/nmakehlp.c src/testing.c]) 111#TEA_ADD_HEADERS([src/TclWeb.h src/apache_multipart_buffer.h src/apache_request.h src/mod_rivet.h src/rivet.h src/rivetChannel.h src/rivetParser.h]) 112TEA_ADD_INCLUDES([]) 113TEA_ADD_LIBS([]) 114TEA_ADD_CFLAGS([]) 115TEA_ADD_STUB_SOURCES([]) 116TEA_ADD_TCL_SOURCES([]) 117 118#-------------------------------------------------------------------- 119# __CHANGE__ 120# A few miscellaneous platform-specific items: 121# 122# Define a special symbol for Windows (BUILD_sample in this case) so 123# that we create the export library with the dll. 124# 125# Windows creates a few extra files that need to be cleaned up. 126# You can add more files to clean if your extension creates any extra 127# files. 128# 129# TEA_ADD_* any platform specific compiler/build info here. 130#-------------------------------------------------------------------- 131 132# removed AC_DEFINE(BUILD_rivet....) as per TEA 3.9 (Massimo Manghi 20100825) 133 134if test "${TEA_PLATFORM}" = "windows" ; then 135# AC_DEFINE(BUILD_rivet,1,[Define to define the BUILD_rivet define (?)]) 136 CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" 137# #TEA_ADD_SOURCES([win/winFile.c]) 138# #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) 139else 140 CLEANFILES="pkgIndex.tcl" 141# #TEA_ADD_SOURCES([unix/unixFile.c]) 142# #TEA_ADD_LIBS([-lsuperfly]) 143fi 144AC_SUBST(CLEANFILES) 145 146#-------------------------------------------------------------------- 147# __CHANGE__ 148# Choose which headers you need. Extension authors should try very 149# hard to only rely on the Tcl public header files. Internal headers 150# contain private data structures and are subject to change without 151# notice. 152# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG 153#-------------------------------------------------------------------- 154 155TEA_PUBLIC_TCL_HEADERS 156#TEA_PRIVATE_TCL_HEADERS 157 158#TEA_PUBLIC_TK_HEADERS 159#TEA_PRIVATE_TK_HEADERS 160#TEA_PATH_X 161 162#-------------------------------------------------------------------- 163# Check whether --enable-threads or --disable-threads was given. 164# This auto-enables if Tcl was compiled threaded. 165#-------------------------------------------------------------------- 166 167TEA_ENABLE_THREADS 168 169#-------------------------------------------------------------------- 170# The statement below defines a collection of symbols related to 171# building as a shared library instead of a static library. 172#-------------------------------------------------------------------- 173 174TEA_ENABLE_SHARED 175 176#-------------------------------------------------------------------- 177# This macro figures out what flags to use with the compiler/linker 178# when building shared/static debug/optimized objects. This information 179# can be taken from the tclConfig.sh file, but this figures it all out. 180#-------------------------------------------------------------------- 181 182TEA_CONFIG_CFLAGS 183 184#-------------------------------------------------------------------- 185# Set the default compiler switches based on the --enable-symbols option. 186#-------------------------------------------------------------------- 187 188TEA_ENABLE_SYMBOLS 189 190#-------------------------------------------------------------------- 191# Everyone should be linking against the Tcl stub library. If you 192# can't for some reason, remove this definition. If you aren't using 193# stubs, you also need to modify the SHLIB_LD_LIBS setting below to 194# link against the non-stubbed Tcl library. Add Tk too if necessary. 195#-------------------------------------------------------------------- 196 197# 198# stubs are causing segmentation violations when mod_rivet is getting 199# loaded into apache. it would be nice if we did no stubs for this and 200# still did stubs for librivet and librivetparser, which seem to be OK. 201# 202#AC_DEFINE(USE_TCL_STUBS,1,[Define to link against the Tcl stub library]) 203#AC_DEFINE(USE_TK_STUBS) 204 205#-------------------------------------------------------------------- 206# This macro generates a line to use when building a library. It 207# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, 208# and TEA_LOAD_TCLCONFIG macros above. 209#-------------------------------------------------------------------- 210 211TEA_MAKE_LIB 212 213#-------------------------------------------------------------------- 214# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl 215# file during the install process. Don't run the TCLSH_PROG through 216# ${CYGPATH} because it's being used directly by make. 217# Require that we use a tclsh shell version 8.2 or later since earlier 218# versions have bugs in the pkg_mkIndex routine. 219# Add WISH as well if this is a Tk extension. 220#-------------------------------------------------------------------- 221 222# We have to either find a working tclsh or be told where it is 223# using --with-tclsh 224AC_ARG_WITH(tclsh, [ --with-tclsh=FILE location of a working tclsh executable], with_tclsh=${withval}) 225 226# 227# allow them to override the tclsh we think we found 228# 229if test x"${with_tclsh}" != x ; then 230 AC_MSG_CHECKING([for tclsh]) 231 if test -f "${with_tclsh}" ; then 232 TCLSH_PROG=${with_tclsh} 233 AC_MSG_RESULT([manually set by --with-tclsh=$TCLSH_PROG]) 234 else 235 AC_MSG_ERROR([No tclsh at place specified by --with-tclsh (${with_tclsh})]) 236 fi 237 AC_SUBST(TCLSH_PROG) 238else 239 TEA_PROG_TCLSH 240fi 241 242#TEA_PROG_WISH 243 244# apache base directory 245 246AC_DEFUN([APACHE],[ 247 AC_MSG_CHECKING(for Apache base) 248 AC_ARG_WITH( 249 apache, 250 [ --with-apache[=DIR] Apache server base directory],, 251 [with_apache="/usr/local/apache2"] 252 ) 253 apache_base="${with_apache}" 254 AC_MSG_RESULT([$apache_base]) 255]) 256 257# 258# We have to either find apxs or be told where it is using --with-apxs 259# 260AC_DEFUN([CHECK_APXS],[ 261 AC_MSG_CHECKING(for Apache apxs) 262 AC_ARG_WITH( 263 apxs, 264 [ --with-apxs=FILE location of Apache apxs tool], 265 [if test -x "${with_apxs}" ; then 266 apxs_found="${with_apxs}" 267 AC_MSG_RESULT([$apxs_found]) 268 fi] 269 , 270 [ 271 APXS_NAMES=apxs 272 for apxs_file in ${APXS_NAMES}; do 273 for apxs_path in bin sbin; do 274 if test -x "${apache_base}"/"${apxs_path}"/"${apxs_file}"; then 275 apxs_found="${apache_base}"/"${apxs_path}"/"${apxs_file}" 276 break 2 277 fi 278 done 279 done 280 if test x"$apxs_found" = x; then 281 AC_PATH_PROGS(with_apxs, apxs) 282 if test "${with_apxs+set}" = set ; then 283 apxs_found="${with_apxs}" 284 fi 285 fi 286 if test x"${apxs_found}" = x; then 287 AC_MSG_ERROR([Could not find apxs. apxs must be in your PATH or you must specify the location of the apxs script using --with-apxs]) 288 else 289 AC_MSG_RESULT([$apxs_found]) 290 fi 291 ] 292 ) 293 if test "${apxs_found+set}" = set ; then 294 dnl At this point we already have apr sorted out 295 export PATH=$PATH:`dirname $apxs_found` 296 APXS_CPPFLAGS=`${apxs_found} -q CFLAGS` 297 AC_SUBST(APXS_CPPFLAGS) 298 APXS_LDFLAGS=`${apxs_found} -q LDFLAGS_SHLIB` 299 AC_SUBST(APXS_LDFLAGS) 300 APXS_LIBS=`${apxs_found} -q LIBS_SHLIB` 301 AC_SUBST(APXS_LIBS) 302 APXS_INCLUDES=-I`${apxs_found} -q INCLUDEDIR` 303 AC_SUBST(APXS_INCLUDES) 304 APXS_CPPFLAGS_SHLIB=`${apxs_found} -q CFLAGS_SHLIB` 305 AC_SUBST(APXS_CPPFLAGS_SHLIB) 306 APXS_LD_SHLIB=`${apxs_found} -q LD_SHLIB` 307 AC_SUBST(APXS_LD_SHLIB) 308 APXS_LIBEXECDIR=`${apxs_found} -q LIBEXECDIR` 309 AC_SUBST(APXS_LIBEXECDIR) 310 APXS_SYSCONFDIR=`${apxs_found} -q SYSCONFDIR` 311 AC_SUBST(APXS_SYSCONFDIR) 312 APXS_PREFIX=`${apxs_found} -q PREFIX` 313 AC_SUBST(APXS_PREFIX) 314 else 315 AC_MSG_ERROR([Could not find apxs. apxs must be in your PATH or you must specify the location of the apxs script using --with-apxs]) 316 fi 317]) 318 319 320AC_DEFUN([APACHE_INCLUDES],[ 321 AC_ARG_WITH( 322 apache_include, 323 [ --with-apache-include[=DIR] Apache server directory], 324 [apache_include="${with_apache_include}"] 325 ,[apache_include="${APXS_INCLUDES}"] 326 ) 327 AC_SUBST(apache_include) 328]) 329 330AC_DEFUN([APR_HANDLING],[ 331 AC_MSG_CHECKING(for Apache apr) 332 AC_ARG_WITH( 333 apr_config, 334 [ --with-apr-config=FILE apr portable apr-1-config path], 335 [if test -x "${with_apr_config}"; then 336 apr_found="${with_apr_config}" 337 fi] 338 , 339 [if test -x "${apache_base}/bin/apr-1-config" ; then 340 apr_found="${apache_base}/bin/apr-1-config" 341 elif test -x "${apache_base}/sbin/apr-1-config" ; then 342 apr_found="${apache_base}/sbin/apr-1-config" 343 elif test "${apache_base+set}" = set; then 344 AC_PATH_PROGS(with_apr_config, apr-1-config) 345 if test "${with_apr_config+set}" = set ; then 346 apr_found="${with_apr_config}" 347 fi 348 else 349 AC_MSG_ERROR( Specify the apr-1-config path using --with-apr-config, 1) 350 fi] 351) 352 if test "${apr_found+set}" = set ; then 353 AC_MSG_RESULT([$apr_found]) 354 dnl At this point we already have apr sorted out 355 dnl It actually calls another script, so the PATH needs to be set. 356 export PATH=$PATH:`dirname ${apr_found}` 357 APR_CPPFLAGS=`${apr_found} --cppflags` 358 AC_SUBST(APR_CPPFLAGS) 359 APR_INCLUDES=`${apr_found} --includes` 360 AC_SUBST(APR_INCLUDES) 361 APR_LDLFAGS=`${apr_found} --link-libtool --libs` 362 AC_SUBST(APR_LDFLAGS) 363 else 364 AC_MSG_ERROR([Could not find apr-1-config. apr-1-config must be in your PATH or you must specify the location of the apr script using --with-apr-config]) 365 fi 366]) 367 368# -- APU_HANDLING 369# 370# calling apu-1-config to determine where apr-utils includes 371# and library are 372# 373 374AC_DEFUN([APU_HANDLING],[ 375 AC_MSG_CHECKING(for Apache apu) 376 AC_ARG_WITH( 377 apu_config, 378 [ --with-apu-config=FILE apu portable apu-1-config path], 379 [if "${with_apu_config}" --version; then 380 apu_found="${with_apu_config}" 381 fi] 382 , 383 [if apu-1-config --version; then 384 apu_found=apu-1-config 385 elif test -x "${apache_base}/bin/apu-1-config" ; then 386 apu_found="${apache_base}/bin/apu-1-config" 387 elif test -x "${apache_base}/sbin/apu-1-config" ; then 388 apu_found="${apache_base}/sbin/apu-1-config" 389 elif test "${apache_base+set}" = set; then 390 AC_PATH_PROGS(with_apu_config, apu-1-config) 391 if test "${with_apu_config+set}" = set ; then 392 apu_found="${with_apu_config}" 393 fi 394 else 395 AC_MSG_ERROR( Specify the apu-1-config path or program name using --with-apu-config, 1) 396 fi] 397) 398 if test "${apu_found+set}" = set ; then 399 AC_MSG_RESULT([$apu_found_]) 400 dnl At this point we already have apu sorted out 401 dnl It actually calls another script, so the PATH needs to be set. 402 export PATH=$PATH:`dirname ${apu_found}` 403 APU_INCLUDES=`${apu_found} --includes` 404 AC_SUBST(APU_INCLUDES) 405 APU_LDLFAGS=`${apu_found} --link-libtool --libs` 406 AC_SUBST(APU_LDFLAGS) 407 else 408 AC_MSG_ERROR([Could not find apu-1-config. apu-1-config must be in your PATH or you must specify the location of the apu script using --with-apu-config]) 409 fi 410]) 411 412#-------------------------------------------------------------------- 413# 6-Dec-2011: Introducing new ::rivet namespace. Some components 414# (namely RivetTcl, providing Tcl level initialization) are required 415# within mod_rivet.c. Unfortunalely Tcl < 8.5.10 shared 416# libs exporting names could clash with Apache's binary own names. 417# Hence we have to make sure we are running a Tcl compatible version. 418# (See Tcl bug #3216070). 419# 420# Effect: If you're running Tcl < 8.5.10 we refuse to build Rivet... 421 422AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.10],[ 423 AC_MSG_ERROR([Rivet 2.1 requires Tcl > 8.5.10 (current is $TCL_VERSION$TCL_PATCH_LEVEL)]) 424] , [ 425 AC_MSG_NOTICE([we are building Rivet with Tcl $TCL_VERSION$TCL_PATCH_LEVEL]) 426]) 427 428 429print_fileevent_msg="0" 430AX_COMPARE_VERSION([$TCL_VERSION$TCL_PATCH_LEVEL],[lt],[8.5.15],[ 431 print_fileevent_msg="1" 432] , ) 433 434 435AX_COMPARE_VERSION([$TCL_VERSION],[eq],[8.6],[ 436 if test "$TCL_PATCH_LEVEL" = ".0" ; then 437 print_fileevent_msg="1" 438 fi 439] , ) 440 441# MOD_RIVET_CORE 442# 443# Determining the path to the mod_rivet.* source files 444# 445 446AC_DEFUN([MOD_RIVET_CORE],[ 447 AC_ARG_WITH( 448 rivet_core, 449 [ --with-rivet-core[=path] mod_rivet core directory],, 450 [with_rivet_core="mod_rivet_ng"] 451 ) 452 453 AC_MSG_CHECKING([mod_rivet core]) 454 455 #if [[ -d "src/${with_rivet_core}" ]]; then 456 # rivet_core=$(pwd)/src/${with_rivet_core} 457 #else 458 # rivet_core=${with_rivet_core} 459 #fi 460 461 rivet_core=${with_rivet_core} 462 463 # by default we search the channel and core commands 464 # implementation in the same directory. This can 465 # be superseded by other macros 466 467 default_rivet_commands=${rivet_core} 468 default_rivet_channel=${rivet_core} 469 470 #AC_CONFIG_FILES([src/${rivet_core}/Makefile]) 471 AC_SUBST(rivet_core) 472 AC_MSG_RESULT([$rivet_core]) 473]) 474 475# 476 477AC_DEFUN([HANDLE_TCL_PACKAGE_PATH],[ 478 # shamelessly stolen from TEA_LOAD_TCLCONFIG 479 AC_MSG_CHECKING([Debian TCL_PACKAGE_PATH workaround]) 480 if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then 481 AC_MSG_RESULT([loading]) 482 . "${TCL_BIN_DIR}/tclConfig.sh" 483 else 484 AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh]) 485 fi 486 # If we have multiple paths, pull the first one, add end slash if needed 487 res=`echo ${TCL_PACKAGE_PATH} | \ 488 grep '[[^\]] ' | \ 489 sed -e 's/\([[^\]]\)\( \)\(.*\)$/\1/' -e 's/\([[^\/]]\)$/\1\//' ` 490 if test x"${res}" != x; then 491 TCL_PACKAGE_PATH=${res} 492 AC_SUBST(TCL_PACKAGE_PATH) 493 fi 494]) 495 496AC_DEFUN([GET_RIVET_BASE], [ 497 RIVET_BASE_INCLUDE=`pwd`/src 498 AC_SUBST(RIVET_BASE_INCLUDE) 499 RIVET_SOURCE_BASE=`pwd`/src 500 AC_SUBST(RIVET_SOURCE_BASE) 501]) 502 503# APACHE_REQUEST 504# 505# Choosing where is located the code for handling Apache request data (like 506# form data etc). Default: 'request' 507 508AC_DEFUN([APACHE_REQUEST],[ 509 AC_ARG_WITH( 510 apache_request, 511 [ --with-apache-request=DIR path to rivet HTML form and urlencoded data handler],, 512 [with_apache_request="request"] 513 ) 514 515 AC_MSG_CHECKING([code for HTML form and urlencoded data handling]) 516 apache_request=${with_apache_request} 517 AC_SUBST(apache_request) 518 AC_MSG_RESULT([$apache_request]) 519]) 520 521# RIVET_CORE_CMDS 522# 523# selecting non default directory for Rivet code commands core 524# 525 526AC_DEFUN([RIVET_CORE_CMDS],[ 527 AC_ARG_WITH( 528 rivet_commands, 529 [ --with-rivet-commands[=dir] path to Rivet core commands code],, 530 [with_rivet_commands=$default_rivet_commands] 531 ) 532 533 AC_MSG_CHECKING([for Rivet core commands code]) 534 rivet_commands=${with_rivet_commands} 535 AC_SUBST(rivet_commands) 536 AC_MSG_RESULT([$rivet_commands]) 537 538]) 539 540# RIVET_CHANNEL 541# 542# selecting the Rivet channel code directory 543 544AC_DEFUN([RIVET_CHANNEL],[ 545 AC_ARG_WITH( 546 rivet_channel, 547 [ --with-rivet-channel=DIR Rivet channel code path ],, 548 [with_rivet_channel=$default_rivet_channel] 549 ) 550 551 AC_MSG_CHECKING([for Rivet channel code path]) 552 rivet_channel=${with_rivet_channel} 553 554 AC_SUBST(rivet_channel) 555 AC_MSG_RESULT([$rivet_channel]) 556]) 557 558# RIVET_TCL_LIB 559# 560# 561 562AC_DEFUN([RIVET_TCL_LIB],[ 563 AC_ARG_WITH( 564 rivet_target_dir, 565 [ --with-rivet-target-dir=DIR Rivet tcl and binary libraries target dir ],, 566 with_rivet_target_dir="${apache_base}/lib/rivet${PACKAGE_VERSION}" 567 ) 568 AC_MSG_CHECKING([for Rivet libraries target]) 569 RIVET_TCL_TARGET=${with_rivet_target_dir} 570 AC_SUBST(RIVET_TCL_TARGET) 571 AC_MSG_RESULT([$with_rivet_target_dir]) 572]) 573 574# DISPLAY_RIVET_VERSION 575# 576# --enable-version-display=[yes|no] (default: no) 577# switches on version number display in Apache's signature. 578# 579 580AC_DEFUN([DISPLAY_RIVET_VERSION],[ 581 AC_ARG_ENABLE( 582 version_display, 583 [ --enable-version-display Display Rivet version in Apache signature], 584 [ signature_version_display=$enable_version_display ], 585 [ signature_version_display="no" ] 586 ) 587 588 AC_MSG_CHECKING([whether rivet version is printed in Apache signature]) 589 if test "$signature_version_display" = "yes"; then 590 AC_MSG_RESULT([yes]) 591 AC_DEFINE(DISPLAY_VERSION,1,[Display Rivet version in Apache signature]) 592 else 593 AC_MSG_RESULT([no, Rivet version will be hidden]) 594 AC_DEFINE(DISPLAY_VERSION,0,[Display Rivet version in Apache signature]) 595 fi 596]) 597 598# UPLOAD_DIRECTORY 599# 600# Adds '--with-upload-dir=DIR' to configure's arguments 601# 602# let's make configuration of the upload directory more flexible for windows builds 603# (in case someone steps forward and takes up the Windows port) 604# The upload directory can be changed in the configuration, but we give the 605# user/packager the chance to set a default at compile time. 606# Default: /tmp 607 608AC_DEFUN([UPLOAD_DIRECTORY],[ 609 AC_ARG_WITH( 610 upload_dir, 611 [ --with-upload-dir=DIR Default directory for uploads],, 612 with_upload_dir="/tmp" 613 ) 614 AC_MSG_CHECKING(where Rivet will save uploads) 615 RIVET_UPLOAD_DIR=${with_upload_dir} 616 AC_SUBST(RIVET_UPLOAD_DIR) 617 AC_MSG_RESULT([$with_upload_dir]) 618]) 619 620# HONOR_HEAD_REQUESTS (--enable-head-requests) 621# Rivet answers to HEAD requests with a standard response to avoid the whole workload 622# of generating the content of a page with to the sole purpose of returning the HTTP 623# headers.To test the configuration or scripts that manipulate the headers it 624# can be useful to let Rivet honor a HEAD request as if the whole content was 625# generated so that the real headers are returned (this can be set in configuration 626# by adding "RivetServerConf HonorHeaderOnlyRequests yes" to the server configuration) 627# 628# Default: no 629 630AC_DEFUN([HONOR_HEAD_REQUESTS],[ 631 AC_ARG_ENABLE( 632 head_requests, 633 [ --enable-head-requests Returns real headers in response to a HEAD request], 634 [ honor_head_requests=$enable_head_requests ], 635 [ honor_head_requests="no"] 636 ) 637 638 AC_MSG_CHECKING([if Rivet has to honor HEAD requests]) 639 if test "$honor_head_requests" = "yes"; then 640 AC_MSG_RESULT([yes]) 641 AC_DEFINE(HEAD_REQUESTS,1,[Honor HEAD requests]) 642 else 643 AC_MSG_RESULT([no, Rivet will shunt HEAD requests]) 644 AC_DEFINE(HEAD_REQUESTS,0,[Honor HEAD requests]) 645 fi 646]) 647 648# SINGLE_WORKER_TCL_THREAD 649# 650# This options is used by the worker MPM bridge for debugging. 651# When enabled rivet_worker_bridge will create a single Tcl interp thread instead 652# of the a whole pool of them 653# 654# Defautl: no 655 656AC_DEFUN([SINGLE_WORKER_TCL_THREAD],[ 657 AC_ARG_ENABLE( 658 single_thread, 659 [ --enable-single-thread forces the worker brigde to create a single thread (debug)], 660 [ single_thread=$enable_single_thread ], 661 [ single_thread="no"] 662 ) 663 664 AC_MSG_CHECKING([if the worker MPM bridge will run in single thread mode]) 665 if test "$single_thread" = "yes"; then 666 AC_MSG_RESULT([yes]) 667 AC_DEFINE(MPM_SINGLE_TCL_THREAD,1,[yes, MPM worker single thread]) 668 else 669 AC_MSG_RESULT([no, maximal number of Tcl threads]) 670 fi 671]) 672 673# -- SERIALIZE_HTTP_REQUEST 674# 675# The macro defines the symbol SERIALIZE_HTTP_REQUESTS and cooperates 676# with macro HTTP_REQUESTS_PROC. This option is useful only 677# for debugging (avoids threads concurrency). See the code of the 678# worker bridge to see the preprocessor macros cooperating to 679# attain this feature 680# 681# Default: no 682 683AC_DEFUN([HTTP_REQUESTS_MUTEX],[ 684 AC_ARG_ENABLE( 685 requests_serialization, 686 [ --enable-requests-serialization Forces HTTP requests serialization among threads(debug)], 687 [ requests_serialization=$enable_requests_serialization ], 688 [ requests_serialization="no" ] 689 ) 690 691 AC_MSG_CHECKING([if we want the worker bridge to serialize HTTP requests]) 692 if test "$requests_serialization" = "yes"; then 693 AC_MSG_RESULT([yes]) 694 AC_DEFINE(SERIALIZE_HTTP_REQUESTS,1,[requests will be serialized]) 695 else 696 AC_MSG_RESULT([no, HTTP requests will not be serialized]) 697 fi 698]) 699 700# -- RIVET_DEBUG_BUILD 701# 702# Defining a symbol for conditional inclusion of code for debugging purposes 703# 704# Default: no 705# 706 707AC_DEFUN([BUILD_DEBUG_CODE],[ 708 AC_ARG_ENABLE( 709 rivet_debug_build, 710 [ --enable-rivet-debug-build Includes optional debugging code], 711 [ rivet_debug_build=$enable_rivet_debug_build ], 712 [ rivet_debug_build="no" ] 713 ) 714 715 AC_MSG_CHECKING([if we are building mod_rivet for debugging]) 716 if test "$rivet_debug_build" = "yes"; then 717 AC_MSG_RESULT([yes]) 718 AC_DEFINE(DEBUG_BUILD,1,[we are building mod_rivet with optional code]) 719 else 720 AC_MSG_RESULT([no, ordinary build]) 721 fi 722]) 723 724# RIVET_COMMANDS_EXPORT (--enable-rivet-commands-export). 725# Enable export of commands in Rivet's namespace. Definining this symbols 726# sets the boolean configuration variable rivet_commands_export 727# Default: yes 728 729AC_DEFUN([RIVET_COMMANDS_EXPORT],[ 730 AC_ARG_ENABLE( 731 rivet-commands-export, 732 [ --disable-rivet-commands-export to prevent export from ::rivet namespace], 733 [ rivet_commands_export=$enable_rivet_commands_export ], 734 [ rivet_commands_export="yes"] 735 ) 736 737 AC_MSG_CHECKING([if the commands in ::rivet namespace will be exported]) 738 if test "$rivet_commands_export" = "yes"; then 739 AC_MSG_RESULT([yes]) 740 AC_DEFINE(NAMESPACE_EXPORT,1,[commands will be exported]) 741 else 742 AC_MSG_RESULT([no]) 743 AC_DEFINE(NAMESPACE_EXPORT,0,[commands will not be exported]) 744 fi 745]) 746 747# IMPORT_RIVET_COMMANDS (--enable-import-rivet-commands). 748# For compatibility the module can be compiled and installed forcing rivet 749# to import commands from ::rivet into the global namespace. 750# Default: no 751 752AC_DEFUN([IMPORT_RIVET_COMMANDS],[ 753 AC_ARG_ENABLE( 754 import-rivet-commands, 755 [ --enable-import-rivet-commands requires explicit namespace import], 756 [ import_rivet_commands=$enable_import_rivet_commands], 757 [ import_rivet_commands="no"] 758 ) 759 760 AC_MSG_CHECKING([if ::rivet namespace will be automatically imported for compatibility]) 761 if test "$import_rivet_commands" = "yes"; then 762 AC_MSG_RESULT([yes]) 763 AC_DEFINE(NAMESPACE_IMPORT,1,[commands will be imported into the global namespace]) 764 else 765 AC_MSG_RESULT([no]) 766 AC_DEFINE(NAMESPACE_IMPORT,0,[good, no automatic import will be done]) 767 fi 768]) 769 770 771# SEPARATE_VIRTUAL_INTERPS (--enable-virtual-interps-separation) 772# Virtual hosts get their own interpreter and configuration. Different 773# applications running on different virtual hosts don't mix up variables 774# and namespaces, avoiding conflicts. 775# Default: no 776 777AC_DEFUN([VIRTUAL_INTERPS_SEPARATION],[ 778 AC_ARG_ENABLE( 779 virtual-interps-separation, 780 [ --enable-virtual-interps-separation to turn on virtual host separation], 781 [ separate_virtual_interps=$enable_virtual_interps_separation ], 782 [ separate_virtual_interps="no"] 783 ) 784 785 AC_MSG_CHECKING([whether Rivet will create an interpreter for each virtual host]) 786 if test "$separate_virtual_interps" = "yes"; then 787 AC_MSG_RESULT([yes]) 788 AC_DEFINE(SEPARATE_VIRTUAL_INTERPS,1,[virtual hosts will have their own interp]) 789 else 790 AC_MSG_RESULT([no]) 791 AC_DEFINE(SEPARATE_VIRTUAL_INTERPS,0,[one interpreter per child]) 792 fi 793]) 794 795# POST_MAX_SIZE (--with-post-max) 796# Maximum size of data posted by a form 797# Default: 0=unlimited 798 799AC_DEFUN([POST_MAX_SIZE],[ 800 AC_ARG_WITH( 801 post_max, 802 [ --with-post-max=BYTES Maximum size of data to be sent with a POST],, 803 with_post_max=0 804 ) 805 806 AC_MSG_CHECKING([maximum size of a POST]) 807 MAX_POST=${with_post_max} 808 AC_SUBST(MAX_POST) 809 if test $with_post_max = 0; then 810 AC_MSG_RESULT([unlimited size]) 811 else 812 AC_MSG_RESULT([$with_post_max]) 813 fi 814]) 815 816# UPLOAD_TO_VAR (--enable-upload-var) 817# Enables upload of files into Tcl variables 818# Default: 1=enabled 819 820AC_DEFUN([UPLOAD_TO_VAR],[ 821 AC_ARG_ENABLE( 822 upload-var, 823 [ --disable-upload-var to disable automatic upload to variables ], 824 [ upload_var=$enable_upload_var ], 825 [ upload_var="yes"] 826 ) 827 828 AC_MSG_CHECKING([whether files are uploaded to Tcl variables]) 829 if test "$upload_var" = "yes"; then 830 AC_MSG_RESULT([yes]) 831 AC_DEFINE(UPLOAD_FILES_TO_VAR,1,[Files are uploaded to Tcl variables]) 832 else 833 AC_MSG_RESULT([no]) 834 AC_DEFINE(UPLOAD_FILES_TO_VAR,0,[uploads go to files]) 835 fi 836 837]) 838 839#APACHE_VERSION 840MOD_RIVET_CORE 841GET_RIVET_BASE 842APACHE 843CHECK_APXS 844APACHE_INCLUDES 845APR_HANDLING 846APU_HANDLING 847RIVET_TCL_LIB 848DISPLAY_RIVET_VERSION 849UPLOAD_DIRECTORY 850HONOR_HEAD_REQUESTS 851VIRTUAL_INTERPS_SEPARATION 852POST_MAX_SIZE 853UPLOAD_TO_VAR 854IMPORT_RIVET_COMMANDS 855APACHE_REQUEST 856RIVET_CORE_CMDS 857RIVET_CHANNEL 858SINGLE_WORKER_TCL_THREAD 859HTTP_REQUESTS_MUTEX 860BUILD_DEBUG_CODE 861AC_HEADER_STDBOOL 862 863# Let's separate the point version from the major and minor version 864# to build a Rivet version to be substituted as basic version for 865# package Rivet, central initialization of the Tcl environment 866 867VERSION=${PACKAGE_VERSION} 868AX_SPLIT_VERSION 869AC_DEFINE_UNQUOTED(INIT_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}",[Rivet Tcl package version]) 870AC_MSG_NOTICE([Rivet package version is ${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}]) 871AC_SUBST(INIT_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}") 872AC_SUBST(RIVETLIB_PACKAGE,"rivetlib",[rivetlib package name]) 873AC_SUBST(RIVETLIB_PACKAGE_VERSION,"${AX_MAJOR_VERSION}.${AX_MINOR_VERSION}") 874 875if test $import_rivet_commands = "yes"; then 876 AC_MSG_NOTICE([forcing Rivet to export commands from ::rivet namespace]) 877 AC_DEFINE(NAMESPACE_EXPORT,1,[commands will be exported]) 878else 879 RIVET_COMMANDS_EXPORT 880fi 881AC_C_INLINE 882 883#AC_SUBST(apache_version_dir) 884AC_SUBST(MOD_RIVET_INCLUDES) 885 886AC_DEFINE_UNQUOTED(RIVETLIB_DESTDIR,"${RIVET_TCL_TARGET}",[The path to the rivet tcl library]) 887AC_DEFINE_UNQUOTED(NAMEOFEXECUTABLE,"${TCLSH_PROG}",[The path to a working tclsh executable]) 888AC_DEFINE_UNQUOTED(UPLOAD_DIR,"${RIVET_UPLOAD_DIR}",[Path to the disk directory where uploads are saved]) 889AC_DEFINE_UNQUOTED(MAX_POST,[$MAX_POST],[Max size of data in POST operations]) 890AC_DEFINE_UNQUOTED(SEPARATE_CHANNELS,0,[Separate Channels for virtual hosts]) 891AC_DEFINE_UNQUOTED(CONFIGURE_CMD,"${CONFIGURE_CMD}",[configure command string]) 892AC_DEFINE_UNQUOTED(RIVET_CORE,"${rivet_core}",[mod_rivet core]) 893 894# We need to use the package path for the installation procedure. On 895#Debian linux TCL_PACKAGE_PATH may have more than one path in the 896#TCL_PACKAGE_PATH variable, so we have to handle this 897HANDLE_TCL_PACKAGE_PATH 898AC_SUBST(TCL_PACKAGE_PATH) 899 900 901# Finally, substitute all of the various values into the Makefile. 902# You may alternatively have a special pkgIndex.tcl.in or other files 903# which require substituting the AC variables in. Include these here. 904#-------------------------------------------------------------------- 905AC_CONFIG_FILES([Makefile src/Makefile rivet/init.tcl doc/Makefile doc/convert_examples.tcl doc/rivet.xml]) 906 907#case $apache_version_dir in 908# apache-1) AC_CONFIG_FILES([Makefile src/Makefile src/apache-1/Makefile doc/Makefile]) ;; 909# apache-2) AC_CONFIG_FILES([Makefile src/Makefile src/apache-2/Makefile doc/Makefile]) ;; 910#esac 911AC_OUTPUT 912 913if test "$print_fileevent_msg" = "1"; then 914 AC_MSG_NOTICE([========================================================================]) 915 AC_MSG_NOTICE([ WARNING!]) 916 AC_MSG_NOTICE([========================================================================]) 917 AC_MSG_NOTICE([The Tcl notifier (and consequently the event loop) does not work with]) 918 AC_MSG_NOTICE([Rivet running Tcl $TCL_VERSION$TCL_PATCH_LEVEL and the 'prefork' MPM of Apache.]) 919 AC_MSG_NOTICE([In order to have asynchronous I/O working the required versions are:]) 920 AC_MSG_NOTICE([ - threaded builds: Tcl >= 8.5.15 (8.5 version) or Tcl >= 8.6.1]) 921 AC_MSG_NOTICE([ - any non-threaded build of Tcl >= 8.5.10]) 922 AC_MSG_NOTICE([]) 923 AC_MSG_NOTICE([Nonetheless Rivet scripts work with Tcl >= 8.5.10 provided]) 924 AC_MSG_NOTICE([you do not have to rely on the event loop to do I/O (e.g. you]) 925 AC_MSG_NOTICE([cannot use the 'fileevent' command to set up callbacks)]) 926 AC_MSG_NOTICE([see https://issues.apache.org/bugzilla/show_bug.cgi?id=55153]) 927 AC_MSG_NOTICE([========================================================================]) 928fi 929 930