Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add libarchive support for mke2fs #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion MCONFIG.in
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ CFLAGS = @CFLAGS@
CFLAGS_SHLIB = @CFLAGS_SHLIB@
CFLAGS_STLIB = @CFLAGS_STLIB@
CPPFLAGS = @INCLUDES@
ALL_CFLAGS = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS) $(PTHREAD_CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
ARCHIVE_CFLAGS = @ARCHIVE_CFLAGS@
ALL_CFLAGS = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS) $(PTHREAD_CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS) $(ARCHIVE_CFLAGS)
ALL_CFLAGS_SHLIB = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS_SHLIB) $(PTHREAD_CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
ALL_CFLAGS_STLIB = $(CPPFLAGS) $(SANITIZER_CFLAGS) $(CFLAGS_STLIB) $(PTHREAD_CFLAGS) $(CFLAGS_WARN) @DEFS@ $(LOCAL_CFLAGS)
LDFLAGS = $(SANITIZER_LDFLAGS) $(PTHREAD_CFLAGS) @LDFLAGS@
Expand Down Expand Up @@ -140,6 +141,7 @@ LIBFUSE = @FUSE_LIB@
LIBSUPPORT = $(LIBINTL) $(LIB)/libsupport@STATIC_LIB_EXT@
LIBBLKID = @LIBBLKID@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
LIBINTL = @LIBINTL@
ARCHIVE_LIBS = @ARCHIVE_LIBS@
SYSLIBS = @LIBS@ @PTHREAD_LIBS@
DEPLIBSS = $(LIB)/libss@LIB_EXT@
DEPLIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@
Expand Down
83 changes: 83 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,9 @@ IMAGER_CMT
DEBUGFS_CMT
SUBSET_CMT
ALL_CMT
HAVE_ARCHIVE
ARCHIVE_LIBS
ARCHIVE_CFLAGS
BLKID_CMT
DEPPROFILED_LIBBLKID
PROFILED_LIBBLKID
Expand Down Expand Up @@ -911,6 +914,8 @@ CPP
PKG_CONFIG
PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
ARCHIVE_CFLAGS
ARCHIVE_LIBS
udev_CFLAGS
udev_LIBS
systemd_CFLAGS
Expand Down Expand Up @@ -1620,6 +1625,10 @@ Some influential environment variables:
directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR
path overriding pkg-config's built-in search path
ARCHIVE_CFLAGS
C compiler flags for ARCHIVE, overriding pkg-config
ARCHIVE_LIBS
linker flags for ARCHIVE, overriding pkg-config
udev_CFLAGS C compiler flags for udev, overriding pkg-config
udev_LIBS linker flags for udev, overriding pkg-config
systemd_CFLAGS
Expand Down Expand Up @@ -5693,6 +5702,80 @@ fi




pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libarchive" >&5
$as_echo_n "checking for libarchive... " >&6; }

if test -n "$ARCHIVE_CFLAGS"; then
pkg_cv_ARCHIVE_CFLAGS="$ARCHIVE_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libarchive\""; } >&5
($PKG_CONFIG --exists --print-errors "libarchive") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARCHIVE_CFLAGS=`$PKG_CONFIG --cflags "libarchive" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$ARCHIVE_LIBS"; then
pkg_cv_ARCHIVE_LIBS="$ARCHIVE_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libarchive\""; } >&5
($PKG_CONFIG --exists --print-errors "libarchive") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_ARCHIVE_LIBS=`$PKG_CONFIG --libs "libarchive" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi



if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }

if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
ARCHIVE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libarchive" 2>&1`
else
ARCHIVE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libarchive" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$ARCHIVE_PKG_ERRORS" >&5

HAVE_ARCHIVE=no
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
HAVE_ARCHIVE=no
else
ARCHIVE_CFLAGS=$pkg_cv_ARCHIVE_CFLAGS
ARCHIVE_LIBS=$pkg_cv_ARCHIVE_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
HAVE_ARCHIVE=yes
fi



ALL_CMT=
SUBSET_CMT=
# Check whether --enable-subset was given.
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,13 @@ AC_SUBST(PROFILED_LIBBLKID)
AC_SUBST(DEPPROFILED_LIBBLKID)
AC_SUBST(BLKID_CMT)
dnl
dnl
dnl
PKG_CHECK_MODULES([ARCHIVE], [libarchive], HAVE_ARCHIVE=yes, HAVE_ARCHIVE=no)
AC_SUBST(ARCHIVE_LIBS)
AC_SUBST(ARCHIVE_CFLAGS)
AC_SUBST(HAVE_ARCHIVE)
dnl
dnl handle --enable-subset
dnl
ALL_CMT=
Expand Down
2 changes: 1 addition & 1 deletion debugfs/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SRCS= debug_cmds.c $(srcdir)/debugfs.c $(srcdir)/util.c $(srcdir)/ls.c \
$(srcdir)/../e2fsck/recovery.c $(srcdir)/do_journal.c

LIBS= $(LIBSUPPORT) $(LIBEXT2FS) $(LIBE2P) $(LIBSS) $(LIBCOM_ERR) $(LIBBLKID) \
$(LIBUUID) $(LIBMAGIC) $(SYSLIBS)
$(LIBUUID) $(LIBMAGIC) $(SYSLIBS) $(ARCHIVE_LIBS)
DEPLIBS= $(DEPLIBSUPPORT) $(LIBEXT2FS) $(LIBE2P) $(DEPLIBSS) $(DEPLIBCOM_ERR) \
$(DEPLIBBLKID) $(DEPLIBUUID)

Expand Down
6 changes: 3 additions & 3 deletions misc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -281,23 +281,23 @@ mke2fs: $(MKE2FS_OBJS) $(DEPLIBS) $(LIBE2P) $(DEPLIBBLKID) $(DEPLIBUUID) \
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS) $(LIBBLKID) \
$(LIBUUID) $(LIBEXT2FS) $(LIBE2P) $(LIBINTL) \
$(SYSLIBS) $(LIBMAGIC)
$(SYSLIBS) $(LIBMAGIC) $(ARCHIVE_LIBS)

mke2fs.static: $(MKE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBUUID) \
$(DEPSTATIC_LIBBLKID)
$(E) " LD $@"
$(Q) $(CC) $(LDFLAGS_STATIC) -o mke2fs.static $(MKE2FS_OBJS) \
$(STATIC_LIBS) $(STATIC_LIBE2P) \
$(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(LIBINTL) $(SYSLIBS) \
$(LIBMAGIC)
$(LIBMAGIC) $(ARCHIVE_LIBS)

mke2fs.profiled: $(MKE2FS_OBJS) $(PROFILED_DEPLIBS) \
$(PROFILED_LIBE2P) $(PROFILED_DEPLIBBLKID) $(PROFILED_DEPLIBUUID)
$(E) " LD $@"
$(Q) $(CC) $(ALL_LDFLAGS) -g -pg -o mke2fs.profiled \
$(PROFILED_MKE2FS_OBJS) $(PROFILED_LIBBLKID) \
$(PROFILED_LIBUUID) $(PROFILED_LIBE2P) \
$(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS) $(LIBMAGIC)
$(LIBINTL) $(PROFILED_LIBS) $(SYSLIBS) $(LIBMAGIC) $(ARCHIVE_LIBS)

chattr: $(CHATTR_OBJS) $(DEPLIBS_E2P)
$(E) " LD $@"
Expand Down
Loading