linking against opensc now as shared library

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@394 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-01-31 11:51:31 +00:00
parent 8ab0ea2eb3
commit 29fdf375e9
10 changed files with 90 additions and 88 deletions

View File

@@ -33,26 +33,12 @@ https://docs.openmoko.org/trac/ticket/2240).
@subsection o HINTS ON OPENSC
ccid-emulator links against libopensc, which is discouraged and hindered since
opensc>=0.12. We really need to get rid of this dependency. But so far we
manually build it to have libopensc for linking. The good thing is that you
don't need any opensc components to be installed. The bad thing is, that
ccid-emulator configures and builds opensc on its own. So you might need to
pass some extra configure options to opensc. So if you need to pass options to
opensc, use something like the following command:
Without libnpa ccid-emulator links against libopensc, which is discouraged and
hindered since opensc>=0.12. We really need to get rid of this dependency. You
need the opensc components to be installed (especially libopensc.so). But you
might need to adjust the opensc library flags:
./configure \
OPENSC_CONFIGURE="options"
@subsection l HINTS ON LIBPACE
If you have a local build of libpace and OpenPACE, that you want to link
against use something like the following command:
./configure \
OPENSSL_CFLAGS="-I/path/to/openssl-1.0.0c_with_openpace-0.4/include" \
LIBPACE_CFLAGS="-I/path/to/openssl-1.0.0c_with_openpace-0.4/include -I/path/to/libpace-0.1/src" \
OPENSSL_LIBS="-L/path/to/openssl-1.0.0c_with_openpace-0.4 -lcrypto" \
LIBPACE_LIBS="-L/path/to/openssl-1.0.0c_with_openpace-0.4 -lcrypto -L/path/to/libpace-0.1/src/.libs -lpace"
OPENSC_LIBS="-L/path/to/opensc/libdir -lopensc"
@section u USAGE

View File

@@ -67,22 +67,31 @@ LIBS="$saved_LIBS"
AC_ARG_ENABLE(pace,
AS_HELP_STRING([--enable-pace], [Enable Password Authenticated Connection Establishment (PACE)]),
[enable_pace="${enableval}"], [enable_pace=no])
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
if test "x$enable_pace" != xno ; then
PKG_CHECK_EXISTS([libpace],
[PKG_CHECK_MODULES([LIBPACE], [libpace])],
[AC_MSG_WARN([libpace not found by pkg-config])])
saved_CPPFLAGS="$CPPFLAGS"
saved_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $LIBPACE_CFLAGS -I$(pwd)/src/opensc-0.12.0/src"
CPPFLAGS="$CPPFLAGS $LIBPACE_CFLAGS -I$(pwd)/src/opensc/src"
LIBS="$LDFLAGS $LIBPACE_LIBS"
AC_CHECK_HEADERS(pace/pace.h, [], [ AC_MSG_ERROR([pace/pace.h not found, install libpace or use ./configure LIBPACE_CFLAGS=...]) ])
AC_MSG_CHECKING([for EstablishPACEChannel])
AC_TRY_LINK_FUNC(EstablishPACEChannel, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERROR([libpace not found, use ./configure LIBPACE_LIBS=...]) ])
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
enable_pace=yes
else
PKG_CHECK_EXISTS([libopensc],
[PKG_CHECK_MODULES([OPENSC], [libopensc >= 0.12])],
[AC_MSG_WARN([libopensc >= 0.12 not found by pkg-config])])
test -z "$OPENSC_LIBS" && OPENSC_LIBS="-lopensc"
LIBS="$LDFLAGS $OPENSC_LIBS $OPENSSL_LIBS"
AC_MSG_CHECKING([for sc_ctx_get_reader_count])
AC_TRY_LINK_FUNC(sc_ctx_get_reader_count, [ AC_MSG_RESULT([yes]) ],
[ AC_MSG_ERROR([libopensc >= 0.12 not found, use ./configure OPENSC_LIBS=...]) ])
fi
CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
AM_CONDITIONAL(WITH_PACE, test "${enable_pace}" != "no")
AM_COND_IF(WITH_PACE, [AC_DEFINE(WITH_PACE, 1, [enable PACE support])])
@@ -134,9 +143,6 @@ fi
AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes])
AC_SUBST(OPENSC_CONFIGURE)
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h memory.h stdint.h stdlib.h string.h sys/ioctl.h unistd.h])
@@ -172,13 +178,13 @@ Linker flags: ${LDFLAGS}
Libraries: ${LIBS}
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
PTHREAD_LIBS: ${PTHREAD_LIBS}
OPENSC_LIBS: ${OPENSC_LIBS}
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
OPENSSL_LIBS: ${OPENSSL_LIBS}
LIBPACE_CFLAGS: ${LIBPACE_CFLAGS}
LIBPACE_LIBS: ${LIBPACE_LIBS}
PCSC_CFLAGS: ${PCSC_CFLAGS}
PCSC_LIBS: ${PCSC_LIBS}
OPENSC_CONFIGURE: ${OPENSC_CONFIGURE}
CCID emulator: ${enable_ccid}
PACE support: ${enable_pace}

View File

@@ -1,27 +1,15 @@
OPENSCVERSION = 0.12.0
EXTRA_DIST = opensc
EXTRA_DIST = opensc-$(OPENSCVERSION)
AM_CPPFLAGS = -I$(top_srcdir)/src/opensc-$(OPENSCVERSION)/src
AM_CPPFLAGS = -I$(top_srcdir)/src/opensc/src
ccid_emulator_SOURCES = ccid.c usbstring.c usb.c binutil.c
ccid_emulator_LDADD = $(OPENSC_LIBS) $(OPENSSL_LIBS) $(PTHREAD_LIBS)
ccid_emulator_CFLAGS = $(OPENSC_CFLAGS) $(OPENSSL_CFLAGS) $(PTHREAD_CFLAGS)
ccid_emulator_LDADD = $(OPENSSL_LIBS) $(PTHREAD_LIBS)
ccid_emulator_CFLAGS = $(OPENSSL_CFLAGS) $(PTHREAD_CFLAGS)
cats_test_SOURCES = cats-test.c pcscutil.c
cats_test_LDADD = $(PCSC_LIBS)
cats_test_CFLAGS = $(PCSC_CFLAGS)
opensc:
cp -r $(top_srcdir)/src/opensc-$(OPENSCVERSION) opensc
cd opensc && ./configure OPENSSL_LIBS="$(OPENSSL_LIBS)" OPENSSL_CFLAGS="$(OPENSSL_CFLAGS)" $(OPENSC_CONFIGURE)
libopensc.la: opensc
$(MAKE) -C opensc
cp opensc/src/libopensc/.libs/libopensc.* .
clean-local:
rm -rf opensc libopensc.*
bin_PROGRAMS =
@@ -47,5 +35,5 @@ ccid_emulator_LDADD += $(LIBPACE_LIBS)
ccid_emulator_CFLAGS += $(LIBPACE_CFLAGS)
else
ccid_emulator_SOURCES += scutil.c
ccid_emulator_LDADD += libopensc.la
ccid_emulator_LDADD += $(OPENSC_LIBS)
endif