tags:

views:

41

answers:

3

I have a project that links to libssl.so and I'm hitting a bug in libssl and never versions of the lib fixes it. However on the system I'm working I don't have root account so I've built libssl and prerequirements myself under $HOME/opt.

Now, when I'm doing:

./configure --prefix=`$HOME/opt`
make

the build system still uses the older system-wide version of libssl.

I'm trying to find the proper way to "hack" autotools to link with libs I've compiled.

+2  A: 

I'm not sure, but perhaps you should also add the new path to the PKG_CONFIG_PATH. That is, if your project uses PKG_CHECK_MODULES for finding libssl.

haggai_e
I do not want to modify any of my source files just to workaround my specific problem.
dpc.ucore.info
You don't need to change your source files in order to set environment variables: you can run ./configure PKG_CONFIG_PATH=$HOME/opt/lib/pkgconfig .
haggai_e
Oh, OK. Now I get it.
dpc.ucore.info
A: 

It seems that:

LDFLAGS="-L$HOME/opt/lib" ../configure --prefix="$HOME/opt"

is forcing autotools to try $HOME/opt/lib first. If anybody knows better or more general answer I'm still all ears.

dpc.ucore.info
+2  A: 

There's always ./configure LDFLAGS=-L$HOME/opt/lib CPPFLAGS=-I$HOME/opt/include. But that method globally uses headers from that prefix and globally links against libs located there. Many projects provide AC_ARG_WITHs to allow to customise paths, e.g.

AC_ARG_WITH([ssl], ...)

or

AC_ARG_WITH([ssl-prefix], ...)
AC_ARG_WITH([ssl-libs], ...)
AC_ARG_WITH([ssl-includes], ...)

in analogy to autoconf's --x-includes and --x-libraries

But I guess it's a question of personal taste.

Just noticed you don't want to change your files, in that case you could just add the library in question to the the LIBS variable, or use an rpath:

./configure LIBS="$HOME/opt/lib/libssl.so.x.y.z"

or

./configure LDFLAGS="-Wl,-rpath,$HOME/opt/lib/"
hroptatyr