* Rework configure.in to enable tokens automatically if requirements
   are met. The reason for this is to allow opencryptoki to build
   with the most features possible while still allowing consistency and
   unambiguity across architectures.

 * Get rid of S390 macro, don't have additional conditionals in the
   token stdll Makefiles

 * Use $host_cpu instead of $target

 * Not bringing -m64 or -m32 explicitly in CFLAGS causes gcc
   to build files for whatever architecture it was configured
   to, not paying attention to --host flags.  This may cause confusion
   interpreting why some autoconf tests failed (namely: OpenSSL on ppc64)

Signed-off-by: Klaus Heinrich Kiwi <[email protected]>
---
 configure.in                       |  238 ++++++++++++++++++++++--------------
 usr/lib/pkcs11/methods/Makefile.am |    4 -
 2 files changed, 148 insertions(+), 94 deletions(-)

diff --git a/configure.in b/configure.in
index 55413b3..1ab980b 100644
--- a/configure.in
+++ b/configure.in
@@ -6,14 +6,10 @@ dnl (which we want to avoid), we can restore them to whatever 
the
 dnl user might have wanted below.
 cmdline_CFLAGS="$CFLAGS"
 
-# Compute $target
-AC_CANONICAL_TARGET
-
 AM_INIT_AUTOMAKE([foreign 1.6])
 
-dnl Checks for programs.
-
-dnl Checks for libraries.
+dnl Get the canonical host type
+AC_CANONICAL_HOST
 
 dnl Checks for header files.
 AC_DISABLE_STATIC
@@ -45,20 +41,13 @@ AC_PATH_PROG([CHGRP], [chgrp], [/bin/chgrp])
 AC_PROG_SED
 AC_PROG_MKDIR_P
 
-CFLAGS="$cmdline_CFLAGS"
-
-s390=0
-
-# Arch specific stuff
-case $target in
-       *s390x*)
-               s390=1
-               AM_CONDITIONAL(S390, true) ;;
-       *s390*)
-               s390=1
-               AM_CONDITIONAL(S390, true) ;;
-        *)
-               AM_CONDITIONAL(S390, false) ;;
+case $host_cpu in
+       x86_64 | ppc64* | s390x)
+               CFLAGS="-m64 $cmdline_CFLAGS"
+               ;;
+       *)
+               CFLAGS="-m32 $cmdline_CFLAGS"
+                ;;
 esac
 
 dnl ---
