1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
--- configure.in.orig 2016-04-29 17:26:45 UTC
+++ configure.in
@@ -6,6 +6,9 @@ AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([foreign 1.6])
+AC_DEFINE(_BSD_SOURCE, 1, BSD functions)
+AC_DEFINE(__BSD_VISIBLE, 1, BSD extensions)
+
dnl Checks for header files.
AC_DISABLE_STATIC
LT_INIT
@@ -25,6 +28,7 @@ AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([getcwd])
+AC_CHECK_FUNCS([asprintf])
dnl Used in various scripts
AC_PATH_PROG([ID], [id], [/us/bin/id])
@@ -40,10 +44,16 @@ AC_PROG_YACC
dnl Define custom variables
-lockdir=$localstatedir/lock/opencryptoki
+AC_ARG_WITH([lockdir],
+ [AS_HELP_STRING([--with-lockdir],[lock directory])],
+ [lockdir=$withval],
+ [lockdir=$localstatedir/lock/opencryptoki])
AC_SUBST(lockdir)
-logdir=$localstatedir/log/opencryptoki
+AC_ARG_WITH([logdir],
+ [AS_HELP_STRING([--with-logdir],[log directory])],
+ [logdir=$withval],
+ [logdir=$localstatedir/log/opencryptoki])
AC_SUBST(logdir)
dnl ---
@@ -166,6 +176,21 @@ AC_ARG_WITH([systemd],
[],
[with_systemd=no])
+dnl --- check for pkcs11 user
+AC_ARG_WITH([pkcs11user],
+ AC_HELP_STRING([--with-pkcs11user[[=USER]]], [set pkcs11 user [[pkcs11]]]),
+ [pkcs11_user=$withval],
+ [pkcs11_user=pkcs11])
+
+dnl --- check for pkcs11 group
+AC_ARG_WITH(pkcs11group,
+ AC_HELP_STRING([--with-pkcs11group[[=GROUP]]], [set pkcs11 group [[pkcs11]]]),
+ [pkcs11_group=$withval],
+ [pkcs11_group=pkcs11])
+
+AC_SUBST(PKCS11USER, $pkcs11_user)
+AC_SUBST(PKCS11GROUP, $pkcs11_group)
+
dnl ---
dnl ---
dnl --- Now that we have all the options, let's check for a valid build
@@ -554,13 +579,31 @@ fi
AM_CONDITIONAL([ENABLE_PKCSEP11_MIGRATE], [test "x$enable_pkcsep11_migrate" = "xyes"])
-CFLAGS="$CFLAGS -DPKCS64 -D_XOPEN_SOURCE=600 -Wall -Wno-pointer-sign"
-
-CFLAGS+=' -DCONFIG_PATH=\"$(localstatedir)/lib/opencryptoki\" -DSBIN_PATH=\"$(sbindir)\" -DLIB_PATH=\"$(libdir)\" -DLOCKDIR_PATH=\"$(lockdir)\" -DOCK_CONFDIR=\"$(sysconfdir)/opencryptoki\" -DOCK_LOGDIR=\"$(logdir)\"'
+CFLAGS="$CFLAGS \
+ -Wall \
+ -Wno-pointer-sign \
+"
+CPPFX=' \
+ -DCONFIG_PATH=\"$(localstatedir)/lib/opencryptoki\" \
+ -DSBIN_PATH=\"$(sbindir)\" \
+ -DLIB_PATH=\"$(libdir)\" \
+ -DLOCKDIR_PATH=\"$(lockdir)\" \
+ -DOCK_CONFDIR=\"$(sysconfdir)/opencryptoki\" \
+ -DOCK_LOGDIR=\"$(logdir)\" \
+'
+CPPFLAGS="$CPPFLAGS \
+ -DPKCS64 \
+ -D_XOPEN_SOURCE=600 \
+ $CPPFX \
+ -DPKCS11USER=\\\"${pkcs11_user}\\\" \
+ -DPKCS11GROUP=\\\"${pkcs11_group}\\\" \
+"
# At this point, CFLAGS is set to something sensible
AC_PROG_CC
+AC_SUBST(FPIC, $lt_prog_compiler_pic)
+
AC_CONFIG_FILES([Makefile usr/Makefile \
usr/include/Makefile \
usr/include/pkcs11/Makefile \
|