]> git.decadent.org.uk Git - nfs-utils.git/blob - configure.in
Fix silly bug with tcp-wrappers check
[nfs-utils.git] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 AC_INIT([linux nfs-utils],[1.0.11],[nfs@lists.sf.net],[nfs-utils])
4 AC_CANONICAL_BUILD([])
5 AC_CANONICAL_HOST([])
6 AC_CONFIG_SRCDIR(tools/getiversion/getiversion.c)
7 AC_CONFIG_MACRO_DIR(aclocal)
8 AM_INIT_AUTOMAKE
9 AC_PREREQ(2.59)
10 AC_PREFIX_DEFAULT(/usr)
11 AM_MAINTAINER_MODE
12
13 dnl *************************************************************
14 dnl * Define the set of applicable options
15 dnl *************************************************************
16 AC_ARG_WITH(release,
17         [AC_HELP_STRING([--with-release=XXX], [set release to XXX [1]])],
18         RELEASE=$withval,
19         RELEASE=1)
20         AC_SUBST(RELEASE)
21 AC_ARG_WITH(statedir,
22         [  --with-statedir=/foo    use state dir /foo [/var/lib/nfs]],
23         statedir=$withval,
24         statedir=/var/lib/nfs)
25         AC_SUBST(statedir)
26 AC_ARG_WITH(statduser,
27         [AC_HELP_STRING([--with-statduser=rpcuser],
28                         [statd to run under @<:@rpcuser or nobody@:>@]
29         )],
30         statduser=$withval,
31         if test "x$cross_compiling" = "xno"; then
32                 if grep -s '^rpcuser:' /etc/passwd > /dev/null; then
33                         statduser=rpcuser
34                 else
35                         statduser=nobody
36                 fi
37         else
38                 statduser=nobody
39         fi)
40         AC_SUBST(statduser)
41 AC_ARG_ENABLE(nfsv3,
42         [AC_HELP_STRING([--enable-nfsv3],
43                         [enable support for NFSv3 @<:@default=yes@:>@])],
44         enable_nfsv3=$enableval,
45         enable_nfsv3=yes)
46         if test "$enable_nfsv3" = yes; then
47                 AC_DEFINE(NFS3_SUPPORTED, 1, [Define this if you want NFSv3 support compiled in])
48         else
49                 enable_nfsv3=
50         fi
51         AC_SUBST(enable_nfsv3)
52 AC_ARG_ENABLE(nfsv4,
53         [AC_HELP_STRING([--enable-nfsv4],
54                         [enable support for NFSv4 @<:@default=yes@:>@])],
55         enable_nfsv4=$enableval,
56         enable_nfsv4=yes)
57         if test "$enable_nfsv4" = yes; then
58                 AC_DEFINE(NFS4_SUPPORTED, 1, [Define this if you want NFSv4 support compiled in])
59                 IDMAPD=idmapd
60         else
61                 enable_nfsv4=
62                 IDMAPD=
63         fi
64         AC_SUBST(IDMAPD)
65         AC_SUBST(enable_nfsv4)
66         AM_CONDITIONAL(CONFIG_NFSV4, [test "$enable_nfsv4" = "yes"])
67 AC_ARG_ENABLE(gss,
68         [AC_HELP_STRING([--enable-gss],
69                         [enable support for rpcsec_gss @<:@default=yes@:>@])],
70         enable_gss=$enableval,
71         enable_gss=yes)
72         if test "$enable_gss" = yes; then
73                 AC_DEFINE(GSS_SUPPORTED, 1, [Define this if you want rpcsec_gss support compiled in])
74                 GSSD=gssd
75                 SVCGSSD=svcgssd
76         else
77                 enable_gss=
78                 GSSD=
79                 SVCGSSD=
80         fi
81         AC_SUBST(GSSD)
82         AC_SUBST(SVCGSSD)
83         AC_SUBST(enable_gss)
84         AM_CONDITIONAL(CONFIG_GSS, [test "$enable_gss" = "yes"])
85 AC_ARG_ENABLE(kprefix,
86         [AC_HELP_STRING([--enable-kprefix], [install progs as rpc.knfsd etc])],
87         test "$enableval" = "yes" && kprefix=k,
88         kprefix=)
89         AC_SUBST(kprefix)
90 AC_ARG_ENABLE(secure-statd,
91         [AC_HELP_STRING([--enable-secure-statd],
92                         [Only lockd can use statd (security)])],
93         test "$enableval" = "yes" && secure_statd=yes,
94         secure_statd=no)
95         if test "$secure_statd" = yes; then
96                 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.])
97         fi
98         AC_SUBST(secure_statd)
99 AC_ARG_ENABLE(rquotad,
100         [AC_HELP_STRING([--enable-rquotad],
101                         [enable rquotad @<:@default=yes@:>@])],
102         enable_rquotad=$enableval,
103         enable_rquotad=yes)
104         if test "$enable_rquotad" = yes; then
105                 RQUOTAD=rquotad
106         else
107                 RQUOTAD=
108         fi
109         AM_CONDITIONAL(CONFIG_RQUOTAD, [test "$enable_rquotad" = "yes"])
110
111 AC_ARG_ENABLE(mount,
112         [AC_HELP_STRING([--enable-mount],
113                         [Create mount.nfs and don't use the util-linux mount(8) functionality. @<:@default=no@:>@])],
114         enable_mount=$enableval,
115         enable_mount=no)
116         AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
117
118 # Check whether user wants TCP wrappers support
119 AC_TCP_WRAPPERS
120
121 AC_CONFIG_SRCDIR([support/include/config.h.in])
122 AC_CONFIG_HEADERS([support/include/config.h])
123
124 # Checks for programs.
125 AC_PROG_CXX
126 AC_PROG_CC
127 AC_PROG_CPP
128 AC_PROG_INSTALL
129 AC_PROG_LN_S
130 AC_PROG_MAKE_SET
131 AC_PROG_LIBTOOL
132
133 if test "x$cross_compiling" = "xno"; then
134         CC_FOR_BUILD=${CC_FOR_BUILD-${CC-gcc}}
135 else
136         CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
137 fi
138
139 AC_SUBST(CC_FOR_BUILD)
140
141 AC_CHECK_TOOL(AR, ar)
142 AC_CHECK_TOOL(LD, ld)
143
144 AC_HEADER_STDC([])
145 AC_GNULIBC
146 AC_BSD_SIGNALS
147
148 dnl *************************************************************
149 dnl * Check for required libraries
150 dnl *************************************************************
151 AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBNSL="-lnsl"])])
152 AC_SUBST(LIBNSL)
153
154 AC_CHECK_FUNC(connect, ,
155       AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket"],
156                 AC_MSG_ERROR(Function 'socket' not found.), $LIBNSL))
157
158 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"])
159 if test "$enable_nfsv4" = yes; then
160     AC_CHECK_LIB(event, event_dispatch, [libevent=1], AC_MSG_ERROR([libevent needed for nfsv4 support]))
161     AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], AC_MSG_ERROR([libnfsidmap needed for nfsv4 support]))
162     AC_CHECK_HEADERS(event.h, ,AC_MSG_ERROR([libevent needed for nfsv4 support]))
163     AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for nfsv4 support]))
164     dnl librpcsecgss already has a dependency on libgssapi,
165     dnl but we need to make sure we get the right version
166     if test "$enable_gss" = yes; then
167      PKG_CHECK_MODULES(RPCSECGSS, librpcsecgss >= 0.10, ,
168       [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])
169       ]
170      )
171     PKG_CHECK_MODULES(GSSAPI, libgssapi >= 0.9)
172     fi
173
174 fi
175 if test "$knfsd_cv_glibc2" = no; then
176     AC_CHECK_LIB(bsd, daemon, [LIBBSD="-lbsd"])
177 fi
178 AC_CHECK_LIB(blkid, blkid_get_cache, [LIBBLKID="-lblkid"], AC_MSG_ERROR([libblkid needed]))
179 AC_CHECK_HEADER(blkid/blkid.h, , AC_MSG_ERROR([Cannot file libblkid header file blkid/blkid.h]))
180 AC_SUBST(LIBSOCKET)
181 AC_SUBST(LIBCRYPT)
182 AC_SUBST(LIBBSD)
183 AC_SUBST(LIBBLKID)
184
185 if test "$enable_gss" = yes; then
186   dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c
187   AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for gss support]))
188   AC_CHECK_HEADERS(spkm3.h, ,AC_MSG_WARN([could not locate SPKM3 header; will not have SPKM3 support]))
189   dnl the nfs4_set_debug function doesn't appear in all version of the library
190   AC_CHECK_LIB(nfsidmap, nfs4_set_debug,
191                AC_DEFINE(HAVE_NFS4_SET_DEBUG,1,
192                          [Whether nfs4_set_debug() is present in libnfsidmap]),)
193
194   dnl Check for Kerberos V5
195   AC_KERBEROS_V5
196
197   dnl This is not done until here because we need to have KRBLIBS set
198   dnl ("librpcsecgss=1" is so that it doesn't get added to LIBS)
199   AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], AC_MSG_ERROR([librpcsecgss needed for nfsv4 support]), -lgssapi -ldl)
200   AC_CHECK_LIB(rpcsecgss, authgss_set_debug_level,
201                AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, -lgssapi -ldl)
202
203 fi
204
205 dnl *************************************************************
206 dnl Check for headers
207 dnl *************************************************************
208 AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h \
209                  malloc.h memory.h netdb.h netinet/in.h paths.h \
210                  stdlib.h string.h sys/file.h sys/ioctl.h sys/mount.h \
211                  sys/param.h sys/socket.h sys/time.h sys/vfs.h \
212                  syslog.h unistd.h com_err.h et/com_err.h \
213                  ifaddrs.h])
214
215 dnl *************************************************************
216 dnl Checks for typedefs, structures, and compiler characteristics
217 dnl *************************************************************
218 AC_C_CONST
219 AC_TYPE_UID_T
220 AC_C_INLINE
221 AC_TYPE_OFF_T
222 AC_TYPE_PID_T
223 AC_TYPE_SIZE_T
224 AC_HEADER_TIME
225 AC_STRUCT_TM
226
227 dnl *************************************************************
228 dnl Check for functions
229 dnl *************************************************************
230 AC_FUNC_ALLOCA
231 AC_FUNC_CLOSEDIR_VOID
232 AC_FUNC_ERROR_AT_LINE
233 AC_FUNC_FORK
234 AC_FUNC_GETGROUPS
235 AC_FUNC_GETMNTENT
236 AC_PROG_GCC_TRADITIONAL
237 AC_FUNC_LSTAT
238 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
239 AC_HEADER_MAJOR
240 #AC_FUNC_MALLOC
241 AC_FUNC_MEMCMP
242 #AC_FUNC_REALLOC
243 AC_FUNC_SELECT_ARGTYPES
244 AC_TYPE_SIGNAL
245 AC_FUNC_STAT
246 AC_FUNC_VPRINTF
247 AC_CHECK_FUNCS([alarm atexit dup2 fdatasync ftruncate getcwd \
248                gethostbyaddr gethostbyname gethostname getmntent \
249                gettimeofday hasmntopt inet_ntoa innetgr memset mkdir pathconf \
250                realpath rmdir select socket strcasecmp strchr strdup \
251                strerror strrchr strtol strtoul sigprocmask])
252
253
254 dnl *************************************************************
255 dnl Check for data sizes (XXX These should go away with libgssapi pkg-config)
256 dnl *************************************************************
257 AC_CHECK_SIZEOF(short)
258 AC_CHECK_SIZEOF(int)
259 AC_CHECK_SIZEOF(long)
260 AC_CHECK_SIZEOF(size_t)
261 AC_CHECK_SIZEOF(socklen_t)
262
263
264 dnl *************************************************************
265 dnl Export some path names to config.h
266 dnl *************************************************************
267 AC_DEFINE_UNQUOTED(NFS_STATEDIR, "$statedir", [This defines the location of the NFS state files. Warning: this must match definitions in config.mk!])
268
269 if test "x$cross_compiling" = "xno"; then
270         CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-"$CFLAGS"}
271         CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-"$CXXFLAGS"}
272         CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-"$CPPFLAGS"}
273         LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-"$LDFLAGS"}
274 else
275         CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-""}
276         CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-""}
277         CPPFLAGS_FOR_BUILD=${CPPFLAGS_FOR_BUILD-""}
278         LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-""}
279 fi
280
281 AC_SUBST(CFLAGS)
282 AC_SUBST(CXXFLAGS)
283 AC_SUBST(CPPFLAGS)
284 AC_SUBST(LDFLAGS)
285
286 AC_SUBST(CFLAGS_FOR_BUILD)
287 AC_SUBST(CXXFLAGS_FOR_BUILD)
288 AC_SUBST(CPPFLAGS_FOR_BUILD)
289 AC_SUBST(LDFLAGS_FOR_BUILD)
290
291 dnl *************************************************************
292 dnl Set up "global" CFLAGS
293 dnl *************************************************************
294 dnl Use architecture-specific compile flags
295 dnl (We use $host and not $build in case we are cross-compiling)
296 dnl *************************************************************
297 case $host in
298   alpha*)
299     ARCHFLAGS="-mno-fp-regs -ffixed-8" ;;
300   *)
301     ARCHFLAGS="" ;;
302 esac
303
304 my_am_cflags="-Wall $ARCHFLAGS -pipe"
305
306 AC_SUBST([AM_CPPFLAGS], ["-I\${top_srcdir}/support/include -D_FILE_OFFSET_BITS=64"])
307 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
308
309 # Make sure that $ACLOCAL_FLAGS are used during a rebuild
310 AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
311
312 AC_CONFIG_FILES([
313         Makefile
314         linux-nfs/Makefile
315         support/Makefile
316         support/export/Makefile
317         support/include/nfs/Makefile
318         support/include/rpcsvc/Makefile
319         support/include/sys/fs/Makefile
320         support/include/sys/Makefile
321         support/include/Makefile
322         support/misc/Makefile
323         support/nfs/Makefile
324         tools/Makefile
325         tools/getiversion/Makefile
326         tools/locktest/Makefile
327         tools/nlmtest/Makefile
328         tools/rpcdebug/Makefile
329         tools/rpcgen/Makefile
330         utils/Makefile
331         utils/exportfs/Makefile
332         utils/gssd/Makefile
333         utils/idmapd/Makefile
334         utils/lockd/Makefile
335         utils/mount/Makefile
336         utils/mountd/Makefile
337         utils/nfsd/Makefile
338         utils/nfsstat/Makefile
339         utils/rquotad/Makefile
340         utils/showmount/Makefile
341         utils/statd/Makefile])
342 AC_OUTPUT
343