File: configure.ac

package info (click to toggle)
mod-wsgi 4.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,712 kB
  • ctags: 859
  • sloc: ansic: 12,521; python: 1,842; makefile: 224; sh: 159
file content (172 lines) | stat: -rw-r--r-- 5,711 bytes parent folder | download
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
dnl  vim: set sw=4 expandtab :
dnl
dnl  Copyright 2007-2014 GRAHAM DUMPLETON
dnl 
dnl  Licensed under the Apache License, Version 2.0 (the "License");
dnl  you may not use this file except in compliance with the License.
dnl  You may obtain a copy of the License at
dnl 
dnl      http://www.apache.org/licenses/LICENSE-2.0
dnl 
dnl  Unless required by applicable law or agreed to in writing, software
dnl  distributed under the License is distributed on an "AS IS" BASIS,
dnl  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
dnl  See the License for the specific language governing permissions and
dnl  limitations under the License.

dnl Process this file with autoconf to produce a configure script.

AC_INIT(src/server/mod_wsgi.c)

AC_ARG_ENABLE(framework, AC_HELP_STRING([--enable-framework],
            [enable mod_wsgi framework link]),
            [ENABLE_FRAMEWORK=$enableval],
	    [ENABLE_FRAMEWORK=false])

AC_ARG_ENABLE(embedded, AC_HELP_STRING([--disable-embedded],
            [disable mod_wsgi embedded mode]),
            [ENABLE_EMBEDDED=$enableval],
	    [ENABLE_EMBEDDED=yes])

AC_ARG_WITH(apxs, AC_HELP_STRING([--with-apxs=NAME],
            [name of the apxs executable [[apxs]]]),
            [APXS="$with_apxs"])

if test -z "${APXS}"; then
    AC_PATH_PROGS(APXS, apxs2 apxs, [apxs],
                   [$PATH:/usr/local/apache/bin:/usr/sbin])
fi

XCODE_PREFIX="/Applications/Xcode.app/Contents/Developer/Toolchains/"
XCODE_CC="${XCODE_PREFIX}XcodeDefault.xctoolchain/usr/bin/cc"

if test -x "${APXS}"; then
    APXS_CC=`${APXS} -q CC`
    APXS_LIBTOOL=`${APXS} -q LIBTOOL | sed -e "s/ .*$//"`
    if [[[ ${APXS_CC} = ${XCODE_PREFIX}* ]]]; then
        cat "${APXS_LIBTOOL}" | sed -e \
            "s/OSX10.[[89]].xctoolchain/XcodeDefault.xctoolchain/" > ./libtool
        cat "${APXS}" | sed -e "s%get_vars(\"CC\")%\"${XCODE_CC}\"%" \
            -e 's%^my $libtool = .*;%my $libtool = \"./libtool\";%' > ./apxs
        chmod +x ./apxs ./libtool
        APXS=./apxs
    fi
fi

AC_SUBST(APXS)

AC_CHECK_FUNCS(prctl)

AC_MSG_CHECKING(Apache version)
HTTPD="`${APXS} -q SBINDIR`/`${APXS} -q TARGET`"
HTTPD_INCLUDEDIR="`${APXS} -q INCLUDEDIR`"
if test -x ${HTTPD}; then
    HTTPD_VERSION=`${HTTPD} -v | awk '/version/ {print $3}' \
     | awk -F/ '{print $2}'`
else
    if test -f ${HTTPD_INCLUDEDIR}/ap_release.h; then
        HTTPD_VERSION=`grep '^#define AP_SERVER_MAJORVERSION_NUMBER ' \
         ${HTTPD_INCLUDEDIR}/ap_release.h | sed -e \
         's/^#define AP_SERVER_MAJORVERSION_NUMBER \([0-9]\).*/\1.X/'`
    else
        if test -f ${HTTPD_INCLUDEDIR}/httpd.h; then
            HTTPD_VERSION=`grep '^#define APACHE_RELEASE ' \
             ${HTTPD_INCLUDEDIR}/httpd.h | sed -e \
             's/^#define APACHE_RELEASE \([0-9]\).*/\1.X/'`
        else
            HTTPD_VERSION="2.?"
        fi
    fi
