enable_documentation=yes
+CC="${CC:-cc}"
+PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
+
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
shift
done
+if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
+ echo "dracut needs pkg-config and libkmod >= 23." >&2
+ exit 1
+fi
+
+cat <<EOF >conftest.c
+#include <fts.h>
+int main() {
+ return 0;
+}
+EOF
+
+${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
+ret=$?
+rm -f conftest.c a.out
+
+# musl doesn't have fts.h included
+if test $ret -ne 0; then
+ echo "dracut needs fts development files." >&2
+ exit 1
+fi
+
+cat <<EOF >conftest.c
+#include <fts.h>
+int main(void) {
+ fts_open(0, 0, 0);
+ return 0;
+}
+EOF
+
+found=no
+for lib in "-lc" "-lfts"; do
+ ${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1
+ ret=$?
+ if test $ret -eq 0; then
+ FTS_LIBS="$lib"
+ found=yes
+ break;
+ fi
+done
+rm -f conftest.c a.out
+
+if test $found = no; then
+ echo "dracut couldn't find usable fts library" >&2
+ exit 1
+fi
+
cat > Makefile.inc.$$ <<EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation:-yes}
bindir ?= ${bindir:-${prefix}/bin}
+KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
+KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
+FTS_LIBS ?= ${FTS_LIBS}
EOF
{