]>
Commit | Line | Data |
---|---|---|
103281f3 CW |
1 | #!/bin/bash |
2 | # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- | |
3 | # ex: ts=8 sw=4 sts=4 et filetype=sh | |
4 | ||
5 | # We don't support srcdir != builddir | |
6 | echo \#buildapi-variable-no-builddir >/dev/null | |
7 | ||
8 | prefix=/usr | |
9 | ||
2692a422 CW |
10 | enable_documentation=yes |
11 | ||
103281f3 CW |
12 | # Little helper function for reading args from the commandline. |
13 | # it automatically handles -a b and -a=b variants, and returns 1 if | |
14 | # we need to shift $3. | |
15 | read_arg() { | |
16 | # $1 = arg name | |
17 | # $2 = arg value | |
18 | # $3 = arg parameter | |
19 | local rematch='^[^=]*=(.*)$' | |
20 | if [[ $2 =~ $rematch ]]; then | |
21 | read "$1" <<< "${BASH_REMATCH[1]}" | |
22 | else | |
23 | read "$1" <<< "$3" | |
24 | # There is no way to shift our callers args, so | |
25 | # return 1 to indicate they should do it instead. | |
26 | return 1 | |
27 | fi | |
28 | } | |
29 | ||
30 | while (($# > 0)); do | |
31 | case "${1%%=*}" in | |
32 | --prefix) read_arg prefix "$@" || shift;; | |
33 | --libdir) read_arg libdir "$@" || shift;; | |
34 | --datadir) read_arg datadir "$@" || shift;; | |
35 | --sysconfdir) read_arg sysconfdir "$@" || shift;; | |
36 | --sbindir) read_arg sbindir "$@" || shift;; | |
37 | --mandir) read_arg mandir "$@" || shift;; | |
2692a422 | 38 | --disable-documentation) enable_documentation=no;; |
103281f3 CW |
39 | *) echo "Ignoring unknown option '$1'";; |
40 | esac | |
41 | shift | |
42 | done | |
43 | ||
44 | cat > Makefile.inc.tmp <<EOF | |
45 | prefix ?= ${prefix} | |
46 | libdir ?= ${libdir:-${prefix}/lib} | |
47 | datadir ?= ${datadir:-${prefix}/share} | |
48 | sysconfdir ?= ${sysconfdir:-${prefix}/etc} | |
49 | sbindir ?= ${sbindir:-${prefix}/sbin} | |
50 | mandir ?= ${mandir:-${prefix}/share/man} | |
2692a422 | 51 | enable_documentation ?= ${enable_documentation} |
103281f3 CW |
52 | EOF |
53 | mv Makefile.inc.tmp Makefile.inc |