[Libguestfs] [PATCH v2 3/7] Rename src/ to lib/

Richard W.M. Jones rjones at redhat.com
Wed Jan 25 14:37:12 UTC 2017


---
 .gitignore                               |  40 ++++-----
 Makefile.am                              |   2 +-
 align/Makefile.am                        |   4 +-
 builder/Makefile.am                      |   8 +-
 cat/Makefile.am                          |  20 ++---
 cfg.mk                                   |   2 +-
 common/protocol/Makefile.am              |   2 +-
 common/utils/Makefile.am                 |   4 +-
 common/utils/guestfs-internal-frontend.h |   2 +-
 common/utils/utils.c                     |   2 +-
 configure.ac                             |   4 +-
 contrib/README                           |   2 +-
 contrib/windows-icons.pl                 |   2 +-
 customize/Makefile.am                    |   6 +-
 daemon/Makefile.am                       |   4 +-
 df/Makefile.am                           |   4 +-
 dib/Makefile.am                          |   6 +-
 diff/Makefile.am                         |   4 +-
 docs/C_SOURCE_FILES                      | 142 +++++++++++++++----------------
 docs/guestfs-hacking.pod                 |  16 ++--
 docs/make-internal-documentation.pl      |   8 +-
 edit/Makefile.am                         |   4 +-
 erlang/Makefile.am                       |   4 +-
 examples/Makefile.am                     |  34 ++++----
 fish/Makefile.am                         |   8 +-
 format/Makefile.am                       |   4 +-
 fuse/Makefile.am                         |  20 ++---
 generator/actions.ml                     |   4 +-
 generator/actions.mli                    |   2 +-
 generator/main.ml                        |  30 +++----
 get-kernel/Makefile.am                   |   6 +-
 gobject/Makefile.am                      |   8 +-
 haskell/Makefile.am                      |   4 +-
 inspector/Makefile.am                    |   4 +-
 installcheck.sh.in                       |  10 +--
 java/Makefile.am                         |   4 +-
 {src => lib}/MAX_PROC_NR                 |   0
 {src => lib}/Makefile.am                 |   2 +-
 {src => lib}/actions-support.c           |   2 +-
 {src => lib}/alloc.c                     |   0
 {src => lib}/appliance-cpu.c             |   0
 {src => lib}/appliance-kcmdline.c        |   0
 {src => lib}/appliance-uefi.c            |   0
 {src => lib}/appliance.c                 |   0
 {src => lib}/available.c                 |   0
 {src => lib}/canonical-name.c            |   0
 {src => lib}/command.c                   |   0
 {src => lib}/conn-socket.c               |   0
 {src => lib}/copy-in-out.c               |   0
 {src => lib}/create.c                    |   0
 {src => lib}/dbdump.c                    |   0
 {src => lib}/drives.c                    |   0
 {src => lib}/errors.c                    |   0
 {src => lib}/events.c                    |   0
 {src => lib}/file.c                      |   0
 {src => lib}/filearch.c                  |   0
 {src => lib}/fuse.c                      |   0
 {src => lib}/guestfs-internal-all.h      |   4 +-
 {src => lib}/guestfs-internal.h          |  12 +--
 {src => lib}/guestfs.pod                 |   0
 {src => lib}/guid.c                      |   0
 {src => lib}/handle.c                    |   0
 {src => lib}/info.c                      |   0
 {src => lib}/inspect-apps.c              |   0
 {src => lib}/inspect-fs-cd.c             |   0
 {src => lib}/inspect-fs-unix.c           |   0
 {src => lib}/inspect-fs-windows.c        |   0
 {src => lib}/inspect-fs.c                |   0
 {src => lib}/inspect-icon.c              |   0
 {src => lib}/inspect.c                   |   2 +-
 {src => lib}/journal.c                   |   0
 {src => lib}/launch-direct.c             |   0
 {src => lib}/launch-libvirt.c            |   0
 {src => lib}/launch-uml.c                |   0
 {src => lib}/launch-unix.c               |   0
 {src => lib}/launch.c                    |   4 +-
 {src => lib}/libguestfs.pc.in            |   0
 {src => lib}/libvirt-auth.c              |   0
 {src => lib}/libvirt-domain.c            |   0
 {src => lib}/libvirt-is-version.c        |   0
 {src => lib}/listfs.c                    |   0
 {src => lib}/lpj.c                       |   0
 {src => lib}/match.c                     |   0
 {src => lib}/mountable.c                 |   0
 {src => lib}/osinfo.c                    |   0
 {src => lib}/private-data.c              |   0
 {src => lib}/proto.c                     |   2 +-
 {src => lib}/qemu.c                      |   0
 {src => lib}/stringsbuf.c                |   0
 {src => lib}/tmpdirs.c                   |   0
 {src => lib}/tsk.c                       |   0
 {src => lib}/umask.c                     |   0
 {src => lib}/unit-tests.c                |   2 +-
 {src => lib}/version.c                   |   0
 {src => lib}/wait.c                      |   0
 {src => lib}/whole-file.c                |   0
 lua/Makefile.am                          |   4 +-
 m4/guestfs_libraries.m4                  |   2 +-
 make-fs/Makefile.am                      |   4 +-
 mllib/Makefile.am                        |  10 +--
 ocaml/Makefile.am                        |  10 +--
 ocaml/examples/Makefile.am               |   2 +-
 p2v/Makefile.am                          |   4 +-
 p2v/conversion.c                         |   2 +-
 perl/Build.PL.in                         |   6 +-
 php/Makefile.am                          |   4 +-
 po/POTFILES                              | 138 +++++++++++++++---------------
 python/Makefile.am                       |   6 +-
 python/setup.py.in                       |   2 +-
 rescue/Makefile.am                       |   4 +-
 resize/Makefile.am                       |   6 +-
 ruby/Rakefile.in                         |   2 +-
 run.in                                   |  12 +--
 sparsify/Makefile.am                     |   6 +-
 sysprep/Makefile.am                      |   6 +-
 test-tool/Makefile.am                    |   4 +-
 tests/c-api/Makefile.am                  |  60 ++++++-------
 tests/charsets/Makefile.am               |   4 +-
 tests/disks/test-qemu-drive-libvirt.sh   |   4 +-
 tests/events/Makefile.am                 |   4 +-
 tests/mount-local/Makefile.am            |   4 +-
 tests/mountable/Makefile.am              |   4 +-
 tests/parallel/Makefile.am               |   4 +-
 tests/protocol/Makefile.am               |   4 +-
 tests/regressions/Makefile.am            |  22 ++---
 tests/regressions/rhbz1044014.sh         |   4 +-
 utils/boot-analysis/Makefile.am          |   4 +-
 utils/boot-benchmark/Makefile.am         |   4 +-
 utils/qemu-boot/Makefile.am              |   4 +-
 utils/qemu-speed-test/Makefile.am        |   4 +-
 v2v/Makefile.am                          |   8 +-
 v2v/domainxml-c.c                        |   2 +-
 v2v/test-harness/Makefile.am             |   6 +-
 133 files changed, 418 insertions(+), 422 deletions(-)
 rename {src => lib}/MAX_PROC_NR (100%)
 rename {src => lib}/Makefile.am (99%)
 rename {src => lib}/actions-support.c (97%)
 rename {src => lib}/alloc.c (100%)
 rename {src => lib}/appliance-cpu.c (100%)
 rename {src => lib}/appliance-kcmdline.c (100%)
 rename {src => lib}/appliance-uefi.c (100%)
 rename {src => lib}/appliance.c (100%)
 rename {src => lib}/available.c (100%)
 rename {src => lib}/canonical-name.c (100%)
 rename {src => lib}/command.c (100%)
 rename {src => lib}/conn-socket.c (100%)
 rename {src => lib}/copy-in-out.c (100%)
 rename {src => lib}/create.c (100%)
 rename {src => lib}/dbdump.c (100%)
 rename {src => lib}/drives.c (100%)
 rename {src => lib}/errors.c (100%)
 rename {src => lib}/events.c (100%)
 rename {src => lib}/file.c (100%)
 rename {src => lib}/filearch.c (100%)
 rename {src => lib}/fuse.c (100%)
 rename {src => lib}/guestfs-internal-all.h (97%)
 rename {src => lib}/guestfs-internal.h (99%)
 rename {src => lib}/guestfs.pod (100%)
 rename {src => lib}/guid.c (100%)
 rename {src => lib}/handle.c (100%)
 rename {src => lib}/info.c (100%)
 rename {src => lib}/inspect-apps.c (100%)
 rename {src => lib}/inspect-fs-cd.c (100%)
 rename {src => lib}/inspect-fs-unix.c (100%)
 rename {src => lib}/inspect-fs-windows.c (100%)
 rename {src => lib}/inspect-fs.c (100%)
 rename {src => lib}/inspect-icon.c (100%)
 rename {src => lib}/inspect.c (99%)
 rename {src => lib}/journal.c (100%)
 rename {src => lib}/launch-direct.c (100%)
 rename {src => lib}/launch-libvirt.c (100%)
 rename {src => lib}/launch-uml.c (100%)
 rename {src => lib}/launch-unix.c (100%)
 rename {src => lib}/launch.c (98%)
 rename {src => lib}/libguestfs.pc.in (100%)
 rename {src => lib}/libvirt-auth.c (100%)
 rename {src => lib}/libvirt-domain.c (100%)
 rename {src => lib}/libvirt-is-version.c (100%)
 rename {src => lib}/listfs.c (100%)
 rename {src => lib}/lpj.c (100%)
 rename {src => lib}/match.c (100%)
 rename {src => lib}/mountable.c (100%)
 rename {src => lib}/osinfo.c (100%)
 rename {src => lib}/private-data.c (100%)
 rename {src => lib}/proto.c (99%)
 rename {src => lib}/qemu.c (100%)
 rename {src => lib}/stringsbuf.c (100%)
 rename {src => lib}/tmpdirs.c (100%)
 rename {src => lib}/tsk.c (100%)
 rename {src => lib}/umask.c (100%)
 rename {src => lib}/unit-tests.c (99%)
 rename {src => lib}/version.c (100%)
 rename {src => lib}/wait.c (100%)
 rename {src => lib}/whole-file.c (100%)

diff --git a/.gitignore b/.gitignore
index f7d7864..ff6bbbb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -305,6 +305,26 @@ Makefile.in
 /java/doc-stamp
 /java/examples/guestfs-java.3
 /java/examples/stamp-guestfs-java.pod
+/lib/actions-?.c
+/lib/actions-variants.c
+/lib/bindtests.c
+/lib/event-string.c
+/lib/guestfs.3
+/lib/guestfs-actions.pod
+/lib/guestfs-availability.pod
+/lib/guestfs.h
+/lib/guestfs-internal-actions.h
+/lib/guestfs-structs.pod
+/lib/libguestfs.3
+/lib/libguestfs.pc
+/lib/libguestfs.syms
+/lib/.libs/libguestfs.so
+/lib/libvirt-is-version
+/lib/stamp-guestfs.pod
+/lib/structs-compare.c
+/lib/structs-copy.c
+/lib/structs-free.c
+/lib/unit-tests
 /libguestfs.spec
 /libguestfs-*.tar.gz
 /libtool
@@ -498,26 +518,6 @@ Makefile.in
 /sparsify/stamp-virt-sparsify.pod
 /sparsify/virt-sparsify
 /sparsify/virt-sparsify.1
