File: python.m4

package info (click to toggle)
libpff 20120802-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 13,524 kB
  • ctags: 6,784
  • sloc: ansic: 214,206; sh: 11,485; makefile: 1,229; python: 138; java: 137; sed: 16
file content (82 lines) | stat: -rw-r--r-- 1,842 bytes parent folder | download | duplicates (2)
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
dnl Functions for Python bindings
dnl
dnl Version: 20111006

dnl Function to detect if Python build environment is available
AC_DEFUN([AX_PYTHON_CHECK],
 [AC_REQUIRE([AM_PATH_PYTHON])

 dnl Check for Python include path
 AC_MSG_CHECKING(
  [for Python include path])

 PYTHON_INCLUDE_DIR=`$PYTHON -c "import distutils.sysconfig;print distutils.sysconfig.get_python_inc() "`;
 AC_MSG_RESULT(
  [$PYTHON_INCLUDE_DIR])

 AC_SUBST(
  [PYTHON_CPPFLAGS],
  [-I$PYTHON_INCLUDE_DIR])

 AS_IF(
  [test ! -r $PYTHON_INCLUDE_DIR/Python.h],
  [AC_MSG_ERROR(
  [Missing Python include file]) ])

 dnl Check for Python library path
 AC_MSG_CHECKING(
  [for Python library path])

 python_path=`$PYTHON -c "import distutils.sysconfig;print distutils.sysconfig.get_python_lib() "`;
 AC_MSG_RESULT(
  [$python_path])

 AC_SUBST(
  [PYTHON_LDFLAGS],
  ["-L$python_path -lpython$PYTHON_VERSION"])

 python_site=`echo $python_path | sed "s/config/site-packages/"`;

 AC_SUBST(
  [PYTHON_SITE_PKG],
  [$python_site])

 dnl Determine the Python libraries which must be linked in when embedding
 AC_MSG_CHECKING(
  [for Python extra libraries])

 PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig;conf = distutils.sysconfig.get_config_var;print conf('LOCALMODLIBS')+' '+conf('LIBS')"`;
 AC_MSG_RESULT(
  [$PYTHON_EXTRA_LIBS])

 AC_SUBST(
 [PYTHON_EXTRA_LIBS])
 ])

dnl Function to detect if to enable Python
AC_DEFUN([AX_PYTHON_CHECK_ENABLE],
 [AX_COMMON_ARG_ENABLE(
  [python],
  [python],
  [build Python bindings],
  [no])

 AS_IF(
  [test "x$ac_cv_enable_python" != xno],
  [AM_PATH_PYTHON([2.5])
  AX_PYTHON_CHECK
  ac_cv_enable_python=yes])

 AS_IF(
  [test "x$ac_cv_enable_python" = xyes],
  [AC_DEFINE(
   [HAVE_PYTHON],
   [1],
   [Define to 1 if you have Python])
  ])

 AM_CONDITIONAL(
  HAVE_PYTHON,
  [test "x$ac_cv_enable_python" = xyes])
])