configure: find cflags and libs for fts on musl
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>master
parent
718aefda13
commit
62f27ee6f1
2
Makefile
2
Makefile
|
@ -62,7 +62,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||||
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||||||
|
|
||||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
|
||||||
|
|
||||||
logtee: logtee.c
|
logtee: logtee.c
|
||||||
$(CC) $(LDFLAGS) -o $@ $<
|
$(CC) $(LDFLAGS) -o $@ $<
|
||||||
|
|
|
@ -7,6 +7,7 @@ prefix=/usr
|
||||||
|
|
||||||
enable_documentation=yes
|
enable_documentation=yes
|
||||||
|
|
||||||
|
CC="${CC:-cc}"
|
||||||
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
|
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
|
||||||
|
|
||||||
# Little helper function for reading args from the commandline.
|
# Little helper function for reading args from the commandline.
|
||||||
|
@ -57,6 +58,48 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
cat > Makefile.inc.$$ <<EOF
|
||||||
prefix ?= ${prefix}
|
prefix ?= ${prefix}
|
||||||
libdir ?= ${libdir:-${prefix}/lib}
|
libdir ?= ${libdir:-${prefix}/lib}
|
||||||
|
@ -68,6 +111,7 @@ enable_documentation ?= ${enable_documentation:-yes}
|
||||||
bindir ?= ${bindir:-${prefix}/bin}
|
bindir ?= ${bindir:-${prefix}/bin}
|
||||||
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
|
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
|
||||||
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
|
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
|
||||||
|
FTS_LIBS ?= ${FTS_LIBS}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue