summaryrefslogtreecommitdiffstats
path: root/contrib/opie/configure.in
blob: 91c1a355a835974d19b5748f61d5a040e1ba1b56 (plain)
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
447
448
449
450
451
452
453
454
455
dnl configure.in: Input for Autoconf
dnl
dnl %%% portions-copyright-cmetz
dnl Portions of this software are Copyright 1996 by Craig Metz, All Rights
dnl Reserved. The Inner Net License Version 2 applies to these portions of
dnl the software.
dnl You should have received a copy of the license with this software. If
dnl you didn't get a copy, you may request one from <license@inner.net>.
dnl
dnl Portions of this software are Copyright 1995 by Randall Atkinson and Dan
dnl McDonald, All Rights Reserved. All Rights under this copyright are assigned
dnl to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
dnl License Agreement applies to this software.   
dnl
dnl	History:
dnl
dnl     Modified by cmetz for OPIE 2.3. Removed redundant memset/memcpy.
dnl	     Changed ls -g test around. Changed logindevperm/fbtab defines.
dnl	     Added check for /etc/environment and /etc/src.sh. Check for
dnl          /var/adm/sulog. Check for {get,put}utxline, provide libmissing
dnl          versionf of {get,put}utline. Added --enable option for anonymous
dnl          FTP. Got rid of a few unneeded checks. Check for functions only
dnl	     used by libmissing only if the replacement function that needs
dnl	     them is itself needed.
dnl	Modified by cmetz for OPIE 2.22. Check for Solaris drain bamaged ls.
dnl          Check for setlogin(). Removed duplicate checks for some funcs.
dnl     Modified by cmetz for OPIE 2.21. Filename must be in utmp[x]/wtmp[x]
dnl          defines.
dnl     Modified by cmetz for OPIE 2.2. Misc changes. Changed for libmissing
dnl          support and building its target object list. Changed to support
dnl          FUNCTION declaration et al. Added a LOT of checks and a LOT of
dnl          fixes.
dnl	Created at NRL for OPIE 2.1.

AC_INIT(README)
AC_CONFIG_HEADER(config.h)
AC_ARG_ENABLE(access-file, [  --enable-access-file=PATH  Use the OPIE access file PATH as a transition aid], AC_DEFINE_UNQUOTED(PATH_ACCESS_FILE, "$enable_access_file") echo "Using the access file in $enable_access_file -- don't say we didn't warn you!")
AC_ARG_ENABLE(anonymous-ftp, [  --enable-anonymous-ftp  Enable anonymous FTP support], AC_DEFINE(DOANONYMOUS) echo "Enabling anonymous FTP support in ftp -- don't say we didn't warn you!")

dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_YACC

AC_AIX
AC_ISC_POSIX
AC_MINIX

AC_C_CROSS

dnl We'd put PATH in these checks, but it turns out that autoconf doesn't
dnl work as documented when it comes to the colon separator...

AC_PATH_PROG(CHOWN, chown, /bin/chown, /usr/bin /bin /usr/sbin /sbin /usr/etc /etc)

AC_PATH_PROG(SU, su, /bin/su, /usr/bin /bin)
AC_PATH_PROG(ALT_SU, su,, /usr/sbin /sbin)

AC_PATH_PROG(SCHEME, scheme,, /usr/lib/iaf/scheme)
AC_PATH_PROG(LOGIN, login, /bin/login, /usr/bin /bin)
dnl AC_DEFINE_UNQUOTED(PATH_LOGIN, "$LOGIN")

if test ! -z "$SCHEME";
then
	LOGIN="$SCHEME";
fi

AC_PATH_PROG(FTPD, ftpd,, /usr/libexec /usr/etc /etc /usr/sbin /sbin /usr/lbin)
AC_PATH_PROG(INFTPD, in.ftpd,, /usr/libexec /usr/etc /etc /usr/sbin /sbin /usr/lbin)

if test -z "$FTPD"
then
	if test ! -z "$INFTPD"
	then
		FTPD="$INFTPD"
	fi
fi

AC_MSG_CHECKING(for default PATH entries)
default_path=""
save_IFS="$IFS"
IFS=" "
for i in /usr/bin /bin /usr/ucb /usr/sbin /usr/bsd /sbin /usr/bin/X11 /etc /usr/local/X11/bin /usr/X11R6/bin /your-system-is-broken
do
	IFS=":"
	for j in $PATH
	do
		if test "$i" = "$j"
		then
			if test -d "$i"
			then
				if test -z "$default_path"
				then
					default_path="$i"
				else
					default_path="$default_path:$i"
				fi
			fi
		fi
	done
	IFS=" "
