Commit Graph

43 Commits

Author SHA1 Message Date
Daniel P. Berrange
291f68b5da autogen.sh: tell user the correct make command
When autogen.sh finishes it helpfully prints

  "Now type 'make' to compile libvirt."

which is fine if on a host with GNU make, but on *BSD running
'make' will end in tears. We should tell users to run 'gmake'
on these platforms. If 'gmake' doesn't exist then we should
report an error too

  "GNU make is required to build libvirt"

Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2017-12-18 17:03:51 +00:00
Andrea Bolognani
6d53255377 autogen.sh: Improve and generalize
The goal is twofold: firstly, we want to extend the script so
that it can deal with more than a single git submodule, and
secondly we'd like to reduce the amount of duplicated code.
Moreover, since we're making heavy changes to the code anyway,
we might as well make sure it follows a somewhat consistent
coding style too.

To reduce code duplication, we introduce a new --dry-run
option, which can be used by third parties to figure out
whether calling autogen.sh is necessary or not: this allows
us to get rid of the reimplementation of part of the logic
in cfg.mk and guarantee they'll never get out of sync.

Other changes include: making dirty submodules checking and
cleaning entirely independent of other operations; removing
the use of 'set -e' and handling errors explicitly instead;
better parsing of command line arguments.
2017-04-25 09:52:37 +02:00
Stefan Zimmermann
0c77a54e3b maint: improve usage of autogen's --no-git
If you build libvirt with the --no-git option, then gnulib requires
either $GNULIB_SRCDIR in the environment or --gnulib-srcdir on the
command line.  But we had not been supporting its use from the
command line.  This patch is a bit picky: --gnulib-srcdir must be
passed immediately after --no-git; but since we don't reorder
arguments, and since we already required --no-git to be first to
have any effect, it's not too horrible.  It also does the wrong
thing if you include spaces in your arguments, but developers
doing that deserve what they get, right?

Signed-off-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
2015-02-06 11:35:29 -07:00
Eric Blake
3cbd3b8e3a maint: detect VPATH builds when checking for gnulib update
I accidentally typed 'make' in the srcdir of a VPATH build, and
was surprised to see this:

$ make
/bin/sh: s/^[ +-]//;s/ .*//: No such file or directory
INFO: gnulib update required; running ./autogen.sh first
make: -n: Command not found
./autogen.sh
I am going to run ./configure with no arguments - if you wish
to pass any to it, please specify them on the ./autogen.sh command line.
running bootstrap...
./bootstrap: Bootstrapping from checked-out libvirt sources...
./bootstrap: getting gnulib files...

Oops - we're trying to execute some fairly bogus command names,
and then trying to configure in-tree (which breaks all existing
VPATH builds, since automake refuses to do a VPATH build if it
detects an in-tree configure).  The third line (executing "-n")
is fixed by updating to the latest gnulib; the rest of the problem
is fixed by copying the same filtering in our cfg.mk as what
gnulib just added, so that we avoid any $(shell) invocations which
in turn depend on variables that are only populated by a working
Makefile.  With that in place, we are back to the much nicer:

$ make
There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
make: *** [abort-due-to-no-makefile] Error 1

Additionally, although harder to see - there was a trailing space in
the message warning us that autogen would run an in-tree configure.

* .gnulib: Update to latest, in part for maint.mk improvements.
* cfg.mk (_update_required): Don't check for update in
unconfigured directory.
* autogen.sh (no_git): Drop trailing space.

