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]
46 --enable-debug enable debugging
48 Additional configuration:
49 --with-scripts=SCRIPTS enable the named scripts []
50 --with-modules=MODULES enable the named modules [<architecture depedent>]
52 Some influential environment variables:
54 CFLAGS C compiler flags
55 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
56 nonstandard directory <lib dir>
57 VLOCK_GROUP group for restricted modules (default: vlock)
58 VLOCK_MODE mode for restricted modules (default: 0750)
60 Use these variables to override the choices made by \`configure' or to help
61 it to find libraries and programs with nonstandard names/locations.
63 Report bugs to <frank-vlock@benkstein.net>.
77 ENABLE_ROOT_PASSWORD
="$2"
80 if [ "$2" = "yes" ] ; then
81 if [ -n "$auth_method" ] && [ "$auth_method" != "$1" ] ; then
82 fatal_error
"pam and shadow authentication are mutually exclusive"
86 fatal_error
"cannot disable authentication"
90 if [ "$2" = "yes" ] ; then
91 CFLAGS
="${DEBUG_CFLAGS}"
93 CFLAGS
="${DEFAULT_CFLAGS}"
97 fatal_error
"invalid feature name: $1"
103 local feature opt optarg
105 while [ $# -gt 0 ] ; do
106 if ! opt
=`expr "x$1" : 'x\([^=]*\)=.*'` ; then
110 if ! optarg
=`expr "x$1" : 'x[^=]*=\(.*\)'` ; then
116 feature
=`expr "x$1" : 'x--disable-\(.*\)'`
117 enable_feature
"$feature" no
121 feature
=`expr "x$1" : 'x--enable-\(.*\)=no'`
122 enable_feature
"$feature" no
126 feature
=`expr "x$1" : 'x--enable-\(.*\)=yes'`
127 enable_feature
"$feature" yes
131 feature
=`expr "x$1" : 'x--enable-\(.*\)'`
132 enable_feature
"$feature" yes
138 set -- "$opt" "$optarg" "$@"
142 shift 2 || fatal_error
"$1 argument missing"
146 shift 2 || fatal_error
"$1 argument missing"
150 shift 2 || fatal_error
"$1 argument missing"
154 shift 2 || fatal_error
"$1 argument missing"
158 shift 2 || fatal_error
"$1 argument missing"
162 shift 2 || fatal_error
"$1 argument missing"
166 shift 2 || fatal_error
"$1 argument missing"
170 shift 2 || fatal_error
"$1 argument missing"
174 shift 2 || fatal_error
"$1 argument missing"
177 set_variable
"$1" "$2"
178 shift 2 || fatal_error
"$1 value missing"
189 error
"unrecognized option: $1"
190 echo >&2 "Try \`$0 --help' for more information."
194 error
"invalid argument: $1"
195 echo >&2 "Try \`$0 --help' for more information."
203 # architecture independent defaults
205 BINDIR
="\$(PREFIX)/bin"
206 SBINDIR
="\$(PREFIX)/sbin"
207 LIBDIR
="\$(PREFIX)/lib"
208 MANDIR
="\$(PREFIX)/share/man"
209 SCRIPTDIR
="\$(LIBDIR)/vlock/scripts"
210 MODULEDIR
="\$(LIBDIR)/vlock/modules"
213 DEFAULT_CFLAGS
="-O2 -Wall -W -pedantic -std=gnu99"
214 DEBUG_CFLAGS
="-O0 -g -Wall -W -pedantic -std=gnu99"
215 CFLAGS
="${DEFAULT_CFLAGS}"
219 ENABLE_ROOT_PASSWORD
="yes"
224 VLOCK_MODULE_MODE
="0750"
226 BOURNE_SHELL
="/bin/sh"
228 # architecture dependent defaults
231 for make in make gmake
; do
232 if $make -f /dev
/null
-q -v 2>/dev
/null |
head -n 1 |
grep -q "GNU Make" ; then
238 ROOT_GROUP
=`getent group | awk -F: '$3 == 0 { print $1 ; exit }'`
242 PAM_LIBS
='-ldl -lpam'
245 MODULES
="all.so new.so nosysrq.so"
248 PAM_LIBS
='-ldl -lpam'
251 MODULES
="all.so new.so"
257 MODULES
="all.so new.so"
265 if [ -z "$MAKE" ] ; then
266 error
"GNU make not found"
267 echo >&2 "Set MAKE environment variable to specify alternative."
271 tmpdir
=`mktemp -d -t vlock-configure.XXXXXX`
273 $MAKE -rR -f config.mk
-p -q .
2>/dev
/null |
awk > "$tmpdir/config.mk" '
274 /^# makefile .from .config\.mk., line/ { p=1; next }
276 p==1 && $1 != "MAKEFILE_LIST" && /^[[:alpha:]_]+ :?= .*/ { print }
281 variable_name
=`expr "x${line}" : 'x\([[[:alpha:]_]\{1,\}\) :\{0,1\}='`
282 if variable_value
=`expr "x${line}" : 'x[[:alpha:]_]\{1,\} :\{0,1\}= \(.*\)'` ; then
283 set_variable
"$variable_name" "$variable_value"
285 set_variable
"$variable_name" ""
287 done < "$tmpdir/config.mk"
302 scriptdir: $SCRIPTDIR
303 moduledir: $MODULEDIR
306 enable plugins: $ENABLE_PLUGINS
307 root-password: $ENABLE_ROOT_PASSWORD
308 auth-method: $AUTH_METHOD
314 operating system: $OS
317 compiler flags: $CFLAGS
320 crypt lib: $CRYPT_LIB
322 installation configuration:
323 root group: $ROOT_GROUP
324 vlock group: $VLOCK_GROUP
329 cat > config.mk
<<EOF
330 # automatically generated by $0 on $(date)
332 ### configuration options ###
334 # authentification method (pam or shadow)
335 AUTH_METHOD = ${AUTH_METHOD}
336 # also prompt for the root password in adition to the user's
337 ENABLE_ROOT_PASSWORD = ${ENABLE_ROOT_PASSWORD}
338 # enable plugins for vlock-main
339 ENABLE_PLUGINS = ${ENABLE_PLUGINS}
340 # which plugins should be build
342 # which scripts should be installed
346 ROOT_GROUP = ${ROOT_GROUP}
348 # group for privileged plugins
349 VLOCK_GROUP = ${VLOCK_GROUP}
350 # mode for privileged plugins
351 VLOCK_MODULE_MODE = ${VLOCK_MODULE_MODE}
355 # installation prefix
363 # path where modules will be located
364 MODULEDIR = ${MODULEDIR}
365 # path where scripts will be located
366 SCRIPTDIR = ${SCRIPTDIR}
370 # shell to run vlock.sh with (only bash is known to work)
371 BOURNE_SHELL = ${BOURNE_SHELL}
381 ### compiler and linker settings ###
387 # linker flags needed for dlopen and friends
389 # linker flags needed for crypt
390 CRYPT_LIB = ${CRYPT_LIB}
391 # linker flags needed for pam
392 PAM_LIBS = ${PAM_LIBS}
403 if [ "$verbose" -ge 1 ] ; then