~ubuntu-branches/ubuntu/maverick/autofs5/maverick-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
#
# configure.in for the autofs daemon

AC_PREREQ(2.5)

#
# Disable caching (the script is tiny, and it doesn't work with --with-path)
# then start autofs
#
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
AC_INIT(.autofs-5.0.4)

#
# autofs installs by default in /usr
#
AC_PREFIX_DEFAULT(/usr)

#
# The user can specify --with-path=PATH rather than relying on the default
#
searchpath="/usr/bin:/bin:/usr/sbin:/sbin"
AC_ARG_WITH(path,
[  --with-path=PATH	  look in PATH for binaries needed by the automounter],
	if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
	then
		:
	else
		searchpath="${withval}"
	fi
)

AC_MSG_CHECKING([for binaries in])
AC_MSG_RESULT([$searchpath])

#
# Make sure we have "/proc"
#
AF_LINUX_PROCFS()

#
# Location of init.d directory?
#
AF_INIT_D()
AC_SUBST(initdir)

#
# Location of system config script directory?
#
AF_CONF_D()
AC_ARG_WITH(confdir,
[  --with-confdir=DIR	  use DIR for autofs configuration files],
	if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
	then
		:
	else
		confdir="${withval}"
	fi
)
AC_MSG_CHECKING([for autofs configuration file directory])
AC_MSG_RESULT([$confdir])
AC_SUBST(confdir)

#
# The user can specify --with-mapsdir=PATH to specify autofs maps go
#
AF_MAP_D()
AC_ARG_WITH(mapdir,
[  --with-mapdir=PATH	  look in PATH for mount maps used by the automounter],
	if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
	then
		:
	else
		mapdir="${withval}"
	fi
)
AC_MSG_CHECKING([for autofs maps directory])
AC_MSG_RESULT([$mapdir])
AC_SUBST(mapdir)

#
# The user can specify --with-fifodir=PATH to specify where autofs fifos go
#
AF_FIFO_D()
AC_ARG_WITH(fifodir,
[  --with-fifodir=PATH	   use PATH as the directory for fifos used by the automounter],
	if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
	then
		:
	else
		fifodir="${withval}"
	fi
)
AC_MSG_CHECKING([for autofs fifos directory])
AC_MSG_RESULT([$fifodir])
AC_SUBST(fifodir)

#
# The user can specify --with-flagdir=PATH to specify where autofs flag file goes
#
AF_FLAG_D()
AC_ARG_WITH(flagdir,
[  --with-flagdir=PATH	   use PATH as the directory for the flag file used by the automounter],
	if test -z "$withval" -o "$withval" = "yes" -o "$withval" = "no"
	then
		:
	else
		filagdir="${withval}"
	fi
)
AC_MSG_CHECKING([for autofs flag file directory])
AC_MSG_RESULT([$flagdir])
AC_SUBST(flagdir)

#
# Optional include dmalloc
#
AM_WITH_DMALLOC()
AC_SUBST(DMALLOCLIB)

#
# Programs needed for various system functions or modules
#
AF_PATH_INCLUDE(MOUNT, mount, /bin/mount, $searchpath)
AF_PATH_INCLUDE(UMOUNT, umount, /bin/umount, $searchpath)
AF_PATH_INCLUDE(E2FSCK, fsck.ext2 e2fsck, , $searchpath)
AF_PATH_INCLUDE(E3FSCK, fsck.ext3 e3fsck, , $searchpath)
AF_PATH_INCLUDE(MODPROBE, modprobe, , $searchpath)

AF_CHECK_PROG(LEX, flex lex, , $searchpath)
AF_CHECK_PROG(YACC, bison, , $searchpath)
AF_CHECK_PROG(RANLIB, ranlib, , $searchpath)
AF_CHECK_PROG(RPCGEN, rpcgen, , $searchpath)

#
# Newer mounts have the -s (sloppy) option to ignore unknown options,
# good for portability
#
AF_SLOPPY_MOUNT()

# LDAP SASL auth need libxml
AF_CHECK_LIBXML()