@@ -69,147 +58,148 @@ dnl --- Debugging support
 AC_ARG_ENABLE([debug],
        AC_HELP_STRING([--enable-debug=no/yes],
        [enable debugging build [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_debug=$enable_debug]),
+       [],
        [enable_debug=no])
 
 dnl --- build testcases
 AC_ARG_ENABLE([testcases],
        AC_HELP_STRING([--enable-testcases=no/yes],
        [build the test cases [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_testcases=$enable_testcases]),
+       [],
        [enable_testcases=no])
 
 dnl --- Check if building daemon
 AC_ARG_ENABLE([daemon],
        AC_HELP_STRING([--enable-daemon=no/yes],
        [build pkcsslotd daemon [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_daemon=$enable_daemon]),
+       [],
        [enable_daemon=yes])
 
 dnl --- Check if building library
 AC_ARG_ENABLE([library],
        AC_HELP_STRING([--enable-library=no/yes],
        [build opencryptoki libraries [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_library=$enable_library]),
+       [],
        [enable_library=yes])
 
 dnl --- Enable/disable tokens
+dnl --- those have an additional 'check' state, which essentially means
+dnl --- that it will enable it by default it dependencies are met
 
 dnl --- ICA token
 AC_ARG_ENABLE([icatok],
        AC_HELP_STRING([--enable-icatok=no/yes],
-       [build ica token [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_icatok=$enable_icatok]),
-       [enable_icatok=yes])
+       [build ica token (enabled by default if libica is present)]),
+       [],
+       [enable_icatok=check])
 
 dnl --- CCA token
 AC_ARG_ENABLE([ccatok],
-       AC_HELP_STRING([--with-ccatok=no/yes],
-       [build cca token [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_ccatok=$enable_ccatok]),
-       [enable_ccatok=yes])
+       AC_HELP_STRING([--enable-ccatok=no/yes],
+       [build cca token (enabled by default in s390 arch)]),
+       [],
+       [enable_ccatok=check])
 
 dnl --- software token
 AC_ARG_ENABLE([swtok],
-       AC_HELP_STRING([--with-swtok=no/yes],
-       [build software token [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_swtok=$enable_swtok]),
+       AC_HELP_STRING([--enable-swtok=no/yes],
+       [build software token (enabled by default)]),
+       [],
        [enable_swtok=yes])
 
 dnl --- TPM token
 AC_ARG_ENABLE([tpmtok],
        AC_HELP_STRING([--enable-tpmtok=no/yes],
-       [build tpm token (Trusted Platform Module hardware, requires TSS 
development libraries) [[default=yes]]]),
-       AC_MSG_NOTICE([**** Requested enable_tpmtok=$enable_tpmtok]),
-       [enable_tpmtok=yes])
+       [build tpm token (Trusted Platform Module, enabled by default if 
TrouSerS is present)]),
+       [],
+       [enable_tpmtok=check])
 
 dnl --- icc token (IBM 4758 PCICC hardware)
 AC_ARG_ENABLE([icctok],
        AC_HELP_STRING([--enable-icctok=no/yes],
-       [build icc token (requires SCC development libraries) [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_icctok=$enable_icctok]),
-       [enable_icctok=no])
+       [build icc token (IBM 4758 hardware, enabled by default if SCC library 
is present)]),
+       [],
+       [enable_icctok=check])
 
 dnl --- aep token (AEP Crypto Accelerator hardware)
 AC_ARG_ENABLE([aeptok],
        AC_HELP_STRING([--enable-aeptok=no/yes],
-       [build aep token (AEP crypto Accelerator, requires AEP development 
libraries) [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_aeptok=$enable_aeptok]),
-       [enable_aeptok=no])
+       [build aep token (AEP Crypto Accelerator, enabled by default if AEP 
library is present)]),
+       [],
+       [enable_aeptok=check])
 
 dnl --- bcom token (Broadcom Crypto Accelerator hardware)
 AC_ARG_ENABLE([bcomtok],
        AC_HELP_STRING([--enable-bcomtok=no/yes],
-       [build bcom token (Broadcom Crypto Accelerator, requires uBSec 
development libraries) [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_bcomtok=$enable_bcomtok]),
-       [enable_bcomtok=no])
+       [build bcom token (Broadcom Crypto Accelerator, enabled by default if 
uBSec library is present)]),
+       [],
+       [enable_bcomtok=check])
 
 dnl -- cr token (Corrent Crypto Accelerator hardware)
 AC_ARG_ENABLE([crtok],
        AC_HELP_STRING([--enable-crtok=no/yes],
-       [build cr token (Corrent Crypto Accelerator, requires Socketarmor 
development libraries) [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested enable_crtok=$enable_crtoken]),
-       [enable_crtok=no])
+       [build cr token (Corrent Crypto Accelerator, enabled by default if 
SocketArmor library is present)]),
+       [],
+       [enable_crtok=check])
 
 dnl --- token-specific stuff
-
 dnl --- pkcscca_migrate
 AC_ARG_ENABLE([pkcscca_migrate],
        AC_HELP_STRING([--enable-pkcscca_migrate=no/yes],
-       [build pkcscca_migrate - A tool to migrate CCA tokens from one Master 
key to another [[default=no]]]),
-       AC_MSG_NOTICE([**** Requested 
enable_pkcscca_migrate=$enable_pkcscca_migrate]),
-       [enable_pkcscca_migrate=no])
+       [build pkcscca_migrate (CCA token key migration tool, enabled by 
default if CCA library is present)]),
+       [],
+       [enable_pkcscca_migrate=check])
 
 dnl ---
 dnl --- Check for external software
