1dnl config.m4 for extension pkcs11
2
3dnl Comments in this file start with the string 'dnl'.
4dnl Remove where necessary.
5
6dnl If your extension references something external, use 'with':
7
8dnl PHP_ARG_WITH([pkcs11],
9dnl   [for pkcs11 support],
10dnl   [AS_HELP_STRING([--with-pkcs11],
11dnl     [Include pkcs11 support])])
12
13dnl Otherwise use 'enable':
14
15PHP_ARG_ENABLE([pkcs11],
16  [whether to enable pkcs11 support],
17  [AS_HELP_STRING([--enable-pkcs11],
18    [Enable pkcs11 support])],
19  [no])
20
21if test "$PHP_PKCS11" != "no"; then
22
23  dnl Write more examples of tests here...
24
25  dnl Remove this code block if the library does not support pkg-config.
26  dnl PKG_CHECK_MODULES([LIBFOO], [foo])
27  dnl PHP_EVAL_INCLINE($LIBFOO_CFLAGS)
28  dnl PHP_EVAL_LIBLINE($LIBFOO_LIBS, PKCS11_SHARED_LIBADD)
29
30  dnl If you need to check for a particular library version using PKG_CHECK_MODULES,
31  dnl you can use comparison operators. For example:
32  dnl PKG_CHECK_MODULES([LIBFOO], [foo >= 1.2.3])
33  dnl PKG_CHECK_MODULES([LIBFOO], [foo < 3.4])
34  dnl PKG_CHECK_MODULES([LIBFOO], [foo = 1.2.3])
35
36  dnl Remove this code block if the library supports pkg-config.
37  dnl --with-pkcs11 -> check with-path
38  dnl SEARCH_PATH="/usr/local /usr"     # you might want to change this
39  dnl SEARCH_FOR="/include/pkcs11.h"  # you most likely want to change this
40  dnl if test -r $PHP_PKCS11/$SEARCH_FOR; then # path given as parameter
41  dnl   PKCS11_DIR=$PHP_PKCS11
42  dnl else # search default path list
43  dnl   AC_MSG_CHECKING([for pkcs11 files in default path])
44  dnl   for i in $SEARCH_PATH ; do
45  dnl     if test -r $i/$SEARCH_FOR; then
46  dnl       PKCS11_DIR=$i
47  dnl       AC_MSG_RESULT(found in $i)
48  dnl     fi
49  dnl   done
50  dnl fi
51  dnl
52  dnl if test -z "$PKCS11_DIR"; then
53  dnl   AC_MSG_RESULT([not found])
54  dnl   AC_MSG_ERROR([Please reinstall the pkcs11 distribution])
55  dnl fi
56
57  dnl Remove this code block if the library supports pkg-config.
58  dnl --with-pkcs11 -> add include path
59  dnl PHP_ADD_INCLUDE($PKCS11_DIR/include)
60
61  dnl Remove this code block if the library supports pkg-config.
62  dnl --with-pkcs11 -> check for lib and symbol presence
63  dnl LIBNAME=PKCS11 # you may want to change this
64  dnl LIBSYMBOL=PKCS11 # you most likely want to change this
65
66  dnl If you need to check for a particular library function (e.g. a conditional
67  dnl or version-dependent feature) and you are using pkg-config:
68  dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
69  dnl [
70  dnl   AC_DEFINE(HAVE_PKCS11_FEATURE, 1, [ ])
71  dnl ],[
72  dnl   AC_MSG_ERROR([FEATURE not supported by your pkcs11 library.])
73  dnl ], [
74  dnl   $LIBFOO_LIBS
75  dnl ])
76
77  dnl If you need to check for a particular library function (e.g. a conditional
78  dnl or version-dependent feature) and you are not using pkg-config:
79  dnl PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL,
80  dnl [
81  dnl   PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PKCS11_DIR/$PHP_LIBDIR, PKCS11_SHARED_LIBADD)
82  dnl   AC_DEFINE(HAVE_PKCS11_FEATURE, 1, [ ])
83  dnl ],[
84  dnl   AC_MSG_ERROR([FEATURE not supported by your pkcs11 library.])
85  dnl ],[
86  dnl   -L$PKCS11_DIR/$PHP_LIBDIR -lm
87  dnl ])
88  dnl
89  dnl PHP_SUBST(PKCS11_SHARED_LIBADD)
90
91  dnl In case of no dependencies
92  AC_DEFINE(HAVE_PKCS11, 1, [ Have pkcs11 support ])
93
94  PHP_NEW_EXTENSION(pkcs11, pkcs11.c pkcs11object.c pkcs11key.c pkcs11keypair.c pkcs11module.c pkcs11signaturecontext.c pkcs11verificationcontext.c pkcs11digestcontext.c pkcs11encryptioncontext.c pkcs11decryptioncontext.c pkcs11mechanism.c pkcs11rsapssparams.c pkcs11rsaoaepparams.c pkcs11gcmparams.c pkcs11chacha20params.c pkcs11salsa20params.c pkcs11salsa20chacha20poly1305params.c pkcs11ecdh1deriveparams.c pkcs11session.c, $ext_shared)
95fi
96