File: Configur

package info (click to toggle)
fdclone 2.00a-1woody3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,448 kB
  • ctags: 4,594
  • sloc: ansic: 56,823; sh: 438; makefile: 419; sed: 124
file content (446 lines) | stat: -rwxr-xr-x 11,872 bytes parent folder | download
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
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
#!/bin/sh
echo "Don't exec me!"
exit 0

CC=__cc__
CPP="$CC -E"
TAR=tar
LIBDIR=
#LIBDIR=-L/usr/local/lib
INCLUDEDIR=
#INCLUDEDIR=-I/usr/local/include

TMPSRC=tmptest.c
TMPEXE=tmptest
LIBS=
trap "rm -f $TMPSRC $TMPEXE; exit 0" 0 1 2 15
docc='$CC $TMPSRC -o $TMPEXE $INCLUDEDIR $LIBDIR $LIBS > /dev/null 2>&1'
docpp='$CPP $TMPSRC $INCLUDEDIR > $TMPEXE 2> /dev/null'
testcpp='$CPP $TMPSRC $INCLUDEDIR 2>&1 > /dev/null'
i_unistdh=

setheader() {
	echo "${i_unistdh}" > $TMPSRC
	if [ -n "$1" ]; then
		for i in $1""; do
			echo "#include <${i}.h>" >> $TMPSRC
		done;
	fi
}

compile() {
	(setheader "$2")
	echo "$3 int test() { $1; } int main() { exit(test()); }" >> $TMPSRC
	if eval $docc; then return 0; else return 1; fi
}

useheader() {
	echo "Checking for <$1.h>..." 1>&2
	(setheader "$1")
	if [ -z "`eval $testcpp`" ]; then ret=0; else ret=1; fi
	rm -f $TMPEXE
	return $ret
}

noheader() {
	if (useheader "$1"); then return 1; else return 0; fi
}

inheader() {
	re=$1
	func=$3
	if [ -z "$3" ]; then
		echo "Checking for \"$1\" in <$2.h>..." 1>&2
	else
		echo "Checking for \"$3\" in <$2.h>..." 1>&2
		re="CONFIGURE\($re\)"
		func="CONFIGURE($func)"
	fi
	(setheader "$2")
	echo "test() { $func; } main() {}" >> $TMPSRC
	eval $docpp
	if egrep "$re" $TMPEXE 2>&1 > /dev/null; then ret=0; else ret=1; fi
	rm -f $TMPEXE
	return $ret
}

noinheader() {
	if (inheader "$1" "$2" "$3"); then return 1; else return 0; fi
}

isexist() {
	echo "Checking for $1..." 1>&2
	if (compile "$1" "$2" "$3"); then ret=0; else ret=1; fi
	rm -f $TMPEXE
	return $ret
}

noexist() {
	if (isexist "$1" "$2" "$3"); then return 1; else return 0; fi
}

havelib() {
	echo "Checking for -l$1..." 1>&2
	ORGLIBS=$LIBS
	LIBS="$LIBS -l$1"
	if (compile "$2" "$3" "$4"); then ret=0; else ret=1; fi
	LIBS=$ORGLIBS
	rm -f $TMPEXE
	return $ret
}


cat ./config.hin

for i in TARUSESPACE CPP7BIT USETERMINFO TERMCAPLIB REGEXPLIB EXTENDLIB \
NOVOID NOUID_T DECLSIGLIST NOSIGLIST \
DECLERRLIST PWNEEDERROR NOERRNO NOFILEMODE NOUNISTDH NOSTDLIBH NOTZFILEH \
USELEAPCNT USESELECTH USESYSDIRH USETIMEH USESTDARGH USEMKDEVH USEMKNODH \
USETERMIO USETERMIOS USEDIRECT SYSVDIRENT NODNAMLEN HAVETIMEZONE NOTMGMTOFF \
USESTATVFSH USESTATFSH USEVFSH USEMOUNTH USEFSDATA \
USEFFSIZE STATFSARGS \
USEMNTENTH USEMNTTABH USEGETFSSTAT USEMNTCTL \
USEMNTINFOR USEMNTINFO USEGETMNT USEGETFSENT \
USEVFCNAME USEFFSTYPE \
USERE_COMP USEREGCOMP USEREGCMP \
USERAND48 USESETENV NOSELECT NOVSPRINTF NOTERMVAR \
USEUTIME USEGETWD USETIMELOCAL USEMKTIME USESYSCONF USELLSEEK USEUNAME \
USEWAITPID USESIGPMASK USERESOURCEH USEULIMITH USETIMESH \
GETPGRPVOID USESETPGID USESETVBUF SIGARGINT SIGFNCINT \
GETTODARGS
do
	echo "#ifdef	$i"
	echo "#undef	$i"
	echo "#endif"
