source: git/m4/ax_python_config_var.m4 @ 84b294

jengelh-datetimespielwiese
Last change on this file since 84b294 was 84b294, checked in by Oleksandr Motsak <motsak@…>, 10 years ago
python-related autoconf macro for pyobjects
  • Property mode set to 100644
File size: 3.3 KB
Line 
1# ===========================================================================
2#   http://www.gnu.org/software/autoconf-archive/ax_python_config_var.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_PYTHON_CONFIG_VAR(PYTHON_VARIABLE, [SHELL_VARIABLE])
8#   AX_PYTHON_CONFIG_H
9#   AX_PYTHON_MAKEFILE
10#
11# DESCRIPTION
12#
13#   AX_PYTHON_CONFIG_VAR:
14#
15#   Using the Python module distutils.sysconfig[1], return a Python
16#   configuration variable. PYTHON_VARIABLE is the name of the variable to
17#   request from Python, and SHELL_VARIABLE is the name of the shell
18#   variable into which the results should be deposited. If SHELL_VARIABLE
19#   is not specified, the macro wil prefix PY_ to the PYTHON_VARIABLE, e.g.,
20#   LIBS -> PY_LIBS.
21#
22#   SHELL_VARIABLE is AC_SUBST'd. No action is taken if an error occurs.
23#   Note if $PYTHON is not set, AC_CHECK_PROG(PYTHON, python, python) will
24#   be run.
25#
26#   Example:
27#
28#     AX_PYTHON_CONFIG_VAR(LINKFORSHARED, PY_LFS)
29#
30#   AX_PYTHON_CONFIG_H:
31#
32#   Using the Python module distutils.sysconfig[1], put the full pathname of
33#   the config.h file used to compile Python into the shell variable
34#   PY_CONFIG_H. PY_CONFIG_H is AC_SUBST'd. Note if $PYTHON is not set,
35#   AC_CHECK_PROG(PYTHON, python, python) will be run.
36#
37#   AX_PYTHON_MAKEFILE:
38#
39#   Using the Python module distutils.sysconfig[1], put the full pathname of
40#   the Makefile file used to compile Python into the shell variable
41#   PY_MAKEFILE. PY_MAKEFILE is AC_SUBST'd. Note if $PYTHON is not set,
42#   AC_CHECK_PROG(PYTHON, python, python) will be run.
43#
44#   [1]
45#   http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
46#
47# LICENSE
48#
49#   Copyright (c) 2008 Dustin J. Mitchell <dustin@cs.uchicago.edu>
50#
51#   Copying and distribution of this file, with or without modification, are
52#   permitted in any medium without royalty provided the copyright notice
53#   and this notice are preserved. This file is offered as-is, without any
54#   warranty.
55
56#serial 9
57
58AC_DEFUN([AX_PYTHON_CONFIG_VAR],
59[
60 AC_MSG_CHECKING(for Python config variable $1)
61 if test -z "$PYTHON"
62 then
63   AC_CHECK_PROG(PYTHON,python,python)
64 fi
65 py_error="no"
66 pyval=`$PYTHON -c "from distutils import sysconfig;dnl
67print sysconfig.get_config_var('$1')"` || py_error="yes"
68 if test "$py_error" = "yes"
69 then
70   AC_MSG_RESULT(no - an error occurred)
71 else
72   AC_MSG_RESULT($pyval)
73   m4_ifval([$2],[$2],[PY_$1])="$pyval"
74   AC_SUBST(m4_ifval([$2],[$2],[PY_$1]))
75 fi
76])
77
78AC_DEFUN([AX_PYTHON_CONFIG_H],
79[
80 AC_MSG_CHECKING(location of Python's config.h)
81 if test -z "$PYTHON"
82 then
83   AC_CHECK_PROG(PYTHON,python,python)
84 fi
85 py_error="no"
86 PY_CONFIG_H=`$PYTHON -c "from distutils import sysconfig;dnl
87print sysconfig.get_config_h_filename()"` || py_error = "yes"
88 if test "$py_error" = "yes"
89 then
90   AC_MSG_RESULT(no - an error occurred)
91 else
92   AC_MSG_RESULT($PY_CONFIG_H)
93   AC_SUBST(PY_CONFIG_H)
94 fi
95])
96
97AC_DEFUN([AX_PYTHON_MAKEFILE],
98[
99 AC_MSG_CHECKING(location of Python's Makefile)
100 if test -z "$PYTHON"
101 then
102   AC_CHECK_PROG(PYTHON,python,python)
103 fi
104 py_error="no"
105 PY_MAKEFILE=`$PYTHON -c "from distutils import sysconfig;dnl
106print sysconfig.get_makefile_filename()"` || py_error = "yes"
107 if test "$py_error" = "yes"
108 then
109   AC_MSG_RESULT(no - an error occurred)
110 else
111   AC_MSG_RESULT($PY_MAKEFILE)
112   AC_SUBST(PY_MAKEFILE)
113 fi
114])
Note: See TracBrowser for help on using the repository browser.