1# 2# configure.in -- configure def for websh 3# nca-073-9 4# 5# (adapted from sampleextension-0.2) 6# 7# See the file "license.terms" for information on usage and 8# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 9# 10# @(#) $Id: configure.in 814719 2009-09-14 16:07:00Z ronnie $ 11# 12 13#-------------------------------------------------------------------- 14# This very first macro is used to verify that the configure script can 15# find the sources. The argument to AC_INIT should be a unique filename 16# for this package, and can be a relative path, such as: 17# 18# AC_INIT(../generic/tcl.h) 19#-------------------------------------------------------------------- 20 21AC_INIT(../generic/web.c) 22 23#-------------------------------------------------------------------- 24# Set your package name and version numbers here. The NODOT_VERSION is 25# required for constructing the library name on systems that don't like 26# dots in library names (Windows). The VERSION variable is used on the 27# other systems. 28#-------------------------------------------------------------------- 29 30PACKAGE=web 31 32MAJOR_VERSION=3 33MINOR_VERSION=6 34PATCHLEVEL=0b5 35 36VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCHLEVEL} 37NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}${PATCHLEVEL} 38 39AC_SUBST(PACKAGE) 40AC_SUBST(VERSION) 41 42#-------------------------------------------------------------------- 43# Check whether --enable-gcc or --disable-gcc was given. Do this 44# before AC_CYGWIN is called so the compiler can 45# be fully tested by built-in autoconf tools. 46# This macro also calls AC_PROG_CC to set the compiler if --enable-gcc 47# was not used. 48#-------------------------------------------------------------------- 49 50SC_ENABLE_GCC 51AC_PROG_INSTALL 52 53AC_EGREP_HEADER(strcasecmp, string.h, tcl_ok=1, tcl_ok=0) 54if test $tcl_ok = 0; then 55 AC_EGREP_HEADER(strcasecmp, strings.h, tcl_ok=1, tcl_ok=0) 56 if test $tcl_ok = 0; then 57 AC_ERROR(needed function strcasecmp not found on this system) 58 fi 59fi 60 61#-------------------------------------------------------------------- 62# Checks to see if the make program sets the $MAKE variable. 63#-------------------------------------------------------------------- 64 65AC_PROG_MAKE_SET 66 67#-------------------------------------------------------------------- 68# Find ranlib 69#-------------------------------------------------------------------- 70 71AC_PROG_RANLIB 72 73#-------------------------------------------------------------------- 74# This macro performs additional compiler tests. 75#-------------------------------------------------------------------- 76 77AC_CYGWIN 78 79#-------------------------------------------------------------------- 80# Determines the correct binary file extension (.o, .obj, .exe etc.) 81#-------------------------------------------------------------------- 82 83AC_OBJEXT 84AC_EXEEXT 85 86#-------------------------------------------------------------------- 87# "cygpath" is used on windows to generate native path names for include 88# files. 89# These variables should only be used with the compiler and linker since 90# they generate native path names. 91# 92# Unix tclConfig.sh points SRC_DIR at the top-level directory of 93# the Tcl sources, while the Windows tclConfig.sh points SRC_DIR at 94# the win subdirectory. Hence the different usages of SRC_DIR below. 95# 96# This must be done before calling SC_PUBLIC_TCL_HEADERS 97#-------------------------------------------------------------------- 98 99case "`uname -s`" in 100 *win32* | *WIN32* | *CYGWIN_NT*) 101 CYGPATH="cygpath -w" 102 ;; 103 *) 104 CYGPATH=echo 105 ;; 106esac 107 108AC_SUBST(CYGPATH) 109 110#-------------------------------------------------------------------- 111# Choose which headers you need. Extension authors should try very 112# hard to only rely on the Tcl public header files. Internal headers 113# contain private data structures and are subject to change without 114# notice. 115# This MUST be called before SC_PATH_TCLCONFIG/SC_LOAD_TCLCONFIG 116#-------------------------------------------------------------------- 117 118SC_PUBLIC_TCL_HEADERS 119 120#-------------------------------------------------------------------- 121# Load the tclConfig.sh file 122#-------------------------------------------------------------------- 123 124SC_PATH_TCLCONFIG 125SC_LOAD_TCLCONFIG 126 127 128#-------------------------------------------------------------------- 129# --with-httpd-include and --with-httpd (for Darwin) 130#-------------------------------------------------------------------- 131AC_MSG_CHECKING(for httpd header files) 132AC_ARG_WITH(httpdinclude, [ --with-httpdinclude directory containing the apache header files.], with_httpdinclude=${withval}, with_httpdinclude=NA) 133 134if test x"${with_httpdinclude}" != xNA ; then 135 if test -f "${with_httpdinclude}/httpd.h" ; then 136 echo "found ${with_httpdinclude}" 137 HTTPD_INCLUDES=-I\"${with_httpdinclude}\" 138 HTTPD_INCDIR=${with_httpdinclude} 139 AC_SUBST(HTTPD_INCLUDES) 140 else 141 AC_MSG_ERROR([${with_httpdinclude}: directory does not contain Apache httpd header file httpd.h]) 142 fi 143else 144 eval "temp_includedir=${includedir}" 145 for i in \ 146 `ls -d ${temp_includedir} 2>/dev/null` \ 147 /usr/local/include /usr/include /usr/include/httpd /usr/include/apache2\ 148 /usr/include/apache /usr/include/httpd2 ; do 149 if test -f "$i/httpd.h" ; then 150 echo "found $i" 151 HTTPD_INCLUDES=-I\"$i\" 152 HTTPD_INCDIR=$i 153 AC_SUBST(HTTPD_INCLUDES) 154 break 155 fi 156 done 157 if test x"${HTTPD_INCLUDES}" = x ; then 158 AC_MSG_ERROR(httpd.h not found. Please specify its location with --with-httpdinclude) 159 fi 160fi 161 162if test "`uname -s`" = "Darwin" ; then 163 AC_MSG_CHECKING(for httpd binary) 164 AC_ARG_WITH(httpd, [ --with-httpd apache binary (Darwin only)], with_httpd=${withval}, with_httpd=NA) 165 if test x"${with_httpd}" != xNA ; then 166 if test -f "${with_httpd}" ; then 167 echo "found ${with_httpd}" 168 HTTPD_BIN=${with_httpd} 169 else 170 AC_MSG_ERROR(httpd binary not found. Invalid specification --with-httpd) 171 fi 172 else 173 if test -f "${HTTPD_INCDIR}/../bin/httpd" ; then 174 echo "found ${HTTPD_INCDIR}/../bin/httpd" 175 HTTPD_BIN=${HTTPD_INCDIR}/../bin/httpd 176 else 177 httpd=`which httpd` 178 if test -f "${httpd}" ; then 179 echo "found ${httpd}" 180 HTTPD_BIN=${httpd} 181 else 182 AC_MSG_ERROR(httpd binary not found. Please specify its location with --with-httpd) 183 fi 184 fi 185 fi 186else 187 HTTPD_BIN= 188fi 189AC_SUBST(HTTPD_BIN) 190 191#-------------------------------------------------------------------- 192# --with-apr and --with-apr-util 193#-------------------------------------------------------------------- 194# needed for Apache httpd 2.2.4 (and others) if Apache httpd is configured 195# with --with-apr and/or --with-apr-util -> header files are missing in 196# installation of httpd 197 198AC_ARG_WITH(aprinclude, [ --with-aprinclude directory containing apr header files.], with_aprinclude=${withval}, with_aprinclude=NA) 199 200if test x"${with_aprinclude}" != xNA ; then 201 AC_MSG_CHECKING(for apache runtime (apr) header files) 202 if test -f "${with_aprinclude}/apr.h" ; then 203 echo "found ${with_aprinclude}" 204 APR_INCLUDES=" -I\"${with_aprinclude}\"" 205 AC_SUBST(APR_INCLUDES) 206 else 207 AC_MSG_ERROR([${with_aprinclude}: directory does not contain apr header file apr.h]) 208 fi 209else 210 APR_INCLUDES= 211 AC_SUBST(APR_INCLUDES) 212fi 213 214AC_ARG_WITH(apuinclude, [ --with-apuinclude directory containing apr util header files.], with_apuinclude=${withval}, with_apuinclude=NA) 215 216if test x"${with_apuinclude}" != xNA ; then 217 AC_MSG_CHECKING(for apache runtime utils (apu) header files) 218 if test -f "${with_apuinclude}/apr_hooks.h" ; then 219 echo "found ${with_apuinclude}" 220 APU_INCLUDES=" -I\"${with_apuinclude}\"" 221 AC_SUBST(APU_INCLUDES) 222 else 223 AC_MSG_ERROR([${with_apuinclude}: directory does not contain apu header file apr_hooks.h]) 224 fi 225else 226 APU_INCLUDES= 227 AC_SUBST(APU_INCLUDES) 228fi 229 230#-------------------------------------------------------------------- 231# A few miscellaneous platform-specific items: 232# 233# Define a special symbol for Windows (BUILD_exampleA in this case) so 234# that we create the export library with the dll. See sha1.h on how 235# to use this. 236# 237# Windows creates a few extra files that need to be cleaned up. 238# You can add more files to clean if your extension creates any extra 239# files. 240# 241# Define any extra compiler flags in the PACKAGE_CFLAGS variable. 242# These will be appended to the current set of compiler flags for 243# your system. 244#-------------------------------------------------------------------- 245 246case "`uname -s`" in 247 *win32* | *WIN32* | *CYGWIN_NT*) 248 CLEANFILES="*.lib *.dll *.exp *.ilk *.pdb vc50.pch" 249 ;; 250 *) 251 CLEANFILES="*pure* *.cov* ../tests/webtest.log ../tests/*.dat" 252 ;; 253esac 254AC_SUBST(CLEANFILES) 255 256 257#-------------------------------------------------------------------- 258# set SYSV or WIN32 or AIX 259#-------------------------------------------------------------------- 260case "`uname -s`" in 261 *win32* | *WIN32* | *CYGWIN_NT*) 262 PLATFORM="WIN32" 263 ;; 264 *aix* | *AIX* ) 265 PLATFORM="AIX" 266 ;; 267 *freebsd* | *FreeBSD* | *DragonFly* ) 268 PLATFORM="FREEBSD" 269 ;; 270 *bsd/os* | *BSD/OS* ) 271 PLATFORM="BSDI" 272 ;; 273 *) 274 PLATFORM="SYSV" 275 ;; 276esac 277AC_SUBST(PLATFORM) 278 279#-------------------------------------------------------------------- 280# Check whether --enable-threads or --disable-threads was given. 281# So far only Tcl responds to this one. 282#-------------------------------------------------------------------- 283 284SC_ENABLE_THREADS 285 286#-------------------------------------------------------------------- 287# The statement below defines a collection of symbols related to 288# building as a shared library instead of a static library. 289#-------------------------------------------------------------------- 290 291SC_ENABLE_SHARED 292 293#-------------------------------------------------------------------- 294# This macro figures out what flags to use with the compiler/linker 295# when building shared/static debug/optimized objects. This information 296# is all taken from the tclConfig.sh file. 297#-------------------------------------------------------------------- 298 299CFLAGS_DEBUG=${TCL_CFLAGS_DEBUG} 300CFLAGS_OPTIMIZE=${TCL_CFLAGS_OPTIMIZE} 301LDFLAGS_DEBUG=${TCL_LDFLAGS_DEBUG} 302LDFLAGS_OPTIMIZE=${TCL_LDFLAGS_OPTIMIZE} 303SHLIB_LD=${TCL_SHLIB_LD} 304STLIB_LD=${TCL_STLIB_LD} 305SHLIB_CFLAGS=${TCL_SHLIB_CFLAGS} 306 307AC_SUBST(CFLAGS_DEBUG) 308AC_SUBST(CFLAGS_OPTIMIZE) 309AC_SUBST(STLIB_LD) 310AC_SUBST(SHLIB_LD) 311AC_SUBST(SHLIB_CFLAGS) 312AC_SUBST(SHLIB_LDFLAGS) 313 314#-------------------------------------------------------------------- 315# Set the default compiler switches based on the --enable-symbols 316# option. 317#-------------------------------------------------------------------- 318 319SC_ENABLE_SYMBOLS 320 321if test "${SHARED_BUILD}" = "1" ; then 322 CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_DEBUG} ${CFLAGS_WARNING} ${SHLIB_CFLAGS}' 323else 324 CFLAGS='${CFLAGS_DEFAULT} ${CFLAGS_DEBUG} ${CFLAGS_WARNING}' 325fi 326 327#-------------------------------------------------------------------- 328# Everyone should be linking against the Tcl stub library. If you 329# can't for some reason, remove this definition. If you aren't using 330# stubs, you also need to modify the SHLIB_LD_LIBS setting below to 331# link against the non-stubbed Tcl library. 332#-------------------------------------------------------------------- 333 334USE_TCL_STUBS=1 335AC_SUBST(USE_TCL_STUBS) 336 337#-------------------------------------------------------------------- 338# This macro generates a line to use when building a library. It 339# depends on values set by the SC_ENABLE_SHARED, SC_ENABLE_SYMBOLS, 340# and SC_LOAD_TCLCONFIG macros above. 341#-------------------------------------------------------------------- 342 343SC_MAKE_LIB 344 345#-------------------------------------------------------------------- 346# eval these two values to dereference the ${DBGX} variable. 347#-------------------------------------------------------------------- 348 349eval "SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}" 350eval "UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}" 351 352AC_SUBST(SHARED_LIB_SUFFIX) 353AC_SUBST(UNSHARED_LIB_SUFFIX) 354 355#-------------------------------------------------------------------- 356# Shared libraries and static libraries have different names. 357#-------------------------------------------------------------------- 358 359case "`uname -s`" in 360 *win32* | *WIN32* | *CYGWIN_NT*) 361 if test "${SHARED_BUILD}" = "1" ; then 362 SHLIB_LD_LIBS="\"`cygpath -w ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\" ${TCL_SHLIB_LD_LIBS}" 363 eval "${PACKAGE}_LIB_FILE=${PACKAGE}sh${SHARED_LIB_SUFFIX}" 364 RANLIB=: 365 else 366 eval "${PACKAGE}_LIB_FILE=${PACKAGE}sh${UNSHARED_LIB_SUFFIX}" 367 fi 368 ;; 369 *) 370 if test "${SHARED_BUILD}" = "1" ; then 371 SHLIB_LD_LIBS="${TCL_STUB_LIB_SPEC}" 372 eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}sh${SHARED_LIB_SUFFIX}" 373 RANLIB=: 374 else 375 eval "${PACKAGE}_LIB_FILE=lib${PACKAGE}sh${UNSHARED_LIB_SUFFIX}" 376 fi 377 ;; 378esac 379 380#-------------------------------------------------------------------- 381# Change the name from exampeA_LIB_FILE to match your package name. 382#-------------------------------------------------------------------- 383 384AC_SUBST(web_LIB_FILE) 385AC_SUBST(SHLIB_LD_LIBS) 386 387#-------------------------------------------------------------------- 388# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl 389# file during the install process. Don't run the TCLSH_PROG through 390# ${CYGPATH} because it's being used directly by make. 391# Require that we use a tclsh shell version 8.2 or later since earlier 392# versions have bugs in the pkg_mkIndex routine. 393#-------------------------------------------------------------------- 394 395#AC_PATH_PROGS (VARIABLE, PROGS-TO-CHECK-FOR [, 396# VALUE-IF-NOT-FOUND [, PATH]]) 397# Like `AC_CHECK_PROGS', but if any of PROGS-TO-CHECK-FOR are found, 398# set VARIABLE to the entire path of the program found. 399 400# search in configured path first 401AC_PATH_PROGS(TCLSH_PROG, \ 402 tclsh8.6${EXEEXT} tclsh86${EXEEXT} tclsh8.5${EXEEXT} tclsh85${EXEEXT} tclsh8.4${EXEEXT} tclsh84${EXEEXT} tclsh8.3${EXEEXT} tclsh83${EXEEXT} tclsh8.2${EXEEXT} tclsh82${EXEEXT}, :, \ 403 :${TCL_BIN_DIR}/../bin) 404 405if test "x${TCLSH_PROG}" = "x:" ; then 406 # search in additional paths 407 AC_PATH_PROGS(TCLSH_PROG, \ 408 tclsh8.6${EXEEXT} tclsh86${EXEEXT} tclsh8.5${EXEEXT} tclsh85${EXEEXT} tclsh8.4${EXEEXT} tclsh84${EXEEXT} tclsh8.3${EXEEXT} tclsh83${EXEEXT} tclsh8.2${EXEEXT} tclsh82${EXEEXT}, :, \ 409 :.:${prefix}:${exec_prefix}:${PATH}) 410fi 411 412# if nothing was found 413if test "x${TCLSH_PROG}" = "x:" ; then 414 AC_ERROR(needed tclsh not found) 415fi 416 417AC_SUBST(TCL_LIB_SPEC) 418AC_SUBST(TCLSH_PROG) 419AC_SUBST(TCL_PACKAGE_PATH) 420 421#-------------------------------------------------------------------- 422# Finally, substitute all of the various values into the Makefile. 423#-------------------------------------------------------------------- 424 425AC_OUTPUT([Makefile]) 426