]> git.ipfire.org Git - thirdparty/dracut.git/blob - configure
network-manager: remove useless use of basename
[thirdparty/dracut.git] / configure
1 #!/bin/bash
2
3 # We don't support srcdir != builddir
4 echo \#buildapi-variable-no-builddir >/dev/null
5
6 prefix=/usr
7
8 enable_documentation=yes
9
10 PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
11
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 return 0
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;;
39 --disable-documentation) enable_documentation=no;;
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;;
50 *) echo "Ignoring unknown option '$1'";;
51 esac
52 shift
53 done
54
55 if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
56 echo "dracut needs pkg-config and libkmod >= 23." >&2
57 exit 1
58 fi
59
60 cat > Makefile.inc.$$ <<EOF
61 prefix ?= ${prefix}
62 libdir ?= ${libdir:-${prefix}/lib}
63 datadir ?= ${datadir:-${prefix}/share}
64 sysconfdir ?= ${sysconfdir:-${prefix}/etc}
65 sbindir ?= ${sbindir:-${prefix}/sbin}
66 mandir ?= ${mandir:-${prefix}/share/man}
67 enable_documentation ?= ${enable_documentation:-yes}
68 bindir ?= ${bindir:-${prefix}/bin}
69 KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
70 KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
71 EOF
72
73 {
74 [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
75 [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
76 [[ $includedir ]] && echo "includedir ?= ${includedir}"
77 [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
78 [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
79 [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
80 [[ $infodir ]] && echo "infodir ?= ${infodir}"
81 [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
82 [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
83 } >> Makefile.inc.$$
84
85 mv Makefile.inc.$$ Makefile.inc