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