[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] autoconf: check for wget and ftp



Some OSes don't come with wget by default, so ftp should be choosen
on those. Add an autoconf check to check for wget and ftp, and
replace the usage of hardcoded wget in tools.

Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
---
Please run autoconf after applying this patch.
---
 config/StdGNU.mk                  |    2 --
 config/Tools.mk.in                |    1 +
 tools/configure.ac                |    2 ++
 tools/firmware/etherboot/Makefile |    2 +-
 tools/m4/fetcher.m4               |   14 ++++++++++++++
 5 files changed, 18 insertions(+), 3 deletions(-)
 create mode 100644 tools/m4/fetcher.m4

diff --git a/config/StdGNU.mk b/config/StdGNU.mk
index b6adbbe..3febe8d 100644
--- a/config/StdGNU.mk
+++ b/config/StdGNU.mk
@@ -22,8 +22,6 @@ MSGMERGE   = msgmerge
 # Allow git to be wrappered in the environment
 GIT        ?= git
 
-WGET       ?= wget -c
-
 INSTALL      = install
 INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
diff --git a/config/Tools.mk.in b/config/Tools.mk.in
index a6ecf48..a78f211 100644
--- a/config/Tools.mk.in
+++ b/config/Tools.mk.in
@@ -22,6 +22,7 @@ AS86                := @AS86@
 LD86                := @LD86@
 BCC                 := @BCC@
 IASL                := @IASL@
+FETCHER             := @FETCHER@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
diff --git a/tools/configure.ac b/tools/configure.ac
index 3318fea..e708f01 100644
--- a/tools/configure.ac
+++ b/tools/configure.ac
@@ -35,6 +35,7 @@ m4_include([m4/curses.m4])
 m4_include([m4/pthread.m4])
 m4_include([m4/ptyfuncs.m4])
 m4_include([m4/extfs.m4])
+m4_include([m4/fetcher.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -117,6 +118,7 @@ esac
  AX_CHECK_UUID
  AX_CHECK_CURSES
 PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.12])
+AX_CHECK_FETCHER
 
 # Checks for libraries.
 AC_CHECK_HEADER([bzlib.h], [
diff --git a/tools/firmware/etherboot/Makefile 
b/tools/firmware/etherboot/Makefile
index a195888..15561fc 100644
--- a/tools/firmware/etherboot/Makefile
+++ b/tools/firmware/etherboot/Makefile
@@ -28,7 +28,7 @@ all: $(ROMS)
        $(MAKE) -C $D/src bin/$(*F).rom
 
 $T:
-       if ! wget -O _$T $(IPXE_TARBALL_URL); then \
+       if ! $(FETCHER) _$T $(IPXE_TARBALL_URL); then \
                $(GIT) clone $(IPXE_GIT_URL) $D.git; \
                (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
                $(IPXE_GIT_TAG) | gzip >../_$T); \
diff --git a/tools/m4/fetcher.m4 b/tools/m4/fetcher.m4
new file mode 100644
index 0000000..86f33b3
--- /dev/null
+++ b/tools/m4/fetcher.m4
@@ -0,0 +1,14 @@
+AC_DEFUN([AX_CHECK_FETCHER], [
+AC_PATH_PROG([WGET],[wget], [no])
+AS_IF([test x"$WGET" != x"no"], [
+    FETCHER="$WGET -c -O"
+], [
+    AC_PATH_PROG([FTP],[ftp], [no])
+    AS_IF([test x"$FTP" != x"no"], [
+        FETCHER="$FTP -o"
+    ], [
+        AC_MSG_ERROR([cannot find wget or ftp])
+    ])
+])
+AC_SUBST(FETCHER)
+])
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.