views:

14

answers:

0

I am writing an autoconf script for a library that has some Python-based test programs. I am trying to add a conditional in the script that tests for Python devel stuff and turns these tests off or on.

I'm trying to use autoconf archive's AC_PYTHON_DEVEL macro to test for python. I'm calling it like this:

AC_PYTHON_DEVEL([>='2.3'])

However, this fails even though I have Ubuntu's python2.6-dev package installed. Looking at config.log, I see the following:

configure:12261: checking python extra libraries
configure:12268: result: -lssl -lcrypto  -lssl -lcrypto      -L/usr/lib -lz -lp\
thread -ldl  -lutil
configure:12275: checking python extra linking flags
configure:12282: result: -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functi\
ons
configure:12289: checking consistency of all components of python development e\
nvironment
configure:12313: gcc -std=gnu99 -o conftest -g -O2  -I/usr/include/python2.6  c\
onftest.c  -L/usr/lib -lpython2.6 -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbol\
ic-functions -lssl -lcrypto  -lssl -lcrypto      -L/usr/lib -lz -lpthread -ldl \
 -lutil >&5
/usr/bin/ld: cannot find -lssl
collect2: ld returned 1 exit status

It seems it is trying to link against libssl and libcrypto, even though my library doesn't use these at all. I imagine some Python modules might need to, but I don't.

Looking at the generated configure script, I can see the following code being generated:

PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \             
                conf = distutils.sysconfig.get_config_var; \                    
                print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`

When run, this outputs:

$ python -c "import distutils.sysconfig; conf = distutils.sysconfig.get_config_var; print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"
-lssl -lcrypto  -lssl -lcrypto      -L/usr/lib -lz -lpthread -ldl  -lutil

Anyone know if it's possible to get AC_PYTHON_DEVEL to work without having to install these libraries?

By the way I thought it was strange that the problem seemed to be about linking against them anyway.. looking on my system:

$ ls /usr/lib/libcrypto*
/usr/lib/libcrypto.so.0.9.8

$ ls /usr/lib/libssl*
/usr/lib/libssl3.so  /usr/lib/libssl3.so.1d  /usr/lib/libssl.so.0.9.8

It seems like the libraries are there, but there are no symlinks to them... weird.

EDIT: Okay, it looks related to many other stupid problems with libssl and libcrypto versioning. In particular it uses a non-standard versioning system which means the Debian maintainers decided not to include the standard major-version symlink.

The solution is to either force my users to install libssl-dev and libcrypto++-dev, or to not use AC_PYTHON_DEVEL. This is too bad since the only reason I need it to work is because it is called in turn by AC_PROG_SWIG. The former solution might be problematic on other target systems like OS X and MingW since they don't have the same packaging systems and it just seems stupid to fail the configure stage due to problems in libraries that I don't even technically depend on. I'll just check for the Python headers and swig manually I guess.