Skip to content

Commit

Permalink
Use gnulib, starting with its physmem and getaddrinfo modules.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jim Meyering committed Dec 5, 2007
1 parent 1d1cf57 commit 261e758
Show file tree
Hide file tree
Showing 26 changed files with 225 additions and 105 deletions.
9 changes: 0 additions & 9 deletions .cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,18 @@ config.cache
config.h
config.h.in
config.log
config.guess
config.status
config.sub
stamp-h
stamp-h1
libtool
ltconfig
ltmain.sh
update.log
libvirt.pc
libvirt.spec
COPYING
m4
ABOUT-NLS
config.rpath
mkinstalldirs
coverage
results.log
libvirt-*.tar.gz
INSTALL
compile
depcomp
install-sh
missing
50 changes: 50 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
Wed Dec 5 22:30:03 CET 2007 Jim Meyering <[email protected]>

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.

Wed Dec 5 21:44:17 CET 2007 Daniel Veillard <[email protected]>

* qemud/remote.c: rename remoteDispatchAuthPolkitInit to
Expand Down
5 changes: 3 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Process this file with automake to produce Makefile.in

SUBDIRS = include src qemud proxy docs @PYTHON_SUBDIR@ tests po m4 scripts
SUBDIRS = gnulib/lib include src qemud proxy docs gnulib/tests \
@PYTHON_SUBDIR@ tests po scripts

ACLOCAL_AMFLAGS = -I m4
ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4

EXTRA_DIST = libvirt.spec.in libvirt.spec COPYING.LIB \
libvirt.pc.in libvirt.pc TODO AUTHORS ChangeLog \
Expand Down
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fi
autopoint --force
#rm -rf m4
libtoolize --copy --force
aclocal -I m4
aclocal -I m4 -I gnulib/m4
autoheader
automake --add-missing
autoconf
Expand Down
117 changes: 117 additions & 0 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#!/bin/sh
# Run this after autogen.sh, to pull in all of the gnulib-related bits.
# It's important to run *after* autogen.sh, since it updates some of
# the same files autogen.sh does, yet those from gnulib are newer,
# and match the tests. So if a gnulib bug has been fixed since the
# snapshot taken for whatever gettext release you're using, yet you
# run "make check" against the wrong version, the corresponding unit
# test in gl-tests/ may well fail.

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.
If the file bootstrap.conf exists in the current working directory, its
contents are read as shell variables to configure the bootstrap.
Running without arguments will suffice in most cases.
"
}

for option
do
case $option in
--help)
usage
exit;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done

cleanup_gnulib() {
st=$?
rm -fr .gnulib
exit $st
}

case ${GNULIB_SRCDIR--} in
-)
if [ ! -d gnulib ]; then
echo "$0: getting gnulib files..."

trap cleanup_gnulib 1 2 13 15

git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib ||
cleanup_gnulib

trap - 1 2 13 15
fi
GNULIB_SRCDIR=.gnulib
esac

gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit

# Tell gnulib to:
# put tests in new gnulib/tests/ dir
# put *.m4 files in new gnulib/m4/ dir
# put *.[ch] files in new gnulib/lib/ dir.
# With --avoid=snprintf, we drop support for systems (many!) with
# losing snprintf but pull in about 30 fewer files
# With the current gnulib and gettext-0.17, the following
# files are added to m4/ by both. But gnulib is stable enough
# and gettext-0.16.1 is new enough that they are identical.
# compiler-flags.m4
# inttypes_h.m4
# longlong.m4
# size_max.m4
# stdint_h.m4
# wchar_t.m4
# wint_t.m4
# xsize.m4

# Note that if we don't exclude the snprintf module, there are two tests
# that have incompatible licenses, so we would have to exclude them. Even
# excluding those two test modules, find reports a total of 94 added files.
# Yes, snprintf has some heavy-duty dependents.
# --avoid=snprintf-tests
# --avoid=vasnprintf-tests

avoid='--avoid=snprintf'

avoid='
--avoid=snprintf-tests
--avoid=vasnprintf-tests
--avoid=alloca-opt-tests
'

$gnulib_tool \
--lgpl \
$avoid \
--with-tests \
--m4-base=gnulib/m4 \
--source-base=gnulib/lib \
--tests-base=gnulib/tests \
--import physmem getaddrinfo

rm -f \
.gitignore \
gnulib/lib/.gitignore \
gnulib/m4/.gitignore \
gnulib/tests/.gitignore

(cd gnulib/lib &&
(cat .cvsignore; \
ls -1 *.in.h|sed 's/\.in\.h/.h/') | sort -u > .t; mv .t .cvsignore)
9 changes: 9 additions & 0 deletions build-aux/.cvsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
compile
config.guess
config.rpath
config.sub
depcomp
install-sh
ltmain.sh
missing
mkinstalldirs
12 changes: 9 additions & 3 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ dnl Process this file with autoconf to produce a configure script.

