automake
[Top][All Lists]
Advanced

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

Building and installing for multiple versions of Python using autotools


From: Faheem Mitha
Subject: Building and installing for multiple versions of Python using autotools
Date: Mon, 10 Nov 2014 11:10:26 +0530 (IST)
User-agent: Alpine 2.11 (DEB 23 2013-08-11)


Hi,

I posted the following question on Stack Overflow:
http://stackoverflow.com/q/26826825/. The text of this question
follows. My impression from searches is that the kind of functionality
I want does not exist, even though this is functionality that Debian,
along with other distributions, uses regularly. It looks like
distutils, for example, does this automatically.

I've seen references to patches to python.m4, though I don't think
I've seen anything workable.

So, let me ask this. Is this omission a policy decision, or just that the project has not got around to adding this functionality? Regardless, I'd appreciate suggestions for workarounds, the simpler the better.

                                                    Regards, Faheem Mitha

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

I'm trying to figure out how to build my project for multiple versions
of Python.  I'm testing this on Debian wheezy, where the default
version of Python is 2.7.  but 2.6 is also supported and
installed. However, automake is only installing and compiling for
Python 2.7. I'd like it to compile for 2.6 as well.

Here are the configure.ac and Makefile.am. I can provide more details if
necessary, but hopefully these will suffice.

I'm a beginner with Autotools, so there may be some obvious solution
to this.

There is what appears to be a wishlist bug about this: [RFE: build
against multiple python stacks](http://debbugs.gnu.org/17811).  There
is also a similar discussion here: [RFC: (automake) add support for
dual python 2 / python 3
builds](https://bugzilla.redhat.com/show_bug.cgi?id=533920).

There is also a proposed solution (which looks complicated), given at
[CDBS + Autotools +
Python](https://www.technovelty.org/debian/cdbs-autotools-python.html)

This is configure.ac.

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

    AC_PREREQ([2.69])
    AC_INIT([corrmodel], [0.1], address@hidden)
    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 Makefile.am.

##################################################################################
    # Define primaries
    bin_PROGRAMS = simann_ex
    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)

    simann_ex_SOURCES = simann_ex.cc
    simann_ex_LDADD = libcommon.la
    simann_ex_CPPFLAGS = $(COMMON_CPPFLAGS)
    simann_ex_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

    dist_bin_SCRIPTS = cm-genetable cm-neglogpp cm-neglogpptable cm-sim cm-cdf 
getfasta init_db cmload

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



reply via email to

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