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 "$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
68 ${CC} $CFLAGS $LDFLAGS conftest.c
>/dev
/null
2>&1
70 rm -f conftest.c a.out
72 # musl doesn't have fts.h included
73 if test $ret -ne 0; then
74 echo "dracut needs fts development files." >&2
87 for lib
in "-lc" "-lfts"; do
88 ${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c
>/dev
/null
2>&1
90 if test $ret -eq 0; then
96 rm -f conftest.c a.out
98 if test $found = no
; then
99 echo "dracut couldn't find usable fts library" >&2
103 cat > Makefile.inc.$$
<<EOF
105 libdir ?= ${libdir:-${prefix}/lib}
106 datadir ?= ${datadir:-${prefix}/share}
107 sysconfdir ?= ${sysconfdir:-${prefix}/etc}
108 sbindir ?= ${sbindir:-${prefix}/sbin}
109 mandir ?= ${mandir:-${prefix}/share/man}
110 enable_documentation ?= ${enable_documentation:-yes}
111 bindir ?= ${bindir:-${prefix}/bin}
112 KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
113 KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
114 FTS_LIBS ?= ${FTS_LIBS}
118 [[ $programprefix ]] && echo "programprefix ?= ${programprefix}"
119 [[ $execprefix ]] && echo "execprefix ?= ${execprefix}"
120 [[ $includedir ]] && echo "includedir ?= ${includedir}"
121 [[ $libexecdir ]] && echo "libexecdir ?= ${libexecdir}"
122 [[ $localstatedir ]] && echo "localstatedir ?= ${localstatedir}"
123 [[ $sharedstatedir ]] && echo "sharedstatedir ?= ${sharedstatedir}"
124 [[ $infodir ]] && echo "infodir ?= ${infodir}"
125 [[ $systemdsystemunitdir ]] && echo "systemdsystemunitdir ?= ${systemdsystemunitdir}"
126 [[ $bashcompletiondir ]] && echo "bashcompletiondir ?= ${bashcompletiondir}"
129 mv Makefile.inc.$$ Makefile.inc