]> git.ipfire.org Git - thirdparty/dracut.git/blobdiff - configure
Revert "github workflow"
[thirdparty/dracut.git] / configure
index 0bd3d2dc23a8fda72188ddf73b295bba9f8eece8..3f724ef220df6a9238eb76ccb3ce00fb19ca7fc3 100755 (executable)
--- a/configure
+++ b/configure
@@ -7,6 +7,9 @@ prefix=/usr
 
 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.
@@ -50,6 +53,53 @@ while (($# > 0)); do
     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}
@@ -59,6 +109,9 @@ sbindir ?= ${sbindir:-${prefix}/sbin}
 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
 
 {