-/src/actions-?.c
-/src/actions-variants.c
-/src/bindtests.c
-/src/event-string.c
-/src/guestfs.3
-/src/guestfs-actions.pod
-/src/guestfs-availability.pod
-/src/guestfs.h
-/src/guestfs-internal-actions.h
-/src/guestfs-structs.pod
-/src/libguestfs.3
-/src/libguestfs.pc
-/src/libguestfs.syms
-/src/.libs/libguestfs.so
-/src/libvirt-is-version
-/src/stamp-guestfs.pod
-/src/structs-compare.c
-/src/structs-copy.c
-/src/structs-free.c
-/src/unit-tests
 /stamp-h1
 /sysprep/.depend
 /sysprep/stamp-script1.sh
diff --git a/Makefile.am b/Makefile.am
index 5910a09..8267e64 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,7 +39,7 @@ endif
 
 # Basic source for the library.
 SUBDIRS += common/errnostring common/protocol common/utils
-SUBDIRS += src docs examples po
+SUBDIRS += lib docs examples po
 
 # The daemon and the appliance.
 if ENABLE_DAEMON
diff --git a/align/Makefile.am b/align/Makefile.am
index 86975a3..0568efb 100644
--- a/align/Makefile.am
+++ b/align/Makefile.am
@@ -40,7 +40,7 @@ virt_alignment_scan_SOURCES = \
 virt_alignment_scan_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/df \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
@@ -54,7 +54,7 @@ virt_alignment_scan_CFLAGS = \
 
 virt_alignment_scan_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 85c754f..d56b394 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -101,7 +101,7 @@ virt_builder_CPPFLAGS = \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 virt_builder_CFLAGS = \
 	-pthread \
@@ -115,13 +115,13 @@ virt_builder_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib \
@@ -337,7 +337,7 @@ virt_index_validate_CPPFLAGS = \
 	-I$(top_builddir) \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 virt_index_validate_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	-Wno-unused-macros
diff --git a/cat/Makefile.am b/cat/Makefile.am
index 66d9356..4ebcdac 100644
--- a/cat/Makefile.am
+++ b/cat/Makefile.am
@@ -44,7 +44,7 @@ virt_cat_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -54,7 +54,7 @@ virt_cat_CFLAGS = \
 
 virt_cat_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
@@ -69,7 +69,7 @@ virt_filesystems_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -79,7 +79,7 @@ virt_filesystems_CFLAGS = \
 
 virt_filesystems_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
@@ -94,7 +94,7 @@ virt_log_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -104,7 +104,7 @@ virt_log_CFLAGS = \
 
 virt_log_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
@@ -121,7 +121,7 @@ virt_ls_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -131,7 +131,7 @@ virt_ls_CFLAGS = \
 
 virt_ls_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
@@ -146,7 +146,7 @@ virt_tail_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -156,7 +156,7 @@ virt_tail_CFLAGS = \
 
 virt_tail_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/cfg.mk b/cfg.mk
index 4cb307a..8ad9b95 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -33,7 +33,7 @@ exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^test-data/|\.patch$|
 exclude_file_name_regexp--sc_prohibit_magic_number_exit = ^(po|po-docs)/|\.pod$|^fuse/guestunmount\.c
 exclude_file_name_regexp--sc_prohibit_strcmp = ^(examples|po-docs)/|\.pod$
 exclude_file_name_regexp--sc_prohibit_strcmp_and_strncmp = ^(examples|po-docs)/|\.pod$
-exclude_file_name_regexp--sc_prohibit_strncpy = ^src/launch-.*\.c$
+exclude_file_name_regexp--sc_prohibit_strncpy = ^lib/launch-.*\.c$
 exclude_file_name_regexp--sc_require_config_h = ^examples/|^tests/c-api/test-just-header\.c$
 exclude_file_name_regexp--sc_require_config_h_first = ^examples/|^tests/c-api/test-just-header\.c$|^python/guestfs-py-byhand\.c$
 
diff --git a/common/protocol/Makefile.am b/common/protocol/Makefile.am
index 079580c..c426f26 100644
--- a/common/protocol/Makefile.am
+++ b/common/protocol/Makefile.am
@@ -49,7 +49,7 @@ endif
 guestfs_protocol.c: guestfs_protocol.x
 	rm -f $@-t $@-t2
 	$(RPCGEN) $(RPCGEN_DEFS) -c -o $@-t $<
-	$(SED) 's,\.\./\(\.\./\)*src,.,' < $@-t > $@-t2
+	$(SED) 's,\.\./\(\.\./\)*lib,.,' < $@-t > $@-t2
 	rm $@-t
 	mv $@-t2 $@
 
diff --git a/common/utils/Makefile.am b/common/utils/Makefile.am
index d1ad261..fa1ca94 100644
--- a/common/utils/Makefile.am
+++ b/common/utils/Makefile.am
@@ -33,7 +33,7 @@ EXTRA_DIST = \
 noinst_LTLIBRARIES = libutils.la
 
 libutils_la_SOURCES = \
-	../src/guestfs.h \
+	../lib/guestfs.h \
 	cleanup.c \
 	guestfs-internal-frontend.h \
 	guestfs-internal-frontend-cleanups.h \
@@ -46,7 +46,7 @@ libutils_la_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 libutils_la_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(GCC_VISIBILITY_HIDDEN) \
diff --git a/common/utils/guestfs-internal-frontend.h b/common/utils/guestfs-internal-frontend.h
index e2598ca..3b57204 100644
--- a/common/utils/guestfs-internal-frontend.h
+++ b/common/utils/guestfs-internal-frontend.h
@@ -22,7 +22,7 @@
  *
  * The daemon does B<not> use this header.  If you need a place to put
  * something shared with absolutely everything including the daemon,
- * put it in F<src/guestfs-internal-all.h>
+ * put it in F<lib/guestfs-internal-all.h>
  *
  * If a definition is only needed by a single component of libguestfs
  * (eg. just the library, or just a single virt tool) then it should
