autotools tuning
authorEugene Crosser <Eugene.Crosser@ru.ibm.com>
Tue, 29 Oct 2013 12:32:35 +0000 (16:32 +0400)
committerEugene Crosser <Eugene.Crosser@ru.ibm.com>
Tue, 29 Oct 2013 12:32:35 +0000 (16:32 +0400)
Makefile.am
autogen.sh
configure.ac

index dc232665f5bfc8cdc58cfccdad16ecf27c9be3d1..e83b179e26a16c5468410fb4d69d9bd54194f18d 100644 (file)
@@ -3,22 +3,21 @@
 AUTOMAKE_OPTIONS = foreign
 ACLOCAL_AMFLAGS = -I m4
 
-LIBS = @LIBS@
-pamlibdir = @pamlibdir@
-
 noinst_HEADERS = pcsc_cr.h token.h
-noinst_PROGRAMS = test_cr
-test_cr_DEPENDENCIES = pam_pcsc_cr.la
+
+EXTRA_LTLIBRARIES = libpcsc_cr.la
+libpcsc_cr_la_SOURCES = crypto.c pcsc_cr.c ykneo.c
+EXTRA_libpcsc_cr_la_SOURCES = ossl_crypto.c tom_prypto.c
+libpcsc_cr_la_LIBADD = @CRYPTO_OBJS@
+libpcsc_cr_la_DEPENDENCIES = @CRYPTO_OBJS@
 
 lib_LTLIBRARIES = pam_pcsc_cr.la
-EXTRA_pam_pcsc_cr_la_SOURCES = ossl_crypto.c tom_prypto.c
-pam_pcsc_cr_la_SOURCES = crypto.c pcsc_cr.c ykneo.c
 pam_pcsc_cr_la_LDFLAGS = -module -avoid-version
-pam_pcsc_cr_la_LIBADD = @CRYPTO_OBJS@
-pam_pcsc_cr_la_DEPENDENCIES = @CRYPTO_OBJS@
+pam_pcsc_cr_la_LIBADD = libpcsc_cr.la
+
+check_PROGRAMS = test_cr
+test_cr_LDADD = libpcsc_cr.la
 
 EXTRA_DIST = autogen.sh
 
 TESTS = test_cr
-
-CLEANFILES = test_cr
index 08240fdfcd6035cfe7ac9b0e143867e5c5191abb..bf02dc512a67e104cad2046e7d2e66b4afce66d1 100755 (executable)
@@ -1,2 +1,3 @@
 #!/bin/sh
+mkdir -p m4
 autoreconf -i -f
index e9fd2f3d2a663e92d5d8aee0d4d9bb807556afbf..d4b556238e625f22a6ce346446de0868146a414a 100644 (file)
@@ -29,11 +29,51 @@ AC_ARG_WITH(pcsclite-lib-path,
        [PCSC_LIBS="-L $withval -lpcsclite"],
        [])
 
-AC_SUBST(PCSC_LIBS)
-AC_SUBST(PCSC_CFLAGS)
-CFLAGS="$PCSC_CFLAGS $CFLAGS"
+CPPFLAGS="$PCSC_CFLAGS $CPPFLAGS"
 LIBS="$PCSC_LIBS $LIBS"
 
+PKG_CHECK_MODULES([OPENSSL], [libcrypto], [], [:])
+AC_ARG_WITH(openssl-include-path,
+       [  --with-openssl-include-path=PATH path to openssl includes],
+       [OPENSSL_CFLAGS="-I $withval"],
+       [])
+AC_ARG_WITH(openssl-lib-path,
+       [  --with-openssl-lib-path=PATH path to openssl libs],
+       [OPENSSL_LIBS="-L $withval -lcrypto"],
+       [])
+AS_IF([test "x$OPENSSL_CFLAGS" != "x" -o "x$OPENSSL_LIBS" != "x" ], [
+  use_openssl=yes
+])
+CPPFLAGS="$OPENSSL_CFLAGS $CPPFLAGS"
+LIBS="$OPENSSL_LIBS $LIBS"
+
+AS_IF([test "x$use_openssl" != "xyes"], [
+  PKG_CHECK_MODULES([TOMCRYPT], [libtomcrypt], [], [:])
+])
+AC_ARG_WITH(libtomcrypt-include-path,
+       [  --with-libtomcrypt-include-path=PATH path to libtomcrypt includes],
+       [TOMCRYPT_CFLAGS="-I $withval"],
+       [])
+AC_ARG_WITH(libtomcrypt-lib-path,
+       [  --with-libtomcrypt-lib-path=PATH path to libtomcrypt libs],
+       [TOMCRYPT_LIBS="-L $withval -ltomcrypt"],
+       [])
+AS_IF([test "x$TOMCRYPT_CFLAGS" != "x" -o "x$TOMCRYPT_LIBS" != "x" ], [
+  use_tomcrypt=yes
+])
+CPPFLAGS="$TOMCRYPT_CFLAGS $CPPFLAGS"
+LIBS="$TOMCRYPT_LIBS $LIBS"
+
+AS_IF([test "x$use_openssl" != "xyes" -a "x$use_tomcrypt" != "xyes"], [
+  AC_MSG_ERROR([[Neither openssl nor tomcrypt libraries present]])
+])
+
+AS_IF([test "x$use_openssl" = "xyes"], [
+  CRYPTO_OBJS+=ossl_crypto.lo
+])
+AS_IF([test "x$use_tomcrypt" = "xyes"], [
+  CRYPTO_OBJS+=tom_crypto.lo
+])
 AC_SUBST(CRYPTO_OBJS)
 
 dnl Checks for header files.