Index: Makefile.in ================================================================== --- Makefile.in +++ Makefile.in @@ -12,14 +12,20 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ @SET_MAKE@ -all: +all: @DEFAULT_TARGET@ + +shared: $(MAKE) libcackey.@SHOBJEXT@ -$(MAKE) libcackey_g.@SHOBJEXT@ +static: + $(MAKE) libcackey.a + -$(MAKE) libcackey_g.a + cackey.o: cackey.c cackey_builtin_certs.h sha1.c sha1.h md5.c md5.h asn1-x509.c asn1-x509.h config.h $(CC) $(SHOBJFLAGS) $(CPPFLAGS) $(CFLAGS) -o cackey.o -c cackey.c cackey_g.o: cackey.c cackey_builtin_certs.h sha1.c sha1.h md5.c md5.h asn1-x509.c asn1-x509.h config.h $(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) -o cackey_g.o -c cackey.c @@ -31,10 +37,20 @@ libcackey_g.@SHOBJEXT@: cackey_g.o $(CC) $(SHOBJFLAGS) $(DEBUGCPPFLAGS) $(DEBUGCFLAGS) $(SHOBJLDFLAGS) $(LDFLAGS) -o libcackey_g.@SHOBJEXT@ cackey_g.o $(LIBS) -@WEAKENSYMS@ "libcackey_g.@SHOBJEXT@" +libcackey.a: cackey.o + rm -f libcackey.a + $(AR) rcu libcackey.a cackey.o + -$(RANLIB) libcackey.a + +libcackey_g.a: cackey_g.o + rm -f libcackey_g.a + $(AR) rcu libcackey_g.a cackey_g.o + -$(RANLIB) libcackey_g.a + test: test.c libcackey_g.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o test test.c -Wl,-R,. libcackey_g.@SHOBJEXT@ test-afl.data: test tmpLogFile='log.$(shell openssl rand -hex 16)'; \ @@ -70,6 +86,6 @@ rm -f config.log config.status config.h Makefile libcackey.syms mrproper: distclean rm -f configure config.h.in aclocal.m4 *~ -.PHONY: all clean distclean mrproper install +.PHONY: all shared static clean distclean mrproper install Index: aclocal/dc_shobjs.m4 ================================================================== --- aclocal/dc_shobjs.m4 +++ aclocal/dc_shobjs.m4 @@ -20,13 +20,15 @@ ]) AC_DEFUN(DC_GET_SHOBJFLAGS, [ AC_SUBST(SHOBJFLAGS) AC_SUBST(SHOBJLDFLAGS) + AC_SUBST(DEFAULT_TARGET) AC_MSG_CHECKING(how to create shared objects) + DEFAULT_TARGET=shared if test -z "$SHOBJFLAGS" -a -z "$SHOBJLDFLAGS"; then DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -rdynamic -mimpure-text], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -mimpure-text], [ @@ -35,12 +37,11 @@ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-shared -dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress -bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-Wl,-dynamiclib -Wl,-flat_namespace -Wl,-undefined,suppress -Wl,-bind_at_load], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib -flat_namespace -undefined suppress], [ DC_TEST_SHOBJFLAGS([-fPIC -DPIC], [-dynamiclib], [ - AC_MSG_RESULT(cant) - AC_MSG_ERROR([We are unable to make shared objects.]) + DEFAULT_TARGET=static ]) ]) ]) ]) ]) @@ -50,11 +51,15 @@ ]) ]) ]) fi - AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS) + if test "$DEFAULT_TARGET" = 'shared' ; then + AC_MSG_RESULT($SHOBJLDFLAGS $SHOBJFLAGS) + else + AC_MSG_RESULT(cant -- result will be a static archive) + fi DC_SYNC_SHLIBOBJS ]) AC_DEFUN(DC_SYNC_SHLIBOBJS, [ Index: build/chrome/build-deps ================================================================== --- build/chrome/build-deps +++ build/chrome/build-deps @@ -287,10 +287,11 @@ } function buildCACKey() { local platform local file copied + local targets platform="$1" shift if [ -z "${platform}" ]; then @@ -307,11 +308,11 @@ ./configure --with-pcsc-headers="${cackeyChromeExtPCSCLiteDir}/include/PCSC" --with-pcsc-libs="${PCSC_LIBS}" "$@" || exit 1 make || exit 1 ) || return 1 copied='0' - for file in ../../libcackey{,_g}.{so,dll,dylib}; do + for file in ../../libcackey{,_g}.{so,dll,dylib,a}; do if [ -f "${file}" ]; then mkdir -p "${outdir}/${platform}" cp "${file}" "${outdir}/${platform}" copied='1' @@ -345,22 +346,10 @@ buildPCSCLite || exit 1 buildCACKey build || exit 1 -buildOutputType="$(echo 'int main(int argc, char **argv) { return(0); }' | "${CC:-cc}" -x c - -o /dev/stdout | file -)" || exit 1 -case "${buildOutputType}" in - *x86-64*) - naclTopDir='linux_x86_glibc' - naclPlatform='x86_64-nacl' - ;; - *) - echo "error: Unrecognized platform output: \"${buildOutputType}\"" >&2 - - exit 1 - ;; -esac -PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/${naclTopDir}/bin" buildCACKey "${naclPlatform}" --host="${naclPlatform}" CC=${naclPlatform}-gcc LD=${naclPlatform}-ld OBJCOPY=${naclPlatform}-objcopy STRIP=${naclPlatform}-strip || exit 1 +PATH="${PATH}:${NACL_SDK_ROOT}/toolchain/linux_pnacl/bin" buildCACKey pnacl --host="nacl" CC=pnacl-clang LD=pnacl-ld OBJCOPY=pnacl-objcopy STRIP=pnacl-strip AR=pnacl-ar RANLIB=pnacl-ranlib cackey_cv_pcsc_works=okay || exit 1 cleanup exit 0 Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -81,13 +81,13 @@ dnl Check for ZLIB libraries AC_CHECK_LIB(z, uncompress) dnl Verify that a basic program will compile -AC_MSG_CHECKING([if basic PC/SC program works]) -AC_LINK_IFELSE( - AC_LANG_PROGRAM([[ +AC_CACHE_CHECK([if basic PC/SC program works], cackey_cv_pcsc_works, [ + AC_LINK_IFELSE( + AC_LANG_PROGRAM([[ #ifdef HAVE_WINTYPES_H # include #endif #ifdef HAVE_PCSCLITE_H # include @@ -122,28 +122,31 @@ #ifdef HAVE_ZLIB_H # ifdef HAVE_LIBZ # include # endif #endif - ]], [[ - LPSCARDHANDLE hCard; - SCARDCONTEXT hContext; - DWORD dwActiveProtocol; - LONG scard_conn_ret, scard_est_context_ret; - - scard_est_context_ret = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext); - - hCard = NULL; - scard_conn_ret = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, hCard, &dwActiveProtocol); - ]]), [ - AC_MSG_RESULT(okay) - ], [ - AC_MSG_RESULT(failed) - - AC_MSG_FAILURE([simple PC/SC program failed]) - ] -) + ]], [[ + LPSCARDHANDLE hCard; + SCARDCONTEXT hContext; + DWORD dwActiveProtocol; + LONG scard_conn_ret, scard_est_context_ret; + + scard_est_context_ret = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext); + + hCard = NULL; + scard_conn_ret = SCardConnect(hContext, "Reader X", SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0, hCard, &dwActiveProtocol); + ]]), [ + cackey_cv_pcsc_works=okay + ], [ + cackey_cv_pcsc_works=failed + ]) + ] +) + +if test "$cackey_cv_pcsc_works" = 'failed'; then + AC_MSG_FAILURE([simple PC/SC program failed]) +fi dnl Option to enable DoD certs on hardware slot AC_ARG_ENABLE(dod-certs-on-hw-slots, AC_HELP_STRING([--enable-dod-certs-on-hw-slots], [Specify that DoD certificates should be made available on hardware token slots]), [ dodcertsonhwslots=$enableval ], [