Building and installing multiple Python versions using autotools

I am trying to figure out how to build my project for multiple Python versions. I am testing this on Debian wheezy where the default Python version is 2.7. but 2.6 is also supported and installed. However, automake only installs and compiles for Python 2.7. I would like it to compile for 2.6 too.

Here are the settings for configure.ac and Makefile.am. I can provide more details if needed, but hopefully enough will be enough.

I am starting with Autotools, so there might be some obvious solution.

Here's what looks like a bug in the wishlist: RFE: Build against multiple python stacks . There is also a similar discussion here: RFC: (automake) add support for two versions of python 2 / python 3 .

There is also a suggested solution (which looks complicated) given in CDBS + Autotools + Python

This is configure.ac.

##################################################################################
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([corrmodel], [0.1], [faheem@faheem.info])
AM_INIT_AUTOMAKE([foreign -Wall -Werror -Wno-extra-portability parallel-tests])
AM_MAINTAINER_MODE
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PATH_PYTHON([2.6])

# Checks for libraries.
AX_BOOST_BASE
AX_BOOST_PYTHON

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

#AC_CONFIG_SUBDIRS([hello/hello-2.9])
LT_INIT
AC_OUTPUT
##################################################################################

      

Here is the Makefile.am.

##################################################################################
# Define primaries
noinst_LTLIBRARIES = libcommon.la
dist_sysconf_DATA = corrmodel/default_conf.yaml

COMMON_CPPFLAGS = -I /usr/include/python$(PYTHON_VERSION) -L/usr/lib/python$(PYTHON_VERSION)/config -ftemplate-depth-100 -fno-strict-aliasing -fno-common -ansi -Wextra -Wall -Werror -Wno-unused-function -Wc++0x-compat -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -std=c++11 -march=native -mtune=native -mfpmath=sse -msse3 -O3 -DBOOST_PYTHON_DYNAMIC_LIB -DBOOST_PYTHON_MAX_ARITY=20
libcommon_la_SOURCES = randutil.cc util.cc gendata_fn.cc model.cc score_fn.cc search_fn.cc pval.cc print.cc \
                       common.hh util.hh model.hh gendata_fn.hh randutil.hh score_fn.hh search_fn.hh pval.hh \
                       print.hh
COMMON_LDFLAGS = -lblitz -lRmath -lpython$(PYTHON_VERSION) -lm -lboost_python
libcommon_la_CPPFLAGS = $(COMMON_CPPFLAGS)
#libcommon_la_LDFLAGS = $(COMMON_LDFLAGS)

# name of Python library.
# See http://www.gnu.org/software/automake/manual/html_node/Python.html
pkgpyexec_LTLIBRARIES = cpplib.la
cpplib_la_SOURCES = cpparr_conv_pif.cc cppmap_conv_pif.cc cpppair_conv_pif.cc cppset_conv_pif.cc cpptup_conv_pif.cc \
                    cppvec_conv_pif.cc cppunicode_conv_pif.cc util_pif.cc gendata_fn_pif.cc model_pif.cc score_fn_pif.cc \
                    search_fn_pif.cc pval_pif.cc main.cc conv_pif.hh util_pif.hh gendata_fn_pif.hh score_fn_pif.hh search_fn_pif.hh
cpplib_la_CPPFLAGS = $(COMMON_CPPFLAGS)
cpplib_la_LDFLAGS = -module -avoid-version -share $(COMMON_LDFLAGS)

cpplib_la_LIBADD = libcommon.la

ACLOCAL_AMFLAGS = -I m4

pkgpython_PYTHON =  corrmodel/dbschema.py corrmodel/__init__.py corrmodel/init_schema.py  corrmodel/modeldist.py corrmodel/crossval.py corrmodel/dbutils.py corrmodel/getmodel.py corrmodel/load.py corrmodel/utils.py

##################################################################################

      

+3
python build-process autotools automake


source to share


No one has answered this question yet

Check out similar questions:

5504
Does Python have a ternary conditional operator?
5231
What are metaclasses in Python?
4473
Calling an external command in Python
3790
How can I safely create a subdirectory?
3602
Does Python have a substring method "contains"?
3119
What is the difference between Python list methods that are appended and expanded?
2818
Finding the index of an element by specifying the list that contains it in Python
2601
How can I make a time delay in Python?
2568
How to find the current time in Python
2453
How do I install pip on Windows?



All Articles
Loading...
X
Show
Funny
Dev
Pics