From 624f882d7b7eb8e6750122dbcc8f6b8da20cadd9 Mon Sep 17 00:00:00 2001 From: yoe Date: Fri, 14 Mar 2008 12:30:24 +0000 Subject: [PATCH] r319: Merge from trunk --- .gitignore | 1 + Makefile.am | 7 ++++++- autogen.sh | 4 ++++ configure.ac | 36 +++++++++++++++++++++++++++++++++++- gznbd/.gitignore | 1 + gznbd/Makefile | 5 +++++ gznbd/gznbd.c | 4 ++-- 7 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 autogen.sh create mode 100644 gznbd/.gitignore diff --git a/.gitignore b/.gitignore index ac7b3e9..6a022fa 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ autom4te.cache autoscan.log config.h config.h.in +*~ config.log config.status configure diff --git a/Makefile.am b/Makefile.am index fa94e10..19893e2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = nbd-server -EXTRA_PROGRAMS = nbd-client +EXTRA_PROGRAMS = nbd-client knbd-client TESTS = $(srcdir)/simple_test check_PROGRAMS = nbd-tester-client nbd_client_SOURCES = nbd-client.c cliserv.h @@ -23,3 +23,8 @@ nbd-server.5.in: nbd-server.5.sgml mv NBD-SERVER.5 nbd-server.5.in dist-hook: rm -Rf `find $(distdir) -name '.svn' -type d -print` +knbd_client-nbd-client.o: nbd-client.c + $(KLCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(knbd_client_CPPFLAGS) $(CPPFLAGS) $(knbd_client_CFLAGS) $(CFLAGS) -c -o knbd_client-nbd-client.o nbd-client.c +knbd-client$(EXEEXT): knbd_client-nbd-client.o $(knbd_client_DEPENDENCIES) + @rm -f knbd-client$(EXEEXT) + $(LINK) $(knbd_client_LDFLAGS) knbd_client-nbd-client.o $(knbd_client_LDADD) $(LIBS) diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..b20c9ca --- /dev/null +++ b/autogen.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -ex +make -f Makefile.am nbd-server.1.in nbd-server.5.in +exec autoreconf -f -i diff --git a/configure.ac b/configure.ac index 350166a..9cc59e6 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,40 @@ AC_ARG_ENABLE( ] ) +AC_MSG_CHECKING(for klcc) +AC_ARG_WITH( + klcc, + AC_HELP_STRING(--with-klcc,[Build a version of nbd-client against klibc (for initramfs uses). Specify the path to 'klcc' (default autodetected)]), + [ + if test "x$withval" != "x"; then + if test -x "$withval"; then + KLCC="$withval" + sbin_PROGRAMS=knbd-client + AC_MSG_RESULT($KLCC) + else + AC_MSG_ERROR("specified klcc is not executable or does not exist.") + fi + else + if test -x /usr/bin/klcc; then + KLCC=/usr/bin/klcc + sbin_PROGRAMS=knbd-client + AC_MSG_RESULT($KLCC) + else + AC_MSG_ERROR("klcc not found! Please specify it as a parameter to the --with-klcc option"); + fi + fi + ], + [ if test -x /usr/bin/klcc; then + sbin_PROGRAMS=knbd-client + KLCC=/usr/bin/klcc + AC_MSG_RESULT($KLCC) + else + AC_MSG_RESULT(not found) + fi + ] +) +AC_SUBST(KLCC) + AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL @@ -98,7 +132,7 @@ AC_FUNC_FORK AC_FUNC_SETVBUF_REVERSED AC_MSG_CHECKING(whether client should be built) case $host_os in - linux*) sbin_PROGRAMS=nbd-client + linux*) sbin_PROGRAMS="$sbin_PROGRAMS nbd-client" AC_MSG_RESULT(yes) ;; *) AC_MSG_RESULT(no) ;; diff --git a/gznbd/.gitignore b/gznbd/.gitignore new file mode 100644 index 0000000..e550a6a --- /dev/null +++ b/gznbd/.gitignore @@ -0,0 +1 @@ +gznbd diff --git a/gznbd/Makefile b/gznbd/Makefile index bb077d5..6a3778e 100644 --- a/gznbd/Makefile +++ b/gznbd/Makefile @@ -5,3 +5,8 @@ CPPFLAGS += -DTRACE LDLIBS += -lz all: gznbd + +clean: + rm -f gznbd *.o + +.PHONY: all clean diff --git a/gznbd/gznbd.c b/gznbd/gznbd.c index 61f7640..09f3d49 100644 --- a/gznbd/gznbd.c +++ b/gznbd/gznbd.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -49,8 +50,7 @@ /* asm/types defines __u??, at least on my system */ #include -#define u32 __u32 -#define u64 __u64 +#define MY_NAME "gznbd" /* these headers take care of endianness */ #include "../config.h" -- 1.7.10.4