diff --git a/common/utils/utils.c b/common/utils/utils.c
index 252c6f9..bdc8449 100644
--- a/common/utils/utils.c
+++ b/common/utils/utils.c
@@ -366,7 +366,7 @@ guestfs_int_is_true (const char *str)
 /**
  * Check a string for validity, that it contains only certain
  * characters, and minimum and maximum length.  This function is
- * usually wrapped in a VALID_* macro, see F<src/drives.c> for an
+ * usually wrapped in a VALID_* macro, see F<lib/drives.c> for an
  * example.
  *
  * C<str> is the string to check.
diff --git a/configure.ac b/configure.ac
index 2cf0fde..c7efbea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,6 +211,8 @@ AC_CONFIG_FILES([Makefile
                  inspector/Makefile
                  java/Makefile
                  java/examples/Makefile
+                 lib/Makefile
+                 lib/libguestfs.pc
                  lua/Makefile
                  lua/examples/Makefile
                  make-fs/Makefile
@@ -238,8 +240,6 @@ AC_CONFIG_FILES([Makefile
                  ruby/examples/Makefile
                  ruby/ext/guestfs/extconf.rb
                  sparsify/Makefile
-                 src/Makefile
-                 src/libguestfs.pc
                  sysprep/Makefile
                  test-data/Makefile
                  test-data/binaries/Makefile
diff --git a/contrib/README b/contrib/README
index 6a7acca..fb359f9 100644
--- a/contrib/README
+++ b/contrib/README
@@ -21,7 +21,7 @@ make-check-on-installed.pl
 windows-icons.pl
         This script lets you extract all the icons from a Windows
         guest.  We use this to locate the Windows logo in new releases
-        of Windows (see src/inspect-icon.c).
+        of Windows (see lib/inspect-icon.c).
 
 visualize-alignment/
         Tests for visualizing block device reads and writes and
diff --git a/contrib/windows-icons.pl b/contrib/windows-icons.pl
index fc93af0..d04829f 100755
--- a/contrib/windows-icons.pl
+++ b/contrib/windows-icons.pl
@@ -18,7 +18,7 @@
 
 # This script lets you extract all the icons from a Windows guest.  We
 # use this to locate the Windows logo in new releases of Windows (see
-# src/inspect-icon.c).
+# lib/inspect-icon.c).
 #
 # Use it like this:
 #   ./run ./contrib/windows-icons.pl /path/to/windows-disk.img
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 0f4ea83..5cc5c05 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -97,7 +97,7 @@ libcustomize_a_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 libcustomize_a_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
@@ -114,13 +114,13 @@ else
 OBJECTS = $(XOBJECTS)
 endif
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib \
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 15e1b7e..3e301ad 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -190,8 +190,8 @@ guestfsd_LDADD = \
 guestfsd_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_builddir)/gnulib/lib \
-	-I$(top_srcdir)/src \
-	-I$(top_builddir)/src \
+	-I$(top_srcdir)/lib \
+	-I$(top_builddir)/lib \
 	-I$(top_srcdir)/common/errnostring \
 	-I$(top_builddir)/common/errnostring \
 	-I$(top_srcdir)/common/protocol \
diff --git a/df/Makefile.am b/df/Makefile.am
index cddcbab..d921372 100644
--- a/df/Makefile.am
+++ b/df/Makefile.am
@@ -42,7 +42,7 @@ virt_df_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -54,7 +54,7 @@ virt_df_CFLAGS = \
 
 virt_df_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/dib/Makefile.am b/dib/Makefile.am
index 99912b5..2672321 100644
--- a/dib/Makefile.am
+++ b/dib/Makefile.am
@@ -48,7 +48,7 @@ virt_dib_CPPFLAGS = \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 virt_dib_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -57,13 +57,13 @@ BOBJECTS = \
 	$(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib
diff --git a/diff/Makefile.am b/diff/Makefile.am
index 33e6b54..5728205 100644
--- a/diff/Makefile.am
+++ b/diff/Makefile.am
@@ -36,7 +36,7 @@ virt_diff_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/cat -I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -46,7 +46,7 @@ virt_diff_CFLAGS = \
 
 virt_diff_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/docs/C_SOURCE_FILES b/docs/C_SOURCE_FILES
index 0d1ca30..f77cd22 100644
--- a/docs/C_SOURCE_FILES
+++ b/docs/C_SOURCE_FILES
@@ -248,6 +248,77 @@ java/actions-4.c
 java/actions-5.c
 java/actions-6.c
 java/handle.c
+lib/actions-0.c
+lib/actions-1.c
+lib/actions-2.c
+lib/actions-3.c
+lib/actions-4.c
+lib/actions-5.c
+lib/actions-6.c
+lib/actions-support.c
+lib/actions-variants.c
+lib/alloc.c
+lib/appliance-cpu.c
+lib/appliance-kcmdline.c
+lib/appliance-uefi.c
+lib/appliance.c
+lib/available.c
+lib/bindtests.c
+lib/canonical-name.c
+lib/command.c
+lib/conn-socket.c
+lib/copy-in-out.c
+lib/create.c
+lib/dbdump.c
+lib/drives.c
+lib/errors.c
+lib/event-string.c
+lib/events.c
+lib/file.c
+lib/filearch.c
+lib/fuse.c
+lib/guestfs-internal-actions.h
+lib/guestfs-internal-all.h
+lib/guestfs-internal.h
+lib/guestfs.h
+lib/guid.c
+lib/handle.c
+lib/info.c
+lib/inspect-apps.c
+lib/inspect-fs-cd.c
+lib/inspect-fs-unix.c
+lib/inspect-fs-windows.c
+lib/inspect-fs.c
+lib/inspect-icon.c
+lib/inspect.c
+lib/journal.c
+lib/launch-direct.c
+lib/launch-libvirt.c
+lib/launch-uml.c
+lib/launch-unix.c
+lib/launch.c
+lib/libvirt-auth.c
+lib/libvirt-domain.c
+lib/libvirt-is-version.c
+lib/listfs.c
+lib/lpj.c
+lib/match.c
+lib/mountable.c
+lib/osinfo.c
+lib/private-data.c
+lib/proto.c
+lib/qemu.c
+lib/stringsbuf.c
+lib/structs-compare.c
+lib/structs-copy.c
+lib/structs-free.c
+lib/tmpdirs.c
+lib/tsk.c
+lib/umask.c
+lib/unit-tests.c
+lib/version.c
+lib/wait.c
+lib/whole-file.c
 lua/lua-guestfs.c
 make-fs/make-fs.c
 mllib/common_utils-c.c
@@ -309,77 +380,6 @@ ruby/ext/guestfs/actions.h
 ruby/ext/guestfs/handle.c
 ruby/ext/guestfs/module.c
 sparsify/dummy.c
-src/actions-0.c
-src/actions-1.c
-src/actions-2.c
-src/actions-3.c
-src/actions-4.c
-src/actions-5.c
-src/actions-6.c
-src/actions-support.c
-src/actions-variants.c
-src/alloc.c
-src/appliance-cpu.c
-src/appliance-kcmdline.c
-src/appliance-uefi.c
-src/appliance.c
-src/available.c
-src/bindtests.c
-src/canonical-name.c
-src/command.c
-src/conn-socket.c
-src/copy-in-out.c
-src/create.c
-src/dbdump.c
-src/drives.c
-src/errors.c
-src/event-string.c
-src/events.c
-src/file.c
-src/filearch.c
-src/fuse.c
-src/guestfs-internal-actions.h
-src/guestfs-internal-all.h
-src/guestfs-internal.h
-src/guestfs.h
-src/guid.c
-src/handle.c
-src/info.c
-src/inspect-apps.c
-src/inspect-fs-cd.c
-src/inspect-fs-unix.c
-src/inspect-fs-windows.c
-src/inspect-fs.c
-src/inspect-icon.c
-src/inspect.c
-src/journal.c
-src/launch-direct.c
-src/launch-libvirt.c
-src/launch-uml.c
-src/launch-unix.c
-src/launch.c
-src/libvirt-auth.c
-src/libvirt-domain.c
-src/libvirt-is-version.c
-src/listfs.c
-src/lpj.c
-src/match.c
-src/mountable.c
-src/osinfo.c
-src/private-data.c
-src/proto.c
-src/qemu.c
-src/stringsbuf.c
-src/structs-compare.c
-src/structs-copy.c
-src/structs-free.c
-src/tmpdirs.c
-src/tsk.c
-src/umask.c
-src/unit-tests.c
-src/version.c
-src/wait.c
-src/whole-file.c
 sysprep/dummy.c
 test-tool/test-tool.c
 utils/boot-analysis/boot-analysis-timeline.c
diff --git a/docs/guestfs-hacking.pod b/docs/guestfs-hacking.pod
index 6e7c7b6..ffb959f 100644
--- a/docs/guestfs-hacking.pod
+++ b/docs/guestfs-hacking.pod
@@ -21,7 +21,7 @@ Libguestfs uses an autotools-based build system, with the main files
 being F<configure.ac> and F<Makefile.am>.  See L</THE BUILD SYSTEM>.
 
 The F<generator> subdirectory contains the generator, plus files
-describing the API.  The F<src> subdirectory contains source for the
+describing the API.  The F<lib> subdirectory contains source for the
 library.  The F<appliance> and F<daemon> subdirectories contain the
 source for the code that builds the appliance, and the code that runs
 in the appliance respectively.  Other directories are covered in the
@@ -31,7 +31,7 @@ Apart from the fact that all API entry points go via some generated
 code, the library is straightforward.  (In fact, even the generated
 code is designed to be readable, and should be read as ordinary code).
 Some actions run entirely in the library, and are written as C
-functions in files under F<src>.  Others are forwarded to the daemon
+functions in files under F<lib>.  Others are forwarded to the daemon
 where (after some generated RPC marshalling) they appear as C
 functions in files under F<daemon>.
 
@@ -40,7 +40,7 @@ To build from source, first read the L<guestfs-building(1)>.
 =head1 SOURCE CODE SUBDIRECTORIES
 
 There are a lot of subdirectories in the source tree!  Which ones
-should you concentrate on first?  F<src> and F<daemon> which contain
+should you concentrate on first?  F<lib> and F<daemon> which contain
 the source code of the core library.  F<generator> is the code
 generator described above, so that is important.  The F<Makefile.am>
 in the root directory will tell you in which order the subdirectories
@@ -169,6 +169,10 @@ under here.
 
 L<virt-inspector(1)>, the virtual machine image inspector.
 
+=item F<lib>
+
+Source code to the C library.
+
 =item F<logo>
 
 Logo used on the website.  The fish is called Arthur by the way.
@@ -213,10 +217,6 @@ L<virt-resize(1)> command and documentation.
 
 L<virt-sparsify(1)> command and documentation.
 
-=item F<src>
-
-Source code to the C library.
-
 =item F<sysprep>
 
 L<virt-sysprep(1)> command and documentation.
@@ -348,7 +348,7 @@ For daemon actions, implement the function C<do_E<lt>nameE<gt>> in the
 C<daemon/> directory.
 
 For library actions, implement the function C<guestfs_impl_E<lt>nameE<gt>>
-in the C<src/> directory.
+in the C<lib/> directory.
 
 In either case, use another function as an example of what to do.
 
diff --git a/docs/make-internal-documentation.pl b/docs/make-internal-documentation.pl
index 0ab4de9..b440b8b 100755
--- a/docs/make-internal-documentation.pl
+++ b/docs/make-internal-documentation.pl
@@ -148,7 +148,7 @@ foreach $input (@ARGV) {
     }
 }
 
-# Sort the input files into directory sections.  Put the 'src'
+# Sort the input files into directory sections.  Put the 'lib'
 # directory first, and the rest follow in alphabetical order.
 my %dirs = ();
 foreach $input (@inputs) {
@@ -157,9 +157,9 @@ foreach $input (@inputs) {
     push @{$dirs{$1}}, $2
 }
 sub src_first {
-    if ($a eq "src" && $b eq "src") { return 0 }
-    elsif ($a eq "src") { return -1 }
-    elsif ($b eq "src") { return 1 }
+    if ($a eq "lib" && $b eq "lib") { return 0 }
+    elsif ($a eq "lib") { return -1 }
+    elsif ($b eq "lib") { return 1 }
     else { return $a cmp $b }
 }
 my @dirs = sort src_first (keys %dirs);
diff --git a/edit/Makefile.am b/edit/Makefile.am
index 06f45d8..602bced 100644
--- a/edit/Makefile.am
+++ b/edit/Makefile.am
@@ -38,7 +38,7 @@ virt_edit_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -48,7 +48,7 @@ virt_edit_CFLAGS = \
 
 virt_edit_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/erlang/Makefile.am b/erlang/Makefile.am
index 64f0e44..75b3ec9 100644
--- a/erlang/Makefile.am
+++ b/erlang/Makefile.am
@@ -81,7 +81,7 @@ erl_guestfs_SOURCES = \
 erl_guestfs_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib \
 	-I$(ERLANG_LIB_DIR_erl_interface)/include
 
@@ -93,7 +93,7 @@ erl_guestfs_LDADD = \
 	$(ERLANG_LIB_DIR_erl_interface)/lib/libei.a \
 	-lpthread \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 1c69f24..17e0e1f 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -44,88 +44,88 @@ if HAVE_LIBVIRT
 copy_over_SOURCES = copy-over.c
 copy_over_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 copy_over_CFLAGS = \
 	$(LIBVIRT_CFLAGS) \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 copy_over_LDADD = \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBVIRT_LIBS)
 
 libvirt_auth_SOURCES = libvirt-auth.c
 libvirt_auth_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 libvirt_auth_CFLAGS = \
 	$(LIBVIRT_CFLAGS) \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 libvirt_auth_LDADD = \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBVIRT_LIBS)
 endif
 
 create_disk_SOURCES = create-disk.c
 create_disk_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 create_disk_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 create_disk_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 debug_logging_SOURCES = debug-logging.c
 debug_logging_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 debug_logging_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 debug_logging_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 display_icon_SOURCES = display-icon.c
 display_icon_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 display_icon_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 display_icon_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 inspect_vm_SOURCES = inspect-vm.c
 inspect_vm_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 inspect_vm_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 inspect_vm_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 if HAVE_FUSE
 mount_local_SOURCES = mount-local.c
 mount_local_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 mount_local_CFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	$(FUSE_CFLAGS) \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 mount_local_LDADD = \
 	$(FUSE_LIBS) \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 endif
 
 if HAVE_HIVEX
 virt_dhcp_address_SOURCES = virt-dhcp-address.c
 virt_dhcp_address_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 virt_dhcp_address_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 virt_dhcp_address_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 endif
 
 man_MANS = guestfs-examples.3
diff --git a/fish/Makefile.am b/fish/Makefile.am
index 8460b6d..b0e783c 100644
--- a/fish/Makefile.am
+++ b/fish/Makefile.am
@@ -98,7 +98,7 @@ libfishcommon_la_SOURCES = \
 libfishcommon_la_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish -I$(top_builddir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 libfishcommon_la_CFLAGS = \
@@ -106,7 +106,7 @@ libfishcommon_la_CFLAGS = \
 	$(LIBXML2_CFLAGS)
 libfishcommon_la_LIBADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LTLIBINTL)
 
@@ -164,7 +164,7 @@ guestfish_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish -I$(top_builddir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -178,7 +178,7 @@ guestfish_LDADD = \
 	$(LIBREADLINE) \
 	$(LIBTINFO_LIBS) \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LTLIBINTL) \
 	-lm
diff --git a/format/Makefile.am b/format/Makefile.am
index 627a38d..85bdb62 100644
--- a/format/Makefile.am
+++ b/format/Makefile.am
@@ -31,7 +31,7 @@ virt_format_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -42,7 +42,7 @@ virt_format_CFLAGS = \
 
 virt_format_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/fuse/Makefile.am b/fuse/Makefile.am
index ca09733..d234215 100644
--- a/fuse/Makefile.am
+++ b/fuse/Makefile.am
@@ -45,7 +45,7 @@ guestmount_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -59,7 +59,7 @@ guestmount_LDADD = \
 	$(FUSE_LIBS) \
 	$(LIBCONFIG_LIBS) \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
@@ -76,7 +76,7 @@ guestunmount_SOURCES = \
 guestunmount_CPPFLAGS = \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -85,7 +85,7 @@ guestunmount_CFLAGS = \
 
 guestunmount_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
@@ -147,7 +147,7 @@ test_fuse_SOURCES = \
 
 test_fuse_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
 test_fuse_CFLAGS = \
@@ -155,7 +155,7 @@ test_fuse_CFLAGS = \
 
 test_fuse_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(ACL_LIBS) \
@@ -166,7 +166,7 @@ test_guestmount_fd_SOURCES = \
 
 test_guestmount_fd_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
 test_guestmount_fd_CFLAGS = \
@@ -174,7 +174,7 @@ test_guestmount_fd_CFLAGS = \
 
 test_guestmount_fd_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
@@ -185,7 +185,7 @@ test_guestunmount_fd_SOURCES = \
 
 test_guestunmount_fd_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
 test_guestunmount_fd_CFLAGS = \
@@ -193,7 +193,7 @@ test_guestunmount_fd_CFLAGS = \
 
 test_guestunmount_fd_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/generator/actions.ml b/generator/actions.ml
index 59afa2e..e8b0ba5 100644
--- a/generator/actions.ml
+++ b/generator/actions.ml
@@ -13658,9 +13658,9 @@ let () =
     | { proc_nr = None } -> ()
   ) non_daemon_functions
 
-(* This is used to generate the src/MAX_PROC_NR file which
+(* This is used to generate the lib/MAX_PROC_NR file which
  * contains the maximum procedure number, a surrogate for the
- * ABI version number.  See src/Makefile.am for the details.
+ * ABI version number.  See lib/Makefile.am for the details.
  *)
 let max_proc_nr =
   let proc_nrs = List.map (
diff --git a/generator/actions.mli b/generator/actions.mli
index a812789..c943cb9 100644
--- a/generator/actions.mli
+++ b/generator/actions.mli
@@ -57,5 +57,5 @@ val fish_commands : Types.action list
 (** Non-API meta-commands available only in guestfish. *)
 
 val max_proc_nr : int
-(** The largest procedure number used (also saved in [src/MAX_PROC_NR] and
+(** The largest procedure number used (also saved in [lib/MAX_PROC_NR] and
     used as the minor version number of the shared library). *)
diff --git a/generator/main.ml b/generator/main.ml
index b1007f6..806735f 100644
--- a/generator/main.ml
+++ b/generator/main.ml
@@ -106,21 +106,21 @@ Run it from the top source directory using the command
   output_to "common/utils/structs-print.h" generate_client_structs_print_h;
   output_to "common/utils/uefi.c" generate_uefi_c;
 
-  output_to "src/guestfs.h" generate_guestfs_h;
-  output_to "src/guestfs-internal-actions.h" generate_internal_actions_h;
-  output_to "src/bindtests.c" generate_bindtests;
-  output_to "src/guestfs-structs.pod" generate_structs_pod;
-  output_to "src/guestfs-actions.pod" generate_actions_pod;
-  output_to "src/guestfs-availability.pod" generate_availability_pod;
-  output_to "src/event-string.c" generate_event_string_c;
-  output_to "src/MAX_PROC_NR" generate_max_proc_nr;
-  output_to "src/libguestfs.syms" generate_linker_script;
-
-  output_to "src/structs-compare.c" generate_client_structs_compare;
-  output_to "src/structs-copy.c" generate_client_structs_copy;
-  output_to "src/structs-free.c" generate_client_structs_free;
-  output_to "src/actions-variants.c" generate_client_actions_variants;
-  output_to_subset "src/actions-%d.c" generate_client_actions;
+  output_to "lib/guestfs.h" generate_guestfs_h;
+  output_to "lib/guestfs-internal-actions.h" generate_internal_actions_h;
+  output_to "lib/bindtests.c" generate_bindtests;
+  output_to "lib/guestfs-structs.pod" generate_structs_pod;
+  output_to "lib/guestfs-actions.pod" generate_actions_pod;
+  output_to "lib/guestfs-availability.pod" generate_availability_pod;
+  output_to "lib/event-string.c" generate_event_string_c;
+  output_to "lib/MAX_PROC_NR" generate_max_proc_nr;
+  output_to "lib/libguestfs.syms" generate_linker_script;
+
+  output_to "lib/structs-compare.c" generate_client_structs_compare;
+  output_to "lib/structs-copy.c" generate_client_structs_copy;
+  output_to "lib/structs-free.c" generate_client_structs_free;
+  output_to "lib/actions-variants.c" generate_client_actions_variants;
+  output_to_subset "lib/actions-%d.c" generate_client_actions;
   output_to "daemon/actions.h" generate_daemon_actions_h;
   output_to "daemon/stubs.h" generate_daemon_stubs_h;
   output_to_subset "daemon/stubs-%d.c" generate_daemon_stubs;
diff --git a/get-kernel/Makefile.am b/get-kernel/Makefile.am
index d2f6d6d..bda3a8d 100644
--- a/get-kernel/Makefile.am
+++ b/get-kernel/Makefile.am
@@ -44,7 +44,7 @@ virt_get_kernel_CPPFLAGS = \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 virt_get_kernel_CFLAGS = \
 	-pthread \
@@ -54,13 +54,13 @@ virt_get_kernel_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib
diff --git a/gobject/Makefile.am b/gobject/Makefile.am
index c47d65a..1c7750c 100644
--- a/gobject/Makefile.am
+++ b/gobject/Makefile.am
@@ -52,11 +52,11 @@ libguestfs_gobject_1_0_ladir = $(includedir)/guestfs-gobject
 
 libguestfs_gobject_1_0_la_HEADERS = $(guestfs_gobject_headers)
 libguestfs_gobject_1_0_la_SOURCES = $(guestfs_gobject_sources)
-libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/src -I$(srcdir)/include \
+libguestfs_gobject_1_0_la_CFLAGS = -I$(top_srcdir)/lib -I$(srcdir)/include \
                                    -DGUESTFS_PRIVATE=1 \
                                    $(GOBJECT_CFLAGS)
-libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/src
-libguestfs_gobject_1_0_la_LIBADD = $(top_builddir)/src/libguestfs.la $(GOBJECT_LIBS) $(GIO_LIBS)
+libguestfs_gobject_1_0_la_LDFLAGS = $(LDFLAGS) -L$(top_builddir)/lib
+libguestfs_gobject_1_0_la_LIBADD = $(top_builddir)/lib/libguestfs.la $(GOBJECT_LIBS) $(GIO_LIBS)
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libguestfs-gobject-1.0.pc
@@ -81,7 +81,7 @@ introspection_sources = \
 Guestfs-1.0.gir: $(libname)
 Guestfs_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
 Guestfs_1_0_gir_CFLAGS = $(INCLUDES) -I$(srcdir)/include
-Guestfs_1_0_gir_LIBS = $(libname) $(top_builddir)/src/libguestfs.la
+Guestfs_1_0_gir_LIBS = $(libname) $(top_builddir)/lib/libguestfs.la
 Guestfs_1_0_gir_FILES = $(patsubst %,$(srcdir)/%,$(introspection_sources))
 INTROSPECTION_GIRS += Guestfs-1.0.gir
 
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index b09b06b..a0b7e25 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -39,10 +39,10 @@ endif ENABLE_APPLIANCE
 
 #check_DATA = Bindtests
 
-GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs -i$(srcdir)
+GHCFLAGS = -I$(top_builddir)/lib -L$(top_builddir)/lib/.libs -i$(srcdir)
 
 all_targets = Guestfs010Load Guestfs030Config Guestfs050LVCreate
-$(all_targets): $(top_builddir)/src/libguestfs.la
+$(all_targets): $(top_builddir)/lib/libguestfs.la
 
 all: $(all_targets)
 
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index 1456966..358a3f9 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -59,7 +59,7 @@ virt_inspector_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -69,7 +69,7 @@ virt_inspector_CFLAGS = \
 
 virt_inspector_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/installcheck.sh.in b/installcheck.sh.in
index e239b12..6b05ab8 100644
--- a/installcheck.sh.in
+++ b/installcheck.sh.in
@@ -35,10 +35,10 @@ exec_prefix=@exec_prefix@
 find -name 'lt-*' | grep '/.libs/lt-' | xargs -r rm
 
 # Copy the installed library into libtool directory.
-rm -f src/.libs/libguestfs.so*
-cp @libdir@/libguestfs.so src/.libs/
-cp @libdir@/libguestfs.so.0 src/.libs/
-cp @libdir@/libguestfs.so.0.* src/.libs/
+rm -f lib/.libs/libguestfs.so*
+cp @libdir@/libguestfs.so lib/.libs/
+cp @libdir@/libguestfs.so.0 lib/.libs/
+cp @libdir@/libguestfs.so.0.* lib/.libs/
 
 # Copy installed binaries into the right places.
 cp @bindir@/libguestfs-test-tool  test-tool/
@@ -100,7 +100,7 @@ compare () {
         exit 1
     fi
 }
-compare @libdir@/libguestfs.so src/.libs/libguestfs.so
+compare @libdir@/libguestfs.so lib/.libs/libguestfs.so
 compare @bindir@/guestfish  fish/guestfish
 compare @bindir@/guestmount fuse/guestmount
 compare @bindir@/virt-df    df/virt-df
diff --git a/java/Makefile.am b/java/Makefile.am
index b165f5a..06d0fc7 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -109,13 +109,13 @@ libguestfs_jni_la_SOURCES = \
 libguestfs_jni_la_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 
 libguestfs_jni_la_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(JNI_CFLAGS)
 
-libguestfs_jni_la_LIBADD = $(top_builddir)/src/libguestfs.la
+libguestfs_jni_la_LIBADD = $(top_builddir)/lib/libguestfs.la
 
 libguestfs_jni_la_LDFLAGS = -version-info $(JNI_VERSION_INFO) -shared
 
diff --git a/src/MAX_PROC_NR b/lib/MAX_PROC_NR
similarity index 100%
rename from src/MAX_PROC_NR
rename to lib/MAX_PROC_NR
diff --git a/src/Makefile.am b/lib/Makefile.am
similarity index 99%
rename from src/Makefile.am
rename to lib/Makefile.am
index 0f6a258..86dab24 100644
--- a/src/Makefile.am
+++ b/lib/Makefile.am
@@ -212,7 +212,7 @@ unit_tests_SOURCES = unit-tests.c
 unit_tests_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I.
+	-I$(top_srcdir)/lib -I.
 unit_tests_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 # We have to link this to libguestfs, but because we want to test
diff --git a/src/actions-support.c b/lib/actions-support.c
similarity index 97%
rename from src/actions-support.c
rename to lib/actions-support.c
index 1312f99..1ace45f 100644
--- a/src/actions-support.c
+++ b/lib/actions-support.c
@@ -17,7 +17,7 @@
  */
 
 /**
- * Helper functions for the actions code in F<src/actions-*.c>.
+ * Helper functions for the actions code in F<lib/actions-*.c>.
  */
 
 #include <config.h>
