Imported Upstream version 1.7.6p1
[debian/sudo] / configure.in
1 dnl
2 dnl Process this file with GNU autoconf to produce a configure script.
3 dnl
4 dnl Copyright (c) 1994-1996,1998-2011 Todd C. Miller <Todd.Miller@courtesan.com>
5 dnl
6 AC_INIT([sudo], [1.7.6p1], [http://www.sudo.ws/bugs/], [sudo])
7 AC_CONFIG_HEADER(config.h pathnames.h zlib/zconf.h)
8 dnl
9 dnl Note: this must come after AC_INIT
10 dnl
11 AC_MSG_NOTICE([Configuring Sudo version $PACKAGE_VERSION])
12 dnl
13 dnl Variables that get substituted in the Makefile and man pages
14 dnl
15 AC_SUBST([HAVE_BSM_AUDIT])
16 AC_SUBST([SHELL])
17 AC_SUBST([LIBTOOL])
18 AC_SUBST([CFLAGS])
19 AC_SUBST([PROGS])
20 AC_SUBST([CPPFLAGS])
21 AC_SUBST([LDFLAGS])
22 AC_SUBST([COMMON_OBJS])
23 AC_SUBST([SUDO_LDFLAGS])
24 AC_SUBST([SUDO_OBJS])
25 AC_SUBST([LIBS])
26 AC_SUBST([SUDO_LIBS])
27 AC_SUBST([NET_LIBS])
28 AC_SUBST([AFS_LIBS])
29 AC_SUBST([GETGROUPS_LIB])
30 AC_SUBST([OSDEFS])
31 AC_SUBST([AUTH_OBJS])
32 AC_SUBST([MANTYPE])
33 AC_SUBST([MAN_POSTINSTALL])
34 AC_SUBST([SUDOERS_MODE])
35 AC_SUBST([SUDOERS_UID])
36 AC_SUBST([SUDOERS_GID])
37 AC_SUBST([DEV])
38 AC_SUBST([BAMAN])
39 AC_SUBST([LCMAN])
40 AC_SUBST([SEMAN])
41 AC_SUBST([devdir])
42 AC_SUBST([mansectsu])
43 AC_SUBST([mansectform])
44 AC_SUBST([mansrcdir])
45 AC_SUBST([NOEXECFILE])
46 AC_SUBST([NOEXECDIR])
47 AC_SUBST([noexec_file])
48 AC_SUBST([INSTALL_NOEXEC])
49 AC_SUBST([DONT_LEAK_PATH_INFO])
50 AC_SUBST([BSDAUTH_USAGE])
51 AC_SUBST([SELINUX_USAGE])
52 AC_SUBST([LDAP])
53 AC_SUBST([REPLAY])
54 AC_SUBST([LOGINCAP_USAGE])
55 AC_SUBST([ZLIB])
56 AC_SUBST([ZLIB_DEP])
57 AC_SUBST([CONFIGURE_ARGS])
58 dnl
59 dnl Variables that get substituted in docs (not overridden by environment)
60 dnl
61 AC_SUBST([iolog_dir])dnl real initial value from SUDO_IO_LOGDIR
62 AC_SUBST([timedir])dnl real initial value from SUDO_TIMEDIR
63 AC_SUBST([timeout])
64 AC_SUBST([password_timeout])
65 AC_SUBST([sudo_umask])
66 AC_SUBST([umask_override])
67 AC_SUBST([passprompt])
68 AC_SUBST([long_otp_prompt])
69 AC_SUBST([lecture])
70 AC_SUBST([logfac])
71 AC_SUBST([goodpri])
72 AC_SUBST([badpri])
73 AC_SUBST([loglen])
74 AC_SUBST([ignore_dot])
75 AC_SUBST([mail_no_user])
76 AC_SUBST([mail_no_host])
77 AC_SUBST([mail_no_perms])
78 AC_SUBST([mailto])
79 AC_SUBST([mailsub])
80 AC_SUBST([badpass_message])
81 AC_SUBST([fqdn])
82 AC_SUBST([runas_default])
83 AC_SUBST([env_editor])
84 AC_SUBST([env_reset])
85 AC_SUBST([passwd_tries])
86 AC_SUBST([tty_tickets])
87 AC_SUBST([insults])
88 AC_SUBST([root_sudo])
89 AC_SUBST([path_info])
90 AC_SUBST([ldap_conf])
91 AC_SUBST([ldap_secret])
92 AC_SUBST([nsswitch_conf])
93 AC_SUBST([netsvc_conf])
94 AC_SUBST([secure_path])
95 AC_SUBST([editor])
96 #
97 # Begin initial values for man page substitution
98 #
99 iolog_dir=/var/log/sudo-io
100 timedir=/var/adm/sudo
101 timeout=5
102 password_timeout=5
103 sudo_umask=0022
104 umask_override=off
105 passprompt="Password:"
106 long_otp_prompt=off
107 lecture=once
108 logfac=auth
109 goodpri=notice
110 badpri=alert
111 loglen=80
112 ignore_dot=off
113 mail_no_user=on
114 mail_no_host=off
115 mail_no_perms=off
116 mailto=root
117 mailsub="*** SECURITY information for %h ***"
118 badpass_message="Sorry, try again."
119 fqdn=off
120 runas_default=root
121 env_editor=off
122 env_reset=on
123 editor=vi
124 passwd_tries=3
125 tty_tickets=on
126 insults=off
127 root_sudo=on
128 path_info=on
129 ldap_conf=/etc/ldap.conf
130 ldap_secret=/etc/ldap.secret
131 netsvc_conf=/etc/netsvc.conf
132 noexec_file=/usr/local/libexec/sudo_noexec.so
133 nsswitch_conf=/etc/nsswitch.conf
134 secure_path="not set"
135 #
136 # End initial values for man page substitution
137 #
138 dnl
139 dnl Initial values for Makefile variables listed above
140 dnl May be overridden by environment variables..
141 dnl
142 INSTALL_NOEXEC=
143 devdir='$(srcdir)'
144 PROGS="sudo visudo"
145 : ${MANTYPE='man'}
146 : ${mansrcdir='.'}
147 : ${SUDOERS_MODE='0440'}
148 : ${SUDOERS_UID='0'}
149 : ${SUDOERS_GID='0'}
150 DEV="#"
151 LDAP="#"
152 REPLAY="#"
153 BAMAN=0
154 LCMAN=0
155 SEMAN=0
156 ZLIB=
157 ZLIB_DEP=
158 AUTH_OBJS=
159 AUTH_REG=
160 AUTH_EXCL=
161 AUTH_EXCL_DEF=
162 AUTH_DEF=passwd
163
164 dnl
165 dnl Other vaiables
166 dnl
167 CHECKSHADOW=true
168 shadow_defs=
169 shadow_funcs=
170 shadow_libs=
171 shadow_libs_optional=
172
173 CONFIGURE_ARGS="$@"
174
175 dnl
176 dnl Deprecated --with options (these all warn or generate an error)
177 dnl
178
179 AC_ARG_WITH(otp-only, [AS_HELP_STRING([--with-otp-only], [deprecated])],
180 [case $with_otp_only in
181     yes)        with_passwd="no"
182                 AC_MSG_NOTICE([--with-otp-only option deprecated, treating as --without-passwd])
183                 ;;
184 esac])
185
186 AC_ARG_WITH(alertmail, [AS_HELP_STRING([--with-alertmail], [deprecated])],
187 [case $with_alertmail in
188     *)          with_mailto="$with_alertmail"
189                 AC_MSG_NOTICE([--with-alertmail option deprecated, treating as --mailto])
190                 ;;
191 esac])
192
193 dnl
194 dnl Options for --with
195 dnl
196
197 AC_ARG_WITH(devel, [AS_HELP_STRING([--with-devel], [add development options])],
198 [case $with_devel in
199     yes)        AC_MSG_NOTICE([Setting up for development: -Wall, flex, yacc])
200                 PROGS="${PROGS} testsudoers"
201                 OSDEFS="${OSDEFS} -DSUDO_DEVEL"
202                 DEV=""
203                 devdir=.
204                 ;;
205     no)         ;;
206     *)          AC_MSG_WARN([Ignoring unknown argument to --with-devel: $with_devel])
207                 ;;
208 esac])
209
210 AC_ARG_WITH(CC, [AS_HELP_STRING([--with-CC], [C compiler to use])],
211 [case $with_CC in
212     yes)        AC_MSG_ERROR(["must give --with-CC an argument."])
213                 ;;
214     no)         AC_MSG_ERROR(["illegal argument: --without-CC."])
215                 ;;
216     *)          CC=$with_CC
217                 ;;
218 esac])
219
220 AC_ARG_WITH(rpath, [AS_HELP_STRING([--with-rpath], [pass -R flag in addition to -L for lib paths])],
221 [case $with_rpath in
222     yes|no)     ;;
223     *)          AC_MSG_ERROR(["--with-rpath does not take an argument."])
224                 ;;
225 esac])
226
227 AC_ARG_WITH(blibpath, [AS_HELP_STRING([--with-blibpath[=PATH]], [pass -blibpath flag to ld for additional lib paths])],
228 [case $with_blibpath in
229     yes|no)     ;;
230     *)          AC_MSG_NOTICE([will pass -blibpath:${with_blibpath} to the loader.])
231                 ;;
232 esac])
233
234 dnl
235 dnl Handle BSM auditing support.
236 dnl
237 AC_ARG_WITH(bsm-audit, [AS_HELP_STRING([--with-bsm-audit], [enable BSM audit support])],
238 [case $with_bsm_audit in
239     yes)        AC_DEFINE(HAVE_BSM_AUDIT)
240                 SUDO_LIBS="${SUDO_LIBS} -lbsm"
241                 SUDO_OBJS="${SUDO_OBJS} bsm_audit.o"
242                 ;;
243     no)         ;;
244     *)          AC_MSG_ERROR(["--with-bsm-audit does not take an argument."])
245                 ;;
246 esac])
247
248 dnl
249 dnl Handle Linux auditing support.
250 dnl
251 AC_ARG_WITH(linux-audit, [AS_HELP_STRING([--with-linux-audit], [enable Linux audit support])],
252 [case $with_linux_audit in
253     yes)        AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libaudit.h>]], [[int i = AUDIT_USER_CMD; (void)i;]])], [
254                     AC_DEFINE(HAVE_LINUX_AUDIT)
255                     SUDO_LIBS="${SUDO_LIBS} -laudit"
256                     SUDO_OBJS="${SUDO_OBJS} linux_audit.o"
257                 ], [
258                     AC_MSG_ERROR([unable to find AUDIT_USER_CMD in libaudit.h for --with-linux-audit])
259                 ])
260                 ;;
261     no)         ;;
262     *)          AC_MSG_ERROR(["--with-linux-audit does not take an argument."])
263                 ;;
264 esac])
265
266 AC_ARG_WITH(incpath, [AS_HELP_STRING([--with-incpath], [additional places to look for include files])],
267 [case $with_incpath in
268     yes)        AC_MSG_ERROR(["must give --with-incpath an argument."])
269                 ;;
270     no)         AC_MSG_ERROR(["--without-incpath not supported."])
271                 ;;
272     *)          AC_MSG_NOTICE([Adding ${with_incpath} to CPPFLAGS])
273                 for i in ${with_incpath}; do
274                     CPPFLAGS="${CPPFLAGS} -I${i}"
275                 done
276                 ;;
277 esac])
278
279 AC_ARG_WITH(libpath, [AS_HELP_STRING([--with-libpath], [additional places to look for libraries])],
280 [case $with_libpath in
281     yes)        AC_MSG_ERROR(["must give --with-libpath an argument."])
282                 ;;
283     no)         AC_MSG_ERROR(["--without-libpath not supported."])
284                 ;;
285     *)          AC_MSG_NOTICE([Adding ${with_libpath} to LDFLAGS])
286                 ;;
287 esac])
288
289 AC_ARG_WITH(libraries, [AS_HELP_STRING([--with-libraries], [additional libraries to link with])],
290 [case $with_libraries in
291     yes)        AC_MSG_ERROR(["must give --with-libraries an argument."])
292                 ;;
293     no)         AC_MSG_ERROR(["--without-libraries not supported."])
294                 ;;
295     *)          AC_MSG_NOTICE([Adding ${with_libraries} to LIBS])
296                 ;;
297 esac])
298
299 AC_ARG_WITH(efence, [AS_HELP_STRING([--with-efence], [link with -lefence for malloc() debugging])],
300 [case $with_efence in
301     yes)        AC_MSG_NOTICE([Sudo will link with -lefence (Electric Fence)])
302                 LIBS="${LIBS} -lefence"
303                 if test -f /usr/local/lib/libefence.a; then
304                     with_libpath="${with_libpath} /usr/local/lib"
305                 fi
306                 ;;
307     no)         ;;
308     *)          AC_MSG_WARN([Ignoring unknown argument to --with-efence: $with_efence])
309                 ;;
310 esac])
311
312 AC_ARG_WITH(csops, [AS_HELP_STRING([--with-csops], [add CSOps standard options])],
313 [case $with_csops in
314     yes)        AC_MSG_NOTICE([Adding CSOps standard options])
315                 CHECKSIA=false
316                 with_ignore_dot=yes
317                 insults=on
318                 with_classic_insults=yes
319                 with_csops_insults=yes
320                 with_env_editor=yes
321                 : ${mansectsu='8'}
322                 : ${mansectform='5'}
323                 ;;
324     no)         ;;
325     *)          AC_MSG_WARN([Ignoring unknown argument to --with-csops: $with_csops])
326                 ;;
327 esac])
328
329 AC_ARG_WITH(passwd, [AS_HELP_STRING([--without-passwd], [don't use passwd/shadow file for authentication])],
330 [case $with_passwd in
331     yes|no)     AC_MSG_CHECKING(whether to use shadow/passwd file authentication)
332                 AC_MSG_RESULT($with_passwd)
333                 AUTH_DEF=""
334                 test "$with_passwd" = "yes" && AUTH_REG="$AUTH_REG passwd"
335                 ;;
336     *)          AC_MSG_ERROR(["Sorry, --with-passwd does not take an argument."])
337                 ;;
338 esac])
339
340 AC_ARG_WITH(skey, [AS_HELP_STRING([--with-skey[=DIR]], [enable S/Key support ])],
341 [case $with_skey in
342     no)         ;;
343     *)          AC_DEFINE(HAVE_SKEY)
344                 AC_MSG_CHECKING(whether to try S/Key authentication)
345                 AC_MSG_RESULT(yes)
346                 AUTH_REG="$AUTH_REG S/Key"
347                 ;;
348 esac])
349
350 AC_ARG_WITH(opie, [AS_HELP_STRING([--with-opie[=DIR]], [enable OPIE support ])],
351 [case $with_opie in
352     no)         ;;
353     *)          AC_DEFINE(HAVE_OPIE)
354                 AC_MSG_CHECKING(whether to try NRL OPIE authentication)
355                 AC_MSG_RESULT(yes)
356                 AUTH_REG="$AUTH_REG NRL_OPIE"
357                 ;;
358 esac])
359
360 AC_ARG_WITH(long-otp-prompt, [AS_HELP_STRING([--with-long-otp-prompt], [use a two line OTP (skey/opie) prompt])],
361 [case $with_long_otp_prompt in
362     yes)        AC_DEFINE(LONG_OTP_PROMPT)
363                 AC_MSG_CHECKING(whether to use a two line prompt for OTP authentication)
364                 AC_MSG_RESULT(yes)
365                 long_otp_prompt=on
366                 ;;
367     no)         long_otp_prompt=off
368                 ;;
369     *)          AC_MSG_ERROR(["--with-long-otp-prompt does not take an argument."])
370                 ;;
371 esac])
372
373 AC_ARG_WITH(SecurID, [AS_HELP_STRING([--with-SecurID[[=DIR]]], [enable SecurID support])],
374 [case $with_SecurID in
375     no)         ;;
376     *)          AC_DEFINE(HAVE_SECURID)
377                 AC_MSG_CHECKING(whether to use SecurID for authentication)
378                 AC_MSG_RESULT(yes)
379                 AUTH_EXCL="$AUTH_EXCL SecurID"
380                 ;;
381 esac])
382
383 AC_ARG_WITH(fwtk, [AS_HELP_STRING([--with-fwtk[[=DIR]]], [enable FWTK AuthSRV support])],
384 [case $with_fwtk in
385     no)         ;;
386     *)          AC_DEFINE(HAVE_FWTK)
387                 AC_MSG_CHECKING(whether to use FWTK AuthSRV for authentication)
388                 AC_MSG_RESULT(yes)
389                 AUTH_EXCL="$AUTH_EXCL FWTK"
390                 ;;
391 esac])
392
393 AC_ARG_WITH(kerb4, [AS_HELP_STRING([--with-kerb4[[=DIR]]], [enable Kerberos IV support])],
394 [case $with_kerb4 in
395     no)         ;;
396     *)          AC_MSG_CHECKING(whether to try kerberos IV authentication)
397                 AC_MSG_RESULT(yes)
398                 AUTH_REG="$AUTH_REG kerb4"
399                 ;;
400 esac])
401
402 AC_ARG_WITH(kerb5, [AS_HELP_STRING([--with-kerb5[[=DIR]]], [enable Kerberos V support])],
403 [case $with_kerb5 in
404     no)         ;;
405     *)          AC_MSG_CHECKING(whether to try Kerberos V authentication)
406                 AC_MSG_RESULT(yes)
407                 AUTH_REG="$AUTH_REG kerb5"
408                 ;;
409 esac])
410
411 AC_ARG_WITH(aixauth, [AS_HELP_STRING([--with-aixauth], [enable AIX general authentication support])],
412 [case $with_aixauth in
413     yes)        AUTH_EXCL="$AUTH_EXCL AIX_AUTH";;
414     no)         ;;
415     *)          AC_MSG_ERROR(["--with-aixauth does not take an argument."])
416                 ;;
417 esac])
418
419 AC_ARG_WITH(pam, [AS_HELP_STRING([--with-pam], [enable PAM support])],
420 [case $with_pam in
421     yes)        AUTH_EXCL="$AUTH_EXCL PAM";;
422     no)         ;;
423     *)          AC_MSG_ERROR(["--with-pam does not take an argument."])
424                 ;;
425 esac])
426
427 AC_ARG_WITH(AFS, [AS_HELP_STRING([--with-AFS], [enable AFS support])],
428 [case $with_AFS in
429     yes)        AC_DEFINE(HAVE_AFS)
430                 AC_MSG_CHECKING(whether to try AFS (kerberos) authentication)
431                 AC_MSG_RESULT(yes)
432                 AUTH_REG="$AUTH_REG AFS"
433                 ;;
434     no)         ;;
435     *)          AC_MSG_ERROR(["--with-AFS does not take an argument."])
436                 ;;
437 esac])
438
439 AC_ARG_WITH(DCE, [AS_HELP_STRING([--with-DCE], [enable DCE support])],
440 [case $with_DCE in
441     yes)        AC_DEFINE(HAVE_DCE)
442                 AC_MSG_CHECKING(whether to try DCE (kerberos) authentication)
443                 AC_MSG_RESULT(yes)
444                 AUTH_REG="$AUTH_REG DCE"
445                 ;;
446     no)         ;;
447     *)          AC_MSG_ERROR(["--with-DCE does not take an argument."])
448                 ;;
449 esac])
450
451 AC_ARG_WITH(logincap, [AS_HELP_STRING([--with-logincap], [enable BSD login class support])],
452 [case $with_logincap in
453     yes|no)     ;;
454     *)          AC_MSG_ERROR(["--with-logincap does not take an argument."])
455                 ;;
456 esac])
457
458 AC_ARG_WITH(bsdauth, [AS_HELP_STRING([--with-bsdauth], [enable BSD authentication support])],
459 [case $with_bsdauth in
460     yes)        AUTH_EXCL="$AUTH_EXCL BSD_AUTH";;
461     no)         ;;
462     *)          AC_MSG_ERROR(["--with-bsdauth does not take an argument."])
463                 ;;
464 esac])
465
466 AC_ARG_WITH(project, [AS_HELP_STRING([--with-project], [enable Solaris project support])],
467 [case $with_project in
468     yes|no)     ;;
469     no) ;;
470     *)          AC_MSG_ERROR(["--with-project does not take an argument."])
471                 ;;
472 esac])
473
474 AC_MSG_CHECKING(whether to lecture users the first time they run sudo)
475 AC_ARG_WITH(lecture, [AS_HELP_STRING([--without-lecture], [don't print lecture for first-time sudoer])],
476 [case $with_lecture in
477     yes|short|always)   lecture=once
478                 ;;
479     no|none|never)      lecture=never
480                 ;;
481     *)          AC_MSG_ERROR(["unknown argument to --with-lecture: $with_lecture"])
482                 ;;
483 esac])
484 if test "$lecture" = "once"; then
485     AC_MSG_RESULT(yes)
486 else
487     AC_DEFINE(NO_LECTURE)
488     AC_MSG_RESULT(no)
489 fi
490
491 AC_MSG_CHECKING(whether sudo should log via syslog or to a file by default)
492 AC_ARG_WITH(logging, [AS_HELP_STRING([--with-logging], [log via syslog, file, or both])],
493 [case $with_logging in
494     yes)        AC_MSG_ERROR(["must give --with-logging an argument."])
495                 ;;
496     no)         AC_MSG_ERROR(["--without-logging not supported."])
497                 ;;
498     syslog)     AC_DEFINE(LOGGING, SLOG_SYSLOG)
499                 AC_MSG_RESULT(syslog)
500                 ;;
501     file)       AC_DEFINE(LOGGING, SLOG_FILE)
502                 AC_MSG_RESULT(file)
503                 ;;
504     both)       AC_DEFINE(LOGGING, SLOG_BOTH)
505                 AC_MSG_RESULT(both)
506                 ;;
507     *)          AC_MSG_ERROR(["unknown argument to --with-logging: $with_logging"])
508                 ;;
509 esac], [AC_DEFINE(LOGGING, SLOG_SYSLOG) AC_MSG_RESULT(syslog)])
510
511 AC_ARG_WITH(logfac, [AS_HELP_STRING([--with-logfac], [syslog facility to log with (default is "auth")])],
512 [case $with_logfac in
513     yes)        AC_MSG_ERROR(["must give --with-logfac an argument."])
514                 ;;
515     no)         AC_MSG_ERROR(["--without-logfac not supported."])
516                 ;;
517     authpriv|auth|daemon|user|local0|local1|local2|local3|local4|local5|local6|local7)          logfac=$with_logfac
518                 ;;
519     *)          AC_MSG_ERROR(["$with_logfac is not a supported syslog facility."])
520                 ;;
521 esac])
522
523 AC_MSG_CHECKING(at which syslog priority to log commands)
524 AC_ARG_WITH(goodpri, [AS_HELP_STRING([--with-goodpri], [syslog priority for commands (def is "notice")])],
525 [case $with_goodpri in
526     yes)        AC_MSG_ERROR(["must give --with-goodpri an argument."])
527                 ;;
528     no)         AC_MSG_ERROR(["--without-goodpri not supported."])
529                 ;;
530     alert|crit|debug|emerg|err|info|notice|warning)
531                 goodpri=$with_goodpri
532                 ;;
533     *)          AC_MSG_ERROR(["$with_goodpri is not a supported syslog priority."])
534                 ;;
535 esac])
536 AC_DEFINE_UNQUOTED(PRI_SUCCESS, "$goodpri", [The syslog priority sudo will use for successful attempts.])
537 AC_MSG_RESULT($goodpri)
538
539 AC_MSG_CHECKING(at which syslog priority to log failures)
540 AC_ARG_WITH(badpri, [AS_HELP_STRING([--with-badpri], [syslog priority for failures (def is "alert")])],
541 [case $with_badpri in
542     yes)        AC_MSG_ERROR(["must give --with-badpri an argument."])
543                 ;;
544     no)         AC_MSG_ERROR(["--without-badpri not supported."])
545                 ;;
546     alert|crit|debug|emerg|err|info|notice|warning)
547                 badpri=$with_badpri
548                 ;;
549     *)          AC_MSG_ERROR([$with_badpri is not a supported syslog priority.])
550                 ;;
551 esac])
552 AC_DEFINE_UNQUOTED(PRI_FAILURE, "$badpri", [The syslog priority sudo will use for unsuccessful attempts/errors.])
553 AC_MSG_RESULT($badpri)
554
555 AC_ARG_WITH(logpath, [AS_HELP_STRING([--with-logpath], [path to the sudo log file])],
556 [case $with_logpath in
557     yes)        AC_MSG_ERROR(["must give --with-logpath an argument."])
558                 ;;
559     no)         AC_MSG_ERROR(["--without-logpath not supported."])
560                 ;;
561 esac])
562
563 AC_MSG_CHECKING(how long a line in the log file should be)
564 AC_ARG_WITH(loglen, [AS_HELP_STRING([--with-loglen], [maximum length of a log file line (default is 80)])],
565 [case $with_loglen in
566     yes)        AC_MSG_ERROR(["must give --with-loglen an argument."])
567                 ;;
568     no)         AC_MSG_ERROR(["--without-loglen not supported."])
569                 ;;
570     [[0-9]]*)   loglen=$with_loglen
571                 ;;
572     *)          AC_MSG_ERROR(["you must enter a number, not $with_loglen"])
573                 ;;
574 esac])
575 AC_DEFINE_UNQUOTED(MAXLOGFILELEN, $loglen, [The max number of chars per log file line (for line wrapping).])
576 AC_MSG_RESULT($loglen)
577
578 AC_MSG_CHECKING(whether sudo should ignore '.' or '' in \$PATH)
579 AC_ARG_WITH(ignore-dot, [AS_HELP_STRING([--with-ignore-dot], [ignore '.' in the PATH])],
580 [case $with_ignore_dot in
581     yes)        ignore_dot=on
582                 ;;
583     no)         ignore_dot=off
584                 ;;
585     *)          AC_MSG_ERROR(["--with-ignore-dot does not take an argument."])
586                 ;;
587 esac])
588 if test "$ignore_dot" = "on"; then
589     AC_DEFINE(IGNORE_DOT_PATH)
590     AC_MSG_RESULT(yes)
591 else
592     AC_MSG_RESULT(no)
593 fi
594
595 AC_MSG_CHECKING(whether to send mail when a user is not in sudoers)
596 AC_ARG_WITH(mail-if-no-user, [AS_HELP_STRING([--without-mail-if-no-user], [do not send mail if user not in sudoers])],
597 [case $with_mail_if_no_user in
598     yes)        mail_no_user=on
599                 ;;
600     no)         mail_no_user=off
601                 ;;
602     *)          AC_MSG_ERROR(["--with-mail-if-no-user does not take an argument."])
603                 ;;
604 esac])
605 if test "$mail_no_user" = "on"; then
606     AC_DEFINE(SEND_MAIL_WHEN_NO_USER)
607     AC_MSG_RESULT(yes)
608 else
609     AC_MSG_RESULT(no)
610 fi
611
612 AC_MSG_CHECKING(whether to send mail when user listed but not for this host)
613 AC_ARG_WITH(mail-if-no-host, [AS_HELP_STRING([--with-mail-if-no-host], [send mail if user in sudoers but not for this host])],
614 [case $with_mail_if_no_host in
615     yes)        mail_no_host=on
616                 ;;
617     no)         mail_no_host=off
618                 ;;
619     *)          AC_MSG_ERROR(["--with-mail-if-no-host does not take an argument."])
620                 ;;
621 esac])
622 if test "$mail_no_host" = "on"; then
623     AC_DEFINE(SEND_MAIL_WHEN_NO_HOST)
624     AC_MSG_RESULT(yes)
625 else
626     AC_MSG_RESULT(no)
627 fi
628
629 AC_MSG_CHECKING(whether to send mail when a user tries a disallowed command)
630 AC_ARG_WITH(mail-if-noperms, [AS_HELP_STRING([--with-mail-if-noperms], [send mail if user not allowed to run command])],
631 [case $with_mail_if_noperms in
632     yes)        mail_noperms=on
633                 ;;
634     no)         mail_noperms=off
635                 ;;
636     *)          AC_MSG_ERROR(["--with-mail-if-noperms does not take an argument."])
637                 ;;
638 esac])
639 if test "$mail_noperms" = "on"; then
640     AC_DEFINE(SEND_MAIL_WHEN_NOT_OK)
641     AC_MSG_RESULT(yes)
642 else
643     AC_MSG_RESULT(no)
644 fi
645
646 AC_MSG_CHECKING(who should get the mail that sudo sends)
647 AC_ARG_WITH(mailto, [AS_HELP_STRING([--with-mailto], [who should get sudo mail (default is "root")])],
648 [case $with_mailto in
649     yes)        AC_MSG_ERROR(["must give --with-mailto an argument."])
650                 ;;
651     no)         AC_MSG_ERROR(["--without-mailto not supported."])
652                 ;;
653     *)          mailto=$with_mailto
654                 ;;
655 esac])
656 AC_DEFINE_UNQUOTED(MAILTO, "$mailto", [The user or email address that sudo mail is sent to.])
657 AC_MSG_RESULT([$mailto])
658
659 AC_ARG_WITH(mailsubject, [AS_HELP_STRING([--with-mailsubject], [subject of sudo mail])],
660 [case $with_mailsubject in
661     yes)        AC_MSG_ERROR(["must give --with-mailsubject an argument."])
662                 ;;
663     no)         AC_MSG_WARN([Sorry, --without-mailsubject not supported.])
664                 ;;
665     *)          mailsub="$with_mailsubject"
666                 AC_MSG_CHECKING(sudo mail subject)
667                 AC_MSG_RESULT([Using alert mail subject: $mailsub])
668                 ;;
669 esac])
670 AC_DEFINE_UNQUOTED(MAILSUBJECT, "$mailsub", [The subject of the mail sent by sudo to the MAILTO user/address.])
671
672 AC_MSG_CHECKING(for bad password prompt)
673 AC_ARG_WITH(passprompt, [AS_HELP_STRING([--with-passprompt], [default password prompt])],
674 [case $with_passprompt in
675     yes)        AC_MSG_ERROR(["must give --with-passprompt an argument."])
676                 ;;
677     no)         AC_MSG_WARN([Sorry, --without-passprompt not supported.])
678                 ;;
679     *)          passprompt="$with_passprompt"
680 esac])
681 AC_MSG_RESULT($passprompt)
682 AC_DEFINE_UNQUOTED(PASSPROMPT, "$passprompt", [The default password prompt.])
683
684 AC_MSG_CHECKING(for bad password message)
685 AC_ARG_WITH(badpass-message, [AS_HELP_STRING([--with-badpass-message], [message the user sees when the password is wrong])],
686 [case $with_badpass_message in
687     yes)        AC_MSG_ERROR(["Must give --with-badpass-message an argument."])
688                 ;;
689     no)         AC_MSG_WARN([Sorry, --without-badpass-message not supported.])
690                 ;;
691     *)          badpass_message="$with_badpass_message"
692                 ;;
693 esac])
694 AC_DEFINE_UNQUOTED(INCORRECT_PASSWORD, "$badpass_message", [The message given when a bad password is entered.])
695 AC_MSG_RESULT([$badpass_message])
696
697 AC_MSG_CHECKING(whether to expect fully qualified hosts in sudoers)
698 AC_ARG_WITH(fqdn, [AS_HELP_STRING([--with-fqdn], [expect fully qualified hosts in sudoers])],
699 [case $with_fqdn in
700     yes)        fqdn=on
701                 ;;
702     no)         fqdn=off
703                 ;;
704     *)          AC_MSG_ERROR(["--with-fqdn does not take an argument."])
705                 ;;
706 esac])
707 if test "$fqdn" = "on"; then
708     AC_DEFINE(FQDN)
709     AC_MSG_RESULT(yes)
710 else
711     AC_MSG_RESULT(no)
712 fi
713
714 AC_ARG_WITH(timedir, [AS_HELP_STRING([--with-timedir], [path to the sudo timestamp dir])],
715 [case $with_timedir in
716     yes)        AC_MSG_ERROR(["must give --with-timedir an argument."])
717                 ;;
718     no)         AC_MSG_ERROR(["--without-timedir not supported."])
719                 ;;
720 esac])
721
722 AC_ARG_WITH(iologdir, [AS_HELP_STRING([--with-iologdir=DIR], [directory to store sudo I/O log files in])],
723 [case $with_iologdir in
724     yes)        ;;
725     no)         ;;
726 esac])
727
728 AC_ARG_WITH(sendmail, [AS_HELP_STRING([--with-sendmail], [set path to sendmail])
729 AS_HELP_STRING([--without-sendmail], [do not send mail at all])],
730 [case $with_sendmail in
731     yes)        with_sendmail=""
732                 ;;
733     no)         ;;
734     *)          SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$with_sendmail")
735                 ;;
736 esac])
737
738 AC_ARG_WITH(sudoers-mode, [AS_HELP_STRING([--with-sudoers-mode], [mode of sudoers file (defaults to 0440)])],
739 [case $with_sudoers_mode in
740     yes)        AC_MSG_ERROR(["must give --with-sudoers-mode an argument."])
741                 ;;
742     no)         AC_MSG_ERROR(["--without-sudoers-mode not supported."])
743                 ;;
744     [[1-9]]*)   SUDOERS_MODE=0${with_sudoers_mode}
745                 ;;
746     0*)         SUDOERS_MODE=$with_sudoers_mode
747                 ;;
748     *)          AC_MSG_ERROR(["you must use an octal mode, not a name."])
749                 ;;
750 esac])
751
752 AC_ARG_WITH(sudoers-uid, [AS_HELP_STRING([--with-sudoers-uid], [uid that owns sudoers file (defaults to 0)])],
753 [case $with_sudoers_uid in
754     yes)        AC_MSG_ERROR(["must give --with-sudoers-uid an argument."])
755                 ;;
756     no)         AC_MSG_ERROR(["--without-sudoers-uid not supported."])
757                 ;;
758     [[0-9]]*)   SUDOERS_UID=$with_sudoers_uid
759                 ;;
760     *)          AC_MSG_ERROR(["you must use an unsigned numeric uid, not a name."])
761                 ;;
762 esac])
763
764 AC_ARG_WITH(sudoers-gid, [AS_HELP_STRING([--with-sudoers-gid], [gid that owns sudoers file (defaults to 0)])],
765 [case $with_sudoers_gid in
766     yes)        AC_MSG_ERROR(["must give --with-sudoers-gid an argument."])
767                 ;;
768     no)         AC_MSG_ERROR(["--without-sudoers-gid not supported."])
769                 ;;
770     [[0-9]]*)   SUDOERS_GID=$with_sudoers_gid
771                 ;;
772     *)          AC_MSG_ERROR(["you must use an unsigned numeric gid, not a name."])
773                 ;;
774 esac])
775
776 AC_MSG_CHECKING(for umask programs should be run with)
777 AC_ARG_WITH(umask, [AS_HELP_STRING([--with-umask], [umask with which the prog should run (default is 022)])
778 AS_HELP_STRING([--without-umask], [Preserves the umask of the user invoking sudo.])],
779 [case $with_umask in
780     yes)        AC_MSG_ERROR(["must give --with-umask an argument."])
781                 ;;
782     no)         sudo_umask=0777
783                 ;;
784     [[0-9]]*)   sudo_umask=$with_umask
785                 ;;
786     *)          AC_MSG_ERROR(["you must enter a numeric mask."])
787                 ;;
788 esac])
789 AC_DEFINE_UNQUOTED(SUDO_UMASK, $sudo_umask, [The umask that the sudo-run prog should use.])
790 if test "$sudo_umask" = "0777"; then
791     AC_MSG_RESULT(user)
792 else
793     AC_MSG_RESULT($sudo_umask)
794 fi
795
796 AC_ARG_WITH(umask-override, [AS_HELP_STRING([--with-umask-override], [Use the umask specified in sudoers even if it is less restrictive than the user's.])],
797 [case $with_umask_override in
798     yes)        AC_DEFINE(UMASK_OVERRIDE)
799                 umask_override=on
800                 ;;
801     no)         umask_override=off
802                 ;;
803     *)          AC_MSG_ERROR(["--with-umask-override does not take an argument."])
804                 ;;
805 esac])
806
807 AC_MSG_CHECKING(for default user to run commands as)
808 AC_ARG_WITH(runas-default, [AS_HELP_STRING([--with-runas-default], [User to run commands as (default is "root")])],
809 [case $with_runas_default in
810     yes)        AC_MSG_ERROR(["must give --with-runas-default an argument."])
811                 ;;
812     no)         AC_MSG_ERROR(["--without-runas-default not supported."])
813                 ;;
814     *)          runas_default="$with_runas_default"
815                 ;;
816 esac])
817 AC_DEFINE_UNQUOTED(RUNAS_DEFAULT, "$runas_default", [The user sudo should run commands as by default.])
818 AC_MSG_RESULT([$runas_default])
819
820 AC_ARG_WITH(exempt, [AS_HELP_STRING([--with-exempt=group], [no passwd needed for users in this group])],
821 [case $with_exempt in
822     yes)        AC_MSG_ERROR(["must give --with-exempt an argument."])
823                 ;;
824     no)         AC_MSG_ERROR(["--without-exempt not supported."])
825                 ;;
826     *)          AC_DEFINE_UNQUOTED(EXEMPTGROUP, "$with_exempt", [If defined, users in this group need not enter a passwd (ie "sudo").])
827                 AC_MSG_CHECKING(for group to be exempt from password)
828                 AC_MSG_RESULT([$with_exempt])
829                 ;;
830 esac])
831
832 AC_MSG_CHECKING(for editor that visudo should use)
833 AC_ARG_WITH(editor, [AS_HELP_STRING([--with-editor=path], [Default editor for visudo (defaults to vi)])],
834 [case $with_editor in
835     yes)        AC_MSG_ERROR(["must give --with-editor an argument."])
836                 ;;
837     no)         AC_MSG_ERROR(["--without-editor not supported."])
838                 ;;
839     *)          AC_DEFINE_UNQUOTED(EDITOR, "$with_editor", [A colon-separated list of pathnames to be used as the editor for visudo.])
840                 AC_MSG_RESULT([$with_editor])
841                 editor="$with_editor"
842                 ;;
843 esac], [AC_DEFINE(EDITOR, _PATH_VI) AC_MSG_RESULT(vi)])
844
845 AC_MSG_CHECKING(whether to obey EDITOR and VISUAL environment variables)
846 AC_ARG_WITH(env-editor, [AS_HELP_STRING([--with-env-editor], [Use the environment variable EDITOR for visudo])],
847 [case $with_env_editor in
848     yes)        env_editor=on
849                 ;;
850     no)         env_editor=off
851                 ;;
852     *)          AC_MSG_ERROR(["--with-env-editor does not take an argument."])
853                 ;;
854 esac])
855 if test "$env_editor" = "on"; then
856     AC_DEFINE(ENV_EDITOR)
857     AC_MSG_RESULT(yes)
858 else
859     AC_MSG_RESULT(no)
860 fi
861
862 AC_MSG_CHECKING(number of tries a user gets to enter their password)
863 AC_ARG_WITH(passwd-tries, [AS_HELP_STRING([--with-passwd-tries], [number of tries to enter password (default is 3)])],
864 [case $with_passwd_tries in
865     yes)        ;;
866     no)         AC_MSG_ERROR(["--without-editor not supported."])
867                 ;;
868     [[1-9]]*)   passwd_tries=$with_passwd_tries
869                 ;;
870     *)          AC_MSG_ERROR(["you must enter the numer of tries, > 0"])
871                 ;;
872 esac])
873 AC_DEFINE_UNQUOTED(TRIES_FOR_PASSWORD, $passwd_tries, [The number of tries a user gets to enter their password.])
874 AC_MSG_RESULT($passwd_tries)
875
876 AC_MSG_CHECKING(time in minutes after which sudo will ask for a password again)
877 AC_ARG_WITH(timeout, [AS_HELP_STRING([--with-timeout], [minutes before sudo asks for passwd again (def is 5 minutes)])],
878 [case $with_timeout in
879     yes)        ;;
880     no)         timeout=0
881                 ;;
882     [[0-9]]*)   timeout=$with_timeout
883                 ;;
884     *)          AC_MSG_ERROR(["you must enter the numer of minutes."])
885                 ;;
886 esac])
887 AC_DEFINE_UNQUOTED(TIMEOUT, $timeout, [The number of minutes before sudo asks for a password again.])
888 AC_MSG_RESULT($timeout)
889
890 AC_MSG_CHECKING(time in minutes after the password prompt will time out)
891 AC_ARG_WITH(password-timeout, [AS_HELP_STRING([--with-password-timeout], [passwd prompt timeout in minutes (default is 5 minutes)])],
892 [case $with_password_timeout in
893     yes)        ;;
894     no)         password_timeout=0
895                 ;;
896     [[0-9]]*)   password_timeout=$with_password_timeout
897                 ;;
898     *)          AC_MSG_ERROR(["you must enter the numer of minutes."])
899                 ;;
900 esac])
901 AC_DEFINE_UNQUOTED(PASSWORD_TIMEOUT, $password_timeout, [The passwd prompt timeout (in minutes).])
902 AC_MSG_RESULT($password_timeout)
903
904 AC_MSG_CHECKING(whether to use per-tty ticket files)
905 AC_ARG_WITH(tty-tickets, [AS_HELP_STRING([--with-tty-tickets], [use a different ticket file for each tty])],
906 [case $with_tty_tickets in
907     yes)        tty_tickets=on
908                 ;;
909     no)         tty_tickets=off
910                 ;;
911     *)          AC_MSG_ERROR(["--with-tty-tickets does not take an argument."])
912                 ;;
913 esac])
914 if test "$tty_tickets" = "off"; then
915     AC_DEFINE(NO_TTY_TICKETS)
916     AC_MSG_RESULT(no)
917 else
918     AC_MSG_RESULT(yes)
919 fi
920
921 AC_MSG_CHECKING(whether to include insults)
922 AC_ARG_WITH(insults, [AS_HELP_STRING([--with-insults], [insult the user for entering an incorrect password])],
923 [case $with_insults in
924     yes)        insults=on
925                 with_classic_insults=yes
926                 with_csops_insults=yes
927                 ;;
928     disabled)   insults=off
929                 with_classic_insults=yes
930                 with_csops_insults=yes
931                 ;;
932     no)         insults=off
933                 ;;
934     *)          AC_MSG_ERROR(["--with-insults does not take an argument."])
935                 ;;
936 esac])
937 if test "$insults" = "on"; then
938     AC_DEFINE(USE_INSULTS)
939     AC_MSG_RESULT(yes)
940 else
941     AC_MSG_RESULT(no)
942 fi
943
944 AC_ARG_WITH(all-insults, [AS_HELP_STRING([--with-all-insults], [include all the sudo insult sets])],
945 [case $with_all_insults in
946     yes)        with_classic_insults=yes
947                 with_csops_insults=yes
948                 with_hal_insults=yes
949                 with_goons_insults=yes
950                 ;;
951     no)         ;;
952     *)          AC_MSG_ERROR(["--with-all-insults does not take an argument."])
953                 ;;
954 esac])
955
956 AC_ARG_WITH(classic-insults, [AS_HELP_STRING([--with-classic-insults], [include the insults from the "classic" sudo])],
957 [case $with_classic_insults in
958     yes)        AC_DEFINE(CLASSIC_INSULTS)
959                 ;;
960     no)         ;;
961     *)          AC_MSG_ERROR(["--with-classic-insults does not take an argument."])
962                 ;;
963 esac])
964
965 AC_ARG_WITH(csops-insults, [AS_HELP_STRING([--with-csops-insults], [include CSOps insults])],
966 [case $with_csops_insults in
967     yes)        AC_DEFINE(CSOPS_INSULTS)
968                 ;;
969     no)         ;;
970     *)          AC_MSG_ERROR(["--with-csops-insults does not take an argument."])
971                 ;;
972 esac])
973
974 AC_ARG_WITH(hal-insults, [AS_HELP_STRING([--with-hal-insults], [include 2001-like insults])],
975 [case $with_hal_insults in
976     yes)        AC_DEFINE(HAL_INSULTS)
977                 ;;
978     no)         ;;
979     *)          AC_MSG_ERROR(["--with-hal-insults does not take an argument."])
980                 ;;
981 esac])
982
983 AC_ARG_WITH(goons-insults, [AS_HELP_STRING([--with-goons-insults], [include the insults from the "Goon Show"])],
984 [case $with_goons_insults in
985     yes)        AC_DEFINE(GOONS_INSULTS)
986                 ;;
987     no)         ;;
988     *)          AC_MSG_ERROR(["--with-goons-insults does not take an argument."])
989                 ;;
990 esac])
991
992 AC_ARG_WITH(nsswitch, [AS_HELP_STRING([--with-nsswitch[[=PATH]]], [path to nsswitch.conf])],
993 [case $with_nsswitch in
994     no)         ;;
995     yes)        with_nsswitch="/etc/nsswitch.conf"
996                 ;;
997     *)          ;;
998 esac])
999
1000 AC_ARG_WITH(ldap, [AS_HELP_STRING([--with-ldap[[=DIR]]], [enable LDAP support])],
1001 [case $with_ldap in
1002     no)         ;;
1003     *)          AC_DEFINE(HAVE_LDAP)
1004                 AC_MSG_CHECKING(whether to use sudoers from LDAP)
1005                 AC_MSG_RESULT(yes)
1006                 ;;
1007 esac])
1008
1009 AC_ARG_WITH(ldap-conf-file, [AS_HELP_STRING([--with-ldap-conf-file], [path to LDAP configuration file])])
1010 test -n "$with_ldap_conf_file" && ldap_conf="$with_ldap_conf_file"
1011 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_CONF, "$ldap_conf", [Path to the ldap.conf file])
1012
1013 AC_ARG_WITH(ldap-secret-file, [AS_HELP_STRING([--with-ldap-secret-file], [path to LDAP secret password file])])
1014 test -n "$with_ldap_secret_file" && ldap_secret="$with_ldap_secret_file"
1015 SUDO_DEFINE_UNQUOTED(_PATH_LDAP_SECRET, "$ldap_secret", [Path to the ldap.secret file])
1016
1017 AC_ARG_WITH(pc-insults, [AS_HELP_STRING([--with-pc-insults], [replace politically incorrect insults with less offensive ones])],
1018 [case $with_pc_insults in
1019     yes)        AC_DEFINE(PC_INSULTS)
1020                 ;;
1021     no)         ;;
1022     *)          AC_MSG_ERROR(["--with-pc-insults does not take an argument."])
1023                 ;;
1024 esac])
1025
1026 dnl include all insult sets on one line
1027 if test "$insults" = "on"; then
1028     AC_MSG_CHECKING(which insult sets to include)
1029     i=""
1030     test "$with_goons_insults" = "yes" && i="goons ${i}"
1031     test "$with_hal_insults" = "yes" && i="hal ${i}"
1032     test "$with_csops_insults" = "yes" && i="csops ${i}"
1033     test "$with_classic_insults" = "yes" && i="classic ${i}"
1034     AC_MSG_RESULT([$i])
1035 fi
1036
1037 AC_MSG_CHECKING(whether to override the user's path)
1038 AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
1039 [case $with_secure_path in
1040     yes)        with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
1041                 AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1042                 AC_MSG_RESULT([$with_secure_path])
1043                 secure_path="set to $with_secure_path"
1044                 ;;
1045     no)         AC_MSG_RESULT(no)
1046                 ;;
1047     *)          AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
1048                 AC_MSG_RESULT([$with_secure_path])
1049                 secure_path="set to F<$with_secure_path>"
1050                 ;;
1051 esac], AC_MSG_RESULT(no))
1052
1053 AC_MSG_CHECKING(whether to get ip addresses from the network interfaces)
1054 AC_ARG_WITH(interfaces, [AS_HELP_STRING([--without-interfaces], [don't try to read the ip addr of ether interfaces])],
1055 [case $with_interfaces in
1056     yes)        AC_MSG_RESULT(yes)
1057                 ;;
1058     no)         AC_DEFINE(STUB_LOAD_INTERFACES)
1059                 AC_MSG_RESULT(no)
1060                 ;;
1061     *)          AC_MSG_ERROR(["--with-interfaces does not take an argument."])
1062                 ;;
1063 esac], AC_MSG_RESULT(yes))
1064
1065 AC_MSG_CHECKING(whether stow should be used)
1066 AC_ARG_WITH(stow, [AS_HELP_STRING([--with-stow], [properly handle GNU stow packaging])],
1067 [case $with_stow in
1068     yes)        AC_MSG_RESULT(yes)
1069                 AC_DEFINE(USE_STOW)
1070                 ;;
1071     no)         AC_MSG_RESULT(no)
1072                 ;;
1073     *)          AC_MSG_ERROR(["--with-stow does not take an argument."])
1074                 ;;
1075 esac], AC_MSG_RESULT(no))
1076
1077 AC_MSG_CHECKING(whether to use an askpass helper)
1078 AC_ARG_WITH(askpass, [AS_HELP_STRING([--with-askpass=PATH], [Fully qualified pathname of askpass helper])],
1079 [case $with_askpass in
1080     yes)        AC_MSG_ERROR(["--with-askpass takes a path as an argument."])
1081                 ;;
1082     no)         ;;
1083     *)          SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, "$with_askpass", [The fully qualified pathname of askpass])
1084                 ;;
1085 esac], AC_MSG_RESULT(no))
1086
1087 dnl
1088 dnl If enabled, set LIBVAS_SO, LIBVAS_RPATH and USING_NONUNIX_GROUPS
1089 dnl
1090 AC_ARG_WITH(libvas, [AS_HELP_STRING([--with-libvas=NAME], [Name of the libvas shared library (default=libvas.so)])],
1091 [case $with_libvas in
1092     yes)        with_libvas=libvas.so
1093                 ;;
1094     no)         ;;
1095     *)          AC_DEFINE_UNQUOTED([LIBVAS_SO], ["$with_libvas"], [The name of libvas.so])
1096                 ;;
1097 esac
1098 if test X"$with_libvas" != X"no"; then
1099     AC_DEFINE_UNQUOTED([LIBVAS_SO], ["$with_libvas"], [The name of libvas.so])
1100     AC_DEFINE(USING_NONUNIX_GROUPS)
1101     COMMON_OBJS="$COMMON_OBJS vasgroups.o"
1102     AC_ARG_WITH([libvas-rpath],
1103        [AS_HELP_STRING([--with-libvas-rpath=PATH],
1104                        [Path to look for libvas in [default=/opt/quest/lib]])],
1105        [LIBVAS_RPATH=$withval],
1106        [LIBVAS_RPATH=/opt/quest/lib])
1107     dnl
1108     dnl Some platforms require libdl for dlopen()
1109     dnl
1110     AC_CHECK_LIB([dl], [main])
1111 fi
1112 ])
1113
1114 dnl
1115 dnl Options for --enable
1116 dnl
1117
1118 AC_MSG_CHECKING(whether to do user authentication by default)
1119 AC_ARG_ENABLE(authentication,
1120 [AS_HELP_STRING([--disable-authentication], [Do not require authentication by default])],
1121 [ case "$enableval" in
1122     yes)        AC_MSG_RESULT(yes)
1123                 ;;
1124     no)         AC_MSG_RESULT(no)
1125                 AC_DEFINE(NO_AUTHENTICATION)
1126                 ;;
1127     *)          AC_MSG_RESULT(no)
1128                 AC_MSG_WARN([Ignoring unknown argument to --enable-authentication: $enableval])
1129                 ;;
1130   esac
1131 ], AC_MSG_RESULT(yes))
1132
1133 AC_MSG_CHECKING(whether to disable running the mailer as root)
1134 AC_ARG_ENABLE(root-mailer,
1135 [AS_HELP_STRING([--disable-root-mailer], [Don't run the mailer as root, run as the user])],
1136 [ case "$enableval" in
1137     yes)        AC_MSG_RESULT(no)
1138                 ;;
1139     no)         AC_MSG_RESULT(yes)
1140                 AC_DEFINE(NO_ROOT_MAILER)
1141                 ;;
1142     *)          AC_MSG_RESULT(no)
1143                 AC_MSG_WARN([Ignoring unknown argument to --enable-root-mailer: $enableval])
1144                 ;;
1145   esac
1146 ], AC_MSG_RESULT(no))
1147
1148 AC_ARG_ENABLE(setreuid,
1149 [AS_HELP_STRING([--disable-setreuid], [Don't try to use the setreuid() function])],
1150 [ case "$enableval" in
1151     no)         SKIP_SETREUID=yes
1152                 ;;
1153     *)          ;;
1154   esac
1155 ])
1156
1157 AC_ARG_ENABLE(setresuid,
1158 [AS_HELP_STRING([--disable-setresuid], [Don't try to use the setresuid() function])],
1159 [ case "$enableval" in
1160     no)         SKIP_SETRESUID=yes
1161                 ;;
1162     *)          ;;
1163   esac
1164 ])
1165
1166 AC_MSG_CHECKING(whether to disable shadow password support)
1167 AC_ARG_ENABLE(shadow,
1168 [AS_HELP_STRING([--disable-shadow], [Never use shadow passwords])],
1169 [ case "$enableval" in
1170     yes)        AC_MSG_RESULT(no)
1171                 ;;
1172     no)         AC_MSG_RESULT(yes)
1173                 CHECKSHADOW="false"
1174                 ;;
1175     *)          AC_MSG_RESULT(no)
1176                 AC_MSG_WARN([Ignoring unknown argument to --enable-shadow: $enableval])
1177                 ;;
1178   esac
1179 ], AC_MSG_RESULT(no))
1180
1181 AC_MSG_CHECKING(whether root should be allowed to use sudo)
1182 AC_ARG_ENABLE(root-sudo,
1183 [AS_HELP_STRING([--disable-root-sudo], [Don't allow root to run sudo])],
1184 [ case "$enableval" in
1185     yes)        AC_MSG_RESULT(yes)
1186                 ;;
1187     no)         AC_DEFINE(NO_ROOT_SUDO)
1188                 AC_MSG_RESULT(no)
1189                 root_sudo=off
1190                 ;;
1191     *)          AC_MSG_ERROR(["--enable-root-sudo does not take an argument."])
1192                 ;;
1193   esac
1194 ], AC_MSG_RESULT(yes))
1195
1196 AC_MSG_CHECKING(whether to log the hostname in the log file)
1197 AC_ARG_ENABLE(log-host,
1198 [AS_HELP_STRING([--enable-log-host], [Log the hostname in the log file])],
1199 [ case "$enableval" in
1200     yes)        AC_MSG_RESULT(yes)
1201                 AC_DEFINE(HOST_IN_LOG)
1202                 ;;
1203     no)         AC_MSG_RESULT(no)
1204                 ;;
1205     *)          AC_MSG_RESULT(no)
1206                 AC_MSG_WARN([Ignoring unknown argument to --enable-log-host: $enableval])
1207                 ;;
1208   esac
1209 ], AC_MSG_RESULT(no))
1210
1211 AC_MSG_CHECKING(whether to invoke a shell if sudo is given no arguments)
1212 AC_ARG_ENABLE(noargs-shell,
1213 [AS_HELP_STRING([--enable-noargs-shell], [If sudo is given no arguments run a shell])],
1214 [ case "$enableval" in
1215     yes)        AC_MSG_RESULT(yes)
1216                 AC_DEFINE(SHELL_IF_NO_ARGS)
1217                 ;;
1218     no)         AC_MSG_RESULT(no)
1219                 ;;
1220     *)          AC_MSG_RESULT(no)
1221                 AC_MSG_WARN([Ignoring unknown argument to --enable-noargs-shell: $enableval])
1222                 ;;
1223   esac
1224 ], AC_MSG_RESULT(no))
1225
1226 AC_MSG_CHECKING(whether to set \$HOME to target user in shell mode)
1227 AC_ARG_ENABLE(shell-sets-home,
1228 [AS_HELP_STRING([--enable-shell-sets-home], [Set $HOME to target user in shell mode])],
1229 [ case "$enableval" in
1230     yes)        AC_MSG_RESULT(yes)
1231                 AC_DEFINE(SHELL_SETS_HOME)
1232                 ;;
1233     no)         AC_MSG_RESULT(no)
1234                 ;;
1235     *)          AC_MSG_RESULT(no)
1236                 AC_MSG_WARN([Ignoring unknown argument to --enable-shell-sets-home: $enableval])
1237                 ;;
1238   esac
1239 ], AC_MSG_RESULT(no))
1240
1241 AC_MSG_CHECKING(whether to disable 'command not found' messages)
1242 AC_ARG_ENABLE(path_info,
1243 [AS_HELP_STRING([--disable-path-info], [Print 'command not allowed' not 'command not found'])],
1244 [ case "$enableval" in
1245     yes)        AC_MSG_RESULT(no)
1246                 ;;
1247     no)         AC_MSG_RESULT(yes)
1248                 AC_DEFINE(DONT_LEAK_PATH_INFO)
1249                 path_info=off
1250                 ;;
1251     *)          AC_MSG_RESULT(no)
1252                 AC_MSG_WARN([Ignoring unknown argument to --enable-path-info: $enableval])
1253                 ;;
1254   esac
1255 ], AC_MSG_RESULT(no))
1256
1257 AC_MSG_CHECKING(whether to enable environment debugging)
1258 AC_ARG_ENABLE(env_debug,
1259 [AS_HELP_STRING([--enable-env-debug], [Whether to enable environment debugging.])],
1260 [ case "$enableval" in
1261     yes)        AC_MSG_RESULT(yes)
1262                 AC_DEFINE(ENV_DEBUG)
1263                 ;;
1264     no)         AC_MSG_RESULT(no)
1265                 ;;
1266     *)          AC_MSG_RESULT(no)
1267                 AC_MSG_WARN([Ignoring unknown argument to --enable-env-debug: $enableval])
1268                 ;;
1269   esac
1270 ], AC_MSG_RESULT(no))
1271
1272 AC_MSG_CHECKING(whether to enable environment resetting by default)
1273 AC_ARG_ENABLE(env_reset,
1274 [AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])],
1275 [ case "$enableval" in
1276     yes)        env_reset=on
1277                 ;;
1278     no)         env_reset=off
1279                 ;;
1280     *)          env_reset=on
1281                 AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval])
1282                 ;;
1283   esac
1284 ])
1285 if test "$env_reset" = "on"; then
1286     AC_MSG_RESULT(yes)
1287     AC_DEFINE(ENV_RESET, TRUE)
1288 else
1289     AC_MSG_RESULT(no)
1290     AC_DEFINE(ENV_RESET, FALSE)
1291 fi
1292
1293 AC_ARG_ENABLE(warnings,
1294 [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])],
1295 [ case "$enableval" in
1296     yes)    if test X"$with_devel" != X"yes" -a -n "$GCC"; then
1297                 CFLAGS="${CFLAGS} -Wall"
1298             fi
1299             ;;
1300     no)     ;;
1301     *)      AC_MSG_WARN([Ignoring unknown argument to --enable-warnings: $enableval])
1302             ;;
1303   esac
1304 ])
1305
1306 AC_ARG_ENABLE(admin-flag,
1307 [AS_HELP_STRING([--enable-admin-flag], [Whether to create a Ubuntu-style admin flag file])],
1308 [ case "$enableval" in
1309     yes)    AC_DEFINE(USE_ADMIN_FLAG)
1310             ;;
1311     no)     ;;
1312     *)      AC_MSG_WARN([Ignoring unknown argument to --enable-admin-flag: $enableval])
1313             ;;
1314   esac
1315 ])
1316
1317 AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])],
1318 [case $with_selinux in
1319     yes)        SELINUX_USAGE="[[-r role]] [[-t type]] "
1320                 AC_DEFINE(HAVE_SELINUX)
1321                 SUDO_LIBS="${SUDO_LIBS} -lselinux"
1322                 SUDO_OBJS="${SUDO_OBJS} selinux.o"
1323                 PROGS="${PROGS} sesh"
1324                 SEMAN=1
1325                 AC_CHECK_LIB([selinux], [setkeycreatecon],
1326                     [AC_DEFINE(HAVE_SETKEYCREATECON)])
1327                 ;;
1328     no)         ;;
1329     *)          AC_MSG_ERROR(["--with-selinux does not take an argument."])
1330                 ;;
1331 esac])
1332
1333 dnl
1334 dnl gss_krb5_ccache_name() may not work on Heimdal so we don't use it by default
1335 dnl
1336 AC_ARG_ENABLE(gss_krb5_ccache_name,
1337 [AS_HELP_STRING([--enable-gss-krb5-ccache-name], [Use GSS-API to set the Kerberos V cred cache name])],
1338 [check_gss_krb5_ccache_name=$enableval], [check_gss_krb5_ccache_name=no])
1339
1340 dnl
1341 dnl C compiler checks
1342 dnl
1343 AC_SEARCH_LIBS([strerror], [cposix])
1344 AC_PROG_CPP
1345 AC_CHECK_TOOL(AR, ar, false)
1346 AC_CHECK_TOOL(RANLIB, ranlib, :)
1347 if test X"$AR" = X"false"; then
1348     AC_MSG_ERROR([the "ar" utility is required to build sudo])
1349 fi
1350
1351 dnl
1352 dnl Libtool setup, we require libtool 2.2.6b or higher
1353 dnl
1354 AC_CANONICAL_HOST
1355 AC_CONFIG_MACRO_DIR([m4])
1356 LT_PREREQ([2.2.6b])
1357 LT_INIT
1358
1359 dnl
1360 dnl Defer with_noexec until after libtool magic runs
1361 dnl
1362 if test "$enable_shared" = "no"; then
1363     with_noexec=no
1364 else
1365     eval _shrext="$shrext_cmds"
1366 fi
1367 AC_MSG_CHECKING(path to sudo_noexec.so)
1368 AC_ARG_WITH(noexec, [AS_HELP_STRING([--with-noexec[=PATH]], [fully qualified pathname of sudo_noexec.so])],
1369 [case $with_noexec in
1370     yes)        with_noexec="$libexecdir/sudo_noexec$_shrext"
1371                 ;;
1372     no)         ;;
1373     *)          ;;
1374 esac], [with_noexec="$libexecdir/sudo_noexec$_shrext"])
1375 AC_MSG_RESULT($with_noexec)
1376 NOEXECFILE="sudo_noexec$_shrext"
1377 NOEXECDIR="`echo $with_noexec|sed 's:^\(.*\)/[[^/]]*:\1:'`"
1378
1379 dnl
1380 dnl It is now safe to modify CFLAGS and CPPFLAGS
1381 dnl
1382 if test X"$with_devel" = X"yes" -a -n "$GCC"; then
1383     CFLAGS="${CFLAGS} -Wall"
1384 fi
1385
1386 dnl
1387 dnl Find programs we use
1388 dnl
1389 AC_CHECK_PROG(UNAMEPROG, [uname], [uname])
1390 AC_CHECK_PROG(TRPROG, [tr], [tr])
1391 AC_CHECK_PROGS(NROFFPROG, [nroff mandoc])
1392 if test -z "$NROFFPROG"; then
1393     MANTYPE="cat"
1394     mansrcdir='$(srcdir)'
1395 fi
1396
1397 dnl
1398 dnl What kind of beastie are we being run on?
1399 dnl Barf if config.cache was generated on another host.
1400 dnl
1401 if test -n "$sudo_cv_prev_host"; then
1402     if test "$sudo_cv_prev_host" != "$host"; then
1403         AC_MSG_ERROR([config.cache was created on a different host; remove it and re-run configure.])
1404     else
1405         AC_MSG_CHECKING(previous host type)
1406         AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1407         AC_MSG_RESULT([$sudo_cv_prev_host])
1408     fi
1409 else
1410     # this will produce no output since there is no cached value
1411     AC_CACHE_VAL(sudo_cv_prev_host, sudo_cv_prev_host="$host")
1412 fi
1413
1414 dnl
1415 dnl We want to be able to differentiate between different rev's
1416 dnl
1417 if test -n "$host_os"; then
1418     OS=`echo $host_os | sed 's/[[0-9]].*//'`
1419     OSREV=`echo $host_os | sed 's/^[[^0-9\.]]*\([[0-9\.]]*\).*$/\1/'`
1420     OSMAJOR=`echo $OSREV | sed 's/\..*$//'`
1421 else
1422     OS="unknown"
1423     OSREV=0
1424     OSMAJOR=0
1425 fi
1426
1427 case "$host" in
1428     *-*-sunos4*)
1429                 # getcwd(3) opens a pipe to getpwd(1)!?!
1430                 BROKEN_GETCWD=1
1431
1432                 # system headers lack prototypes but gcc helps...
1433                 if test -n "$GCC"; then
1434                     OSDEFS="${OSDEFS} -D__USE_FIXED_PROTOTYPES__"
1435                 fi
1436
1437                 shadow_funcs="getpwanam issecure"
1438                 ;;
1439     *-*-solaris2*)
1440                 # To get the crypt(3) prototype (so we pass -Wall)
1441                 OSDEFS="${OSDEFS} -D__EXTENSIONS__"
1442                 # AFS support needs -lucb
1443                 if test "$with_AFS" = "yes"; then
1444                     AFS_LIBS="-lc -lucb"
1445                 fi
1446                 : ${mansectsu='1m'}
1447                 : ${mansectform='4'}
1448                 : ${with_rpath='yes'}
1449                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1450                 ;;
1451     *-*-aix*)
1452                 # To get all prototypes (so we pass -Wall)
1453                 OSDEFS="${OSDEFS} -D_ALL_SOURCE -D_LINUX_SOURCE_COMPAT"
1454                 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-bI:\$(srcdir)/aixcrypt.exp"
1455                 if test X"$with_blibpath" != X"no"; then
1456                     AC_MSG_CHECKING([if linker accepts -Wl,-blibpath])
1457                     O_LDFLAGS="$LDFLAGS"
1458                     LDFLAGS="$O_LDFLAGS -Wl,-blibpath:/usr/lib:/lib"
1459                     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])], [
1460                         if test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
1461                             blibpath="$with_blibpath"
1462                         elif test -n "$GCC"; then
1463                             blibpath="/usr/lib:/lib:/usr/local/lib"
1464                         else
1465                             blibpath="/usr/lib:/lib"
1466                         fi
1467                         AC_MSG_RESULT(yes)
1468                     ], [AC_MSG_RESULT(no)])
1469                 fi
1470                 LDFLAGS="$O_LDFLAGS"
1471
1472                 # Use authenticate(3) as the default authentication method
1473                 if test X"$with_aixauth" = X""; then
1474                     AC_CHECK_FUNCS(authenticate, [AUTH_EXCL_DEF="AIX_AUTH"])
1475                 fi
1476
1477                 # AIX analog of nsswitch.conf, enabled by default
1478                 AC_ARG_WITH(netsvc, [AS_HELP_STRING([--with-netsvc[[=PATH]]], [path to netsvc.conf])],
1479                 [case $with_netsvc in
1480                     no)         ;;
1481                     yes)        with_netsvc="/etc/netsvc.conf"
1482                                 ;;
1483                     *)          ;;
1484                 esac])
1485                 if test -z "$with_nsswitch" -a -z "$with_netsvc"; then
1486                     with_netsvc="/etc/netsvc.conf"
1487                 fi
1488
1489                 # AIX-specific functions
1490                 AC_CHECK_FUNCS(getuserattr setauthdb)
1491                 COMMON_OBJS="$COMMON_OBJS aix.o"
1492                 ;;
1493     *-*-hiuxmpp*)
1494                 : ${mansectsu='1m'}
1495                 : ${mansectform='4'}
1496                 ;;
1497     *-*-hpux*)
1498                 # AFS support needs -lBSD
1499                 if test "$with_AFS" = "yes"; then
1500                     AFS_LIBS="-lc -lBSD"
1501                 fi
1502                 : ${mansectsu='1m'}
1503                 : ${mansectform='4'}
1504
1505                 if test -z "$GCC"; then
1506                     # HP-UX bundled compiler can't generate shared objects
1507                     if test "x$ac_cv_prog_cc_c89" = "xno"; then
1508                         with_noexec=no
1509                     fi
1510
1511                     # Use the +DAportable flag on hppa if it is supported
1512                     case "$host_cpu" in
1513                     hppa*)
1514                         _CFLAGS="$CFLAGS"
1515                         CFLAGS="$CFLAGS +DAportable"
1516                         AC_CACHE_CHECK([whether $CC understands +DAportable],
1517                             [sudo_cv_var_daportable],
1518                             [AC_LINK_IFELSE(
1519                                 [AC_LANG_PROGRAM([[]], [[]])],
1520                                     [sudo_cv_var_daportable=yes],
1521                                     [sudo_cv_var_daportable=no]
1522                                 )
1523                             ]
1524                         )
1525                         if test X"$sudo_cv_var_daportable" != X"yes"; then
1526                             CFLAGS="$_CFLAGS"
1527                         fi
1528                         ;;
1529                     esac
1530                 fi
1531
1532                 case "$host" in
1533                         *-*-hpux[1-8].*)
1534                             AC_DEFINE(BROKEN_SYSLOG)
1535
1536                             # Not sure if setuid binaries are safe in < 9.x
1537                             if test -n "$GCC"; then
1538                                 SUDO_LDFLAGS="${SUDO_LDFLAGS} -static"
1539                             else
1540                                 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-a,archive"
1541                             fi
1542                         ;;
1543                         *-*-hpux9.*)
1544                             AC_DEFINE(BROKEN_SYSLOG)
1545
1546                             shadow_funcs="getspwuid"
1547
1548                             # DCE support (requires ANSI C compiler)
1549                             if test "$with_DCE" = "yes"; then
1550                                 # order of libs in 9.X is important. -lc_r must be last
1551                                 SUDO_LIBS="${SUDO_LIBS} -ldce -lM -lc_r"
1552                                 LIBS="${LIBS} -ldce -lM -lc_r"
1553                                 CPPFLAGS="${CPPFLAGS} -D_REENTRANT -I/usr/include/reentrant"
1554                             fi
1555                         ;;
1556                         *-*-hpux10.*)
1557                             shadow_funcs="getprpwnam iscomsec"
1558                             shadow_libs="-lsec"
1559                             # HP-UX 10.20 libc has an incompatible getline
1560                             ac_cv_func_getline="no"
1561                         ;;
1562                         *)
1563                             shadow_funcs="getspnam iscomsec"
1564                             shadow_libs="-lsec"
1565                             test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1566                         ;;
1567                 esac
1568                 ;;
1569     *-dec-osf*)
1570                 # ignore envariables wrt dynamic lib path
1571                 SUDO_LDFLAGS="${SUDO_LDFLAGS} -Wl,-no_library_replacement"
1572
1573                 : ${CHECKSIA='true'}
1574                 AC_MSG_CHECKING(whether to disable sia support on Digital UNIX)
1575                 AC_ARG_ENABLE(sia,
1576                 [AS_HELP_STRING([--disable-sia], [Disable SIA on Digital UNIX])],
1577                 [ case "$enableval" in
1578                     yes)        AC_MSG_RESULT(no)
1579                                 CHECKSIA=true
1580                                 ;;
1581                     no)         AC_MSG_RESULT(yes)
1582                                 CHECKSIA=false
1583                                 ;;
1584                     *)          AC_MSG_RESULT(no)
1585                                 AC_MSG_WARN([Ignoring unknown argument to --enable-sia: $enableval])
1586                                 ;;
1587                   esac
1588                 ], AC_MSG_RESULT(no))
1589
1590                 shadow_funcs="getprpwnam dispcrypt"
1591                 # OSF/1 4.x and higher need -ldb too
1592                 if test $OSMAJOR -lt 4; then
1593                     shadow_libs="-lsecurity -laud -lm"
1594                 else
1595                     shadow_libs="-lsecurity -ldb -laud -lm"
1596                 fi
1597
1598                 # use SIA by default, if we have it
1599                 test "$CHECKSIA" = "true" && AUTH_EXCL_DEF="SIA"
1600
1601                 #
1602                 # Some versions of Digital Unix ship with a broken
1603                 # copy of prot.h, which we need for shadow passwords.
1604                 # XXX - make should remove this as part of distclean
1605                 #
1606                 AC_MSG_CHECKING([for broken prot.h])
1607                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1608 #include <sys/types.h>
1609 #include <sys/security.h>
1610 #include <prot.h>
1611                 ]], [[exit(0);]])], [AC_MSG_RESULT(no)], [AC_MSG_RESULT([yes, fixing locally])
1612                 sed 's:<acl.h>:<sys/acl.h>:g' < /usr/include/prot.h > prot.h
1613                 ])
1614                 : ${mansectsu='8'}
1615                 : ${mansectform='4'}
1616                 ;;
1617     *-*-irix*)
1618                 OSDEFS="${OSDEFS} -D_BSD_TYPES"
1619                 if test -z "$NROFFPROG"; then
1620                     MAN_POSTINSTALL='   /bin/rm -f $(mandirsu)/sudo.$(mansectsu).z $(mandirsu)/visudo.$(mansectsu).z $(mandirform)/sudoers.$(mansectform).z ; /usr/bin/pack $(mandirsu)/sudo.$(mansectsu) $(mandirsu)/visudo.$(mansectsu) $(mandirform)/sudoers.$(mansectform)'
1621                     if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1622                         if test -d /usr/share/catman/local; then
1623                             mandir="/usr/share/catman/local"
1624                         else
1625                             mandir="/usr/catman/local"
1626                         fi
1627                     fi
1628                 else
1629                     if test "$prefix" = "/usr/local" -a "$mandir" = '${datarootdir}/man'; then
1630                         if test -d "/usr/share/man/local"; then
1631                             mandir="/usr/share/man/local"
1632                         else
1633                             mandir="/usr/man/local"
1634                         fi
1635                     fi
1636                 fi
1637                 # IRIX <= 4 needs -lsun
1638                 if test "$OSMAJOR" -le 4; then
1639                     AC_CHECK_LIB(sun, getpwnam, [LIBS="${LIBS} -lsun"])
1640                 fi
1641                 : ${mansectsu='1m'}
1642                 : ${mansectform='4'}
1643                 ;;
1644     *-*-linux*|*-*-k*bsd*-gnu)
1645                 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1646                 # Some Linux versions need to link with -lshadow
1647                 shadow_funcs="getspnam"
1648                 shadow_libs_optional="-lshadow"
1649                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1650                 ;;
1651     *-convex-bsd*)
1652                 OSDEFS="${OSDEFS} -D_CONVEX_SOURCE"
1653                 if test -z "$GCC"; then
1654                     CFLAGS="${CFLAGS} -D__STDC__"
1655                 fi
1656
1657                 shadow_defs="-D_AUDIT -D_ACL -DSecureWare"
1658                 shadow_funcs="getprpwnam"
1659                 shadow_libs="-lprot"
1660                 ;;
1661     *-*-ultrix*)
1662                 OS="ultrix"
1663                 shadow_funcs="getauthuid"
1664                 shadow_libs="-lauth"
1665                 ;;
1666     *-*-riscos*)
1667                 LIBS="${LIBS} -lsun -lbsd"
1668                 CPPFLAGS="${CPPFLAGS} -I/usr/include -I/usr/include/bsd"
1669                 OSDEFS="${OSDEFS} -D_MIPS"
1670                 : ${mansectsu='1m'}
1671                 : ${mansectform='4'}
1672                 ;;
1673     *-*-isc*)
1674                 OSDEFS="${OSDEFS} -D_ISC"
1675                 LIB_CRYPT=1
1676                 SUDO_LIBS="${SUDO_LIBS} -lcrypt"
1677                 LIBS="${LIBS} -lcrypt"
1678
1679                 shadow_funcs="getspnam"
1680                 shadow_libs="-lsec"
1681
1682                 : ${mansectsu='1m'}
1683                 : ${mansectform='4'}
1684                 ;;
1685     *-*-sco*|*-sco-*)
1686                 shadow_funcs="getprpwnam"
1687                 shadow_libs="-lprot -lx"
1688                 : ${mansectsu='1m'}
1689                 : ${mansectform='4'}
1690                 ;;
1691     m88k-motorola-sysv*)
1692                 # motorolla's cc (a variant of gcc) does -O but not -O2
1693                 CFLAGS=`echo $CFLAGS | sed 's/-O2/-O/g'`
1694                 : ${mansectsu='1m'}
1695                 : ${mansectform='4'}
1696                 ;;
1697     *-sequent-sysv*)
1698                 shadow_funcs="getspnam"
1699                 shadow_libs="-lsec"
1700                 : ${mansectsu='1m'}
1701                 : ${mansectform='4'}
1702                 : ${with_rpath='yes'}
1703                 ;;
1704     *-ncr-sysv4*|*-ncr-sysvr4*)
1705                 AC_CHECK_LIB(c89, strcasecmp, AC_DEFINE(HAVE_STRCASECMP) [LIBS="${LIBS} -lc89"; ac_cv_func_strcasecmp=yes])
1706                 : ${mansectsu='1m'}
1707                 : ${mansectform='4'}
1708                 : ${with_rpath='yes'}
1709                 ;;
1710     *-ccur-sysv4*|*-ccur-sysvr4*)
1711                 LIBS="${LIBS} -lgen"
1712                 SUDO_LIBS="${SUDO_LIBS} -lgen"
1713                 : ${mansectsu='1m'}
1714                 : ${mansectform='4'}
1715                 : ${with_rpath='yes'}
1716                 ;;
1717     *-*-bsdi*)
1718                 SKIP_SETREUID=yes
1719                 # Use shlicc for BSD/OS [23].x unless asked to do otherwise
1720                 if test "${with_CC+set}" != set -a "$ac_cv_prog_CC" = gcc; then
1721                     case "$OSMAJOR" in
1722                         2|3)    AC_MSG_NOTICE([using shlicc as CC])
1723                                 ac_cv_prog_CC=shlicc
1724                                 CC="$ac_cv_prog_CC"
1725                                 ;;
1726                     esac
1727                 fi
1728                 # Check for newer BSD auth API (just check for >= 3.0?)
1729                 if test -z "$with_bsdauth"; then
1730                     AC_CHECK_FUNCS(auth_challenge, [AUTH_EXCL_DEF="BSD_AUTH"])
1731                 fi
1732                 ;;
1733     *-*-freebsd*)
1734                 # FreeBSD has a real setreuid(2) starting with 2.1 and
1735                 # backported to 2.0.5.  We just take 2.1 and above...
1736                 case "$OSREV" in
1737                 0.*|1.*|2.0*)
1738                     SKIP_SETREUID=yes
1739                     ;;
1740                 esac
1741                 if test "${with_skey-'no'}" = "yes"; then
1742                      SUDO_LIBS="${SUDO_LIBS} -lmd"
1743                 fi
1744                 CHECKSHADOW="false"
1745                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1746                 : ${with_logincap='maybe'}
1747                 ;;
1748     *-*-*openbsd*)
1749                 # OpenBSD has a real setreuid(2) starting with 3.3 but
1750                 # we will use setreuid(2) instead.
1751                 SKIP_SETREUID=yes
1752                 CHECKSHADOW="false"
1753                 # OpenBSD >= 3.0 supports BSD auth
1754                 if test -z "$with_bsdauth"; then
1755                     case "$OSREV" in
1756                     [0-2].*)
1757                         ;;
1758                     *)
1759                         AUTH_EXCL_DEF="BSD_AUTH"
1760                         ;;
1761                     esac
1762                 fi
1763                 : ${with_logincap='maybe'}
1764                 ;;
1765     *-*-*netbsd*)
1766                 # NetBSD has a real setreuid(2) starting with 1.3.2
1767                 case "$OSREV" in
1768                 0.9*|1.[012]*|1.3|1.3.1)
1769                     SKIP_SETREUID=yes
1770                     ;;
1771                 esac
1772                 CHECKSHADOW="false"
1773                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1774                 : ${with_logincap='maybe'}
1775                 ;;
1776     *-*-dragonfly*)
1777                 if test "${with_skey-'no'}" = "yes"; then
1778                      SUDO_LIBS="${SUDO_LIBS} -lmd"
1779                 fi
1780                 CHECKSHADOW="false"
1781                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1782                 : ${with_logincap='yes'}
1783                 ;;
1784     *-*-*bsd*)
1785                 CHECKSHADOW="false"
1786                 ;;
1787     *-*-darwin*)
1788                 # Darwin has a real setreuid(2) starting with 9.0
1789                 if test $OSMAJOR -lt 9; then
1790                     SKIP_SETREUID=yes
1791                 fi
1792                 CHECKSHADOW="false"
1793                 test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
1794                 : ${with_logincap='yes'}
1795                 ;;
1796     *-*-nextstep*)
1797                 # lockf() on is broken on the NeXT -- use flock instead
1798                 ac_cv_func_lockf=no
1799                 ac_cv_func_flock=yes
1800                 ;;
1801     *-*-*sysv4*)
1802                 : ${mansectsu='1m'}
1803                 : ${mansectform='4'}
1804                 : ${with_rpath='yes'}
1805                 ;;
1806     *-*-sysv*)
1807                 : ${mansectsu='1m'}
1808                 : ${mansectform='4'}
1809                 ;;
1810     *-gnu*)
1811                 OSDEFS="${OSDEFS} -D_GNU_SOURCE"
1812                 ;;
1813 esac
1814
1815 dnl
1816 dnl Check for mixing mutually exclusive and regular auth methods
1817 dnl
1818 AUTH_REG=${AUTH_REG# }
1819 AUTH_EXCL=${AUTH_EXCL# }
1820 if test -n "$AUTH_EXCL"; then
1821     set -- $AUTH_EXCL
1822     if test $# != 1; then
1823         AC_MSG_ERROR([More than one mutually exclusive authentication method specified: $AUTH_EXCL])
1824     fi
1825     if test -n "$AUTH_REG"; then
1826         AC_MSG_ERROR([Cannot mix mutually exclusive ($AUTH_EXCL) and regular ($AUTH_REG) authentication methods])
1827     fi
1828 fi
1829 dnl
1830 dnl Only one of S/Key and OPIE may be specified
1831 dnl
1832 if test X"${with_skey}${with_opie}" = X"yesyes"; then
1833     AC_MSG_ERROR(["cannot use both S/Key and OPIE"])
1834 fi
1835
1836 dnl
1837 dnl Use BSD-style man sections by default
1838 dnl
1839 : ${mansectsu='8'}
1840 : ${mansectform='5'}
1841
1842 dnl
1843 dnl Add in any libpaths or libraries specified via configure
1844 dnl
1845 if test -n "$with_libpath"; then
1846     for i in ${with_libpath}; do
1847         SUDO_APPEND_LIBPATH(LDFLAGS, [$i])
1848     done
1849 fi
1850 if test -n "$with_libraries"; then
1851     for i in ${with_libraries}; do
1852         case $i in
1853             -l*)        ;;
1854             *.a)        ;;
1855             *.o)        ;;
1856             *)  i="-l${i}";;
1857         esac
1858         LIBS="${LIBS} ${i}"
1859     done
1860 fi
1861
1862 dnl
1863 dnl C compiler checks (to be done after os checks)
1864 dnl
1865 AC_PROG_GCC_TRADITIONAL
1866 AC_C_CONST
1867 AC_C_VOLATILE
1868 dnl
1869 dnl Program checks
1870 dnl
1871 AC_PROG_YACC
1872 AC_PATH_PROG([FLEX], [flex], [flex])
1873 SUDO_PROG_MV
1874 SUDO_PROG_BSHELL
1875 if test -z "$with_sendmail"; then
1876     SUDO_PROG_SENDMAIL
1877 fi
1878 if test -z "$with_editor"; then
1879     SUDO_PROG_VI
1880 fi
1881 dnl
1882 dnl Check for authpriv support in syslog
1883 dnl
1884 AC_MSG_CHECKING(which syslog facility sudo should log with)
1885 if test X"$with_logfac" = X""; then
1886     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <syslog.h>]], [[int i = LOG_AUTHPRIV; (void)i;]])], [logfac=authpriv])
1887 fi
1888 AC_DEFINE_UNQUOTED(LOGFAC, "$logfac", [The syslog facility sudo will use.])
1889 AC_MSG_RESULT($logfac)
1890 dnl
1891 dnl Header file checks
1892 dnl
1893 AC_HEADER_STDC
1894 AC_HEADER_DIRENT
1895 AC_HEADER_TIME
1896 AC_CHECK_HEADERS(malloc.h paths.h utime.h netgroup.h sys/sockio.h sys/bsdtypes.h sys/select.h sys/stropts.h sys/sysmacros.h)
1897 dnl
1898 dnl Check for large file support.  HP-UX 11.23 has a broken sys/type.h
1899 dnl when large files support is enabled so work around it.
1900 dnl
1901 AC_SYS_LARGEFILE
1902 case "$host" in
1903     *-*-hpux11.*)
1904         AC_CACHE_CHECK([whether sys/types.h needs _XOPEN_SOURCE_EXTENDED], [sudo_cv_xopen_source_extended],
1905         [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT
1906         #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=no], [
1907             AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#define _XOPEN_SOURCE_EXTENDED
1908             AC_INCLUDES_DEFAULT
1909             #include <sys/socket.h>], [])], [sudo_cv_xopen_source_extended=yes],
1910             [sudo_cv_xopen_source_extended=error])
1911         ])])
1912         if test "$sudo_cv_xopen_source_extended" = "yes"; then
1913             OSDEFS="${OSDEFS} -D_XOPEN_SOURCE_EXTENDED"
1914             SUDO_DEFINE(_XOPEN_SOURCE_EXTENDED)
1915         fi
1916         ;;
1917 esac
1918 AC_SYS_POSIX_TERMIOS
1919 if test "$ac_cv_sys_posix_termios" = "yes"; then
1920     AC_DEFINE(HAVE_TERMIOS_H)
1921 else
1922     AC_CHECK_HEADERS(termio.h)
1923 fi
1924 SUDO_MAILDIR
1925 if test ${with_logincap-'no'} != "no"; then
1926     AC_CHECK_HEADERS(login_cap.h, [LOGINCAP_USAGE='[[-c class|-]] '; LCMAN=1
1927         case "$OS" in
1928             freebsd|netbsd)     SUDO_LIBS="${SUDO_LIBS} -lutil"
1929             ;;
1930         esac
1931     ])
1932 fi
1933 if test ${with_project-'no'} != "no"; then
1934     AC_CHECK_HEADER(project.h, AC_DEFINE(HAVE_PROJECT_H)
1935         [SUDO_LIBS="${SUDO_LIBS} -lproject"], -)
1936 fi
1937 dnl
1938 dnl typedef checks
1939 dnl
1940 AC_TYPE_MODE_T
1941 AC_TYPE_UID_T
1942 AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
1943 AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
1944 #include <signal.h>])
1945 AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T)], [], [#include <sys/types.h>
1946 #include <signal.h>])
1947 AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC)], [], [#include <sys/types.h>
1948 #if TIME_WITH_SYS_TIME
1949 # include <sys/time.h>
1950 #endif
1951 #include <time.h>])
1952 AC_CHECK_TYPES([struct in6_addr], [AC_DEFINE(HAVE_IN6_ADDR)], [], [#include <sys/types.h>
1953 #include <netinet/in.h>])
1954 AC_TYPE_LONG_LONG_INT
1955 AC_CHECK_SIZEOF([long int])
1956 SUDO_TYPE_SIZE_T
1957 SUDO_TYPE_SSIZE_T
1958 SUDO_TYPE_DEV_T
1959 SUDO_TYPE_INO_T
1960 SUDO_UID_T_LEN
1961 SUDO_SOCK_SA_LEN
1962 dnl
1963 dnl only set RETSIGTYPE if it is not set already
1964 dnl
1965 case "$DEFS" in
1966     *"RETSIGTYPE"*)     ;;
1967     *)                  AC_TYPE_SIGNAL;;
1968 esac
1969 dnl
1970 dnl Function checks
1971 dnl
1972 AC_FUNC_GETGROUPS
1973 AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \
1974                strftime setrlimit initgroups getgroups fstat gettimeofday \
1975                regcomp setlocale nl_langinfo getaddrinfo setenv \
1976                mbr_check_membership setrlimit64)
1977 AC_CHECK_FUNCS(getline, [], [
1978     AC_LIBOBJ(getline)
1979     AC_CHECK_FUNCS(fgetln)
1980 ])
1981 AC_CHECK_FUNCS(setsid, [], [
1982     AC_LIBOBJ(setsid)
1983     AC_FUNC_SETPGRP
1984 ])
1985
1986 AC_CHECK_FUNCS(sysctl getutxid getutid, [break])
1987
1988 AC_CHECK_FUNCS(openpty, [AC_CHECK_HEADERS(util.h pty.h, [break])], [
1989     AC_CHECK_LIB(util, openpty, [
1990         AC_CHECK_HEADERS(util.h pty.h, [break])
1991         SUDO_LIBS="${SUDO_LIBS} -lutil"
1992         AC_DEFINE(HAVE_OPENPTY)
1993     ], [
1994         AC_CHECK_FUNCS(_getpty, [], [
1995             AC_CHECK_FUNCS(grantpt, [
1996                 AC_CHECK_FUNCS(posix_openpt)
1997             ], [
1998                 AC_CHECK_FUNCS(revoke)
1999             ])
2000         ])
2001     ])
2002 ])
2003 AC_CHECK_FUNCS(unsetenv, SUDO_FUNC_UNSETENV_VOID)
2004 SUDO_FUNC_PUTENV_CONST
2005 if test -z "$SKIP_SETRESUID"; then
2006     AC_CHECK_FUNCS(setresuid, [SKIP_SETREUID=yes])
2007 fi
2008 if test -z "$SKIP_SETREUID"; then
2009     AC_CHECK_FUNCS(setreuid, [SKIP_SETEUID=yes])
2010 fi
2011 if test -z "$SKIP_SETEUID"; then
2012     AC_CHECK_FUNCS(seteuid)
2013 fi
2014 if test X"$with_interfaces" != X"no"; then
2015     AC_CHECK_FUNCS(getifaddrs, [AC_CHECK_FUNCS(freeifaddrs)])
2016 fi
2017 if test -z "$BROKEN_GETCWD"; then
2018     AC_REPLACE_FUNCS(getcwd)
2019 fi
2020 AC_CHECK_FUNCS(glob, [AC_MSG_CHECKING(for GLOB_BRACE and GLOB_TILDE in glob.h)
2021 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <glob.h>]], [[int i = GLOB_BRACE | GLOB_TILDE; (void)i;]])], [AC_DEFINE(HAVE_EXTENDED_GLOB)
2022     AC_MSG_RESULT(yes)], [AC_LIBOBJ(glob)
2023     AC_MSG_RESULT(no)])], [AC_LIBOBJ(glob)])
2024 AC_CHECK_FUNCS(lockf flock, [break])
2025 AC_CHECK_FUNCS(waitpid wait3, [break])
2026 AC_CHECK_FUNCS(innetgr _innetgr, [AC_CHECK_FUNCS(getdomainname) [break]])
2027 AC_CHECK_FUNCS(utimes, [AC_CHECK_FUNCS(futimes futimesat, [break])], [AC_CHECK_FUNCS(futime) AC_LIBOBJ(utimes)])
2028 AC_CHECK_FUNCS(killpg, [], [AC_LIBOBJ(killpg)])
2029 SUDO_FUNC_FNMATCH([AC_DEFINE(HAVE_FNMATCH)], [AC_LIBOBJ(fnmatch)])
2030 SUDO_FUNC_ISBLANK
2031 AC_REPLACE_FUNCS(memrchr strerror strcasecmp sigaction strlcpy strlcat)
2032 AC_CHECK_FUNCS(nanosleep, [], [
2033     # On Solaris, nanosleep is in librt
2034     AC_CHECK_LIB(rt, nanosleep, [LIBS="${LIBS} -lrt"], [AC_LIBOBJ(nanosleep)])
2035 ])
2036 AC_CHECK_FUNCS(closefrom, [], [AC_LIBOBJ(closefrom)
2037     AC_CHECK_DECL(F_CLOSEM, AC_DEFINE(HAVE_FCNTL_CLOSEM), [],
2038         [ #include <limits.h>
2039           #include <fcntl.h> ])
2040 ])
2041 AC_CHECK_FUNCS(mkstemps, [], [SUDO_OBJS="${SUDO_OBJS} mkstemps.o"
2042     AC_CHECK_FUNCS(random lrand48, [break])
2043 ])
2044 AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf, , [NEED_SNPRINTF=1])
2045 if test X"$ac_cv_type_struct_timespec" != X"no"; then
2046     AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)]
2047         [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
2048         [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))])
2049 fi
2050 dnl
2051 dnl Check for the dirfd function/macro.  If not found, look for dd_fd in DIR.
2052 dnl
2053 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2054 #include <$ac_header_dirent>]], [[DIR *d; (void)dirfd(d);]])], [AC_DEFINE(HAVE_DIRFD)], [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2055 #include <$ac_header_dirent>]], [[DIR d; memset(&d, 0, sizeof(d)); return(d.dd_fd);]])], [AC_DEFINE(HAVE_DD_FD)], [])])
2056 dnl
2057 dnl If NEED_SNPRINTF is set, add snprintf.c to LIBOBJS
2058 dnl (it contains snprintf, vsnprintf, asprintf, and vasprintf)
2059 dnl
2060 if test -n "$NEED_SNPRINTF"; then
2061     AC_LIBOBJ(snprintf)
2062 fi
2063 dnl
2064 dnl If socket(2) not in libc, check -lsocket and -linet
2065 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2066 dnl In this case we look for main(), not socket() to avoid using a cached value
2067 dnl
2068 AC_CHECK_FUNC(socket, , [AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(inet, socket, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find socket() trying -lsocket -lnsl)
2069 AC_CHECK_LIB(socket, socket, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl)))])
2070 dnl
2071 dnl If inet_addr(3) not in libc, check -lnsl and -linet
2072 dnl May need to link with *both* -lnsl and -lsocket due to unresolved symbols
2073 dnl
2074 AC_CHECK_FUNC(inet_addr, , [AC_CHECK_FUNC(__inet_addr, , AC_CHECK_LIB(nsl, inet_addr, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, inet_addr, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"], AC_MSG_WARN(unable to find inet_addr() trying -lsocket -lnsl)
2075 AC_CHECK_LIB(socket, inet_addr, [NET_LIBS="${NET_LIBS} -lsocket -lnsl"; LIBS="${LIBS} -lsocket -lnsl"], , -lnsl))))])
2076 dnl
2077 dnl If syslog(3) not in libc, check -lsocket, -lnsl and -linet
2078 dnl
2079 AC_CHECK_FUNC(syslog, , [AC_CHECK_LIB(socket, syslog, [NET_LIBS="${NET_LIBS} -lsocket"; LIBS="${LIBS} -lsocket"], AC_CHECK_LIB(nsl, syslog, [NET_LIBS="${NET_LIBS} -lnsl"; LIBS="${LIBS} -lnsl"], AC_CHECK_LIB(inet, syslog, [NET_LIBS="${NET_LIBS} -linet"; LIBS="${LIBS} -linet"])))])
2080 dnl
2081 dnl Check for getprogname() or __progname
2082 dnl
2083 AC_CHECK_FUNCS(getprogname, , [
2084     AC_MSG_CHECKING([for __progname])
2085     AC_CACHE_VAL(sudo_cv___progname, [
2086     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[extern char *__progname; (void)puts(__progname);]])], [sudo_cv___progname=yes], [sudo_cv___progname=no])])
2087     if test "$sudo_cv___progname" = "yes"; then
2088         AC_DEFINE(HAVE___PROGNAME)
2089     else
2090         AC_LIBOBJ(getprogname)
2091     fi
2092     AC_MSG_RESULT($sudo_cv___progname)
2093 ])
2094
2095 dnl
2096 dnl Check for strsignal() or sys_siglist
2097 dnl
2098 AC_CHECK_FUNCS(strsignal, [], [
2099     AC_LIBOBJ(strsignal)
2100     HAVE_SIGLIST="false"
2101     AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], [
2102         HAVE_SIGLIST="true"
2103         break
2104     ], [ ], [
2105 AC_INCLUDES_DEFAULT
2106 #include <signal.h>
2107     ])
2108     if test "$HAVE_SIGLIST" != "true"; then
2109         AC_LIBOBJ(siglist)
2110     fi
2111 ])
2112
2113 dnl
2114 dnl nsswitch.conf and its equivalents
2115 dnl
2116 if test ${with_netsvc-"no"} != "no"; then
2117     SUDO_DEFINE_UNQUOTED(_PATH_NETSVC_CONF, "${with_netsvc-/etc/netsvc.conf}")
2118     netsvc_conf=${with_netsvc-/etc/netsvc.conf}
2119 elif test ${with_nsswitch-"yes"} != "no"; then
2120     SUDO_DEFINE_UNQUOTED(_PATH_NSSWITCH_CONF, "${with_nsswitch-/etc/nsswitch.conf}")
2121     nsswitch_conf=${with_nsswitch-/etc/nsswitch.conf}
2122 fi
2123
2124 dnl
2125 dnl Mutually exclusive auth checks come first, followed by
2126 dnl non-exclusive ones.  Note: passwd must be last of all!
2127 dnl
2128
2129 dnl
2130 dnl Convert default authentication methods to with_* if
2131 dnl no explicit authentication scheme was specified.
2132 dnl
2133 if test -z "${AUTH_EXCL}${AUTH_REG}" -a -n "$AUTH_EXCL_DEF"; then
2134     for auth in $AUTH_EXCL_DEF; do
2135         case $auth in
2136             AIX_AUTH)   with_aixauth=maybe;;
2137             BSD_AUTH)   with_bsdauth=maybe;;
2138             PAM)        with_pam=maybe;;
2139             SIA)        CHECKSIA=true;;
2140         esac
2141     done
2142 fi
2143
2144 dnl
2145 dnl PAM support.  Systems that use PAM by default set with_pam=default
2146 dnl and we do the actual tests here.
2147 dnl
2148 if test ${with_pam-"no"} != "no"; then
2149     dnl
2150     dnl Some platforms need libdl for dlopen
2151     dnl
2152     case "$LIBS" in
2153         *-ldl*) SUDO_LIBS="${SUDO_LIBS} -lpam"
2154                 ;;
2155         *)      AC_CHECK_LIB([dl], [main], [SUDO_LIBS="${SUDO_LIBS} -lpam -ldl"], [SUDO_LIBS="${SUDO_LIBS} -lpam"])
2156                 ac_cv_lib_dl=ac_cv_lib_dl_main
2157                 ;;
2158     esac
2159
2160     dnl
2161     dnl Some PAM implementations (MacOS X for example) put the PAM headers
2162     dnl in /usr/include/pam instead of /usr/include/security...
2163     dnl
2164     AC_CHECK_HEADERS([security/pam_appl.h] [pam/pam_appl.h], [with_pam=yes; break])
2165     if test "$with_pam" = "yes"; then
2166         AC_DEFINE(HAVE_PAM)
2167         AUTH_OBJS="$AUTH_OBJS pam.o";
2168         AUTH_EXCL=PAM
2169
2170         AC_ARG_WITH(pam-login, [AS_HELP_STRING([--with-pam-login], [enable specific PAM session for sudo -i])],
2171         [case $with_pam_login in
2172             yes)        AC_DEFINE([HAVE_PAM_LOGIN])
2173                         AC_MSG_CHECKING(whether to use PAM login)
2174                         AC_MSG_RESULT(yes)
2175                         ;;
2176             no)         ;;
2177             *)          AC_MSG_ERROR(["--with-pam-login does not take an argument."])
2178                         ;;
2179         esac])
2180
2181         AC_MSG_CHECKING(whether to use PAM session support)
2182         AC_ARG_ENABLE(pam_session,
2183         [AS_HELP_STRING([--disable-pam-session], [Disable PAM session support])],
2184             [ case "$enableval" in
2185                 yes)    AC_MSG_RESULT(yes)
2186                         ;;
2187                 no)             AC_MSG_RESULT(no)
2188                             AC_DEFINE([NO_PAM_SESSION], [], [PAM session support disabled])
2189                             ;;
2190                 *)              AC_MSG_RESULT(no)
2191                             AC_MSG_WARN([Ignoring unknown argument to --enable-pam-session: $enableval])
2192                             ;;
2193             esac], AC_MSG_RESULT(yes))
2194
2195         case $host in
2196             *-*-linux*|*-*-solaris*)
2197                     # dgettext() may be defined to dgettext_libintl in the
2198                     # header file, so first check that it links w/ additional
2199                     # libs, then try with -lintl
2200                     AC_LINK_IFELSE([AC_LANG_PROGRAM(
2201                     [[#include <libintl.h>]], [(void)dgettext((char *)0, (char *)0);])],
2202                     [AC_DEFINE(HAVE_DGETTEXT)],
2203                     [AC_CHECK_LIB(intl, dgettext, [LIBS="${LIBS} -lintl"]
2204                         [AC_DEFINE(HAVE_DGETTEXT)])])
2205                     ;;
2206         esac
2207     fi
2208 fi
2209
2210 dnl
2211 dnl AIX general authentication
2212 dnl If set to "maybe" only enable if no other exclusive method in use.
2213 dnl
2214 if test ${with_aixauth-'no'} != "no"; then
2215     if test X"$with_aixauth" != X"maybe" -o X"$AUTH_EXCL" = X""; then
2216         AC_MSG_NOTICE([using AIX general authentication])
2217         AC_DEFINE(HAVE_AIXAUTH)
2218         AUTH_OBJS="$AUTH_OBJS aix_auth.o";
2219         SUDO_LIBS="${SUDO_LIBS} -ls"
2220         AUTH_EXCL=AIX_AUTH
2221     fi
2222 fi
2223
2224 dnl
2225 dnl BSD authentication
2226 dnl If set to "maybe" only enable if no other exclusive method in use.
2227 dnl
2228 if test ${with_bsdauth-'no'} != "no"; then
2229     AC_CHECK_HEADER(bsd_auth.h, AC_DEFINE(HAVE_BSD_AUTH_H)
2230         [AUTH_OBJS="$AUTH_OBJS bsdauth.o"]
2231         [BSDAUTH_USAGE='[[-a auth_type]] ']
2232         [AUTH_EXCL=BSD_AUTH; BAMAN=1],
2233         [AC_MSG_ERROR([BSD authentication was specified but bsd_auth.h could not be found])])
2234 fi
2235
2236 dnl
2237 dnl SIA authentication for Tru64 Unix
2238 dnl
2239 if test ${CHECKSIA-'false'} = "true"; then
2240     AC_CHECK_FUNCS(sia_ses_init, [found=true], [found=false])
2241     if test "$found" = "true"; then
2242         AUTH_EXCL=SIA
2243         AUTH_OBJS="$AUTH_OBJS sia.o"
2244     fi
2245 fi
2246
2247 dnl
2248 dnl extra FWTK libs + includes
2249 dnl
2250 if test ${with_fwtk-'no'} != "no"; then
2251     if test "$with_fwtk" != "yes"; then
2252         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_fwtk}])
2253         CPPFLAGS="${CPPFLAGS} -I${with_fwtk}"
2254         with_fwtk=yes
2255     fi
2256     SUDO_LIBS="${SUDO_LIBS} -lauth -lfwall"
2257     AUTH_OBJS="$AUTH_OBJS fwtk.o"
2258 fi
2259
2260 dnl
2261 dnl extra SecurID lib + includes
2262 dnl
2263 if test ${with_SecurID-'no'} != "no"; then
2264     if test "$with_SecurID" != "yes"; then
2265         :
2266     elif test -d /usr/ace/examples; then
2267         with_SecurID=/usr/ace/examples
2268     else
2269         with_SecurID=/usr/ace
2270     fi
2271     CPPFLAGS="${CPPFLAGS} -I${with_SecurID}"
2272     _LDFLAGS="${LDFLAGS}"
2273     SUDO_APPEND_LIBPATH(LDFLAGS, [${with_SecurID}])
2274     #
2275     # Determine whether to use the new or old SecurID API
2276     #
2277     AC_CHECK_LIB(aceclnt, SD_Init,
2278         [
2279             AUTH_OBJS="$AUTH_OBJS securid5.o";
2280             SUDO_LIBS="${SUDO_LIBS} -laceclnt -lpthread"
2281         ]
2282         [
2283             SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_SecurID}])
2284         ], [
2285             AUTH_OBJS="$AUTH_OBJS securid.o";
2286             SUDO_LIBS="${SUDO_LIBS} ${with_SecurID}/sdiclient.a"
2287         ],
2288         [
2289             -lpthread
2290         ]
2291     )
2292     LDFLAGS="${_LDFLAGS}"
2293 fi
2294
2295 dnl
2296 dnl Non-mutually exclusive auth checks come next.
2297 dnl Note: passwd must be last of all!
2298 dnl
2299
2300 dnl
2301 dnl Convert default authentication methods to with_* if
2302 dnl no explicit authentication scheme was specified.
2303 dnl
2304 if test -z "${AUTH_EXCL}" -a -n "$AUTH_DEF"; then
2305     for auth in $AUTH_DEF; do
2306         case $auth in
2307             passwd)     : ${with_passwd='maybe'};;
2308         esac
2309     done
2310 fi
2311
2312 dnl
2313 dnl Kerberos IV
2314 dnl
2315 if test ${with_kerb4-'no'} != "no"; then
2316     AC_DEFINE(HAVE_KERB4)
2317     dnl
2318     dnl Use the specified directory, if any, else search for correct inc dir
2319     dnl
2320     O_LDFLAGS="$LDFLAGS"
2321     if test "$with_kerb4" = "yes"; then
2322         found=no
2323         O_CPPFLAGS="$CPPFLAGS"
2324         for dir in "" "kerberosIV/" "krb4/" "kerberos4/" "kerberosv4/"; do
2325             CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2326             AC_PREPROC_IFELSE([#include <krb.h>], [found=yes; break])
2327         done
2328         test X"$found" = X"no" && CPPFLAGS="$O_CPPFLAGS"
2329     else
2330         SUDO_APPEND_LIBPATH(LDFLAGS, [${with_kerb4}/lib])
2331         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_kerb4}/lib])
2332         CPPFLAGS="$CPPFLAGS -I${with_kerb4}/include"
2333         AC_CHECK_HEADER([krb.h], [found=yes], [found=no])
2334     fi
2335     if test X"$found" = X"no"; then
2336         AC_MSG_WARN([Unable to locate Kerberos IV include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS])
2337     fi
2338
2339     dnl
2340     dnl Check for -ldes vs. -ldes425
2341     dnl
2342     AC_CHECK_LIB(des, des_cbc_encrypt, [K4LIBS="-ldes"], [
2343         AC_CHECK_LIB(des425, des_cbc_encrypt, [K4LIBS="-ldes425"], [K4LIBS=""])
2344     ])
2345     dnl
2346     dnl Try to determine whether we have KTH or MIT/CNS Kerberos IV
2347     dnl
2348     AC_MSG_CHECKING(whether we are using KTH Kerberos IV)
2349     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb.h>]], [[const char *tmp = krb4_version;]])], [
2350             AC_MSG_RESULT(yes)
2351             K4LIBS="${K4LIBS} -lcom_err"
2352             AC_CHECK_LIB(roken, main, [K4LIBS="${K4LIBS} -lroken"])
2353         ], [
2354             AC_MSG_RESULT(no)
2355         ]
2356     )
2357     dnl
2358     dnl The actual Kerberos IV lib might be -lkrb or -lkrb4
2359     dnl
2360     AC_CHECK_LIB(krb, main, [K4LIBS="-lkrb $K4LIBS"], [
2361         AC_CHECK_LIB(krb4, main, [K4LIBS="-lkrb4 $K4LIBS"],
2362             [K4LIBS="-lkrb $K4LIBS"]
2363             [AC_MSG_WARN([Unable to locate Kerberos IV libraries, you will have to edit the Makefile and add -L/path/to/krb/libs to SUDO_LDFLAGS and possibly add Kerberos libs to SUDO_LIBS])]
2364         , [$K4LIBS])
2365     ], [$K4LIBS])
2366     LDFLAGS="$O_LDFLAGS"
2367     SUDO_LIBS="${SUDO_LIBS} $K4LIBS"
2368     AUTH_OBJS="$AUTH_OBJS kerb4.o"
2369 fi
2370
2371 dnl
2372 dnl Kerberos V
2373 dnl There is an easy way and a hard way...
2374 dnl
2375 if test ${with_kerb5-'no'} != "no"; then
2376     AC_CHECK_PROG(KRB5CONFIG, krb5-config, yes, "")
2377     if test -n "$KRB5CONFIG"; then
2378         AC_DEFINE(HAVE_KERB5)
2379         AUTH_OBJS="$AUTH_OBJS kerb5.o"
2380         CPPFLAGS="$CPPFLAGS `krb5-config --cflags`"
2381         SUDO_LIBS="$SUDO_LIBS `krb5-config --libs`"
2382         dnl
2383         dnl Try to determine whether we have Heimdal or MIT Kerberos
2384         dnl
2385         AC_MSG_CHECKING(whether we are using Heimdal)
2386         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2387                 AC_MSG_RESULT(yes)
2388                 AC_DEFINE(HAVE_HEIMDAL)
2389             ], [
2390                 AC_MSG_RESULT(no)
2391             ]
2392         )
2393     fi
2394 fi
2395 if test ${with_kerb5-'no'} != "no" -a -z "$KRB5CONFIG"; then
2396     AC_DEFINE(HAVE_KERB5)
2397     dnl
2398     dnl Use the specified directory, if any, else search for correct inc dir
2399     dnl
2400     if test "$with_kerb5" = "yes"; then
2401         found=no
2402         O_CPPFLAGS="$CPPFLAGS"
2403         for dir in "" "kerberosV/" "krb5/" "kerberos5/" "kerberosv5/"; do
2404             CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2405             AC_PREPROC_IFELSE([#include <krb5.h>], [found=yes; break])
2406         done
2407         if test X"$found" = X"no"; then
2408             CPPFLAGS="$O_CPPFLAGS"
2409             AC_MSG_WARN([Unable to locate Kerberos V include files, you will have to edit the Makefile and add -I/path/to/krb/includes to CPPFLAGS])
2410         fi
2411     else
2412         dnl XXX - try to include krb5.h here too
2413         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_kerb5}/lib])
2414         CPPFLAGS="$CPPFLAGS -I${with_kerb5}/include"
2415     fi
2416
2417     dnl
2418     dnl Try to determine whether we have Heimdal or MIT Kerberos
2419     dnl
2420     AC_MSG_CHECKING(whether we are using Heimdal)
2421     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <krb5.h>]], [[const char *tmp = heimdal_version;]])], [
2422             AC_MSG_RESULT(yes)
2423             AC_DEFINE(HAVE_HEIMDAL)
2424             # XXX - need to check whether -lcrypo is needed!
2425             SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lcrypto -ldes -lcom_err -lasn1"
2426             AC_CHECK_LIB(roken, main, [SUDO_LIBS="${SUDO_LIBS} -lroken"])
2427         ], [
2428             AC_MSG_RESULT(no)
2429             SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lk5crypto -lcom_err"
2430             AC_CHECK_LIB(krb5support, main, [SUDO_LIBS="${SUDO_LIBS} -lkrb5support"])
2431     ])
2432     AUTH_OBJS="$AUTH_OBJS kerb5.o"
2433     _LIBS="$LIBS"
2434     LIBS="${LIBS} ${SUDO_LIBS}"
2435     AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
2436     AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
2437         AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
2438             sudo_cv_krb5_get_init_creds_opt_free_two_args, [
2439                AC_COMPILE_IFELSE(
2440                    [AC_LANG_PROGRAM(
2441                        [[#include <krb5.h>]],
2442                        [[krb5_get_init_creds_opt_free(NULL, NULL);]]
2443                    )],
2444                     [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
2445                     [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
2446                 )
2447             ]
2448         )
2449     ])
2450     if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
2451         AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
2452     fi
2453     LIBS="$_LIBS"
2454 fi
2455
2456 dnl
2457 dnl extra AFS libs and includes
2458 dnl
2459 if test ${with_AFS-'no'} = "yes"; then
2460
2461     # looks like the "standard" place for AFS libs is /usr/afsws/lib
2462     AFSLIBDIRS="/usr/lib/afs /usr/afsws/lib /usr/afsws/lib/afs"
2463     for i in $AFSLIBDIRS; do
2464         if test -d ${i}; then
2465             SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [$i])
2466             FOUND_AFSLIBDIR=true
2467         fi
2468     done
2469     if test -z "$FOUND_AFSLIBDIR"; then
2470         AC_MSG_WARN([Unable to locate AFS libraries, you will have to edit the Makefile and add -L/path/to/afs/libs to SUDO_LDFLAGS or rerun configure with the --with-libpath options.])
2471     fi
2472
2473     # Order is important here.  Note that we build AFS_LIBS from right to left
2474     # since AFS_LIBS may be initialized with BSD compat libs that must go last
2475     AFS_LIBS="-laudit ${AFS_LIBS}"
2476     for i in $AFSLIBDIRS; do
2477         if test -f ${i}/util.a; then
2478             AFS_LIBS="${i}/util.a ${AFS_LIBS}"
2479             FOUND_UTIL_A=true
2480             break;
2481         fi
2482     done
2483     if test -z "$FOUND_UTIL_A"; then
2484         AFS_LIBS="-lutil ${AFS_LIBS}"
2485     fi
2486     AFS_LIBS="-lkauth -lprot -lubik -lauth -lrxkad -lsys -ldes -lrx -llwp -lcom_err ${AFS_LIBS}"
2487
2488     # AFS includes may live in /usr/include on some machines...
2489     for i in /usr/afsws/include; do
2490         if test -d ${i}; then
2491             CPPFLAGS="${CPPFLAGS} -I${i}"
2492             FOUND_AFSINCDIR=true
2493         fi
2494     done
2495
2496     if test -z "$FOUND_AFSLIBDIR"; then
2497         AC_MSG_WARN([Unable to locate AFS include dir, you may have to edit the Makefile and add -I/path/to/afs/includes to CPPFLAGS or rerun configure with the --with-incpath options.])
2498     fi
2499
2500     AUTH_OBJS="$AUTH_OBJS afs.o"
2501 fi
2502
2503 dnl
2504 dnl extra DCE obj + lib
2505 dnl Order of libs in HP-UX 10.x is important, -ldce must be last.
2506 dnl
2507 if test ${with_DCE-'no'} = "yes"; then
2508     DCE_OBJS="${DCE_OBJS} dce_pwent.o"
2509     SUDO_LIBS="${SUDO_LIBS} -ldce"
2510     AUTH_OBJS="$AUTH_OBJS dce.o"
2511 fi
2512
2513 dnl
2514 dnl extra S/Key lib and includes
2515 dnl
2516 if test "${with_skey-'no'}" = "yes"; then
2517     O_LDFLAGS="$LDFLAGS"
2518     if test "$with_skey" != "yes"; then
2519         CPPFLAGS="${CPPFLAGS} -I${with_skey}/include"
2520         SUDO_APPEND_LIBPATH(LDFLAGS, [${with_skey}/lib])
2521         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_skey}/lib])
2522         AC_PREPROC_IFELSE([#include <skey.h>], [found=yes], [found=no])
2523     else
2524         found=no
2525         O_CPPFLAGS="$CPPFLAGS"
2526         for dir in "" "/usr/local" "/usr/contrib"; do
2527             test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2528             AC_PREPROC_IFELSE([#include <skey.h>], [found=yes; break])
2529         done
2530         if test "$found" = "no" -o -z "$dir"; then
2531             CPPFLAGS="$O_CPPFLAGS"
2532         else
2533             SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2534             SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${dir}/lib])
2535         fi
2536     fi
2537     if test "$found" = "no"; then
2538         AC_MSG_WARN([Unable to locate skey.h, you will have to edit the Makefile and add -I/path/to/skey/includes to CPPFLAGS])
2539     fi
2540     AC_CHECK_LIB(skey, main, [found=yes], [AC_MSG_WARN([Unable to locate libskey.a, you will have to edit the Makefile and add -L/path/to/skey/lib to SUDO_LDFLAGS])])
2541     AC_CHECK_LIB(skey, skeyaccess, AC_DEFINE(HAVE_SKEYACCESS))
2542     LDFLAGS="$O_LDFLAGS"
2543     SUDO_LIBS="${SUDO_LIBS} -lskey"
2544     AUTH_OBJS="$AUTH_OBJS rfc1938.o"
2545 fi
2546
2547 dnl
2548 dnl extra OPIE lib and includes
2549 dnl
2550 if test "${with_opie-'no'}" = "yes"; then
2551     O_LDFLAGS="$LDFLAGS"
2552     if test "$with_opie" != "yes"; then
2553         CPPFLAGS="${CPPFLAGS} -I${with_opie}/include"
2554         SUDO_APPEND_LIBPATH(LDFLAGS, [${with_opie}/lib])
2555         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_opie}/lib])
2556         AC_PREPROC_IFELSE([#include <opie.h>], [found=yes], [found=no])
2557     else
2558         found=no
2559         O_CPPFLAGS="$CPPFLAGS"
2560         for dir in "" "/usr/local" "/usr/contrib"; do
2561             test -n "$dir" && CPPFLAGS="$O_CPPFLAGS -I${dir}/include"
2562             AC_PREPROC_IFELSE([#include <opie.h>], [found=yes; break])
2563         done
2564         if test "$found" = "no" -o -z "$dir"; then
2565             CPPFLAGS="$O_CPPFLAGS"
2566         else
2567             SUDO_APPEND_LIBPATH(LDFLAGS, [${dir}/lib])
2568             SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${dir}/lib])
2569         fi
2570     fi
2571     if test "$found" = "no"; then
2572         AC_MSG_WARN([Unable to locate opie.h, you will have to edit the Makefile and add -I/path/to/opie/includes to CPPFLAGS])
2573     fi
2574     AC_CHECK_LIB(opie, main, [found=yes], [AC_MSG_WARN([Unable to locate libopie.a, you will have to edit the Makefile and add -L/path/to/opie/lib to SUDO_LDFLAGS])])
2575     LDFLAGS="$O_LDFLAGS"
2576     SUDO_LIBS="${SUDO_LIBS} -lopie"
2577     AUTH_OBJS="$AUTH_OBJS rfc1938.o"
2578 fi
2579
2580 dnl
2581 dnl Check for shadow password routines if we have not already done so.
2582 dnl If there is a specific list of functions to check we do that first.
2583 dnl Otherwise, we check for SVR4-style and then SecureWare-style.
2584 dnl
2585 if test ${with_passwd-'no'} != "no"; then
2586     dnl
2587     dnl if crypt(3) not in libc, look elsewhere
2588     dnl
2589     if test -z "$LIB_CRYPT"; then
2590         AC_SEARCH_LIBS([crypt], [crypt crypt_d ufc], [test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2591     fi
2592
2593     if test "$CHECKSHADOW" = "true" -a -n "$shadow_funcs"; then
2594         _LIBS="$LIBS"
2595         LIBS="$LIBS $shadow_libs"
2596         found=no
2597         AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2598         if test "$found" = "yes"; then
2599             SUDO_LIBS="$SUDO_LIBS $shadow_libs"
2600         elif test -n "$shadow_libs_optional"; then
2601             LIBS="$LIBS $shadow_libs_optional"
2602             AC_CHECK_FUNCS($shadow_funcs, [found=yes])
2603             if test "$found" = "yes"; then
2604                 SUDO_LIBS="$SUDO_LIBS $shadow_libs $shadow_libs_optional"
2605             fi
2606         fi
2607         if test "$found" = "yes"; then
2608             case "$shadow_funcs" in
2609                 *getprpwnam*) SECUREWARE=1;;
2610             esac
2611             test -n "$shadow_defs" && OSDEFS="${OSDEFS} $shadow_defs"
2612         else
2613             LIBS="$_LIBS"
2614         fi
2615         CHECKSHADOW=false
2616     fi
2617     if test "$CHECKSHADOW" = "true"; then
2618         AC_SEARCH_LIBS([getspnam], [gen], [AC_DEFINE(HAVE_GETSPNAM)] [CHECKSHADOW=false; test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2619     fi
2620     if test "$CHECKSHADOW" = "true"; then
2621         AC_SEARCH_LIBS([getprpwnam], [sec security prot], [AC_DEFINE(HAVE_GETPRPWNAM)] [CHECKSHADOW=false; SECUREWARE=1; test -n "$ac_lib" && SUDO_LIBS="${SUDO_LIBS} $ac_res"])
2622     fi
2623     if test -n "$SECUREWARE"; then
2624         AC_CHECK_FUNCS(bigcrypt set_auth_parameters initprivs)
2625         AUTH_OBJS="$AUTH_OBJS secureware.o"
2626     fi
2627 fi
2628
2629 dnl
2630 dnl extra lib and .o file for LDAP support
2631 dnl
2632 if test ${with_ldap-'no'} != "no"; then
2633     _LDFLAGS="$LDFLAGS"
2634     if test "$with_ldap" != "yes"; then
2635         SUDO_APPEND_LIBPATH(SUDO_LDFLAGS, [${with_ldap}/lib])
2636         SUDO_APPEND_LIBPATH(LDFLAGS, [${with_ldap}/lib])
2637         CPPFLAGS="${CPPFLAGS} -I${with_ldap}/include"
2638         with_ldap=yes
2639     fi
2640     SUDO_OBJS="${SUDO_OBJS} ldap.o"
2641     LDAP=""
2642
2643     AC_MSG_CHECKING([for LDAP libraries])
2644     LDAP_LIBS=""
2645     _LIBS="$LIBS"
2646     found=no
2647     for l in -lldap -llber '-lssl -lcrypto'; do
2648         LIBS="${LIBS} $l"
2649         LDAP_LIBS="${LDAP_LIBS} $l"
2650         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2651         #include <lber.h>
2652         #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [found=yes; break])
2653     done
2654     dnl if nothing linked just try with -lldap
2655     if test "$found" = "no"; then
2656         LIBS="${_LIBS} -lldap"
2657         LDAP_LIBS="-lldap"
2658         AC_MSG_RESULT([not found, using -lldap])
2659     else
2660         AC_MSG_RESULT([$LDAP_LIBS])
2661     fi
2662     dnl check if we need to link with -llber for ber_set_option
2663     OLIBS="$LIBS"
2664     AC_SEARCH_LIBS([ber_set_option], [lber], [found=yes], [found=no])
2665     if test X"$found" = X"yes" -a X"$LIBS" != X"$OLIBS"; then
2666         LDAP_LIBS="$LDAP_LIBS -llber"
2667     fi
2668     dnl check if ldap.h includes lber.h for us
2669     AC_MSG_CHECKING([whether lber.h is needed])
2670     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
2671     #include <ldap.h>]], [[(void)ldap_init(0, 0)]])], [AC_MSG_RESULT([no])], [
2672     AC_MSG_RESULT([yes])
2673     AC_DEFINE(HAVE_LBER_H)])
2674
2675     AC_CHECK_HEADERS([sasl/sasl.h] [sasl.h], [AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s)], [break])
2676     AC_CHECK_HEADERS([ldap_ssl.h] [mps/ldap_ssl.h], [break], [], [#include <ldap.h>])
2677     AC_CHECK_FUNCS(ldap_initialize ldap_start_tls_s ldapssl_init ldapssl_set_strength ldap_unbind_ext_s ldap_str2dn ldap_create ldap_sasl_bind_s ldap_ssl_client_init ldap_start_tls_s_np)
2678     AC_CHECK_FUNCS(ldap_search_ext_s ldap_search_st, [break])
2679
2680     if test X"$check_gss_krb5_ccache_name" = X"yes"; then
2681         AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,
2682             AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
2683             [LDAP_LIBS="${LDAP_LIBS} -lgssapi"],
2684             AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,
2685                 AC_DEFINE(HAVE_GSS_KRB5_CCACHE_NAME)
2686                 [LDAP_LIBS="${LDAP_LIBS} -lgssapi_krb5"])
2687         )
2688
2689         # gssapi headers may be separate or part of Kerberos V
2690         found=no
2691         O_CPPFLAGS="$CPPFLAGS"
2692         for dir in "" "kerberosV" "krb5" "kerberos5" "kerberosv5"; do
2693             test X"$dir" != X"" && CPPFLAGS="$O_CPPFLAGS -I/usr/include/${dir}"
2694             AC_PREPROC_IFELSE([#include <gssapi/gssapi.h>], [found="gssapi/gssapi.h"; break], [AC_PREPROC_IFELSE([#include <gssapi.h>], [found="gssapi.h"; break])])
2695         done
2696         if test X"$found" != X"no"; then
2697             AC_CHECK_HEADERS([$found])
2698             if test X"$found" = X"gssapi/gssapi.h"; then
2699                 AC_CHECK_HEADERS([gssapi/gssapi_krb5.h])
2700             fi
2701         else
2702             CPPFLAGS="$O_CPPFLAGS"
2703             AC_MSG_WARN([Unable to locate gssapi.h, you will have to edit the Makefile and add -I/path/to/gssapi/includes to CPPFLAGS])
2704         fi
2705     fi
2706
2707     SUDO_LIBS="${SUDO_LIBS} ${LDAP_LIBS}"
2708     LIBS="$_LIBS"
2709     LDFLAGS="$_LDFLAGS"
2710 fi
2711
2712 dnl
2713 dnl Add LIBVAS_RPATH to LDFLAGS
2714 dnl GNU ld accepts -R/path/ as an alias for -rpath /path/
2715 dnl
2716 if test X"$LIBVAS_RPATH" != X""; then
2717     if test -n "$blibpath"; then
2718         blibpath_add="${blibpath_add}:$LIBVAS_RPATH"
2719     else
2720         case "$host" in
2721             *-*-hpux*)  LDFLAGS="$LDFLAGS -Wl,+b,$LIBVAS_RPATH"
2722                         ;;
2723             *)          LDFLAGS="$LDFLAGS -Wl,-R$LIBVAS_RPATH"
2724                         ;;
2725         esac
2726     fi
2727 fi
2728
2729 dnl
2730 dnl Add $blibpath to SUDO_LDFLAGS if specified by the user or if we
2731 dnl added -L dirpaths to SUDO_LDFLAGS.
2732 dnl
2733 if test -n "$blibpath"; then
2734     if test -n "$blibpath_add"; then
2735         SUDO_LDFLAGS="$SUDO_LDFLAGS -Wl,-blibpath:${blibpath}${blibpath_add}"
2736     elif test -n "$with_blibpath" -a "$with_blibpath" != "yes"; then
2737         SUDO_LDFLAGS="$SUDO_LDFLAGS -Wl,-blibpath:${blibpath}"
2738     fi
2739 fi
2740
2741 dnl
2742 dnl Check for log file, timestamp and iolog locations
2743 dnl
2744 SUDO_LOGFILE
2745 SUDO_TIMEDIR
2746 SUDO_IO_LOGDIR
2747
2748 dnl
2749 dnl If I/O logging is enabled, build sudoreplay and exec_pty get_pty.o iolog.o
2750 dnl
2751 if test "${with_iologdir-yes}" != "no"; then
2752     # Require POSIX job control for I/O log support
2753     AC_CHECK_FUNCS(tcsetpgrp, [
2754         SUDO_OBJS="${SUDO_OBJS} exec_pty.o get_pty.o iolog.o"
2755         PROGS="$PROGS sudoreplay"
2756         REPLAY=""
2757
2758         AC_ARG_ENABLE(zlib,
2759         [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])], [])
2760         case ${enable_zlib-"yes"} in
2761             yes)
2762                 AC_CHECK_LIB(z, gzdopen, [
2763                     AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"], [enable_zlib=builtin])
2764                 ])
2765                 ;;
2766             no)
2767                 ;;
2768             system)
2769                 AC_DEFINE(HAVE_ZLIB_H)
2770                 ZLIB="-lz"
2771                 ;;
2772             builtin)
2773                 # handled below
2774                 ;;
2775             *)
2776                 AC_DEFINE(HAVE_ZLIB_H)
2777                 CPPFLAGS="${CPPFLAGS} -I${enable_zlib}/include"
2778                 SUDO_APPEND_LIBPATH(ZLIB, [$enable_zlib/lib])
2779                 ZLIB="${ZLIB} -lz"
2780                 ;;
2781         esac
2782         if test X"$enable_zlib" = X"builtin"; then
2783             AC_DEFINE(HAVE_ZLIB_H)
2784             CPPFLAGS="${CPPFLAGS}"' -I$(srcdir)/zlib'
2785             ZLIB="${ZLIB} libz.a"
2786             ZLIB_DEP=libz.a
2787         fi
2788     ], [
2789         AC_MSG_WARN([Disabling I/O log support due to lack of tcsetpgrp function])
2790         with_iologdir=no
2791     ])
2792 fi
2793
2794 dnl
2795 dnl Use passwd auth module?
2796 dnl
2797 case "$with_passwd" in
2798 yes|maybe)
2799     AUTH_OBJS="$AUTH_OBJS getspwuid.o passwd.o"
2800     ;;
2801 *)
2802     AC_DEFINE(WITHOUT_PASSWD)
2803     if test -z "$AUTH_OBJS"; then
2804         AC_MSG_ERROR([no authentication methods defined.])
2805     fi
2806     ;;
2807 esac
2808 AUTH_OBJS=${AUTH_OBJS# }
2809 _AUTH=`echo "$AUTH_OBJS" | sed -e 's/\.o//g' -e 's/getspwuid *//'`
2810 AC_MSG_NOTICE([using the following authentication methods: $_AUTH])
2811
2812 dnl
2813 dnl LIBS may contain duplicates from SUDO_LIBS or NET_LIBS so prune it.
2814 dnl
2815 if test -n "$LIBS"; then
2816     L="$LIBS"
2817     LIBS=
2818     for l in ${L}; do
2819         dupe=0
2820         for sl in ${SUDO_LIBS} ${NET_LIBS}; do
2821             test $l = $sl && dupe=1
2822         done
2823         test $dupe = 0 && LIBS="${LIBS} $l"
2824     done
2825 fi
2826
2827 dnl
2828 dnl Set exec_prefix
2829 dnl
2830 test "$exec_prefix" = "NONE" && exec_prefix='$(prefix)'
2831
2832 dnl
2833 dnl Defer setting _PATH_SUDO_NOEXEC until after exec_prefix is set
2834 dnl XXX - this is gross!
2835 dnl
2836 if test X"$with_noexec" != X"no" -o X"$with_selinux" != X"no"; then
2837     oexec_prefix="$exec_prefix"
2838     if test "$exec_prefix" = '$(prefix)'; then
2839         if test "$prefix" = "NONE"; then
2840             exec_prefix="$ac_default_prefix"
2841         else
2842             exec_prefix="$prefix"
2843         fi
2844     fi
2845     if test X"$with_noexec" != X"no"; then
2846         PROGS="${PROGS} libsudo_noexec.la"
2847         INSTALL_NOEXEC="install-noexec"
2848
2849         eval noexec_file="$with_noexec"
2850         SUDO_DEFINE_UNQUOTED(_PATH_SUDO_NOEXEC, "$noexec_file", [The fully qualified pathname of sudo_noexec.so])
2851     fi
2852     if test X"$with_selinux" != X"no"; then
2853         eval sesh_file="$libexecdir/sesh"
2854         SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SESH, "$sesh_file", [The fully qualified pathname of sesh])
2855     fi
2856     exec_prefix="$oexec_prefix"
2857 fi
2858
2859 dnl
2860 dnl Override default configure dirs for the Makefile
2861 dnl
2862 if test X"$prefix" = X"NONE"; then
2863     test "$mandir" = '${datarootdir}/man' && mandir='$(prefix)/man'
2864 else
2865     test "$mandir" = '${datarootdir}/man' && mandir='$(datarootdir)/man'
2866 fi
2867 test "$bindir" = '${exec_prefix}/bin' && bindir='$(exec_prefix)/bin'
2868 test "$sbindir" = '${exec_prefix}/sbin' && sbindir='$(exec_prefix)/sbin'
2869 test "$libexecdir" = '${exec_prefix}/libexec' && libexecdir='$(exec_prefix)/libexec'
2870 test "$includedir" = '${prefix}/include' && includedir='$(prefix)/include'
2871 test "$datarootdir" = '${prefix}/share' && datarootdir='$(prefix)/share'
2872 test "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' && docdir='$(datarootdir)/doc/$(PACKAGE_TARNAME)'
2873 test "$sysconfdir" = '${prefix}/etc' -a X"$with_stow" != X"yes" && sysconfdir='/etc'
2874
2875 dnl
2876 dnl Substitute into the Makefile and man pages
2877 dnl
2878 AC_CONFIG_FILES([Makefile sudo.man visudo.man sudoers.man sudoers.ldap.man sudoreplay.man sudo_usage.h sudoers])
2879 AC_OUTPUT
2880
2881 dnl
2882 dnl Spew any text the user needs to know about
2883 dnl
2884 if test "$with_pam" = "yes"; then
2885     case $host in
2886         *-*-linux*)
2887             AC_MSG_NOTICE([You will need to customize sample.pam and install it as /etc/pam.d/sudo])
2888             ;;
2889     esac
2890 fi
2891
2892 dnl
2893 dnl Autoheader templates
2894 dnl
2895 AH_TEMPLATE(BROKEN_SYSLOG, [Define to 1 if the `syslog' function returns a non-zero int to denote failure.])
2896 AH_TEMPLATE(CLASSIC_INSULTS, [Define to 1 if you want the insults from the "classic" version sudo.])
2897 AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twisted minds of CSOps.])
2898 AH_TEMPLATE(DONT_LEAK_PATH_INFO, [Define to 1 if you want sudo to display "command not allowed" instead of "command not found" when a command cannot be found.])
2899 AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.])
2900 AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.])
2901 AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.])
2902 AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.])
2903 AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".])
2904 AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.])
2905 AH_TEMPLATE(HAVE_AFS, [Define to 1 if you use AFS.])
2906 AH_TEMPLATE(HAVE_AIXAUTH, [Define to 1 if you use AIX general authentication.])
2907 AH_TEMPLATE(HAVE_BSD_AUTH_H, [Define to 1 if you use BSD authentication.])
2908 AH_TEMPLATE(HAVE_BSM_AUDIT, [Define to 1 to enable BSM audit support.])
2909 AH_TEMPLATE(HAVE_DCE, [Define to 1 if you use OSF DCE.])
2910 AH_TEMPLATE(HAVE_DD_FD, [Define to 1 if your `DIR' contains dd_fd.])
2911 AH_TEMPLATE(HAVE_DIRFD, [Define to 1 if you have the `dirfd' function or macro.])
2912 AH_TEMPLATE(HAVE_DGETTEXT, [Define to 1 if you have the `dgettext' function.])
2913 AH_TEMPLATE(HAVE_DISPCRYPT, [Define to 1 if you have the `dispcrypt' function.])
2914 AH_TEMPLATE(HAVE_EXTENDED_GLOB, [Define to 1 if your glob.h defines the GLOB_BRACE and GLOB_TILDE flags.])
2915 AH_TEMPLATE(HAVE_FCNTL_CLOSEM, [Define to 1 if your system has the F_CLOSEM fcntl.])
2916 AH_TEMPLATE(HAVE_FNMATCH, [Define to 1 if you have the `fnmatch' function.])
2917 AH_TEMPLATE(HAVE_FWTK, [Define to 1 if you use the FWTK authsrv daemon.])
2918 AH_TEMPLATE(HAVE_GETAUTHUID, [Define to 1 if you have the `getauthuid' function. (ULTRIX 4.x  shadow passwords)])
2919 AH_TEMPLATE(HAVE_GETPRPWNAM, [Define to 1 if you have the `getprpwnam' function.  (SecureWare-style shadow passwords)])
2920 AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. (SunOS 4.x shadow passwords)])
2921 AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords)])
2922 AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)])
2923 AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
2924 AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
2925 AH_TEMPLATE(HAVE_IN6_ADDR, [Define to 1 if <netinet/in.h> contains struct in6_addr.])
2926 AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)])
2927 AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)])
2928 AH_TEMPLATE(HAVE_KERB4, [Define to 1 if you use Kerberos IV.])
2929 AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
2930 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
2931 AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS, [Define to 1 if your `krb5_get_init_creds_opt_free' function takes two arguments.])
2932 AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
2933 AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
2934 AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not)])
2935 AH_TEMPLATE(HAVE_LDAP, [Define to 1 if you use LDAP for sudoers.])
2936 AH_TEMPLATE(HAVE_LINUX_AUDIT, [Define to 1 to enable Linux audit support.])
2937 AH_TEMPLATE(HAVE_OPIE, [Define to 1 if you use NRL OPIE.])
2938 AH_TEMPLATE(HAVE_PAM, [Define to 1 if you use PAM authentication.])
2939 AH_TEMPLATE(HAVE_PAM_LOGIN, [Define to 1 if you use a specific PAM session for sudo -i.])
2940 AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the <project.h> header file.])
2941 AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
2942 AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
2943 AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
2944 AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if <signal.h> has the sigaction_t typedef.])
2945 AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
2946 AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
2947 AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union])
2948 AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member])
2949 AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member])
2950 AH_TEMPLATE(HAVE_TERMIOS_H, [Define to 1 if you have the <termios.h> header file and the `tcgetattr' function.])
2951 AH_TEMPLATE(HAVE_TIMESPEC, [Define to 1 if you have struct timespec in sys/time.h])
2952 AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
2953 AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
2954 AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements])
2955 AH_TEMPLATE(LOGGING, [Define to SLOG_SYSLOG, SLOG_FILE, or SLOG_BOTH.])
2956 AH_TEMPLATE(LONG_OTP_PROMPT, [Define to 1 if you want a two line OTP (S/Key or OPIE) prompt.])
2957 AH_TEMPLATE(NO_AUTHENTICATION, [Define to 1 if you don't want sudo to prompt for a password by default.])
2958 AH_TEMPLATE(NO_LECTURE, [Define to 1 if you don't want users to get the lecture the first they user sudo.])
2959 AH_TEMPLATE(NO_PAM_SESSION, [Define to 1 if you don't want to use sudo's PAM session support])
2960 AH_TEMPLATE(NO_ROOT_MAILER, [Define to avoid runing the mailer as root.])
2961 AH_TEMPLATE(NO_ROOT_SUDO, [Define to 1 if root should not be allowed to use sudo.])
2962 AH_TEMPLATE(NO_TTY_TICKETS, [Define to 1 if you want a single ticket file instead of per-tty files.])
2963 AH_TEMPLATE(PC_INSULTS, [Define to 1 to replace politically incorrect insults with less offensive ones.])
2964 AH_TEMPLATE(SECURE_PATH, [Define to 1 to override the user's path with a built-in one.])
2965 AH_TEMPLATE(SEND_MAIL_WHEN_NOT_OK, [Define to 1 to send mail when the user is not allowed to run a command.])
2966 AH_TEMPLATE(SEND_MAIL_WHEN_NO_HOST, [Define to 1 to send mail when the user is not allowed to run sudo on this host.])
2967 AH_TEMPLATE(SEND_MAIL_WHEN_NO_USER, [Define to 1 to send mail when the user is not in the sudoers file.])
2968 AH_TEMPLATE(SHELL_IF_NO_ARGS, [Define to 1 if you want sudo to start a shell if given no arguments.])
2969 AH_TEMPLATE(SHELL_SETS_HOME, [Define to 1 if you want sudo to set $HOME in shell mode.])
2970 AH_TEMPLATE(STUB_LOAD_INTERFACES, [Define to 1 if the code in interfaces.c does not compile for you.])
2971 AH_TEMPLATE(UMASK_OVERRIDE, [Define to 1 to use the umask specified in sudoers even when it is less restrictive than the invoking user's.])
2972 AH_TEMPLATE(USE_ADMIN_FLAG, [Define to 1 if you want to create ~/.sudo_as_admin_successful if the user is in the admin group the first time they run sudo.])
2973 AH_TEMPLATE(USE_INSULTS, [Define to 1 if you want to insult the user for entering an incorrect password.])
2974 AH_TEMPLATE(USE_STOW, [Define to 1 if you use GNU stow packaging.])
2975 AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for authentication.])
2976 AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
2977 AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
2978 AH_TEMPLATE(USING_NONUNIX_GROUPS, [Define to 1 if using a non-Unix group lookup implementation.])
2979
2980 dnl
2981 dnl Bits to copy verbatim into config.h.in
2982 dnl
2983 AH_TOP([#ifndef _SUDO_CONFIG_H
2984 #define _SUDO_CONFIG_H])
2985
2986 AH_BOTTOM([/*
2987  * Macros to convert ctime and mtime into timevals.
2988  */
2989 #define timespec2timeval(_ts, _tv) do {                                 \
2990     (_tv)->tv_sec = (_ts)->tv_sec;                                      \
2991     (_tv)->tv_usec = (_ts)->tv_nsec / 1000;                             \
2992 } while (0)
2993
2994 #ifdef HAVE_ST_MTIM
2995 # ifdef HAVE_ST__TIM
2996 #  define ctim_get(_x, _y)      timespec2timeval(&(_x)->st_ctim.st__tim, (_y))
2997 #  define mtim_get(_x, _y)      timespec2timeval(&(_x)->st_mtim.st__tim, (_y))
2998 # else
2999 #  define ctim_get(_x, _y)      timespec2timeval(&(_x)->st_ctim, (_y))
3000 #  define mtim_get(_x, _y)      timespec2timeval(&(_x)->st_mtim, (_y))
3001 # endif
3002 #else
3003 # ifdef HAVE_ST_MTIMESPEC
3004 #  define ctim_get(_x, _y)      timespec2timeval(&(_x)->st_ctimespec, (_y))
3005 #  define mtim_get(_x, _y)      timespec2timeval(&(_x)->st_mtimespec, (_y))
3006 # else
3007 #  define ctim_get(_x, _y)      do { (_y)->tv_sec = (_x)->st_ctime; (_y)->tv_usec = 0; } while (0)
3008 #  define mtim_get(_x, _y)      do { (_y)->tv_sec = (_x)->st_mtime; (_y)->tv_usec = 0; } while (0)
3009 # endif /* HAVE_ST_MTIMESPEC */
3010 #endif /* HAVE_ST_MTIM */
3011
3012 /*
3013  * Emulate a subset of waitpid() if we don't have it.
3014  */
3015 #ifdef HAVE_WAITPID
3016 # define sudo_waitpid(p, s, o)  waitpid(p, s, o)
3017 #else
3018 # ifdef HAVE_WAIT3
3019 #  define sudo_waitpid(p, s, o) wait3(s, o, NULL)
3020 # endif
3021 #endif
3022
3023 /* GNU stow needs /etc/sudoers to be a symlink. */
3024 #ifdef USE_STOW
3025 # define stat_sudoers   stat
3026 #else
3027 # define stat_sudoers   lstat
3028 #endif
3029
3030 /* Macros to set/clear/test flags. */
3031 #undef SET
3032 #define SET(t, f)       ((t) |= (f))
3033 #undef CLR
3034 #define CLR(t, f)       ((t) &= ~(f))
3035 #undef ISSET
3036 #define ISSET(t, f)     ((t) & (f))
3037
3038 /* New ANSI-style OS defs for HP-UX and ConvexOS. */
3039 #if defined(hpux) && !defined(__hpux)
3040 # define __hpux         1
3041 #endif /* hpux */
3042
3043 #if defined(convex) && !defined(__convex__)
3044 # define __convex__     1
3045 #endif /* convex */
3046
3047 /* BSD compatibility on some SVR4 systems. */
3048 #ifdef __svr4__
3049 # define BSD_COMP
3050 #endif /* __svr4__ */
3051
3052 #endif /* _SUDO_CONFIG_H */])