1
0
mirror of https://github.com/opencryptoki/opencryptoki.git synced 2026-10-24 05:39:17 +03:00
Files
opencryptoki/configure.in
2006-04-05 17:28:19 +00:00

316 lines
10 KiB
Plaintext

dnl Process this file with autoconf to produce a configure script.
AC_INIT(openCryptoki, 2.2.0, mhalcrow@us.ibm.com,)
dnl Backup CFLAGS so that once the auto tools set it to "-g -O2",
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
dnl AM_INIT_AUTOMAKE(openCryptoki, 2.0.0)
AM_INIT_AUTOMAKE(1.6.1)
dnl Checks for programs.
dnl Checks for libraries.
dnl Checks for header files.
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/file.h syslog.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd])
# Used in the init scripts
AC_SUBST(ID, /usr/bin/id)
AC_SUBST(USERMOD, /usr/sbin/usermod)
AC_SUBST(GROUPADD, /usr/sbin/groupadd)
dnl i.e., /usr/local or /usr
if test "x$prefix" = xNONE; then
prefix=$ac_default_prefix
fi
if test "x$exec_prefix" = xNONE; then
exec_prefix='${prefix}'
fi
CFLAGS="$cmdline_CFLAGS"
# Arch specific stuff
case $target in
*ppc64* | *powerpc64*)
CFLAGS="$CFLAGS -m64"
AM_CONDITIONAL(BUILD_UTILS, true)
AM_CONDITIONAL(S390, false)
AC_SUBST(LIB_PATH, $prefix/lib64/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib64) ;;
*s390x*)
AM_CONDITIONAL(BUILD_UTILS, false)
AM_CONDITIONAL(S390, true)
AC_SUBST(LIB_PATH, $prefix/lib64/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib64)
AC_MSG_RESULT([*** 64bit platform detected. Not building utilities. ***]) ;;
*ppc* | *powerpc*)
AM_CONDITIONAL(S390, false)
AC_SUBST(LIB_PATH, $prefix/lib/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib)
AM_CONDITIONAL(BUILD_UTILS, true) ;;
*s390*)
CFLAGS="$CFLAGS -m31"
AM_CONDITIONAL(BUILD_UTILS, true)
AC_SUBST(LIB_PATH, $prefix/lib/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib)
AM_CONDITIONAL(S390, true) ;;
*x86_64*)
AM_CONDITIONAL(BUILD_UTILS, true)
AC_SUBST(LIB_PATH, $prefix/lib64/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib64)
AM_CONDITIONAL(S390, false) ;;
*)
AM_CONDITIONAL(BUILD_UTILS, true)
AC_SUBST(LIB_PATH, $prefix/lib/opencryptoki)
AC_SUBST(LIB_ROOT_PATH, $prefix/lib)
AM_CONDITIONAL(S390, false) ;;
esac
if test "x$prefix" == x/usr; then
AC_SUBST(CONFIG_PATH, /var/lib/opencryptoki)
AC_SUBST(CONFIG_PATH_ETC, /etc)
AC_SUBST(SBIN_PATH, /usr/sbin)
AC_SUBST(DB_PATH, /var/lib/opencryptoki)
else
AC_SUBST(CONFIG_PATH, $prefix/var/lib/opencryptoki)
AC_SUBST(CONFIG_PATH_ETC, $prefix/etc)
AC_SUBST(SBIN_PATH, $prefix/sbin)
AC_SUBST(DB_PATH, $prefix/var/lib/opencryptoki)
fi
AC_SUBST(STDLL_PATH, $LIB_PATH/stdll)
AC_SUBST(CONFIG_FILE, pk_config_data)
AC_SUBST(METHOD_PATH, $prefix/sbin)
AC_SUBST(HEADER_PATH, $prefix/include)
TO_BUILD=0
# Debugging support
AC_ARG_ENABLE(debug, [ --enable-debug turn on all openCryptoki debugging flags],
[ enable_debug="yes"],)
if test "x$enable_debug" = xyes; then
CFLAGS="$CFLAGS -g -O0 -DDEBUG -DDEBUGON"
AC_MSG_RESULT([*** Enabling debugging at user request ***])
else
CFLAGS="$CFLAGS -O2"
fi
# Support for OpenSSL path specification
AC_ARG_WITH(openssl,
[ --with-openssl[[=DIR]] build with OpenSSL support [[/usr/local/ssl]]],
[openssl_prefix=$withval],
[openssl_prefix=]
)
if test "x$openssl_prefix" != x; then
AC_MSG_RESULT([*** Using OpenSSL directory $openssl_prefix ***])
LDFLAGS="-L$openssl_prefix/lib $LDFLAGS"
CFLAGS="-I$openssl_prefix/include $CFLAGS"
fi
# Support for the IBM 4758 (PCICC) token
AC_ARG_ENABLE(icctok,
[ --disable-icctok don't build the IBM 4758 (PCICC) token [default=enabled]],
[AM_CONDITIONAL(ICC, false)],
[enable_icctok="yes"])
if test "x$enable_icctok" = xyes; then
AC_CHECK_HEADER(scc_host.h,
AC_CHECK_LIB(scc, sccOpenAdapter,
[AM_CONDITIONAL(ICC, true)
TO_BUILD=1],
[AM_CONDITIONAL(ICC, false)]),
[AM_CONDITIONAL(ICC, false)],,)
else
AC_MSG_RESULT([*** Disabling the IBM 4758 (PCICC) token at user request ***])
fi
# Support for the IBM Crypto Accelerator (PCICA) token
AC_ARG_ENABLE(icatok,
[ --disable-icatok don't build the IBM Crypto Accelerator (PCICA) token [default=enabled]],
[AM_CONDITIONAL(ICA, false)],
[enable_icatok="yes"])
if test "x$enable_icatok" = xyes; then
AC_CHECK_HEADER(ica_api.h,
AC_CHECK_LIB(ica, icaOpenAdapter,
[AM_CONDITIONAL(ICA, true)
TO_BUILD=1],
[AM_CONDITIONAL(ICA, false)]),
[AM_CONDITIONAL(ICA, false)],,)
else
AC_MSG_RESULT([*** Disabling the IBM Crypto Accelerator (PCICA) token at user request ***])
fi
# OpenSSL support for the software token
AC_ARG_ENABLE(swtok,
[ --disable-swtok don't build the software token [default=enabled]],
[AM_CONDITIONAL(SOFT, false)],
[enable_swtok="yes"])
if test "x$enable_swtok" = xyes; then
AC_CHECK_LIB(crypto, AES_encrypt,
[AM_CONDITIONAL(SOFT, true)
TO_BUILD=1],
[AM_CONDITIONAL(SOFT, false)])
else
AC_MSG_RESULT([*** Disabling the software token at user request ***])
fi
# TPM support for the TPM token
AC_ARG_ENABLE(tpmtok,
[ --disable-tpmtok don't build the TPM token [default=enabled]],
[AM_CONDITIONAL(TPM, false)],
[enable_tpmtok="yes"])
if test "x$enable_tpmtok" = xyes; then
AC_CHECK_HEADER(tss/platform.h,
AC_CHECK_LIB(crypto, AES_encrypt,
AC_CHECK_LIB(tspi, Tspi_Context_Create,
[AM_CONDITIONAL(TPM, true)], [AM_CONDITIONAL(TPM, false)], -lcrypto),
[AM_CONDITIONAL(TPM, false)]),
[AM_CONDITIONAL(TPM, false)])
else
AC_MSG_RESULT([*** Disabling the TPM token at user request ***])
fi
# Support for the Broadcom Crypto Accelerator
AC_ARG_ENABLE(bcomtok,
[ --disable-bcomtok don't build the Broadcom Crypto Accelerator token [default=enabled]],
[AM_CONDITIONAL(BCOM, false)],
[enable_bcomtok="yes"])
if test "x$enable_bcomtok" = xyes; then
AC_CHECK_HEADER(ubsec.h,
AC_CHECK_LIB(ubsec, ubsec_open,
[AM_CONDITIONAL(BCOM, true)
TO_BUILD=1],
[AM_CONDITIONAL(BCOM, false)]),
[AM_CONDITIONAL(BCOM, false)],,)
else
AC_MSG_RESULT([*** Disabling the Broadcom Crypto Accelerator token at user request ***])
fi
# Support for the AEP Crypto Accelerator
AC_ARG_ENABLE(aeptok,
[ --disable-aeptok don't build the AEP Crypto Accelerator token [default=enabled]],
[AM_CONDITIONAL(AEP, false)],
[enable_aeptok="yes"])
if test "x$enable_aeptok" = xyes; then
AC_CHECK_LIB(aep, AEP_Initialize,
[AM_CONDITIONAL(AEP, true)
TO_BUILD=1],
[AM_CONDITIONAL(AEP, false)])
else
AC_MSG_RESULT([*** Disabling the AEP Crypto Accelerator token at user request ***])
fi
# Support for the Corrent Crypto Accelerator
AC_ARG_ENABLE(crtok,
[ --disable-crtok don't build the Corrent Crypto Accelerator token [default=enabled]],
[AM_CONDITIONAL(CR, false)],
[enable_crtok="yes"])
if test "x$enable_crtok" = xyes; then
AC_CHECK_HEADER(typhoon.h,
AC_CHECK_LIB(socketarmor, CR_init_lib,
[AM_CONDITIONAL(CR, true)
TO_BUILD=1],
[AM_CONDITIONAL(CR, false)], -ldl),
[AM_CONDITIONAL(CR, false)],,)
else
AC_MSG_RESULT([*** Disabling the Corrent Crypto Accelerator token at user request ***])
fi
CFLAGS="$CFLAGS -DPKCS64 \
-DCONFIG_PATH=\\\"$CONFIG_PATH\\\" \
-DSBIN_PATH=\\\"$SBIN_PATH\\\" \
-DLIB_PATH=\\\"$LIB_PATH\\\" \
-D_XOPEN_SOURCE=500 -Wno-unused"
# At this point, CFLAGS is set to something sensible
AC_PROG_CC
if [[ $TO_BUILD -eq 0 ]]; then
echo " "
echo "Warning!"
echo " "
echo "No tokens are flagged as buildable! Install the necessary components of the "
echo "tokens you'd like to build and re-configure openCryptoki. If you have no "
echo "hardware, install openssl's libcrypto.a to build a software token. See README"
echo "for information on how to point the openCryptoki build to your token's libraries"
echo " "
fi
AC_OUTPUT([Makefile usr/Makefile \
usr/include/Makefile \
usr/include/pkcs11/Makefile \
usr/lib/Makefile \
usr/lib/pkcs11/Makefile \
usr/lib/pkcs11/api/Makefile \
usr/lib/pkcs11/api/shrd_mem.c \
usr/lib/pkcs11/ica_stdll/Makefile \
usr/lib/pkcs11/ica_stdll/tok_struct.h \
usr/lib/pkcs11/ica_s390_stdll/Makefile \
usr/lib/pkcs11/ica_s390_stdll/tok_struct.h \
usr/sbin/Makefile \
usr/sbin/pkcsslotd/Makefile \
usr/sbin/pkcs11_startup/Makefile \
usr/sbin/pkcs11_startup/pkcs11_startup \
usr/sbin/pkcs_slot/Makefile \
usr/sbin/pkcs_slot/pkcs_slot \
usr/sbin/pkcsconf/Makefile \
usr/lib/pkcs11/methods/Makefile \
usr/lib/pkcs11/leeds_stdll/Makefile \
usr/lib/pkcs11/soft_stdll/Makefile \
usr/lib/pkcs11/soft_stdll/tok_struct.h \
usr/lib/pkcs11/bcom_stdll/Makefile \
usr/lib/pkcs11/bcom_stdll/tok_struct.h \
usr/lib/pkcs11/cr_stdll/Makefile \
usr/lib/pkcs11/cr_stdll/tok_struct.h \
usr/lib/pkcs11/aep_stdll/Makefile \
usr/lib/pkcs11/aep_stdll/tok_struct.h \
usr/lib/pkcs11/tpm_stdll/Makefile \
usr/lib/pkcs11/tpm_stdll/tok_struct.h \
usr/lib/pkcs11/methods/4758_status/Makefile \
testcases/Makefile \
testcases/driver/Makefile \
testcases/init_tok/Makefile \
testcases/mkobj/Makefile \
testcases/oc-digest/Makefile \
testcases/rsa_keygen/Makefile \
testcases/rsa_test/Makefile \
testcases/speed/Makefile \
testcases/test_crypto/Makefile \
testcases/threadmkobj/Makefile \
testcases/tok_obj/Makefile \
testcases/v2.11/Makefile \
testcases/login/Makefile])
echo
echo "CLFAGS=$CFLAGS"