qi: Bump to version 2.0 (Release Candidate 1)
[dragora.git] / qi / configure
blob5987343968dfbd66f100afeda2f3ee44d608d988
1 #! /bin/sh -
3 # Simple `configure' script for Qi.
5 # Copyright (c) 2016-2018, 2020 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 set directory for package installations [${packagedir}]" \
38 " --targetdir=DIR set target directory for symbolic links [${targetdir}]" \
39 " --arch=name set default package architecture [${arch}]" \
43 # Defaults
44 prefix=/usr/local
45 exec_prefix='$(prefix)'
46 bindir='$(exec_prefix)/bin'
47 sbindir='$(exec_prefix)/sbin'
48 libexecdir='$(exec_prefix)/libexec'
49 sysconfdir='$(prefix)/etc'
50 localstatedir='$(prefix)/var'
51 datarootdir='$(prefix)/share'
52 infodir='$(datarootdir)/info'
53 mandir='$(datarootdir)/man'
54 docdir='$(datarootdir)/doc'
55 packagedir='/usr/local/pkgs'
56 targetdir='/usr/local'
57 arch="$(uname -m)"
59 return_variables() {
60 printf "%s\n" \
61 "prefix = $prefix" \
62 "exec_prefix = $exec_prefix" \
63 "bindir = $bindir" \
64 "sbindir = $sbindir" \
65 "libexecdir = $libexecdir" \
66 "sysconfdir = $sysconfdir" \
67 "localstatedir = $localstatedir" \
68 "datarootdir = $datarootdir" \
69 "infodir = $infodir" \
70 "mandir = $mandir" \
71 "docdir = $docdir" \
72 "packagedir = $packagedir" \
73 "targetdir = $targetdir" \
74 "arch = $arch" \
78 # Handle options
79 while test $# -gt 0
81 case $1 in
82 --prefix)
83 prefix="$2"
84 shift
86 --prefix=*)
87 prefix="${1#*=}"
89 --exec-prefix)
90 exec_prefix="$2"
91 shift
93 --exec-prefix=*)
94 exec_prefix="${1#*=}"
96 --bindir)
97 bindir="$2"
98 shift
100 --bindir=*)
101 bindir="${1#*=}"
103 --sbindir)
104 sbindir="$2"
105 shift
107 --sbindir=*)
108 sbindir="${1#*=}"
110 --libexecdir)
111 libexecdir="$2"
112 shift
114 --libexecdir=*)
115 libexecdir="${1#*=}"
117 --sysconfdir)
118 sysconfdir="$2"
119 shift
121 --sysconfdir=*)
122 sysconfdir="${1#*=}"
124 --localstatedir)
125 localstatedir="$2"
126 shift
128 --localstatedir=*)
129 localstatedir="${1#*=}"
131 --datarootdir)
132 datarootdir="$2"
133 shift
135 --datarootdir=*)
136 datarootdir="${1#*=}"
138 --infodir)
139 infodir="$2"
140 shift
142 --infodir=*)
143 infodir="${1#*=}"
145 --mandir)
146 mandir="$2"
147 shift
149 --mandir=*)
150 mandir="${1#*=}"
152 --docdir)
153 docdir="$2"
154 shift
156 --docdir=*)
157 docdir="${1#*=}"
159 --packagedir)
160 packagedir="$2"
161 shift
163 --packagedir=*)
164 packagedir="${1#*=}"
166 --targetdir)
167 targetdir="$2"
168 shift
170 --targetdir=*)
171 targetdir="${1#*=}"
173 --arch)
174 arch="$2"
175 shift
177 --arch=*)
178 arch="${1#*=}"
180 --help | --hel | --he | --h | '--?' | -help | -hel | -he | -h | '-?' )
181 usage
182 exit
185 shift
186 break; # End of options.
189 echo "configure: WARNING: unrecognized option '${1}'" 1>&2
192 break
194 esac
195 shift
196 done
198 echo "Creating config.mak ..."
200 return_variables; # Show configured variables.
201 : > config.mak; # Clean up config.mak, first.
203 return_variables > config.mak && \
204 echo "OK, now you can run \`make'"
205 exit $?