archive: dragora-installer/parts: add header to explain script purposes
[dragora.git] / qi / configure
blobcbbe2a43a8f01d63f171cb17af597be962ae369e
1 #! /bin/sh -
3 # Simple `configure' script for Qi.
5 # Copyright (c) 2016-2018 Matias Fonzo, <selk@dragora.org>.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 usage() {
20 printf "%s\n" \
21 "Usage: configure [options]" \
22 "" \
23 "Defaults for the options are specified in brackets." \
24 "" \
25 "Options:" \
26 " --prefix=DIR install files in DIR [${prefix}]" \
27 " --exec-prefix=DIR base DIR for arch-dependent files [${exec_prefix}]" \
28 " --bindir=DIR user executables [${bindir}]" \
29 " --sbindir=DIR system admin executables [${sbindir}]" \
30 " --libexecdir=DIR program executables [${libexecdir}]" \
31 " --sysconfdir=DIR read-only single-machine data [${sysconfdir}]" \
32 " --localstatedir=DIR modifiable single-machine data [${localstatedir}]" \
33 " --datarootdir=DIR read-only arch-independent data root [${datarootdir}]" \
34 " --infodir=DIR info documentation [${infodir}]" \
35 " --mandir=DIR man documentation [${mandir}]" \
36 " --docdir=DIR documentation root [${docdir}]" \
37 " --packagedir=DIR package installation directory [${packagedir}]" \
38 " --targetdir=DIR target directory for linking [${targetdir}]" \
42 # Defaults
43 prefix=/usr/local
44 exec_prefix='$(prefix)'
45 bindir='$(exec_prefix)/bin'
46 sbindir='$(exec_prefix)/sbin'
47 libexecdir='$(exec_prefix)/libexec'
48 sysconfdir='$(prefix)/etc'
49 localstatedir='$(prefix)/var'
50 datarootdir='$(prefix)/share'
51 infodir='$(datarootdir)/info'
52 mandir='$(datarootdir)/man'
53 docdir='$(datarootdir)/doc'
54 packagedir='/usr/local/pkgs'
55 targetdir='/usr/local'
57 return_variables() {
58 printf "%s\n" \
59 "prefix = $prefix" \
60 "exec_prefix = $exec_prefix" \
61 "bindir = $bindir" \
62 "sbindir = $sbindir" \
63 "libexecdir = $libexecdir" \
64 "sysconfdir = $sysconfdir" \
65 "localstatedir = $localstatedir" \
66 "datarootdir = $datarootdir" \
67 "infodir = $infodir" \
68 "mandir = $mandir" \
69 "docdir = $docdir" \
70 "packagedir = $packagedir" \
71 "targetdir = $targetdir" \
75 # Handle options
76 while test $# -gt 0
78 case $1 in
79 --prefix)
80 prefix="$2"
81 shift
83 --prefix=*)
84 prefix="${1#*=}"
86 --exec-prefix)
87 exec_prefix="$2"
88 shift
90 --exec-prefix=*)
91 exec_prefix="${1#*=}"
93 --bindir)
94 bindir="$2"
95 shift
97 --bindir=*)
98 bindir="${1#*=}"
100 --sbindir)
101 sbindir="$2"
102 shift
104 --sbindir=*)
105 sbindir="${1#*=}"
107 --libexecdir)
108 libexecdir="$2"
109 shift
111 --libexecdir=*)
112 libexecdir="${1#*=}"
114 --sysconfdir)
115 sysconfdir="$2"
116 shift
118 --sysconfdir=*)
119 sysconfdir="${1#*=}"
121 --localstatedir)
122 localstatedir="$2"
123 shift
125 --localstatedir=*)
126 localstatedir="${1#*=}"
128 --datarootdir)
129 datarootdir="$2"
130 shift
132 --datarootdir=*)
133 datarootdir="${1#*=}"
135 --infodir)
136 infodir="$2"
137 shift
139 --infodir=*)
140 infodir="${1#*=}"
142 --mandir)
143 mandir="$2"
144 shift
146 --mandir=*)
147 mandir="${1#*=}"
149 --docdir)
150 docdir="$2"
151 shift
153 --docdir=*)
154 docdir="${1#*=}"
156 --packagedir)
157 packagedir="$2"
158 shift
160 --packagedir=*)
161 packagedir="${1#*=}"
163 --targetdir)
164 targetdir="$2"
165 shift
167 --targetdir=*)
168 targetdir="${1#*=}"
170 -h | --help)
171 usage
172 exit
174 --) # End of options
175 shift
176 break
179 echo "configure: WARNING: unrecognized option '${1}'" 1>&2
182 break
184 esac
185 shift
186 done
188 echo "Creating config.mak ..."
190 # Show variales and clean up the config.mak file
192 return_variables; : > config.mak
194 # To populate config.mak
195 return_variables > config.mak
197 echo "OK, now you can run \`make'"