Installation is quite easy:
wget http://www.opensc.org/files/libp11-0.1.tar.gz tar xfvz libp11-0.1.tar.gz cd libp11-0.1 ./configure --prefix=/usr make make install
is all you need. Libp11 depends on pkg-config, openssl and libltdl.
If you don't have pkg-config installed, please do so and try again. If pkg-config is not found, please change your PATH environment setting.
If openssl is not installed, please do so. If openssl is not found, please change your PKG_CONFIG_PATH environment setting to include the directory with "openssl.pc" file. Some linux distributions split openssl into a runtime package and a development package, you need to install both.
Libltdl3 is shipped with most linux distribution. It can be either found in the libtool package, or in a seperate libltdl3 package, some distributions even have a runtime and a development package, in those case you need to install both.
To compile libp11 on Windows extract the source with 7-zip, winzip or a similar application, and edit the file src/Makefile.mak, edit these lines:
LIBLTDL_INC = # E.g. /IC:\libtool-1.5.8-lib\include LIBLTDL_LIB = # E.g. C:\libtool-1.5.8-lib\lib\libltdl.lib OPENSSL_INC = /IC:\openssl\include OPENSSL_LIB = C:\openssl\out32dll\libeay32.lib
Then you can run nmake /f Makefile.mak to compile libp11. The makefile includes no install target, so you can copy the header files, lib file and dll to do that.
To use libp11 in your application: in the source code add
#include <libp11.h>
and in your Makefile add
CFLAGS=$(shell pkg-config --cflags libp11) LDLFLAGS=$(shell pkg-config --libs libp11)
or if you are using autoconf/automake, you can add this to configure.ac
PKG_CHECK_MODULES([LIBP11], [libp11])
and edit your Makefile.am to include
myapplication_INCLUDES = @LIBP11_CFLAGS@ myapplication_LIBADD = @LIBP11_LIBS@