~ubuntu-branches/ubuntu/saucy/sssd/saucy

« back to all changes in this revision

Viewing changes to server/external/python.m4

  • Committer: Stéphane Graber
  • Date: 2011-06-15 16:23:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: stgraber@ubuntu.com-20110615162314-rbhoppnpaxfqo5q7
Merge 1.5.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl Check for python-config and substitute needed CFLAGS and LDFLAGS
2
 
dnl Usage:
3
 
dnl     AM_PYTHON_CONFIG
4
 
 
5
 
AC_DEFUN([AM_PYTHON_CONFIG],
6
 
[   AC_SUBST(PYTHON_CFLAGS)
7
 
    AC_SUBST(PYTHON_LIBS)
8
 
 
9
 
dnl We need to check for python build flags using distutils.sysconfig
10
 
dnl We cannot use python-config, as it was not available on older
11
 
dnl versions of python
12
 
    AC_PATH_PROG(PYTHON, python)
13
 
    AC_MSG_CHECKING([for working python])
14
 
    if test -x "$PYTHON"; then
15
 
        PYTHON_CFLAGS="`$PYTHON -c \"from distutils import sysconfig; \
16
 
            print '-I' + sysconfig.get_python_inc() + \
17
 
            ' -I' + sysconfig.get_python_inc(plat_specific=True) + ' ' + \
18
 
            sysconfig.get_config_var('BASECFLAGS')\"`"
19
 
        PYTHON_LIBS="`$PYTHON -c \"from distutils import sysconfig; \
20
 
            print \\\" \\\".join(sysconfig.get_config_var('LIBS').split() + \
21
 
            sysconfig.get_config_var('SYSLIBS').split()) + \
22
 
            ' -lpython' + sysconfig.get_config_var('VERSION')\"`"
23
 
            AC_MSG_RESULT([yes])
24
 
    else
25
 
        AC_MSG_ERROR([no. Please install python devel package])
26
 
    fi
27
 
])
28
 
 
29
 
dnl Taken from GNOME sources
30
 
dnl a macro to check for ability to create python extensions
31
 
dnl  AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
32
 
dnl function also defines PYTHON_INCLUDES
33
 
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
34
 
[AC_REQUIRE([AM_PATH_PYTHON])
35
 
    AC_MSG_CHECKING(for headers required to compile python extensions)
36
 
 
37
 
    dnl deduce PYTHON_INCLUDES
38
 
    py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
39
 
    py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
40
 
    PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
41
 
    if test "$py_prefix" != "$py_exec_prefix"; then
42
 
        PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
43
 
    fi
44
 
 
45
 
    AC_SUBST(PYTHON_INCLUDES)
46
 
 
47
 
    dnl check if the headers exist:
48
 
    save_CPPFLAGS="$CPPFLAGS"
49
 
    CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
50
 
    AC_TRY_CPP([#include <Python.h>],dnl
51
 
               [AC_MSG_RESULT([found])
52
 
                $1],dnl
53
 
               [AC_MSG_RESULT([not found])
54
 
               $2])
55
 
    CPPFLAGS="$save_CPPFLAGS"
56
 
])
57
 
 
58