adding m4 dir
This commit is contained in:
1
m4/Makefile.am
Normal file
1
m4/Makefile.am
Normal file
@@ -0,0 +1 @@
|
||||
EXTRA_DIST = as-version.m4 as-python.m4
|
||||
220
m4/as-python.m4
Normal file
220
m4/as-python.m4
Normal file
@@ -0,0 +1,220 @@
|
||||
dnl as-python.m4 0.1.1
|
||||
dnl autostars m4 macro for python checks
|
||||
|
||||
dnl From Andrew Dalke
|
||||
dnl Updated by James Henstridge
|
||||
dnl Updated by Andy Wingo to loop through possible pythons
|
||||
dnl Updated by Thomas Vander Stichele to check for presence of packages/modules
|
||||
|
||||
dnl $Id: as-python.m4,v 1.3 2006/02/28 16:49:31 thomasvs Exp $
|
||||
|
||||
# AS_PATH_PYTHON([MINIMUM-VERSION])
|
||||
|
||||
# Adds support for distributing Python modules and packages. To
|
||||
# install modules, copy them to $(pythondir), using the python_PYTHON
|
||||
# automake variable. To install a package with the same name as the
|
||||
# automake package, install to $(pkgpythondir), or use the
|
||||
# pkgpython_PYTHON automake variable.
|
||||
|
||||
# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as
|
||||
# locations to install python extension modules (shared libraries).
|
||||
# Another macro is required to find the appropriate flags to compile
|
||||
# extension modules.
|
||||
|
||||
# If your package is configured with a different prefix to python,
|
||||
# users will have to add the install directory to the PYTHONPATH
|
||||
# environment variable, or create a .pth file (see the python
|
||||
# documentation for details).
|
||||
|
||||
# If the MINIMUM-VERSION argument is passed, AS_PATH_PYTHON will
|
||||
# cause an error if the version of python installed on the system
|
||||
# doesn't meet the requirement. MINIMUM-VERSION should consist of
|
||||
# numbers and dots only.
|
||||
|
||||
# Updated to loop over all possible python binaries by Andy Wingo
|
||||
# <wingo@pobox.com>
|
||||
|
||||
AC_DEFUN([AS_PATH_PYTHON],
|
||||
[
|
||||
dnl Find a version of Python. I could check for python versions 1.4
|
||||
dnl or earlier, but the default installation locations changed from
|
||||
dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
|
||||
dnl in 1.5, and I don't want to maintain that logic.
|
||||
|
||||
dnl should we do the version check?
|
||||
ifelse([$1],[],
|
||||
[AC_PATH_PROG(PYTHON, python python2.1 python2.0 python1.6 python1.5)],
|
||||
[
|
||||
AC_MSG_NOTICE(Looking for Python version >= $1)
|
||||
changequote(<<, >>)dnl
|
||||
prog="
|
||||
import sys, string
|
||||
minver = '$1'
|
||||
pyver = string.split(sys.version)[0] # first word is version string
|
||||
# split strings by '.'. just compare textually to allow for versions like
|
||||
# 2.4.1a0
|
||||
minver = string.split(minver, '.')
|
||||
pyver = string.split(pyver, '.')
|
||||
# we can now do comparisons on the two lists:
|
||||
if pyver >= minver:
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)"
|
||||
changequote([, ])dnl
|
||||
|
||||
python_good=false
|
||||
for python_candidate in python python2.2 python2.1 python2.0 python2 python1.6 python1.5; do
|
||||
unset PYTHON
|
||||
AC_PATH_PROG(PYTHON, $python_candidate) 1> /dev/null 2> /dev/null
|
||||
|
||||
if test "x$PYTHON" = "x"; then continue; fi
|
||||
|
||||
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC; then
|
||||
AC_MSG_CHECKING(["$PYTHON":])
|
||||
AC_MSG_RESULT([okay])
|
||||
python_good=true
|
||||
break;
|
||||
else
|
||||
dnl clear the cache val
|
||||
unset ac_cv_path_PYTHON
|
||||
fi
|
||||
done
|
||||
])
|
||||
|
||||
if test "$python_good" != "true"; then
|
||||
AC_MSG_ERROR([No suitable version of python found])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([local Python configuration])
|
||||
|
||||
dnl Query Python for its version number. Getting [:3] seems to be
|
||||
dnl the best way to do this; it's what "site.py" does in the standard
|
||||
dnl library. Need to change quote character because of [:3]
|
||||
|
||||
AC_SUBST(PYTHON_VERSION)
|
||||
changequote(<<, >>)dnl
|
||||
PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"`
|
||||
changequote([, ])dnl
|
||||
|
||||
|
||||
dnl Use the values of $prefix and $exec_prefix for the corresponding
|
||||
dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made
|
||||
dnl distinct variables so they can be overridden if need be. However,
|
||||
dnl general consensus is that you shouldn't need this ability.
|
||||
|
||||
AC_SUBST(PYTHON_PREFIX)
|
||||
PYTHON_PREFIX='${prefix}'
|
||||
|
||||
AC_SUBST(PYTHON_EXEC_PREFIX)
|
||||
PYTHON_EXEC_PREFIX='${exec_prefix}'
|
||||
|
||||
dnl At times (like when building shared libraries) you may want
|
||||
dnl to know which OS platform Python thinks this is.
|
||||
|
||||
AC_SUBST(PYTHON_PLATFORM)
|
||||
PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"`
|
||||
|
||||
|
||||
dnl Set up 4 directories:
|
||||
|
||||
dnl pythondir -- where to install python scripts. This is the
|
||||
dnl site-packages directory, not the python standard library
|
||||
dnl directory like in previous automake betas. This behaviour
|
||||
dnl is more consistent with lispdir.m4 for example.
|
||||
dnl
|
||||
dnl Also, if the package prefix isn't the same as python's prefix,
|
||||
dnl then the old $(pythondir) was pretty useless.
|
||||
|
||||
AC_SUBST(pythondir)
|
||||
pythondir=$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
|
||||
|
||||
dnl pkgpythondir -- $PACKAGE directory under pythondir. Was
|
||||
dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is
|
||||
dnl more consistent with the rest of automake.
|
||||
dnl Maybe this should be put in python.am?
|
||||
|
||||
AC_SUBST(pkgpythondir)
|
||||
pkgpythondir=\${pythondir}/$PACKAGE
|
||||
|
||||
dnl pyexecdir -- directory for installing python extension modules
|
||||
dnl (shared libraries) Was PYTHON_SITE_EXEC in previous betas.
|
||||
|
||||
AC_SUBST(pyexecdir)
|
||||
pyexecdir=$PYTHON_EXEC_PREFIX"/lib/python"$PYTHON_VERSION/site-packages
|
||||
|
||||
dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)
|
||||
dnl Maybe this should be put in python.am?
|
||||
|
||||
AC_SUBST(pkgpyexecdir)
|
||||
pkgpyexecdir=\${pyexecdir}/$PACKAGE
|
||||
|
||||
AC_MSG_RESULT([looks good])
|
||||
])
|
||||
|
||||
dnl AS_PYTHON_IMPORT(PACKAGE/MODULE, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND, [PREAMBLE, [POSTAMBLE]]]])
|
||||
dnl Try to import the given PACKAGE/MODULE
|
||||
|
||||
AC_DEFUN([AS_PYTHON_IMPORT],
|
||||
[
|
||||
dnl Check if we can import a given module.
|
||||
dnl Requires AS_PATH_PYTHON to be called before.
|
||||
dnl PREAMBLE and POSTAMBLE, if given, is code executed right before and after
|
||||
dnl the import
|
||||
|
||||
AC_MSG_CHECKING([for python module $1])
|
||||
|
||||
prog="
|
||||
import sys
|
||||
|
||||
try:
|
||||
$4
|
||||
import $1
|
||||
$5
|
||||
sys.exit(0)
|
||||
except ImportError:
|
||||
sys.exit(1)
|
||||
except SystemExit:
|
||||
raise
|
||||
except Exception, e:
|
||||
print ' Error while trying to import $1:'
|
||||
print ' %r: %s' % (e, e)
|
||||
sys.exit(1)"
|
||||
|
||||
if $PYTHON -c "$prog" 1>&AC_FD_CC 2>&AC_FD_CC
|
||||
then
|
||||
AC_MSG_RESULT(found)
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(not found)
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl a macro to check for ability to create python extensions
|
||||
dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE])
|
||||
dnl function also defines PYTHON_INCLUDES
|
||||
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
|
||||
[
|
||||
AC_REQUIRE([AM_PATH_PYTHON])
|
||||
AC_MSG_CHECKING(for headers required to compile python extensions)
|
||||
|
||||
dnl deduce PYTHON_INCLUDES
|
||||
py_prefix=`$PYTHON -c "import sys; print sys.prefix"`
|
||||
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"`
|
||||
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
|
||||
|
||||
if test "$py_prefix" != "$py_exec_prefix"; then
|
||||
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}"
|
||||
fi
|
||||
AC_SUBST(PYTHON_INCLUDES)
|
||||
|
||||
dnl check if the headers exist:
|
||||
save_CPPFLAGS="$CPPFLAGS"
|
||||
CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES"
|
||||
AC_TRY_CPP([#include <Python.h>],dnl
|
||||
[AC_MSG_RESULT(found)
|
||||
$1],dnl
|
||||
[AC_MSG_RESULT(not found)
|
||||
$2])
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
])
|
||||
71
m4/as-version.m4
Normal file
71
m4/as-version.m4
Normal file
@@ -0,0 +1,71 @@
|
||||
dnl as-version.m4 0.2.0
|
||||
|
||||
dnl autostars m4 macro for versioning
|
||||
|
||||
dnl Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
dnl $Id: as-version.m4,v 1.4 2004/06/01 09:40:05 thomasvs Exp $
|
||||
|
||||
dnl AS_VERSION
|
||||
|
||||
dnl example
|
||||
dnl AS_VERSION
|
||||
|
||||
dnl this macro
|
||||
dnl - AC_SUBST's PACKAGE_VERSION_MAJOR, _MINOR, _MICRO
|
||||
dnl - AC_SUBST's PACKAGE_VERSION_RELEASE,
|
||||
dnl which can be used for rpm release fields
|
||||
dnl - doesn't call AM_INIT_AUTOMAKE anymore because it prevents
|
||||
dnl maintainer mode from running correctly
|
||||
dnl
|
||||
dnl don't forget to put #undef PACKAGE_VERSION_RELEASE in acconfig.h
|
||||
dnl if you use acconfig.h
|
||||
|
||||
AC_DEFUN([AS_VERSION],
|
||||
[
|
||||
PACKAGE_VERSION_MAJOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f1)
|
||||
PACKAGE_VERSION_MINOR=$(echo AC_PACKAGE_VERSION | cut -d'.' -f2)
|
||||
PACKAGE_VERSION_MICRO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f3)
|
||||
|
||||
AC_SUBST(PACKAGE_VERSION_MAJOR)
|
||||
AC_SUBST(PACKAGE_VERSION_MINOR)
|
||||
AC_SUBST(PACKAGE_VERSION_MICRO)
|
||||
])
|
||||
|
||||
dnl AS_NANO(ACTION-IF-NO-NANO, [ACTION-IF-NANO])
|
||||
|
||||
dnl requires AC_INIT to be called before
|
||||
dnl For projects using a fourth or nano number in your versioning to indicate
|
||||
dnl development or prerelease snapshots, this macro allows the build to be
|
||||
dnl set up differently accordingly.
|
||||
|
||||
dnl this macro:
|
||||
dnl - parses AC_PACKAGE_VERSION, set by AC_INIT, and extracts the nano number
|
||||
dnl - sets the variable PACKAGE_VERSION_NANO
|
||||
dnl - sets the variable PACKAGE_VERSION_RELEASE, which can be used
|
||||
dnl for rpm release fields
|
||||
dnl - executes ACTION-IF-NO-NANO or ACTION-IF-NANO
|
||||
|
||||
dnl example:
|
||||
dnl AS_NANO(RELEASE="yes", RELEASE="no")
|
||||
|
||||
AC_DEFUN([AS_NANO],
|
||||
[
|
||||
AC_MSG_CHECKING(nano version)
|
||||
|
||||
NANO=$(echo AC_PACKAGE_VERSION | cut -d'.' -f4)
|
||||
|
||||
if test x"$NANO" = x || test "x$NANO" = "x0" ; then
|
||||
AC_MSG_RESULT([0 (release)])
|
||||
NANO=0
|
||||
PACKAGE_VERSION_RELEASE=1
|
||||
ifelse([$1], , :, [$1])
|
||||
else
|
||||
AC_MSG_RESULT($NANO)
|
||||
PACKAGE_VERSION_RELEASE=0.`date +%Y%m%d.%H%M%S`
|
||||
ifelse([$2], , :, [$2])
|
||||
fi
|
||||
PACKAGE_VERSION_NANO=$NANO
|
||||
AC_SUBST(PACKAGE_VERSION_NANO)
|
||||
AC_SUBST(PACKAGE_VERSION_RELEASE)
|
||||
])
|
||||
51
m4/pychecker.mk
Normal file
51
m4/pychecker.mk
Normal file
@@ -0,0 +1,51 @@
|
||||
# configure.ac needs to AM_CONDITIONAL HAVE_PYCHECKER
|
||||
|
||||
if HAVE_PYCHECKER
|
||||
check-local-pychecker: pychecker
|
||||
else
|
||||
check-local-pychecker:
|
||||
echo "Pychecker not found, passing"
|
||||
endif
|
||||
|
||||
# include this snippet for the pychecker stuff
|
||||
# Makefile.am needs to define
|
||||
# PYCHECKER_WHITELIST
|
||||
# and
|
||||
# PYCHECKER_BLACKLIST
|
||||
|
||||
pychecker_setup = `ls $(top_srcdir)/misc/setup.py 2> /dev/null`
|
||||
pychecker_help = `ls $(top_srcdir)/misc/pycheckerhelp.py 2> /dev/null`
|
||||
pychecker = \
|
||||
pychecker -Q -F misc/pycheckerrc \
|
||||
$(pychecker_setup) \
|
||||
$(pychecker_help)
|
||||
|
||||
# during distcheck, we get executed from $(NAME)-$(VERSION)/_build, while
|
||||
# our python sources are one level up. Figure this out and set a OUR_PATH
|
||||
# this uses Makefile syntax, so we need to protect it from automake
|
||||
thisdir = $(shell basename `pwd`)
|
||||
OUR_PATH = $(if $(subst _build,,$(thisdir)),$(shell pwd),$(shell pwd)/..)
|
||||
|
||||
pychecker_files = $(filter-out $(PYCHECKER_BLACKLIST),$(wildcard $(PYCHECKER_WHITELIST)))
|
||||
|
||||
# we redirect stderr so we don't get messages like
|
||||
# warning: couldn't find real module for class SSL.Error (module name: SSL)
|
||||
# which can't be turned off in pychecker
|
||||
pycheckersplit:
|
||||
@echo running pychecker on each file ...
|
||||
@for file in $(pychecker_all_files)
|
||||
do \
|
||||
$(pychecker) $$file > /dev/null 2>&1 \
|
||||
if test $$? -ne 0; then \
|
||||
echo "Error on $$file"; \
|
||||
$(pychecker) $$file; break \
|
||||
fi \
|
||||
done
|
||||
|
||||
pychecker:
|
||||
@echo running pychecker ...
|
||||
@$(pychecker) $(pychecker_files) 2>/dev/null || make pycheckerverbose
|
||||
|
||||
pycheckerverbose:
|
||||
@echo "running pychecker (verbose) ..."
|
||||
$(pychecker) $(pychecker_files)
|
||||
Reference in New Issue
Block a user