diff --git a/src/alloc.c b/lib/alloc.c
similarity index 100%
rename from src/alloc.c
rename to lib/alloc.c
diff --git a/src/appliance-cpu.c b/lib/appliance-cpu.c
similarity index 100%
rename from src/appliance-cpu.c
rename to lib/appliance-cpu.c
diff --git a/src/appliance-kcmdline.c b/lib/appliance-kcmdline.c
similarity index 100%
rename from src/appliance-kcmdline.c
rename to lib/appliance-kcmdline.c
diff --git a/src/appliance-uefi.c b/lib/appliance-uefi.c
similarity index 100%
rename from src/appliance-uefi.c
rename to lib/appliance-uefi.c
diff --git a/src/appliance.c b/lib/appliance.c
similarity index 100%
rename from src/appliance.c
rename to lib/appliance.c
diff --git a/src/available.c b/lib/available.c
similarity index 100%
rename from src/available.c
rename to lib/available.c
diff --git a/src/canonical-name.c b/lib/canonical-name.c
similarity index 100%
rename from src/canonical-name.c
rename to lib/canonical-name.c
diff --git a/src/command.c b/lib/command.c
similarity index 100%
rename from src/command.c
rename to lib/command.c
diff --git a/src/conn-socket.c b/lib/conn-socket.c
similarity index 100%
rename from src/conn-socket.c
rename to lib/conn-socket.c
diff --git a/src/copy-in-out.c b/lib/copy-in-out.c
similarity index 100%
rename from src/copy-in-out.c
rename to lib/copy-in-out.c
diff --git a/src/create.c b/lib/create.c
similarity index 100%
rename from src/create.c
rename to lib/create.c
diff --git a/src/dbdump.c b/lib/dbdump.c
similarity index 100%
rename from src/dbdump.c
rename to lib/dbdump.c
diff --git a/src/drives.c b/lib/drives.c
similarity index 100%
rename from src/drives.c
rename to lib/drives.c
diff --git a/src/errors.c b/lib/errors.c
similarity index 100%
rename from src/errors.c
rename to lib/errors.c
diff --git a/src/events.c b/lib/events.c
similarity index 100%
rename from src/events.c
rename to lib/events.c
diff --git a/src/file.c b/lib/file.c
similarity index 100%
rename from src/file.c
rename to lib/file.c
diff --git a/src/filearch.c b/lib/filearch.c
similarity index 100%
rename from src/filearch.c
rename to lib/filearch.c
diff --git a/src/fuse.c b/lib/fuse.c
similarity index 100%
rename from src/fuse.c
rename to lib/fuse.c
diff --git a/src/guestfs-internal-all.h b/lib/guestfs-internal-all.h
similarity index 97%
rename from src/guestfs-internal-all.h
rename to lib/guestfs-internal-all.h
index bae42c2..dbf9735 100644
--- a/src/guestfs-internal-all.h
+++ b/lib/guestfs-internal-all.h
@@ -22,9 +22,9 @@
  * tools (ie. I<all> C code).
  *
  * If you need a definition used by only the library, put it in
