Make it possible to build in a separate directory
authorMatthew Booth <mbooth@redhat.com>
Fri, 3 Jul 2009 10:52:50 +0000 (11:52 +0100)
committerMatthew Booth <mbooth@redhat.com>
Fri, 3 Jul 2009 15:16:51 +0000 (16:16 +0100)
This patch allows you to do:
mkdir build
cd build
../configure ...
make

This will output all generated files to the build directory. Given that
autogen automatically runs configure, you can also do:

BUILDDIR=./build ./autogen.sh

which will do the right thing.

Also:

* Fix a dependency bug which means that guestfs_protocol.h
  isn't automatically rebuilt.
* Re-running autogen.sh with no arguments won't blow away your previous
  configure arguments.

22 files changed:
appliance/Makefile.am
appliance/make.sh.in
appliance/update.sh.in
autogen.sh
capitests/Makefile.am
configure.ac
daemon/Makefile.am
daemon/configure.ac
examples/Makefile.am
fish/Makefile.am
haskell/Makefile.am
images/Makefile.am
inspector/Makefile.am
java/Makefile.am
ocaml/Makefile.am
perl/Makefile.PL.in
perl/Makefile.am
python/Makefile.am
ruby/Makefile.am
ruby/Rakefile.in
src/Makefile.am
src/generator.ml