-dnl ---
+dnl --- Define what to check based on enabled features
 
 dnl --- Openssl development files
 AC_ARG_WITH([openssl],
-       AC_HELP_STRING([--with-openssl[[=DIR]]], [openssl location]),
-       AC_MSG_NOTICE([**** Requested with_openssl=$with_openssl]),
+       AC_HELP_STRING([--with-openssl[[=DIR]]], [OpenSSL development files 
location]),
+       [],
        [with_openssl=check])
 
 dnl --- Libica development files
 AC_ARG_WITH([libica],
-       AC_HELP_STRING([--with-libica[[=DIR]]], [libica location]),
-       AC_MSG_NOTICE([**** Requested with_libica=$with_libica]),
+       AC_HELP_STRING([--with-libica[[=DIR]]], [libica development files 
location]),
+       [],
        [with_libica=check])
 
 dnl --- TSS (TrouSerS) development files
 AC_ARG_WITH([tss],
-       AC_HELP_STRING([--with-tss[[=DIR]]], [TSS (TrouSerS) library location]),
-       AC_MSG_NOTICE([**** Requested with_tss=$with_tss]),
+       AC_HELP_STRING([--with-tss[[=DIR]]], [TrouSerS development files 
location]),
+       [],
        [with_tss=check])
 
 dnl --- SCC development files (IBM 4758 PCI Cryptographic Coprocessor)
 AC_ARG_WITH([scc],
-       AC_HELP_STRING([--with-scc[[=DIR]]], [SCC library (IBM 4758 hardware 
SDK) location]),
-       AC_MSG_NOTICE([**** Requested with_scc=$with_scc]),
+       AC_HELP_STRING([--with-scc[[=DIR]]], [SCC library location]),
+       [],
        [with_scc=check])
 
 dnl --- AEP development files (AEP crypto hardware)
 AC_ARG_WITH([aep],
-       AC_HELP_STRING([--with-aep[[=DIR]]], [AEP library location]),
-       AC_MSG_NOTICE([**** Requested with_aep=$with_aep]),
+       AC_HELP_STRING([--with-aep[[=DIR]]], [AEP development files location]),
+       [],
        [with_aep=check])
 
 dnl --- uBSec development files (Broadcom crypto hardware)
 AC_ARG_WITH([ubsec],
-       AC_HELP_STRING([--with-ubsec[[=DIR]]], [uBSec library (Broadcom 
hardware SDK) location]),
-       AC_MSG_NOTICE([**** Requested with_ubsec=$with_ubsec]),
+       AC_HELP_STRING([--with-ubsec[[=DIR]]], [uBSec library location]),
+       [],
        [with_ubsec=check])
 
 dnl --- Socketarmor development files (Corrent crypto hardware)
 AC_ARG_WITH([socketarmor],
-       AC_HELP_STRING([--with-socketarmor[[=DIR]]], [Socketarmor library 
(Corrent hardware SDK) location]),
-       AC_MSG_NOTICE([**** Requested with_socketarmor=$with_socketarmor]),
+       AC_HELP_STRING([--with-socketarmor[[=DIR]]], [Socketarmor library 
location]),
+       [],
        [with_socketarmor=check])
 
 dnl --- xcryptolinz development files (IBM CCA development files)
 AC_ARG_WITH([xcryptolinz],
-       AC_HELP_STRING([--with-xcryptolinz[[=DIR]]], [xcryptolinz (IBM CCA 
suppor library) location]),
-       AC_MSG_NOTICE([**** Requested with_xcryptolinz=$with_xcryptolinz]),
+       AC_HELP_STRING([--with-xcryptolinz[[=DIR]]], [CCA library (xcryptolinz) 
location]),
+       [],
        [with_xcryptolinz=check])
 
 dnl ---
@@ -521,85 +511,135 @@ dnl --- enable_library
 AM_CONDITIONAL([ENABLE_LIBRARY], [test "x$enable_library" = "xyes"])
 
 dnl --- enable_icatok
-if test "x$enable_icatok" != "xno"; then
+if test "x$enable_icatok" = "xyes"; then
        if test "x$with_libica" != "xyes"; then
                AC_MSG_ERROR([ica token build requested but libica development 
files not found])
                enable_icatok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_ICATOK], test "x$enable_icatok" = "xyes")
