]>
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 | |
1d4b3375 | 28 | return 0 |
103281f3 CW |
29 | } |
30 | ||
31 | while (($# > 0)); do | |
32 | case "${1%%=*}" in | |
33 | --prefix) read_arg prefix "$@" || shift;; | |
34 | --libdir) read_arg libdir "$@" || shift;; | |
35 | --datadir) read_arg datadir "$@" || shift;; | |
36 | --sysconfdir) read_arg sysconfdir "$@" || shift;; | |
37 | --sbindir) read_arg sbindir "$@" || shift;; | |
38 | --mandir) read_arg mandir "$@" || shift;; | |
2692a422 | 39 | --disable-documentation) enable_documentation=no;; |
1d4b3375 HH |
40 | --program-prefix) read_arg programprefix "$@" || shift;; |
41 | --exec-prefix) read_arg execprefix "$@" || shift;; | |
42 | --bindir) read_arg bindir "$@" || shift;; | |
43 | --includedir) read_arg includedir "$@" || shift;; | |
44 | --libexecdir) read_arg libexecdir "$@" || shift;; | |
45 | --localstatedir) read_arg localstatedir "$@" || shift;; | |
46 | --sharedstatedir) read_arg sharedstatedir "$@" || shift;; | |
47 | --infodir) read_arg infodir "$@" || shift;; | |
48 | --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;; | |
49 | --bashcompletiondir) read_arg bashcompletiondir "$@" || shift;; | |
103281f3 CW |
50 | *) echo "Ignoring unknown option '$1'";; |
51 | esac | |
52 | shift | |
53 | done | |
54 | ||
1d4b3375 | 55 | cat > Makefile.inc.$$ <<EOF |
103281f3 CW |
56 | prefix ?= ${prefix} |
57 | libdir ?= ${libdir:-${prefix}/lib} | |
58 | datadir ?= ${datadir:-${prefix}/share} | |
59 | sysconfdir ?= ${sysconfdir:-${prefix}/etc} | |
60 | sbindir ?= ${sbindir:-${prefix}/sbin} | |
61 | mandir ?= ${mandir:-${prefix}/share/man} | |
1d4b3375 HH |
62 | enable_documentation ?= ${enable_documentation:-yes} |
63 | bindir ?= ${bindir:-${prefix}/bin} | |
103281f3 | 64 | EOF |
1d4b3375 HH |
65 | |
66 | { | |
67 | [[ $programprefix ]] && echo "programprefix ?= ${programprefix}" | |
68 | [[ $execprefix ]] && echo "execprefix ?= ${execprefix}" | |
69 | [[ $includedir ]] && echo "includedir ?= ${includedir}" | |
70 | [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}" | |
71 | [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}" | |
72 | [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}" | |
73 | [[ $infodir ]] && echo "infodir ?= ${infodir}" | |
74 | [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}" | |
75 | [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}" | |
76 | } >> Makefile.inc.$$ | |
77 | ||
78 | mv Makefile.inc.$$ Makefile.inc |