This repository has been archived by the owner on Dec 6, 2018. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
config.m4
69 lines (57 loc) · 2.29 KB
/
config.m4
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
dnl $Id$
dnl config.m4 for python extension
PHP_ARG_WITH(python, for embedded Python support,
[ --with-python Include embedded Python support])
if test "$PHP_PYTHON" != "no"; then
if test "$ext_shared" = "shared" || test "$ext_shared" = "yes"; then
AC_PATH_PROG([PYTHON_CONFIG],[python-config])
else
AC_PATH_PROG([PYTHON_CONFIG],[python-shared-config])
fi
if test -z "$PYTHON_CONFIG"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR([Cannot find python-config in your system path])
fi
AC_MSG_CHECKING(for Python includes)
PYTHON_CFLAGS=`$PYTHON_CONFIG --includes`
AC_MSG_RESULT($PYTHON_CFLAGS)
AC_MSG_CHECKING(for Python libraries)
PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
AC_MSG_RESULT($PYTHON_LDFLAGS)
AC_CHECK_LIB(pthread, pthread_create, [
PYTHON_LDFLAGS="-lpthread $PYTHON_LDFLAGS"
])
AC_CHECK_LIB(dl, dlopen, [
PYTHON_LDFLAGS="-ldl $PYTHON_LDFLAGS"
])
AC_MSG_CHECKING([consistency of Python build environment])
AC_LANG_PUSH([C])
LDFLAGS="$ac_save_LDFLAGS $PYTHON_LDFLAGS"
CFLAGS="$ac_save_CFLAGS $PYTHON_CFLAGS"
AC_TRY_LINK([
#include <Python.h>
],[
Py_Initialize();
],[pythonexists=yes],[pythonexists=no])
AC_MSG_RESULT([$pythonexists])
if test ! "$pythonexists" = "yes"; then
AC_MSG_ERROR([
Could not link test program to Python. Maybe the main Python library has been
installed in some non-standard library path. If so, pass it to configure,
via the LDFLAGS environment variable.
Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
============================================================================
ERROR!
You probably have to install the development version of the Python package
for your distribution. The exact name of this package varies among them.
============================================================================
])
fi
AC_LANG_POP
CFLAGS="$ac_save_CFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
PHP_EVAL_INCLINE($PYTHON_CFLAGS)
PHP_EVAL_LIBLINE($PYTHON_LDFLAGS, PYTHON_SHARED_LIBADD)
PHP_SUBST(PYTHON_SHARED_LIBADD)
PHP_NEW_EXTENSION(python, python.c python_convert.c python_handlers.c python_object.c python_php.c python_streams.c, $ext_shared)
fi