+if test "x$enable_icatok" = "xyes"; then
+       if test "x$with_openssl" != "xyes"; then
+               AC_MSG_ERROR([ica token build requested but OpenSSL development 
files not found])
+               enable_icatok=no
+       fi
+fi
+if test "x$enable_icatok" != "xno" -a "x$with_libica" != "xno" -a 
"x$with_openssl" != "xno"; then
+       enable_icatok=yes
+else
+       enable_icatok=no
+fi
+AM_CONDITIONAL([ENABLE_ICATOK], [test "x$enable_icatok" = "xyes"])
 
 dnl --- enable_ccatok
-AM_CONDITIONAL([ENABLE_CCATOK], test "x$enable_ccatok" = "xyes")
+if test "x$enable_ccatok" != "xno"; then
+       enable_ccatok=yes
+else
+       enable_ccatok=no
+fi
+AM_CONDITIONAL([ENABLE_CCATOK], [test "x$enable_ccatok" = "xyes"])
 
 dnl --- enable_swtok
-if test "x$enable_swtok" != "xno"; then
+if test "x$enable_swtok" = "xyes"; then
        if test "x$with_openssl" != "xyes"; then
-               AC_MSG_ERROR([software token build requested but openssl 
development files not found])
+               AC_MSG_ERROR([software token build requested but OpenSSL 
development files not found])
                enable_swtok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_SWTOK], test "x$enable_swtok" = "xyes")
+if test "x$enable_swtok" != "xno" -a "x$with_openssl" != "xno"; then
+       enable_swtok=yes
+else
+       enable_swtok=no
+fi
+AM_CONDITIONAL([ENABLE_SWTOK], [test "x$enable_swtok" = "xyes"])
 
 dnl --- enable_tpmtok
-if test "x$enable_tpmtok" != "xno"; then
+if test "x$enable_tpmtok" = "xyes"; then
        if test "x$with_tss" != "xyes"; then
                AC_MSG_ERROR([tpm token build requested but TSS development 
files not found])
                enable_tpmtok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_TPMTOK], test "x$enable_tpmtok" = "xyes")
+if test "x$enable_tpmtok" != "xno" -a "x$with_tss" != "xno"; then
+       enable_tpmtok=yes
+else
+       enable_tpmtok=no
+fi
+AM_CONDITIONAL([ENABLE_TPMTOK], [test "x$enable_tpmtok" = "xyes"])
 
 dnl --- enable_icctok
-if test "x$enable_icctok" != "xno"; then
+if test "x$enable_icctok" = "xyes"; then
        if test "x$with_scc" != "xyes"; then
                AC_MSG_ERROR([icc token build requested but no scc development 
files not found])
                enable_icctok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_ICCTOK], test "x$enable_icctok" = "xyes")
+if test "x$enable_icctok" != "xno" -a "x$with_scc" != "xno"; then
+       enable_icctok=yes
+else
+       enable_icctok=no
+fi
+AM_CONDITIONAL([ENABLE_ICCTOK], [test "x$enable_icctok" = "xyes"])
 
 dnl --- enable_aeptok
-if test "x$enable_aeptok" != "xno"; then
+if test "x$enable_aeptok" = "xyes"; then
        if test "x$with_aep" != "xyes"; then
                AC_MSG_ERROR([aep token build requested but no aep development 
files not found])
                enable_aeptok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_AEPTOK], test "x$enable_aeptok" = "xyes")
+if test "x$enable_aeptok" != "xno" -a "x$with_aep" != "xno"; then
+       enable_aeptok=yes
+else
+       enable_aeptok=no
+fi
+AM_CONDITIONAL([ENABLE_AEPTOK], [test "x$enable_aeptok" = "xyes"])
 
 dnl --- enable_bcomtok
-if test "x$enable_bcomtok" != "xno"; then
+if test "x$enable_bcomtok" = "xyes"; then
        if test "x$with_ubsec" != "xyes"; then
                AC_MSG_ERROR([bcom token build requested but no uBSec 
development files not found])
                enable_bcomok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_BCOMTOK], test "x$enable_bcomtok" = "xyes")
