It turns out that all we need from gnulib @ 253f29d8b391 is xstrtoull(),
ignore_value(), and assure(), when building on Fedora 35 anyway.
Constructing this patch must be the most arbitrary "programming"
I've ever
done. It started with capturing the output of "gnulib-tool" (invoked
through "autogen.sh" -> "bootstrap"), then trimming it as
much as
possible, guided by libguestfs commit 0f54df53d26e ("build: Remove
gnulib.", 2021-04-08), then filling in any new gaps.
(The "manywarnings" functionality falls victim to this patch as well
-- if
that change was good enough for libguestfs, then so should it be for
virt-p2v.)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1945835
Suggested-by: Richard W.M. Jones <rjones at redhat.com>
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
configure.ac | 14 +-
Makefile.am | 8 +-
gnulib/lib/Makefile.am | 32 +++
gnulib/lib/assure.h | 37 +++
gnulib/lib/ignore-value.h | 50 +++++
gnulib/lib/xstrtol.h | 53 +++++
gnulib/lib/xstrtol.c | 237 ++++++++++++++++++++
gnulib/lib/xstrtoull.c | 6 +
.gitignore | 12 +-
.gitmodules | 3 -
.gnulib | 1 -
autogen.sh | 50 -----
bootstrap | 122 ----------
docs/p2v-building.pod | 8 +-
docs/p2v-hacking.pod | 5 -
m4/p2v-c.m4 | 98 ++------
m4/p2v-tests.m4 | 10 -
17 files changed, 446 insertions(+), 300 deletions(-)
diff --git a/configure.ac b/configure.ac
index 5486e47b7a1f..cbafcb4cb986 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,9 @@ AM_SILENT_RULES([yes]) # make --enable-silent-rules the
default.
AC_CONFIG_MACRO_DIR([m4])
+dnl Initialize libtool.
+LT_INIT
+
dnl Extra string, a freeform string defined by packagers.
AC_ARG_WITH([extra],
[AS_HELP_STRING([--with-extra],
@@ -59,11 +62,6 @@
PACKAGE_VERSION_FULL="p2v_major.p2v_minor.p2v_release${p2v_extra}"
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_FULL],["$PACKAGE_VERSION_FULL"],[Full
version string.])
AC_SUBST([PACKAGE_VERSION_FULL])
-dnl Early gnulib initialization.
-HEADING([Configuring Gnulib])
-gl_EARLY
-gl_INIT
-
dnl Check for external programs required to either build or run
dnl virt-p2v.
HEADING([Checking for external programs])
@@ -105,10 +103,12 @@ AC_CONFIG_FILES([run],
AC_CONFIG_FILES([Makefile
bash/Makefile
docs/Makefile
- gnulib/lib/Makefile
- gnulib/tests/Makefile])
+ gnulib/lib/Makefile])
AC_CONFIG_COMMANDS([p2v-config.h],
[${ac_srcdir}/generate-p2v-config.pl --file=p2v-config.h
--output=p2v-config.h])
+dnl gnulib embedding hacks
+AC_TYPE_LONG_LONG_INT
+
AC_OUTPUT
diff --git a/Makefile.am b/Makefile.am
index cc864636f039..a5742b0dc5d3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,10 +19,6 @@ include $(top_srcdir)/subdir-rules.mk
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = gnulib/lib
-if ENABLE_GNULIB_TESTS
-SUBDIRS += gnulib/tests
-endif
-
SUBDIRS += docs
# bash-completion
@@ -32,8 +28,6 @@ EXTRA_DIST = \
$(BUILT_SOURCES) \
$(TESTS) $(LIBGUESTFS_TESTS) $(SLOW_TESTS) \
AUTHORS \
- autogen.sh \
- bootstrap \
contrib/aux-scripts/do-build.sh \
contrib/build-p2v-iso.sh \
contrib/patches/0001-RHEL-5-ONLY-DISABLE-AUTOMATIC-REMOTE-PORT-ALLOCATION.patch
\
@@ -155,7 +149,7 @@ virt_p2v_LDADD = \
$(LIBXML2_LIBS) \
$(GTK_LIBS) \
$(DBUS_LIBS) \
- gnulib/lib/libgnu.a \
+ gnulib/lib/libgnu.la \
-lm
$(generated_sources) virt-p2v-kernel-config.pod:
$(srcdir)/generate-p2v-config.pl
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
new file mode 100644
index 000000000000..787fa350345a
--- /dev/null
+++ b/gnulib/lib/Makefile.am
@@ -0,0 +1,32 @@
+# libguestfs
+# Copyright (C) 2017-2022 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+# This directory contains some dependencies originally from gnulib.
+# The aim is for everything in this directory to eventually go away.
+
+include $(top_srcdir)/subdir-rules.mk
+
+noinst_LTLIBRARIES = libgnu.la
+libgnu_la_SOURCES = \
+ assure.h \
+ ignore-value.h \
+ xstrtol.c \
+ xstrtol.h \
+ xstrtoull.c
+libgnu_la_CFLAGS = \
+ $(WARN_CFLAGS) $(WERROR_CFLAGS) \
+ $(GCC_VISIBILITY_HIDDEN)
diff --git a/gnulib/lib/assure.h b/gnulib/lib/assure.h
new file mode 100644
index 000000000000..c21b6a6b806f
--- /dev/null
+++ b/gnulib/lib/assure.h
@@ -0,0 +1,37 @@
+/* Run-time assert-like macros.
+
+ Copyright (C) 2014-2019 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
+/* Written by Paul Eggert. */
+
+#ifndef _GL_ASSURE_H
+#define _GL_ASSURE_H
+
+#include <assert.h>
+
+/* Check E's value at runtime, and report an error and abort if not.
+ However, do nothing if NDEBUG is defined.
+
+ Unlike standard 'assert', this macro always compiles E even when
NDEBUG
+ is defined, so as to catch typos and avoid some GCC warnings. */
+
+#ifdef NDEBUG
+# define assure(E) ((void) (0 && (E)))
+#else
+# define assure(E) assert (E)
+#endif
+
+#endif
diff --git a/gnulib/lib/ignore-value.h b/gnulib/lib/ignore-value.h
new file mode 100644
index 000000000000..7e3b4c1f0f7a
--- /dev/null
+++ b/gnulib/lib/ignore-value.h
@@ -0,0 +1,50 @@
+/* ignore a function return without a compiler warning. -*- coding: utf-8 -*-
+
+ Copyright (C) 2008-2019 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
+/* Written by Jim Meyering, Eric Blake and P?draig Brady. */
+
+/* Use "ignore_value" to avoid a warning when using a function
declared with
+ gcc's warn_unused_result attribute, but for which you really do want to
+ ignore the result. Traditionally, people have used a "(void)"
cast to
+ indicate that a function's return value is deliberately unused.
However,
+ if the function is declared with __attribute__((warn_unused_result)),
+ gcc issues a warning even with the cast.
+
+ Caution: most of the time, you really should heed gcc's warning, and
+ check the return value. However, in those exceptional cases in which
+ you're sure you know what you're doing, use this function.
+
+ For the record, here's one of the ignorable warnings:
+ "copy.c:233: warning: ignoring return value of 'fchown',
+ declared with attribute warn_unused_result". */
+
+#ifndef _GL_IGNORE_VALUE_H
+#define _GL_IGNORE_VALUE_H
+
+/* Normally casting an expression to void discards its value, but GCC
+ versions 3.4 and newer have __attribute__ ((__warn_unused_result__))
+ which may cause unwanted diagnostics in that case. Use __typeof__
+ and __extension__ to work around the problem, if the workaround is
+ known to be needed. */
+#if 3 < __GNUC__ + (4 <= __GNUC_MINOR__)
+# define ignore_value(x) \
+ (__extension__ ({ __typeof__ (x) __x = (x); (void) __x; }))
+#else
+# define ignore_value(x) ((void) (x))
+#endif
+
+#endif
diff --git a/gnulib/lib/xstrtol.h b/gnulib/lib/xstrtol.h
new file mode 100644
index 000000000000..d888120e6bae
--- /dev/null
+++ b/gnulib/lib/xstrtol.h
@@ -0,0 +1,53 @@
+/* A more useful interface to strtol.
+
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2019 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
+#ifndef XSTRTOL_H_
+# define XSTRTOL_H_ 1
+
+# include <inttypes.h>
+
+# ifndef _STRTOL_ERROR
+enum strtol_error
+ {
+ LONGINT_OK = 0,
+
+ /* These two values can be ORed together, to indicate that both
+ errors occurred. */
+ LONGINT_OVERFLOW = 1,
+ LONGINT_INVALID_SUFFIX_CHAR = 2,
+
+ LONGINT_INVALID_SUFFIX_CHAR_WITH_OVERFLOW = (LONGINT_INVALID_SUFFIX_CHAR
+ | LONGINT_OVERFLOW),
+ LONGINT_INVALID = 4
+ };
+typedef enum strtol_error strtol_error;
+# endif
+
+# define _DECLARE_XSTRTOL(name, type) \
+ strtol_error name (const char *, char **, int, type *, const char *);
+_DECLARE_XSTRTOL (xstrtol, long int)
+_DECLARE_XSTRTOL (xstrtoul, unsigned long int)
+_DECLARE_XSTRTOL (xstrtoimax, intmax_t)
+_DECLARE_XSTRTOL (xstrtoumax, uintmax_t)
+
+#if HAVE_LONG_LONG_INT
+_DECLARE_XSTRTOL (xstrtoll, long long int)
+_DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
+#endif
+
+#endif /* not XSTRTOL_H_ */
diff --git a/gnulib/lib/xstrtol.c b/gnulib/lib/xstrtol.c
new file mode 100644
index 000000000000..ab73d0403f13
--- /dev/null
+++ b/gnulib/lib/xstrtol.c
@@ -0,0 +1,237 @@
+/* A more useful interface to strtol.
+
+ Copyright (C) 1995-1996, 1998-2001, 2003-2007, 2009-2019 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+
+/* Written by Jim Meyering. */
+
+#ifndef __strtol
+# define __strtol strtol
+# define __strtol_t long int
+# define __xstrtol xstrtol
+# define STRTOL_T_MINIMUM LONG_MIN
+# define STRTOL_T_MAXIMUM LONG_MAX
+#endif
+
+#include <config.h>
+
+#include "xstrtol.h"
+
+/* Some pre-ANSI implementations (e.g. SunOS 4)
+ need stderr defined if assertion checking is enabled. */
+#include <stdio.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "assure.h"
+
+#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
+
+static strtol_error
+bkm_scale (__strtol_t *x, int scale_factor)
+{
+ if (TYPE_SIGNED (__strtol_t) && *x < STRTOL_T_MINIMUM /
scale_factor)
+ {
+ *x = STRTOL_T_MINIMUM;
+ return LONGINT_OVERFLOW;
+ }
+ if (STRTOL_T_MAXIMUM / scale_factor < *x)
+ {
+ *x = STRTOL_T_MAXIMUM;
+ return LONGINT_OVERFLOW;
+ }
+ *x *= scale_factor;
+ return LONGINT_OK;
+}
+
+static strtol_error
+bkm_scale_by_power (__strtol_t *x, int base, int power)
+{
+ strtol_error err = LONGINT_OK;
+ while (power--)
+ err |= bkm_scale (x, base);
+ return err;
+}
+
+/* FIXME: comment. */
+
+strtol_error
+__xstrtol (const char *s, char **ptr, int strtol_base,
+ __strtol_t *val, const char *valid_suffixes)
+{
+ char *t_ptr;
+ char **p;
+ __strtol_t tmp;
+ strtol_error err = LONGINT_OK;
+
+ assure (0 <= strtol_base && strtol_base <= 36);
+
+ p = (ptr ? ptr : &t_ptr);
+
+ errno = 0;
+
+ if (! TYPE_SIGNED (__strtol_t))
+ {
+ const char *q = s;
+ unsigned char ch = *q;
+ while (isspace (ch))
+ ch = *++q;
+ if (ch == '-')
+ return LONGINT_INVALID;
+ }
+
+ tmp = __strtol (s, p, strtol_base);
+
+ if (*p == s)
+ {
+ /* If there is no number but there is a valid suffix, assume the
+ number is 1. The string is invalid otherwise. */
+ if (valid_suffixes && **p && strchr (valid_suffixes,
**p))
+ tmp = 1;
+ else
+ return LONGINT_INVALID;
+ }
+ else if (errno != 0)
+ {
+ if (errno != ERANGE)
+ return LONGINT_INVALID;
+ err = LONGINT_OVERFLOW;
+ }
+
+ /* Let valid_suffixes == NULL mean "allow any suffix". */
+ /* FIXME: update all callers except the ones that allow suffixes
+ after the number, changing last parameter NULL to "". */
+ if (!valid_suffixes)
+ {
+ *val = tmp;
+ return err;
+ }
+
+ if (**p != '\0')
+ {
+ int base = 1024;
+ int suffixes = 1;
+ strtol_error overflow;
+
+ if (!strchr (valid_suffixes, **p))
+ {
+ *val = tmp;
+ return err | LONGINT_INVALID_SUFFIX_CHAR;
+ }
+
+ switch (**p)
+ {
+ case 'E': case 'G': case 'g': case 'k':
case 'K': case 'M': case 'm':
+ case 'P': case 'T': case 't': case 'Y':
case 'Z':
+
+ /* The "valid suffix" '0' is a special flag meaning
that
+ an optional second suffix is allowed, which can change
+ the base. A suffix "B" (e.g. "100MB") stands
for a power
+ of 1000, whereas a suffix "iB" (e.g. "100MiB")
stands for
+ a power of 1024. If no suffix (e.g. "100M"), assume
+ power-of-1024. */
+
+ if (strchr (valid_suffixes, '0'))
+ switch (p[0][1])
+ {
+ case 'i':
+ if (p[0][2] == 'B')
+ suffixes += 2;
+ break;
+
+ case 'B':
+ case 'D': /* 'D' is obsolescent */
+ base = 1000;
+ suffixes++;
+ break;
+ }
+ }
+
+ switch (**p)
+ {
+ case 'b':
+ overflow = bkm_scale (&tmp, 512);
+ break;
+
+ case 'B':
+ /* This obsolescent first suffix is distinct from the 'B'
+ second suffix above. E.g., 'tar -L 1000B' means change
+ the tape after writing 1000 KiB of data. */
+ overflow = bkm_scale (&tmp, 1024);
+ break;
+
+ case 'c':
+ overflow = LONGINT_OK;
+ break;
+
+ case 'E': /* exa or exbi */
+ overflow = bkm_scale_by_power (&tmp, base, 6);
+ break;
+
+ case 'G': /* giga or gibi */
+ case 'g': /* 'g' is undocumented; for compatibility
only */
+ overflow = bkm_scale_by_power (&tmp, base, 3);
+ break;
+
+ case 'k': /* kilo */
+ case 'K': /* kibi */
+ overflow = bkm_scale_by_power (&tmp, base, 1);
+ break;
+
+ case 'M': /* mega or mebi */
+ case 'm': /* 'm' is undocumented; for compatibility
only */
+ overflow = bkm_scale_by_power (&tmp, base, 2);
+ break;
+
+ case 'P': /* peta or pebi */
+ overflow = bkm_scale_by_power (&tmp, base, 5);
+ break;
+
+ case 'T': /* tera or tebi */
+ case 't': /* 't' is undocumented; for compatibility
only */
+ overflow = bkm_scale_by_power (&tmp, base, 4);
+ break;
+
+ case 'w':
+ overflow = bkm_scale (&tmp, 2);
+ break;
+
+ case 'Y': /* yotta or 2**80 */
+ overflow = bkm_scale_by_power (&tmp, base, 8);
+ break;
+
+ case 'Z': /* zetta or 2**70 */
+ overflow = bkm_scale_by_power (&tmp, base, 7);
+ break;
+
+ default:
+ *val = tmp;
+ return err | LONGINT_INVALID_SUFFIX_CHAR;
+ }
+
+ err |= overflow;
+ *p += suffixes;
+ if (**p)
+ err |= LONGINT_INVALID_SUFFIX_CHAR;
+ }
+
+ *val = tmp;
+ return err;
+}
diff --git a/gnulib/lib/xstrtoull.c b/gnulib/lib/xstrtoull.c
new file mode 100644
index 000000000000..10dda504445c
--- /dev/null
+++ b/gnulib/lib/xstrtoull.c
@@ -0,0 +1,6 @@
+#define __strtol strtoull
+#define __strtol_t unsigned long long int
+#define __xstrtol xstrtoull
+#define STRTOL_T_MINIMUM 0
+#define STRTOL_T_MAXIMUM ULLONG_MAX
+#include "xstrtol.c"
diff --git a/.gitignore b/.gitignore
index 459c9a05ff9c..a870e2b6186b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
*~
+*.la
+*.lo
*.log
*.o
*.trs
@@ -8,7 +10,6 @@
Makefile
Makefile.in
-/.git-module-status
/about-authors.c
/aclocal.m4
/autom4te.cache/
@@ -32,10 +33,13 @@ Makefile.in
/docs/stamp-p2v-hacking.pod
/docs/stamp-p2v-release-notes.pod
/fedora.img
-/gnulib/
/kernel-config.c
-/m4/.gitignore
-/m4/gnulib-cache.m4
+/libtool
+/m4/libtool.m4
+/m4/lt~obsolete.m4
+/m4/ltoptions.m4
+/m4/ltsugar.m4
+/m4/ltversion.m4
/p2v-config.h
/podwrapper.pl
/run
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index f8d0cf321d35..000000000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "gnulib"]
- path = .gnulib
- url = https://git.savannah.gnu.org/git/gnulib.git
diff --git a/.gnulib b/.gnulib
deleted file mode 160000
index 253f29d8b391..000000000000
--- a/.gnulib
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 253f29d8b391ebe8cea50355eda351bb7962e160
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index f055ffcbc7cf..000000000000
--- a/autogen.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash -
-# libguestfs
-# Copyright (C) 2009 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-# Rebuild the autotools environment.
-
-set -e
-set -v
-
-# Ensure that whenever we pull in a gnulib update or otherwise change to a
-# different version (i.e., when switching branches), we also rerun ./bootstrap.
-curr_status=.git-module-status
-t=$(git submodule status|sed 's/^[ +-]//;s/ .*//')
-if test "$t" = "$(cat $curr_status 2>/dev/null)"; then
- : # good, it's up to date
-else
- echo running bootstrap...
- ./bootstrap && echo "$t" > $curr_status
-fi
-
-CONFIGUREDIR=.
-
-# Run configure in BUILDDIR if it's set
-if [ ! -z "$BUILDDIR" ]; then
- mkdir -p $BUILDDIR
- cd $BUILDDIR
-
- CONFIGUREDIR=..
-fi
-
-# If no arguments were specified and configure has run before, use the previous
-# arguments
-if test $# -eq 0 && test -x ./config.status; then
- ./config.status --recheck
-else
- $CONFIGUREDIR/configure "$@"
-fi
diff --git a/bootstrap b/bootstrap
deleted file mode 100755
index 565d50450c96..000000000000
--- a/bootstrap
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-
-usage() {
- echo >&2 "\
-Usage: $0 [OPTION]...
-Bootstrap this package from the checked-out sources.
-
-Options:
- --gnulib-srcdir=DIRNAME specify the local directory where gnulib
- sources reside. Use this if you already
- have gnulib sources on your machine, and
- do not want to waste your bandwidth downloading
- them again. Defaults to \$GNULIB_SRCDIR
-"
-}
-
-for option
-do
- case $option in
- --help)
- usage
- exit;;
- --gnulib-srcdir=*)
- GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
- *)
- echo >&2 "$0: $option: unknown option"
- exit 1;;
- esac
-done
-
-cleanup_gnulib() {
- status=$?
- rm -fr "$gnulib_path"
- exit $status
-}
-
-git_modules_config () {
- test -f .gitmodules && git config --file .gitmodules "$@"
-}
-
-gnulib_path=$(git_modules_config submodule.gnulib.path)
-test -z "$gnulib_path" && gnulib_path=gnulib
-
-# Get gnulib files. Populate $GNULIB_SRCDIR, possibly updating a
-# submodule, for use in the rest of the script.
-
-case ${GNULIB_SRCDIR--} in
--)
- if git_modules_config submodule.gnulib.url >/dev/null; then
- echo "$0: getting gnulib files..."
- git submodule init -- "$gnulib_path" || exit $?
- git submodule update -- "$gnulib_path" || exit $?
-
- elif [ ! -d "$gnulib_path" ]; then
- echo "$0: getting gnulib files..."
-
- trap cleanup_gnulib 1 2 13 15
-
- shallow- git clone -h 2>&1 | grep -- --depth > /dev/null
&& shallow='--depth 2'
- git clone $shallow git://git.sv.gnu.org/gnulib "$gnulib_path" ||
- cleanup_gnulib
-
- trap - 1 2 13 15
- fi
- GNULIB_SRCDIR=$gnulib_path
- ;;
-*)
- # Use GNULIB_SRCDIR directly or as a reference.
- if test -d "$GNULIB_SRCDIR"/.git && \
- git_modules_config submodule.gnulib.url >/dev/null; then
- echo "$0: getting gnulib files..."
- if git submodule -h|grep -- --reference > /dev/null; then
- # Prefer the one-liner available in git 1.6.4 or newer.
- git submodule update --init --reference "$GNULIB_SRCDIR" \
- "$gnulib_path" || exit $?
- else
- # This fallback allows at least git 1.5.5.
- if test -f "$gnulib_path"/gnulib-tool; then
- # Since file already exists, assume submodule init already complete.
- git submodule update -- "$gnulib_path" || exit $?
- else
- # Older git can't clone into an empty directory.
- rmdir "$gnulib_path" 2>/dev/null
- git clone --reference "$GNULIB_SRCDIR" \
- "$(git_modules_config submodule.gnulib.url)"
"$gnulib_path" \
- && git submodule init -- "$gnulib_path" \
- && git submodule update -- "$gnulib_path" \
- || exit $?
- fi
- fi
- GNULIB_SRCDIR=$gnulib_path
- fi
- ;;
-esac
-
-gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
-<$gnulib_tool || exit
-
-modules='
-error
-ignore-value
-manywarnings
-ptsname_r
-sys_types
-xstrtoll
-'
-
-# If any tests fail, avoid including them by adding them to
-# this list.
-avoid=""
-
-$gnulib_tool \
- $avoid \
- --with-tests \
- --m4-base=m4 \
- --source-base=gnulib/lib \
- --tests-base=gnulib/tests \
- --import $modules
-
-# Disable autopoint, since it was already done above.
-AUTOPOINT=true autoreconf --verbose --install
diff --git a/docs/p2v-building.pod b/docs/p2v-building.pod
index 0e3df94b4a1a..f249f742554a 100644
--- a/docs/p2v-building.pod
+++ b/docs/p2v-building.pod
@@ -119,7 +119,8 @@ and C<automake> when building from git.
git clone https://github.com/libguestfs/virt-p2v
cd virt-p2v
- ./autogen.sh
+ autoreconf -i
+ ./configure
make
=head1 BUILDING FROM TARBALLS
@@ -184,11 +185,6 @@ ones.
=over 4
-=item B<--disable-gnulib-tests>
-
-On some platforms the GNUlib test suite can be flaky. This disables
-it, since errors in the GNUlib test suite are often not important.
-
=item B<--enable-werror>
This turns compiler warnings into errors (ie. C<-Werror>). Use this
diff --git a/docs/p2v-hacking.pod b/docs/p2v-hacking.pod
index cdc6c89eb16c..2c0a14c093a3 100644
--- a/docs/p2v-hacking.pod
+++ b/docs/p2v-hacking.pod
@@ -52,11 +52,6 @@ Outside contributions, experimental parts.
Miscellaneous manual pages.
-=item F<gnulib>
-
-Gnulib is used as a portability library. A copy of gnulib is included
-under here.
-
=item F<libguestfs>
Some sources (mostly with utilities) copied from libguestfs. Changes
diff --git a/m4/p2v-c.m4 b/m4/p2v-c.m4
index 772e48d67d5a..bbf48625ae05 100644
--- a/m4/p2v-c.m4
+++ b/m4/p2v-c.m4
@@ -23,99 +23,27 @@ AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_CPP
+AC_C_PROTOTYPES
+test "x$U" != "x" && AC_MSG_ERROR([Compiler not
ANSI compliant])
+
+AM_PROG_CC_C_O
+
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],
- [turn GCC warnings into errors (for developers)])],
+ [turn on lots of GCC warnings (for developers)])],
[case $enableval in
yes|no) ;;
*) AC_MSG_ERROR([bad value $enableval for werror option]) ;;
esac
- gl_gcc_werror=$enableval],
- [gl_gcc_werror=no]
+ gcc_warnings=$enableval],
+ [gcc_warnings=no]
)
-
-if test "$gl_gcc_werror" = yes; then
- gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
- AC_SUBST([WERROR_CFLAGS])
-fi
-
-dnl This, $nw, is the list of warnings we disable.
-nw-nw="$nw -Waggregate-return" # anachronistic
-nw="$nw -Wundef" # Warns on '#if
GNULIB_FOO' etc in gnulib
-nw="$nw -Wtraditional" # Warns on #elif which we use
often
-nw="$nw -Wsystem-headers" # Don't let system headers
trigger warnings
-nw="$nw -Wpadded" # Our structs are not padded
-nw="$nw -Wvla" # Allow variable length arrays.
-nw="$nw -Wvla-larger-than=4031"
-nw="$nw -Winline" # inline functions in Python
binding
-nw="$nw -Wshadow" # Not useful, as it applies to
global vars
-nw="$nw -Wunsafe-loop-optimizations" # just a warning that an
optimization
- # was not possible, safe to ignore
-nw="$nw -Wstack-protector" # Useless warning when stack
protector
- # cannot being used in a function.
-nw="$nw -Wcast-align" # Useless warning on arm >=
7, intel
-nw="$nw -Wabi" # Broken in GCC 8.1.
-dnl things I might fix soon:
-nw="$nw -Wpacked" # Allow attribute((packed)) on
structs
-nw="$nw -Wlong-long" # Allow long long since it's
required
- # by Python, Ruby and xstrtoll.
-nw="$nw -Wsuggest-attribute=pure" # Don't suggest pure
functions.
-nw="$nw -Wsuggest-attribute=const" # Don't suggest const
functions.
-nw="$nw -Wsuggest-attribute=malloc" # Don't suggest malloc
functions.
-nw="$nw -Wunsuffixed-float-constants" # Don't care about these.
-nw="$nw -Wswitch-default" # This warning is actively
dangerous.
-nw="$nw -Woverlength-strings" # Who cares about stupid ISO C99
limit.
-
-gl_MANYWARN_ALL_GCC([ws])
-gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
-for w in $ws; do
- gl_WARN_ADD([$w])
-done
-
-dnl Normally we disable warnings in $nw above. However $nw only
-dnl filters out exact matching warning strings from a list inside
-dnl gnulib (see m4/manywarnings.m4). So we need to explicitly list a
-dnl few disabled warnings below.
-
-dnl Unused parameters are not a bug.
-gl_WARN_ADD([-Wno-unused-parameter])
-
-dnl Missing field initializers is not a bug in C.
-gl_WARN_ADD([-Wno-missing-field-initializers])
-
-dnl Display the name of the warning option with the warning.
-gl_WARN_ADD([-fdiagnostics-show-option])
-
-dnl Now some warnings we want to enable and/or customize ...
-
-dnl Warn about large stack frames. This does not include alloca and
-dnl variable length arrays. Coverity warns about 10000 byte frames.
-gl_WARN_ADD([-Wframe-larger-than=5000])
-
-dnl Warn about large stack frames, including estimates for alloca
-dnl and variable length arrays.
-dnl gl_WARN_ADD([-Wstack-usage=10000])
-
-dnl Warn about implicit fallthrough in case statements, but suppress
-dnl the warning if /*FALLTHROUGH*/ comment is used.
-gl_WARN_ADD([-Wimplicit-fallthrough=4])
-
-dnl GCC level 2 gives incorrect warnings, so use level 1.
-gl_WARN_ADD([-Wformat-truncation=1])
-
-dnl GCC 9 at level 2 gives apparently bogus errors when %.*s is used.
-gl_WARN_ADD([-Wformat-overflow=1])
-
+WARN_CFLAGS="-Wall"
AC_SUBST([WARN_CFLAGS])
-
-AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
-AC_DEFINE([GNULIB_PORTCHECK], [1], [Enable some gnulib portability checks.])
-
-AC_C_PROTOTYPES
-test "x$U" != "x" && AC_MSG_ERROR([Compiler not
ANSI compliant])
-
-AM_PROG_CC_C_O
+if test "x$gcc_warnings" = "xyes"; then
+ WERROR_CFLAGS="-Werror"
+fi
+AC_SUBST([WERROR_CFLAGS])
# Provide a global place to set CFLAGS. (Note that setting AM_CFLAGS
# is no use because it doesn't override target_CFLAGS).
diff --git a/m4/p2v-tests.m4 b/m4/p2v-tests.m4
index 9b4a77fb22cb..291755af4156 100644
--- a/m4/p2v-tests.m4
+++ b/m4/p2v-tests.m4
@@ -14,16 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
-dnl Should we run the gnulib tests?
-AC_MSG_CHECKING([if we should run the GNUlib tests])
-AC_ARG_ENABLE([gnulib-tests],
- [AS_HELP_STRING([--disable-gnulib-tests],
- [disable running GNU Portability library tests
@<:@default=yes@:>@])],
- [ENABLE_GNULIB_TESTS="$enableval"],
- [ENABLE_GNULIB_TESTS=yes])
-AM_CONDITIONAL([ENABLE_GNULIB_TESTS],[test "x$ENABLE_GNULIB_TESTS" =
"xyes"])
-AC_MSG_RESULT([$ENABLE_GNULIB_TESTS])
-
dnl Check libguestfs tools.
AC_CHECK_PROG([GUESTFISH],[guestfish],[guestfish],[no])
AC_CHECK_PROG([VIRT_BUILDER],[virt-builder],[virt-builder],[no])
base-commit: 442cd286614fc4975d6956a8c7cce7edf63375d0
--
2.19.1.3.g30247aa5d201