1 dnl configure.in: Input for Autoconf
3 dnl %%% portions-copyright-cmetz-96
4 dnl Portions of this software are Copyright 1996-1999 by Craig Metz, All Rights
5 dnl Reserved. The Inner Net License Version 2 applies to these portions of
7 dnl You should have received a copy of the license with this software. If
8 dnl you didn't get a copy, you may request one from <license@inner.net>.
10 dnl Portions of this software are Copyright 1995 by Randall Atkinson and Dan
11 dnl McDonald, All Rights Reserved. All Rights under this copyright are assigned
12 dnl to the U.S. Naval Research Laboratory (NRL). The NRL Copyright Notice and
13 dnl License Agreement applies to this software.
17 dnl Modified by cmetz for OPIE 2.4. Add --enable-opieauto option. Check
18 dnl for ut_id and ut_syslen. Make disable-wtmp disable wtmp not utmp.
19 dnl Define HAVE_foo if foo is found by the libmissing function check.
20 dnl Added checks for libmissing functions that were there but never
21 dnl actually checked for and therefore available.
22 dnl Modified by cmetz for OPIE 2.32. Substitute default for LOCK_DIR.
23 dnl Fix the --disable-user-locking bug. AC_DEFINE variables to 1.
24 dnl Really check for ut_host.
25 dnl Modified by cmetz for OPIE 2.31. Put back manual utmp[x]/wtmp[x]
26 dnl checks -- too many OSs can't be trusted to tell us where they are.
27 dnl Check for sys/select.h. Spell endutent right. Replace strtoul()
28 dnl if needed. Removed duplicate check for sysconf. Added check for
29 dnl SunOS C2 shadow passwords (may need more work). Replace
30 dnl setutent. Added options to disable use of utmp/wtmp. Replace
31 dnl seteuid and setegid. Check for usleep. Moved options.h options
32 dnl here as enable/disable options.
33 dnl Modified by cmetz for OPIE 2.3. Removed redundant memset/memcpy.
34 dnl Changed ls -g test around. Changed logindevperm/fbtab defines.
35 dnl Added check for /etc/environment and /etc/src.sh. Check for
36 dnl /var/adm/sulog. Check for {get,put}utxline, provide libmissing
37 dnl versionf of {get,put}utline. Added --enable option for anonymous
38 dnl FTP. Got rid of a few unneeded checks. Check for functions only
39 dnl used by libmissing only if the replacement function that needs
40 dnl them is itself needed.
41 dnl Modified by cmetz for OPIE 2.22. Check for Solaris drain bamaged ls.
42 dnl Check for setlogin(). Removed duplicate checks for some funcs.
43 dnl Modified by cmetz for OPIE 2.21. Filename must be in utmp[x]/wtmp[x]
45 dnl Modified by cmetz for OPIE 2.2. Misc changes. Changed for libmissing
46 dnl support and building its target object list. Changed to support
47 dnl FUNCTION declaration et al. Added a LOT of checks and a LOT of
49 dnl Created at NRL for OPIE 2.1.
52 AC_CONFIG_HEADER(config.h)
53 AC_ARG_ENABLE(access-file, [ --enable-access-file=FILENAME
54 Enable the OPIE access file FILENAME], 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!")
55 ACCESS_FILE="$enable_access_file"
57 AC_ARG_ENABLE(server-md4, [ --enable-server-md4 Use MD4 instead of MD5 for the server], AC_DEFINE(MDX, 4), AC_DEFINE(MDX, 5))
59 AC_ARG_ENABLE(user-locking, [ --disable-user-locking Disable user locking
60 --enable-user-locking[=DIR]
61 Put user lock files in DIR [/etc/opielocks]],,)
62 if test "$enable_user_locking" != no;
64 if test -z "$enable_user_locking"
66 AC_DEFINE(OPIE_LOCK_DIR, "/etc/opielocks")
67 LOCK_DIR="/etc/opielocks"
69 AC_DEFINE_UNQUOTED(OPIE_LOCK_DIR, "$enable_user_locking")
70 LOCK_DIR="$enable_user_locking"
75 AC_ARG_ENABLE(retype, [ --enable-retype Ask users to re-type their secret pass phrases], AC_DEFINE(RETYPE, 1))
76 AC_ARG_ENABLE(su-star-check, [ --enable-su-star-check Refuse to switch to disabled accounts], AC_DEFINE(SU_STAR_CHECK, 1))
77 AC_ARG_ENABLE(new-prompts, [ --disable-new-prompts Use more compatible (but less informative) prompts],, AC_DEFINE(NEW_PROMPTS, 1))
78 AC_ARG_ENABLE(insecure-override, [ --enable-insecure-override
79 Allow users to override insecure checks], AC_DEFINE(INSECURE_OVERRIDE, 1))
80 AC_ARG_ENABLE(anonymous-ftp, [ --enable-anonymous-ftp Enable anonymous FTP support], AC_DEFINE(DOANONYMOUS, 1) echo "enabling anonymous FTP support in ftp -- don't say we didn't warn you!")
81 AC_ARG_ENABLE(utmp, [ --disable-utmp Disable utmp logging], AC_DEFINE(DISABLE_UTMP, 1) echo "disabling utmp logging")
82 AC_ARG_ENABLE(wtmp, [ --disable-wtmp Disable wtmp logging], AC_DEFINE(DISABLE_WTMP, 1) echo "disabling wtmp logging")
83 AC_ARG_ENABLE(opieauto, [ --enable-opieauto Enable support for opieauto], AC_DEFINE(OPIEAUTO, 1) OPIEAUTO=opieauto; echo "enabling opieauto support")
86 dnl Checks for programs.
97 dnl We'd put PATH in these checks, but it turns out that autoconf doesn't
98 dnl work as documented when it comes to the colon separator...
100 AC_PATH_PROG(CHOWN, chown, /bin/chown, /usr/bin /bin /usr/sbin /sbin /usr/etc /etc)
102 AC_PATH_PROG(SU, su, /bin/su, /usr/bin /bin)
103 AC_PATH_PROG(ALT_SU, su,, /usr/sbin /sbin)
105 AC_PATH_PROG(SCHEME, scheme,, /usr/lib/iaf/scheme)
106 AC_PATH_PROG(LOGIN, login, /bin/login, /usr/bin /bin)
107 dnl AC_DEFINE_UNQUOTED(PATH_LOGIN, "$LOGIN")
109 if test ! -z "$SCHEME";
114 AC_PATH_PROG(FTPD, ftpd,, /usr/libexec /usr/etc /etc /usr/sbin /sbin /usr/lbin)
115 AC_PATH_PROG(INFTPD, in.ftpd,, /usr/libexec /usr/etc /etc /usr/sbin /sbin /usr/lbin)
119 if test ! -z "$INFTPD"
125 AC_MSG_CHECKING(for default PATH entries)
129 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
138 if test -z "$default_path"
142 default_path="$default_path:$i"
149 AC_DEFINE_UNQUOTED(DEFAULT_PATH, "$default_path")
150 AC_MSG_RESULT($default_path)
152 AC_MSG_CHECKING(for test -e flag)
153 if sh config.testeflag
162 AC_MSG_RESULT($result)
164 AC_MSG_CHECKING(for mkdir -p flag)
165 if test -d config.tmpdir
167 rmdir config.tmpdir/foo/bar >/dev/null 2>/dev/null
168 rmdir config.tmpdir/foo >/dev/null 2>/dev/null
169 rmdir config.tmpdir >/dev/null 2>/dev/null
173 if mkdir -p config.tmpdir/foo/bar >/dev/null 2>/dev/null
175 if test -d config.tmpdir
177 if test -d config.tmpdir/foo
179 if test -d config.tmpdir/foo/bar
182 rmdir config.tmpdir/foo/bar >/dev/null 2>/dev/null
184 rmdir config.tmpdir/foo >/dev/null 2>/dev/null
186 rmdir config.tmpdir >/dev/null 2>/dev/null
190 if test "$result" = yes
197 AC_MSG_RESULT($result)
199 AC_MSG_CHECKING(for ls group field)
200 lsg=`/bin/ls -ldg / | wc -w | awk '{print $1}'`;
201 ls=`/bin/ls -ld / | wc -w | awk '{print $1}'`;
207 if test "$ls" = 8 -a "$lsg" = 9;
209 result="yes, with -g"
210 AC_DEFINE(HAVE_LS_G_FLAG)
213 AC_MSG_RESULT($result)
215 dnl Checks for various system characteristics
216 AC_MSG_CHECKING(for /etc/default/login)
217 if test $EXISTS /etc/default/login
220 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
224 AC_MSG_RESULT($result)
226 AC_MSG_CHECKING(for /etc/securetty)
227 if test $EXISTS /etc/securetty
230 AC_DEFINE(HAVE_SECURETTY)
234 AC_MSG_RESULT($result)
236 AC_MSG_CHECKING(for /etc/logindevperm)
237 if test $EXISTS /etc/logindevperm
240 AC_DEFINE(HAVE_LOGIN_PERMFILE, "/etc/logindevperm")
244 AC_MSG_CHECKING(for /etc/fbtab)
245 if test $EXISTS /etc/fbtab
248 AC_DEFINE(HAVE_LOGIN_PERMFILE, "/etc/fbtab")
252 AC_MSG_RESULT($result)
255 AC_MSG_CHECKING(for /etc/environment)
256 if test $EXISTS /etc/environment
259 AC_DEFINE(HAVE_LOGIN_ENVFILE, "/etc/environment")
263 AC_MSG_CHECKING(for /etc/src.sh)
264 if test $EXISTS /etc/src.sh
267 AC_DEFINE(HAVE_LOGIN_ENVFILE, "/etc/src.sh")
271 AC_MSG_RESULT($result)
274 AC_MSG_CHECKING(for /etc/shadow)
275 if test $EXISTS /etc/shadow
278 AC_DEFINE(HAVE_ETC_SHADOW)
282 AC_MSG_CHECKING(for /etc/security/passwd.adjunct)
283 if test $EXISTS /etc/security/passwd.adjunct
286 AC_DEFINE(HAVE_SUNOS_C2_SHADOW)
287 LIBOBJS="$LIBOBJS getspnam.o endspent.o"
292 AC_MSG_RESULT($result)
294 AC_MSG_CHECKING(for /var/adm/sulog)
295 if test $EXISTS /var/adm/sulog
298 AC_DEFINE(HAVE_SULOG)
302 AC_MSG_RESULT($result)
304 AC_MSG_CHECKING(mail spool location)
306 for i in /var/mail /usr/mail /var/spool/mail /usr/spool/mail
313 if test -z "$mail_spool"
318 AC_DEFINE_UNQUOTED(PATH_MAIL, "$mail_spool")
320 AC_MSG_RESULT($result)
322 AC_MSG_CHECKING(where your system puts the utmp file)
324 for i in /var/run /var/adm /usr/adm /etc
326 if test $EXISTS $i/utmp
331 if test -z "$utmp_path"
336 AC_DEFINE_UNQUOTED(PATH_UTMP_AC, "$utmp_path/utmp")
338 AC_MSG_RESULT($result)
340 AC_MSG_CHECKING(where your system puts the utmpx file)
342 for i in /var/run /var/adm /usr/adm /etc
344 if test $EXISTS $i/utmp
349 if test -z "$utmp_path"
352 AC_DEFINE_UNQUOTED(PATH_UTMP_AC, "$utmp_path/utmpx")
354 AC_MSG_RESULT($result)
356 AC_MSG_CHECKING(where your system puts the wtmp file)
358 for i in /var/run /var/log /var/adm /usr/adm /etc
360 if test $EXISTS $i/wtmp
365 if test -z "$wtmp_path"
370 AC_DEFINE_UNQUOTED(PATH_WTMP_AC, "$wtmp_path/wtmp")
372 AC_MSG_RESULT($result)
374 AC_MSG_CHECKING(where your system puts the wtmpx file)
376 for i in /var/run /var/log /var/adm /usr/adm /etc
378 if test $EXISTS $i/wtmpx
383 if test -z "$wtmpx_path"
388 AC_DEFINE_UNQUOTED(PATH_WTMPX_AC, "$wtmpx_path/wtmpx")
390 AC_MSG_RESULT($result)
392 AC_MSG_CHECKING(whether the system profile displays the motd)
394 if test $EXISTS /etc/profile
396 if grep motd /etc/profile >/dev/null 2>/dev/null
401 if test "$result" = yes
403 AC_DEFINE(HAVE_MOTD_IN_PROFILE)
405 AC_MSG_RESULT($result)
407 AC_MSG_CHECKING(whether the system profile checks for mail)
409 if test $EXISTS /etc/profile
411 if grep 'mail\.' /etc/profile >/dev/null 2>/dev/null
416 if test "$result" = yes
418 AC_DEFINE(HAVE_MAILCHECK_IN_PROFILE)
420 AC_MSG_RESULT($result)
425 AC_MSG_CHECKING(to see if your compiler can handle void arguments)
426 AC_TRY_COMPILE(foo(void) { },, AC_DEFINE(HAVE_VOIDARG) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
428 AC_MSG_CHECKING(to see if your compiler can handle void return values)
429 AC_TRY_COMPILE(void foo() { },, AC_DEFINE(HAVE_VOIDRET) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
431 AC_MSG_CHECKING(to see if your compiler can handle void pointers)
432 AC_TRY_COMPILE(foo() { void *bar = (void *)0x42; bar = bar + 1; },, AC_DEFINE(HAVE_VOIDPTR) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
434 AC_MSG_CHECKING(to see if your compiler can handle ANSI argument lists)
435 AC_TRY_COMPILE(int foo(int bar, int baz) { return 0; },, AC_DEFINE(HAVE_ANSIDECL) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
437 AC_MSG_CHECKING(to see if your compiler can handle ANSI prototypes)
438 AC_TRY_COMPILE(extern int foo(int, int);,, AC_DEFINE(HAVE_ANSIPROTO) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
440 AC_MSG_CHECKING(to see if your compiler can handle ANSI variable arguments)
441 AC_TRY_COMPILE([#include <stdarg.h>
442 int foo(int arg, ...) {
447 }],, AC_DEFINE(HAVE_ANSISTDARG) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
449 AC_MSG_CHECKING(to see if you have an ANSI-style sprintf)
450 AC_TRY_RUN([#include <stdio.h>
457 i += sprintf(buf, "1234");
458 return (i == 6) ? 0 : -1;
459 }], AC_DEFINE(HAVE_ANSISPRINTF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no), AC_MSG_RESULT(no))
461 dnl Checks for libraries.
462 AC_CHECK_LIB(crypt, crypt)
463 AC_CHECK_LIB(nsl, gethostname)
464 AC_CHECK_LIB(posix, main)
465 AC_CHECK_LIB(socket, socket)
467 dnl Checks for header files.
470 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 sys/select.h)
472 dnl Checks for typedefs, structures, and compiler characteristics.
476 dnl AC_STRUCT_ST_BLKSIZE
479 AC_MSG_CHECKING(for ut_pid in struct utmp)
480 AC_TRY_COMPILE([#include <sys/types.h>
481 #include <utmp.h>], [struct utmp foo; return (int)foo.ut_pid;], AC_DEFINE(HAVE_UT_PID) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
482 AC_MSG_CHECKING(for ut_type in struct utmp)
483 AC_TRY_COMPILE([#include <sys/types.h>
484 #include <utmp.h>], [struct utmp foo; return (int)foo.ut_type;], AC_DEFINE(HAVE_UT_TYPE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
485 AC_MSG_CHECKING(for ut_name in struct utmp)
486 AC_TRY_COMPILE([#include <sys/types.h>
487 #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))
488 dnl AC_MSG_CHECKING(for ut_user in struct utmp)
489 dnl AC_TRY_COMPILE([#include <sys/types.h>
490 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))
491 AC_MSG_CHECKING(for ut_host in struct utmp)
492 AC_TRY_COMPILE([#include <sys/types.h>
493 #include <utmp.h>], [struct utmp foo; return (int)foo.ut_host[0];], AC_DEFINE(HAVE_UT_HOST) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
494 AC_MSG_CHECKING(for ut_id in struct utmp)
495 AC_TRY_COMPILE([#include <sys/types.h>
496 #include <utmp.h>], [struct utmp foo; return (int)foo.ut_id[0];], AC_DEFINE(HAVE_UT_ID) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
497 #AC_MSG_CHECKING(for ut_syslen in struct utmp)
498 #AC_TRY_COMPILE([#include <sys/types.h>
499 ##include <utmp.h>], [struct utmp foo; return (int)foo.ut_syslen;], AC_DEFINE(HAVE_UT_SYSLEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
500 AC_MSG_CHECKING(for ut_syslen in struct utmpx)
501 AC_TRY_COMPILE([#include <sys/types.h>
502 #include <utmpx.h>], [struct utmpx foo; return (int)foo.ut_syslen;], AC_DEFINE(HAVE_UTX_SYSLEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
504 dnl Checks for library functions.
505 dnl AC_PROG_GCC_TRADITIONAL
507 AC_CHECK_FUNCS(gettimeofday socket strftime strstr setpriority getttynam setvbuf getspnam endspent setgroups getgroups fpurge setlogin lstat getutxline pututxline usleep)
512 AC_REPLACE_FUNCS(getusershell sigaddset sigemptyset strerror strncasecmp)
513 MISSING="$LIBOBJS $ALLOCA " ;
515 dnl These should be simplified by a macro
516 AC_CHECK_FUNC(atexit, AC_DEFINE(HAVE_ATEXIT), MISSING="${MISSING}atexit.o "; AC_CHECK_FUNCS(on_exit))
517 AC_CHECK_FUNC(endutent, AC_DEFINE(HAVE_ENDUTENT), MISSING="${MISSING}endutent.o ")
518 AC_CHECK_FUNC(initgroups, AC_DEFINE(HAVE_INITGROUPS), MISSING="${MISSING}initgroups.o ")
519 AC_CHECK_FUNC(memcmp, AC_DEFINE(HAVE_MEMCMP), MISSING="${MISSING}memcmp.o ")
520 AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY), MISSING="${MISSING}memcpy.o "; AC_CHECK_FUNCS(bcopy))
521 AC_CHECK_FUNC(memset, AC_DEFINE(HAVE_MEMSET), MISSING="${MISSING}memset.o "; AC_CHECK_FUNCS(bzero))
522 AC_CHECK_FUNC(getcwd, AC_DEFINE(HAVE_GETCWD), MISSING="${MISSING}getcwd.o "; AC_CHECK_FUNCS(getwd))
523 AC_CHECK_FUNC(getenv, AC_DEFINE(HAVE_GETENV), MISSING="${MISSING}env.o ")
524 AC_CHECK_FUNC(getutline, AC_DEFINE(HAVE_GETUTLINE), MISSING="${MISSING}getutline.o "; AC_CHECK_FUNCS(ttyslot))
525 AC_CHECK_FUNC(pututline, AC_DEFINE(HAVE_PUTUTLINE), MISSING="${MISSING}pututline.o "; AC_CHECK_FUNCS(ttyslot))
526 AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV), MISSING="${MISSING}env.o ")
527 AC_CHECK_FUNC(setegid, AC_DEFINE(HAVE_SETEGID), MISSING="${MISSING}setegid.o "; AC_CHECK_FUNCS(setregid setresgid))
528 AC_CHECK_FUNC(seteuid, AC_DEFINE(HAVE_SETEUID), MISSING="${MISSING}seteuid.o "; AC_CHECK_FUNCS(setreuid setresuid))
529 AC_CHECK_FUNC(setutent, AC_DEFINE(HAVE_SETUTENT), MISSING="${MISSING}setutent.o ")
530 AC_CHECK_FUNC(sigprocmask, AC_DEFINE(HAVE_SIGPROCMASK), MISSING="${MISSING}sigprocmask.o "; AC_CHECK_FUNCS(sigblock sigsetmask))
531 AC_CHECK_FUNC(strchr, AC_DEFINE(HAVE_STRCHR), MISSING="${MISSING}strchr.o "; AC_CHECK_FUNCS(index))
532 AC_CHECK_FUNC(strrchr, AC_DEFINE(HAVE_STRRCHR), MISSING="${MISSING}strrchr.o "; AC_CHECK_FUNCS(rindex))
533 AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL), MISSING="${MISSING}strtoul.o ")
534 AC_CHECK_FUNC(sysconf, AC_DEFINE(HAVE_SYSCONF), MISSING="${MISSING}sysconf.o "; AC_CHECK_FUNCS(getdtablesize))
535 AC_CHECK_FUNC(uname, AC_DEFINE(HAVE_UNAME), MISSING="${MISSING}uname.o "; AC_CHECK_FUNCS(gethostname))
536 AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV), MISSING="${MISSING}env.o ")
539 AC_MSG_CHECKING(for nonstandard gettimeofday)
542 #include <sys/time.h>
543 #endif /* HAVE_SYS_TIME_H */
546 #endif /* HAVE_UNISTD_H */
549 gettimeofday(&tv, NULL)], AC_MSG_RESULT(no), AC_MSG_RESULT(maybe) AC_TRY_COMPILE([
551 #include <sys/time.h>
552 #endif /* HAVE_SYS_TIME_H */
555 #endif /* HAVE_UNISTD_H */
558 gettimeofday(&tv)], AC_DEFINE(HAVE_ONE_ARG_GETTIMEOFDAY) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)))
560 # Munge out LOCALBIN and LOCALMAN in canonical (no bletch) form
561 AC_OUTPUT(configure.munger libmissing/Makefile libopie/Makefile Makefile.munge:Makefile.in)