move config.mk out of the way
[vlock.git] / configure
blob1d4f7fe0ad040cb484dbec3406f50734600ff663
1 #!/bin/sh
3 set -e
5 error() {
6 echo >&2 "$0: error: $@"
9 fatal_error() {
10 error "$@"
11 exit 1
14 show_usage() {
15 cat <<EOT
16 Usage: $0 [OPTION]... [VAR=VALUE]...
18 This script creates necessary configuration files to build/install.
20 To assign environment variables (e.g., CC, CFLAGS...), specify them as
21 VAR=VALUE. See below for descriptions of some of the useful variables.
23 Defaults for the options are specified in brackets.
25 Main options:
26 -h, --help display this help and exit
27 --prefix=[path] base path [/usr/local]
28 --bindir=DIR user executables [PREFIX/bin]
29 --sbindir=DIR system admin executables [PREFIX/sbin]
30 --libdir=DIR object code libraries [PREFIX/lib]
31 --scriptdir=DIR script type plugins [LIBDIR/vlock/scripts]
32 --moduledir=DIR module type plugins [LIBDIR/vlock/modules]
33 --mandir=DIR man documentation [PREFIX/share/man]
35 Optional Features:
36 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
37 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
38 --enable-plugins enable plugin support [enabled]
39 --enable-pam enable PAM authentication [enabled]
40 --enable-shadow enable shadow authentication [disabled]
41 --enable-root-password enable unlogging with root password [enabled]
43 Some influential environment variables:
44 CC C compiler command
45 CFLAGS C compiler flags
46 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
47 nonstandard directory <lib dir>
48 CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
49 headers in a nonstandard directory <include dir>
50 CPP C preprocessor
52 Use these variables to override the choices made by \`configure' or to help
53 it to find libraries and programs with nonstandard names/locations.
55 Report bugs to <frank-vlock@benkstein.net>.
56 EOT
59 enable_feature() {
60 case "$1" in
61 plugins)
62 enable_plugins="$2"
64 root-password)
65 enable_root_password="$2"
67 pam|shadow)
68 if [ "$2" = "yes" ] ; then
69 if [ -n "$auth_method" ] && [ "$auth_method" != "$1" ] ; then
70 fatal_error "pam and shadow authentication are mutually exclusive"
72 auth_method="$1"
73 else
74 fatal_error "cannot disable authentication"
78 fatal_error "invalid feature name: $1"
80 esac
83 while [ $# -gt 0 ] ; do
84 opt=`expr "x$1" : 'x\([^=]*\)=.*' ||:`
85 optarg=`expr "x$1" : 'x[^=]*=\(.*\)' ||:`
86 case "$1" in
87 --disable-*)
88 feature=`expr "$1" : '--disable-\(.*\)'`
89 enable_feature "$feature" no
90 shift
92 --enable-*=no)
93 feature=`expr "$1" : '--enable-\(.*\)=no'`
94 enable_feature "$feature" no
95 shift
97 --enable-*=yes)
98 feature=`expr "$1" : '--enable-\(.*\)=yes'`
99 enable_feature "$feature" yes
100 shift
102 --enable-*)
103 feature=`expr "$1" : '--enable-\(.*\)'`
104 enable_feature "$feature" yes
105 shift
107 --*=*)
108 shift
109 # unshift
110 eval set -- "$opt" "$optarg" "$@"
112 --prefix)
113 prefix="$2"
114 shift 2 || fatal_error "$1 argument missing"
116 --bindir)
117 bindir="$2"
118 shift 2 || fatal_error "$1 argument missing"
120 --sbindir)
121 sbindir="$2"
122 shift 2 || fatal_error "$1 argument missing"
124 --libdir)
125 libdir="$2"
126 shift 2 || fatal_error "$1 argument missing"
128 --moduledir)
129 moduledir="$2"
130 shift 2 || fatal_error "$1 argument missing"
132 --scriptdir)
133 scriptdir="$2"
134 shift 2 || fatal_error "$1 argument missing"
136 --mandir)
137 mandir="$2"
138 shift 2 || fatal_error "$1 argument missing"
140 --help)
141 show_usage
142 exit
144 --*)
145 error "unrecognized option: $1"
146 echo >&2 "Try \`$0 --help' for more information."
147 exit 1
150 fatal_error "invalid argument: $1"
152 esac
153 done
155 cat <<EOF
156 vlock configuration"
158 directories:
159 prefix: $PREFIX
160 bindir: $BINDIR
161 sbindir: $SBINDIR
162 libdir: $LIBDIR
163 scriptdir: $SCRIPTDIR
164 moduledir: $MODULEDIR
166 features:
167 plugins: $ENABLE_PLUGINS
168 root-password: $ENABLE_ROOT_PASSWORD
169 auth-method: $AUTH_METHOD