done
echo
echo "/*"
echo " *	OS Oriented Definitions"
echo " */"
echo


case "$LANG" in
	ja_JP.EUC*|ja_JP.euc*|ja_JP.ujis)
		echo "#ifndef	CODEEUC"
		echo "#define	CODEEUC"
		echo "#endif"
		if [ -d /usr/man/$LANG ]; then
			echo "#ifndef	USEMANLANG"
			echo "#define	USEMANLANG"
			echo "#endif"
		fi
	;;
	ja_JP.SJIS)
		echo "#ifdef	CODEEUC"
		echo "#undef	CODEEUC"
		echo "#endif"
		if [ -d /usr/man/$LANG ]; then
			echo "#ifndef	USEMANLANG"
			echo "#define	USEMANLANG"
			echo "#endif"
		fi
	;;
esac

echo "Checking for tar(1)..." 1>&2
touch $TMPSRC
$TAR cfo $TMPEXE $TMPSRC 2> /dev/null
set dummy `$TAR tvf $TMPEXE 2> /dev/null`
if echo $3 | egrep '/' 2>&1 > /dev/null; then
	ORGIFS=$IFS
	IFS=/
	set dummy $3
	if expr "$2" \> 100 2>&1 > /dev/null; then
		echo "#define	TARUSESPACE"
	fi;
	IFS=$ORGIFS
fi
rm -f $TMPEXE

echo "Checking for cpp(1)..." 1>&2
echo '#define test "01"' | tr '01' '\376\376' > $TMPSRC
echo 'main() {char *cp=test;}' >> $TMPSRC
if [ -z "`eval $testcpp`" ]; then
	:
else
	echo "#define	CPP7BIT"
fi
rm -f $TMPEXE

lib=
if havelib termlib "tgetent(b,\"T\")" "" "char b[1024];"; then
	lib=-ltermlib
elif havelib ncurses "setupterm(\"T\",0,0)" "curses term"; then
	lib=-lncurses
	echo "#define	USETERMINFO"
elif havelib ncurses "tgetent(b,\"T\")" "" "char b[1024];"; then
	lib=-lncurses
elif havelib termcap "tgetent(b,\"T\")" "" "char b[1024];"; then
	lib=-ltermcap
elif havelib curses "setupterm(\"T\",0,0)" "curses term"; then
	lib=-lcurses
	echo "#define	USETERMINFO"
elif havelib curses "tgetent(b,\"T\")" "" "char b[1024];"; then
	lib=-lcurses
elif havelib "curses -ltermcap" "tgetent(b,\"T\")" "" "char b[1024];"; then
	lib=-l"curses -ltermcap"
fi
if [ -n "$lib" ]; then
	echo "#define	TERMCAPLIB	\"$lib\""
	LIBS="$LIBS $lib"
fi

lib=
if noexist "getmntent(0)" "stdio mntent" \
&& havelib sun "getmntent(0)" "stdio mntent"; then
	lib="$lib -lsun"
fi
if noexist "getmntinfo_r(0,0,0,0)" "stdio sys/mount" \
&& havelib c_r "getmntinfo_r(0,0,0,0)" "stdio sys/mount"; then
	lib="$lib -lc_r"
fi
if [ -n "$lib" ]; then
	echo "#define	EXTENDLIB	\"$lib\""
	LIBS="$LIBS $lib"
fi

if noexist 'void *p'; then
	echo "#define	NOVOID"
fi
if noinheader uid_t sys/types; then
	echo "#define	NOUID_T"
fi
if inheader sys_siglist signal; then
	echo "#define	DECLSIGLIST"
elif noexist 'return(*(sys_siglist[0]))' signal 'extern char *sys_siglist[];'
then
	echo "#define	NOSIGLIST"
fi
if inheader sys_errlist "stdio errno"; then
	echo "#define	DECLERRLIST"
fi
if noexist errno errno; then
	echo "#define	NOERRNO"
fi
if noinheader ' *\(* *[0-7]+.*, *\(* *[0-7]+.*, *\(* *[0-7]+.*' sys/stat \
"S_IRUSR,S_IWGRP,S_IXOTH"; then
	echo "#define	NOFILEMODE"
fi
if noheader unistd; then
	echo "#define	NOUNISTDH"
else
	i_unistdh="#include <unistd.h>"
fi
if noheader stdlib; then
	echo "#define	NOSTDLIBH"
fi
if noheader tzfile; then
	echo "#define	NOTZFILEH"
elif isexist "t.tzh_leapcnt" tzfile "struct tzhead t;"; then
	echo "#define	USELEAPCNT"
fi

