From: Richard W.M. Jones Date: Thu, 20 Sep 2007 18:40:36 +0000 (+0000) Subject: Thu Sep 20 19:37:00 BST 2007 Richard W.M. Jones X-Git-Tag: LIBVIRT_0_3_3~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0caf0d767c169a0cfc795587e348713c43fd71e8;p=thirdparty%2Flibvirt.git Thu Sep 20 19:37:00 BST 2007 Richard W.M. Jones * src/bridge.c, src/qemu_driver.c, configure.in: Try to detect the paths of dnsmasq and brctl at compile time. If found then compile them in, otherwise search $PATH at runtime. * libvirt.spec.in: BR dnsmasq and bridge-utils so we have their paths at compile time. --- diff --git a/ChangeLog b/ChangeLog index 12024549a1..a25c0ef7d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Sep 20 19:37:00 BST 2007 Richard W.M. Jones + + * src/bridge.c, src/qemu_driver.c, configure.in: Try to detect + the paths of dnsmasq and brctl at compile time. If found + then compile them in, otherwise search $PATH at runtime. + + * libvirt.spec.in: BR dnsmasq and bridge-utils so we have their + paths at compile time. + Thu Sep 20 18:10:00 BST 2007 Richard W.M. Jones * src/qemu_driver.c, docs/libvir.html: Support virConnectGetHostname diff --git a/configure.in b/configure.in index 4b5590c06f..4bb2eee3aa 100644 --- a/configure.in +++ b/configure.in @@ -36,6 +36,20 @@ AC_PATH_PROG(TAR, tar, /bin/tar) AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint) AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc) +dnl External programs that we can use if they are available. +dnl We will hard-code paths to these programs unless we cannot +dnl detect them, in which case we'll search for the program +dnl along the $PATH at runtime and fail if it's not there. +AC_PATH_PROG(DNSMASQ, dnsmasq, dnsmasq, + [/sbin:/usr/sbin:/usr/local/sbin:$PATH]) +AC_PATH_PROG(BRCTL, brctl, brctl, + [/sbin:/usr/sbin:/usr/local/sbin:$PATH]) + +AC_DEFINE_UNQUOTED([DNSMASQ],["$DNSMASQ"], + [Location or name of the dnsmasq program]) +AC_DEFINE_UNQUOTED([BRCTL],["$BRCTL"], + [Location or name of the brctl program (see bridge-utils)]) + dnl Make sure we have an ANSI compiler AM_C_PROTOTYPES test "x$U" != "x" && AC_MSG_ERROR(Compiler not ANSI compliant) diff --git a/libvirt.spec.in b/libvirt.spec.in index 4ecf0b646c..bc18a73924 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -23,6 +23,8 @@ BuildRequires: ncurses-devel BuildRequires: gettext BuildRequires: gnutls-devel BuildRequires: avahi-devel +BuildRequires: dnsmasq +BuildRequires: bridge-utils Obsoletes: libvir ExclusiveArch: i386 x86_64 ia64 diff --git a/src/bridge.c b/src/bridge.c index d728c2684c..457b5d72ad 100644 --- a/src/bridge.c +++ b/src/bridge.c @@ -45,7 +45,6 @@ #define MAX_BRIDGE_ID 256 -#define BRCTL_PATH "/usr/sbin/brctl" #define JIFFIES_TO_MS(j) (((j)*1000)/HZ) #define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000) @@ -684,7 +683,7 @@ brSetForwardDelay(brControl *ctl ATTRIBUTE_UNUSED, n = 0; - if (!(argv[n++] = strdup(BRCTL_PATH))) + if (!(argv[n++] = strdup(BRCTL))) goto error; if (!(argv[n++] = strdup("setfd"))) @@ -741,7 +740,7 @@ brSetEnableSTP(brControl *ctl ATTRIBUTE_UNUSED, n = 0; - if (!(argv[n++] = strdup(BRCTL_PATH))) + if (!(argv[n++] = strdup(BRCTL))) goto error; if (!(argv[n++] = strdup("stp"))) diff --git a/src/qemu_driver.c b/src/qemu_driver.c index 0dac4b388f..6482e0a106 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -830,7 +830,7 @@ qemudBuildDnsmasqArgv(virConnectPtr conn, i = 0; - APPEND_ARG(*argv, i++, "dnsmasq"); + APPEND_ARG(*argv, i++, DNSMASQ); APPEND_ARG(*argv, i++, "--keep-in-foreground"); /*