- * F<src/guestfs-internal.h> instead.  If you need a definition used
+ * F<lib/guestfs-internal.h> instead.  If you need a definition used
  * by only the frontend (non-daemon) parts of libguestfs, try
- * F<src/guestfs-internal-frontend.h>.  If a definition is used by
+ * F<lib/guestfs-internal-frontend.h>.  If a definition is used by
  * only a single tool, it should not be in any shared header file at
  * all.
  */
diff --git a/src/guestfs-internal.h b/lib/guestfs-internal.h
similarity index 99%
rename from src/guestfs-internal.h
rename to lib/guestfs-internal.h
index 24a248e..04d087b 100644
--- a/src/guestfs-internal.h
+++ b/lib/guestfs-internal.h
@@ -17,11 +17,11 @@
  */
 
 /**
- * This header file is included in the libguestfs library (F<src/>)
+ * This header file is included in the libguestfs library (F<lib/>)
  * only.
  *
- * See also F<src/guestfs-internal-frontend.h> and
- * F<src/guestfs-internal-all.h>
+ * See also F<lib/guestfs-internal-frontend.h> and
+ * F<lib/guestfs-internal-all.h>
  */
 
 #ifndef GUESTFS_INTERNAL_H_
@@ -387,7 +387,7 @@ struct error_cb_stack {
 /**
  * Cache of queried features.
  *
- * Used to cache the appliance features (see F<src/available.c>).
+ * Used to cache the appliance features (see F<lib/available.c>).
  */
 struct cached_feature {
   char *group;
@@ -524,7 +524,7 @@ struct guestfs_h {
 #endif
 
 #ifdef HAVE_LIBVIRT_BACKEND
-  /* Used by src/libvirt-auth.c. */
+  /* Used by lib/libvirt-auth.c. */
 #define NR_CREDENTIAL_TYPES 9
   unsigned int nr_supported_credentials;
   int supported_credentials[NR_CREDENTIAL_TYPES];
@@ -541,7 +541,7 @@ struct guestfs_h {
 
 /**
  * Used for storing major.minor.micro version numbers.
- * See F<src/version.c> for more information.
+ * See F<lib/version.c> for more information.
  */
 struct version {
   int v_major;
diff --git a/src/guestfs.pod b/lib/guestfs.pod
similarity index 100%
rename from src/guestfs.pod
rename to lib/guestfs.pod
diff --git a/src/guid.c b/lib/guid.c
similarity index 100%
rename from src/guid.c
rename to lib/guid.c
diff --git a/src/handle.c b/lib/handle.c
similarity index 100%
rename from src/handle.c
rename to lib/handle.c
diff --git a/src/info.c b/lib/info.c
similarity index 100%
rename from src/info.c
rename to lib/info.c
diff --git a/src/inspect-apps.c b/lib/inspect-apps.c
similarity index 100%
rename from src/inspect-apps.c
rename to lib/inspect-apps.c
diff --git a/src/inspect-fs-cd.c b/lib/inspect-fs-cd.c
similarity index 100%
rename from src/inspect-fs-cd.c
rename to lib/inspect-fs-cd.c
diff --git a/src/inspect-fs-unix.c b/lib/inspect-fs-unix.c
similarity index 100%
rename from src/inspect-fs-unix.c
rename to lib/inspect-fs-unix.c
diff --git a/src/inspect-fs-windows.c b/lib/inspect-fs-windows.c
similarity index 100%
rename from src/inspect-fs-windows.c
rename to lib/inspect-fs-windows.c
diff --git a/src/inspect-fs.c b/lib/inspect-fs.c
similarity index 100%
rename from src/inspect-fs.c
rename to lib/inspect-fs.c
diff --git a/src/inspect-icon.c b/lib/inspect-icon.c
similarity index 100%
rename from src/inspect-icon.c
rename to lib/inspect-icon.c
diff --git a/src/inspect.c b/lib/inspect.c
similarity index 99%
rename from src/inspect.c
rename to lib/inspect.c
index f6d0840..da80e47 100644
--- a/src/inspect.c
+++ b/lib/inspect.c
@@ -17,7 +17,7 @@
  */
 
 /**
- * This file, and the other C<src/inspect*.c> files, handle
+ * This file, and the other C<lib/inspect*.c> files, handle
  * inspection.  See L<guestfs(3)/INSPECTION>.
  */
 
diff --git a/src/journal.c b/lib/journal.c
similarity index 100%
rename from src/journal.c
rename to lib/journal.c
diff --git a/src/launch-direct.c b/lib/launch-direct.c
similarity index 100%
rename from src/launch-direct.c
rename to lib/launch-direct.c
diff --git a/src/launch-libvirt.c b/lib/launch-libvirt.c
similarity index 100%
rename from src/launch-libvirt.c
rename to lib/launch-libvirt.c
diff --git a/src/launch-uml.c b/lib/launch-uml.c
similarity index 100%
rename from src/launch-uml.c
rename to lib/launch-uml.c
diff --git a/src/launch-unix.c b/lib/launch-unix.c
similarity index 100%
rename from src/launch-unix.c
rename to lib/launch-unix.c
diff --git a/src/launch.c b/lib/launch.c
similarity index 98%
rename from src/launch.c
rename to lib/launch.c
index 17c4cee..f0ac4be 100644
--- a/src/launch.c
+++ b/lib/launch.c
@@ -21,7 +21,7 @@
  *
  * Most of the work is done by the backends (see
  * L<guestfs(3)/BACKEND>), which are implemented in
- * F<src/launch-direct.c>, F<src/launch-libvirt.c> etc, so this file
+ * F<lib/launch-direct.c>, F<lib/launch-libvirt.c> etc, so this file
  * mostly passes calls through to the current backend.
  */
 
@@ -129,7 +129,7 @@ guestfs_impl_launch (guestfs_h *g)
  *
  * =item 3.
  *
- * There is a hack in F<src/proto.c> to make this work.
+ * There is a hack in F<lib/proto.c> to make this work.
  *
  * =back
  */
diff --git a/src/libguestfs.pc.in b/lib/libguestfs.pc.in
similarity index 100%
rename from src/libguestfs.pc.in
rename to lib/libguestfs.pc.in
diff --git a/src/libvirt-auth.c b/lib/libvirt-auth.c
similarity index 100%
rename from src/libvirt-auth.c
rename to lib/libvirt-auth.c
diff --git a/src/libvirt-domain.c b/lib/libvirt-domain.c
similarity index 100%
rename from src/libvirt-domain.c
rename to lib/libvirt-domain.c
diff --git a/src/libvirt-is-version.c b/lib/libvirt-is-version.c
similarity index 100%
rename from src/libvirt-is-version.c
rename to lib/libvirt-is-version.c
diff --git a/src/listfs.c b/lib/listfs.c
similarity index 100%
rename from src/listfs.c
rename to lib/listfs.c
diff --git a/src/lpj.c b/lib/lpj.c
similarity index 100%
rename from src/lpj.c
rename to lib/lpj.c
diff --git a/src/match.c b/lib/match.c
similarity index 100%
rename from src/match.c
rename to lib/match.c
diff --git a/src/mountable.c b/lib/mountable.c
similarity index 100%
rename from src/mountable.c
rename to lib/mountable.c
diff --git a/src/osinfo.c b/lib/osinfo.c
similarity index 100%
rename from src/osinfo.c
rename to lib/osinfo.c
diff --git a/src/private-data.c b/lib/private-data.c
similarity index 100%
rename from src/private-data.c
rename to lib/private-data.c
diff --git a/src/proto.c b/lib/proto.c
similarity index 99%
rename from src/proto.c
rename to lib/proto.c
index 99a4f4c..83491da 100644
--- a/src/proto.c
+++ b/lib/proto.c
@@ -19,7 +19,7 @@
 /**
  * This is the code used to send and receive RPC messages and (for
  * certain types of message) to perform file transfers.  This code is
- * driven from the generated actions (F<src/actions-*.c>).  There
+ * driven from the generated actions (F<lib/actions-*.c>).  There
  * are five different cases to consider:
  *
  * =over 4
diff --git a/src/qemu.c b/lib/qemu.c
similarity index 100%
rename from src/qemu.c
rename to lib/qemu.c
diff --git a/src/stringsbuf.c b/lib/stringsbuf.c
similarity index 100%
rename from src/stringsbuf.c
rename to lib/stringsbuf.c
diff --git a/src/tmpdirs.c b/lib/tmpdirs.c
similarity index 100%
rename from src/tmpdirs.c
rename to lib/tmpdirs.c
diff --git a/src/tsk.c b/lib/tsk.c
similarity index 100%
rename from src/tsk.c
rename to lib/tsk.c
diff --git a/src/umask.c b/lib/umask.c
similarity index 100%
rename from src/umask.c
rename to lib/umask.c
diff --git a/src/unit-tests.c b/lib/unit-tests.c
similarity index 99%
rename from src/unit-tests.c
rename to lib/unit-tests.c
index 517262e..d44bc41 100644
--- a/src/unit-tests.c
+++ b/lib/unit-tests.c
@@ -433,7 +433,7 @@ test_stringsbuf (void)
   guestfs_close (g);
 }
 
-/* Use the same macros as in src/drives.c */
+/* Use the same macros as in lib/drives.c */
 #define VALID_FORMAT_IFACE(str) \
   guestfs_int_string_is_valid ((str), 1, 0, \
                                VALID_FLAG_ALPHA|VALID_FLAG_DIGIT, "-_")
diff --git a/src/version.c b/lib/version.c
similarity index 100%
rename from src/version.c
rename to lib/version.c
diff --git a/src/wait.c b/lib/wait.c
similarity index 100%
rename from src/wait.c
rename to lib/wait.c
diff --git a/src/whole-file.c b/lib/whole-file.c
similarity index 100%
rename from src/whole-file.c
rename to lib/whole-file.c
diff --git a/lua/Makefile.am b/lua/Makefile.am
index 30ec4fb..f90c1d7 100644
--- a/lua/Makefile.am
+++ b/lua/Makefile.am
@@ -42,7 +42,7 @@ libluaguestfs_la_SOURCES = lua-guestfs.c
 libluaguestfs_la_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 
 libluaguestfs_la_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
@@ -50,7 +50,7 @@ libluaguestfs_la_CFLAGS = \
 
 libluaguestfs_la_LIBADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	../gnulib/lib/libgnu.la
diff --git a/m4/guestfs_libraries.m4 b/m4/guestfs_libraries.m4
index bff9df3..ac71b39 100644
--- a/m4/guestfs_libraries.m4
+++ b/m4/guestfs_libraries.m4
@@ -282,5 +282,5 @@ AC_DEFINE_UNQUOTED([PATH_SEPARATOR],["$PATH_SEPARATOR"],
                    [Character that separates path elements in search paths])
 
 dnl Library versioning.
-MAX_PROC_NR=`cat $srcdir/src/MAX_PROC_NR`
+MAX_PROC_NR=`cat $srcdir/lib/MAX_PROC_NR`
 AC_SUBST(MAX_PROC_NR)
diff --git a/make-fs/Makefile.am b/make-fs/Makefile.am
index fde3dea..8d8971a 100644
--- a/make-fs/Makefile.am
+++ b/make-fs/Makefile.am
@@ -31,7 +31,7 @@ virt_make_fs_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -41,7 +41,7 @@ virt_make_fs_CFLAGS = \
 
 virt_make_fs_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/fish/libfishcommon.la \
 	$(LIBXML2_LIBS) \
 	$(LTLIBINTL) \
diff --git a/mllib/Makefile.am b/mllib/Makefile.am
index 40f2212..87c3032 100644
--- a/mllib/Makefile.am
+++ b/mllib/Makefile.am
@@ -111,7 +111,7 @@ libmllib_a_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/cat \
 	-I$(top_srcdir)/fish
 libmllib_a_CFLAGS = \
@@ -122,13 +122,13 @@ libmllib_a_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(builddir)
@@ -177,7 +177,7 @@ common_utils_tests_CPPFLAGS = \
 	-I. \
 	-I$(top_builddir) \
 	-I$(shell $(OCAMLC) -where) \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 common_utils_tests_BOBJECTS = common_utils_tests.cmo
 common_utils_tests_XOBJECTS = $(common_utils_tests_BOBJECTS:.cmo=.cmx)
 
@@ -186,7 +186,7 @@ getopt_tests_CPPFLAGS = \
 	-I. \
 	-I$(top_builddir) \
 	-I$(shell $(OCAMLC) -where) \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 getopt_tests_BOBJECTS = getopt_tests.cmo
 getopt_tests_XOBJECTS = $(getopt_tests_BOBJECTS:.cmo=.cmx)
 
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 8377a83..57ecd60 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -69,13 +69,13 @@ stamp-mlguestfs: libguestfsocaml.a $(guestfs_cmm)
 	  $(libguestfsocaml_a_OBJECTS) guestfs.cmo \
 	  $(LDFLAGS) \
 	  $(LTLIBINTL) \
-	  -L../src/.libs -lguestfs
+	  -L../lib/.libs -lguestfs
 if HAVE_OCAMLOPT
 	$(OCAMLMKLIB) -o mlguestfs \
 	  $(libguestfsocaml_a_OBJECTS) guestfs.cmx \
 	  $(LDFLAGS) \
 	  $(LTLIBINTL) \
-	  -L../src/.libs -lguestfs
+	  -L../lib/.libs -lguestfs
 endif
 	touch $@
 
@@ -83,7 +83,7 @@ libguestfsocaml_a_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib -I../gnulib/lib
 
 libguestfsocaml_a_CFLAGS = \
@@ -159,12 +159,12 @@ check_DATA += bindtests.opt
 endif
 
 %.bc: %.cmo mlguestfs.cma
-	$(guestfs_am_v_ocamlc)$(top_builddir)/libtool -dlopen $(top_builddir)/src/.libs/libguestfs.la --mode=execute \
+	$(guestfs_am_v_ocamlc)$(top_builddir)/libtool -dlopen $(top_builddir)/lib/.libs/libguestfs.la --mode=execute \
 	$(OCAMLFIND) ocamlc $(OCAMLCFLAGS) -I . -package unix -linkpkg mlguestfs.cma $< -o $@
 
 if HAVE_OCAMLOPT
 %.opt: %.cmx mlguestfs.cmxa
-	$(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/src/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
+	$(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLOPTFLAGS) -cclib -L$(top_builddir)/lib/.libs -I . -package unix -linkpkg mlguestfs.cmxa $< -o $@
 endif
 
 check-valgrind:
diff --git a/ocaml/examples/Makefile.am b/ocaml/examples/Makefile.am
index 35f410b..14e534b 100644
--- a/ocaml/examples/Makefile.am
+++ b/ocaml/examples/Makefile.am
@@ -48,7 +48,7 @@ if HAVE_OCAML
 
 noinst_SCRIPTS = create_disk debug_logging inspect_vm
 
-OCAMLFINDFLAGS = -cclib -L$(top_builddir)/src/.libs
+OCAMLFINDFLAGS = -cclib -L$(top_builddir)/lib/.libs
 
 if HAVE_OCAMLOPT
 create_disk: create_disk.ml
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 1cefd62..86d905e 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -93,7 +93,7 @@ virt_p2v_SOURCES = \
 virt_p2v_CPPFLAGS = \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
 virt_p2v_CFLAGS = \
@@ -302,7 +302,7 @@ test-virt-p2v-pxe.sshd_config: test-virt-p2v-pxe.sshd_config.in
 
 test-virt-p2v-pxe.authorized_keys: test-virt-p2v-pxe.id_rsa.pub $(top_builddir)/run
 	rm -f $@ $@-t
-	$(top_builddir)/run sh -c 'echo -n environment=\"PATH=$$PATH\",environment=\"LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs\"\ ' > $@-t
+	$(top_builddir)/run sh -c 'echo -n environment=\"PATH=$$PATH\",environment=\"LD_LIBRARY_PATH=$(abs_top_builddir)/lib/.libs\"\ ' > $@-t
 	cat $< >> $@-t
 	mv $@-t $@
 
diff --git a/p2v/conversion.c b/p2v/conversion.c
index b8bab34..b25f272 100644
--- a/p2v/conversion.c
+++ b/p2v/conversion.c
@@ -704,7 +704,7 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr)
   }
 }
 
-/* Macros "inspired" by src/launch-libvirt.c */
+/* Macros "inspired" by lib/launch-libvirt.c */
 /* <element */
 #define start_element(element)						\
   if (xmlTextWriterStartElement (xo, BAD_CAST (element)) == -1)         \
diff --git a/perl/Build.PL.in b/perl/Build.PL.in
index 01f67a1..451030a 100755
--- a/perl/Build.PL.in
+++ b/perl/Build.PL.in
@@ -60,11 +60,11 @@ my $build = Module::Build->new (
         split (' ', '@CFLAGS@'),
     ],
     include_dirs => [
-        '@top_builddir@/src',
-        '@top_srcdir@/src',
+        '@top_builddir@/lib',
+        '@top_srcdir@/lib',
     ],
     extra_linker_flags => [
-        '-L at top_builddir@/src/.libs',
+        '-L at top_builddir@/lib/.libs',
         '-lguestfs',
     ],
 );
diff --git a/php/Makefile.am b/php/Makefile.am
index 4dda499..a974cdf 100644
--- a/php/Makefile.am
+++ b/php/Makefile.am
@@ -38,8 +38,8 @@ php_DATA = guestfs_php.ini
 # and we need to add the library to EXTRA_LDFLAGS.
 all: check-builddir-equals-srcdir extension/config.h
 	$(MAKE) -C extension \
-	  EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../src" \
-	  EXTRA_LDFLAGS="-L$(abs_srcdir)/../src/.libs -lguestfs" \
+	  EXTRA_INCLUDES="-I$(abs_srcdir)/../common/utils -I$(abs_srcdir)/../lib" \
+	  EXTRA_LDFLAGS="-L$(abs_srcdir)/../lib/.libs -lguestfs" \
 	  EXTRA_CFLAGS="-DGUESTFS_PRIVATE=1" \
 	  all
 
diff --git a/po/POTFILES b/po/POTFILES
index 05e3631..25ddf01 100644
--- a/po/POTFILES
+++ b/po/POTFILES
@@ -1,7 +1,5 @@
 align/scan.c
-builder/index-parse.c
 builder/index-parser-c.c
-builder/index-scan.c
 builder/index-struct.c
 builder/index-validate.c
 builder/pxzcat-c.c
@@ -158,7 +156,6 @@ erlang/dispatch.c
 erlang/main.c
 erlang/structs.c
 fish/alloc.c
-fish/cmds-gperf.c
 fish/cmds.c
 fish/completion.c
 fish/config.c
@@ -318,6 +315,73 @@ java/actions-4.c
 java/actions-5.c
 java/actions-6.c
 java/handle.c
+lib/actions-0.c
+lib/actions-1.c
+lib/actions-2.c
+lib/actions-3.c
+lib/actions-4.c
+lib/actions-5.c
+lib/actions-6.c
+lib/actions-support.c
+lib/actions-variants.c
+lib/alloc.c
+lib/appliance-cpu.c
+lib/appliance-kcmdline.c
+lib/appliance-uefi.c
+lib/appliance.c
+lib/available.c
+lib/bindtests.c
+lib/canonical-name.c
+lib/command.c
+lib/conn-socket.c
+lib/copy-in-out.c
+lib/create.c
+lib/dbdump.c
+lib/drives.c
+lib/errors.c
+lib/event-string.c
+lib/events.c
+lib/file.c
+lib/filearch.c
+lib/fuse.c
+lib/guid.c
+lib/handle.c
+lib/info.c
+lib/inspect-apps.c
+lib/inspect-fs-cd.c
+lib/inspect-fs-unix.c
+lib/inspect-fs-windows.c
+lib/inspect-fs.c
+lib/inspect-icon.c
+lib/inspect.c
+lib/journal.c
+lib/launch-direct.c
+lib/launch-libvirt.c
+lib/launch-uml.c
+lib/launch-unix.c
+lib/launch.c
+lib/libvirt-auth.c
+lib/libvirt-domain.c
+lib/libvirt-is-version.c
+lib/listfs.c
+lib/lpj.c
+lib/match.c
+lib/mountable.c
+lib/osinfo.c
+lib/private-data.c
+lib/proto.c
+lib/qemu.c
+lib/stringsbuf.c
+lib/structs-compare.c
+lib/structs-copy.c
+lib/structs-free.c
+lib/tmpdirs.c
+lib/tsk.c
+lib/umask.c
+lib/unit-tests.c
+lib/version.c
+lib/wait.c
+lib/whole-file.c
 lua/lua-guestfs.c
 make-fs/make-fs.c
 mllib/common_utils-c.c
@@ -349,7 +413,6 @@ p2v/ssh.c
 p2v/utils.c
 p2v/whole-file.c
 perl/bindtests.pl
-perl/lib/Sys/Guestfs.c
 perl/lib/Sys/Guestfs.pm
 php/extension/guestfs_php.c
 python/actions-0.c
@@ -376,73 +439,6 @@ ruby/ext/guestfs/actions-6.c
 ruby/ext/guestfs/handle.c
 ruby/ext/guestfs/module.c
 sparsify/dummy.c
-src/actions-0.c
-src/actions-1.c
-src/actions-2.c
-src/actions-3.c
-src/actions-4.c
-src/actions-5.c
-src/actions-6.c
-src/actions-support.c
-src/actions-variants.c
-src/alloc.c
-src/appliance-cpu.c
-src/appliance-kcmdline.c
-src/appliance-uefi.c
-src/appliance.c
-src/available.c
-src/bindtests.c
-src/canonical-name.c
-src/command.c
-src/conn-socket.c
-src/copy-in-out.c
-src/create.c
-src/dbdump.c
-src/drives.c
-src/errors.c
-src/event-string.c
-src/events.c
-src/file.c
-src/filearch.c
-src/fuse.c
-src/guid.c
-src/handle.c
-src/info.c
-src/inspect-apps.c
-src/inspect-fs-cd.c
-src/inspect-fs-unix.c
-src/inspect-fs-windows.c
-src/inspect-fs.c
-src/inspect-icon.c
-src/inspect.c
-src/journal.c
-src/launch-direct.c
-src/launch-libvirt.c
-src/launch-uml.c
-src/launch-unix.c
-src/launch.c
-src/libvirt-auth.c
-src/libvirt-domain.c
-src/libvirt-is-version.c
-src/listfs.c
-src/lpj.c
-src/match.c
-src/mountable.c
-src/osinfo.c
-src/private-data.c
-src/proto.c
-src/qemu.c
-src/stringsbuf.c
-src/structs-compare.c
-src/structs-copy.c
-src/structs-free.c
-src/tmpdirs.c
-src/tsk.c
-src/umask.c
-src/unit-tests.c
-src/version.c
-src/wait.c
-src/whole-file.c
 sysprep/dummy.c
 test-tool/test-tool.c
 utils/boot-analysis/boot-analysis-timeline.c
diff --git a/python/Makefile.am b/python/Makefile.am
index ec99570..ae90aa0 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -68,14 +68,14 @@ libguestfsmod_la_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	$(PYTHON_CFLAGS) \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 
 libguestfsmod_la_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 
 libguestfsmod_la_LIBADD = \
 	$(top_builddir)/common/utils/libutils_la-utils.lo \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 libguestfsmod_la_LDFLAGS = -avoid-version -shared -module -shrext $(PYTHON_EXT_SUFFIX)
 
@@ -115,7 +115,7 @@ ignore-value.h:
 	ln $(top_srcdir)/gnulib/lib/ignore-value.h $@
 
 guestfs-internal-all.h:
-	ln $(top_srcdir)/src/guestfs-internal-all.h $@
+	ln $(top_srcdir)/lib/guestfs-internal-all.h $@
 
 guestfs-internal-frontend-cleanups.h:
 	ln $(top_srcdir)/common/utils/guestfs-internal-frontend-cleanups.h $@
diff --git a/python/setup.py.in b/python/setup.py.in
index 6561426..e3d7973 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -64,7 +64,7 @@ This package contains the Python bindings for libguestfs.
                'structs.c',
                'utils.c'],
 
-              include_dirs=['.', '../src'],
+              include_dirs=['.', '../lib'],
               libraries=['guestfs'],
               define_macros=[('GUESTFS_PRIVATE', '1')],
           )