fi
AC_MSG_RESULT($HTTPD_VERSION)

AC_ARG_WITH(python, AC_HELP_STRING([--with-python=NAME],
            [name of the python executable [[python]]]),
            [PYTHON="$with_python"])

if test -z "${PYTHON}"; then
    AC_PATH_PROGS(PYTHON, python, [python],
                   [$PATH:/usr/local/bin])
fi

AC_SUBST(PYTHON)

PYTHON_VERSION=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("VERSION"))'`

PYTHON_LDVERSION=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("LDVERSION") or "")'`

if test x"${PYTHON_LDVERSION}" = x""; then
    PYTHON_LDVERSION=${PYTHON_VERSION}
fi

CPPFLAGS1=`${PYTHON}-config --includes`
[CPPFLAGS2=`${PYTHON}-config --cflags | sed 's|^-[^D][^ ]*||g; s| -[^D][^ ]*||g; s|^ ||; s| *$||g'`]

if test "${ENABLE_EMBEDDED}" != "yes"; then
CPPFLAGS3="-DMOD_WSGI_DISABLE_EMBEDDED"
else
CPPFLAGS3=""
fi

CPPFLAGS="${CPPFLAGS} ${CPPFLAGS1} ${CPPFLAGS2} ${CPPFLAGS3}"

AC_SUBST(CPPFLAGS)

PYTHONLIBDIR=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("LIBDIR"))'`
PYTHONCFGDIR=`${PYTHON} -c 'from sys import stdout; \
    import distutils.sysconfig; \
    stdout.write(distutils.sysconfig.get_python_lib(plat_specific=1, \
    standard_lib=1) +"/config")'`
PYTHONFRAMEWORKDIR=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'`
PYTHONFRAMEWORKPREFIX=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKPREFIX"))'`
PYTHONFRAMEWORK=`${PYTHON} -c 'from sys import stdout; \
    from distutils import sysconfig; \
    stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORK"))'`

if test "${PYTHON_LDVERSION}" != "${PYTHON_VERSION}"; then
    PYTHONCFGDIR="${PYTHONCFGDIR}-${PYTHON_LDVERSION}"
fi

[LDFLAGS1=`${PYTHON}-config --ldflags | sed 's|^-L[^ ]*||g; s| -L[^ ]*||g; s|^ ||; s| *$||g'`]
[LDLIBS1=`${PYTHON}-config --ldflags | sed 's|^-l[^ ]*||g; s| -l[^ ]*||g; s|^ ||; s| *$||g'`]

CFLAGS1=""
for arg in ${CFLAGS}
do
    CFLAGS1="${CFLAGS1} -Wc,$arg"
done

CFLAGS2=""
if test -x /usr/bin/lipo; then
    LDFLAGS3=""
    ARCHITECTURES=`/usr/bin/lipo -info $HTTPD | sed -e 's/.*://'`
    for ARCH in $ARCHITECTURES; do
        CFLAGS2="${CFLAGS2} -Wc,'-arch ${ARCH}'" 
        LDFLAGS3="${LDFLAGS3} -arch ${ARCH}" 
    done
fi

CFLAGS="${CFLAGS1} ${CFLAGS2}"
LDFLAGS="${LDFLAGS} ${LDFLAGS1} ${LDFLAGS3}"
LDLIBS="${LDLIBS} ${LDLIBS1}"

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LDLIBS)

LIBEXECDIR="`${APXS} -q LIBEXECDIR`"
AC_SUBST(LIBEXECDIR)

HTTPD_MAJOR_VERSION=`echo ${HTTPD_VERSION} | sed -e 's/\..*//'`

AC_OUTPUT(Makefile)