3 # We don't support srcdir != builddir
4 echo \
#buildapi-variable-no-builddir > /dev/null
8 enable_documentation
=yes
11 PKG_CONFIG
="${PKG_CONFIG:-pkg-config}"
13 # Little helper function for reading args from the commandline.
14 # it automatically handles -a b and -a=b variants, and returns 1 if
15 # we need to shift $3.
20 local rematch
='^[^=]*=(.*)$'
21 if [[ $2 =~
$rematch ]]; then
22 read -r "$1" <<< "${BASH_REMATCH[1]}"
25 # There is no way to shift our callers args, so
26 # return 1 to indicate they should do it instead.
34 --prefix) read_arg prefix
"$@" ||
shift ;;
35 --libdir) read_arg libdir
"$@" ||
shift ;;
36 --datadir) read_arg datadir
"$@" ||
shift ;;
37 --sysconfdir) read_arg sysconfdir
"$@" ||
shift ;;
38 --sbindir) read_arg sbindir
"$@" ||
shift ;;
39 --mandir) read_arg mandir
"$@" ||
shift ;;
40 --disable-documentation) enable_documentation
=no
;;
41 --program-prefix) read_arg programprefix
"$@" ||
shift ;;
42 --exec-prefix) read_arg execprefix
"$@" ||
shift ;;
43 --bindir) read_arg bindir
"$@" ||
shift ;;
44 --includedir) read_arg includedir
"$@" ||
shift ;;
45 --libexecdir) read_arg libexecdir
"$@" ||
shift ;;
46 --localstatedir) read_arg localstatedir
"$@" ||
shift ;;
47 --sharedstatedir) read_arg sharedstatedir
"$@" ||
shift ;;
48 --infodir) read_arg infodir
"$@" ||
shift ;;
49 --systemdsystemunitdir) read_arg systemdsystemunitdir
"$@" ||
shift ;;
50 --bashcompletiondir) read_arg bashcompletiondir
"$@" ||
shift ;;
51 *) echo "Ignoring unknown option '$1'" ;;
56 if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
57 echo "dracut needs pkg-config and libkmod >= 23." >&2
61 cat << EOF > conftest.c
68 # shellcheck disable=SC2086
69 ${CC} $CFLAGS $LDFLAGS conftest.c
> /dev
/null
2>&1
71 rm -f conftest.c a.out
73 # musl doesn't have fts.h included
74 if test $ret -ne 0; then
75 echo "dracut needs fts development files." >&2
79 cat << EOF > conftest.c
88 for lib
in "-lc" "-lfts"; do
89 # shellcheck disable=SC2086
90 ${CC} $CFLAGS $LDFLAGS conftest.c
-Wl,$lib > /dev
/null
2>&1
92 if test $ret -eq 0; then
98 rm -f conftest.c a.out
100 if test $found = no
; then
101 echo "dracut couldn't find usable fts library" >&2
105 cat > Makefile.inc.$$
<< EOF
107 libdir ?= ${libdir:-${prefix}/lib}
108 datadir ?= ${datadir:-${prefix}/share}
109 sysconfdir ?= ${sysconfdir:-${prefix}/etc}
110 sbindir ?= ${sbindir:-${prefix}/sbin}
111 mandir ?= ${mandir:-${prefix}/share/man}
112 enable_documentation ?= ${enable_documentation:-yes}
113 bindir ?= ${bindir:-${prefix}/bin}
114 KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
115 KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
116 FTS_LIBS ?= ${FTS_LIBS}
120 [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
121 [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
122 [[ $includedir ]] && echo "includedir ?= ${includedir}"
123 [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
124 [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
125 [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
126 [[ $infodir ]] && echo "infodir ?= ${infodir}"
127 [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
128 [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
131 mv Makefile.inc.$$ Makefile.inc