mc-vfs-smb.m4 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. dnl @synopsis AC_MC_VFS_SMB
  2. dnl
  3. dnl Adds Samba support
  4. dnl
  5. dnl @author Slava Zanko <slavazanko@gmail.com>
  6. dnl @version 2013-03-05
  7. dnl @license GPL
  8. dnl @copyright Free Software Foundation, Inc.
  9. dnl check for ncurses in user supplied path
  10. AC_DEFUN([MC_CHECK_SAMBA_BY_PATH], [
  11. ac_samba_inc_path=[$1]
  12. ac_samba_lib_path=[$2]
  13. if test x"$ac_samba_inc_path" != x; then
  14. ac_samba_inc_path="-I"$ac_samba_inc_path
  15. fi
  16. if test x"$ac_samba_lib_path" != x; then
  17. ac_samba_lib_path="-L"$ac_samba_lib_path
  18. fi
  19. saved_CPPFLAGS="$CPPFLAGS"
  20. saved_LDFLAGS="$LDFLAGS"
  21. CPPFLAGS="$CPPFLAGS $ac_samba_inc_path"
  22. LDFLAGS="$LDFLAGS $ac_samba_lib_path"
  23. dnl Check for the headers
  24. AC_CHECK_HEADERS([libsmbclient.h],
  25. [AC_CHECK_LIB(smbclient, smbc_init, [found_samba=yes], [found_samba=no], [])],
  26. [found_samba=no], [])
  27. if test x"$found_samba" != x"yes"; then
  28. CPPFLAGS="$saved_CPPFLAGS"
  29. LDFLAGS="$saved_LDPFLAGS"
  30. AC_MSG_ERROR([Samba's development files not found])
  31. fi
  32. ])
  33. dnl Samba support
  34. AC_DEFUN([AC_MC_VFS_SMB],
  35. [
  36. AC_ARG_ENABLE([vfs-smb],
  37. AS_HELP_STRING([--enable-vfs-smb], [Support for SMB filesystem @<:@no@:>@]),
  38. [
  39. if test "x$enableval" = "xno"; then
  40. enable_vfs_smb=no
  41. else
  42. enable_vfs_smb=yes
  43. fi
  44. ],
  45. [enable_vfs_smb=no])
  46. if test "$enable_vfs" = "yes" -a x"$enable_vfs_smb" != x"no"; then
  47. dnl checks for Samba-3
  48. AC_ARG_WITH([samba-includes],
  49. AS_HELP_STRING([--with-samba-includes=@<:@DIR@:>@],
  50. [set path to Samba includes @<:@default=/usr/include@:>@; make sense only if --enable-vfs-smb=yes]
  51. ),
  52. [ac_samba_inc_path="$withval"],
  53. [ac_samba_inc_path=""]
  54. )
  55. AC_ARG_WITH([samba-libs],
  56. AS_HELP_STRING([--with-samba-libs=@<:@DIR@:>@],
  57. [set path to Samba library @<:@default=/usr/lib@:>@; make sense only if --enable-vfs-smb=yes]
  58. ),
  59. [ac_samba_lib_path="$withval"],
  60. [ac_samba_lib_path=""]
  61. )
  62. if test x"$ac_samba_lib_path" != x -o x"$ac_samba_inc_path" != x; then
  63. echo 'checking Samba headers in specified place ...'
  64. MC_CHECK_SAMBA_BY_PATH([$ac_samba_inc_path],[$ac_samba_lib_path])
  65. else
  66. found_samba=no
  67. dnl Just in case: search Samba3's pkgconfig settings
  68. PKG_CHECK_MODULES(SAMBA3, [smbclient >= 0.0.1], [found_samba=yes], [:])
  69. if test x"$found_samba" = "xyes"; then
  70. MCLIBS="$MCLIBS $SAMBA3_LIBS"
  71. CPPFLAGS="$CPPFLAGS $SAMBA3_CFLAGS"
  72. else
  73. if test x"$found_samba" = "xno"; then
  74. dnl Search in /usr
  75. found_samba=yes
  76. echo 'checking Samba headers in /usr ...'
  77. MC_CHECK_SAMBA_BY_PATH([],[])
  78. if test x"$found_samba" = "xno"; then
  79. dnl Search in /usr/local
  80. found_samba=yes
  81. echo 'checking Samba headers in /usr/local ...'
  82. MC_CHECK_SAMBA_BY_PATH([/usr/local/include],[/usr/local/lib])
  83. fi
  84. fi
  85. fi
  86. fi
  87. if test x"$found_samba" != "xno"; then
  88. AC_MC_VFS_ADDNAME([smb])
  89. AC_DEFINE([ENABLE_VFS_SMB], [1], [Define to enable VFS over SMB])
  90. LDFLAGS="$LDFLAGS -lsmbclient"
  91. AM_CONDITIONAL([ENABLE_VFS_SMB], [test "1" = "1"])
  92. else
  93. exit 1
  94. fi
  95. else
  96. AM_CONDITIONAL([ENABLE_VFS_SMB], [test "1" = "2"])
  97. fi
  98. ])