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 Additional configuration:
48 --with-scripts=SCRIPTS enable the named scripts []
49 --with-modules=MODULES enable the named modules [<architecture depedent>]
51 Some influential environment variables:
53 CFLAGS C compiler flags
54 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
55 nonstandard directory <lib dir>
57 Use these variables to override the choices made by \`configure' or to help
58 it to find libraries and programs with nonstandard names/locations.
60 Report bugs to <frank-vlock@benkstein.net>.
74 ENABLE_ROOT_PASSWORD
="$2"
77 if [ "$2" = "yes" ] ; then
78 if [ -n "$auth_method" ] && [ "$auth_method" != "$1" ] ; then
79 fatal_error
"pam and shadow authentication are mutually exclusive"
83 fatal_error
"cannot disable authentication"
87 fatal_error
"invalid feature name: $1"
93 local feature opt optarg
95 while [ $# -gt 0 ] ; do
96 if ! opt
=`expr "x$1" : 'x\([^=]*\)=.*'` ; then
100 if ! optarg
=`expr "x$1" : 'x[^=]*=\(.*\)'` ; then
106 feature
=`expr "$1" : '--disable-\(.*\)'`
107 enable_feature
"$feature" no
111 feature
=`expr "$1" : '--enable-\(.*\)=no'`
112 enable_feature
"$feature" no
116 feature
=`expr "$1" : '--enable-\(.*\)=yes'`
117 enable_feature
"$feature" yes
121 feature
=`expr "$1" : '--enable-\(.*\)'`
122 enable_feature
"$feature" yes
128 set -- "$opt" "$optarg" "$@"
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"
156 shift 2 || fatal_error
"$1 argument missing"
160 shift 2 || fatal_error
"$1 argument missing"
164 shift 2 || fatal_error
"$1 argument missing"
167 set_variable
"$1" "$2"
168 shift 2 || fatal_error
"$1 value missing"
179 error
"unrecognized option: $1"
180 echo >&2 "Try \`$0 --help' for more information."
184 error
"invalid argument: $1"
185 echo >&2 "Try \`$0 --help' for more information."
193 # architecture independent defaults
195 BINDIR
="\$(PREFIX)/bin"
196 SBINDIR
="\$(PREFIX)/sbin"
197 LIBDIR
="\$(PREFIX)/lib"
198 MANDIR
="\$(PREFIX)/share/man"
199 SCRIPTDIR
="\$(LIBDIR)/vlock/scripts"
200 MODULEDIR
="\$(LIBDIR)/vlock/modules"
203 CFLAGS
="-O2 -Wall -W -pedantic -std=gnu99"
207 ENABLE_ROOT_PASSWORD
="yes"
212 VLOCK_MODULE_MODE
="0750"
214 BOURNE_SHELL
="/bin/sh"
216 # architecture dependent defaults
219 for make in make gmake
; do
220 if $make -f /dev
/null
-q -v 2>/dev
/null |
head -n 1 |
grep -q "GNU Make" ; then
226 ROOT_GROUP
=`getent group | awk -F: '$3 == 0 { print $1 ; exit }'`
230 PAM_LIBS
='-ldl -lpam'
233 MODULES
="all.so new.so nosysrq.so"
236 PAM_LIBS
='-ldl -lpam'
239 MODULES
="all.so new.so"
245 DEFAULT_MODULES
="all.so new.so"
253 if [ -z "$MAKE" ] ; then
254 error
"GNU make not found"
255 echo >&2 "Set MAKE environment variable to specify alternative."
259 tmpdir
=`mktemp -d -t vlock-configure.XXXXXX`
261 $MAKE -rR -f config.mk
-p -q .
2>/dev
/null |
awk > "$tmpdir/config.mk" '
262 /^# makefile .from .config\.mk., line/ { p=1; next }
264 p==1 && $1 != "MAKEFILE_LIST" && /^[[:alpha:]_]+ :?= .*/ { print }
269 variable_name
=`expr "${line}" : '\([[[:alpha:]_]\{1,\}\) :\{0,1\}='`
270 if variable_value
=`expr "${line}" : '[[:alpha:]_]\{1,\} :\{0,1\}= \(.*\)'` ; then
271 set_variable
"$variable_name" "$variable_value"
273 set_variable
"$variable_name" ""
275 done < "$tmpdir/config.mk"
290 scriptdir: $SCRIPTDIR
291 moduledir: $MODULEDIR
294 enable plugins: $ENABLE_PLUGINS
295 root-password: $ENABLE_ROOT_PASSWORD
296 auth-method: $AUTH_METHOD
302 operating system: $OS
305 compiler flags: $CFLAGS
308 crypt lib: $CRYPT_LIB
310 installation configuration:
311 root group: $ROOT_GROUP
312 vlock group: $VLOCK_GROUP
317 cat > config.mk
<<EOF
318 # automatically generated by $0 on $(date)
320 ### configuration options ###
322 # authentification method (pam or shadow)
323 AUTH_METHOD = ${AUTH_METHOD}
324 # also prompt for the root password in adition to the user's
325 ENABLE_ROOT_PASSWORD = ${ENABLE_ROOT_PASSWORD}
326 # enable plugins for vlock-main
327 ENABLE_PLUGINS = ${ENABLE_PLUGINS}
328 # which plugins should be build
330 # which scripts should be installed
334 ROOT_GROUP = ${ROOT_GROUP}
336 # group to install vlock-main with
337 VLOCK_GROUP = ${VLOCK_GROUP}
338 # mode to install privileged plugins with
339 VLOCK_MODULE_MODE = ${VLOCK_MODULE_MODE}
343 # installation prefix
351 # path where modules will be located
352 MODULEDIR = ${MODULEDIR}
353 # path where scripts will be located
354 SCRIPTDIR = ${SCRIPTDIR}
358 # shell to run vlock.sh with (only bash is known to work)
359 BOURNE_SHELL = ${BOURNE_SHELL}
367 ### compiler and linker settings ###
373 # linker flags needed for dlopen and friends
375 # linker flags needed for crypt
376 CRYPT_LIB = ${CRYPT_LIB}
377 # linker flags needed for pam
378 PAM_LIBS = ${PAM_LIBS}
389 if [ "$verbose" -ge 1 ] ; then