#
# glibc/libc 6 new libraries
#
AC_CHECK_LIB(nsl, yp_match, LIBNSL="-lnsl")
AC_SUBST(LIBNSL)

AC_CHECK_LIB(resolv, res_query, LIBRESOLV="-lresolv")
AC_SUBST(LIBRESOLV)

#
# Hesiod support?  Expect that this may have a special directory...
#
AF_tmp_ldflags="$LDFLAGS"
LIBHESIOD=''
HAVE_HESIOD=''
AC_ARG_WITH(hesiod,
[  --with-hesiod=DIR	  enable Hesiod support (libs and includes in DIR)],
	if test "$withval" = no
	then
		HAVE_HESIOD=0	# Disable
	elif test -z "$withval" -o "$withval" = 'yes'
	then
		: Search for Hesiod in normal directory path
	else
		: Search for Hesiod in specific directory
		LDFLAGS="$LDFLAGS -L${withval}/lib"
		LIBHESIOD="-L${withval}/lib"
		HESIOD_FLAGS="-I${withval}/include"
	fi
)	

if test -z "$HAVE_HESIOD" -o "$HAVE_HESIOD" != "0"
then
	HAVE_HESIOD=0
	AF_CHECK_LIBHESIOD()
	if test "$HAVE_HESIOD" == "1"; then
		AC_DEFINE(WITH_HESIOD,1,
			[Define if using Hesiod as a source of automount maps])
	fi
fi
AC_SUBST(HAVE_HESIOD)
AC_SUBST(LIBHESIOD)
AC_SUBST(HESIOD_FLAGS)
LDFLAGS="${AF_tmp_ldflags}"

# NIS+ support?
HAVE_NISPLUS=0
AC_CHECK_HEADER(rpcsvc/nis.h, HAVE_NISPLUS=1)
AC_SUBST(HAVE_NISPLUS)

#
# OpenLDAP support?  Expect that this may have a special directory...
#
AF_tmp_ldflags="$LDFLAGS"
LIBLDAP=''
HAVE_LDAP=''
AC_ARG_WITH(openldap,
[  --with-openldap=DIR	  enable OpenLDAP map support (libs and includes in DIR)],
	if test "$withval" = 'no'; then
		HAVE_LDAP=0	# Disable 
	elif test -z "$withval" -o "$withval" = 'yes'
	then
		: Search for LDAP in normal directory path
	else
		: Search for LDAP in specific directory
		LDFLAGS="$LDFLAGS -L${withval}/lib"
		LIBLDAP="-L${withval}/lib"
		LDAP_FLAGS="-I${withval}/include"
	fi
)
if test -z "$HAVE_LDAP" -o "$HAVE_LDAP" != "0"; then
	HAVE_LDAP=0
	LDAP_FLAGS="$LDAP_FLAGS -DLDAP_DEPRECATED=1"
	AC_CHECK_LIB(ldap, ldap_initialize, HAVE_LDAP=1 LIBLDAP="$LIBLDAP -lldap -llber -lresolv", ,
		     -llber -lresolv $LIBS)
	if test "$HAVE_LDAP" = "1"; then
		AC_DEFINE(WITH_LDAP,1,
			[Define if using LDAP as a source of automount maps])
	fi
	AF_CHECK_FUNC_LDAP_CREATE_PAGE_CONTROL()
	AF_CHECK_FUNC_LDAP_PARSE_PAGE_CONTROL()
fi

AC_SUBST(LDAP_FLAGS)
AC_SUBST(HAVE_LDAP)
AC_SUBST(LIBLDAP)
LDFLAGS="${AF_tmp_ldflags}"

#
# SASL support
#   configure magic taken from:
#	http://www.timof.qipc.org/autofs/autofs-4.1.4-ldap-20050930.patch
#