Signed-off-by: Eric Blake <eblake@redhat.com>
2014-06-04 16:06:55 -06:00
Michal Privoznik
834a86eae5 autogen.sh: Correctly detect .git as a file
One of my previous patches 5cfe0d37cd tried to handle the case when
libvirt is a submodule of another project. In that case, the .git is
just a link to the parent .git directory (which the autogen.sh script
didn't count on). The fix was missing 'test' though.
2013-08-29 13:19:45 +02:00
Michal Privoznik
5cfe0d37cd autogen: Handle case when libvirt's submodule
Currently, in the autogen.sh script we check whether .git is an existing
directory in which case bootstrap is run. However, if libvirt is a
submodule, then the .git is just a file (with reference to the topmost
.git directory). However, our submodule routines work well. So there's
no real reason why we should prohibit users to build libvirt from
submodule.
2013-07-19 13:45:22 +02:00
Eric Blake
1e503ee534 build: honor autogen.sh --no-git
Based on a report by Chandrashekar Shastri, at
https://bugzilla.redhat.com/show_bug.cgi?id=979360

On systems where git cannot access the outside world, a developer
can instead arrange to get a copy of gnulib at the right commit
via side channels (such as NFS share drives), set GNULIB_SRCDIR,
then use ./autogen.sh --no-git.  In this setup, we will now
avoid direct use of git.  Of course, this means no automatic
gnulib updates when libvirt.git updates its submodule, but it
is expected that any developer in such a situation is already
prepared to deal with the fallout.

* .gnulib: Update to latest, for bootstrap.
* bootstrap: Synchronize from gnulib.
* autogen.sh (no_git): Avoid git when requested.
* cfg.mk (_update_required): Skip automatic rerun of bootstrap if
we can't use git.
* docs/compiling.html.in: Document this setup.
* docs/hacking.html.in: Mention this.
* HACKING: Regenerate.

Signed-off-by: Eric Blake <eblake@redhat.com>
2013-07-09 16:15:29 -06:00
Eric Blake
55dc872bd8 build: fix incremental autogen.sh when no AUTHORS is present
Commit 71d1256 tried to fix a problem where rebasing an old
branch on top of newer libvirt.git resulted in automake failing
because of a missing AUTHORS file.  However, while the fix
worked for an incremental 'make', it did not work for someone
that directly reran './autogen.sh'.  Reported by Laine Stump.

* autogen.sh (autoreconf): Check for same conditions as cfg.mk.
* cfg.mk (_update_required): Add comments.
2012-12-03 14:59:09 -07:00
Hu Tao
f2f9ae426a run bootstrap if .gnulib is not present
If .gnulib is deleted unexpectedly, autogen.sh will fail with message:

fatal: ambiguous argument '.gnulib': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

which is actually given by git diff .gnulib, which doesn't exist.

In the case to run bootstrap to create .gnulib.
2012-11-21 07:09:05 -07:00
Eric Blake
c5f162200c build: avoid infinite autogen loop
Several people have reported that if the .gnulib submodule is dirty,
then 'make' will go into an infinite loop attempting to rerun bootstrap,
because that never cleans up the dirty submodule.  By default, we
should halt and make the user investigate, but if the user doesn't
know why or care that the submodule is dirty, I also added the ability
to 'make CLEAN_SUBMODULE=1' to get things going again.

Also, while testing this, I noticed that when a submodule update was
needed, 'make' would first run autoreconf, then bootstrap (which
reruns autoreconf); adding a strategic dependency allows for less work.

* .gnulib: Update to latest, for maint.mk improvements.
* cfg.mk (_autogen): Also hook maint.mk, to run before autoreconf.
* autogen.sh (bootstrap): Refuse to run if gnulib is dirty, unless
user requests discarding gnulib changes.
2012-10-01 09:47:38 -06:00
Daniel P. Berrange
d4170dfad3 Ensure autogen.sh exists if bootstrap fails
If any of the bootstrap tasks (autoconf/automake/etc) failed,
autogen.sh carried on running any pre-existing configure anyway.
Use 'set -e' to ensure autogen.sh immediately exists on error.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-09-20 15:58:29 +01:00
Daniel P. Berrange
63f5c83bb0 Allow NOCONFIGURE=1 to make autogen.sh skip ./configure
Sometimes it is useful to re-bootstrap libvirt without running
through a ./configure invocation immediately. eg if you want
to run ./configure for Mingw32 rather than native.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-06-25 10:41:10 +01:00
Cole Robinson
2cd29c3107 autogen: Always abide --system
If we do ./autogen.sh && ./configure, then later try ./autogen.sh --system,
configure isn't invoked with the requested params. Instead
config.status --recheck is run.
2012-06-15 14:56:57 -04:00
Eric Blake
676fdf8cb5 build: allow for local gnulib diffs
Commit f7bd00c12 pulled in a gnulib module that fails to compile
on mingw.  While it would be nice to pull in a newer version of
.gnulib that fixes this, it is difficult to backport any .gnulib
update to older releases.  So, it makes sense to take advantage
of gnulib-tool's ability to support local diffs, where we can
apply specific diffs in our use of gnulib without waiting for
upstream gnulib to pick up those changes, as well as avoiding
a wholesale .gnulib update.  The existence of local diffs will
also make it easier to backport fixes against a tarball (as long
as a tarball and libvirt.git share the same .gnulib commit, then
the tarball can be patched by applying the same local diffs as
a post-release libvirt.git commit, without having to rerun an
entire gnulib-tool bootstrap).

This patch introduces the framework for supporting local diffs,
without actually introducing any.

* bootstrap.conf (local_gl_dir): New variable.
* autogen.sh (bootstrap_hash): Hash any local diffs, to force a
re-bootstrap if just diffs change.
* cfg.mk (_update_required): Likewise.
2011-11-09 09:03:33 -07:00
Eric Blake
3a97fa28e4 build: avoid problems with autogen.sh runs from tarball
Introduced by commit fac97c65c distributing cfg.mk, which
previously could blindly assume it was in a git checkout.

* cfg.mk (_update_required): Also check for .git.
* autogen.sh: Don't run bootstrap from a tarball.
Reported by Daniel Veillard.
2011-02-12 06:28:28 -07:00
Daniel P. Berrange
3493f1bcec Fix setup of lib directory with autogen.sh --system
On x86_64 hosts, /usr/lib64 must be used instead of /usr/lib
Rather than attempt to whitelist architectures, just check
for existance of /usr/lib64

* autogen.sh: Fix to use /usr/lib64 if it exists
2011-01-26 14:54:23 +00:00
Eric Blake
125978fe3b maint: support --no-git option during autogen.sh
https://bugzilla.redhat.com/show_bug.cgi?id=562743

Also, fixes gnulib bug in dealing with strerror_r from glibc 2.13.

* .gnulib: Update to latest, for improved bootstrap.
* bootstrap: Resync from gnulib.
* autogen.sh (bootstrap): Add --bootstrap-sync, to make it easier
to keep bootstrap up-to-date.  Pass optional --no-git through.
Reported by Aleksey Avdeev.
2011-01-21 09:45:37 -07:00
Eric Blake
b0f34a6a1a build: require pkg-config for bootstrap
* .gnulib: Update to latest, for bootstrap fixes.
* bootstrap: Synchronize with upstream.
* bootstrap.conf: Add pkg-config pre-requisite.
* autogen.sh: Tweak wording message.
Reported by Justin Clift, and with feedback from Bruno Haible.
2010-10-05 13:54:39 -06:00
Eric Blake
f8db6c90e3 build: fix example build on MacOS X
Partial reversion of commit 76d87a59, now that bootstrap is smarter.

* .gnulib: Update to latest, for poll and bootstrap fixes.
* bootstrap: Resync from gnulib.
* autogen.sh: Drop redundant tool checks; bootstrap does them
better, by honoring environment variables.
* examples/domain-events/events-c/Makefile.am (INCLUDES)
(event_test_LDADD): Use gnulib library during build.
* bootstrap.conf (gnulib_tool_option_extras): Revert --libtool
addition, now that updated bootstrap does it for us.
Reported by Justin Clift.
2010-09-30 11:34:00 -06:00
Jiri Denemark
0495fe59ad Avoid unnecessary bootstrap runs in VPATH builds 2010-08-11 09:20:26 +02:00
Eric Blake
5f211d4bc5 build: rerun bootstrap if po/Makevars got nuked
There has been a frequent complaint of:

make[2]: Entering directory `/home/remote/eblake/libvirt/po'
make[2]: *** No rule to make target `/config.status', needed by `Makefile'.  Stop.

It happens after nuking and regenerating the po directory,
which is a common action after running anything like
'make dist' or 'make rpm' that dirties all the .po files.

Teach autogen.sh that it must regenerate po/Makevars to avoid
the missing variable declaration, and teach cfg.mk to recognize
that a nuked po directory is cause to rerun autogen.sh.

* cfg.mk (_update_required): Check for po/Makevars.
* autogen.sh (bootstrap): Run bootstrap if it got lost.
Diagnosed by Justin Clift.
2010-08-04 14:36:14 -06:00
Eric Blake
d002c250cd build: improve check for out-of-date .gnulib submodule
git reset --hard 96e5a2d4d5
./autogen.sh
make -s
git pull
make -s    <-- expecting auto-bootstrap here, doesn't happen

Use git diff to expose whether the submodule has untracked changes,
which are typical on an incremental pull if .gnulib was updated but
the user did not manually run 'git submodule update'.

After this patch is applied, I encountered a new problem when
following the reproducing pattern.  Basically, the change to .gnulib
between libvirt's commit 96e5a2d4 and this patch introduced a change
to sys_ioctl.in.h, but gnulib (intentionally) does not make the
replacement headers depend on Makefile changes.  Therefore, I ended up
with the generated replacement header being broken:
gnulib/lib/sys/ioctl.h complained about a use of @.  But that seems
like something that should be fixed upstream in gnulib's bootstrap
script (that is, when doing a gnulib update, all files created from
.in.h file should probably be deleted).  Without the benefit of that
proposed gnulib fix, I worked around the problem by manually removing
the stale gnulib/lib/sys/ioctl.h.

* autogen.sh (t): Also run bootstrap if the gnulib submodule needs
to be updated.
* cfg.mk (_autogen): Likewise.
Reported by Matthias Bolte.
2010-04-02 15:49:32 -06:00
Eric Blake
508da563b9 build: don't lose prior configure args on autogen.sh
My prior patch forced an autogen.sh run, and I was surprised that the
suggested './autogen.sh' lost the fact that I had previously used
'./autogen.sh -C' for speed.

* autogen.sh: Use config.status, if present and there were no arguments.

Signed-off-by: Eric Blake <eblake@redhat.com>
2010-03-26 19:16:37 +01:00
Jim Meyering
be7780b035 do not require two ./autogen.sh runs to permit "make"
* autogen.sh (bootstrap_hash): New function.
Running bootstrap may update the gnulib SHA1, yet we were computing
t=$(git submodule status ...) *prior* to running bootstrap, and
then recording that sometimes-stale value in the stamp file upon
a successful bootstrap run.  That would require two (lengthy!)
bootstrap runs to update the stamp file.
2010-03-16 21:42:56 +01:00
Eric Blake
3b04f3bb0f build: change to gnulib module list should rerun bootstrap
* autogen.sh (curr_status): Also include hash of bootstrap.conf
when checking for changes that require bootstrap rerun.
* cfg.mk (_update_required): Likewise.
2010-03-10 18:14:15 +01:00
Jim Meyering
0f88dade23 build: make git submodule checking more reliable
* cfg.mk (_curr_status): Accommodate leading "+" or "-" in the output
of git submodule status.
* autogen.sh: Likewise.
2010-02-25 13:35:03 +01:00
Eric Blake
38c9440a15 maint: import modern bootstrap
Copy the latest gnulib bootstrap, which runs autoreconf and
generates po/Makevars for us.  Other improvements include some
improved prerequisite tool checking.

This also fixes a bug in the .pot files, regarding the copyright holder.

* bootstrap: Update to version in .gnulib/build-aux.
* bootstrap.conf (MSGID_BUGS_ADDRESS, COPYRIGHT_HOLDER, SKIP_PO)
(gnulib_mk, ACLOCAL, bootstrap_epilogue): Provide overrides.
* autogen.sh (autoreconf): Avoid redundant autoreconf if bootstrap
was run.
* po/Makevars: Delete, now that bootstrap creates it.
* po/.gitignore: Update.
2010-02-23 21:31:21 +01:00
Eric Blake
f1ef0e31d2 maint: fix quoting in autogen.sh
* autogen.sh (srcdir, THEDIR, OBJ_DIR): Use proper quoting.
(.git-module-status): Abort if bootstrap fails.
2010-02-23 21:31:17 +01:00
Daniel P. Berrange
563dc5654c Add --system flag to autogen.sh to make it easy to build with right prefix
Add a --system flag to autogen.sh which gets turned into the args
--prefix=/usr --sysconfdir=/etc --localstatedir=/var to make it
easy to build with settings that match an RPM build

* autogen.sh: Add --system flag
2009-12-07 14:13:53 +00:00
Jim Meyering
f272378d52 build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the
gnulib git submodule, you must rerun the autogen.sh script.  With this
change, "make" now fails and tells you to run ./autogen.sh, when needed.
* autogen.sh: Maintain a new file, .git-module-status, containing
the current submodule status.  If it doesn't exist or its content
is different from what "git submodule status" prints, then run
./bootstrap
* .gitignore: Add .git-module-status
* cfg.mk: Diagnose out of date submodule and fail.
* README-hacking: Update not to mention bootstrap.
* Makefile.am (MAINTAINERCLEANFILES): Add .git-module-status,
so that "make maintainerclean" will remove it.
2009-07-10 13:39:28 +02:00
Jim Meyering
e335b2ca90 build: make autogen.sh use autoreconf -if
* autogen.sh: Use "autoreconf -if" instead of open-coding it with
manual and unconditional invocation of each separate tool.
2009-07-10 13:39:28 +02:00
Jim Meyering
27b175b9a2 generate ChangeLog from git logs into distribution tarball
No longer maintain a version-controlled ChangeLog file, but do
continue to include a ChangeLog file in distribution tarball.
* Makefile.am (gen-ChangeLog): New rule.
(dist-hook): Depend on it.
(EXTRA_DIST): Add ChangeLog-old.
* bootstrap (modules): Add gitlog-to-changelog.
* ChangeLog: Remove file.  Renamed to...
* ChangeLog-old: ...this.  New file.
* autogen.sh: Touch ChangeLog, to ensure it exists.  For automake.
2009-07-08 16:17:51 +02:00
Jim Meyering
e04912a9f0 Remove all trailing blanks; turn on the rule to detect them.
* Makefile.cfg (local-checks-to-skip): Remove sc_trailing_blank.
* .x-sc_trailing_blank: New file, to exempt the few binary files.
2008-02-05 19:27:37 +00:00
Jim Meyering
261e7581b1 Use gnulib, starting with its physmem and getaddrinfo modules.
New files go into these directories:
  gnulib/lib
  gnulib/m4
  gnulib/tests

* bootstrap: A wrapper around gnulib-tool.
* configure.in: Invoke gl_EARLY and gl_INIT, being careful to put gl_EARLY
before any macro that uses AC_COMPILE_IFELSE.
(AC_OUTPUT): Add lib/Makefile and gl-tests/Makefile.  Remove m4/Makefile.
* Makefile.am (SUBDIRS): Add gnulib/lib and remove m4.  Add gnulib/tests
early enough that those tests run before any libvirt unit tests.
* m4/Makefile.am: Remove file.  Not needed.
* src/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS, libvirt_la_LIBADD): Add ../gnulib/lib/libgnu.la.
* src/nodeinfo.c: Include "physmem.h".
* qemud/qemud.c, src/remote_internal.c: Include "getaddrinfo.h".
(MEMINFO_PATH, linuxNodeInfoMemPopulate): Remove definitions.
(virNodeInfoPopulate): Use physmem_total, not linuxNodeInfoMemPopulate.
* tests/Makefile.am (INCLUDES): Add -I$(top_srcdir)/gnulib/lib -I../gnulib/lib.
(LDADDS): Add ../gnulib/lib/libgnu.la.
* qemud/Makefile.am (libvirtd_LDADD): Add ../gnulib/lib/libgnu.la.
* tests/nodeinfotest.c (linuxTestCompareFiles): No longer read total
memory from a file.
Update expected output not to include "Memory: NNNN"
* tests/nodeinfodata/linux-nodeinfo-1.txt:
* tests/nodeinfodata/linux-nodeinfo-2.txt:
* tests/nodeinfodata/linux-nodeinfo-3.txt:
* tests/nodeinfodata/linux-nodeinfo-4.txt:
* tests/nodeinfodata/linux-nodeinfo-5.txt:
* tests/nodeinfodata/linux-nodeinfo-6.txt:
* src/test.c [WITH_TEST]: Remove definition of _GNU_SOURCE that
would conflict with the one now in "config.h".
* autogen.sh: Add -I gnulib/m4.
* src/conf.c, src/sexpr.c: Don't define _GNU_SOURCE.
Instead, include "config.h".
* qemud/qemud.c: Remove definition of _GNU_SOURCE.
* src/openvz_driver.c: Likewise.
* src/qemu_driver.c: Likewise.
* src/remote_internal.c: Likewise.

