Comparison

configure @ 10008:272c436ca5d1

configure: Handle ostype preset after argument processing
author Kim Alvefur <zash@zash.se>
date Mon, 13 May 2019 11:52:16 +0200
parent 9999:d2febb4befbc
child 10009:b6ce1dbe74a0
comparison
equal deleted inserted replaced
10007:de43ca319184 10008:272c436ca5d1
151 [ -n "$value" ] || die "Missing value in flag $key." 151 [ -n "$value" ] || die "Missing value in flag $key."
152 SYSCONFDIR="$value" 152 SYSCONFDIR="$value"
153 SYSCONFDIR_SET=yes 153 SYSCONFDIR_SET=yes
154 ;; 154 ;;
155 --ostype) 155 --ostype)
156 # TODO make this a switch?
157 OSPRESET="$value" 156 OSPRESET="$value"
158 if [ "$OSPRESET" = "debian" ]; then 157 OSPRESET_SET="yes"
159 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
160 LUA_SUFFIX="5.1";
161 LUA_SUFFIX_SET=yes
162 fi
163 if [ "$RUNWITH_SET" != "yes" ]; then
164 RUNWITH="lua$LUA_SUFFIX";
165 RUNWITH_SET=yes
166 fi
167 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX"
168 LUA_INCDIR_SET=yes
169 CFLAGS="$CFLAGS -ggdb"
170 fi
171 if [ "$OSPRESET" = "macosx" ]; then
172 LUA_INCDIR=/usr/local/include;
173 LUA_INCDIR_SET=yes
174 LUA_LIBDIR=/usr/local/lib
175 LUA_LIBDIR_SET=yes
176 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
177 LDFLAGS="-bundle -undefined dynamic_lookup"
178 fi
179 if [ "$OSPRESET" = "linux" ]; then
180 LUA_INCDIR=/usr/local/include;
181 LUA_INCDIR_SET=yes
182 LUA_LIBDIR=/usr/local/lib
183 LUA_LIBDIR_SET=yes
184 CFLAGS="$CFLAGS -ggdb"
185 fi
186 if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then
187 LUA_INCDIR="/usr/local/include/lua51"
188 LUA_INCDIR_SET=yes
189 CFLAGS="-Wall -fPIC -I/usr/local/include"
190 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
191 LUA_SUFFIX="51"
192 LUA_SUFFIX_SET=yes
193 LUA_DIR=/usr/local
194 LUA_DIR_SET=yes
195 CC=cc
196 LD=ld
197 fi
198 if [ "$OSPRESET" = "openbsd" ]; then
199 LUA_INCDIR="/usr/local/include";
200 LUA_INCDIR_SET="yes"
201 fi
202 if [ "$OSPRESET" = "netbsd" ]; then
203 LUA_INCDIR="/usr/pkg/include/lua-5.1"
204 LUA_INCDIR_SET=yes
205 LUA_LIBDIR="/usr/pkg/lib/lua/5.1"
206 LUA_LIBDIR_SET=yes
207 CFLAGS="-Wall -fPIC -I/usr/pkg/include"
208 LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared"
209 fi
210 if [ "$OSPRESET" = "pkg-config" ]; then
211 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
212 LUA_SUFFIX="5.1";
213 LUA_SUFFIX_SET=yes
214 fi
215 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
216 LUA_CF="${LUA_CF#*-I}"
217 LUA_CF="${LUA_CF%% *}"
218 if [ "$LUA_CF" != "" ]; then
219 LUA_INCDIR="$LUA_CF"
220 LUA_INCDIR_SET=yes
221 fi
222 CFLAGS="$CFLAGS"
223 fi
224 ;; 158 ;;
225 --libdir) 159 --libdir)
226 LIBDIR="$value" 160 LIBDIR="$value"
227 LIBDIR_SET=yes 161 LIBDIR_SET=yes
228 ;; 162 ;;
316 die "Error: Unknown flag: $1" 250 die "Error: Unknown flag: $1"
317 ;; 251 ;;
318 esac 252 esac
319 shift 253 shift
320 done 254 done
255
256 if [ "$OSPRESET_SET" = "yes" ]; then
257 # TODO make this a switch?
258 if [ "$OSPRESET" = "debian" ]; then
259 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
260 LUA_SUFFIX="5.1";
261 LUA_SUFFIX_SET=yes
262 fi
263 if [ "$RUNWITH_SET" != "yes" ]; then
264 RUNWITH="lua$LUA_SUFFIX";
265 RUNWITH_SET=yes
266 fi
267 LUA_INCDIR="/usr/include/lua$LUA_SUFFIX"
268 LUA_INCDIR_SET=yes
269 CFLAGS="$CFLAGS -ggdb"
270 fi
271 if [ "$OSPRESET" = "macosx" ]; then
272 LUA_INCDIR=/usr/local/include;
273 LUA_INCDIR_SET=yes
274 LUA_LIBDIR=/usr/local/lib
275 LUA_LIBDIR_SET=yes
276 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
277 LDFLAGS="-bundle -undefined dynamic_lookup"
278 fi
279 if [ "$OSPRESET" = "linux" ]; then
280 LUA_INCDIR=/usr/local/include;
281 LUA_INCDIR_SET=yes
282 LUA_LIBDIR=/usr/local/lib
283 LUA_LIBDIR_SET=yes
284 CFLAGS="$CFLAGS -ggdb"
285 fi
286 if [ "$OSPRESET" = "freebsd" ] || [ "$OSPRESET" = "openbsd" ]; then
287 LUA_INCDIR="/usr/local/include/lua51"
288 LUA_INCDIR_SET=yes
289 CFLAGS="-Wall -fPIC -I/usr/local/include"
290 LDFLAGS="-I/usr/local/include -L/usr/local/lib -shared"
291 LUA_SUFFIX="51"
292 LUA_SUFFIX_SET=yes
293 LUA_DIR=/usr/local
294 LUA_DIR_SET=yes
295 CC=cc
296 LD=ld
297 fi
298 if [ "$OSPRESET" = "openbsd" ]; then
299 LUA_INCDIR="/usr/local/include";
300 LUA_INCDIR_SET="yes"
301 fi
302 if [ "$OSPRESET" = "netbsd" ]; then
303 LUA_INCDIR="/usr/pkg/include/lua-5.1"
304 LUA_INCDIR_SET=yes
305 LUA_LIBDIR="/usr/pkg/lib/lua/5.1"
306 LUA_LIBDIR_SET=yes
307 CFLAGS="-Wall -fPIC -I/usr/pkg/include"
308 LDFLAGS="-L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -shared"
309 fi
310 if [ "$OSPRESET" = "pkg-config" ]; then
311 if [ "$LUA_SUFFIX_SET" != "yes" ]; then
312 LUA_SUFFIX="5.1";
313 LUA_SUFFIX_SET=yes
314 fi
315 LUA_CF="$(pkg-config --cflags-only-I lua$LUA_SUFFIX)"
316 LUA_CF="${LUA_CF#*-I}"
317 LUA_CF="${LUA_CF%% *}"
318 if [ "$LUA_CF" != "" ]; then
319 LUA_INCDIR="$LUA_CF"
320 LUA_INCDIR_SET=yes
321 fi
322 CFLAGS="$CFLAGS"
323 fi
324 fi
321 325
322 if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ] 326 if [ "$PREFIX_SET" = "yes" ] && [ ! "$SYSCONFDIR_SET" = "yes" ]
323 then 327 then
324 if [ "$PREFIX" = "/usr" ] 328 if [ "$PREFIX" = "/usr" ]
325 then SYSCONFDIR=/etc/$APP_DIRNAME 329 then SYSCONFDIR=/etc/$APP_DIRNAME