diff --git a/rescue/Makefile.am b/rescue/Makefile.am
index 4159944..92ebc4a 100644
--- a/rescue/Makefile.am
+++ b/rescue/Makefile.am
@@ -47,7 +47,7 @@ virt_rescue_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/fish \
 	-I$(srcdir)/../gnulib/lib -I../gnulib/lib
 
@@ -59,7 +59,7 @@ virt_rescue_CFLAGS = \
 virt_rescue_LDADD = \
 	$(LIBCONFIG_LIBS) \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/resize/Makefile.am b/resize/Makefile.am
index a767c83..e097dd6 100644
--- a/resize/Makefile.am
+++ b/resize/Makefile.am
@@ -42,7 +42,7 @@ virt_resize_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 virt_resize_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
@@ -51,13 +51,13 @@ virt_resize_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib
diff --git a/ruby/Rakefile.in b/ruby/Rakefile.in
index 1d6cb87..18ec311 100644
--- a/ruby/Rakefile.in
+++ b/ruby/Rakefile.in
@@ -65,7 +65,7 @@ CLOBBER.include [ "@builddir@/config.save", "@builddir@/ext/**/mkmf.log",
 # Build locally
 
 file MAKEFILE => EXT_CONF do |t|
-     unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/common/utils:$top_srcdir/src:$top_builddir --with-_guestfs-lib=$top_builddir/src/.libs"
+     unless sh "top_srcdir=$(pwd)/@top_srcdir@; top_builddir=$(pwd)/@top_builddir@; export ARCHFLAGS=\"-arch $(uname -m)\"; mkdir -p @builddir@/ext/guestfs; cd @builddir@/ext/guestfs; @RUBY@ #{EXT_CONF} --with-_guestfs-include=$top_srcdir/common/utils:$top_srcdir/lib:$top_builddir --with-_guestfs-lib=$top_builddir/lib/.libs"
          $stderr.puts "Failed to run extconf"
          break
      end
diff --git a/run.in b/run.in
index 4cad130..0e2e6af 100755
--- a/run.in
+++ b/run.in
@@ -111,10 +111,10 @@ export PATH
 # Set LD_LIBRARY_PATH and DYLD_LIBRARY_PATH to contain library.
 prepend LD_LIBRARY_PATH "$b/gobject/.libs"
 prepend LD_LIBRARY_PATH "$b/java/.libs"
-prepend LD_LIBRARY_PATH "$b/src/.libs"
+prepend LD_LIBRARY_PATH "$b/lib/.libs"
 prepend DYLD_LIBRARY_PATH "$b/gobject/.libs"
 prepend DYLD_LIBRARY_PATH "$b/java/.libs"
-prepend DYLD_LIBRARY_PATH "$b/src/.libs"
+prepend DYLD_LIBRARY_PATH "$b/lib/.libs"
 export LD_LIBRARY_PATH
 export DYLD_LIBRARY_PATH
 
@@ -189,15 +189,15 @@ export GOLANG="@GOLANG@"
 prepend GOPATH "$b/golang"
 export GOPATH
 if [ -z "$CGO_CFLAGS" ]; then
-    CGO_CFLAGS="-I$s/src"
+    CGO_CFLAGS="-I$s/lib"
 else
-    CGO_CFLAGS="$CGO_CFLAGS -I$s/src"
+    CGO_CFLAGS="$CGO_CFLAGS -I$s/lib"
 fi
 export CGO_CFLAGS
 if [ -z "$CGO_LDFLAGS" ]; then
-    CGO_LDFLAGS="-L$b/src/.libs"
+    CGO_LDFLAGS="-L$b/lib/.libs"
 else
-    CGO_LDFLAGS="$CGO_LDFLAGS -L$b/src/.libs"
+    CGO_LDFLAGS="$CGO_LDFLAGS -L$b/lib/.libs"
 fi
 export CGO_LDFLAGS
 
diff --git a/sparsify/Makefile.am b/sparsify/Makefile.am
index 8df0c93..b7229ff 100644
--- a/sparsify/Makefile.am
+++ b/sparsify/Makefile.am
@@ -48,7 +48,7 @@ virt_sparsify_CPPFLAGS = \
 	-I$(top_builddir) \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 virt_sparsify_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -56,13 +56,13 @@ virt_sparsify_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 975a664..bb8948d 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -93,7 +93,7 @@ virt_sysprep_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src \
+	-I$(top_srcdir)/lib \
 	-I$(top_srcdir)/fish
 virt_sysprep_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
@@ -102,13 +102,13 @@ virt_sysprep_CFLAGS = \
 BOBJECTS = $(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib \
diff --git a/test-tool/Makefile.am b/test-tool/Makefile.am
index 095f116..c4a1b18 100644
--- a/test-tool/Makefile.am
+++ b/test-tool/Makefile.am
@@ -26,7 +26,7 @@ libguestfs_test_tool_SOURCES = test-tool.c
 
 libguestfs_test_tool_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DLOCALEBASEDIR=\""$(datadir)/locale"\"
@@ -37,7 +37,7 @@ libguestfs_test_tool_CFLAGS = \
 
 libguestfs_test_tool_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la
diff --git a/tests/c-api/Makefile.am b/tests/c-api/Makefile.am
index 9d4898b..cb653f7 100644
--- a/tests/c-api/Makefile.am
+++ b/tests/c-api/Makefile.am
@@ -93,14 +93,14 @@ tests_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 tests_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(PCRE_CFLAGS)
 tests_LDADD = \
 	$(PCRE_LIBS) \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
@@ -119,39 +119,39 @@ test_pwd_LDFLAGS = -all-static
 
 test_just_header_SOURCES = test-just-header.c
 test_just_header_CPPFLAGS = \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_just_header_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_just_header_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 if HAVE_CXX
 test_just_header_cxx_SOURCES = test-just-header-cxx.cpp
 test_just_header_cxx_CPPFLAGS = \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_just_header_cxx_CXXFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_just_header_cxx_LDADD = \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 endif
 
 test_create_handle_SOURCES = test-create-handle.c
 test_create_handle_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_create_handle_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_create_handle_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 if HAVE_LIBDL
 test_dlopen_SOURCES = test-dlopen.c
 test_dlopen_CPPFLAGS = \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_dlopen_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
-	-DLIBRARY=\"$(top_builddir)/src/.libs/libguestfs.so.0\"
+	-DLIBRARY=\"$(top_builddir)/lib/.libs/libguestfs.so.0\"
 test_dlopen_LDADD = \
 	-ldl
 endif
@@ -159,107 +159,107 @@ endif
 test_config_SOURCES = test-config.c
 test_config_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_config_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_config_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 test_add_drive_opts_SOURCES = test-add-drive-opts.c
 test_add_drive_opts_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_add_drive_opts_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_add_drive_opts_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 test_last_errno_SOURCES = test-last-errno.c
 test_last_errno_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_last_errno_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_last_errno_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 test_backend_settings_SOURCES = test-backend-settings.c
 test_backend_settings_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_backend_settings_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_backend_settings_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
 	$(LTLIBINTL) \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 test_private_data_SOURCES = test-private-data.c
 test_private_data_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_private_data_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_private_data_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 test_user_cancel_SOURCES = test-user-cancel.c
 test_user_cancel_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_user_cancel_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_user_cancel_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la -lm \
+	$(top_builddir)/lib/libguestfs.la -lm \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 test_debug_to_file_SOURCES = test-debug-to-file.c
 test_debug_to_file_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_builddir)/gnulib/lib
 test_debug_to_file_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_debug_to_file_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 test_environment_SOURCES = test-environment.c
 test_environment_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_builddir)/gnulib/lib
 test_environment_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_environment_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 test_event_string_SOURCES = test-event-string.c
 test_event_string_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_builddir)/gnulib/lib
 test_event_string_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_event_string_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