* configure.in: Use AC_CONFIG_AUX_DIR(build-aux), so that a bunch
of gettextize-generated files go into build-aux/, rather than in
the top-level directory.
* .cvsignore: Adjust.
* build-aux/.cvsignore: New file.


Author: Jim Meyering <meyering@redhat.com>
2007-12-05 21:31:07 +00:00
Mark McLoughlin
081c8d435c Tue Feb 14 16:35:56 IST 2007 Mark McLoughlin <markmc@redhat.com>
* autogen.sh: run autoheader before automake
2007-02-14 16:35:47 +00:00
Mark McLoughlin
24a92945d3 Tue Feb 14 14:33:22 EST 2007 Mark McLoughlin <markmc@redhat.com
* autogen.sh: run autoheader

        * config.h.in: remove
2007-02-14 15:34:56 +00:00
Daniel P. Berrange
26ceeb4e9b Added code coverage testing enabled via --enable-test-coverage 2007-02-14 02:12:41 +00:00
Daniel Veillard
f873796e20 * autogen.sh: applied patch from Richard W.M. Jones to not
output instructions if configure failed
Daniel
2007-01-26 11:12:56 +00:00
Daniel P. Berrange
e8e5844089 Added support for i18n translation with gettext 2006-09-21 15:24:37 +00:00
Daniel Veillard
e2bd543163 * src/xend_internal.c: fixed xenDaemonOpen() to try both unix and
http accesses by default and to use the provided URI otherwise,
  applied Jim Fehlig patch working around xend connection close bug
* autogen.sh: fixed package name
Daniel
2006-07-06 09:29:34 +00:00
Daniel Veillard
0b2869fb84 * autogen.sh configure.in: fixed snapshot autogeneration, had to
tweak a few things
Daniel
2006-02-10 08:40:20 +00:00
Daniel Veillard
1192a2ade3 * Makefile.am README TODO autogen.sh configure.in libvir.pc.in
libvir.spec.in docs/Makefile.am docs/apibuild.py docs/structures.fig
  include/Makefile.am include/libvir.h src/Makefile.am src/hash.c
  src/hash.h src/internal.h src/libvir.c src/libvir_sym.version
  src/virsh.c: renamed to libvir
Daniel
2005-12-05 11:16:07 +00:00
Daniel Veillard
b8e381131c * AUTHORS NEWS README autogen.sh configure.in: allow autogen.sh and
configure to start working
* src/Makefile.am src/internal.h src/libxen.c: make the first compile
Daniel
2005-11-02 13:19:10 +00:00