AC_INIT(libvirt, 0.3.3)
AC_CONFIG_SRCDIR(src/libvirt.c)
AC_CONFIG_AUX_DIR(build-aux)
AM_CONFIG_HEADER(config.h)
dnl Make automake keep quiet about wildcards & other GNUmake-isms
AM_INIT_AUTOMAKE([-Wno-portability])
Expand Down Expand Up @@ -29,11 +30,15 @@ POLKIT_REQUIRED="0.6"

dnl Checks for C compiler.
AC_PROG_CC
AM_PROG_CC_STDC
AC_C_CONST
AC_PROG_INSTALL
AC_PROG_CPP

gl_EARLY
gl_INIT

AM_PROG_CC_STDC
AC_C_CONST

dnl Make sure we have an ANSI compiler
AM_C_PROTOTYPES
test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant)
Expand Down Expand Up @@ -626,11 +631,12 @@ cp COPYING.LIB COPYING
AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
docs/examples/Makefile docs/devhelp/Makefile \
docs/examples/python/Makefile \
gnulib/lib/Makefile tests/gnulib/Makefile \
libvirt.pc libvirt.spec \
po/Makefile.in scripts/Makefile \
include/libvirt/Makefile include/libvirt/libvirt.h \
python/Makefile python/tests/Makefile \
qemud/Makefile m4/Makefile \
qemud/Makefile \
tests/Makefile proxy/Makefile \
tests/xml2sexprdata/Makefile \
tests/sexpr2xmldata/Makefile \
Expand Down
3 changes: 0 additions & 3 deletions m4/Makefile.am

This file was deleted.

3 changes: 2 additions & 1 deletion qemud/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ libvirtd_SOURCES = \

#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
libvirtd_CFLAGS = \
-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I$(top_srcdir)/include -I$(top_builddir)/include \
$(LIBXML_CFLAGS) $(GNUTLS_CFLAGS) $(SASL_CFLAGS) \
$(POLKIT_CFLAGS) \
Expand All @@ -40,7 +41,7 @@ libvirtd_CFLAGS = \
libvirtd_LDFLAGS = $(WARN_CFLAGS) $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) \
$(POLKIT_LIBS)
libvirtd_DEPENDENCIES = ../src/libvirt.la
libvirtd_LDADD = ../src/libvirt.la
libvirtd_LDADD = ../src/libvirt.la ../gnulib/lib/libgnu.la


if HAVE_POLKIT
Expand Down
3 changes: 1 addition & 2 deletions qemud/qemud.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

#include "config.h"

#define _GNU_SOURCE /* for asprintf */

#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -53,6 +51,7 @@
#include "libvirt/virterror.h"

#include "internal.h"
#include "getaddrinfo.h"
#include "../src/internal.h"
#include "../src/remote_internal.h"
#include "../src/conf.h"
Expand Down
8 changes: 5 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Process this file with automake to produce Makefile.in

INCLUDES = -I$(top_builddir)/include \
INCLUDES = \
-I$(top_srcdir)/gnulib/lib -I../gnulib/lib \
-I../include \
-I@top_srcdir@/include \
-I@top_srcdir@/qemud \
$(LIBXML_CFLAGS) \
Expand All @@ -15,7 +17,7 @@ INCLUDES = -I$(top_builddir)/include \
$(WARN_CFLAGS) \
$(LIBVIRT_FEATURES)
DEPS = libvirt.la
LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la
LDADDS = @STATIC_BINARIES@ $(WARN_CFLAGS) libvirt.la ../gnulib/lib/libgnu.la
VIRSH_LIBS = @VIRSH_LIBS@

confdir = $(sysconfdir)/libvirt/
Expand Down Expand Up @@ -61,7 +63,7 @@ SERVER_SOURCES = \

libvirt_la_SOURCES = $(CLIENT_SOURCES) $(SERVER_SOURCES)
libvirt_la_LIBADD = $(LIBXML_LIBS) $(GNUTLS_LIBS) $(SASL_LIBS) \
@CYGWIN_EXTRA_LIBADD@
@CYGWIN_EXTRA_LIBADD@ ../gnulib/lib/libgnu.la
libvirt_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libvirt_sym.version \
-version-info @LIBVIRT_VERSION_INFO@ \
$(COVERAGE_CFLAGS:-f%=-Wc,-f%) \
Expand Down
3 changes: 2 additions & 1 deletion src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
* Daniel Veillard <[email protected]>
*/

#define _GNU_SOURCE /* want strndup ! */
#include "config.h"

#include <string.h>

#include <stdio.h>
Expand Down
Loading

0 comments on commit 261e758

Please sign in to comment.