index e2b0b31..7abee80 100644 (file)
@@ -105,6 +105,7 @@ debirf_symlinks = \
 noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
 $(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
 stamp-debirf-modules:
 noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
 $(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
 stamp-debirf-modules:
+       mkdir -p debian/modules
        for f in $(debirf_symlinks); do \
          ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
        done
        for f in $(debirf_symlinks); do \
          ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
        done
index 57f5223..a132ed8 100755 (executable)
@@ -21,6 +21,7 @@
 unset CDPATH
 
 set -e
 unset CDPATH
 
 set -e
+set -x
 
 if [ "@DIST@" = "REDHAT" ]; then
   cd @top_builddir@
 
 if [ "@DIST@" = "REDHAT" ]; then
   cd @top_builddir@
@@ -65,8 +66,8 @@ if [ "@DIST@" = "REDHAT" ]; then
   # Don't need any keyboard maps.
   @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
 
   # Don't need any keyboard maps.
   @FEBOOTSTRAP_RUN@ initramfs -- rm -rf /lib/kbd
 
-  # Remove anything in home directory.  Because this is potentially
-  # liable to monstrous fuck-ups, we don't put a slash before 'home'.
+  # Remove anything in home directory.  Because of the potential for disaster
+  # we don't put a slash before 'home'.
   (cd initramfs && echo home/*) |
     xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
 
   (cd initramfs && echo home/*) |
     xargs @FEBOOTSTRAP_RUN@ initramfs -- rm -rf
 
index 01e22b6..cdc441b 100755 (executable)
@@ -28,7 +28,7 @@ if [ "@DIST@" = "REDHAT" ]; then
   output=appliance/initramfs.@REPO@.@host_cpu@.img
 
   # Create the init script.
   output=appliance/initramfs.@REPO@.@host_cpu@.img
 
   # Create the init script.
-  @FEBOOTSTRAP_INSTALL@ initramfs appliance/init /init 0755 root.root
+  @FEBOOTSTRAP_INSTALL@ initramfs appliance/@top_srcdir@/appliance/init /init 0755 root.root
 
   # Copy the daemon into the filesystem.
   @FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
 
   # Copy the daemon into the filesystem.
   @FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
index a1d7e27..ba4612c 100755 (executable)
 
 set -e
 set -v
 
 set -e
 set -v
-export AUTOMAKE='automake --foreign'
+
 mkdir -p daemon/m4
 mkdir -p daemon/m4
-aclocal
-libtoolize
-autoreconf -i
-pushd daemon
 autoreconf -i
 autoreconf -i
-popd
-./configure "$@"
+
+CONFIGUREDIR=.
+
+# Run configure in BUILDDIR if it's set
+if [ ! -z "$BUILDDIR" ]; then
+    mkdir -p $BUILDDIR
+    cd $BUILDDIR
+
+    CONFIGUREDIR=..
+fi
+
+# If no arguments were specified and configure has run before, use the previous
+# arguments
+if [ $# == 0 -a -x ./config.status ]; then
+    ./config.status --recheck
+else
+    $CONFIGUREDIR/configure "$@"
+fi
index 5a10a92..dd2e556 100644 (file)
@@ -24,8 +24,7 @@ EXTRA_DIST = \
 check_PROGRAMS = tests test-command
 
 tests_SOURCES = tests.c
 check_PROGRAMS = tests test-command
 
 tests_SOURCES = tests.c
-tests_CFLAGS = \
-       -I$(top_builddir)/src -Wall
+tests_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
 tests_LDADD = $(top_builddir)/src/libguestfs.la
 
 TESTS = tests
 tests_LDADD = $(top_builddir)/src/libguestfs.la
 
 TESTS = tests
index 4a57fa3..f0eba8a 100644 (file)
@@ -16,7 +16,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 AC_INIT([libguestfs],[1.0.55])
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 AC_INIT([libguestfs],[1.0.55])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 
 AC_CONFIG_MACRO_DIR([m4])
 
 
 AC_CONFIG_MACRO_DIR([m4])
 
index 141dfad..846a95c 100644 (file)
@@ -67,7 +67,7 @@ guestfsd_SOURCES = \
        wc.c \
        zero.c \
        zerofree.c \
        wc.c \
        zero.c \
        zerofree.c \
-       ../src/guestfs_protocol.h \
-       ../src/guestfs_protocol.c
+       $(top_builddir)/../src/guestfs_protocol.h \
+       $(top_builddir)/../src/guestfs_protocol.c
 
 guestfsd_CFLAGS = -Wall
 
 guestfsd_CFLAGS = -Wall
index 6ecbb8a..238532e 100644 (file)
@@ -16,7 +16,7 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 AC_INIT([libguestfs-daemon],[1.0.0])
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 AC_INIT([libguestfs-daemon],[1.0.0])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([foreign])
 
 AC_CONFIG_MACRO_DIR([m4])
 
 
 AC_CONFIG_MACRO_DIR([m4])
 
index 13302d9..fb3d656 100644 (file)
@@ -3,11 +3,11 @@
 noinst_PROGRAMS = hello to-xml
 
 hello_SOURCES = hello.c
 noinst_PROGRAMS = hello to-xml
 
 hello_SOURCES = hello.c
-hello_CFLAGS = -I$(top_builddir)/src -Wall
+hello_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
 hello_LDADD = $(top_builddir)/src/libguestfs.la
 
 to_xml_SOURCES = to-xml.c
 hello_LDADD = $(top_builddir)/src/libguestfs.la
 
 to_xml_SOURCES = to-xml.c
-to_xml_CFLAGS = -I$(top_builddir)/src -Wall
+to_xml_CFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src -Wall
 to_xml_LDADD = $(top_builddir)/src/libguestfs.la
 
 CLEANFILES = $(noinst_PROGRAMS)
 to_xml_LDADD = $(top_builddir)/src/libguestfs.la
 
 CLEANFILES = $(noinst_PROGRAMS)
index 03e872c..1439a5d 100644 (file)
@@ -32,6 +32,6 @@ guestfish_SOURCES = \
        time.c
 
 guestfish_CFLAGS = \
        time.c
 
 guestfish_CFLAGS = \
-       -I$(top_builddir)/src -Wall \
+       -I$(top_srcdir)/src -I$(top_builddir)/src -Wall \
        -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"'
 guestfish_LDADD = $(top_builddir)/src/libguestfs.la $(LIBREADLINE)
        -DGUESTFS_DEFAULT_PATH='"$(libdir)/guestfs"'
 guestfish_LDADD = $(top_builddir)/src/libguestfs.la $(LIBREADLINE)
index 3cb721f..dcaf18a 100644 (file)
@@ -30,7 +30,7 @@ TESTS = run-bindtests Guestfs005Load Guestfs010Launch Guestfs050LVCreate
 
 check_DATA = Bindtests
 
 
 check_DATA = Bindtests
 
-GHCFLAGS = -I$(abs_top_builddir)/src -L$(abs_top_builddir)/src/.libs
+GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs
 
 Bindtests: Bindtests.hs Guestfs.hs
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
 Bindtests: Bindtests.hs Guestfs.hs
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
@@ -44,4 +44,4 @@ Guestfs010Launch: Guestfs010Launch.hs Guestfs.hs
 Guestfs050LVCreate: Guestfs050LVCreate.hs Guestfs.hs
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
 Guestfs050LVCreate: Guestfs050LVCreate.hs Guestfs.hs
        $(GHC)  $(GHCFLAGS) -main-is $(shell basename $@) --make -o $@ $< -lguestfs
 
-endif
\ No newline at end of file
+endif
index 8855382..9353e17 100644 (file)
@@ -28,9 +28,23 @@ CLEANFILES = \
        100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
        initrd
 
        100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
        initrd
 
-squash_files = helloworld.tar helloworld.tar.gz empty known-1 known-2 known-3 \
-       100kallzeroes 100kallnewlines 100kallspaces 100krandom 10klines \
-       initrd
+squash_files_src = \
+    $(srcdir)/helloworld.tar \
+    $(srcdir)/helloworld.tar.gz \
+    $(srcdir)/empty \
+    $(srcdir)/known-1 \
+    $(srcdir)/known-2 \
+    $(srcdir)/known-3
+
+squash_files_build = \
+    $(builddir)/100kallzeroes \
+    $(builddir)/100kallnewlines \
+    $(builddir)/100kallspaces \
+    $(builddir)/100krandom \
+    $(builddir)/10klines \
+    $(builddir)/initrd
+
+squash_files = $(squash_files_src) $(squash_files_build)
 
 test.sqsh: $(squash_files)
        rm -f $@
 
 test.sqsh: $(squash_files)
        rm -f $@
index b43870d..a1df2ab 100644 (file)
@@ -23,7 +23,7 @@ if HAVE_INSPECTOR
 
 man_MANS = virt-inspector.1
 
 
 man_MANS = virt-inspector.1
 
-noinst_DATA = ../html/virt-inspector.1.html
+noinst_DATA = @top_builddir@/html/virt-inspector.1.html
 
 virt-inspector.1: virt-inspector.pl
        $(POD2MAN) \
 
 virt-inspector.1: virt-inspector.pl
        $(POD2MAN) \
@@ -32,8 +32,9 @@ virt-inspector.1: virt-inspector.pl
          --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
          $< > $@
 
          --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \
          $< > $@
 
-../html/virt-inspector.1.html: virt-inspector.pl
-       cd .. && pod2html \
+@top_builddir@/html/virt-inspector.1.html: virt-inspector.pl
+       mkdir -p @top_builddir@/html
+       cd @top_builddir@ && pod2html \
          --css 'pod.css' \
          --title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
          --htmldir html \
          --css 'pod.css' \
          --title 'virt-inspector, display OS version, kernel, drivers, mount points, applications, etc. in a virtual machine' \
          --htmldir html \
index ea90a48..b682747 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-CPTH = com/redhat/et/libguestfs
+java_prefix = com/redhat/et/libguestfs
 
 java_sources = \
 
 java_sources = \
-       $(CPTH)/LibGuestFSException.java \
-       $(CPTH)/IntBool.java \
-       $(CPTH)/PV.java \
-       $(CPTH)/VG.java \
-       $(CPTH)/LV.java \
-       $(CPTH)/Stat.java \
-       $(CPTH)/StatVFS.java \
-       $(CPTH)/Dirent.java \
-       $(CPTH)/GuestFS.java
+       $(java_prefix)/LibGuestFSException.java \
+       $(java_prefix)/IntBool.java \
+       $(java_prefix)/PV.java \
+       $(java_prefix)/VG.java \
+       $(java_prefix)/LV.java \
+       $(java_prefix)/Stat.java \
+       $(java_prefix)/StatVFS.java \
+       $(java_prefix)/Dirent.java \
+       $(java_prefix)/GuestFS.java
 
 java_tests = \
        Bindtests.java \
 
 java_tests = \
        Bindtests.java \
@@ -50,7 +50,7 @@ libguestfs_jardir = $(JAR_INSTALL_DIR)
 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
 libguestfs_jar_class_files = $(java_sources:.java=.class)
 $(libguestfs_jar_class_files): %.class: %.java
 libguestfs_jar_DATA = libguestfs-${VERSION}.jar
 libguestfs_jar_class_files = $(java_sources:.java=.class)
 $(libguestfs_jar_class_files): %.class: %.java
-       $(JAVAC) $(JAVAC_FLAGS) -classpath $(CPTH) $(java_sources)
+       $(JAVAC) $(JAVAC_FLAGS) -d @builddir@ -classpath @srcdir@:@builddir@ -sourcepath @srcdir@:@builddir@ $<
 
 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
        $(JAR) cf $@ $^
 
 libguestfs-${VERSION}.jar: $(libguestfs_jar_class_files)
        $(JAR) cf $@ $^
@@ -64,12 +64,12 @@ libguestfs_jni_la_SOURCES = \
 
 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
 
 libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO)
-libguestfs_jni_la_CFLAGS = -Wall -I$(top_builddir)/src $(JNI_CFLAGS)
+libguestfs_jni_la_CFLAGS = -Wall -I$(top_srcdir)/src -I$(top_builddir)/src $(JNI_CFLAGS)
 
 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
 
 
 BUILT_SOURCES = com_redhat_et_libguestfs_GuestFS.h
 
-com_redhat_et_libguestfs_GuestFS.h: $(CPTH)/GuestFS.class
-       $(JAVAH) -classpath .:$(CPTH) com.redhat.et.libguestfs.GuestFS
+com_redhat_et_libguestfs_GuestFS.h: $(java_prefix)/GuestFS.class
+       $(JAVAH) -classpath @srcdir@:@builddir@ com.redhat.et.libguestfs.GuestFS
 
 # Documentation.
 
 
 # Documentation.
 
index bed1f92..bf9760c 100644 (file)
@@ -39,10 +39,10 @@ mlguestfs.cmxa: guestfs_c.o guestfs_c_actions.o guestfs.cmx
        $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
 
 guestfs_c.o: guestfs_c.c
        $(OCAMLMKLIB) -o mlguestfs $^ -L$(top_builddir)/src/.libs -lguestfs
 
 guestfs_c.o: guestfs_c.c
-       $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
+       $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml -I$(top_srcdir)/src -I$(top_builddir)/src -fPIC -Wall -c $<
 
 guestfs_c_actions.o: guestfs_c_actions.c
 
 guestfs_c_actions.o: guestfs_c_actions.c
-       $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_builddir)/src -fPIC -Wall -c $<
+       $(CC) $(CFLAGS) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml -I$(top_srcdir)/src -I$(top_builddir)/src -fPIC -Wall -c $<
 
 TESTS_ENVIRONMENT = \
        LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
 
 TESTS_ENVIRONMENT = \
        LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
@@ -60,15 +60,19 @@ bindtests: bindtests.ml mlguestfs.cmxa
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_005_load: t/guestfs_005_load.ml mlguestfs.cmxa
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_005_load: t/guestfs_005_load.ml mlguestfs.cmxa
+       mkdir -p t
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_010_launch: t/guestfs_010_launch.ml mlguestfs.cmxa
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_010_launch: t/guestfs_010_launch.ml mlguestfs.cmxa
+       mkdir -p t
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.ml mlguestfs.cmxa
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_050_lvcreate: t/guestfs_050_lvcreate.ml mlguestfs.cmxa
+       mkdir -p t
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_060_readdir: t/guestfs_060_readdir.ml mlguestfs.cmxa
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 t/guestfs_060_readdir: t/guestfs_060_readdir.ml mlguestfs.cmxa
+       mkdir -p t
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 .mli.cmi:
        $(OCAMLFIND) ocamlopt -cclib -L$(top_builddir)/src/.libs -I . unix.cmxa mlguestfs.cmxa $< -o $@
 
 .mli.cmi:
index 40d1d6c..d18aba6 100644 (file)
@@ -23,7 +23,8 @@ WriteMakefile (
     NAME => 'Sys::Guestfs',
     VERSION => '@PACKAGE_VERSION@',
 
     NAME => 'Sys::Guestfs',
     VERSION => '@PACKAGE_VERSION@',
 
-    LIBS => '-L@abs_top_builddir@/src/.libs -lguestfs',
-    INC => '-I@abs_top_builddir@/src',
+    LIBS => '-L@top_builddir@/src/.libs -lguestfs',
+    INC => '-I@top_builddir@/src -I@top_srcdir@/src',
+    TYPEMAPS => [ '@srcdir@/typemap' ],
     CCFLAGS => '@CFLAGS@',
     );
     CCFLAGS => '@CFLAGS@',
     );
index 747ac43..66d1d4b 100644 (file)
@@ -36,8 +36,8 @@ if HAVE_PERL
 TESTS = run-bindtests run-perl-tests
 
 TESTS_ENVIRONMENT = \
 TESTS = run-bindtests run-perl-tests
 
 TESTS_ENVIRONMENT = \
-       LD_LIBRARY_PATH=../src/.libs \
-       LIBGUESTFS_PATH=../appliance
+       LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+       LIBGUESTFS_PATH=$(top_builddir)/appliance
 
 INSTALLDIRS = site
 
 
 INSTALLDIRS = site
 
index dcd0625..2928f98 100644 (file)
@@ -32,12 +32,13 @@ python_DATA = guestfs.py
 python_LTLIBRARIES = libguestfsmod.la
 
 libguestfsmod_la_SOURCES = guestfs-py.c
 python_LTLIBRARIES = libguestfsmod.la
 
 libguestfsmod_la_SOURCES = guestfs-py.c
-libguestfsmod_la_CFLAGS = -Wall -I$(PYTHON_INCLUDEDIR) -I$(top_builddir)/src
+libguestfsmod_la_CFLAGS = -Wall -I$(PYTHON_INCLUDEDIR) \
+                         -I$(top_srcdir)/src -I$(top_builddir)/src
 libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
 
 TESTS_ENVIRONMENT = \
        LIBGUESTFS_PATH=$(top_builddir)/appliance \
 libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
 
 TESTS_ENVIRONMENT = \
        LIBGUESTFS_PATH=$(top_builddir)/appliance \
-       PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs
+       PYTHONPATH=$(builddir):$(builddir)/.libs
 
 TESTS = run-bindtests run-python-tests
 
 
 TESTS = run-bindtests run-python-tests
 
index 389399f..7ea0107 100644 (file)
@@ -40,10 +40,10 @@ if HAVE_RUBY
 TESTS = run-bindtests run-ruby-tests
 
 TESTS_ENVIRONMENT = \
 TESTS = run-bindtests run-ruby-tests
 
 TESTS_ENVIRONMENT = \
-       LD_LIBRARY_PATH=../src/.libs \
-       LIBGUESTFS_PATH=../appliance
+       LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+       LIBGUESTFS_PATH=$(top_builddir)/appliance
 
 all:
        rake build
 
 
 all:
        rake build
 
-endif
\ No newline at end of file
+endif
index 67f6b17..076efd8 100644 (file)
@@ -24,26 +24,24 @@ require 'rake/gempackagetask'
 PKG_NAME='@PACKAGE_NAME@'
 PKG_VERSION='@PACKAGE_VERSION@'
 
 PKG_NAME='@PACKAGE_NAME@'
 PKG_VERSION='@PACKAGE_VERSION@'
 
-EXT_CONF='ext/guestfs/extconf.rb'
-MAKEFILE='ext/guestfs/Makefile'
-GUESTFS_MODULE='ext/guestfs/_guestfs.so'
-GUESTFS_SRC='ext/guestfs/_guestfs.c'
+EXT_CONF='@srcdir@/ext/guestfs/extconf.rb'
+MAKEFILE='@builddir@/ext/guestfs/Makefile'
+GUESTFS_MODULE='@builddir@/ext/guestfs/_guestfs.so'
+GUESTFS_SRC='@builddir@/ext/guestfs/_guestfs.c'
 
 
-CLEAN.include [ "ext/**/*.o", GUESTFS_MODULE,
-                "ext/**/depend" ]
+CLEAN.include [ "@builddir@/ext/**/*.o", GUESTFS_MODULE,
+                "@builddir@/ext/**/depend" ]
 
 
-CLOBBER.include [ "config.save", "ext/**/mkmf.log",
+CLOBBER.include [ "@builddir@/config.save", "@builddir@/ext/**/mkmf.log",
                   MAKEFILE ]
 
 # Build locally
 
 file MAKEFILE => EXT_CONF do |t|
                   MAKEFILE ]
 
 # Build locally
 
 file MAKEFILE => EXT_CONF do |t|
-    Dir::chdir(File::dirname(EXT_CONF)) do
-         unless sh "ruby #{File::basename(EXT_CONF)} --with-_guestfs-include=../../../src --with-_guestfs-lib=../../../src/.libs"
-             $stderr.puts "Failed to run extconf"
-             break
-         end
-    end
+     unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; cd #{File::dirname(EXT_CONF)}; ruby #{File::basename(EXT_CONF)} --with-_guestfs-include=$top_srcdir --with-_guestfs-lib=$top_builddir/src/.libs"
+         $stderr.puts "Failed to run extconf"
+         break
+     end
 end
 file GUESTFS_MODULE => [ MAKEFILE, GUESTFS_SRC ] do |t|
     Dir::chdir(File::dirname(EXT_CONF)) do
 end
 file GUESTFS_MODULE => [ MAKEFILE, GUESTFS_SRC ] do |t|
     Dir::chdir(File::dirname(EXT_CONF)) do
index 1c0fa0a..9dc8e99 100644 (file)
@@ -30,8 +30,10 @@ EXTRA_DIST = \
 noinst_DATA = stamp-generator
 
 stamp-generator: generator.ml
 noinst_DATA = stamp-generator
 
 stamp-generator: generator.ml
-       mkdir -p $(top_srcdir)/perl/lib/Sys
-       cd .. && ocaml -warn-error A $(srcdir)/src/$<
+       mkdir -p $(top_builddir)/perl/lib/Sys
+       mkdir -p $(top_builddir)/ruby/ext/guestfs
+       mkdir -p $(top_builddir)/java/com/redhat/et/libguestfs
+       cd $(top_builddir) && ocaml -warn-error A ./src/$<
 
 guestfs_protocol.x: stamp-generator
 
 
 guestfs_protocol.x: stamp-generator
 
@@ -83,6 +85,8 @@ lib_LTLIBRARIES = libguestfs.la
 
 BUILT_SOURCES = \
   guestfs_protocol.x \
 
 BUILT_SOURCES = \
   guestfs_protocol.x \
+  guestfs_protocol.c \
+  guestfs_protocol.h \
   guestfs-structs.h \
   guestfs-actions.h \
   guestfs-actions.c \
   guestfs-structs.h \
   guestfs-actions.h \
   guestfs-actions.c \
index 5c9e1c3..e86fce1 100755 (executable)
@@ -8607,7 +8607,7 @@ let output_to filename =
 let () =
   check_functions ();
 
 let () =
   check_functions ();
 
-  if not (Sys.file_exists "configure.ac") then (
+  if not (Sys.file_exists "config.status") then (
     eprintf "\
 You are probably running this from the wrong directory.
 Run it from the top source directory using the command
     eprintf "\
 You are probably running this from the wrong directory.
 Run it from the top source directory using the command