done
AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$default_path")
AC_MSG_RESULT($default_path)

AC_MSG_CHECKING(for test -e flag)
if sh config.testeflag
then
	result=yes
	EXISTS="-e"
else
	result=no
	EXISTS="-f"
fi
AC_SUBST(EXISTS)
AC_MSG_RESULT($result)

AC_MSG_CHECKING(for mkdir -p flag)
if test -d config.tmpdir
then
	rmdir config.tmpdir/foo/bar >/dev/null 2>/dev/null
	rmdir config.tmpdir/foo >/dev/null 2>/dev/null
	rmdir config.tmpdir >/dev/null 2>/dev/null
fi

result=no
if mkdir -p config.tmpdir/foo/bar >/dev/null 2>/dev/null
then
	if test -d config.tmpdir
	then
		if test -d config.tmpdir/foo
		then
			if test -d config.tmpdir/foo/bar
			then
				result=yes
				rmdir config.tmpdir/foo/bar >/dev/null 2>/dev/null
			fi
			rmdir config.tmpdir/foo >/dev/null 2>/dev/null
		fi
		rmdir config.tmpdir >/dev/null 2>/dev/null
	fi
fi

if test "$result" = yes
then
	MKDIR="mkdir -p"
else
	MKDIR="mkdir"
fi
AC_SUBST(MKDIR)
AC_MSG_RESULT($result)

AC_MSG_CHECKING(for ls group field)
lsg=`/bin/ls -ldg / | wc -w | awk '{print $1}'`;
ls=`/bin/ls -ld / | wc -w | awk '{print $1}'`;
result="no"
if test $ls = 9;
then
	result="yes"
else
	if test "$ls" = 8 -a "$lsg" = 9;
	then
		result="yes, with -g"
		AC_DEFINE(HAVE_LS_G_FLAG)
	fi
fi
AC_MSG_RESULT($result)

dnl Checks for various system characteristics
AC_MSG_CHECKING(for /etc/default/login)
if test $EXISTS /etc/default/login
then
	result=yes
	AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
else
	result=no
fi
AC_MSG_RESULT($result)

AC_MSG_CHECKING(for /etc/securetty)
if test $EXISTS /etc/securetty
then
	result=yes
	AC_DEFINE(HAVE_SECURETTY)
else
	result=no
fi
AC_MSG_RESULT($result)

AC_MSG_CHECKING(for /etc/logindevperm)
if test $EXISTS /etc/logindevperm
then
	AC_MSG_RESULT(yes)
	AC_DEFINE(HAVE_LOGIN_PERMFILE, "/etc/logindevperm")
else
	AC_MSG_RESULT(no)

	AC_MSG_CHECKING(for /etc/fbtab)
	if test $EXISTS /etc/fbtab
	then
		result=yes
		AC_DEFINE(HAVE_LOGIN_PERMFILE, "/etc/fbtab")
	else
		result=no
	fi
	AC_MSG_RESULT($result)
fi

AC_MSG_CHECKING(for /etc/environment)
if test $EXISTS /etc/environment
then
	AC_MSG_RESULT(yes)
	AC_DEFINE(HAVE_LOGIN_ENVFILE, "/etc/environment")
else
	AC_MSG_RESULT(no)

	AC_MSG_CHECKING(for /etc/src.sh)
	if test $EXISTS /etc/src.sh
	then
		result=yes
		AC_DEFINE(HAVE_LOGIN_ENVFILE, "/etc/src.sh")
	else
		result=no
	fi
	AC_MSG_RESULT($result)
fi

AC_MSG_CHECKING(for /etc/shadow)
if test $EXISTS /etc/shadow
then
	result=yes
	AC_DEFINE(HAVE_ETC_SHADOW)
else
	result=no
fi
AC_MSG_RESULT($result)

AC_MSG_CHECKING(for /var/adm/sulog)
if test $EXISTS /var/adm/sulog
then
	result=yes
	AC_DEFINE(HAVE_SULOG)
else
	result=no
fi
AC_MSG_RESULT($result)

AC_MSG_CHECKING(mail spool location)
mail_spool=""
for i in /var/mail /usr/mail /var/spool/mail /usr/spool/mail
do
	if test -d $i
	then
		mail_spool="$i"
	fi
done
if test -z "$mail_spool"
then
	result="not found"
