fixup test suite
[dracut.git] / configure
blob0bd3d2dc23a8fda72188ddf73b295bba9f8eece8
1 #!/bin/bash
3 # We don't support srcdir != builddir
4 echo \#buildapi-variable-no-builddir >/dev/null
6 prefix=/usr
8 enable_documentation=yes
10 # Little helper function for reading args from the commandline.
11 # it automatically handles -a b and -a=b variants, and returns 1 if
12 # we need to shift $3.
13 read_arg() {
14 # $1 = arg name
15 # $2 = arg value
16 # $3 = arg parameter
17 local rematch='^[^=]*=(.*)$'
18 if [[ $2 =~ $rematch ]]; then
19 read "$1" <<< "${BASH_REMATCH[1]}"
20 else
21 read "$1" <<< "$3"
22 # There is no way to shift our callers args, so
23 # return 1 to indicate they should do it instead.
24 return 1
26 return 0
29 while (($# > 0)); do
30 case "${1%%=*}" in
31 --prefix) read_arg prefix "$@" || shift;;
32 --libdir) read_arg libdir "$@" || shift;;
33 --datadir) read_arg datadir "$@" || shift;;
34 --sysconfdir) read_arg sysconfdir "$@" || shift;;
35 --sbindir) read_arg sbindir "$@" || shift;;
36 --mandir) read_arg mandir "$@" || shift;;
37 --disable-documentation) enable_documentation=no;;
38 --program-prefix) read_arg programprefix "$@" || shift;;
39 --exec-prefix) read_arg execprefix "$@" || shift;;
40 --bindir) read_arg bindir "$@" || shift;;
41 --includedir) read_arg includedir "$@" || shift;;
42 --libexecdir) read_arg libexecdir "$@" || shift;;
43 --localstatedir) read_arg localstatedir "$@" || shift;;
44 --sharedstatedir) read_arg sharedstatedir "$@" || shift;;
45 --infodir) read_arg infodir "$@" || shift;;
46 --systemdsystemunitdir) read_arg systemdsystemunitdir "$@" || shift;;
47 --bashcompletiondir) read_arg bashcompletiondir "$@" || shift;;
48 *) echo "Ignoring unknown option '$1'";;
49 esac
50 shift
51 done
53 cat > Makefile.inc.$$ <<EOF
54 prefix ?= ${prefix}
55 libdir ?= ${libdir:-${prefix}/lib}
56 datadir ?= ${datadir:-${prefix}/share}
57 sysconfdir ?= ${sysconfdir:-${prefix}/etc}
58 sbindir ?= ${sbindir:-${prefix}/sbin}
59 mandir ?= ${mandir:-${prefix}/share/man}
60 enable_documentation ?= ${enable_documentation:-yes}
61 bindir ?= ${bindir:-${prefix}/bin}
62 EOF
65 [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
66 [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
67 [[ $includedir ]] && echo "includedir ?= ${includedir}"
68 [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
69 [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
70 [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
71 [[ $infodir ]] && echo "infodir ?= ${infodir}"
72 [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
73 [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
74 } >> Makefile.inc.$$
76 mv Makefile.inc.$$ Makefile.inc