6 echo >&2 "$0: error: $@"
15 ( eval [ "\"\${$1+set}\"" = "set" ] )
20 Usage: $0 [OPTION]... [VAR=VALUE]...
22 This script creates necessary configuration files to build/install.
24 To assign environment variables (e.g., CC, CFLAGS...), specify them as
25 VAR=VALUE. See below for descriptions of some of the useful variables.
27 Defaults for the options are specified in brackets.
30 -h, --help display this help and exit
31 --prefix=[path] base path [/usr/local]
32 --bindir=DIR user executables [PREFIX/bin]
33 --sbindir=DIR system admin executables [PREFIX/sbin]
34 --libdir=DIR object code libraries [PREFIX/lib]
35 --scriptdir=DIR script type plugins [LIBDIR/vlock/scripts]
36 --moduledir=DIR module type plugins [LIBDIR/vlock/modules]
37 --mandir=DIR man documentation [PREFIX/share/man]
40 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
41 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
42 --enable-plugins enable plugin support [enabled]
43 --enable-pam enable PAM authentication [enabled]
44 --enable-shadow enable shadow authentication [disabled]
45 --enable-root-password enable unlogging with root password [enabled]
47 Some influential environment variables:
49 CFLAGS C compiler flags
50 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
51 nonstandard directory <lib dir>
53 Use these variables to override the choices made by \`configure' or to help
54 it to find libraries and programs with nonstandard names/locations.
56 Report bugs to <frank-vlock@benkstein.net>.
70 ENABLE_ROOT_PASSWORD
="$2"
73 if [ "$2" = "yes" ] ; then
74 if [ -n "$auth_method" ] && [ "$auth_method" != "$1" ] ; then
75 fatal_error
"pam and shadow authentication are mutually exclusive"
79 fatal_error
"cannot disable authentication"
83 fatal_error
"invalid feature name: $1"
89 local feature opt optarg
91 while [ $# -gt 0 ] ; do
92 if ! opt
=`expr "x$1" : 'x\([^=]*\)=.*'` ; then
96 if ! optarg
=`expr "x$1" : 'x[^=]*=\(.*\)'` ; then
102 feature
=`expr "$1" : '--disable-\(.*\)'`
103 enable_feature
"$feature" no
107 feature
=`expr "$1" : '--enable-\(.*\)=no'`
108 enable_feature
"$feature" no
112 feature
=`expr "$1" : '--enable-\(.*\)=yes'`
113 enable_feature
"$feature" yes
117 feature
=`expr "$1" : '--enable-\(.*\)'`
118 enable_feature
"$feature" yes
124 set -- "$opt" "$optarg" "$@"
128 shift 2 || fatal_error
"$1 argument missing"
132 shift 2 || fatal_error
"$1 argument missing"
136 shift 2 || fatal_error
"$1 argument missing"
140 shift 2 || fatal_error
"$1 argument missing"
144 shift 2 || fatal_error
"$1 argument missing"
148 shift 2 || fatal_error
"$1 argument missing"
152 shift 2 || fatal_error
"$1 argument missing"
155 set_variable
"$1" "$2"
156 shift 2 || fatal_error
"$1 value missing"
167 error
"unrecognized option: $1"
168 echo >&2 "Try \`$0 --help' for more information."
172 error
"invalid argument: $1"
173 echo >&2 "Try \`$0 --help' for more information."
181 # architecture independent defaults
183 BINDIR
="\$(PREFIX)/bin"
184 SBINDIR
="\$(PREFIX)/sbin"
185 LIBDIR
="\$(PREFIX)/lib"
186 MANDIR
="\$(PREFIX)/share/man"
187 SCRIPTDIR
="\$(LIBDIR)/vlock/scripts"
188 MODULEDIR
="\$(LIBDIR)/vlock/modules"
191 CFLAGS
="-O2 -Wall -W -pedantic -std=gnu99"
195 PLUGINS
="$DEFAULT_MODULES"
196 ENABLE_ROOT_PASSWORD
="yes"
200 VLOCK_MODULE_MODE
="0750"
202 BOURNE_SHELL
="/bin/sh"
204 # architecture dependent defaults
207 for make in make gmake
; do
208 if $make -f /dev
/null
-q -v 2>/dev
/null |
head -n 1 |
grep -q "GNU Make" ; then
214 ROOT_GROUP
=`getent group | awk -F: '$3 == 0 { print $1 ; exit }'`
218 PAM_LIBS
='-ldl -lpam'
221 DEFAULT_MODULES
="all.so new.so nosysrq.so"
224 PAM_LIBS
='-ldl -lpam'
227 DEFAULT_MODULES
="all.so new.so"
233 DEFAULT_MODULES
="all.so new.so"
241 if [ -z "$MAKE" ] ; then
242 error
"GNU make not found"
243 echo >&2 "Set MAKE environment variable to specify alternative."
247 tmpdir
=`mktemp -d -t vlock-configure.XXXXXX`
249 $MAKE -rR -f config.mk
-p -q .
2>/dev
/null |
awk > "$tmpdir/config.mk" '
250 /^# makefile .from .config\.mk., line/ { p=1; next }
252 p==1 && $1 != "MAKEFILE_LIST" && /^[[:alpha:]_]+ :?= .*/ { print }
257 variable_name
=`expr "${line}" : '\([[[:alpha:]_]\{1,\}\) :\{0,1\}='`
258 if variable_value
=`expr "${line}" : '[[:alpha:]_]\{1,\} :\{0,1\}= \(.*\)'` ; then
259 set_variable
"$variable_name" "$variable_value"
261 set_variable
"$variable_name" ""
263 done < "$tmpdir/config.mk"
278 scriptdir: $SCRIPTDIR
279 moduledir: $MODULEDIR
282 enable plugins: $ENABLE_PLUGINS
283 root-password: $ENABLE_ROOT_PASSWORD
284 auth-method: $AUTH_METHOD
289 operating system: $OS
292 compiler flags: $CFLAGS
295 crypt lib: $CRYPT_LIB
297 installation configuration:
298 root group: $ROOT_GROUP
299 vlock group: $VLOCK_GROUP
304 cat > config.mk
<<EOF
305 # automatically generated by $0 on $(date)
307 ### configuration options ###
309 # authentification method (pam or shadow)
310 AUTH_METHOD = ${AUTH_METHOD}
311 # also prompt for the root password in adition to the user's
312 ENABLE_ROOT_PASSWORD = ${ENABLE_ROOT_PASSWORD}
313 # enable plugins for vlock-main
314 ENABLE_PLUGINS = ${ENABLE_PLUGINS}
315 # which plugins should be build
316 MODULES = \$(filter %.so, ${PLUGINS})
317 # which scripts should be installed
318 SCRIPTS = \$(filter %.sh, ${PLUGINS})
321 ROOT_GROUP = ${ROOT_GROUP}
323 # group to install vlock-main with
324 VLOCK_GROUP = ${VLOCK_GROUP}
325 # mode to install privileged plugins with
326 VLOCK_MODULE_MODE = ${VLOCK_MODULE_MODE}
330 # installation prefix
338 # path where modules will be located
339 VLOCK_MODULE_DIR = ${VLOCK_MODULE_DIR}
340 # path where scripts will be located
341 VLOCK_SCRIPT_DIR = ${VLOCK_SCRIPT_DIR}
345 # shell to run vlock.sh with (only bash is known to work)
346 BOURNE_SHELL = ${BOURNE_SHELL}
356 ### compiler and linker settings ###
362 # linker flags needed for dlopen and friends, default is system dependend
364 # linker flags needed for crypt
365 CRYPT_LIB = ${CRYPT_LIB}
366 # linker flags needed for pam
367 PAM_LIBS = ${PAM_LIBS}
378 if [ "$verbose" -ge 1 ] ; then