Merge pull request #164 from dpward/master
Use static libopensc in ccid-emulator, and improve build process
This commit is contained in:
19
.gitmodules
vendored
19
.gitmodules
vendored
@@ -9,25 +9,22 @@
|
|||||||
url = https://github.com/philipWendland/IsoApplet.git
|
url = https://github.com/philipWendland/IsoApplet.git
|
||||||
[submodule "ACardEmulator/app/src/main/external/jcardsim"]
|
[submodule "ACardEmulator/app/src/main/external/jcardsim"]
|
||||||
path = ACardEmulator/app/src/main/external/jcardsim
|
path = ACardEmulator/app/src/main/external/jcardsim
|
||||||
url = https://github.com/licel/jcardsim
|
url = https://github.com/licel/jcardsim.git
|
||||||
[submodule "ACardEmulator/app/src/main/external/MuscleApplet"]
|
[submodule "ACardEmulator/app/src/main/external/MuscleApplet"]
|
||||||
path = ACardEmulator/app/src/main/external/MuscleApplet
|
path = ACardEmulator/app/src/main/external/MuscleApplet
|
||||||
url = https://github.com/martinpaljak/MuscleApplet.git
|
url = https://github.com/martinpaljak/MuscleApplet.git
|
||||||
[submodule "ACardEmulator/app/src/main/external/GidsApplet"]
|
[submodule "ACardEmulator/app/src/main/external/GidsApplet"]
|
||||||
path = ACardEmulator/app/src/main/external/GidsApplet
|
path = ACardEmulator/app/src/main/external/GidsApplet
|
||||||
url = https://github.com/vletoux/GidsApplet.git
|
url = https://github.com/vletoux/GidsApplet.git
|
||||||
|
[submodule "ACardEmulator/app/src/main/external/PivApplet"]
|
||||||
|
path = ACardEmulator/app/src/main/external/PivApplet
|
||||||
|
url = https://github.com/frankmorgner/PivApplet.git
|
||||||
|
[submodule "ACardEmulator/app/src/main/external/vJCRE"]
|
||||||
|
path = ACardEmulator/app/src/main/external/vJCRE
|
||||||
|
url = https://github.com/frankmorgner/vJCRE.git
|
||||||
[submodule "ccid/src/OpenSC"]
|
[submodule "ccid/src/OpenSC"]
|
||||||
path = ccid/src/OpenSC
|
path = ccid/src/OpenSC
|
||||||
url = https://github.com/frankmorgner/OpenSC
|
url = https://github.com/OpenSC/OpenSC.git
|
||||||
[submodule "virtualsmartcard/win32/DevMsi"]
|
[submodule "virtualsmartcard/win32/DevMsi"]
|
||||||
path = virtualsmartcard/win32/DevMsi
|
path = virtualsmartcard/win32/DevMsi
|
||||||
url = https://github.com/nickrussler/DevMsi.git
|
url = https://github.com/nickrussler/DevMsi.git
|
||||||
[submodule "ACardEmulator/app/src/main/external/PivApplet"]
|
|
||||||
path = ACardEmulator/app/src/main/external/PivApplet
|
|
||||||
url = https://github.com/frankmorgner/PivApplet
|
|
||||||
[submodule "vJCRE"]
|
|
||||||
path = vJCRE
|
|
||||||
url = https://github.com/frankmorgner/vJCRE
|
|
||||||
[submodule "ACardEmulator/app/src/main/external/vJCRE"]
|
|
||||||
path = ACardEmulator/app/src/main/external/vJCRE
|
|
||||||
url = https://github.com/frankmorgner/vJCRE
|
|
||||||
|
|||||||
11
.travis.yml
11
.travis.yml
@@ -52,15 +52,6 @@ before_script:
|
|||||||
./configure --prefix=$PREFIX --enable-openssl-install --enable-python || cat config.log;
|
./configure --prefix=$PREFIX --enable-openssl-install --enable-python || cat config.log;
|
||||||
make install;
|
make install;
|
||||||
fi
|
fi
|
||||||
# ccid requires OpenSC
|
|
||||||
- git clone https://github.com/frankmorgner/OpenSC
|
|
||||||
- cd OpenSC && autoreconf -vsi
|
|
||||||
- if [ -z "$HOST" ]; then
|
|
||||||
./configure --prefix=$PREFIX --with-completiondir=/tmp || cat config.log;
|
|
||||||
else
|
|
||||||
./configure --prefix=$PREFIX --with-completiondir=/tmp --host=$HOST || cat config.log;
|
|
||||||
fi
|
|
||||||
- make install
|
|
||||||
# Configure virtualsmartcard
|
# Configure virtualsmartcard
|
||||||
- cd $TRAVIS_BUILD_DIR/virtualsmartcard && autoreconf -vsi
|
- cd $TRAVIS_BUILD_DIR/virtualsmartcard && autoreconf -vsi
|
||||||
- if [ -z "$HOST" ]; then
|
- if [ -z "$HOST" ]; then
|
||||||
@@ -85,7 +76,7 @@ before_script:
|
|||||||
# Configure ccid
|
# Configure ccid
|
||||||
- if [ $TRAVIS_OS_NAME == linux -a -z "$HOST" ]; then
|
- if [ $TRAVIS_OS_NAME == linux -a -z "$HOST" ]; then
|
||||||
cd $TRAVIS_BUILD_DIR/ccid && autoreconf -vsi;
|
cd $TRAVIS_BUILD_DIR/ccid && autoreconf -vsi;
|
||||||
./configure OPENSC_LIBS="-L$PREFIX/lib -lopensc" || cat config.log;
|
./configure || cat config.log;
|
||||||
fi
|
fi
|
||||||
# Optionally try to upload to Coverity Scan
|
# Optionally try to upload to Coverity Scan
|
||||||
# On error (propably quota is exhausted), just continue
|
# On error (propably quota is exhausted), just continue
|
||||||
|
|||||||
@@ -1,4 +1,31 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
SUBDIRS = src m4 patches doc
|
|
||||||
|
|
||||||
EXTRA_DIST = docs
|
SUBDIRS = . src doc
|
||||||
|
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS) src/OpenSC
|
||||||
|
|
||||||
|
EXTRA_DIST = docs patches
|
||||||
|
|
||||||
|
all-local:
|
||||||
|
cd src/OpenSC/src/common && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
cd src/OpenSC/src/scconf && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
cd src/OpenSC/src/ui && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
cd src/OpenSC/src/pkcs15init && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
cd src/OpenSC/src/sm && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
cd src/OpenSC/src/libopensc && $(MAKE) $(AM_MAKEFLAGS) all
|
||||||
|
|
||||||
|
check-local:
|
||||||
|
cd src/OpenSC/src/common && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
cd src/OpenSC/src/scconf && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
cd src/OpenSC/src/ui && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
cd src/OpenSC/src/pkcs15init && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
cd src/OpenSC/src/sm && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
cd src/OpenSC/src/libopensc && $(MAKE) $(AM_MAKEFLAGS) check
|
||||||
|
|
||||||
|
clean-local:
|
||||||
|
cd src/OpenSC/src/common && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
cd src/OpenSC/src/scconf && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
cd src/OpenSC/src/ui && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
cd src/OpenSC/src/pkcs15init && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
cd src/OpenSC/src/sm && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
cd src/OpenSC/src/libopensc && $(MAKE) $(AM_MAKEFLAGS) clean
|
||||||
|
|||||||
@@ -43,22 +43,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
|
|||||||
AC_CHECK_HEADERS(linux/usb/gadgetfs.h,,
|
AC_CHECK_HEADERS(linux/usb/gadgetfs.h,,
|
||||||
[ AC_MSG_ERROR([linux/usb/gadgetfs.h not found, maybe you want to disable ccid]) ])
|
[ AC_MSG_ERROR([linux/usb/gadgetfs.h not found, maybe you want to disable ccid]) ])
|
||||||
|
|
||||||
ACX_PTHREAD
|
AX_PTHREAD([], [ AC_MSG_ERROR([pthread not found, use ./configure PTHREAD_CFLAGS=... PTHREAD_LIBS=...]) ])
|
||||||
|
|
||||||
saved_CPPFLAGS="$CPPFLAGS"
|
|
||||||
saved_LIBS="$LIBS"
|
|
||||||
CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS"
|
|
||||||
LIBS="$LDFLAGS $PTHREAD_LIBS"
|
|
||||||
|
|
||||||
AC_CHECK_HEADERS(pthread.h, [],
|
|
||||||
[ AC_MSG_ERROR([pthread.h not found, use ./configure PTHREAD_CFLAGS=... or disable ccid]) ])
|
|
||||||
AC_MSG_CHECKING([for pthread_create])
|
|
||||||
AC_TRY_LINK_FUNC(pthread_create, [ AC_MSG_RESULT([yes]) ],
|
|
||||||
[ AC_MSG_ERROR([pthread not found, use ./configure PTHREAD_LIBS=... or disable ccid]) ])
|
|
||||||
|
|
||||||
CPPFLAGS="$saved_CPPFLAGS"
|
|
||||||
LIBS="$saved_LIBS"
|
|
||||||
|
|
||||||
|
|
||||||
PKG_CHECK_EXISTS([libcrypto],
|
PKG_CHECK_EXISTS([libcrypto],
|
||||||
[PKG_CHECK_MODULES([OPENSSL], [libcrypto >= 1.0.0])],
|
[PKG_CHECK_MODULES([OPENSSL], [libcrypto >= 1.0.0])],
|
||||||
@@ -74,21 +59,6 @@ AC_TRY_LINK_FUNC(EVP_read_pw_string_min, [ AC_MSG_RESULT([yes]) ], [ AC_MSG_ERRO
|
|||||||
CPPFLAGS="$saved_CPPFLAGS"
|
CPPFLAGS="$saved_CPPFLAGS"
|
||||||
LIBS="$saved_LIBS"
|
LIBS="$saved_LIBS"
|
||||||
|
|
||||||
saved_CPPFLAGS="$CPPFLAGS"
|
|
||||||
saved_LIBS="$LIBS"
|
|
||||||
PKG_CHECK_EXISTS([libopensc],
|
|
||||||
[PKG_CHECK_MODULES([OPENSC], [libopensc >= 0.12.1])],
|
|
||||||
[AC_MSG_WARN([libopensc >= 0.12.1 not found by pkg-config])])
|
|
||||||
test -z "$OPENSC_LIBS" && OPENSC_LIBS="-lopensc $OPENSSL_LIBS"
|
|
||||||
LIBS="$LDFLAGS $OPENSC_LIBS"
|
|
||||||
AC_MSG_CHECKING([for sc_bytes2apdu])
|
|
||||||
AC_TRY_LINK_FUNC(sc_bytes2apdu, [ AC_MSG_RESULT([yes]) ],
|
|
||||||
[ AC_MSG_ERROR([libopensc >= 0.12.1 not found, use ./configure OPENSC_LIBS=...]) ])
|
|
||||||
AC_CHECK_FUNCS([sc_apdu_set_resp sc_apdu_get_octets _sc_match_atr boxing_buf_to_pace_input])
|
|
||||||
CPPFLAGS="$saved_CPPFLAGS"
|
|
||||||
LIBS="$saved_LIBS"
|
|
||||||
|
|
||||||
|
|
||||||
PACKAGE_SUMMARY="Emulate a USB CCID compliant smart card reader"
|
PACKAGE_SUMMARY="Emulate a USB CCID compliant smart card reader"
|
||||||
AC_SUBST(PACKAGE_SUMMARY)
|
AC_SUBST(PACKAGE_SUMMARY)
|
||||||
|
|
||||||
@@ -110,6 +80,17 @@ AC_FUNC_REALLOC
|
|||||||
AC_FUNC_STRNLEN
|
AC_FUNC_STRNLEN
|
||||||
AC_CHECK_FUNCS([memmove memset strerror strtol])
|
AC_CHECK_FUNCS([memmove memset strerror strtol])
|
||||||
|
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([
|
||||||
|
Makefile
|
||||||
|
src/Makefile
|
||||||
|
doc/Makefile
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_CONFIG_SUBDIRS([src/OpenSC])
|
||||||
|
|
||||||
|
AC_OUTPUT
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
${PACKAGE} has been configured with following options:
|
${PACKAGE} has been configured with following options:
|
||||||
@@ -119,31 +100,19 @@ User binaries: $(eval eval eval echo "${bindir}")
|
|||||||
Libraries: $(eval eval eval echo "${libdir}")
|
Libraries: $(eval eval eval echo "${libdir}")
|
||||||
Configuration files: $(eval eval eval echo "${sysconfdir}")
|
Configuration files: $(eval eval eval echo "${sysconfdir}")
|
||||||
|
|
||||||
|
|
||||||
Host: ${host}
|
Host: ${host}
|
||||||
Compiler: ${CC}
|
Compiler: ${CC}
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
Preprocessor flags: ${CPPFLAGS}
|
||||||
Compiler flags: ${CFLAGS}
|
Compiler flags: ${CFLAGS}
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
|
||||||
Linker flags: ${LDFLAGS}
|
Linker flags: ${LDFLAGS}
|
||||||
Libraries: ${LIBS}
|
Libraries: ${LIBS}
|
||||||
|
|
||||||
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
||||||
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
||||||
OPENSC_LIBS: ${OPENSC_LIBS}
|
|
||||||
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
|
OPENSSL_CFLAGS: ${OPENSSL_CFLAGS}
|
||||||
OPENSSL_LIBS: ${OPENSSL_LIBS}
|
OPENSSL_LIBS: ${OPENSSL_LIBS}
|
||||||
|
|
||||||
|
|
||||||
HELP2MAN: ${HELP2MAN}
|
HELP2MAN: ${HELP2MAN}
|
||||||
GENGETOPT: ${GENGETOPT}
|
GENGETOPT: ${GENGETOPT}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
|
||||||
Makefile
|
|
||||||
m4/Makefile
|
|
||||||
patches/Makefile
|
|
||||||
src/Makefile
|
|
||||||
doc/Makefile
|
|
||||||
])
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ do_subst = $(SED) \
|
|||||||
-e 's,[@]libdir[@],$(libdir),g' \
|
-e 's,[@]libdir[@],$(libdir),g' \
|
||||||
-e 's,[@]includedir[@],$(includedir),g' \
|
-e 's,[@]includedir[@],$(includedir),g' \
|
||||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||||
-e 's,[@]OPENSC_LIBS[@],$(OPENSC_LIBS),g' \
|
|
||||||
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
||||||
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,9 @@ modern Windows and Unix-like systems by default.
|
|||||||
|
|
||||||
.. include:: autotools.txt
|
.. include:: autotools.txt
|
||||||
|
|
||||||
|
The @PACKAGE_NAME@ depends on :program:`libopensc`, which is automatically
|
||||||
|
built from a snapshot of the OpenSC source code and then statically linked.
|
||||||
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
Hints on GadgetFS
|
Hints on GadgetFS
|
||||||
@@ -302,33 +305,6 @@ loading the module, you maybe want to check out `this patch
|
|||||||
<http://comments.gmane.org/gmane.linux.usb.general/47440>`_.
|
<http://comments.gmane.org/gmane.linux.usb.general/47440>`_.
|
||||||
|
|
||||||
|
|
||||||
===============
|
|
||||||
Hints on OpenSC
|
|
||||||
===============
|
|
||||||
|
|
||||||
@PACKAGE_NAME@ needs the OpenSC components to be
|
|
||||||
installed (especially :file:`libopensc.so`). Here is an example of how to get
|
|
||||||
the standard installation of OpenSC without |PACE|::
|
|
||||||
|
|
||||||
PREFIX=/tmp/install
|
|
||||||
VSMARTCARD=$PWD/vsmartcard
|
|
||||||
git clone https://github.com/frankmorgner/vsmartcard.git $VSMARTCARD
|
|
||||||
cd $VSMARTCARD
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
cd $VSMARTCARD/ccid/src/opensc
|
|
||||||
autoreconf --verbose --install
|
|
||||||
./configure --prefix=$PREFIX
|
|
||||||
make install && cd -
|
|
||||||
|
|
||||||
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``. Here is how to
|
|
||||||
configure the @PACKAGE_NAME@ to use it::
|
|
||||||
|
|
||||||
cd $VSMARTCARD/ccid
|
|
||||||
./configure --prefix=$PREFIX OPENSC_LIBS="-L$PREFIX/lib -lopensc"
|
|
||||||
make install && cd -
|
|
||||||
|
|
||||||
|
|
||||||
*****
|
*****
|
||||||
Usage
|
Usage
|
||||||
*****
|
*****
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Process this file with automake to create Makefile.in
|
|
||||||
|
|
||||||
EXTRA_DIST = acx_pthread.m4
|
|
||||||
@@ -1,242 +0,0 @@
|
|||||||
dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
|
||||||
dnl
|
|
||||||
dnl @summary figure out how to build C programs using POSIX threads
|
|
||||||
dnl
|
|
||||||
dnl This macro figures out how to build C programs using POSIX threads.
|
|
||||||
dnl It sets the PTHREAD_LIBS output variable to the threads library and
|
|
||||||
dnl linker flags, and the PTHREAD_CFLAGS output variable to any special
|
|
||||||
dnl C compiler flags that are needed. (The user can also force certain
|
|
||||||
dnl compiler flags/libs to be tested by setting these environment
|
|
||||||
dnl variables.)
|
|
||||||
dnl
|
|
||||||
dnl Also sets PTHREAD_CC to any special C compiler that is needed for
|
|
||||||
dnl multi-threaded programs (defaults to the value of CC otherwise).
|
|
||||||
dnl (This is necessary on AIX to use the special cc_r compiler alias.)
|
|
||||||
dnl
|
|
||||||
dnl NOTE: You are assumed to not only compile your program with these
|
|
||||||
dnl flags, but also link it with them as well. e.g. you should link
|
|
||||||
dnl with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
|
|
||||||
dnl $LIBS
|
|
||||||
dnl
|
|
||||||
dnl If you are only building threads programs, you may wish to use
|
|
||||||
dnl these variables in your default LIBS, CFLAGS, and CC:
|
|
||||||
dnl
|
|
||||||
dnl LIBS="$PTHREAD_LIBS $LIBS"
|
|
||||||
dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
||||||
dnl CC="$PTHREAD_CC"
|
|
||||||
dnl
|
|
||||||
dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
|
|
||||||
dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
|
|
||||||
dnl that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
|
||||||
dnl
|
|
||||||
dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
|
|
||||||
dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands to
|
|
||||||
dnl run it if it is not found. If ACTION-IF-FOUND is not specified, the
|
|
||||||
dnl default action will define HAVE_PTHREAD.
|
|
||||||
dnl
|
|
||||||
dnl Please let the authors know if this macro fails on any platform, or
|
|
||||||
dnl if you have any other suggestions or comments. This macro was based
|
|
||||||
dnl on work by SGJ on autoconf scripts for FFTW (www.fftw.org) (with
|
|
||||||
dnl help from M. Frigo), as well as ac_pthread and hb_pthread macros
|
|
||||||
dnl posted by Alejandro Forero Cuervo to the autoconf macro repository.
|
|
||||||
dnl We are also grateful for the helpful feedback of numerous users.
|
|
||||||
dnl
|
|
||||||
dnl @category InstalledPackages
|
|
||||||
dnl @author Steven G. Johnson <stevenj@alum.mit.edu>
|
|
||||||
dnl @version 2006-05-29
|
|
||||||
dnl @license GPLWithACException
|
|
||||||
|
|
||||||
AC_DEFUN([ACX_PTHREAD], [
|
|
||||||
AC_REQUIRE([AC_CANONICAL_HOST])
|
|
||||||
AC_LANG_SAVE
|
|
||||||
AC_LANG_C
|
|
||||||
acx_pthread_ok=no
|
|
||||||
|
|
||||||
# We used to check for pthread.h first, but this fails if pthread.h
|
|
||||||
# requires special compiler flags (e.g. on True64 or Sequent).
|
|
||||||
# It gets checked for in the link test anyway.
|
|
||||||
|
|
||||||
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
|
||||||
# etcetera environment variables, and if threads linking works using
|
|
||||||
# them:
|
|
||||||
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
|
|
||||||
save_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
||||||
save_LIBS="$LIBS"
|
|
||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
|
||||||
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
|
|
||||||
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
|
|
||||||
AC_MSG_RESULT($acx_pthread_ok)
|
|
||||||
if test x"$acx_pthread_ok" = xno; then
|
|
||||||
PTHREAD_LIBS=""
|
|
||||||
PTHREAD_CFLAGS=""
|
|
||||||
fi
|
|
||||||
LIBS="$save_LIBS"
|
|
||||||
CFLAGS="$save_CFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We must check for the threads library under a number of different
|
|
||||||
# names; the ordering is very important because some systems
|
|
||||||
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
|
||||||
# libraries is broken (non-POSIX).
|
|
||||||
|
|
||||||
# Create a list of thread flags to try. Items starting with a "-" are
|
|
||||||
# C compiler flags, and other items are library names, except for "none"
|
|
||||||
# which indicates that we try without any flags at all, and "pthread-config"
|
|
||||||
# which is a program returning the flags for the Pth emulation library.
|
|
||||||
|
|
||||||
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
|
||||||
|
|
||||||
# The ordering *is* (sometimes) important. Some notes on the
|
|
||||||
# individual items follow:
|
|
||||||
|
|
||||||
# pthreads: AIX (must check this before -lpthread)
|
|
||||||
# none: in case threads are in libc; should be tried before -Kthread and
|
|
||||||
# other compiler flags to prevent continual compiler warnings
|
|
||||||
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
|
||||||
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
|
||||||
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
|
||||||
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
|
|
||||||
# -pthreads: Solaris/gcc
|
|
||||||
# -mthreads: Mingw32/gcc, Lynx/gcc
|
|
||||||
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
|
||||||
# doesn't hurt to check since this sometimes defines pthreads too;
|
|
||||||
# also defines -D_REENTRANT)
|
|
||||||
# ... -mt is also the pthreads flag for HP/aCC
|
|
||||||
# pthread: Linux, etcetera
|
|
||||||
# --thread-safe: KAI C++
|
|
||||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
|
||||||
|
|
||||||
case "${host_cpu}-${host_os}" in
|
|
||||||
*solaris*)
|
|
||||||
|
|
||||||
# On Solaris (at least, for some versions), libc contains stubbed
|
|
||||||
# (non-functional) versions of the pthreads routines, so link-based
|
|
||||||
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
|
|
||||||
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
|
|
||||||
# a function called by this macro, so we could check for that, but
|
|
||||||
# who knows whether they'll stub that too in a future libc.) So,
|
|
||||||
# we'll just look for -pthreads and -lpthread first:
|
|
||||||
|
|
||||||
acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if test x"$acx_pthread_ok" = xno; then
|
|
||||||
for flag in $acx_pthread_flags; do
|
|
||||||
|
|
||||||
case $flag in
|
|
||||||
none)
|
|
||||||
AC_MSG_CHECKING([whether pthreads work without any flags])
|
|
||||||
;;
|
|
||||||
|
|
||||||
-*)
|
|
||||||
AC_MSG_CHECKING([whether pthreads work with $flag])
|
|
||||||
PTHREAD_CFLAGS="$flag"
|
|
||||||
;;
|
|
||||||
|
|
||||||
pthread-config)
|
|
||||||
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
|
|
||||||
if test x"$acx_pthread_config" = xno; then continue; fi
|
|
||||||
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
|
||||||
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
AC_MSG_CHECKING([for the pthreads library -l$flag])
|
|
||||||
PTHREAD_LIBS="-l$flag"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
save_LIBS="$LIBS"
|
|
||||||
save_CFLAGS="$CFLAGS"
|
|
||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
|
||||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
||||||
|
|
||||||
# Check for various functions. We must include pthread.h,
|
|
||||||
# since some functions may be macros. (On the Sequent, we
|
|
||||||
# need a special flag -Kthread to make this header compile.)
|
|
||||||
# We check for pthread_join because it is in -lpthread on IRIX
|
|
||||||
# while pthread_create is in libc. We check for pthread_attr_init
|
|
||||||
# due to DEC craziness with -lpthreads. We check for
|
|
||||||
# pthread_cleanup_push because it is one of the few pthread
|
|
||||||
# functions on Solaris that doesn't have a non-functional libc stub.
|
|
||||||
# We try pthread_create on general principles.
|
|
||||||
AC_TRY_LINK([#include <pthread.h>],
|
|
||||||
[pthread_t th; pthread_join(th, 0);
|
|
||||||
pthread_attr_init(0); pthread_cleanup_push(0, 0);
|
|
||||||
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
|
|
||||||
[acx_pthread_ok=yes])
|
|
||||||
|
|
||||||
LIBS="$save_LIBS"
|
|
||||||
CFLAGS="$save_CFLAGS"
|
|
||||||
|
|
||||||
AC_MSG_RESULT($acx_pthread_ok)
|
|
||||||
if test "x$acx_pthread_ok" = xyes; then
|
|
||||||
break;
|
|
||||||
fi
|
|
||||||
|
|
||||||
PTHREAD_LIBS=""
|
|
||||||
PTHREAD_CFLAGS=""
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Various other checks:
|
|
||||||
if test "x$acx_pthread_ok" = xyes; then
|
|
||||||
save_LIBS="$LIBS"
|
|
||||||
LIBS="$PTHREAD_LIBS $LIBS"
|
|
||||||
save_CFLAGS="$CFLAGS"
|
|
||||||
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|
||||||
|
|
||||||
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
|
||||||
AC_MSG_CHECKING([for joinable pthread attribute])
|
|
||||||
attr_name=unknown
|
|
||||||
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
|
||||||
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
|
|
||||||
[attr_name=$attr; break])
|
|
||||||
done
|
|
||||||
AC_MSG_RESULT($attr_name)
|
|
||||||
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
|
|
||||||
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
|
|
||||||
[Define to necessary symbol if this constant
|
|
||||||
uses a non-standard name on your system.])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([if more special flags are required for pthreads])
|
|
||||||
flag=no
|
|
||||||
case "${host_cpu}-${host_os}" in
|
|
||||||
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
|
|
||||||
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
|
|
||||||
esac
|
|
||||||
AC_MSG_RESULT(${flag})
|
|
||||||
if test "x$flag" != xno; then
|
|
||||||
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
LIBS="$save_LIBS"
|
|
||||||
CFLAGS="$save_CFLAGS"
|
|
||||||
|
|
||||||
# More AIX lossage: must compile with xlc_r or cc_r
|
|
||||||
if test x"$GCC" != xyes; then
|
|
||||||
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
|
|
||||||
else
|
|
||||||
PTHREAD_CC=$CC
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
PTHREAD_CC="$CC"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST(PTHREAD_LIBS)
|
|
||||||
AC_SUBST(PTHREAD_CFLAGS)
|
|
||||||
AC_SUBST(PTHREAD_CC)
|
|
||||||
|
|
||||||
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
|
||||||
if test x"$acx_pthread_ok" = xyes; then
|
|
||||||
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
|
|
||||||
:
|
|
||||||
else
|
|
||||||
acx_pthread_ok=no
|
|
||||||
$2
|
|
||||||
fi
|
|
||||||
AC_LANG_RESTORE
|
|
||||||
])dnl ACX_PTHREAD
|
|
||||||
507
ccid/m4/ax_pthread.m4
Normal file
507
ccid/m4/ax_pthread.m4
Normal file
@@ -0,0 +1,507 @@
|
|||||||
|
# ===========================================================================
|
||||||
|
# https://www.gnu.org/software/autoconf-archive/ax_pthread.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# This macro figures out how to build C programs using POSIX threads. It
|
||||||
|
# sets the PTHREAD_LIBS output variable to the threads library and linker
|
||||||
|
# flags, and the PTHREAD_CFLAGS output variable to any special C compiler
|
||||||
|
# flags that are needed. (The user can also force certain compiler
|
||||||
|
# flags/libs to be tested by setting these environment variables.)
|
||||||
|
#
|
||||||
|
# Also sets PTHREAD_CC to any special C compiler that is needed for
|
||||||
|
# multi-threaded programs (defaults to the value of CC otherwise). (This
|
||||||
|
# is necessary on AIX to use the special cc_r compiler alias.)
|
||||||
|
#
|
||||||
|
# NOTE: You are assumed to not only compile your program with these flags,
|
||||||
|
# but also to link with them as well. For example, you might link with
|
||||||
|
# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS
|
||||||
|
#
|
||||||
|
# If you are only building threaded programs, you may wish to use these
|
||||||
|
# variables in your default LIBS, CFLAGS, and CC:
|
||||||
|
#
|
||||||
|
# LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
# CC="$PTHREAD_CC"
|
||||||
|
#
|
||||||
|
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant
|
||||||
|
# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to
|
||||||
|
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
|
||||||
|
#
|
||||||
|
# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the
|
||||||
|
# PTHREAD_PRIO_INHERIT symbol is defined when compiling with
|
||||||
|
# PTHREAD_CFLAGS.
|
||||||
|
#
|
||||||
|
# ACTION-IF-FOUND is a list of shell commands to run if a threads library
|
||||||
|
# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it
|
||||||
|
# is not found. If ACTION-IF-FOUND is not specified, the default action
|
||||||
|
# will define HAVE_PTHREAD.
|
||||||
|
#
|
||||||
|
# Please let the authors know if this macro fails on any platform, or if
|
||||||
|
# you have any other suggestions or comments. This macro was based on work
|
||||||
|
# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help
|
||||||
|
# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by
|
||||||
|
# Alejandro Forero Cuervo to the autoconf macro repository. We are also
|
||||||
|
# grateful for the helpful feedback of numerous users.
|
||||||
|
#
|
||||||
|
# Updated for Autoconf 2.68 by Daniel Richard G.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
|
||||||
|
# Copyright (c) 2011 Daniel Richard G. <skunk@iSKUNK.ORG>
|
||||||
|
# Copyright (c) 2019 Marc Stevens <marc.stevens@cwi.nl>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the
|
||||||
|
# Free Software Foundation, either version 3 of the License, or (at your
|
||||||
|
# option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 27
|
||||||
|
|
||||||
|
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||||
|
AC_DEFUN([AX_PTHREAD], [
|
||||||
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
|
AC_REQUIRE([AC_PROG_SED])
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
ax_pthread_ok=no
|
||||||
|
|
||||||
|
# We used to check for pthread.h first, but this fails if pthread.h
|
||||||
|
# requires special compiler flags (e.g. on Tru64 or Sequent).
|
||||||
|
# It gets checked for in the link test anyway.
|
||||||
|
|
||||||
|
# First of all, check if the user has set any of the PTHREAD_LIBS,
|
||||||
|
# etcetera environment variables, and if threads linking works using
|
||||||
|
# them:
|
||||||
|
if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then
|
||||||
|
ax_pthread_save_CC="$CC"
|
||||||
|
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||||
|
ax_pthread_save_LIBS="$LIBS"
|
||||||
|
AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"])
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS])
|
||||||
|
AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes])
|
||||||
|
AC_MSG_RESULT([$ax_pthread_ok])
|
||||||
|
if test "x$ax_pthread_ok" = "xno"; then
|
||||||
|
PTHREAD_LIBS=""
|
||||||
|
PTHREAD_CFLAGS=""
|
||||||
|
fi
|
||||||
|
CC="$ax_pthread_save_CC"
|
||||||
|
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||||
|
LIBS="$ax_pthread_save_LIBS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We must check for the threads library under a number of different
|
||||||
|
# names; the ordering is very important because some systems
|
||||||
|
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
|
||||||
|
# libraries is broken (non-POSIX).
|
||||||
|
|
||||||
|
# Create a list of thread flags to try. Items with a "," contain both
|
||||||
|
# C compiler flags (before ",") and linker flags (after ","). Other items
|
||||||
|
# starting with a "-" are C compiler flags, and remaining items are
|
||||||
|
# library names, except for "none" which indicates that we try without
|
||||||
|
# any flags at all, and "pthread-config" which is a program returning
|
||||||
|
# the flags for the Pth emulation library.
|
||||||
|
|
||||||
|
ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
|
||||||
|
|
||||||
|
# The ordering *is* (sometimes) important. Some notes on the
|
||||||
|
# individual items follow:
|
||||||
|
|
||||||
|
# pthreads: AIX (must check this before -lpthread)
|
||||||
|
# none: in case threads are in libc; should be tried before -Kthread and
|
||||||
|
# other compiler flags to prevent continual compiler warnings
|
||||||
|
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
|
||||||
|
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64
|
||||||
|
# (Note: HP C rejects this with "bad form for `-t' option")
|
||||||
|
# -pthreads: Solaris/gcc (Note: HP C also rejects)
|
||||||
|
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
|
||||||
|
# doesn't hurt to check since this sometimes defines pthreads and
|
||||||
|
# -D_REENTRANT too), HP C (must be checked before -lpthread, which
|
||||||
|
# is present but should not be used directly; and before -mthreads,
|
||||||
|
# because the compiler interprets this as "-mt" + "-hreads")
|
||||||
|
# -mthreads: Mingw32/gcc, Lynx/gcc
|
||||||
|
# pthread: Linux, etcetera
|
||||||
|
# --thread-safe: KAI C++
|
||||||
|
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||||
|
|
||||||
|
case $host_os in
|
||||||
|
|
||||||
|
freebsd*)
|
||||||
|
|
||||||
|
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
|
||||||
|
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
|
||||||
|
|
||||||
|
ax_pthread_flags="-kthread lthread $ax_pthread_flags"
|
||||||
|
;;
|
||||||
|
|
||||||
|
hpux*)
|
||||||
|
|
||||||
|
# From the cc(1) man page: "[-mt] Sets various -D flags to enable
|
||||||
|
# multi-threading and also sets -lpthread."
|
||||||
|
|
||||||
|
ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags"
|
||||||
|
;;
|
||||||
|
|
||||||
|
openedition*)
|
||||||
|
|
||||||
|
# IBM z/OS requires a feature-test macro to be defined in order to
|
||||||
|
# enable POSIX threads at all, so give the user a hint if this is
|
||||||
|
# not set. (We don't define these ourselves, as they can affect
|
||||||
|
# other portions of the system API in unpredictable ways.)
|
||||||
|
|
||||||
|
AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING],
|
||||||
|
[
|
||||||
|
# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS)
|
||||||
|
AX_PTHREAD_ZOS_MISSING
|
||||||
|
# endif
|
||||||
|
],
|
||||||
|
[AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])])
|
||||||
|
;;
|
||||||
|
|
||||||
|
solaris*)
|
||||||
|
|
||||||
|
# On Solaris (at least, for some versions), libc contains stubbed
|
||||||
|
# (non-functional) versions of the pthreads routines, so link-based
|
||||||
|
# tests will erroneously succeed. (N.B.: The stubs are missing
|
||||||
|
# pthread_cleanup_push, or rather a function called by this macro,
|
||||||
|
# so we could check for that, but who knows whether they'll stub
|
||||||
|
# that too in a future libc.) So we'll check first for the
|
||||||
|
# standard Solaris way of linking pthreads (-mt -lpthread).
|
||||||
|
|
||||||
|
ax_pthread_flags="-mt,-lpthread pthread $ax_pthread_flags"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Are we compiling with Clang?
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether $CC is Clang],
|
||||||
|
[ax_cv_PTHREAD_CLANG],
|
||||||
|
[ax_cv_PTHREAD_CLANG=no
|
||||||
|
# Note that Autoconf sets GCC=yes for Clang as well as GCC
|
||||||
|
if test "x$GCC" = "xyes"; then
|
||||||
|
AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG],
|
||||||
|
[/* Note: Clang 2.7 lacks __clang_[a-z]+__ */
|
||||||
|
# if defined(__clang__) && defined(__llvm__)
|
||||||
|
AX_PTHREAD_CC_IS_CLANG
|
||||||
|
# endif
|
||||||
|
],
|
||||||
|
[ax_cv_PTHREAD_CLANG=yes])
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
ax_pthread_clang="$ax_cv_PTHREAD_CLANG"
|
||||||
|
|
||||||
|
|
||||||
|
# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC)
|
||||||
|
|
||||||
|
# Note that for GCC and Clang -pthread generally implies -lpthread,
|
||||||
|
# except when -nostdlib is passed.
|
||||||
|
# This is problematic using libtool to build C++ shared libraries with pthread:
|
||||||
|
# [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25460
|
||||||
|
# [2] https://bugzilla.redhat.com/show_bug.cgi?id=661333
|
||||||
|
# [3] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468555
|
||||||
|
# To solve this, first try -pthread together with -lpthread for GCC
|
||||||
|
|
||||||
|
AS_IF([test "x$GCC" = "xyes"],
|
||||||
|
[ax_pthread_flags="-pthread,-lpthread -pthread -pthreads $ax_pthread_flags"])
|
||||||
|
|
||||||
|
# Clang takes -pthread (never supported any other flag), but we'll try with -lpthread first
|
||||||
|
|
||||||
|
AS_IF([test "x$ax_pthread_clang" = "xyes"],
|
||||||
|
[ax_pthread_flags="-pthread,-lpthread -pthread"])
|
||||||
|
|
||||||
|
|
||||||
|
# The presence of a feature test macro requesting re-entrant function
|
||||||
|
# definitions is, on some systems, a strong hint that pthreads support is
|
||||||
|
# correctly enabled
|
||||||
|
|
||||||
|
case $host_os in
|
||||||
|
darwin* | hpux* | linux* | osf* | solaris*)
|
||||||
|
ax_pthread_check_macro="_REENTRANT"
|
||||||
|
;;
|
||||||
|
|
||||||
|
aix*)
|
||||||
|
ax_pthread_check_macro="_THREAD_SAFE"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
ax_pthread_check_macro="--"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AS_IF([test "x$ax_pthread_check_macro" = "x--"],
|
||||||
|
[ax_pthread_check_cond=0],
|
||||||
|
[ax_pthread_check_cond="!defined($ax_pthread_check_macro)"])
|
||||||
|
|
||||||
|
|
||||||
|
if test "x$ax_pthread_ok" = "xno"; then
|
||||||
|
for ax_pthread_try_flag in $ax_pthread_flags; do
|
||||||
|
|
||||||
|
case $ax_pthread_try_flag in
|
||||||
|
none)
|
||||||
|
AC_MSG_CHECKING([whether pthreads work without any flags])
|
||||||
|
;;
|
||||||
|
|
||||||
|
*,*)
|
||||||
|
PTHREAD_CFLAGS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\1/"`
|
||||||
|
PTHREAD_LIBS=`echo $ax_pthread_try_flag | sed "s/^\(.*\),\(.*\)$/\2/"`
|
||||||
|
AC_MSG_CHECKING([whether pthreads work with "$PTHREAD_CFLAGS" and "$PTHREAD_LIBS"])
|
||||||
|
;;
|
||||||
|
|
||||||
|
-*)
|
||||||
|
AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag])
|
||||||
|
PTHREAD_CFLAGS="$ax_pthread_try_flag"
|
||||||
|
;;
|
||||||
|
|
||||||
|
pthread-config)
|
||||||
|
AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no])
|
||||||
|
AS_IF([test "x$ax_pthread_config" = "xno"], [continue])
|
||||||
|
PTHREAD_CFLAGS="`pthread-config --cflags`"
|
||||||
|
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag])
|
||||||
|
PTHREAD_LIBS="-l$ax_pthread_try_flag"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||||
|
ax_pthread_save_LIBS="$LIBS"
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
|
||||||
|
# Check for various functions. We must include pthread.h,
|
||||||
|
# since some functions may be macros. (On the Sequent, we
|
||||||
|
# need a special flag -Kthread to make this header compile.)
|
||||||
|
# We check for pthread_join because it is in -lpthread on IRIX
|
||||||
|
# while pthread_create is in libc. We check for pthread_attr_init
|
||||||
|
# due to DEC craziness with -lpthreads. We check for
|
||||||
|
# pthread_cleanup_push because it is one of the few pthread
|
||||||
|
# functions on Solaris that doesn't have a non-functional libc stub.
|
||||||
|
# We try pthread_create on general principles.
|
||||||
|
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>
|
||||||
|
# if $ax_pthread_check_cond
|
||||||
|
# error "$ax_pthread_check_macro must be defined"
|
||||||
|
# endif
|
||||||
|
static void *some_global = NULL;
|
||||||
|
static void routine(void *a)
|
||||||
|
{
|
||||||
|
/* To avoid any unused-parameter or
|
||||||
|
unused-but-set-parameter warning. */
|
||||||
|
some_global = a;
|
||||||
|
}
|
||||||
|
static void *start_routine(void *a) { return a; }],
|
||||||
|
[pthread_t th; pthread_attr_t attr;
|
||||||
|
pthread_create(&th, 0, start_routine, 0);
|
||||||
|
pthread_join(th, 0);
|
||||||
|
pthread_attr_init(&attr);
|
||||||
|
pthread_cleanup_push(routine, 0);
|
||||||
|
pthread_cleanup_pop(0) /* ; */])],
|
||||||
|
[ax_pthread_ok=yes],
|
||||||
|
[])
|
||||||
|
|
||||||
|
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||||
|
LIBS="$ax_pthread_save_LIBS"
|
||||||
|
|
||||||
|
AC_MSG_RESULT([$ax_pthread_ok])
|
||||||
|
AS_IF([test "x$ax_pthread_ok" = "xyes"], [break])
|
||||||
|
|
||||||
|
PTHREAD_LIBS=""
|
||||||
|
PTHREAD_CFLAGS=""
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Clang needs special handling, because older versions handle the -pthread
|
||||||
|
# option in a rather... idiosyncratic way
|
||||||
|
|
||||||
|
if test "x$ax_pthread_clang" = "xyes"; then
|
||||||
|
|
||||||
|
# Clang takes -pthread; it has never supported any other flag
|
||||||
|
|
||||||
|
# (Note 1: This will need to be revisited if a system that Clang
|
||||||
|
# supports has POSIX threads in a separate library. This tends not
|
||||||
|
# to be the way of modern systems, but it's conceivable.)
|
||||||
|
|
||||||
|
# (Note 2: On some systems, notably Darwin, -pthread is not needed
|
||||||
|
# to get POSIX threads support; the API is always present and
|
||||||
|
# active. We could reasonably leave PTHREAD_CFLAGS empty. But
|
||||||
|
# -pthread does define _REENTRANT, and while the Darwin headers
|
||||||
|
# ignore this macro, third-party headers might not.)
|
||||||
|
|
||||||
|
# However, older versions of Clang make a point of warning the user
|
||||||
|
# that, in an invocation where only linking and no compilation is
|
||||||
|
# taking place, the -pthread option has no effect ("argument unused
|
||||||
|
# during compilation"). They expect -pthread to be passed in only
|
||||||
|
# when source code is being compiled.
|
||||||
|
#
|
||||||
|
# Problem is, this is at odds with the way Automake and most other
|
||||||
|
# C build frameworks function, which is that the same flags used in
|
||||||
|
# compilation (CFLAGS) are also used in linking. Many systems
|
||||||
|
# supported by AX_PTHREAD require exactly this for POSIX threads
|
||||||
|
# support, and in fact it is often not straightforward to specify a
|
||||||
|
# flag that is used only in the compilation phase and not in
|
||||||
|
# linking. Such a scenario is extremely rare in practice.
|
||||||
|
#
|
||||||
|
# Even though use of the -pthread flag in linking would only print
|
||||||
|
# a warning, this can be a nuisance for well-run software projects
|
||||||
|
# that build with -Werror. So if the active version of Clang has
|
||||||
|
# this misfeature, we search for an option to squash it.
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread],
|
||||||
|
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG],
|
||||||
|
[ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown
|
||||||
|
# Create an alternate version of $ac_link that compiles and
|
||||||
|
# links in two steps (.c -> .o, .o -> exe) instead of one
|
||||||
|
# (.c -> exe), because the warning occurs only in the second
|
||||||
|
# step
|
||||||
|
ax_pthread_save_ac_link="$ac_link"
|
||||||
|
ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g'
|
||||||
|
ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"`
|
||||||
|
ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)"
|
||||||
|
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||||
|
for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do
|
||||||
|
AS_IF([test "x$ax_pthread_try" = "xunknown"], [break])
|
||||||
|
CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS"
|
||||||
|
ac_link="$ax_pthread_save_ac_link"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||||
|
[ac_link="$ax_pthread_2step_ac_link"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])],
|
||||||
|
[break])
|
||||||
|
])
|
||||||
|
done
|
||||||
|
ac_link="$ax_pthread_save_ac_link"
|
||||||
|
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||||
|
AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no])
|
||||||
|
ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try"
|
||||||
|
])
|
||||||
|
|
||||||
|
case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in
|
||||||
|
no | unknown) ;;
|
||||||
|
*) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
fi # $ax_pthread_clang = yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Various other checks:
|
||||||
|
if test "x$ax_pthread_ok" = "xyes"; then
|
||||||
|
ax_pthread_save_CFLAGS="$CFLAGS"
|
||||||
|
ax_pthread_save_LIBS="$LIBS"
|
||||||
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
||||||
|
LIBS="$PTHREAD_LIBS $LIBS"
|
||||||
|
|
||||||
|
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
|
||||||
|
AC_CACHE_CHECK([for joinable pthread attribute],
|
||||||
|
[ax_cv_PTHREAD_JOINABLE_ATTR],
|
||||||
|
[ax_cv_PTHREAD_JOINABLE_ATTR=unknown
|
||||||
|
for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||||
|
[int attr = $ax_pthread_attr; return attr /* ; */])],
|
||||||
|
[ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break],
|
||||||
|
[])
|
||||||
|
done
|
||||||
|
])
|
||||||
|
AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \
|
||||||
|
test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \
|
||||||
|
test "x$ax_pthread_joinable_attr_defined" != "xyes"],
|
||||||
|
[AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE],
|
||||||
|
[$ax_cv_PTHREAD_JOINABLE_ATTR],
|
||||||
|
[Define to necessary symbol if this constant
|
||||||
|
uses a non-standard name on your system.])
|
||||||
|
ax_pthread_joinable_attr_defined=yes
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
||||||
|
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
||||||
|
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
||||||
|
case $host_os in
|
||||||
|
solaris*)
|
||||||
|
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
])
|
||||||
|
AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \
|
||||||
|
test "x$ax_pthread_special_flags_added" != "xyes"],
|
||||||
|
[PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS"
|
||||||
|
ax_pthread_special_flags_added=yes])
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT],
|
||||||
|
[ax_cv_PTHREAD_PRIO_INHERIT],
|
||||||
|
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
|
||||||
|
[[int i = PTHREAD_PRIO_INHERIT;
|
||||||
|
return i;]])],
|
||||||
|
[ax_cv_PTHREAD_PRIO_INHERIT=yes],
|
||||||
|
[ax_cv_PTHREAD_PRIO_INHERIT=no])
|
||||||
|
])
|
||||||
|
AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \
|
||||||
|
test "x$ax_pthread_prio_inherit_defined" != "xyes"],
|
||||||
|
[AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.])
|
||||||
|
ax_pthread_prio_inherit_defined=yes
|
||||||
|
])
|
||||||
|
|
||||||
|
CFLAGS="$ax_pthread_save_CFLAGS"
|
||||||
|
LIBS="$ax_pthread_save_LIBS"
|
||||||
|
|
||||||
|
# More AIX lossage: compile with *_r variant
|
||||||
|
if test "x$GCC" != "xyes"; then
|
||||||
|
case $host_os in
|
||||||
|
aix*)
|
||||||
|
AS_CASE(["x/$CC"],
|
||||||
|
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||||
|
[#handle absolute path differently from PATH based program lookup
|
||||||
|
AS_CASE(["x$CC"],
|
||||||
|
[x/*],
|
||||||
|
[AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])],
|
||||||
|
[AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
test -n "$PTHREAD_CC" || PTHREAD_CC="$CC"
|
||||||
|
|
||||||
|
AC_SUBST([PTHREAD_LIBS])
|
||||||
|
AC_SUBST([PTHREAD_CFLAGS])
|
||||||
|
AC_SUBST([PTHREAD_CC])
|
||||||
|
|
||||||
|
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
|
||||||
|
if test "x$ax_pthread_ok" = "xyes"; then
|
||||||
|
ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1])
|
||||||
|
:
|
||||||
|
else
|
||||||
|
ax_pthread_ok=no
|
||||||
|
$2
|
||||||
|
fi
|
||||||
|
AC_LANG_POP
|
||||||
|
])dnl AX_PTHREAD
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
EXTRA_DIST = ccid-1.3.11.patch \
|
|
||||||
pcsc-lite-1.5.5.patch pcsc-lite-1.6.1.patch
|
|
||||||
@@ -10,38 +10,38 @@ do_subst = $(SED) \
|
|||||||
BUILT_SOURCES = cmdline.h cmdline.c
|
BUILT_SOURCES = cmdline.h cmdline.c
|
||||||
|
|
||||||
EXTRA_DIST = ccid-emulator.ggo ccid-emulator.ggo.in
|
EXTRA_DIST = ccid-emulator.ggo ccid-emulator.ggo.in
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/src/OpenSC/src -path '*/.git' -prune -o -type f -a \( -name '*.h' -o -name 'apdu.c' -o -name 'card.c' \) -print)
|
|
||||||
MAINTAINERCLEANFILES = $(BUILT_SOURCES) ccid-emulator.ggo $(dist_man1_MANS)
|
MAINTAINERCLEANFILES = $(BUILT_SOURCES) ccid-emulator.ggo $(dist_man1_MANS)
|
||||||
|
|
||||||
dist_man1_MANS = ccid-emulator.1
|
dist_man1_MANS = ccid-emulator.1
|
||||||
|
|
||||||
ccid_emulator_SOURCES = ccid.c usbstring.c usb.c scutil.c $(BUILT_SOURCES)
|
ccid_emulator_SOURCES = cmdline.c ccid.c usbstring.c usb.c scutil.c
|
||||||
ccid_emulator_LDADD = $(OPENSC_LIBS) $(OPENSSL_LIBS) $(PTHREAD_LIBS)
|
ccid_emulator_LDADD = OpenSC/src/libopensc/libopensc.la
|
||||||
|
ccid_emulator_LDFLAGS = $(OPENSSL_LIBS) $(PTHREAD_LIBS) -static
|
||||||
ccid_emulator_CFLAGS = $(OPENSSL_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_srcdir)/src/OpenSC/src
|
ccid_emulator_CFLAGS = $(OPENSSL_CFLAGS) $(PTHREAD_CFLAGS) -I$(top_srcdir)/src/OpenSC/src
|
||||||
|
|
||||||
|
|
||||||
ccid-emulator.c: $(BUILT_SOURCES)
|
|
||||||
|
|
||||||
$(BUILT_SOURCES): ccid-emulator.ggo
|
$(BUILT_SOURCES): ccid-emulator.ggo
|
||||||
$(GENGETOPT) --output-dir=$(srcdir) < $<
|
$(AM_V_GEN)$(GENGETOPT) --output-dir=$(srcdir) < $<
|
||||||
|
|
||||||
ccid-emulator.ggo: ccid-emulator.ggo.in
|
ccid-emulator.ggo: ccid-emulator.ggo.in
|
||||||
$(do_subst) < $< > $(srcdir)/$@
|
$(AM_V_GEN)$(do_subst) < $< > $(srcdir)/$@
|
||||||
|
|
||||||
|
|
||||||
ccid-emulator.1:
|
ccid-emulator.1:
|
||||||
$(HELP2MAN) \
|
$(AM_V_GEN)$(HELP2MAN) \
|
||||||
--output=$@ \
|
--output=$@ \
|
||||||
--no-info \
|
--no-info \
|
||||||
|
--no-discard-stderr \
|
||||||
--source='$(PACKAGE_STRING)' \
|
--source='$(PACKAGE_STRING)' \
|
||||||
|
--help-option='--input=$< --set-package=$(PACKAGE) --set-version=$(VERSION) --show-help' \
|
||||||
--version-string='$(PACKAGE) $(VERSION)' \
|
--version-string='$(PACKAGE) $(VERSION)' \
|
||||||
$(builddir)/ccid-emulator
|
$(GENGETOPT)
|
||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = ccid-emulator
|
bin_PROGRAMS = ccid-emulator
|
||||||
|
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
ccid.h \
|
ccid.h \
|
||||||
ccid-types.h \
|
cmdline.h \
|
||||||
scutil.h \
|
scutil.h \
|
||||||
usbstring.h
|
usbstring.h
|
||||||
|
|||||||
Submodule ccid/src/OpenSC updated: 0ebe09f5f3...45e29056cc
@@ -1,276 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2009 Frank Morgner
|
|
||||||
*
|
|
||||||
* This file is part of ccid.
|
|
||||||
*
|
|
||||||
* ccid is free software: you can redistribute it and/or modify it under the
|
|
||||||
* terms of the GNU General Public License as published by the Free Software
|
|
||||||
* Foundation, either version 3 of the License, or (at your option) any later
|
|
||||||
* version.
|
|
||||||
*
|
|
||||||
* ccid is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
* details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* ccid. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* @file
|
|
||||||
*/
|
|
||||||
#ifndef _CCID_TYPES_H
|
|
||||||
#define _CCID_TYPES_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USB_REQ_CCID 0xA1
|
|
||||||
|
|
||||||
#define CCID_CONTROL_ABORT 0x01
|
|
||||||
#define CCID_CONTROL_GET_CLOCK_FREQUENCIES 0x02
|
|
||||||
#define CCID_CONTROL_GET_DATA_RATES 0x03
|
|
||||||
|
|
||||||
#define CCID_OPERATION_VERIFY 0x00;
|
|
||||||
#define CCID_OPERATION_MODIFY 0x01;
|
|
||||||
#define CCID_ENTRY_VALIDATE 0x02
|
|
||||||
|
|
||||||
#define CCID_BERROR_CMD_ABORTED 0xff /** Host aborted the current activity */
|
|
||||||
#define CCID_BERROR_ICC_MUTE 0xfe /** CCID timed out while talking to the ICC */
|
|
||||||
#define CCID_BERROR_XFR_PARITY_ERROR 0xfd /** Parity error while talking to the ICC */
|
|
||||||
#define CCID_BERROR_XFR_OVERRUN 0xfc /** Overrun error while talking to the ICC */
|
|
||||||
#define CCID_BERROR_HW_ERROR 0xfb /** An all inclusive hardware error occurred */
|
|
||||||
#define CCID_BERROR_BAD_ATR_TS 0xf
|
|
||||||
#define CCID_BERROR_BAD_ATR_TCK 0xf
|
|
||||||
#define CCID_BERROR_ICC_PROTOCOL_NOT_SUPPORTED 0xf6
|
|
||||||
#define CCID_BERROR_ICC_CLASS_NOT_SUPPORTED 0xf5
|
|
||||||
#define CCID_BERROR_PROCEDURE_BYTE_CONFLICT 0xf4
|
|
||||||
#define CCID_BERROR_DEACTIVATED_PROTOCOL 0xf3
|
|
||||||
#define CCID_BERROR_BUSY_WITH_AUTO_SEQUENCE 0xf2 /** Automatic Sequence Ongoing */
|
|
||||||
#define CCID_BERROR_PIN_TIMEOUT 0xf0
|
|
||||||
#define CCID_BERROR_PIN_CANCELLED 0xef
|
|
||||||
#define CCID_BERROR_CMD_SLOT_BUSY 0xe0 /** A second command was sent to a slot which was already processing a command. */
|
|
||||||
#define CCID_BERROR_CMD_NOT_SUPPORTED 0x00
|
|
||||||
#define CCID_BERROR_OK 0x00
|
|
||||||
|
|
||||||
#define CCID_BSTATUS_OK_ACTIVE 0x00 /** No error. An ICC is present and active */
|
|
||||||
#define CCID_BSTATUS_OK_INACTIVE 0x01 /** No error. ICC is present and inactive */
|
|
||||||
#define CCID_BSTATUS_OK_NOICC 0x02 /** No error. No ICC is present */
|
|
||||||
#define CCID_BSTATUS_ERROR_ACTIVE 0x40 /** Failed. An ICC is present and active */
|
|
||||||
#define CCID_BSTATUS_ERROR_INACTIVE 0x41 /** Failed. ICC is present and inactive */
|
|
||||||
#define CCID_BSTATUS_ERROR_NOICC 0x42 /** Failed. No ICC is present */
|
|
||||||
|
|
||||||
#define CCID_WLEVEL_DIRECT __constant_cpu_to_le16(0) /** APDU begins and ends with this command */
|
|
||||||
#define CCID_WLEVEL_CHAIN_NEXT_XFRBLOCK __constant_cpu_to_le16(1) /** APDU begins with this command, and continue in the next PC_to_RDR_XfrBlock */
|
|
||||||
#define CCID_WLEVEL_CHAIN_END __constant_cpu_to_le16(2) /** abData field continues a command APDU and ends the APDU command */
|
|
||||||
#define CCID_WLEVEL_CHAIN_CONTINUE __constant_cpu_to_le16(3) /** abData field continues a command APDU and another block is to follow */
|
|
||||||
#define CCID_WLEVEL_RESPONSE_IN_DATABLOCK __constant_cpu_to_le16(0x10) /** empty abData field, continuation of response APDU is expected in the next RDR_to_PC_DataBlock */
|
|
||||||
|
|
||||||
#define CCID_PIN_ENCODING_BIN 0x00
|
|
||||||
#define CCID_PIN_ENCODING_BCD 0x01
|
|
||||||
#define CCID_PIN_ENCODING_ASCII 0x02
|
|
||||||
#define CCID_PIN_UNITS_BYTES 0x80
|
|
||||||
#define CCID_PIN_JUSTIFY_RIGHT 0x04
|
|
||||||
#define CCID_PIN_CONFIRM_NEW 0x01
|
|
||||||
#define CCID_PIN_INSERT_OLD 0x02
|
|
||||||
#define CCID_PIN_NO_MSG 0x00
|
|
||||||
#define CCID_PIN_MSG1 0x01
|
|
||||||
#define CCID_PIN_MSG2 0x02
|
|
||||||
#define CCID_PIN_MSG_REF 0x03
|
|
||||||
#define CCID_PIN_MSG_DEFAULT 0xff
|
|
||||||
|
|
||||||
#define CCID_SLOTS_UNCHANGED 0x00
|
|
||||||
#define CCID_SLOT1_CARD_PRESENT 0x01
|
|
||||||
#define CCID_SLOT1_CHANGED 0x02
|
|
||||||
#define CCID_SLOT2_CARD_PRESENT 0x04
|
|
||||||
#define CCID_SLOT2_CHANGED 0x08
|
|
||||||
#define CCID_SLOT3_CARD_PRESENT 0x10
|
|
||||||
#define CCID_SLOT3_CHANGED 0x20
|
|
||||||
#define CCID_SLOT4_CARD_PRESENT 0x40
|
|
||||||
#define CCID_SLOT4_CHANGED 0x80
|
|
||||||
|
|
||||||
#define CCID_EXT_APDU_MAX (4 + 3 + 0xffff + 3)
|
|
||||||
#define CCID_SHORT_APDU_MAX (4 + 1 + 0xff + 1)
|
|
||||||
|
|
||||||
struct ccid_class_descriptor {
|
|
||||||
uint8_t bLength;
|
|
||||||
uint8_t bDescriptorType;
|
|
||||||
uint16_t bcdCCID;
|
|
||||||
uint8_t bMaxSlotIndex;
|
|
||||||
uint8_t bVoltageSupport;
|
|
||||||
uint32_t dwProtocols;
|
|
||||||
uint32_t dwDefaultClock;
|
|
||||||
uint32_t dwMaximumClock;
|
|
||||||
uint8_t bNumClockSupport;
|
|
||||||
uint32_t dwDataRate;
|
|
||||||
uint32_t dwMaxDataRate;
|
|
||||||
uint8_t bNumDataRatesSupported;
|
|
||||||
uint32_t dwMaxIFSD;
|
|
||||||
uint32_t dwSynchProtocols;
|
|
||||||
uint32_t dwMechanical;
|
|
||||||
uint32_t dwFeatures;
|
|
||||||
uint32_t dwMaxCCIDMessageLength;
|
|
||||||
uint8_t bClassGetResponse;
|
|
||||||
uint8_t bclassEnvelope;
|
|
||||||
uint16_t wLcdLayout;
|
|
||||||
uint8_t bPINSupport;
|
|
||||||
uint8_t bMaxCCIDBusySlots;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bmFindexDindex;
|
|
||||||
uint8_t bmTCCKST0;
|
|
||||||
uint8_t bGuardTimeT0;
|
|
||||||
uint8_t bWaitingIntegerT0;
|
|
||||||
uint8_t bClockStop;
|
|
||||||
} __attribute__ ((packed)) abProtocolDataStructure_T0_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bmFindexDindex;
|
|
||||||
uint8_t bmTCCKST1;
|
|
||||||
uint8_t bGuardTimeT1;
|
|
||||||
uint8_t bWaitingIntegersT1;
|
|
||||||
uint8_t bClockStop;
|
|
||||||
uint8_t bIFSC;
|
|
||||||
uint8_t bNadValue;
|
|
||||||
} __attribute__ ((packed)) abProtocolDataStructure_T1_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bTimeOut;
|
|
||||||
uint8_t bmFormatString;
|
|
||||||
uint8_t bmPINBlockString;
|
|
||||||
uint8_t bmPINLengthFormat;
|
|
||||||
uint16_t wPINMaxExtraDigit;
|
|
||||||
uint8_t bEntryValidationCondition;
|
|
||||||
uint8_t bNumberMessage;
|
|
||||||
uint16_t wLangId;
|
|
||||||
uint8_t bMsgIndex;
|
|
||||||
uint8_t bTeoPrologue1;
|
|
||||||
uint16_t bTeoPrologue2;
|
|
||||||
} __attribute__ ((packed)) abPINDataStucture_Verification_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bTimeOut;
|
|
||||||
uint8_t bmFormatString;
|
|
||||||
uint8_t bmPINBlockString;
|
|
||||||
uint8_t bmPINLengthFormat;
|
|
||||||
uint8_t bInsertionOffsetOld;
|
|
||||||
uint8_t bInsertionOffsetNew;
|
|
||||||
uint16_t wPINMaxExtraDigit;
|
|
||||||
uint8_t bConfirmPIN;
|
|
||||||
uint8_t bEntryValidationCondition;
|
|
||||||
uint8_t bNumberMessage;
|
|
||||||
uint16_t wLangId;
|
|
||||||
uint8_t bMsgIndex1;
|
|
||||||
} __attribute__ ((packed)) abPINDataStucture_Modification_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bBWI;
|
|
||||||
uint16_t wLevelParameter;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_XfrBlock_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t abRFU1;
|
|
||||||
uint16_t abRFU2;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_IccPowerOff_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t abRFU1;
|
|
||||||
uint16_t abRFU2;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_GetSlotStatus_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t abRFU1;
|
|
||||||
uint16_t abRFU2;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_GetParameters_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t abRFU1;
|
|
||||||
uint16_t abRFU2;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_ResetParameters_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bProtocolNum;
|
|
||||||
uint16_t abRFU;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_SetParameters_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bBWI;
|
|
||||||
uint16_t wLevelParameter;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_Secure_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bPowerSelect;
|
|
||||||
uint16_t abRFU;
|
|
||||||
} __attribute__ ((packed)) PC_to_RDR_IccPowerOn_t;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bStatus;
|
|
||||||
uint8_t bError;
|
|
||||||
uint8_t bClockStatus;
|
|
||||||
} __attribute__ ((packed)) RDR_to_PC_SlotStatus_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bStatus;
|
|
||||||
uint8_t bError;
|
|
||||||
uint8_t bChainParameter;
|
|
||||||
} __attribute__ ((packed)) RDR_to_PC_DataBlock_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint32_t dwLength;
|
|
||||||
uint8_t bSlot;
|
|
||||||
uint8_t bSeq;
|
|
||||||
uint8_t bStatus;
|
|
||||||
uint8_t bError;
|
|
||||||
uint8_t bProtocolNum;
|
|
||||||
} __attribute__ ((packed)) RDR_to_PC_Parameters_t;
|
|
||||||
typedef struct {
|
|
||||||
uint8_t bMessageType;
|
|
||||||
uint8_t bmSlotICCState; /* we support 1 slots, so we need 2*1 bits = 1 byte */
|
|
||||||
} __attribute__ ((packed)) RDR_to_PC_NotifySlotChange_t;
|
|
||||||
|
|
||||||
struct hid_class_descriptor {
|
|
||||||
uint8_t bLength;
|
|
||||||
uint8_t bDescriptorType;
|
|
||||||
uint16_t bcdHID;
|
|
||||||
uint32_t bCountryCode;
|
|
||||||
uint8_t bNumDescriptors;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#include <asm/byteorder.h>
|
#include <asm/byteorder.h>
|
||||||
#include <libopensc/log.h>
|
#include <libopensc/log.h>
|
||||||
#include <libopensc/opensc.h>
|
#include <libopensc/opensc.h>
|
||||||
#include <libopensc/reader-boxing.h>
|
#include <libopensc/reader-tr03119.h>
|
||||||
#include <libopensc/sm.h>
|
#include <libopensc/sm.h>
|
||||||
#include <sm/sm-eac.h>
|
#include <sm/sm-eac.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
@@ -34,10 +34,6 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "scutil.h"
|
#include "scutil.h"
|
||||||
|
|
||||||
#ifndef HAVE_BOXING_BUF_TO_PACE_INPUT
|
|
||||||
#include <libopensc/reader-boxing.c>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static sc_context_t *ctx = NULL;
|
static sc_context_t *ctx = NULL;
|
||||||
static sc_card_t *card = NULL;
|
static sc_card_t *card = NULL;
|
||||||
static sc_reader_t *reader = NULL;
|
static sc_reader_t *reader = NULL;
|
||||||
@@ -52,7 +48,7 @@ perform_pseudo_apdu_EstablishPACEChannel(sc_apdu_t *apdu)
|
|||||||
memset(&pace_input, 0, sizeof pace_input);
|
memset(&pace_input, 0, sizeof pace_input);
|
||||||
memset(&pace_output, 0, sizeof pace_output);
|
memset(&pace_output, 0, sizeof pace_output);
|
||||||
|
|
||||||
r = boxing_buf_to_pace_input(reader->ctx, apdu->data, apdu->datalen,
|
r = escape_buf_to_pace_input(reader->ctx, apdu->data, apdu->datalen,
|
||||||
&pace_input);
|
&pace_input);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto err;
|
goto err;
|
||||||
@@ -62,7 +58,7 @@ perform_pseudo_apdu_EstablishPACEChannel(sc_apdu_t *apdu)
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
r = boxing_pace_output_to_buf(reader->ctx, &pace_output, &apdu->resp,
|
r = escape_pace_output_to_buf(reader->ctx, &pace_output, &apdu->resp,
|
||||||
&apdu->resplen);
|
&apdu->resplen);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
@@ -85,7 +81,7 @@ perform_pseudo_apdu_GetReaderPACECapabilities(sc_apdu_t *apdu)
|
|||||||
| SC_READER_CAP_PACE_EID | SC_READER_CAP_PACE_ESIGN;
|
| SC_READER_CAP_PACE_EID | SC_READER_CAP_PACE_ESIGN;
|
||||||
|
|
||||||
|
|
||||||
return boxing_pace_capabilities_to_buf(reader->ctx,
|
return escape_pace_capabilities_to_buf(reader->ctx,
|
||||||
sc_reader_t_capabilities, &apdu->resp, &apdu->resplen);
|
sc_reader_t_capabilities, &apdu->resp, &apdu->resplen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,11 +460,6 @@ perform_PC_to_RDR_IccPowerOn(const __u8 *in, size_t inlen, __u8 **out, size_t *o
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sc_result >= 0) {
|
if (sc_result >= 0) {
|
||||||
#ifdef WITH_PACE
|
|
||||||
#ifndef DISABLE_GLOBAL_BOXING_INITIALIZATION
|
|
||||||
sc_initialize_boxing_cmds(ctx);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
return get_RDR_to_PC_SlotStatus(request->bSeq,
|
return get_RDR_to_PC_SlotStatus(request->bSeq,
|
||||||
sc_result, out, outlen, card->atr.value, card->atr.len);
|
sc_result, out, outlen, card->atr.value, card->atr.len);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -23,8 +23,7 @@
|
|||||||
#define _CCID_H
|
#define _CCID_H
|
||||||
|
|
||||||
#include <linux/usb/ch9.h>
|
#include <linux/usb/ch9.h>
|
||||||
#include <libopensc/opensc.h>
|
#include <libopensc/ccid-types.h>
|
||||||
#include "ccid-types.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|||||||
@@ -20,29 +20,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "libopensc/internal.h"
|
#include <libopensc/internal.h>
|
||||||
|
|
||||||
#ifndef HAVE__SC_MATCH_ATR
|
|
||||||
int sc_dlclose(void *handle) {}
|
|
||||||
const char *sc_dlerror() {}
|
|
||||||
void *sc_dlsym(void *handle, const char *symbol) {}
|
|
||||||
size_t strlcpy(char *dst, const char *src, size_t siz) {}
|
|
||||||
int sc_mutex_create(const sc_context_t *ctx, void **mutex) {}
|
|
||||||
int sc_mutex_destroy(const sc_context_t *ctx, void *mutex) {}
|
|
||||||
int _sc_parse_atr(sc_reader_t *reader) {}
|
|
||||||
void *sc_dlopen(const char *filename) {}
|
|
||||||
int sc_mutex_lock(const sc_context_t *ctx, void *mutex) {}
|
|
||||||
int sc_mutex_unlock(const sc_context_t *ctx, void *mutex) {}
|
|
||||||
#include "libopensc/card.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_SC_APDU_GET_OCTETS) || !defined(HAVE_SC_APDU_SET_RESP)
|
|
||||||
#ifdef HAVE__SC_MATCH_ATR
|
|
||||||
size_t sc_get_max_send_size(const sc_card_t *card) {return 0;}
|
|
||||||
#endif
|
|
||||||
#include "libopensc/apdu.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <libopensc/log.h>
|
#include <libopensc/log.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -107,7 +85,7 @@ void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
|
|||||||
if (!f) {
|
if (!f) {
|
||||||
char buf[1800];
|
char buf[1800];
|
||||||
if (data)
|
if (data)
|
||||||
sc_hex_dump(ctx, SC_LOG_DEBUG_NORMAL, data, len, buf, sizeof buf);
|
sc_hex_dump(data, len, buf, sizeof buf);
|
||||||
else
|
else
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
sc_do_log(ctx, type, file, line, func,
|
sc_do_log(ctx, type, file, line, func,
|
||||||
|
|||||||
@@ -88,38 +88,5 @@ void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
|
|||||||
*/
|
*/
|
||||||
int print_avail(int verbose);
|
int print_avail(int verbose);
|
||||||
|
|
||||||
/*
|
|
||||||
* OPENSC functions that do not get exported (sometimes)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the encoded APDU in newly created buffer.
|
|
||||||
* @param ctx sc_context_t object
|
|
||||||
* @param apdu sc_apdu_t object with the APDU to encode
|
|
||||||
* @param buf pointer to the newly allocated buffer
|
|
||||||
* @param len length of the encoded APDU
|
|
||||||
* @param proto protocol to be used
|
|
||||||
* @return SC_SUCCESS on success and an error code otherwise
|
|
||||||
*/
|
|
||||||
int sc_apdu_get_octets(sc_context_t *ctx, const sc_apdu_t *apdu, u8 **buf,
|
|
||||||
size_t *len, unsigned int proto);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the status bytes and return data in the APDU
|
|
||||||
* @param ctx sc_context_t object
|
|
||||||
* @param apdu the apdu to which the data should be written
|
|
||||||
* @param buf returned data
|
|
||||||
* @param len length of the returned data
|
|
||||||
* @return SC_SUCCESS on success and an error code otherwise
|
|
||||||
*/
|
|
||||||
int sc_apdu_set_resp(sc_context_t *ctx, sc_apdu_t *apdu, const u8 *buf,
|
|
||||||
size_t len);
|
|
||||||
|
|
||||||
/* Returns an index number if a match was found, -1 otherwise. table has to
|
|
||||||
* be null terminated. */
|
|
||||||
int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *type_out);
|
|
||||||
|
|
||||||
int fread_to_eof(const char *file, unsigned char **buf, size_t *buflen);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* @} */
|
/* @} */
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ os.system("make doc -C virtualsmartcard")
|
|||||||
os.system("make doc -C ccid")
|
os.system("make doc -C ccid")
|
||||||
os.system("make doc -C pcsc-relay")
|
os.system("make doc -C pcsc-relay")
|
||||||
|
|
||||||
|
os.environ['PATH'] = os.path.abspath('../ccid/src') + os.pathsep + os.environ['PATH']
|
||||||
os.environ['PATH'] = os.path.abspath('../pcsc-relay/src') + os.pathsep + os.environ['PATH']
|
os.environ['PATH'] = os.path.abspath('../pcsc-relay/src') + os.pathsep + os.environ['PATH']
|
||||||
os.environ['PATH'] = os.path.abspath('../virtualsmartcard/src/vpicc') + os.pathsep + os.environ['PATH']
|
os.environ['PATH'] = os.path.abspath('../virtualsmartcard/src/vpicc') + os.pathsep + os.environ['PATH']
|
||||||
|
|
||||||
|
|||||||
@@ -265,6 +265,9 @@ modern Windows and Unix-like systems by default.
|
|||||||
|
|
||||||
.. include:: autotools.txt
|
.. include:: autotools.txt
|
||||||
|
|
||||||
|
The USB CCID Emulator depends on :program:`libopensc`, which is automatically
|
||||||
|
built from a snapshot of the OpenSC source code and then statically linked.
|
||||||
|
|
||||||
|
|
||||||
=================
|
=================
|
||||||
Hints on GadgetFS
|
Hints on GadgetFS
|
||||||
@@ -302,33 +305,6 @@ loading the module, you maybe want to check out `this patch
|
|||||||
<http://comments.gmane.org/gmane.linux.usb.general/47440>`_.
|
<http://comments.gmane.org/gmane.linux.usb.general/47440>`_.
|
||||||
|
|
||||||
|
|
||||||
===============
|
|
||||||
Hints on OpenSC
|
|
||||||
===============
|
|
||||||
|
|
||||||
USB CCID Emulator needs the OpenSC components to be
|
|
||||||
installed (especially :file:`libopensc.so`). Here is an example of how to get
|
|
||||||
the standard installation of OpenSC without |PACE|::
|
|
||||||
|
|
||||||
PREFIX=/tmp/install
|
|
||||||
VSMARTCARD=$PWD/vsmartcard
|
|
||||||
git clone https://github.com/frankmorgner/vsmartcard.git $VSMARTCARD
|
|
||||||
cd $VSMARTCARD
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
cd $VSMARTCARD/ccid/src/opensc
|
|
||||||
autoreconf --verbose --install
|
|
||||||
./configure --prefix=$PREFIX
|
|
||||||
make install && cd -
|
|
||||||
|
|
||||||
Now :file:`libopensc.so` should be located in ``$PREFIX/lib``. Here is how to
|
|
||||||
configure the USB CCID Emulator to use it::
|
|
||||||
|
|
||||||
cd $VSMARTCARD/ccid
|
|
||||||
./configure --prefix=$PREFIX OPENSC_LIBS="-L$PREFIX/lib -lopensc"
|
|
||||||
make install && cd -
|
|
||||||
|
|
||||||
|
|
||||||
*****
|
*****
|
||||||
Usage
|
Usage
|
||||||
*****
|
*****
|
||||||
|
|||||||
@@ -109,7 +109,6 @@
|
|||||||
<li><a class="reference internal" href="#installation">Installation</a><ul>
|
<li><a class="reference internal" href="#installation">Installation</a><ul>
|
||||||
<li><a class="reference internal" href="#installation-on-linux-unix-and-similar">Installation on Linux, Unix and similar</a></li>
|
<li><a class="reference internal" href="#installation-on-linux-unix-and-similar">Installation on Linux, Unix and similar</a></li>
|
||||||
<li><a class="reference internal" href="#hints-on-gadgetfs">Hints on GadgetFS</a></li>
|
<li><a class="reference internal" href="#hints-on-gadgetfs">Hints on GadgetFS</a></li>
|
||||||
<li><a class="reference internal" href="#hints-on-opensc">Hints on OpenSC</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li><a class="reference internal" href="#usage">Usage</a></li>
|
<li><a class="reference internal" href="#usage">Usage</a></li>
|
||||||
@@ -491,6 +490,8 @@ make
|
|||||||
make install
|
make install
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</div>
|
</div>
|
||||||
|
<p>The USB CCID Emulator depends on <strong class="program">libopensc</strong>, which is automatically
|
||||||
|
built from a snapshot of the OpenSC source code and then statically linked.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="hints-on-gadgetfs">
|
<div class="section" id="hints-on-gadgetfs">
|
||||||
<h3>Hints on GadgetFS<a class="headerlink" href="#hints-on-gadgetfs" title="Permalink to this headline">¶</a></h3>
|
<h3>Hints on GadgetFS<a class="headerlink" href="#hints-on-gadgetfs" title="Permalink to this headline">¶</a></h3>
|
||||||
@@ -522,31 +523,6 @@ patch is needed</a>.</p>
|
|||||||
<p>If you are using a more recent version of <strong class="program">dummy_hcd</strong> and get an error
|
<p>If you are using a more recent version of <strong class="program">dummy_hcd</strong> and get an error
|
||||||
loading the module, you maybe want to check out <a class="reference external" href="http://comments.gmane.org/gmane.linux.usb.general/47440">this patch</a>.</p>
|
loading the module, you maybe want to check out <a class="reference external" href="http://comments.gmane.org/gmane.linux.usb.general/47440">this patch</a>.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="hints-on-opensc">
|
|
||||||
<h3>Hints on OpenSC<a class="headerlink" href="#hints-on-opensc" title="Permalink to this headline">¶</a></h3>
|
|
||||||
<p>USB CCID Emulator needs the OpenSC components to be
|
|
||||||
installed (especially <tt class="file docutils literal"><span class="pre">libopensc.so</span></tt>). Here is an example of how to get
|
|
||||||
the standard installation of OpenSC without <abbr title="Password Authenticated Connection Establishment">PACE</abbr>:</p>
|
|
||||||
<div class="highlight-sh"><div class="highlight"><pre><span class="nv">PREFIX</span><span class="o">=</span>/tmp/install
|
|
||||||
<span class="nv">VSMARTCARD</span><span class="o">=</span><span class="nv">$PWD</span>/vsmartcard
|
|
||||||
git clone https://github.com/frankmorgner/vsmartcard.git <span class="nv">$VSMARTCARD</span>
|
|
||||||
<span class="nb">cd</span> <span class="nv">$VSMARTCARD</span>
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
<span class="nb">cd</span> <span class="nv">$VSMARTCARD</span>/ccid/src/opensc
|
|
||||||
autoreconf --verbose --install
|
|
||||||
./configure --prefix<span class="o">=</span><span class="nv">$PREFIX</span>
|
|
||||||
make install <span class="o">&&</span> <span class="nb">cd</span> -
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
<p>Now <tt class="file docutils literal"><span class="pre">libopensc.so</span></tt> should be located in <tt class="docutils literal"><span class="pre">$PREFIX/lib</span></tt>. Here is how to
|
|
||||||
configure the USB CCID Emulator to use it:</p>
|
|
||||||
<div class="highlight-sh"><div class="highlight"><pre><span class="nb">cd</span> <span class="nv">$VSMARTCARD</span>/ccid
|
|
||||||
./configure --prefix<span class="o">=</span><span class="nv">$PREFIX</span> <span class="nv">OPENSC_LIBS</span><span class="o">=</span><span class="s2">"-L</span><span class="nv">$PREFIX</span><span class="s2">/lib -lopensc"</span>
|
|
||||||
make install <span class="o">&&</span> <span class="nb">cd</span> -
|
|
||||||
</pre></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="usage">
|
<div class="section" id="usage">
|
||||||
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
|
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
|
||||||
|
|||||||
@@ -160,6 +160,13 @@ AC_FUNC_MALLOC
|
|||||||
AC_FUNC_REALLOC
|
AC_FUNC_REALLOC
|
||||||
|
|
||||||
|
|
||||||
|
AC_CONFIG_FILES([Makefile
|
||||||
|
doc/Makefile
|
||||||
|
win32/Makefile
|
||||||
|
src/Makefile])
|
||||||
|
|
||||||
|
AC_OUTPUT
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
pcsc-relay has been configured with following options:
|
pcsc-relay has been configured with following options:
|
||||||
@@ -168,13 +175,15 @@ Version: ${PACKAGE_VERSION}
|
|||||||
User binaries: $(eval eval eval echo "${bindir}")
|
User binaries: $(eval eval eval echo "${bindir}")
|
||||||
Enable libnfc: ${enable_libnfc}
|
Enable libnfc: ${enable_libnfc}
|
||||||
|
|
||||||
|
OpenPICC device: ${piccdev}
|
||||||
|
|
||||||
Host: ${host}
|
Host: ${host}
|
||||||
Compiler: ${CC}
|
Compiler: ${CC}
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
Preprocessor flags: ${CPPFLAGS}
|
||||||
Compiler flags: ${CFLAGS}
|
Compiler flags: ${CFLAGS}
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
|
||||||
Linker flags: ${LDFLAGS}
|
Linker flags: ${LDFLAGS}
|
||||||
Libraries: ${LIBS}
|
Libraries: ${LIBS}
|
||||||
|
|
||||||
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
||||||
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
||||||
PCSC_CFLAGS: ${PCSC_CFLAGS}
|
PCSC_CFLAGS: ${PCSC_CFLAGS}
|
||||||
@@ -182,17 +191,7 @@ PCSC_LIBS: ${PCSC_LIBS}
|
|||||||
LIBNFC_CFLAGS: ${LIBNFC_CFLAGS}
|
LIBNFC_CFLAGS: ${LIBNFC_CFLAGS}
|
||||||
LIBNFC_LIBS: ${LIBNFC_LIBS}
|
LIBNFC_LIBS: ${LIBNFC_LIBS}
|
||||||
|
|
||||||
OpenPICC device: ${piccdev}
|
|
||||||
|
|
||||||
|
|
||||||
HELP2MAN: ${HELP2MAN}
|
HELP2MAN: ${HELP2MAN}
|
||||||
GENGETOPT: ${GENGETOPT}
|
GENGETOPT: ${GENGETOPT}
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
|
||||||
doc/Makefile
|
|
||||||
win32/Makefile
|
|
||||||
src/Makefile])
|
|
||||||
AC_OUTPUT
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ do_subst = $(SED) \
|
|||||||
-e 's,[@]libdir[@],$(libdir),g' \
|
-e 's,[@]libdir[@],$(libdir),g' \
|
||||||
-e 's,[@]includedir[@],$(includedir),g' \
|
-e 's,[@]includedir[@],$(includedir),g' \
|
||||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||||
-e 's,[@]OPENSC_LIBS[@],$(OPENSC_LIBS),g' \
|
|
||||||
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
||||||
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
||||||
|
|
||||||
|
|||||||
@@ -16,18 +16,19 @@ dist_man1_MANS = pcsc-relay.1
|
|||||||
|
|
||||||
|
|
||||||
pcsc-relay.1:
|
pcsc-relay.1:
|
||||||
$(HELP2MAN) \
|
$(AM_V_GEN)$(HELP2MAN) \
|
||||||
--output=$@ \
|
--output=$@ \
|
||||||
--no-info \
|
--no-info \
|
||||||
--no-discard-stderr \
|
--no-discard-stderr \
|
||||||
--source='$(PACKAGE_STRING)' \
|
--source='$(PACKAGE_STRING)' \
|
||||||
|
--help-option='--input=$< --set-package=$(PACKAGE) --set-version=$(VERSION) --show-help' \
|
||||||
--version-string='$(PACKAGE) $(VERSION)' \
|
--version-string='$(PACKAGE) $(VERSION)' \
|
||||||
$(builddir)/pcsc-relay
|
$(GENGETOPT)
|
||||||
|
|
||||||
|
|
||||||
bin_PROGRAMS = pcsc-relay
|
bin_PROGRAMS = pcsc-relay
|
||||||
|
|
||||||
pcsc_relay_SOURCES = pcsc-relay.c pcsc.c vpcd.c vpcd-driver.c opicc.c lnfc.c vicc.c lock.c $(BUILT_SOURCES)
|
pcsc_relay_SOURCES = cmdline.c pcsc-relay.c pcsc.c vpcd.c vpcd-driver.c opicc.c lnfc.c vicc.c lock.c
|
||||||
pcsc_relay_LDADD = $(PCSC_LIBS) $(LIBNFC_LIBS)
|
pcsc_relay_LDADD = $(PCSC_LIBS) $(LIBNFC_LIBS)
|
||||||
pcsc_relay_CFLAGS = $(PCSC_CFLAGS) $(LIBNFC_CFLAGS)
|
pcsc_relay_CFLAGS = $(PCSC_CFLAGS) $(LIBNFC_CFLAGS)
|
||||||
|
|
||||||
@@ -35,12 +36,10 @@ if WIN32
|
|||||||
pcsc_relay_LDADD += -lws2_32
|
pcsc_relay_LDADD += -lws2_32
|
||||||
endif
|
endif
|
||||||
|
|
||||||
noinst_HEADERS = pcsc-relay.h vpcd.h lock.h
|
noinst_HEADERS = cmdline.h pcsc-relay.h vpcd.h lock.h
|
||||||
|
|
||||||
pcsc-relay.c: $(BUILT_SOURCES)
|
|
||||||
|
|
||||||
$(BUILT_SOURCES): pcsc-relay.ggo
|
$(BUILT_SOURCES): pcsc-relay.ggo
|
||||||
$(GENGETOPT) --output-dir=$(srcdir) < $<
|
$(AM_V_GEN)$(GENGETOPT) --output-dir=$(srcdir) < $<
|
||||||
|
|
||||||
pcsc-relay.ggo: pcsc-relay.ggo.in
|
pcsc-relay.ggo: pcsc-relay.ggo.in
|
||||||
$(do_subst) < $< > $(srcdir)/$@
|
$(AM_V_GEN)$(do_subst) < $< > $(srcdir)/$@
|
||||||
|
|||||||
1
vJCRE
1
vJCRE
Submodule vJCRE deleted from faff77a157
@@ -265,44 +265,6 @@ case "$host" in
|
|||||||
LIB_PREFIX="lib"
|
LIB_PREFIX="lib"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
${PACKAGE} has been configured with following options:
|
|
||||||
|
|
||||||
Version: ${PACKAGE_VERSION}
|
|
||||||
User binaries: $(eval eval eval echo "${bindir}")
|
|
||||||
PC/SC configuration: ${serialconfdir}
|
|
||||||
Driver directory: ${serialdropdir}
|
|
||||||
Python site-packages: $(eval eval eval echo "${pythondir}")
|
|
||||||
|
|
||||||
Build libpcsclite: ${libpcsclite}
|
|
||||||
Build Info.plist: ${infoplist}
|
|
||||||
Build reader.conf: ${readerconf}
|
|
||||||
VPCD hostname: ${vpcdhost}
|
|
||||||
VPCD slot count: ${vpcdslots}
|
|
||||||
|
|
||||||
|
|
||||||
Host: ${host}
|
|
||||||
Compiler: ${CC}
|
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
|
||||||
Compiler flags: ${CFLAGS}
|
|
||||||
Preprocessor flags: ${CPPFLAGS}
|
|
||||||
Linker flags: ${LDFLAGS}
|
|
||||||
Libraries: ${LIBS}
|
|
||||||
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
|
||||||
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
|
||||||
PCSC_CFLAGS: ${PCSC_CFLAGS}
|
|
||||||
PCSC_LIBS: ${PCSC_LIBS}
|
|
||||||
QRENCODE_CFLAGS: ${QRENCODE_CFLAGS}
|
|
||||||
QRENCODE_LIBS: ${QRENCODE_LIBS}
|
|
||||||
BUNDLE_HOST: ${BUNDLE_HOST}
|
|
||||||
LIB_PREFIX: ${LIB_PREFIX}
|
|
||||||
DYN_LIB_EXT: ${DYN_LIB_EXT}
|
|
||||||
|
|
||||||
|
|
||||||
HELP2MAN: ${HELP2MAN}
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
@@ -319,3 +281,40 @@ AC_CONFIG_FILES([Makefile
|
|||||||
MacOSX/Makefile
|
MacOSX/Makefile
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
cat << EOF
|
||||||
|
|
||||||
|
${PACKAGE} has been configured with following options:
|
||||||
|
|
||||||
|
Version: ${PACKAGE_VERSION}
|
||||||
|
User binaries: $(eval eval eval echo "${bindir}")
|
||||||
|
PC/SC configuration: ${serialconfdir}
|
||||||
|
Driver directory: ${serialdropdir}
|
||||||
|
Python site-packages: $(eval eval eval echo "${pythondir}")
|
||||||
|
|
||||||
|
Build libpcsclite: ${libpcsclite}
|
||||||
|
Build Info.plist: ${infoplist}
|
||||||
|
Build reader.conf: ${readerconf}
|
||||||
|
VPCD hostname: ${vpcdhost}
|
||||||
|
VPCD slot count: ${vpcdslots}
|
||||||
|
|
||||||
|
Host: ${host}
|
||||||
|
Compiler: ${CC}
|
||||||
|
Preprocessor flags: ${CPPFLAGS}
|
||||||
|
Compiler flags: ${CFLAGS}
|
||||||
|
Linker flags: ${LDFLAGS}
|
||||||
|
Libraries: ${LIBS}
|
||||||
|
|
||||||
|
PTHREAD_LIBS: ${PTHREAD_LIBS}
|
||||||
|
PTHREAD_CFLAGS: ${PTHREAD_CFLAGS}
|
||||||
|
PCSC_CFLAGS: ${PCSC_CFLAGS}
|
||||||
|
PCSC_LIBS: ${PCSC_LIBS}
|
||||||
|
QRENCODE_CFLAGS: ${QRENCODE_CFLAGS}
|
||||||
|
QRENCODE_LIBS: ${QRENCODE_LIBS}
|
||||||
|
BUNDLE_HOST: ${BUNDLE_HOST}
|
||||||
|
LIB_PREFIX: ${LIB_PREFIX}
|
||||||
|
DYN_LIB_EXT: ${DYN_LIB_EXT}
|
||||||
|
|
||||||
|
HELP2MAN: ${HELP2MAN}
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ do_subst = $(SED) \
|
|||||||
-e 's,[@]libdir[@],$(libdir),g' \
|
-e 's,[@]libdir[@],$(libdir),g' \
|
||||||
-e 's,[@]includedir[@],$(includedir),g' \
|
-e 's,[@]includedir[@],$(includedir),g' \
|
||||||
-e 's,[@]VERSION[@],$(VERSION),g' \
|
-e 's,[@]VERSION[@],$(VERSION),g' \
|
||||||
-e 's,[@]OPENSC_LIBS[@],$(OPENSC_LIBS),g' \
|
|
||||||
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
-e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
|
||||||
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
-e 's,[@]top_srcdir[@],$(top_srcdir),g'
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ nobase_include_HEADERS = \
|
|||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libpcsclite.pc
|
pkgconfig_DATA = libpcsclite.pc
|
||||||
libpcsclite.pc: libpcsclite.pc.in
|
libpcsclite.pc: libpcsclite.pc.in
|
||||||
$(do_subst) < $(srcdir)/libpcsclite.pc.in > libpcsclite.pc
|
$(AM_V_GEN)$(do_subst) < $(srcdir)/libpcsclite.pc.in > libpcsclite.pc
|
||||||
|
|
||||||
do_subst = $(SED) \
|
do_subst = $(SED) \
|
||||||
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
|
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g' \
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ do_subst = $(SED) \
|
|||||||
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g'
|
-e 's,[@]PACKAGE_NAME[@],$(PACKAGE_NAME),g'
|
||||||
|
|
||||||
$(builddir)/vicc: vicc.in Makefile
|
$(builddir)/vicc: vicc.in Makefile
|
||||||
$(do_subst) < $(srcdir)/vicc.in > $(builddir)/vicc
|
$(AM_V_GEN)$(do_subst) < $(srcdir)/vicc.in > $(builddir)/vicc
|
||||||
chmod +x $(builddir)/vicc
|
@chmod +x $(builddir)/vicc
|
||||||
|
|
||||||
vicc.1: vicc.in
|
vicc.1: $(builddir)/vicc
|
||||||
$(HELP2MAN) \
|
$(AM_V_GEN)$(HELP2MAN) \
|
||||||
--no-discard-stderr \
|
--no-discard-stderr \
|
||||||
--output=$@ \
|
--output=$@ \
|
||||||
$(builddir)/vicc
|
$(builddir)/vicc
|
||||||
|
|||||||
Reference in New Issue
Block a user