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
|
AC_INIT(rc.h)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
case "x$GCC" in
xyes)
CFLAGS="-Wall $CFLAGS"
;;
esac
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_YACC
AC_CHECK_PROGS(LN, ln cp)
AC_CHECK_HEADERS(sys/resource.h sys/time.h sys/types.h unistd.h)
AC_HEADER_DIRENT
AC_HEADER_STDC
dnl Linux puts real signal names in /usr/include/asm/signal.h. NT puts
dnl them somewhere else altogether. This attempts to parse the output
dnl of saying `#include <signal.h>' to find the full path of files named
dnl signal.h, then examines each of those to see if it contains the
dnl `#define's we want. What a hack.
echo '#include <signal.h>' > temp.c
AC_CACHE_CHECK(for full paths of <signal.h>, rc_cv_full_signal_h, [
rc_cv_full_signal_h=`$CPP temp.c |sed -n 's/.*"\(.*signal.h\)".*/\1/p' |sort -u |sed 'y/
/ /'`
case "x$rc_cv_full_signal_h" in
x)
rc_cv_full_signal_h='/usr/include/sys/signal.h /usr/include/asm/signal.h'
;;
esac
])
rm temp.c
AC_CACHE_CHECK(for signal names, rc_cv_signal_h,
for i in $rc_cv_full_signal_h; do
if grep SIGINT $i >/dev/null 2>&1; then
rc_cv_signal_h=$i
fi
done
)
case "x$rc_cv_signal_h" in
x)
AC_MSG_ERROR(Can't find signal names in $rc_cv_full_signal_h)
;;
*)
SIGNAL_H=$rc_cv_signal_h
;;
esac
AC_SUBST(SIGNAL_H)
AC_TYPE_GETGROUPS
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_FUNCS(getgroups setpgrp setrlimit)
AC_FUNC_SETPGRP
dnl HPUX needs _KERNEL defined to pick up RLIMIT_foo defines. (Why?)
AC_CACHE_CHECK(if _KERNEL is required for RLIMIT defines, rc_cv_kernel_rlimit,
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/resource.h>
], [
int f;
f = RLIMIT_DATA;
], rc_cv_kernel_rlimit=no, [ AC_TRY_COMPILE([
#include <sys/types.h>
#define _KERNEL
#include <sys/resource.h>
#undef _KERNEL
], [
int f;
f = RLIMIT_DATA;
], rc_cv_kernel_rlimit=yes, rc_cv_kernel_rlimit=no)]))
case "x$rc_cv_kernel_rlimit" in
xyes)
AC_DEFINE(RLIMIT_NEEDS_KERNEL)
;;
esac
dnl Look for rlim_t in sys/types.h and sys/resource.h
AC_CACHE_CHECK(for rlim_t, rc_cv_have_rlim_t,
AC_EGREP_CPP(rlim_t, [
#include <sys/types.h>
#if RLIMIT_NEEDS_KERNEL
#define _KERNEL
#endif
#include <sys/resource.h>
], rc_cv_have_rlim_t=yes, rc_cv_have_rlim_t=no))
case "x$rc_cv_have_rlim_t" in
xyes)
AC_DEFINE(HAVE_RLIM_T)
;;
xno)
AC_CACHE_CHECK(for native quad_t, rc_cv_have_quad_t,
AC_TRY_RUN([
#include <sys/types.h>
main() {
quad_t q;
q = 0;
exit((int) q);
}
], rc_cv_have_quad_t=yes, rc_cv_have_quad_t=no))
case "x$rc_cv_have_quad_t" in
xyes)
AC_DEFINE(HAVE_QUAD_T)
AC_CACHE_CHECK(if rlimit values are quad_t, rc_cv_rlim_t_is_quad_t,
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/time.h>
#include <sys/types.h>
#if RLIMIT_NEEDS_KERNEL
#define _KERNEL
#endif
#include <sys/resource.h>
#if RLIMIT_NEEDS_KERNEL
#undef _KERNEL
#endif
main(){
struct rlimit rl;
exit(sizeof rl.rlim_cur != sizeof(quad_t));
}
], rc_cv_rlim_t_is_quad_t=yes, rc_cv_rlim_t_is_quad_t=no, $ac_cv_type_quad_t))
case "x$rc_cv_rlim_t_is_quad_t" in
xyes)
AC_DEFINE(RLIM_T_IS_QUAD_T)
;;
esac
;;
esac
;;
esac
AC_SYS_RESTARTABLE_SYSCALLS
dnl Does the kernel handle `#! /interpreter'?
AC_SYS_INTERPRETER
case "x$ac_cv_sys_interpreter" in
xyes)
AC_DEFINE(HASH_BANG)
EXECVE=''
;;
xno)
EXECVE=execve.o
esac
AC_SUBST(EXECVE)
AC_CACHE_CHECK(for /dev/fd, rc_cv_sys_dev_fd,
if test -d /dev/fd && test -r /dev/fd/0; then
rc_cv_sys_dev_fd=yes
elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
rc_cv_sys_dev_fd=odd
else
rc_cv_sys_dev_fd=no
fi)
case "x$rc_cv_sys_dev_fd" in
xyes)
AC_DEFINE(HAVE_DEV_FD)
;;
xodd)
AC_DEFINE(HAVE_PROC_SELF_FD)
;;
xno)
AC_CACHE_CHECK(for named pipes, rc_cv_sys_fifo,
AC_DEFINE_UNQUOTED(TMPNAM, "/tmp/rc$$.0")
AC_TRY_RUN([
#include <sys/types.h>
#include <sys/stat.h>
main() {
exit(mknod(TMPNAM, S_IFIFO | 0666, 0) != 0);
}
], rc_cv_sys_fifo=yes, rc_cv_sys_fifo=no, rc_cv_sys_fifo=no))
case "x$rc_cv_sys_fifo" in
xyes)
AC_DEFINE(HAVE_FIFO)
;;
esac
esac
AC_ARG_ENABLE(builtin-echo, [ --disable-builtin-echo Don't include \`echo' as a builtin],
test "x$enableval" != "xno" && AC_DEFINE(RC_ECHO),
AC_DEFINE(RC_ECHO))
AC_ARG_ENABLE(job, [ --disable-job Don't do job-control-style backgrounding],
test "x$enableval" != "xno" && AC_DEFINE(RC_JOB),
AC_DEFINE(RC_JOB))
AC_ARG_ENABLE(protect-env, [ --disable-protect-env Don't protect environment names],
test "x$enableval" != "xno" && AC_DEFINE(PROTECT_ENV),
AC_DEFINE(PROTECT_ENV))
AC_ARG_ENABLE(def-interp,
[ --enable-def-interp=/bin/foo
Use /bin/foo as default interpreter [/bin/sh]],
[
case "x$enableval" in
xno)
;;
xyes)
AC_DEFINE(DEFAULTINTERP, "/bin/sh")
;;
*)
AC_DEFINE_UNQUOTED(DEFAULTINTERP, "$enableval")
esac
],
AC_DEFINE(DEFAULTINTERP, "/bin/sh"))
AC_ARG_ENABLE(def-path,
[ --enable-def-path=\"/usr/local/bin/\",\"/usr/bin\"
Default path [All of these that exist
(/usr/local/bin /usr/bin /usr/ucb /bin .)]],
[
case "x$enableval" in
xno|xyes)
;;
*)
AC_DEFINE_UNQUOTED(DEFAULTPATH, $enableval)
esac
],
enable_def_path=yes)
case "x$enable_def_path" in
xyes)
AC_CACHE_CHECK(extant directories for default path, rc_cv_def_path,[
rc_cv_def_path=''
for i in /usr/local/bin /usr/bin /usr/ucb /bin .; do
if test -d $i; then
case "x$rc_cv_def_path" in
x)
rc_cv_def_path=\"$i\"
;;
*)
rc_cv_def_path=$rc_cv_def_path,\"$i\"
;;
esac
fi
done
AC_DEFINE_UNQUOTED(DEFAULTPATH, $rc_cv_def_path)
])
;;
esac
AC_ARG_ENABLE(history, [ --enable-history Build history subprograms],
test "x$enableval" != "xno" && rc_history=yes,
rc_history=no)
case "x$rc_history" in
xyes)
HISTORY=history/history
;;
esac
AC_SUBST(HISTORY)
AC_ARG_WITH(addon, [ --with-addon Extra builtins, from addon.c ],[
case "x$withval" in
xyes)
ADDON=addon.o
;;
xno)
ADDON=''
;;
*)
ADDON=$withval
;;
esac
])
AC_SUBST(ADDON)
AC_ARG_WITH(editline, [ --with-editline Simmule Turner's line editing],
AC_CHECK_LIB(edit, readline,
AC_DEFINE(READLINE) LIBS="$LIBS -ledit",
AC_MSG_WARN(editline library not found)))
AC_ARG_WITH(readline, [ --with-readline Bloated GNU line editing],
AC_CHECK_LIB(readline, readline,
AC_DEFINE(READLINE) LIBS="$LIBS -lreadline -ltermcap",
AC_MSG_WARN(readline library not found),
-ltermcap))
AC_OUTPUT(Makefile)
|