AF_tmp_ldflags="$LDFLAGS"
LIBSASL=''
HAVE_SASL=''
AC_ARG_WITH(sasl,
[  --with-sasl=DIR	  enable SASL support for LDAP maps (libs and includes in DIR)],
	if test "$withval" = 'no'; then
		HAVE_SASL=0     # Disable
	elif test -z "$withval" -o "$withval" = 'yes'
	then
		: Search for SASL in normal directory path
	else
		: Search for SASL in specific directory
		HAVE_SASL=1
		LDFLAGS="$LDFLAGS -L${withval}/lib"
		LIBSASL="-L${withval}/lib"
		SASL_FLAGS="-I${withval}/include"
	fi
)
if test -z "$HAVE_SASL" -o "$HAVE_SASL" != "0" -a "$HAVE_LIBXML" == "1"
then
	HAVE_SASL=0
	AC_CHECK_LIB(sasl2, sasl_client_start, HAVE_SASL=1 LIBSASL="$LIBSASL -lsasl2", , -lsasl2 $LIBS)
	if test "$HAVE_SASL" == "1"; then
		AC_DEFINE(WITH_SASL,1,
			[Define if using SASL authentication with the LDAP module])
	fi
fi

AC_SUBST(XML_FLAGS)
AC_SUBST(XML_LIBS)
AC_SUBST(SASL_FLAGS)
AC_SUBST(HAVE_SASL)
AC_SUBST(LIBSASL)
LDFLAGS="${AF_tmp_ldflags}"

#
# Does gcc support building position independent executables?
#
AC_PROG_CC
cat > pietest.c <<EOF
int main(void) { return 0; }
EOF
CFLAGS=-fPIE
LDFLAGS=-pie
DAEMON_CFLAGS=
DAEMON_LDFLAGS=
AC_MSG_CHECKING([whether gcc -fPIE works])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[]], [[int main(void) {return 0;}]])],
	      [gcc_supports_pie=yes], [gcc_supports_pie=no])
AC_MSG_RESULT([$gcc_supports_pie])
if test $gcc_supports_pie = yes ; then
	DAEMON_CFLAGS="-fPIE"
	DAEMON_LDFLAGS="-pie"
fi
rm -f pietest.c
AC_SUBST(DAEMON_CFLAGS)
AC_SUBST(DAEMON_LDFLAGS)

#
# Enable ability to access value in external env variable
#
AC_ARG_ENABLE(ext-env,
[  --disable-ext-env	  disable search in environment for substitution variable],,
	enableval=yes)
if test x$enable_ext_env = xyes; then
        AC_DEFINE(ENABLE_EXT_ENV, 1, [leave this alone])
fi

#
# Disable use of locking when spawning mount command
#
AC_ARG_ENABLE(mount-locking,
[  --disable-mount-locking disable use of locking when spawning mount command],,
	enableval=yes)
if test x$enable_mount_locking = xyes -o x$enableval = xyes; then
	AC_DEFINE(ENABLE_MOUNT_LOCKING, 1, [Disable use of locking when spawning mount command])
fi

#
# Enable forced shutdown on USR1 signal (unlink umounts all mounts).
#
AC_ARG_ENABLE(forced-shutdown,
[  --enable-force-shutdown enable USR1 signal to force unlink umount of any
			  busy mounts during shutdown],,
	enableval=no)
if test x$enable_forced_shutdown = xyes -o x$enableval = xyes; then
	AC_DEFINE(ENABLE_FORCED_SHUTDOWN, 1, [Enable forced shutdown on USR1 signal])
fi

#
# Enable exit, ignoring busy mounts.
#
AC_ARG_ENABLE(ignore-busy,
[  --enable-ignore-busy	  enable exit without umounting busy mounts during
			  shutdown],,
	enableval=no)
if test x$enable_ignore_busy_mounts = xyes -o x$enableval = xyes; then
	AC_DEFINE(ENABLE_IGNORE_BUSY_MOUNTS, 1, [Enable exit, ignoring busy mounts])
fi

#
# Write Makefile.conf and include/config.h
#
AC_CONFIG_HEADER(include/config.h)
AC_OUTPUT(Makefile.conf)

#
# Run make clean since we don't explicitly code the header file dependencies
#
AC_OUTPUT_COMMANDS([make clean])