]> git.decadent.org.uk Git - nfs-utils.git/blob - configure.in
174436e9d5e23097fd5fd4e40e5430af43bbe6de
[nfs-utils.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_INIT(rules.mk)
4 AC_PREFIX_DEFAULT(/usr)
5
6 # The nfs-utils version
7 VERSION="1.0.7"
8 AC_SUBST(VERSION)
9
10 dnl *************************************************************
11 dnl * Define the set of applicable options
12 dnl *************************************************************
13 AC_ARG_WITH(release,
14         [  --with-release=XXX      set release to XXX [1]],
15         RELEASE=$withval,
16         RELEASE=1)
17         AC_SUBST(RELEASE)
18 AC_ARG_WITH(statedir,
19         [  --with-statedir=/foo    use state dir /foo [/var/lib/nfs]],
20         statedir=$withval,
21         statedir=/var/lib/nfs)
22         AC_SUBST(statedir)
23 AC_ARG_WITH(statduser,
24         [  --with-statduser=rpcuser user for statd to run under [rpcuser or nobody]],
25         statduser=$withval,
26         if grep -s '^rpcuser:' /etc/passwd > /dev/null; then
27                 statduser=rpcuser
28         else
29                 statduser=nobody
30         fi)
31         AC_SUBST(statduser)
32 AC_ARG_ENABLE(nfsv3,
33         [  --enable-nfsv3          enable support for NFSv3],
34         enable_nfsv3=$enableval,
35         enable_nfsv3=yes)
36         if test "$enable_nfsv3" = yes; then
37                 AC_DEFINE(NFS3_SUPPORTED, 1, [Define this if you want NFSv3 support compiled in])
38         else
39                 enable_nfsv3=
40         fi
41         AC_SUBST(enable_nfsv3)
42 AC_ARG_ENABLE(nfsv4,
43         [  --enable-nfsv4          enable support for NFSv4],
44         enable_nfsv4=$enableval,
45         enable_nfsv4=yes)
46         if test "$enable_nfsv4" = yes; then
47                 AC_DEFINE(NFS4_SUPPORTED, 1, [Define this if you want NFSv4 support compiled in])
48                 IDMAPD=idmapd
49         else
50                 enable_nfsv4=
51                 IDMAPD=
52         fi
53         AC_SUBST(IDMAPD)
54         AC_SUBST(enable_nfsv4)
55 AC_ARG_ENABLE(gss,
56         [  --enable-gss           enable support for rpcsec_gss],
57         enable_gss=$enableval,
58         enable_gss=yes)
59         if test "$enable_gss" = yes; then
60                 AC_DEFINE(GSS_SUPPORTED, 1, [Define this if you want rpcsec_gss support compiled in])
61                 GSSD=gssd
62                 SVCGSSD=svcgssd
63         else
64                 enable_gss=
65                 GSSD=
66                 SVCGSSD=
67         fi
68         AC_SUBST(GSSD)
69         AC_SUBST(SVCGSSD)
70         AC_SUBST(enable_gss)
71 AC_ARG_ENABLE(kprefix,
72         [  --enable-kprefix       install progs as rpc.knfsd etc],
73         test "$enableval" = "yes" && kprefix=k,
74         kprefix=)
75         AC_SUBST(kprefix)
76 AC_ARG_ENABLE(secure-statd,
77         [  --enable-secure-statd  Only lockd can use statd (security)],
78         test "$enableval" = "yes" && secure_statd=yes,
79         secure_statd=no)
80         if test "$secure_statd" = yes; then
81                 AC_DEFINE(RESTRICTED_STATD, 1, [Define this if you want to enable various security checks in statd. These checks basically keep anyone but lockd from using this service.])
82         fi
83         AC_SUBST(secure_statd)
84 AC_ARG_ENABLE(rquotad,
85         [  --enable-rquotad          enable rquotad],
86         enable_rquotad=$enableval,
87         enable_rquotad=yes)
88         if test "$enable_rquotad" = yes; then
89                 RQUOTAD=rquotad
90         else
91                 RQUOTAD=
92         fi
93         AC_SUBST(RQUOTAD)
94 dnl AC_ARG_ENABLE(frob, enable frobnicator,,                enable_frob=test)
95 AC_CONFIG_HEADER(support/include/config.h)
96
97 AC_PROG_CC
98 AC_PROG_CPP
99 AC_PROG_INSTALL
100
101 test "${CC_FOR_BUILD+set}" = set || CC_FOR_BUILD="$CC"
102 AC_SUBST(CC_FOR_BUILD)
103
104 AC_CHECK_TOOL(RANLIB, ranlib, :)
105 AC_CHECK_TOOL(AR, ar)
106 AC_CHECK_TOOL(LD, ld)
107
108 AC_STDC_HEADERS
109 AC_GNULIBC
110 dnl AC_LN_SF
111 dnl AC_BSD_SIGNALS
112
113 dnl *************************************************************
114 dnl * Check for required librarues
115 dnl *************************************************************
116 AC_CHECK_LIB(socket, main, [LIBSOCKET="-lnsl"])
117 AC_CHECK_LIB(nsl, main, [LIBNSL="-lnsl"])
118 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"])
119 if test "$enable_nfsv4" = yes; then
120     AC_CHECK_LIB(event, event_dispatch, [libevent=1], [AC_MSG_ERROR(libevent needed for nfsv4 support)])
121     AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], [AC_MSG_ERROR(libnfsidmap needed for nfsv4 support)])
122     AC_CHECK_HEADERS(event.h, ,[AC_MSG_ERROR(libevent needed for nfsv4 support)])
123     AC_CHECK_HEADERS(nfsidmap.h, ,[AC_MSG_ERROR(libnfsidmap needed for nfsv4 support)])
124 fi
125 if test "$knfsd_cv_glibc2" = no; then
126     AC_CHECK_LIB(bsd, daemon, [LIBBSD="-lbsd"])
127 fi
128 AC_SUBST(LIBSOCKET)
129 AC_SUBST(LIBNSL)
130 AC_SUBST(LIBCRYPT)
131 AC_SUBST(LIBBSD)
132
133 AC_TCP_WRAPPER
134 AC_SUBST(LIBWRAP)
135
136 if test "$enable_gss" = yes; then
137   dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c
138   AC_CHECK_HEADERS(nfsidmap.h, ,[AC_MSG_ERROR(libnfsidmap needed for gss support)])
139   AC_CHECK_HEADERS(spkm3.h, ,[AC_MSG_WARN(could not locate SPKM3 header; will not have SPKM3 support)])
140   
141   dnl Checks for Kerberos
142   dnl NOTE: while we intend to do generic gss-api, currently we
143   dnl have a requirement to get an initial Kerberos machine
144   dnl credential.  Thus, the requirement for Kerberos.
145   dnl The Kerberos gssapi library will be dynamically loaded?
146   AC_MSG_CHECKING(for Kerberos v5)
147   AC_ARG_WITH(krb5,
148   [  --with-krb5=DIR         use Kerberos v5 installation in DIR],
149   [ case "$withval" in
150     yes|no)
151        krb5_with=""
152        ;;
153     *)
154        krb5_with="$withval"
155        ;;
156     esac ]
157   )
158
159   for dir in $krb5_with /usr /usr/kerberos /usr/local /usr/local/krb5 \
160              /usr/krb5 /usr/heimdal /usr/local/heimdal /usr/athena ; do
161     dnl This ugly hack brought on by the split installation of
162     dnl MIT Kerberos on Fedora Core 1
163     K5CONFIG=""
164     if test -f $dir/bin/krb5-config; then
165       K5CONFIG=$dir/bin/krb5-config
166     elif test -f "/usr/kerberos/bin/krb5-config"; then
167       K5CONFIG="/usr/kerberos/bin/krb5-config"
168     fi
169     if test "$K5CONFIG" != ""; then
170       KRBINC=`$K5CONFIG --cflags`
171       KRBLIB=`$K5CONFIG --libs gssapi`
172       K5VERS=`$K5CONFIG --version | head -n 1 | awk '{split($4,v,"."); if (v[[3]] == "") v[[3]] = "0"; print v[[1]]v[[2]]v[[3]] }'`
173       AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
174       if test -f $dir/include/gssapi/gssapi_krb5.h -a \
175               \( -f $dir/lib/libgssapi_krb5.a -o \
176             -f $dir/lib/libgssapi_krb5.so \) ; then
177          AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
178          KRBDIR="$dir"
179          dnl If we are using MIT K5 1.3.1 and before, we *MUST* use the
180          dnl private function (gss_krb5_ccache_name) to get correct
181          dnl behavior of changing the ccache used by gssapi.
182          dnl Starting in 1.3.2, we *DO NOT* want to use
183          dnl gss_krb5_ccache_name, instead we want to set KRB5CCNAME
184          dnl to get gssapi to use a different ccache
185          if test $K5VERS -le 131; then
186            AC_DEFINE(USE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the private function, gss_krb5_cache_name, must be used to tell the Kerberos library which credentials cache to use. Otherwise, this is done by setting the KRB5CCNAME environment variable])
187          fi
188          gssapi_lib=gssapi_krb5
189          break
190       dnl The following ugly hack brought on by the split installation
191       dnl of Heimdal Kerberos on SuSe
192       elif test \( -f $dir/include/heim_err.h -o\
193                  -f $dir/include/heimdal/heim_err.h \) -a \
194                 -f $dir/lib/libroken.a; then
195          AC_DEFINE(HAVE_HEIMDAL, 1, [Define this if you have Heimdal Kerberos libraries])
196          KRBDIR="$dir"
197          gssapi_lib=gssapi
198         break
199       fi
200       CFLAGS=$CFLAGS `$K5CONFIG --cflags`
201     fi
202   done
203   dnl We didn't find a usable Kerberos environment
204   if test "x$KRBDIR" = "x"; then
205     if test "x$krb5_with" = "x"; then
206       AC_MSG_ERROR(Kerberos v5 with GSS support not found: consider --disable-gss or --with-krb5=)
207     else
208       AC_MSG_ERROR(Kerberos v5 with GSS support not found at $krb5_with)
209     fi
210   fi
211   CFLAGS="$CFLAGS `$K5CONFIG --cflags`"
212   AC_MSG_RESULT($KRBDIR)
213
214   dnl Now check for functions within gssapi library
215   AC_CHECK_LIB($gssapi_lib, gss_krb5_export_lucid_sec_context,
216     AC_DEFINE(HAVE_LUCID_CONTEXT_SUPPORT, 1, [Define this if the Kerberos GSS library supports gss_krb5_export_lucid_sec_context]), ,$KRBLIB)
217   AC_CHECK_LIB($gssapi_lib, gss_krb5_set_allowable_enctypes,
218     AC_DEFINE(HAVE_SET_ALLOWABLE_ENCTYPES, 1, [Define this if the Kerberos GSS library supports gss_krb5_set_allowable_enctypes]), ,$KRBLIB)
219   AC_CHECK_LIB($gssapi_lib, gss_krb5_ccache_name,
220     AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME, 1, [Define this if the Kerberos GSS library supports gss_krb5_ccache_name]), ,$KRBLIB)
221
222   dnl If they specified a directory and it didn't work, give them a warning
223   if test "x$krb5_with" != "x" -a "$krb5_with" != "$KRBDIR"; then
224     AC_MSG_WARN(Using $KRBDIR instead of requested value of $krb5_with for Kerberos!)
225   fi
226
227   dnl This is not done until here because we need to have KRBLIB set
228   dnl "librpcsecgss=1" is so that it doesn't get added to LIBS
229   AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], [AC_MSG_ERROR(librpcsecgss needed for nfsv4 support)], $KRBLIB)
230   AC_CHECK_LIB(rpcsecgss, authgss_set_debug_level,
231                AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, $KRBLIB)
232
233   AC_SUBST([KRBDIR])
234   AC_SUBST([KRBLIB])
235   AC_SUBST([KRBINC])
236   AC_SUBST([K5VERS])
237 fi
238
239 dnl *************************************************************
240 dnl Check for headers
241 dnl *************************************************************
242 dnl AC_HAVE_HEADERS(string.h)
243 AC_HAVE_HEADERS(com_err.h)
244 AC_HAVE_HEADERS(et/com_err.h)
245
246 dnl *************************************************************
247 dnl Check for functions
248 dnl *************************************************************
249 AC_HAVE_FUNCS(innetgr)
250
251 dnl *************************************************************
252 dnl Check for data sizes
253 dnl *************************************************************
254 AC_CHECK_SIZEOF(short)
255 AC_CHECK_SIZEOF(int)
256 AC_CHECK_SIZEOF(long)
257 AC_CHECK_SIZEOF(size_t)
258
259 dnl *************************************************************
260 dnl Export some path names to config.h
261 dnl *************************************************************
262 AC_DEFINE_UNQUOTED(NFS_STATEDIR, "$statedir", [This defines the location of the NFS state files. Warning: this must match definitions in config.mk!])
263
264 AC_SUBST(LDFLAGS)
265 AC_SUBST(CXXFLAGS)
266 AC_SUBST(CFLAGS)
267 AC_OUTPUT(config.mk utils/Makefile)