1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
|
# Copyright (c) 2000 Gregory Trubetskoy. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
#
# 3. The end-user documentation included with the redistribution, if
# any, must include the following acknowledgment: "This product
# includes software developed by Gregory Trubetskoy."
# Alternately, this acknowledgment may appear in the software itself,
# if and wherever such third-party acknowledgments normally appear.
#
# 4. The names "mod_python", "modpython" or "Gregory Trubetskoy" must not
# be used to endorse or promote products derived from this software
# without prior written permission. For written permission, please
# contact grisha@modpython.org.
#
# 5. Products derived from this software may not be called "mod_python"
# or "modpython", nor may "mod_python" or "modpython" appear in their
# names without prior written permission of Gregory Trubetskoy.
#
# THIS SOFTWARE IS PROVIDED BY GREGORY TRUBETSKOY ``AS IS'' AND ANY
# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GREGORY TRUBETSKOY OR
# HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
# OF THE POSSIBILITY OF SUCH DAMAGE.
# ====================================================================
#
dnl $Id: configure.in,v 1.11 2001/06/11 19:16:25 gtrubetskoy Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/mod_python.c)
# includes
INCLUDES="-I`pwd`/src/include"
dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar)
AC_PROG_INSTALL
AC_PROG_MAKE_SET
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, main)
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
### humor lowers blood pressure
AC_MSG_CHECKING(your blood pressure)
AC_MSG_RESULT([a bit high, but we can proceed])
## The goal is to find apxs
AC_CHECKING(whether apxs is available)
AC_SUBST(APXS)
AC_SUBST(DSO)
AC_SUBST(ALL)
# check for --with-apxs
AC_MSG_CHECKING(for --with-apxs)
AC_ARG_WITH(apxs, [--with-apxs=PATH Path to apxs],
[
if test -x "$withval"
then
AC_MSG_RESULT([$withval executable, good])
APXS=$withval
else
echo
AC_MSG_ERROR([$withval not found or not executable])
fi
],
AC_MSG_RESULT(no))
# if no apxs found yet, check /usr/local/apache/sbin
# since it's the default Apache location
if test -z "$APXS"; then
AC_MSG_CHECKING(for apxs in /usr/local/apache/sbin)
if test -x /usr/local/apache/sbin/apxs; then
APXS=/usr/local/apache/sbin/apxs
AC_MSG_RESULT([found, we'll use this. Use --with-apxs to specify another.])
else
AC_MSG_RESULT(no)
fi
fi
# last resort
if test -z "$APXS"; then
AC_MSG_CHECKING(for apxs in your PATH)
AC_PATH_PROG(APXS, apxs)
if test -n "$APXS"; then
AC_MSG_RESULT([found $APXS, we'll use this. Use --with-apxs to specify another.])
fi
fi
# if apxs was still not found, then no DSO
AC_SUBST(LIBEXECDIR)
AC_SUBST(EPRINTF_HACK)
if test -z "$APXS"; then
AC_MSG_WARN([**** apxs was not found, DSO compilation will not be available.])
AC_MSG_WARN([**** You can use --with-apxs to specify where your apxs is.])
DSO="no_dso"
ALL="static"
else
DSO="do_dso"
ALL="dso"
# determine LIBEXEC
AC_MSG_CHECKING(for Apache libexec directory)
LIBEXECDIR=`${APXS} -q LIBEXECDIR`
AC_MSG_RESULT($LIBEXECDIR)
# determine INCLUDES
AC_MSG_CHECKING([for Apache include directory])
AP_INCLUDES="-I`${APXS} -q INCLUDEDIR`"
AC_MSG_RESULT($AP_INCLUDES)
dnl Small hack to work around _eprintf.o problem on Solaris
if test "`uname`" = "SunOS"; then
AC_MSG_CHECKING([for gcc on Solaris possible missing _eprintf problem])
if test "$CC" = "gcc"; then
EPRINTF_HACK="_eprintf.o"
fi
AC_MSG_RESULT("done")
fi
fi
# check for --with-apache
AC_SUBST(AP_SRC)
AC_SUBST(AP_SRC_OWN)
AC_SUBST(AP_SRC_GRP)
AC_MSG_CHECKING(for --with-apache)
AC_ARG_WITH(apache, [--with-apache=DIR Path to Apache sources],
[
AP_SRC=`cd $withval; pwd`
dnl For Apache 2.0 apxs in src/support may be usable
if test ! -f "$AP_SRC/src/include/httpd.h"; then
AC_MSG_ERROR([$withval does not look like an Apache source directory.])
fi
AC_MSG_RESULT($AP_SRC)
AP_INCLUDES="-I${AP_SRC}/src/include -I${AP_SRC}/src/os/unix"
# note who owns the apache source directory
AP_SRC_OWN="`ls -ld $AP_SRC | awk '{print $3}'`"
AP_SRC_GRP="`ls -ld $AP_SRC | awk '{print $4}'`"
],
AC_MSG_RESULT(no))
AC_SUBST(STATIC)
if test -z "$AP_SRC"; then
AC_MSG_WARN([**** No apache sources specified, static compilation will not be available.])
AC_MSG_WARN([**** You can use --with-apache to specify where your Apache sources are.])
STATIC="no_static"
else
STATIC="do_static"
fi
if test "$STATIC" = "no_static" -a "$DSO" = "no_dso"; then
AC_MSG_ERROR([Neither static nor DSO option available, there is no point in continuing.])
fi
AC_MSG_CHECKING(for --with-python)
AC_ARG_WITH(python, [--with-python=DIR Path to Python sources],
[
AC_SUBST(PYTHON_SRC)
PYTHON_SRC=`cd $withval; pwd`
AC_MSG_RESULT($PYTHON_SRC)
],
AC_MSG_RESULT(no))
# check for Python executable
if test -z "$PYTHON_SRC"; then
AC_PATH_PROG(PYTHON_BIN, python)
if test -z "$PYTHON_BIN"; then
AC_MSG_ERROR(python binary not found)
fi
else
AC_PATH_PROG(PYTHON_BIN, python, "", $PYTHON_SRC)
if test -z "$PYTHON_BIN"; then
AC_MSG_ERROR([python executable not found in ${withval},
perhaps you need to build Python first.])
fi
fi
# find out python version
AC_MSG_CHECKING(Python version)
PyVERSION=`$PYTHON_BIN -c ['import sys; print sys.version[:3]'`]
AC_MSG_RESULT($PyVERSION)
# check if python is compiled with threads
AC_MSG_CHECKING(whether Python is compiled with thread support)
PyTHREADS=`$PYTHON_BIN -c "import sys; print \"thread\" in sys.builtin_module_names"`
if test "$PyTHREADS" = "1"; then
AC_MSG_RESULT(yes)
echo
echo " ****** WARNING ******"
echo " Python is compiled with thread support. Apache 1.3 does not use threads."
echo " On some systems this will cause problems during compilation, on others "
echo " it may result in unpredictable behaviour of your Apache server. Yet on"
echo " others it will work just fine. The recommended approach is to compile"
echo " Python without thread support in a separate location and specify it with"
echo " --with-python option to this ./configure script."
echo
else
AC_MSG_RESULT([no threads, good])
fi
# find out compiled in install prefix
AC_MSG_CHECKING(Python install prefix)
PyEXEC_INSTALLDIR=`$PYTHON_BIN -c "import sys; print sys.exec_prefix"`
AC_MSG_RESULT($PyEXEC_INSTALLDIR)
# this is where the Python libraries will get installed
AC_SUBST(PY_STD_LIB)
PY_STD_LIB=${PyEXEC_INSTALLDIR}/lib/python${PyVERSION}
# set python std library variable
AC_MSG_CHECKING(what libraries Python was linked with)
AC_SUBST(LIBS)
if test -z "$PYTHON_SRC"; then
PyLIBP=${PyEXEC_INSTALLDIR}/lib/python${PyVERSION}
PyLIBPL=${PyLIBP}/config
PyPYTHONLIBS=${PyLIBPL}/libpython${PyVERSION}-pic.a
PyLIBS=`grep "^LIB[[SMC]]=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyMODLIBS=`grep "^LOCALMODLIBS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PY_LIBS="${PyPYTHONLIBS} ${PyLIBS} ${PyMODLIBS}"
else
PyPYTHONLIBS=${PYTHON_SRC}/libpython${PyVERSION}-pic.a
if test ${PyVERSION} = "2.1"; then
PyLIBS=`grep "^LIB[[SMC]]=" ${PYTHON_SRC}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyMODLIBS=`grep "^LOCALMODLIBS=" ${PYTHON_SRC}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
else
PyLIBS=`grep "^LIB[[SMC]]=" ${PYTHON_SRC}/Modules/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyMODLIBS=`grep "^LOCALMODLIBS=" ${PYTHON_SRC}/Modules/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
fi
PY_LIBS="${PyPYTHONLIBS} ${PyLIBS} ${PyMODLIBS}"
fi
## XXX this is a small work around for a weird RedHat problem
## erase -lieee from library list
if test -f /etc/redhat-release; then
PY_LIBS="`echo $PY_LIBS | sed s/-lieee//`"
fi
LIBS="${LIBS} ${PY_LIBS}"
AC_MSG_RESULT($PY_LIBS)
AC_MSG_CHECKING(linker flags used to link Python)
AC_SUBST(LDFLAGS)
if test -z "$PYTHON_SRC"; then
PyLFS=`grep "^LINKFORSHARED=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyLDFLAGS=`grep "^LDFLAGS=" ${PyLIBPL}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
LDFLAGS="${LDFLAGS} ${PyLFS} ${PyLDFLAGS}"
else
PyLFS=`grep "^LINKFORSHARED=" ${PYTHON_SRC}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PyLDFLAGS=`grep "^LDFLAGS=" ${PYTHON_SRC}/Makefile | cut -f2 -d= | tr '\011\012\015' ' '`
PY_LDFLAGS="${PyLFS} ${PyLDFLAGS}"
fi
LDFLAGS="${LDFLAGS} ${PY_LDFLAGS}"
AC_MSG_RESULT($PY_LDFLAGS)
AC_MSG_CHECKING(where Python include files are)
AC_SUBST(INCLUDES)
if test -z "$PYTHON_SRC"; then
PY_INCLUDES="-I${PyEXEC_INSTALLDIR}/include/python${PyVERSION}"
else
PY_INCLUDES="-I${PYTHON_SRC} -I${PYTHON_SRC}/Include"
fi
INCLUDES="${INCLUDES} ${AP_INCLUDES} ${PY_INCLUDES}"
AC_MSG_RESULT($PY_INCLUDES)
AC_SUBST(MKDEP)
# see if we have mkdep
AC_PATH_PROG(MKDEP, "mkdep")
if test -z "${MKDEP}"; then
# or makedepend
AC_PATH_PROG(MKDEP, "makedepend")
fi
AC_OUTPUT(Makefile src/Makefile src/libpython.module Doc/Makefile)
if test -n "$MKDEP"; then
# make dependencies
echo "analyzing dependencies"
cd src
make depend > /dev/null 2>&1
fi
|