GNOME Bugzilla – Bug 782446
gvfs cannot find -lsmbclient on FreeBSD because the result of pkg-config --libs is not used
Last modified: 2017-05-15 09:48:57 UTC
I have samba 4.4.13 installed on my FreeBSD desktop system, but gvfs cannot find -lsmbclient and automatically disables samba support. checking for SMBCLIENT... yes checking libsmbclient.h usability... yes checking libsmbclient.h presence... yes checking for libsmbclient.h... yes checking for smbc_getFunctionStatVFS in -lsmbclient... no checking for smbc_new_context in -lsmbclient... no checking for Samba libraries... no gvfs configuration summary: Samba support: no The reason of the problem is that the configure script never uses flags returned by pkg-config. Even if the script uses PKG_CHECK_MODULES to find smbclient library, it never uses SMBCLIENT_LIBS. It may be possible to workaround the issue by manually passing --with-samba-libs option, but I think it is better to get it work by default because pkg-config can return the correct result.
Created attachment 351556 [details] [review] build: Use flags returned by pkg-config to find smbclient Previously, the result returned PKG_CHECK_MODULES is only used to find header files, and --with-samba-libs option is required if the shared library is not installed in the default search path. This commit changes it to use the result returned by pkg-config to find both header files and the shared library when --with-samba-libs is not used, preventing samba feature from being unexpectedly disabled on FreeBSD.
Review of attachment 351556 [details] [review]: Thanks! However, I think we can rely on PKG_CHECK_MODULES these days and that the old detection code may be removed instead of updating them. What do you think? Can you please update your patch?
Created attachment 351726 [details] [review] build: Use flags returned by pkg-config to find smbclient Previously, the result returned by PKG_CHECK_MODULES is only used to find header files, and --with-samba-libs option is required if the shared library is not installed in the default search path. This commit replaces the old detection code with simple pkg-config calls, making it easier to find and specify the smbclient library. Yes, using PKG_CHECK_MODULES not only simplifies the code but also makes debugging easier. This patch is based on the libusb check found in the same file.
Created attachment 351727 [details] [review] build: Use flags returned by pkg-config to find smbclient Previously, the result returned by PKG_CHECK_MODULES is only used to find header files, and --with-samba-libs option is required if the shared library is not installed in the default search path. This commit replaces the old detection code with simple pkg-config calls, making it easier to find and specify the smbclient library. Fix the AC_DEFINE macro usage.
Attachment 351727 [details] pushed as 18b24b2 - build: Use flags returned by pkg-config to find smbclient Thanks a lot for your contribution!