@@ -267,7 +267,7 @@ if HAVE_LIBVIRT
 test_add_libvirt_dom_SOURCES = test-add-libvirt-dom.c
 test_add_libvirt_dom_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib \
 	-I$(top_builddir)/gnulib/lib
 test_add_libvirt_dom_CFLAGS = \
@@ -275,7 +275,7 @@ test_add_libvirt_dom_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_add_libvirt_dom_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la $(LIBVIRT_LIBS) \
+	$(top_builddir)/lib/libguestfs.la $(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
 	$(LTLIBTHREAD) $(top_builddir)/gnulib/lib/libgnu.la
 endif
diff --git a/tests/charsets/Makefile.am b/tests/charsets/Makefile.am
index 5715402..7621dc2 100644
--- a/tests/charsets/Makefile.am
+++ b/tests/charsets/Makefile.am
@@ -28,12 +28,12 @@ test_charset_fidelity_SOURCES = test-charset-fidelity.c
 test_charset_fidelity_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_charset_fidelity_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_charset_fidelity_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/tests/disks/test-qemu-drive-libvirt.sh b/tests/disks/test-qemu-drive-libvirt.sh
index 3a78dab..316a263 100755
--- a/tests/disks/test-qemu-drive-libvirt.sh
+++ b/tests/disks/test-qemu-drive-libvirt.sh
@@ -31,12 +31,12 @@ if [ -z "$abs_builddir" ]; then
     exit 1
 fi
 
-if [ ! -x ../../src/libvirt-is-version ]; then
+if [ ! -x ../../lib/libvirt-is-version ]; then
     echo "$0: test skipped because libvirt-is-version is not built yet"
     exit 77
 fi
 
-if ! ../../src/libvirt-is-version 1 1 3; then
+if ! ../../lib/libvirt-is-version 1 1 3; then
     echo "$0: test skipped because libvirt is too old (< 1.1.3)"
     exit 77
 fi
diff --git a/tests/events/Makefile.am b/tests/events/Makefile.am
index d2d2e4c..944011c 100644
--- a/tests/events/Makefile.am
+++ b/tests/events/Makefile.am
@@ -35,13 +35,13 @@ test_libvirt_auth_callbacks_SOURCES = test-libvirt-auth-callbacks.c
 test_libvirt_auth_callbacks_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_libvirt_auth_callbacks_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(LIBVIRT_CFLAGS)
 test_libvirt_auth_callbacks_LDADD = \
         $(top_builddir)/common/utils/libutils.la \
-        $(top_builddir)/src/libguestfs.la \
+        $(top_builddir)/lib/libguestfs.la \
         $(LIBVIRT_LIBS) \
         $(LIBXML2_LIBS) \
         $(LTLIBINTL) \
diff --git a/tests/mount-local/Makefile.am b/tests/mount-local/Makefile.am
index f0bba80..19335b3 100644
--- a/tests/mount-local/Makefile.am
+++ b/tests/mount-local/Makefile.am
@@ -34,7 +34,7 @@ test_parallel_mount_local_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/df
 test_parallel_mount_local_CFLAGS = \
 	-pthread \
@@ -43,7 +43,7 @@ test_parallel_mount_local_CFLAGS = \
 test_parallel_mount_local_LDADD = \
 	$(FUSE_LIBS) \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/tests/mountable/Makefile.am b/tests/mountable/Makefile.am
index 0e2cedd..c1a1ebf 100644
--- a/tests/mountable/Makefile.am
+++ b/tests/mountable/Makefile.am
@@ -30,9 +30,9 @@ test_internal_parse_mountable_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_internal_parse_mountable_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_internal_parse_mountable_LDADD = \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/gnulib/lib/libgnu.la
diff --git a/tests/parallel/Makefile.am b/tests/parallel/Makefile.am
index cf67232..7f61440 100644
--- a/tests/parallel/Makefile.am
+++ b/tests/parallel/Makefile.am
@@ -29,13 +29,13 @@ test_parallel_CPPFLAGS = \
 	-DGUESTFS_WARN_DEPRECATED=1 \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_parallel_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_parallel_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
diff --git a/tests/protocol/Makefile.am b/tests/protocol/Makefile.am
index 6c7a76c..8dafc98 100644
--- a/tests/protocol/Makefile.am
+++ b/tests/protocol/Makefile.am
@@ -47,12 +47,12 @@ test_error_messages_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
 	-I$(top_srcdir)/common/protocol -I$(top_builddir)/common/protocol \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_error_messages_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_error_messages_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(top_builddir)/gnulib/lib/libgnu.la
diff --git a/tests/regressions/Makefile.am b/tests/regressions/Makefile.am
index 4f78178..aef6982 100644
--- a/tests/regressions/Makefile.am
+++ b/tests/regressions/Makefile.am
@@ -92,7 +92,7 @@ tests_not_run = \
 	rhbz727178.sh
 
 TESTS_ENVIRONMENT = \
-	NOEXEC_CHECK="$(top_builddir)/src/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \
+	NOEXEC_CHECK="$(top_builddir)/lib/.libs/libguestfs.so $(top_builddir)/daemon/guestfsd" \
 	$(top_builddir)/run --test
 
 check_PROGRAMS = \
@@ -105,31 +105,31 @@ check_PROGRAMS = \
 rhbz501893_SOURCES = rhbz501893.c
 rhbz501893_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 rhbz501893_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 rhbz501893_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 rhbz790721_SOURCES = rhbz790721.c
 rhbz790721_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 rhbz790721_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 rhbz790721_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 rhbz914931_SOURCES = rhbz914931.c
 rhbz914931_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-DGUESTFS_PRIVATE=1
 rhbz914931_CFLAGS = \
 	-pthread \
@@ -137,29 +137,29 @@ rhbz914931_CFLAGS = \
 rhbz914931_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
 	$(LTLIBINTL) \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(top_builddir)/gnulib/lib/libgnu.la
 
 rhbz1055452_SOURCES = rhbz1055452.c
 rhbz1055452_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 rhbz1055452_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 rhbz1055452_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 test_big_heap_SOURCES = test-big-heap.c
 test_big_heap_CPPFLAGS = \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 test_big_heap_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 test_big_heap_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la
+	$(top_builddir)/lib/libguestfs.la
 
 SLOW_TESTS = \
 	rhbz909624.sh
diff --git a/tests/regressions/rhbz1044014.sh b/tests/regressions/rhbz1044014.sh
index 8e0df2a..f9e0455 100755
--- a/tests/regressions/rhbz1044014.sh
+++ b/tests/regressions/rhbz1044014.sh
@@ -34,12 +34,12 @@ if [[ ! ( "$backend" =~ ^libvirt ) ]]; then
     exit 77
 fi
 
-if [ ! -x ../../src/libvirt-is-version ]; then
+if [ ! -x ../../lib/libvirt-is-version ]; then
     echo "$0: test skipped because libvirt-is-version is not built yet"
     exit 77
 fi
 
-if ! ../../src/libvirt-is-version 1 2 1; then
+if ! ../../lib/libvirt-is-version 1 2 1; then
     echo "$0: test skipped because libvirt is too old (< 1.2.1)"
     exit 77
 fi
diff --git a/utils/boot-analysis/Makefile.am b/utils/boot-analysis/Makefile.am
index d472884..4d9149e 100644
--- a/utils/boot-analysis/Makefile.am
+++ b/utils/boot-analysis/Makefile.am
@@ -30,14 +30,14 @@ boot_analysis_SOURCES = \
 boot_analysis_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib
 boot_analysis_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(PCRE_CFLAGS)
 boot_analysis_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(PCRE_LIBS) \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
diff --git a/utils/boot-benchmark/Makefile.am b/utils/boot-benchmark/Makefile.am
index e77e5d9..2e6ca46 100644
--- a/utils/boot-benchmark/Makefile.am
+++ b/utils/boot-benchmark/Makefile.am
@@ -32,13 +32,13 @@ boot_benchmark_SOURCES = \
 boot_benchmark_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/utils/boot-analysis
 boot_benchmark_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 boot_benchmark_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LTLIBINTL) \
 	$(top_builddir)/gnulib/lib/libgnu.la \
