From d226b908c5974815e70289b51f173a807dea5e2c Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 18 Jun 2019 00:55:08 -0400 Subject: configure.ac, config.sh.in: Check for tar with options --- diff --git a/NEWS b/NEWS index 2ef5f22..813d67e 100644 --- a/NEWS +++ b/NEWS @@ -37,8 +37,9 @@ libopkbuild: Build system: - * configure now checks for fakeroot and touch (preferably with the - "-h" option). + * configure now checks for fakeroot, touch (preferably with the "-h" + option), and tar (with the "-T", "--no-recursion", and + "--numeric-owner" options). Documentation: diff --git a/config.sh.in b/config.sh.in index ec3d34d..6ef78ca 100644 --- a/config.sh.in +++ b/config.sh.in @@ -3,4 +3,5 @@ PACKAGE_NAME='@PACKAGE_NAME@' FAKEROOT='@FAKEROOT@' OPKG='@OPKG@' TOUCH='@TOUCH@' +TAR='@TAR@' HAVE_TOUCH_NODEREF='@HAVE_TOUCH_NODEREF@' diff --git a/configure.ac b/configure.ac index 49bf5b8..d43aaf2 100644 --- a/configure.ac +++ b/configure.ac @@ -150,6 +150,52 @@ else fi AC_ARG_WITH( + [tar], + [AS_HELP_STRING([--with-tar=PATH], [path to tar utility])], + [ + case "${withval}" in + 'yes'|'') + AC_MSG_ERROR( + [--with-tar requires an argument]) + ;; + 'no') + AC_MSG_ERROR([tar is required]) + ;; + *) + TAR="${withval}" + AC_SUBST([TAR]) + ;; + esac + ], + [ + AC_PATH_PROG([TAR], [tar]) + if test -z "${TAR}"; then + AC_MSG_ERROR([tar not found]) + fi + ] +) +AC_MSG_CHECKING([whether tar accepts -T, --no-recursion, and --numeric-owner]) +rm -Rf conftest.dir +mkdir conftest.dir +touch conftest.dir/foo conftest.dir/bar +if printf '%s\n' conftest.dir/ conftest.dir/foo | ${TAR} -cf conftest.tar \ + --no-recursion -T - --numeric-owner; then + if ${TAR} -tf conftest.tar | grep -Fq 'foo' && \ + ${TAR} -tf conftest.tar | grep -Fvq 'bar' + then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([tar with -T, --no-recursion, and --numeric-owner + is required]) + fi +else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([tar with -T, --no-recursion, and --numeric-owner is + required]) +fi + +AC_ARG_WITH( [metadata], [AS_HELP_STRING([--with-metadata=SYSTEM], [use SYSTEM metadata plugin @<:@default: proteanos@:>@])], -- cgit v0.9.1