else
	result="$mail_spool"
	AC_DEFINE_UNQUOTED(PATH_MAIL, "$mail_spool")
fi
AC_MSG_RESULT($result)

dnl AC_MSG_CHECKING(where your system puts the utmp file)
dnl utmp_path=""
dnl for i in /var/run /var/adm /usr/adm /etc
dnl do
dnl	if test $EXISTS $i/utmp
dnl	then
dnl		utmp_path="$i"
dnl	fi
dnl done
dnl if test -z "$utmp_path"
dnl then
dnl	result="not found"
dnl else
dnl	result="$utmp_path"
dnl	AC_DEFINE_UNQUOTED(PATH_UTMP_AC, "$utmp_path/utmp")
dnl fi
dnl AC_MSG_RESULT($result)

dnl AC_MSG_CHECKING(where your system puts the wtmp file)
dnl wtmp_path=""
dnl for i in /var/run /var/adm /usr/adm /etc
dnl do
dnl	if test $EXISTS $i/wtmp
dnl	then
dnl		wtmp_path="$i"
dnl	fi
dnl done
dnl if test -z "$wtmp_path"
dnl then
dnl	result="not found"
dnl else
dnl	result="$wtmp_path"
dnl	AC_DEFINE_UNQUOTED(PATH_WTMP_AC, "$wtmp_path/wtmp")
dnl fi
dnl AC_MSG_RESULT($result)

AC_MSG_CHECKING(whether the system profile displays the motd)
result=no
if test $EXISTS /etc/profile
then
	if grep motd /etc/profile >/dev/null 2>/dev/null
	then
		result=yes
	fi
fi
if test "$result" = yes
then
	AC_DEFINE(HAVE_MOTD_IN_PROFILE)
fi
AC_MSG_RESULT($result)

AC_MSG_CHECKING(whether the system profile checks for mail)
result=no
if test $EXISTS /etc/profile
then
	if grep 'mail\.' /etc/profile >/dev/null 2>/dev/null
	then
		result=yes
	fi
fi
if test "$result" = yes
then
	AC_DEFINE(HAVE_MAILCHECK_IN_PROFILE)
fi
AC_MSG_RESULT($result)

dnl Random checks
AC_C_CONST

AC_MSG_CHECKING(to see if your compiler can handle void arguments)
AC_TRY_COMPILE(foo(void) { },, AC_DEFINE(HAVE_VOIDARG) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if your compiler can handle void return values)
AC_TRY_COMPILE(void foo() { },, AC_DEFINE(HAVE_VOIDRET) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if your compiler can handle void pointers)
AC_TRY_COMPILE(foo() { void *bar = (void *)0x42; bar = bar + 1; },, AC_DEFINE(HAVE_VOIDPTR) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if your compiler can handle ANSI argument lists)
AC_TRY_COMPILE(int foo(int bar, int baz) { return 0; },, AC_DEFINE(HAVE_ANSIDECL) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if your compiler can handle ANSI prototypes)
AC_TRY_COMPILE(extern int foo(int, int);,, AC_DEFINE(HAVE_ANSIPROTO) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if your compiler can handle ANSI variable arguments)
AC_TRY_COMPILE([#include <stdarg.h>
int foo(int arg, ...) {
	va_list ap;
	va_start(ap, arg);
	va_end(ap);
	return 0;
}],, AC_DEFINE(HAVE_ANSISTDARG) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))

AC_MSG_CHECKING(to see if you have an ANSI-style sprintf)
AC_TRY_RUN([#include <stdio.h>
int main(argc, argv)
int argc;
char *argv[];
{
  char buf[5];
  int i = 2;
  i += sprintf(buf, "1234");
  return (i == 6) ? 0 : -1;
}], AC_DEFINE(HAVE_ANSISPRINTF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))

dnl Checks for libraries.
AC_CHECK_LIB(crypt, crypt)
AC_CHECK_LIB(nsl, gethostname)
AC_CHECK_LIB(posix, main)
AC_CHECK_LIB(socket, socket)

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(crypt.h fcntl.h limits.h termios.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h paths.h shadow.h signal.h sys/signal.h lastlog.h sys/utsname.h pwd.h sys/param.h string.h stdlib.h utmpx.h)

dnl Checks for typedefs, structures, and compiler characteristics.
dnl AC_TYPE_UID_T
dnl AC_TYPE_OFF_T
dnl AC_TYPE_PID_T
dnl AC_STRUCT_ST_BLKSIZE
dnl AC_STRUCT_TM