if noinheader 'struct.*[^a-zA-Z0-9_]fd_set[^a-zA-Z0-9_]' sys/types \
&& inheader 'struct.*[^a-zA-Z0-9_]fd_set[^a-zA-Z0-9_]' sys/select; then
	echo "#define	USESELECTH"
fi
if noinheader ' *0*x*[0-9a-fA-F ]* *' sys/param DEV_BSIZE \
&& inheader ' *0*x*[0-9a-fA-F ]* *' sys/dir DEV_BSIZE; then
	echo "#define	USESYSDIRH"
fi
if inheader 'struct.*[^a-zA-Z0-9_]tm[^a-zA-Z0-9_]' "sys/types sys/time time" \
&& noinheader 'struct.*[^a-zA-Z0-9_]tm[^a-zA-Z0-9_]' "sys/types sys/time"; then
	echo "#define	USETIMEH"
fi
if inheader va_list stdarg; then
	echo "#define	USESTDARGH"
fi
if isexist "return(major(0))" sys/mkdev; then
	echo "#define	USEMKDEVH"
fi
if isexist "return(major(0))" sys/mknod; then
	echo "#define	USEMKNODH"
fi
if noheader sgtty \
|| inheader 'TIOCFLUSH' sgtty "TIOCFLUSH"; then
	if noheader termio; then
		echo "#define	USETERMIOS"
	else
		echo "#define	USETERMIO"
	fi
fi
if noheader dirent; then
	echo "#define	USEDIRECT"
else
	if isexist "d.d_ino" "sys/types dirent" "struct dirent d;" \
	&& noexist "d.d_fileno" "sys/types dirent" "struct dirent d;"; then
		echo "#define	SYSVDIRENT"
	fi
	if noexist "d.d_namlen" "sys/types dirent" "struct dirent d;"; then
		echo "#define	NODNAMLEN"
	fi
fi
if (inheader 'extern.*[^a-zA-Z0-9_]timezone[^a-zA-Z0-9_]' sys/time \
&& isexist "timezone=0" "sys/types sys/time" "extern time_t timezone;") \
|| (inheader 'extern.*[^a-zA-Z0-9_]timezone[^a-zA-Z0-9_]' time \
&& isexist "timezone=0" "sys/types time" "extern time_t timezone;"); then
	echo "#define	HAVETIMEZONE"
fi
if (noexist "t.tm_gmtoff" "sys/types sys/time" "struct tm t;" \
&& noexist "t.tm_gmtoff" "sys/types time" "struct tm t;"); then
	echo "#define	NOTMGMTOFF"
fi


arg=2
if inheader 'struct.*[^a-zA-Z0-9_]fs_data[^a-zA-Z0-9_]' sys/mount; then
	echo "#define	USEFSDATA"
elif inheader 'struct.*[^a-zA-Z0-9_]statfs[^a-zA-Z0-9_]' sys/vfs; then
	echo "#define	USEVFSH"
elif inheader 'struct.*[^a-zA-Z0-9_]statfs[^a-zA-Z0-9_]' sys/mount; then {
	echo "#define	USEMOUNTH"
	if inheader MOUNT_UFS sys/mount; then
		echo "#define	USEFFSIZE"
	elif isexist "statfs(0,0,0)" sys/mount; then arg=3; fi
}
elif inheader 'struct.*[^a-zA-Z0-9_]statfs[^a-zA-Z0-9_]' \
"sys/types sys/statfs" \
&& { { isexist "statfs(0,&f,0,0)" "sys/types sys/statfs" "struct statfs f;" \
&& arg=4; } \
|| isexist "statfs(0,&f)" "sys/types sys/statfs" "struct statfs f;"; }; then
	echo "#define	USESTATFSH"
elif inheader 'struct.*[^a-zA-Z0-9_]statvfs[^a-zA-Z0-9_]' sys/statvfs; then
	echo "#define	USESTATVFSH"
fi
if [ "$arg" != "2" ]; then
	echo "#define	STATFSARGS	$arg"
fi

if isexist "getmntent(0)" "stdio mntent"; then
	echo "#define	USEMNTENTH"
elif isexist "getmntent(0,0)" "stdio sys/mnttab"; then
	echo "#define	USEMNTTABH"
elif isexist "mntctl(0,0,0)"; then
	echo "#define	USEMNTCTL"
elif isexist "getmntinfo_r(0,0,0,0)"; then
	echo "#define	USEMNTINFOR"
elif isexist "getmntinfo(0,0)"; then {
	echo "#define	USEMNTINFO"
	if isexist 'getvfsbytype(0); return(*(c.vfc_name));' \
	"sys/param sys/mount" "struct vfsconf c;"; then
		echo "#define	USEVFCNAME"
	elif isexist 'return(*(f.f_fstypename))' \
	"sys/param sys/mount" "struct statfs f;"; then
		echo "#define	USEFFSTYPE"
	fi
}
elif isexist "getfsstat(0,0,0)"; then
	echo "#define	USEGETFSSTAT"
