Added SILC Thread Queue API
[crypto.git] / apps / silcer / macros / gnome-vfs.m4
1 dnl GNOME_VFS_CHECKS
2 dnl   Check for various functions needed by libvfs.
3 dnl   This has various effects:
4 dnl     Sets GNOME_VFS_LIBS to libraries required
5 dnl     Sets termnet  to true or false depending on whether it is required.
6 dnl        If yes, defines USE_TERMNET.
7 dnl     Sets vfs_flags to "pretty" list of vfs implementations we include.
8 dnl     Sets shell variable use_vfs to yes (default, --with-vfs) or
9 dnl        "no" (--without-vfs).
10 dnl     Calls AC_SUBST(mcserv), which is either empty or "mcserv".
11
12 dnl Private define
13 AC_DEFUN([GNOME_WITH_VFS],[
14   dnl FIXME: network checks should probably be in their own macro.
15   AC_CHECK_LIB(nsl, t_accept)
16   AC_CHECK_LIB(socket, socket)
17
18   have_socket=no
19   AC_CHECK_FUNCS(socket, have_socket=yes)
20   if test $have_socket = no; then
21     # socket is not in the default libraries.  See if it's in some other.
22     for lib in bsd socket inet; do
23       AC_CHECK_LIB($lib, socket, [
24           LIBS="$LIBS -l$lib"
25           have_socket=yes
26           AC_DEFINE(HAVE_SOCKET)
27           break])
28     done
29   fi
30
31   have_gethostbyname=no
32   AC_CHECK_FUNC(gethostbyname, have_gethostbyname=yes)
33   if test $have_gethostbyname = no; then
34     # gethostbyname is not in the default libraries.  See if it's in some other.
35     for lib in bsd socket inet; do
36       AC_CHECK_LIB($lib, gethostbyname, [LIBS="$LIBS -l$lib"; have_gethostbyname=yes; break])
37     done
38   fi
39
40   vfs_flags="tarfs"
41   use_net_code=false
42   if test $have_socket = yes; then
43       AC_STRUCT_LINGER
44       AC_CHECK_FUNCS(pmap_set, , [
45          AC_CHECK_LIB(rpc, pmap_set, [
46            LIBS="-lrpc $LIBS"
47           AC_DEFINE(HAVE_PMAP_SET)
48           ])])
49       AC_CHECK_FUNCS(pmap_getport pmap_getmaps rresvport)
50       dnl add for source routing support setsockopt
51       AC_CHECK_HEADERS(rpc/pmap_clnt.h)
52       vfs_flags="$vfs_flags, mcfs, ftpfs, fish"
53       use_net_code=true
54   fi
55
56   dnl
57   dnl Samba support
58   dnl
59   smbfs=""
60   SAMBAFILES=""
61   AC_ARG_WITH(samba,
62           [--with-samba             Support smb virtual file system],[
63           if test "x$withval" != "xno"; then
64                   AC_DEFINE(WITH_SMBFS)
65                   vfs_flags="$vfs_flags, smbfs"
66                   smbfs="smbfs.o"
67                   SAMBAFILES="\$(SAMBAFILES)"
68           fi
69   ])
70   AC_SUBST(smbfs)
71   AC_SUBST(SAMBAFILES)
72   
73   dnl
74   dnl The termnet support
75   dnl
76   termnet=false
77   AC_ARG_WITH(termnet,
78           [--with-termnet             If you want a termified net support],[
79           if test x$withval = xyes; then
80                   AC_DEFINE(USE_TERMNET)
81                   termnet=true          
82           fi
83   ])
84
85   TERMNET=""
86   AC_DEFINE(USE_VFS)
87   if $use_net_code; then
88      AC_DEFINE(USE_NETCODE)
89   fi
90   mcserv=
91   if test $have_socket = yes; then
92      mcserv="mcserv"
93      if $termnet; then
94         TERMNET="-ltermnet"
95      fi
96   fi
97
98   AC_SUBST(TERMNET)
99   AC_SUBST(mcserv)
100
101 dnl FIXME:
102 dnl GNOME_VFS_LIBS=
103
104 ])
105
106 AC_DEFUN([GNOME_VFS_CHECKS],[
107         use_vfs=yes
108         AC_ARG_WITH(vfs,
109                 [--with-vfs                Compile with the VFS code],
110                 use_vfs=$withval
111         )
112         case $use_vfs in
113                 yes)    GNOME_WITH_VFS;;
114                 no)     use_vfs=no;;
115                 *)      use_vfs=no;;
116                         dnl Should we issue a warning?
117         esac
118 ])
119
120