ac-archive-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ax_python_config_var.m4


From: Dustin Mitchell
Subject: ax_python_config_var.m4
Date: Thu, 24 Jul 2003 17:23:04 -0500
User-agent: Mutt/1.4.1i

My second Python macro.  This is a collection of three closely related
macros; let me know if these should be split into separate submissions.

--snip--
dnl @synopsis AX_PYTHON_CONFIG_VAR(PY_VARIABLE, SHELL_VARIABLE)
dnl
dnl Using the Python module distutils.sysconfig[1], return a Python 
configuration
dnl variable.  PY_VARIABLE is the name of the variable to request from Python,
dnl and SHELL_VARIABLE is the name of the shell variable into which the results
dnl should be deposited.  SHELL_VARIABLE is AC_SUBST'd.  No action is taken if
dnl an error occurs.
dnl
dnl Example:
dnl
dnl   AX_PYTHON_CONFIG_VAR(LINKFORSHARED, PY_LFS)
dnl
dnl [1] http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
dnl
dnl @author Dustin Mitchell <address@hidden>
AC_DEFUN([AX_PYTHON_CONFIG_VAR],
[
 # look for the Python distribution variable $1, putting the result in $$2.
 # does nothing if an error occurs
 AC_MSG_CHECKING(for Python config variable $1)
 if test -z "$PYTHON"
 then
   AC_MSG_RESULT(no)
   AC_MSG_ERROR(Python not configured)
 fi
 # see http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
 py_error="no"
 pyval=`$PYTHON -c "from distutils import sysconfig; print 
sysconfig.get_config_var('$1')"` || py_error="yes"
 if test $py_error = "yes"
 then
   AC_MSG_RESULT(no - an error occurred)
 else
   AC_MSG_RESULT($pyval)
   $2="$pyval"
   AC_SUBST($2)
 fi
])

dnl @synopsis AX_PYTHON_CONFIG_H
dnl
dnl Using the Python module distutils.sysconfig[1], put the full pathname of
dnl the config.h file used to compile Python into the shell variable
dnl PY_CONFIG_H.  PY_CONFIG_H is AC_SUBST'd.
dnl
dnl Example:
dnl
dnl   AX_PYTHON_CONFIG_H
dnl
dnl [1] http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
dnl
dnl @author Dustin Mitchell <address@hidden>
AC_DEFUN([AX_PYTHON_CONFIG_H],
[
 # Get the full path of Python's config.h, placing it in PY_CONFIG_H; does 
nothing
 # if an error occurs
 AC_MSG_CHECKING(location of Python's config.h)
 if test -z "$PYTHON"
 then
   AC_MSG_RESULT(no)
   AC_MSG_ERROR(Python not configured)
 fi
 py_error="no"
 PY_CONFIG_H=`$PYTHON -c "from distutils import sysconfig; print 
sysconfig.get_config_h_filename()"` || py_error = "yes"
 if test $py_error = "yes"
 then
   AC_MSG_RESULT(no - an error occurred)
 else
   AC_MSG_RESULT($PY_CONFIG_H)
   AC_SUBST(PY_CONFIG_H)
 fi
])

dnl @synopsis AX_PYTHON_MAKEFILE
dnl
dnl Using the Python module distutils.sysconfig[1], put the full pathname of
dnl the Makefile file used to compile Python into the shell variable
dnl PY_MAKEFILE.  PY_MAKEFILE is AC_SUBST'd.
dnl
dnl Example:
dnl
dnl   AX_PYTHON_MAKEFILE
dnl
dnl [1] http://www.python.org/doc/current/dist/module-distutils.sysconfig.html
dnl
dnl @author Dustin Mitchell <address@hidden>
AC_DEFUN([AX_PYTHON_MAKEFILE],
[
 # Get the full path of Python's Makefile, placing it in PY_MAKEFILE; does 
nothing
 # if an error occurs
 AC_MSG_CHECKING(location of Python's Makefile)
 if test -z "$PYTHON"
 then
   AC_MSG_RESULT(no)
   AC_MSG_ERROR(Python not configured)
 fi
 py_error="no"
 PY_MAKEFILE=`$PYTHON -c "from distutils import sysconfig; print 
sysconfig.get_makefile_filename()"` || py_error = "yes"
 if test $py_error = "yes"
 then
   AC_MSG_RESULT(no - an error occurred)
 else
   AC_MSG_RESULT($PY_MAKEFILE)
   AC_SUBST(PY_MAKEFILE)
 fi
])
--snip--

-- 

  Dustin Mitchell
  address@hidden/address@hidden
  http://people.cs.uchicago.edu/~dustin/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]