AU_ALIAS([CHECK_PKCS], [AX_CHECK_PKCS])
|
|
AC_DEFUN([AX_CHECK_PKCS], [
|
|
found=false
|
|
AC_ARG_WITH(gskssl,
|
|
AS_HELP_STRING([--with-gskssl=DIR],
|
|
[root of the GSK PKCS directory]),
|
|
[
|
|
case "$withval" in
|
|
"" | y | ye | yes | n | no)
|
|
AC_MSG_ERROR([Invalid --with-gskssl value])
|
|
;;
|
|
*) pkcsdirs="$withval"
|
|
;;
|
|
esac
|
|
], [
|
|
# if pkg-config is installed and gskssl has installed a .pc file,
|
|
# then use that information and don't search pkcsdirs
|
|
AC_PATH_PROG(PKG_CONFIG, pkg-config)
|
|
if test x"$PKG_CONFIG" != x""; then
|
|
PKCS_LDFLAGS=`$PKG_CONFIG gskssl --libs-only-L 2>/dev/null`
|
|
if test $? = 0; then
|
|
PKCS_LIBS=`$PKG_CONFIG gskssl --libs-only-l 2>/dev/null`
|
|
PKCS_INCLUDES=`$PKG_CONFIG gskssl --cflags-only-I 2>/dev/null`
|
|
found=true
|
|
fi
|
|
fi
|
|
|
|
# no such luck; use some default pkcsdirs
|
|
if ! $found; then
|
|
pkcsdirs="$withval /usr/lpp/pkcs11 /usr"
|
|
fi
|
|
]
|
|
)
|
|
|
|
|
|
# note that we #include <gskssl/foo.h>, so the GSK PKCS headers have to be in
|
|
# an 'gskssl' subdirectory
|
|
|
|
if ! $found; then
|
|
PKCS_INCLUDES=
|
|
for pkcsdir in $pkcsdirs; do
|
|
AC_MSG_CHECKING([for include/gskssl.h in $pkcsdir])
|
|
if test -f "$pkcsdir/include/csnpdefs.h"; then
|
|
if test -f "$pkcsdir/lib/CSNPCA64.x"; then
|
|
PKCS_INCLUDES="-I$pkcsdir/include"
|
|
PKCS_LDFLAGS="-L$pkcsdir/lib"
|
|
PKCS_LIBS="$pkcsdir/lib/CSNPCA64.x"
|
|
found=true
|
|
AC_MSG_RESULT([yes])
|
|
fi
|
|
break
|
|
else
|
|
AC_MSG_RESULT([no])
|
|
fi
|
|
done
|
|
|
|
# if the file wasn't found, well, go ahead and try the link anyway -- maybe
|
|
# it will just work!
|
|
fi
|
|
|
|
# try the preprocessor and linker with our new flags,
|
|
# being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
|
|
|
AC_MSG_CHECKING([whether compiling and linking against GSK PKCS works])
|
|
echo "Trying link with PKCS_LDFLAGS=$PKCS_LDFLAGS;" \
|
|
"PKCS_LIBS=$PKCS_LIBS; PKCS_INCLUDES=$PKCS_INCLUDES" >&AS_MESSAGE_LOG_FD
|
|
|
|
save_LIBS="$LIBS"
|
|
save_LDFLAGS="$LDFLAGS"
|
|
save_CPPFLAGS="$CPPFLAGS"
|
|
LDFLAGS="$LDFLAGS $PKCS_LDFLAGS"
|
|
LIBS="$PKCS_LIBS $LIBS"
|
|
CPPFLAGS="$PKCS_INCLUDES $CPPFLAGS"
|
|
AC_LINK_IFELSE(
|
|
AC_LANG_PROGRAM([#include <gskssl.h>], [gsk_handle env_handle;]),
|
|
[
|
|
AC_MSG_RESULT([yes])
|
|
$1
|
|
], [
|
|
AC_MSG_RESULT([no])
|
|
$2
|
|
])
|
|
CPPFLAGS="$save_CPPFLAGS"
|
|
LDFLAGS="$save_LDFLAGS"
|
|
LIBS="$save_LIBS"
|
|
|
|
AC_SUBST([PKCS_INCLUDES])
|
|
AC_SUBST([PKCS_LIBS])
|
|
AC_SUBST([PKCS_LDFLAGS])
|
|
])
|