AC_MSG_CHECKING(for ut_pid in struct utmp)
AC_TRY_COMPILE([#include <sys/types.h>
#include <utmp.h>], [struct utmp foo; return (int)foo.ut_pid;], AC_DEFINE(HAVE_UT_PID) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(for ut_type in struct utmp)
AC_TRY_COMPILE([#include <sys/types.h>
#include <utmp.h>], [struct utmp foo; return (int)foo.ut_type;], AC_DEFINE(HAVE_UT_TYPE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_MSG_CHECKING(for ut_name in struct utmp)
AC_TRY_COMPILE([#include <sys/types.h>
#include <utmp.h>], [struct utmp foo; return (int)foo.ut_name[0];], AC_DEFINE(HAVE_UT_NAME) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
dnl AC_MSG_CHECKING(for ut_user in struct utmp)
dnl AC_TRY_COMPILE([#include <sys/types.h>
dnl #include <utmp.h>], [struct utmp foo; return (int)foo.ut_user[0];], AC_DEFINE(HAVE_UT_USER) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
AC_DEFINE(HAVE_UT_HOST)

dnl Checks for library functions.
dnl AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(gettimeofday socket strftime strstr setpriority seteuid setreuid setegid setregid setresuid setresgid getttynam sysconf setvbuf getspent endspent setgroups getgroups fpurge setlogin lstat getutxline pututxline)

dnl Libmissing...
AC_FUNC_MEMCMP
AC_FUNC_ALLOCA
AC_REPLACE_FUNCS(getusershell sigaddset sigemptyset strerror strncasecmp)
MISSING="$LIBOBJS $ALLOCA "
AC_CHECK_FUNC(atexit,, MISSING="${MISSING}atexit.o ")
AC_CHECK_FUNC(entutent,, MISSING="${MISSING}endutent.o ")
AC_CHECK_FUNC(memcpy,, MISSING="${MISSING}memcpy.o "; AC_CHECK_FUNCS(bcopy))
AC_CHECK_FUNC(memset,, MISSING="${MISSING}memset.o "; AC_CHECK_FUNCS(bzero))
AC_CHECK_FUNC(getcwd,, MISSING="${MISSING}getcwd.o "; AC_CHECK_FUNCS(getwd))
AC_CHECK_FUNC(getenv, AC_DEFINE(HAVE_GETENV), MISSING="${MISSING}env.o ")
AC_CHECK_FUNC(getutline,, MISSING="${MISSING}getutline.o "; AC_CHECK_FUNCS(ttyslot))
AC_CHECK_FUNC(pututline,, MISSING="${MISSING}pututline.o "; AC_CHECK_FUNCS(ttyslot))
AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV), MISSING="${MISSING}env.o ")
AC_CHECK_FUNC(sigprocmask,, MISSING="${MISSING}sigprocmask.o "; AC_CHECK_FUNCS(sigblock sigsetmask))
AC_CHECK_FUNC(strchr,, MISSING="${MISSING}strchr.o "; AC_CHECK_FUNCS(index))
AC_CHECK_FUNC(strrchr,, MISSING="${MISSING}strrchr.o "; AC_CHECK_FUNCS(rindex))
AC_CHECK_FUNC(sysconf,, MISSING="${MISSING}sysconf.o "; AC_CHECK_FUNCS(getdtablesize))
AC_CHECK_FUNC(uname,, MISSING="${MISSING}uname.o "; AC_CHECK_FUNCS(gethostname))
AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV), MISSING="${MISSING}env.o ")
AC_SUBST(MISSING)

AC_MSG_CHECKING(for nonstandard gettimeofday)
AC_TRY_COMPILE([
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
],
[struct timeval tv;
gettimeofday(&tv, NULL)], AC_MSG_RESULT(no), AC_MSG_RESULT(maybe) AC_TRY_COMPILE([
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#endif /* HAVE_SYS_TIME_H */
#if HAVE_UNISTD_H
#include <unistd.h>
#endif /* HAVE_UNISTD_H */
],
[struct timeval tv;
gettimeofday(&tv)], AC_DEFINE(HAVE_ONE_ARG_GETTIMEOFDAY) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)))

# Munge out LOCALBIN and LOCALMAN in canonical (no bletch) form
AC_OUTPUT(configure.munger libmissing/Makefile libopie/Makefile Makefile.munge:Makefile.in)
sh configure.munger
OpenPOWER on IntegriCloud