[gvfs/mtp-backend: 18/64] MTP: Add conditional configuration against libmtp.



commit 18696cfef55329dcb1a7c7de0b268ddc6f75cb21
Author: Philip Langdale <philipl overt org>
Date:   Sat Aug 11 10:12:23 2012 -0700

    MTP: Add conditional configuration against libmtp.

 configure.ac        |   20 ++++++++++++++++++++
 daemon/Makefile.am  |   43 ++++++++++++++++++++++---------------------
 monitor/Makefile.am |    6 +++++-
 3 files changed, 47 insertions(+), 22 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b8cc55c..54ea0bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -493,6 +493,25 @@ AC_SUBST(BLURAY_CFLAGS)
 AC_SUBST(BLURAY_LIBS)
 AM_CONDITIONAL(HAVE_BLURAY, [test "$msg_bluray" = "yes"])
 
+dnl *************************
+dnl *** Check for libmtp ***
+dnl *************************
+AC_ARG_ENABLE(libmtp, AS_HELP_STRING([--disable-libmtp],[build without libmtp support]))
+msg_libmtp=no
+LIBMTP_LIBS=
+LIBMTP_CFLAGS=
+
+if test "x$enable_libmtp" != "xno" -a "x$msg_gudev" = "xyes"; then
+  PKG_CHECK_EXISTS(libmtp, msg_libmtp=yes)
+
+  if test "x$msg_libmtp" = "xyes"; then
+    PKG_CHECK_MODULES(LIBMTP, libmtp >= 1.1.0)
+    AC_DEFINE(HAVE_LIBMTP, 1, [Define to 1 if libmtp is available])
+  fi
+fi
+
+AM_CONDITIONAL(USE_LIBMTP, [test "$msg_libmtp" = "yes"])
+
 dnl ==========================================================================
 dnl Samba 3.0
 
@@ -848,6 +867,7 @@ echo "
 	FUSE support:                 $msg_fuse
         CDDA support:                 $msg_cdda
         Gphoto2 support:              $msg_gphoto2
+        MTP support:                  $msg_libmtp
 	archive support:              $msg_archive
 	AFC support:                  $msg_afc
         AFP support:                  $msg_afp
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 38561c0..45b76f5 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -39,10 +39,10 @@ service_DATA = gvfs-daemon.service
 %.mount: %.mount.in ../config.log
 	$(AM_V_GEN) $(SED) -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
 
-libexec_PROGRAMS=gvfsd gvfsd-sftp gvfsd-trash gvfsd-computer gvfsd-burn gvfsd-localtest gvfsd-ftp gvfsd-network gvfsd-mtp
+libexec_PROGRAMS=gvfsd gvfsd-sftp gvfsd-trash gvfsd-computer gvfsd-burn gvfsd-localtest gvfsd-ftp gvfsd-network
 
-mount_in_files = sftp.mount.in ftp.mount.in trash.mount.in computer.mount.in burn.mount.in localtest.mount.in network.mount.in mtp.mount.in
-mount_DATA =  sftp.mount ftp.mount trash.mount computer.mount burn.mount localtest.mount network.mount mtp.mount
+mount_in_files = sftp.mount.in ftp.mount.in trash.mount.in computer.mount.in burn.mount.in localtest.mount.in network.mount.in
+mount_DATA =  sftp.mount ftp.mount trash.mount computer.mount burn.mount localtest.mount network.mount
 
 mount_in_files +=recent.mount.in
 if USE_GTK
@@ -79,6 +79,12 @@ mount_DATA += gphoto2.mount
 libexec_PROGRAMS += gvfsd-gphoto2
 endif
 
+mount_in_files += mtp.mount.in
+if USE_LIBMTP
+mount_DATA += mtp.mount
+libexec_PROGRAMS += gvfsd-mtp
+endif
+
 mount_in_files += obexftp.mount.in
 if USE_OBEXFTP
 mount_DATA += obexftp.mount
@@ -216,24 +222,6 @@ gvfsd_localtest_CPPFLAGS = \
 
 gvfsd_localtest_LDADD = $(libraries)
 
-gvfsd_mtp_SOURCES = \
-	gvfsbackendmtp.c gvfsbackendmtp.h \
-	daemon-main.c daemon-main.h \
-	daemon-main-generic.c
-
-gvfsd_mtp_CPPFLAGS = \
-	-DBACKEND_HEADER=gvfsbackendmtp.h \
-	-DDEFAULT_BACKEND_TYPE=mtp \
-	-DBACKEND_TYPES='"mtp", G_VFS_TYPE_BACKEND_MTP,'
-if USE_GUDEV
-gvfsd_mtp_CPPFLAGS += $(GUDEV_CFLAGS)
-endif
-
-gvfsd_mtp_LDADD = $(libraries) -lmtp
-if USE_GUDEV
-gvfsd_mtp_LDADD += $(GUDEV_LIBS)
-endif
-
 gvfsd_smb_SOURCES = \
 	gvfsbackendsmb.c gvfsbackendsmb.h libsmb-compat.h \
 	daemon-main.c daemon-main.h \
@@ -458,6 +446,19 @@ else
 gvfsd_gphoto2_LDADD = $(libraries) $(GPHOTO2_LIBS) $(HAL_LIBS)
 endif
 
+gvfsd_mtp_SOURCES = \
+	gvfsbackendmtp.c gvfsbackendmtp.h \
+	daemon-main.c daemon-main.h \
+	daemon-main-generic.c
+
+gvfsd_mtp_CPPFLAGS = \
+	-DBACKEND_HEADER=gvfsbackendmtp.h \
+	-DDEFAULT_BACKEND_TYPE=mtp \
+	-DBACKEND_TYPES='"mtp", G_VFS_TYPE_BACKEND_MTP,' \
+	$(GUDEV_CFLAGS) $(LIBMTP_CFLAGS)
+
+gvfsd_mtp_LDADD = $(libraries) $(GUDEV_LIBS) $(LIBMTP_LIBS)
+
 gvfsd_http_SOURCES = \
 	soup-input-stream.c soup-input-stream.h \
 	gvfsbackendhttp.c gvfsbackendhttp.h \
diff --git a/monitor/Makefile.am b/monitor/Makefile.am
index 9bf4e8d..7a4e87f 100644
--- a/monitor/Makefile.am
+++ b/monitor/Makefile.am
@@ -1,5 +1,5 @@
 DIST_SUBDIRS = proxy hal gdu gphoto2 afc udisks2 mtp
-SUBDIRS = proxy mtp
+SUBDIRS = proxy
 
 if USE_HAL
 SUBDIRS += hal
@@ -20,3 +20,7 @@ endif
 if USE_AFC
 SUBDIRS += afc
 endif
+
+if USE_LIBMTP
+SUBDIRS += mtp
+endif



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