diff --git a/utils/qemu-boot/Makefile.am b/utils/qemu-boot/Makefile.am
index 4f0d6a9..7507116 100644
--- a/utils/qemu-boot/Makefile.am
+++ b/utils/qemu-boot/Makefile.am
@@ -26,14 +26,14 @@ qemu_boot_SOURCES = \
 qemu_boot_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/df
 qemu_boot_CFLAGS = \
 	-pthread \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 qemu_boot_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/utils/qemu-speed-test/Makefile.am b/utils/qemu-speed-test/Makefile.am
index c8ee0ec..d7bf59a 100644
--- a/utils/qemu-speed-test/Makefile.am
+++ b/utils/qemu-speed-test/Makefile.am
@@ -24,13 +24,13 @@ qemu_speed_test_SOURCES = \
 qemu_speed_test_CPPFLAGS = \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/df
 qemu_speed_test_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS)
 qemu_speed_test_LDADD = \
 	$(top_builddir)/common/utils/libutils.la \
-	$(top_builddir)/src/libguestfs.la \
+	$(top_builddir)/lib/libguestfs.la \
 	$(LIBXML2_LIBS) \
 	$(LIBVIRT_LIBS) \
 	$(LTLIBINTL) \
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index b0fe917..9189aaf 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -116,7 +116,7 @@ virt_v2v_CPPFLAGS = \
 	-I$(top_builddir) \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 virt_v2v_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(LIBXML2_CFLAGS) \
@@ -128,13 +128,13 @@ BOBJECTS = \
 	$(SOURCES_ML:.ml=.cmo)
 XOBJECTS = $(BOBJECTS:.cmo=.cmx)
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib \
@@ -175,7 +175,7 @@ virt_v2v_copy_to_local_CPPFLAGS = \
 	-I$(top_builddir) \
 	-I$(shell $(OCAMLC) -where) \
 	-I$(top_srcdir)/common/utils \
-	-I$(top_srcdir)/src
+	-I$(top_srcdir)/lib
 virt_v2v_copy_to_local_CFLAGS = \
 	$(WARN_CFLAGS) $(WERROR_CFLAGS) \
 	$(LIBXML2_CFLAGS) \
diff --git a/v2v/domainxml-c.c b/v2v/domainxml-c.c
index 98a6539..c75574a 100644
--- a/v2v/domainxml-c.c
+++ b/v2v/domainxml-c.c
@@ -79,7 +79,7 @@ get_dom_state (virDomainPtr dom)
   return -1;
 }
 
-/* See src/libvirt-auth.c for why we need this. */
+/* See lib/libvirt-auth.c for why we need this. */
 static int
 libvirt_auth_default_wrapper (virConnectCredentialPtr cred,
                               unsigned int ncred,
diff --git a/v2v/test-harness/Makefile.am b/v2v/test-harness/Makefile.am
index e2ba15c..1395e66 100644
--- a/v2v/test-harness/Makefile.am
+++ b/v2v/test-harness/Makefile.am
@@ -33,13 +33,13 @@ SOURCES_ML = \
 if HAVE_OCAML
 if HAVE_OCAML_PKG_LIBVIRT
 
-# -I $(top_builddir)/src/.libs is a hack which forces corresponding -L
+# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
 # option to be passed to gcc, so we don't try linking against an
 # installed copy of libguestfs.
 OCAMLPACKAGES = \
 	-package str,unix,libvirt \
 	-I $(top_builddir)/common/utils/.libs \
-	-I $(top_builddir)/src/.libs \
+	-I $(top_builddir)/lib/.libs \
 	-I $(top_builddir)/gnulib/lib/.libs \
 	-I $(top_builddir)/ocaml \
 	-I $(top_builddir)/mllib \
@@ -73,7 +73,7 @@ libv2vth_a_CPPFLAGS = \
 	-DGUESTFS_PRIVATE=1 \
 	-I$(top_builddir) -I$(OCAMLLIB) -I$(top_srcdir)/ocaml \
 	-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-	-I$(top_srcdir)/src -I$(top_builddir)/src \
+	-I$(top_srcdir)/lib -I$(top_builddir)/lib \
 	-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib
 
 libv2vth_a_CFLAGS = \
-- 
2.9.3




More information about the Libguestfs mailing list