elif isexist "getmnt(0,0,0,0,0)"; then
	echo "#define	USEGETMNT"
elif isexist "getfsent()" \
&& inheader 'char.*[^a-zA-Z0-9_]fs_mntops[^a-zA-Z0-9_]' fstab; then
	echo "#define	USEGETFSENT"
fi


lib=
if isexist "re_comp(0)" ctype 'extern char *re_comp();' \
|| { havelib compat "re_comp(0)" ctype 'extern char *re_comp();' \
&& lib=-lcompat; }; then
	echo "#define	USERE_COMP"
elif isexist "regfree(re)" "sys/types regex" 'regex_t *re;'; then
	echo "#define	USEREGCOMP"
elif isexist "regcmp(0,0)" ctype 'extern char *regcmp();' \
|| { havelib gen "regcmp(0,0)" ctype 'extern char *regcmp();' && lib=-lgen; } \
|| { havelib PW "regcmp(0,0)" ctype 'extern char *regcmp();' && lib=-lPW; } \
|| { havelib PW "regcmp(0,0)" ctype 'extern char *regcmp(); char Error[1024];' \
&& lib=-lPW && echo "#define	PWNEEDERROR"; }; then
	echo "#define	USEREGCMP"
fi
if [ -n "$lib" ]; then
	echo "#define	REGEXPLIB	\"$lib\""
	LIBS="$LIBS $lib"
fi


if isexist "rand48()"; then
	echo "#define	USERAND48"
fi
if isexist "setenv(0,0,0)"; then
	echo "#define	USESETENV"
fi
if noexist "select(0,0,0,0,0)"; then
	echo "#define	NOSELECT"
fi
if noexist "vsprintf(0,0,0)" "stdio varargs"; then
	echo "#define	NOVSPRINTF"
fi
if noexist "ospeed=0" "" "extern short ospeed;" \
|| noexist "BC=NULL" "" "extern char *BC;"; then
	echo "#define	NOTERMVAR"
fi
if noexist "utimes(0,0)"; then
	echo "#define	USEUTIME"
fi
if noexist "getcwd(0,0)"; then
	echo "#define	USEGETWD"
fi
if isexist "mktime(0)" time; then
	echo "#define	USEMKTIME"
elif isexist "timelocal(0)" time; then
	echo "#define	USETIMELOCAL"
fi
if isexist "sysconf(0)"; then
	echo "#define	USESYSCONF"
fi
if isexist "_llseek(0,0,0,0,0)" "linux/unistd" 'static _syscall5(int, _llseek,
	unsigned int, fd,
	unsigned long, ofs_h,
	unsigned long, ofs_l,
	long long *, result,
	unsigned int, whence);
'; then
	echo "#define	USELLSEEK"
fi
if noexist "gethostname(0,0)" && isexist "uname(0)" sys/utsname; then
	echo "#define	USEUNAME"
fi
if isexist "waitpid(0,0,0)" sys/wait; then
	echo "#define	USEWAITPID"
fi
if isexist "sigprocmask(0,0,0)" signal; then
	echo "#define	USESIGPMASK"
fi
if isexist "getrusage(0,0)" "sys/types sys/time sys/resource" \
&& isexist "getrlimit(0,0)" "sys/types sys/time sys/resource"; then
	echo "#define	USERESOURCEH"
else
	if isexist "ulimit(0,0)" ulimit; then
	echo "#define	USEULIMITH"
	fi
	if isexist "times(0)" "sys/types sys/times"; then
	echo "#define	USETIMESH"
	fi
fi
if noexist "getpgrp(0)" && isexist "getpgrp()"; then
	echo "#define	GETPGRPVOID"
fi
if isexist "setpgid(0,0)"; then
	echo "#define	USESETPGID"
fi
if isexist "setvbuf(0,0,0,0)" stdio; then
	echo "#define	USESETVBUF"
fi
if inheader 'int.*[^a-zA-Z0-9_]signal[^a-zA-Z0-9_]' signal; then
	echo "#define	SIGARGINT"
fi
if inheader '[^a-zA-Z0-9_]signal([^a-zA-Z0-9_].*\(|\()[ (]*int[ ),].*\) *;' \
signal; then
	echo "#define	SIGFNCINT"
fi
if noexist "gettimeofday(0,0)" "sys/time time" \
&& isexist "gettimeofday(0)" "sys/time time"; then
	echo "#define	GETTODARGS	1"
fi