+if test "x$enable_bcomtok" != "xno" -a "x$with_ubsec" != "xno"; then
+       enable_bcomtok=yes
+else
+       enable_bcomtok=no
+fi
+AM_CONDITIONAL([ENABLE_BCOMTOK], [test "x$enable_bcom" = "xyes"])
 
 dnl --- enable_crtok
-if test "x$enable_crtok" != "xno"; then
+if test "x$enable_crtok" = "xyes"; then
        if test "x$with_socketarmor" != "xyes"; then
                AC_MSG_ERROR([cr token build requested but no Socketarmor 
development files not found])
                enable_crtok=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_CRTOK], test "x$enable_crtok" = "xyes")
+if test "x$enable_crtok" != "xno" -a "x$with_socketarmor" != "xno"; then
+       enable_crtok=yes
+else
+       enable_crtok=no
+fi
+AM_CONDITIONAL([ENABLE_CRTOK], [test "x$enable_crtok" = "xyes"])
 
 dnl --- enable_pkcscca_migrate
-if test "x$enable_pkcscca_migrate" != "xno"; then
+if test "x$enable_pkcscca_migrate" = "xyes"; then
        if test "x$with_xcryptolinz" != "xyes"; then
                AC_MSG_ERROR([pkcscca_migrate build requested but no 
xcryptolinz libraries found])
                enable_pkcscca_migrate=no
        fi
 fi
-AM_CONDITIONAL([ENABLE_PKCSCCA_MIGRATE], test "x$enable_pkcscca_migrate" = 
"xyes")
+if test "x$enable_pkcscca_migrate" = "xno" -a "x$with_xcryptolinz" != "xno"; 
then
+       enable_pkcscca_migrate=yes
+else
+       enable_pkcscca_migrate=no
+fi
+AM_CONDITIONAL([ENABLE_PKCSCCA_MIGRATE], [test "x$enable_pkcscca_migrate" = 
"xyes"])
 
 
 CFLAGS="$CFLAGS $DEBUG_CFLAGS -DPKCS64 -D_XOPEN_SOURCE=500"
 
-CFLAGS+=' -DCONFIG_PATH=\"$(localstatedir)/lib/opencryptoki\" \
-       -DSBIN_PATH=\"$(sbindir)\" -DLIB_PATH=\"$(libdir)\"'
+CFLAGS+=' -DCONFIG_PATH=\"$(localstatedir)/lib/opencryptoki\" 
-DSBIN_PATH=\"$(sbindir)\" -DLIB_PATH=\"$(libdir)\"'
 
 # At this point, CFLAGS is set to something sensible
 AC_PROG_CC
@@ -654,6 +694,24 @@ AC_OUTPUT([Makefile usr/Makefile \
          man/man8/Makefile \
          man/man8/pkcsslotd.8])
 
+echo "Enabled features:"
+echo " Debug build:            $enable_debug"
+echo " Testcases:              $enable_testcases"
+echo " Daemon build:           $enable_daemon"
+echo " Library build:          $enable_library"
+echo
+echo "Enabled token types:"
+echo " ICA token:              $enable_icatok"
+echo " CCA token:              $enable_ccatok"
+echo " Software token:         $enable_swtok"
+echo " TPM token:              $enable_tpmtok"
+echo " ICC token:              $enable_icctok"
+echo " AEP token:              $enable_aeptok"
+echo " Broadcom token:         $enable_bcomtok"
+echo " Corrent token:          $enable_crtok"
+echo
+echo "Token-specific features:"
+echo " pkcsccamigrate build:   $enable_pkcscca_migrate"
 echo
 echo "CLFAGS=$CFLAGS"
 echo
diff --git a/usr/lib/pkcs11/methods/Makefile.am 
b/usr/lib/pkcs11/methods/Makefile.am
index 8a59270..bcdec99 100644
--- a/usr/lib/pkcs11/methods/Makefile.am
+++ b/usr/lib/pkcs11/methods/Makefile.am
@@ -1,7 +1,3 @@
-if S390
-SUBDIRS =
-else
 if ENABLE_ICCTOK
 SUBDIRS = 4758_status
 endif
-endif
-- 
1.6.6.1


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Opencryptoki-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opencryptoki-tech

Reply via email to