SEND_TODISP(_ALL)?: append newline if message does have no final one
[s-mailx.git] / mk-conf.sh
blobeaecb39fa1196058072423fad74d150515fdd2aa
1 #!/bin/sh -
2 #@ Please see `INSTALL' and `make.rc' instead.
4 LC_ALL=C
5 export LC_ALL
7 option_reset() {
8 OPT_ICONV=0
9 OPT_SOCKETS=0
10 OPT_SSL=0 OPT_ALL_SSL_ALGORITHMS=0
11 OPT_SMTP=0 OPT_POP3=0
12 OPT_GSSAPI=0 OPT_NETRC=0 OPT_AGENT=0
13 #OPT_MD5=0
14 OPT_IDNA=0
15 OPT_IMAP_SEARCH=0
16 OPT_REGEX=0
17 OPT_READLINE=0 OPT_MLE=0
18 OPT_HISTORY=0 OPT_KEY_BINDINGS=0
19 OPT_TERMCAP=0 OPT_TERMCAP_PREFER_TERMINFO=0
20 OPT_ERRORS=0
21 OPT_SPAM_SPAMC=0 OPT_SPAM_SPAMD=0 OPT_SPAM_FILTER=0
22 OPT_DOCSTRINGS=0
23 OPT_QUOTE_FOLD=0
24 OPT_FILTER_HTML_TAGSOUP=0
25 OPT_COLOUR=0
26 OPT_DOTLOCK=0
29 option_maximal() {
30 OPT_ICONV=require
31 OPT_SOCKETS=1
32 OPT_SSL=1 OPT_ALL_SSL_ALGORITHMS=1
33 OPT_SMTP=1 OPT_POP3=1
34 OPT_GSSAPI=1 OPT_NETRC=1 OPT_AGENT=1
35 #OPT_MD5=1
36 OPT_IDNA=1
37 OPT_IMAP_SEARCH=1
38 OPT_REGEX=require
39 OPT_MLE=1
40 OPT_HISTORY=1 OPT_KEY_BINDINGS=1
41 OPT_TERMCAP=1 OPT_TERMCAP_PREFER_TERMINFO=1
42 OPT_ERRORS=1
43 OPT_SPAM_SPAMC=1 OPT_SPAM_SPAMD=1 OPT_SPAM_FILTER=1
44 OPT_DOCSTRINGS=1
45 OPT_QUOTE_FOLD=1
46 OPT_FILTER_HTML_TAGSOUP=1
47 OPT_COLOUR=1
48 OPT_DOTLOCK=require
51 # Predefined CONFIG= urations take precedence over anything else
52 if [ -n "${CONFIG}" ]; then
53 case "${CONFIG}" in
54 [nN][uU][lL][lL])
55 option_reset
57 [nN][uU][lL][lL][iI])
58 option_reset
59 OPT_ICONV=require
61 [mM][iI][nN][iI][mM][aA][lL])
62 option_reset
63 OPT_ICONV=1
64 OPT_REGEX=1
65 OPT_DOTLOCK=require
67 [mM][eE][dD][iI][uU][mM])
68 option_reset
69 OPT_ICONV=require
70 OPT_IDNA=1
71 OPT_REGEX=1
72 OPT_MLE=1
73 OPT_HISTORY=1 OPT_KEY_BINDINGS=1
74 OPT_ERRORS=1
75 OPT_SPAM_FILTER=1
76 OPT_DOCSTRINGS=1
77 OPT_COLOUR=1
78 OPT_DOTLOCK=require
80 [nN][eE][tT][sS][eE][nN][dD])
81 option_reset
82 OPT_ICONV=require
83 OPT_SOCKETS=1
84 OPT_SSL=require
85 OPT_SMTP=require
86 OPT_GSSAPI=1 OPT_NETRC=1 OPT_AGENT=1
87 OPT_IDNA=1
88 OPT_REGEX=1
89 OPT_MLE=1
90 OPT_HISTORY=1 OPT_KEY_BINDINGS=1
91 OPT_DOCSTRINGS=1
92 OPT_COLOUR=1
93 OPT_DOTLOCK=require
95 [mM][aA][xX][iI][mM][aA][lL])
96 option_reset
97 option_maximal
99 [dD][eE][vV][eE][lL])
100 OPT_DEVEL=1 OPT_DEBUG=1 OPT_NYD2=1
101 option_maximal
103 [oO][dD][eE][vV][eE][lL])
104 OPT_DEVEL=1
105 option_maximal
108 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
109 echo >&2 'Possible values: NULL, NULLI, MINIMAL, MEDIUM, NETSEND, MAXIMAL'
110 exit 1
112 esac
115 # Inter-relationships
116 option_update() {
117 if feat_no SMTP && feat_no POP3; then
118 OPT_SOCKETS=0
120 if feat_no SOCKETS; then
121 if feat_require SMTP; then
122 msg 'ERROR: need SOCKETS for required feature SMTP'
123 config_exit 13
125 if feat_require POP3; then
126 msg 'ERROR: need SOCKETS for required feature POP3'
127 config_exit 13
129 OPT_SSL=0 OPT_ALL_SSL_ALGORITHMS=0
130 OPT_SMTP=0 OPT_POP3=0
131 OPT_GSSAPI=0 OPT_NETRC=0 OPT_AGENT=0
133 if feat_no SMTP; then
134 OPT_GSSAPI=0
137 if feat_no READLINE && feat_no MLE; then
138 OPT_HISTORY=0 OPT_KEY_BINDINGS=0
141 # If we don't need MD5 leave it alone
142 if feat_no SOCKETS; then
143 OPT_MD5=0
146 if feat_yes DEVEL; then
147 OPT_DEBUG=1
149 if feat_yes DEBUG; then
150 OPT_NOALLOCA=1 OPT_DEVEL=1
154 # Note that potential duplicates in PATH, C_INCLUDE_PATH etc. will be cleaned
155 # via path_check() later on once possible
157 # TODO cc_maxopt is brute simple, we should compile test program and dig real
158 # compiler versions for known compilers, then be more specific
159 cc_maxopt=100
160 _CFLAGS= _LDFLAGS=
162 os_early_setup() {
163 i="${OS:-`uname -s`}"
165 if [ ${i} = SunOS ]; then
166 msg 'SunOS / Solaris? Applying some "early setup" rules ...'
167 _os_early_setup_sunos
171 os_setup() {
172 # OSFULLSPEC is used to recognize changes (i.e., machine type, updates etc.)
173 OSFULLSPEC="${OS:-`uname -a | ${tr} '[A-Z]' '[a-z]'`}"
174 OS="${OS:-`uname -s | ${tr} '[A-Z]' '[a-z]'`}"
175 msg 'Operating system is %s' ${OS}
177 if [ ${OS} = sunos ]; then
178 msg ' . have special SunOS / Solaris "setup" rules ...'
179 _os_setup_sunos
180 elif [ ${OS} = unixware ]; then
181 msg ' . have special UnixWare environmental rules ...'
182 if feat_yes AUTOCC && command -v cc >/dev/null 2>&1; then
183 CC=cc
184 feat_yes DEBUG && _CFLAGS='-v -Xa -g' || _CFLAGS='-Xa -O'
186 CFLAGS="${_CFLAGS} ${EXTRA_CFLAGS}"
187 LDFLAGS="${_LDFLAGS} ${EXTRA_LDFLAGS}"
188 export CC CFLAGS LDFLAGS
189 OPT_AUTOCC=0 had_want_autocc=1 need_R_ldflags=-R
191 elif [ -n "${VERBOSE}" ]; then
192 msg ' . no special treatment for this system necessary or known'
195 # Sledgehammer: better set _GNU_SOURCE
196 # And in general: oh, boy!
197 OS_DEFINES="${OS_DEFINES}#define _GNU_SOURCE\n"
198 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200809L\n"
199 #OS_DEFINES="${OS_DEFINES}#define _XOPEN_SOURCE 700\n"
200 #[ ${OS} = darwin ] && OS_DEFINES="${OS_DEFINES}#define _DARWIN_C_SOURCE\n"
202 # On pkgsrc(7) systems automatically add /usr/pkg/*
203 if [ -d /usr/pkg ]; then
204 C_INCLUDE_PATH="${C_INCLUDE_PATH}:/usr/pkg/include"
205 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/pkg/lib"
209 _os_early_setup_sunos() {
210 # According to standards(5), this is what we need to do
211 if [ -d /usr/xpg4 ]; then :; else
212 msg 'ERROR: On SunOS / Solaris we need /usr/xpg4 environment! Sorry.'
213 config_exit 1
215 PATH="/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:${PATH}"
216 [ -d /usr/xpg6 ] && PATH="/usr/xpg6/bin:${PATH}"
217 export PATH
220 _os_setup_sunos() {
221 C_INCLUDE_PATH="/usr/xpg4/include:${C_INCLUDE_PATH}"
222 LD_LIBRARY_PATH="/usr/xpg4/lib:${LD_LIBRARY_PATH}"
224 # Include packages
225 if [ -d /opt/csw ]; then
226 C_INCLUDE_PATH="${C_INCLUDE_PATH}:/opt/csw/include"
227 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/csw/lib"
230 OS_DEFINES="${OS_DEFINES}#define __EXTENSIONS__\n"
231 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200112L\n"
233 [ -n "${cksum}" ] || cksum=/opt/csw/gnu/cksum
234 if [ -x "${cksum}" ]; then :; else
235 msg 'ERROR: Not an executable program: %s' "${cksum}"
236 msg 'ERROR: We need a CRC-32 cksum(1), as specified in POSIX.'
237 msg 'ERROR: However, we do so only for tests.'
238 msg 'ERROR: If that is ok, set "cksum=/usr/bin/true", then rerun'
239 config_exit 1
242 if feat_yes AUTOCC; then
243 if command -v cc >/dev/null 2>&1; then
244 CC=cc
245 feat_yes DEBUG && _CFLAGS="-v -Xa -g" || _CFLAGS="-Xa -O"
247 CFLAGS="${_CFLAGS} ${EXTRA_CFLAGS}"
248 LDFLAGS="${_LDFLAGS} ${EXTRA_LDFLAGS}"
249 export CC CFLAGS LDFLAGS
250 OPT_AUTOCC=0 had_want_autocc=1 need_R_ldflags=-R
251 else
252 # Assume gcc(1), which supports -R for compat
253 cc_maxopt=2 force_no_stackprot=1 need_R_ldflags=-Wl,-R
258 # Check out compiler ($CC) and -flags ($CFLAGS)
259 cc_setup() {
260 # Even though it belongs into cc_flags we will try to compile and link
261 # something, so ensure we have a clean state regarding CFLAGS/LDFLAGS or
262 # EXTRA_CFLAGS/EXTRA_LDFLAGS
263 if feat_no AUTOCC; then
264 _cc_default
265 # Ensure those don't do any harm
266 EXTRA_CFLAGS= EXTRA_LDFLAGS=
267 export EXTRA_CFLAGS EXTRA_LDFLAGS
268 return
269 else
270 CFLAGS= LDFLAGS=
271 export CFLAGS LDFLAGS
274 [ -n "${CC}" ] && [ "${CC}" != cc ] && { _cc_default; return; }
276 printf >&2 'Searching for a usable C compiler .. $CC='
277 if { i="`command -v clang`"; }; then
278 CC=${i}
279 elif { i="`command -v gcc`"; }; then
280 CC=${i}
281 elif { i="`command -v c99`"; }; then
282 CC=${i}
283 elif { i="`command -v tcc`"; }; then
284 CC=${i}
285 elif { i="`command -v pcc`"; }; then
286 CC=${i}
287 else
288 if [ "${CC}" = cc ]; then
290 elif { i="`command -v c89`"; }; then
291 CC=${i}
292 else
293 printf >&2 'boing booom tschak\n'
294 msg 'ERROR: I cannot find a compiler!'
295 msg ' Neither of clang(1), gcc(1), tcc(1), pcc(1), c89(1) and c99(1).'
296 msg ' Please set ${CC} environment variable, maybe ${CFLAGS}, rerun.'
297 config_exit 1
300 printf >&2 -- '%s\n' "${CC}"
301 export CC
304 _cc_default() {
305 if [ -z "${CC}" ]; then
306 printf >&2 'To go on like you have chosen, please set $CC, rerun.'
307 config_exit 1
310 if [ -z "${VERBOSE}" ] && [ -f ${lst} ] && feat_no DEBUG; then
312 else
313 msg 'Using C compiler ${CC}=%s' "${CC}"
317 cc_flags() {
318 if feat_yes AUTOCC; then
319 if [ -f ${lst} ] && feat_no DEBUG && [ -z "${VERBOSE}" ]; then
320 cc_check_silent=1
321 msg 'Detecting ${CFLAGS}/${LDFLAGS} for ${CC}="%s", just a second..' \
322 "${CC}"
323 else
324 cc_check_silent=
325 msg 'Testing usable ${CFLAGS}/${LDFLAGS} for ${CC}=%s' "${CC}"
328 i=`echo "${CC}" | ${awk} 'BEGIN{FS="/"}{print $NF}'`
329 if { echo "${i}" | ${grep} tcc; } >/dev/null 2>&1; then
330 msg ' . have special tcc(1) environmental rules ...'
331 _cc_flags_tcc
332 else
333 # As of pcc CVS 2016-04-02, stack protection support is announced but
334 # will break if used on Linux
335 if { echo "${i}" | ${grep} pcc; } >/dev/null 2>&1; then
336 force_no_stackprot=1
338 _cc_flags_generic
341 feat_no DEBUG && _CFLAGS="-DNDEBUG ${_CFLAGS}"
342 CFLAGS="${_CFLAGS} ${EXTRA_CFLAGS}"
343 LDFLAGS="${_LDFLAGS} ${EXTRA_LDFLAGS}"
344 else
345 if feat_no DEBUG; then
346 CFLAGS="-DNDEBUG ${CFLAGS}"
349 msg ''
350 export CFLAGS LDFLAGS
353 _cc_flags_tcc() {
354 __cflags=${_CFLAGS} __ldflags=${_LDFLAGS}
355 _CFLAGS= _LDFLAGS=
357 cc_check -Wall
358 cc_check -Wextra
359 cc_check -pedantic
361 if feat_yes DEBUG; then
362 # May have problems to find libtcc cc_check -b
363 cc_check -g
366 if ld_check -Wl,-rpath =./ no; then
367 need_R_ldflags=-Wl,-rpath=
368 ld_runtime_flags # update!
371 _CFLAGS="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
372 unset __cflags __ldflags
375 _cc_flags_generic() {
376 __cflags=${_CFLAGS} __ldflags=${_LDFLAGS}
377 _CFLAGS= _LDFLAGS=
378 feat_yes DEVEL && cc_check -std=c89 || cc_check -std=c99
380 # Check -g first since some others may rely upon -g / optim. level
381 if feat_yes DEBUG; then
382 cc_check -O
383 cc_check -g
384 elif [ ${cc_maxopt} -gt 2 ] && cc_check -O3; then
386 elif [ ${cc_maxopt} -gt 1 ] && cc_check -O2; then
388 elif [ ${cc_maxopt} -gt 0 ] && cc_check -O1; then
390 else
391 cc_check -O
394 if feat_yes DEVEL && cc_check -Weverything; then
396 else
397 cc_check -Wall
398 cc_check -Wextra
399 cc_check -Wbad-function-cast
400 cc_check -Wcast-align
401 cc_check -Wcast-qual
402 cc_check -Winit-self
403 cc_check -Wmissing-prototypes
404 cc_check -Wshadow
405 cc_check -Wunused
406 cc_check -Wwrite-strings
407 cc_check -Wno-long-long
409 cc_check -pedantic
411 if feat_yes AMALGAMATION && feat_no DEVEL; then
412 cc_check -Wno-unused-function
414 feat_no DEVEL && cc_check -Wno-unused-result # XXX do right way (pragma too)
416 cc_check -fno-unwind-tables
417 cc_check -fno-asynchronous-unwind-tables
418 cc_check -fstrict-aliasing
419 if cc_check -fstrict-overflow && feat_yes DEVEL; then
420 cc_check -Wstrict-overflow=5
423 if feat_yes DEBUG || feat_yes FORCED_STACKPROT; then
424 if [ -z "${force_no_stackprot}" ]; then
425 if cc_check -fstack-protector-strong ||
426 cc_check -fstack-protector-all; then
427 cc_check -D_FORTIFY_SOURCE=2
429 else
430 msg 'Not checking for -fstack-protector compiler option,'
431 msg 'since that caused errors in a "similar" configuration.'
432 msg 'You may turn off OPT_AUTOCC and use your own settings, rerun'
436 if feat_yes AMALGAMATION; then
437 cc_check -pipe
440 # LD (+ dependend CC)
442 if feat_yes DEVEL; then
443 _ccfg=${_CFLAGS}
444 # -fsanitize=address
445 #if cc_check -fsanitize=memory &&
446 # ld_check -fsanitize=memory &&
447 # cc_check -fsanitize-memory-track-origins=2 &&
448 # ld_check -fsanitize-memory-track-origins=2; then
450 #else
451 # _CFLAGS=${_ccfg}
455 ld_check -Wl,-z,relro
456 ld_check -Wl,-z,now
457 ld_check -Wl,-z,noexecstack
458 if ld_check -Wl,-rpath =./ no; then
459 need_R_ldflags=-Wl,-rpath=
460 ld_runtime_flags # update!
461 elif ld_check -Wl,-R ./ no; then
462 need_R_ldflags=-Wl,-R
463 ld_runtime_flags # update!
466 # Address randomization
467 _ccfg=${_CFLAGS}
468 if cc_check -fPIE || cc_check -fpie; then
469 ld_check -pie || _CFLAGS=${_ccfg}
471 unset _ccfg
473 _CFLAGS="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
474 unset __cflags __ldflags
477 ## -- >8 -- 8< -- ##
479 ## Notes:
480 ## - Heirloom sh(1) (and same origin) have _sometimes_ problems with ': >'
481 ## redirection, so use "printf '' >" instead
483 ## Very first: we undergo several states regarding I/O redirection etc.,
484 ## but need to deal with option updates from within all. Since all the
485 ## option stuff should be above the scissor line, define utility functions
486 ## and redefine them as necessary.
487 ## And, since we have those functions, simply use them for whatever
489 config_exit() {
490 exit ${1}
493 msg() {
494 fmt=${1}
495 shift
496 printf >&2 -- "${fmt}\\n" "${@}"
499 ## First of all, create new configuration and check whether it changed
501 rc=./make.rc
502 lst=./config.lst
503 ev=./config.ev
504 h=./config.h h_name=config.h
505 mk=./mk.mk
507 newlst=./config.lst-new
508 newmk=./config.mk-new
509 newev=./config.ev-new
510 newh=./config.h-new
511 tmp0=___tmp
512 tmp=./${tmp0}1$$
513 tmp2=./${tmp0}2$$
515 t1=ten10one1ten10one1
516 if ( [ ${t1##*ten10} = one1 ] && [ ${t1#*ten10} = one1ten10one1 ] &&
517 [ ${t1%%one1*} = ten10 ] && [ ${t1%one1*} = ten10one1ten10 ]
518 ) > /dev/null 2>&1; then
519 good_shell=1
520 else
521 unset good_shell
523 unset t1
525 # We need some standard utilities
526 unset -f command
527 check_tool() {
528 n=${1} i=${2} opt=${3:-0}
529 # Evaluate, just in case user comes in with shell snippets (..well..)
530 eval i="${i}"
531 if type "${i}" >/dev/null 2>&1; then # XXX why have i type not command -v?
532 [ -n "${VERBOSE}" ] && msg ' . ${%s} ... %s' "${n}" "${i}"
533 eval ${n}=${i}
534 return 0
536 if [ ${opt} -eq 0 ]; then
537 msg 'ERROR: no trace of utility %s' "${n}"
538 config_exit 1
540 return 1
543 # Very easy checks for the operating system in order to be able to adjust paths
544 # or similar very basic things which we need to be able to go at all
545 os_early_setup
547 # Check those tools right now that we need before including $rc
548 msg 'Checking for basic utility set'
549 check_tool awk "${awk:-`command -v awk`}"
550 check_tool rm "${rm:-`command -v rm`}"
551 check_tool tr "${tr:-`command -v tr`}"
553 # Our feature check environment
554 feat_val_no() {
555 [ "x${1}" = x0 ] || [ "x${1}" = xn ] ||
556 [ "x${1}" = xfalse ] || [ "x${1}" = xno ] || [ "x${1}" = xoff ]
559 feat_val_yes() {
560 [ "x${1}" = x1 ] || [ "x${1}" = xy ] ||
561 [ "x${1}" = xtrue ] || [ "x${1}" = xyes ] || [ "x${1}" = xon ] ||
562 [ "x${1}" = xrequire ]
565 feat_val_require() {
566 [ "x${1}" = xrequire ]
569 _feat_check() {
570 eval i=\$OPT_${1}
571 i="`echo ${i} | ${tr} '[A-Z]' '[a-z]'`"
572 if feat_val_no "${i}"; then
573 return 1
574 elif feat_val_yes "${i}"; then
575 return 0
576 else
577 msg "ERROR: %s: 0/n/false/no/off or 1/y/true/yes/on/require, got: %s" \
578 "${1}" "${i}"
579 config_exit 11
583 feat_yes() {
584 _feat_check ${1}
587 feat_no() {
588 _feat_check ${1} && return 1
589 return 0
592 feat_require() {
593 eval i=\$OPT_${1}
594 i="`echo ${i} | ${tr} '[A-Z]' '[a-z]'`"
595 [ "x${i}" = xrequire ] || [ "x${i}" = xrequired ]
598 feat_bail_required() {
599 if feat_require ${1}; then
600 msg 'ERROR: feature OPT_%s is required but not available' "${1}"
601 config_exit 13
603 eval OPT_${1}=0
604 option_update # XXX this is rather useless here (dependency chain..)
607 path_check() {
608 # "path_check VARNAME" or "path_check VARNAME FLAG VARNAME"
609 varname=${1} addflag=${2} flagvarname=${3}
610 j=${IFS}
611 IFS=:
612 eval "set -- \$${1}"
613 IFS=${j}
614 j= k= y= z=
615 for i
617 [ -z "${i}" ] && continue
618 [ -d "${i}" ] || continue
619 # Skip any fakeroot packager environment
620 case "${i}" in *fakeroot*) continue;; esac
621 if [ -n "${j}" ]; then
622 if { z=${y}; echo "${z}"; } | ${grep} ":${i}:" >/dev/null 2>&1; then
624 else
625 y="${y} :${i}:"
626 j="${j}:${i}"
627 [ -n "${addflag}" ] && k="${k} ${addflag}${i}"
629 else
630 y=" :${i}:"
631 j="${i}"
632 [ -n "${addflag}" ] && k="${addflag}${i}"
634 done
635 eval "${varname}=\"${j}\""
636 [ -n "${addflag}" ] && eval "${flagvarname}=\"${k}\""
637 unset varname
640 ld_runtime_flags() {
641 if [ -n "${need_R_ldflags}" ]; then
642 i=${IFS}
643 IFS=:
644 set -- ${LD_LIBRARY_PATH}
645 IFS=${i}
646 for i
648 LDFLAGS="${LDFLAGS} ${need_R_ldflags}${i}"
649 _LDFLAGS="${_LDFLAGS} ${need_R_ldflags}${i}"
650 done
651 export LDFLAGS
653 # Disable it for a possible second run.
654 need_R_ldflags=
657 cc_check() {
658 [ -n "${cc_check_silent}" ] || printf >&2 ' . CC %s .. ' "${1}"
659 if "${CC}" ${INCS} \
660 ${_CFLAGS} ${1} ${EXTRA_CFLAGS} ${_LDFLAGS} ${EXTRA_LDFLAGS} \
661 -o ${tmp2} ${tmp}.c ${LIBS} >/dev/null 2>&1; then
662 _CFLAGS="${_CFLAGS} ${1}"
663 [ -n "${cc_check_silent}" ] || printf >&2 'yes\n'
664 return 0
666 [ -n "${cc_check_silent}" ] || printf >&2 'no\n'
667 return 1
670 ld_check() {
671 # $1=option [$2=option argument] [$3=if set, shall NOT be added to _LDFLAGS]
672 [ -n "${cc_check_silent}" ] || printf >&2 ' . LD %s .. ' "${1}"
673 if "${CC}" ${INCS} ${_CFLAGS} ${_LDFLAGS} ${1}${2} ${EXTRA_LDFLAGS} \
674 -o ${tmp2} ${tmp}.c ${LIBS} >/dev/null 2>&1; then
675 [ -n "${3}" ] || _LDFLAGS="${_LDFLAGS} ${1}"
676 [ -n "${cc_check_silent}" ] || printf >&2 'yes\n'
677 return 0
679 [ -n "${cc_check_silent}" ] || printf >&2 'no\n'
680 return 1
683 # Include $rc, but only take from it what wasn't overwritten by the user from
684 # within the command line or from a chosen fixed CONFIG=
685 # Note we leave alone the values
686 trap "exit 1" HUP INT TERM
687 trap "${rm} -f ${tmp}" EXIT
689 printf >&2 'Reading and preparing configuration from %s ... ' ${rc}
690 ${rm} -f ${tmp}
691 # We want read(1) to perform backslash escaping in order to be able to use
692 # multiline values in make.rc; the resulting sh(1)/sed(1) code was very slow in
693 # VMs (see [fa2e248]), Aharon Robbins suggested the following
694 < ${rc} ${awk} 'BEGIN{line = ""}{
695 gsub(/^[[:space:]]+/, "", $0)
696 gsub(/[[:space:]]+$/, "", $0)
697 if(gsub(/\\$/, "", $0)){
698 line = line $0
699 next
700 }else
701 line = line $0
702 if(index(line, "#") == 1){
703 line = ""
704 }else if(length(line)){
705 print line
706 line = ""
708 }' |
709 while read line; do
710 if [ -n "${good_shell}" ]; then
711 i=${line%%=*}
712 else
713 i=`${awk} -v LINE="${line}" 'BEGIN{
714 gsub(/=.*$/, "", LINE)
715 print LINE
718 if [ "${i}" = "${line}" ]; then
719 msg 'ERROR: invalid syntax in: %s' "${line}"
720 continue
723 eval j="\$${i}" jx="\${${i}+x}"
724 if [ -n "${j}" ] || [ "${jx}" = x ]; then
725 : # Yet present
726 else
727 j=`${awk} -v LINE="${line}" 'BEGIN{
728 gsub(/^[^=]*=/, "", LINE)
729 gsub(/^\"*/, "", LINE)
730 gsub(/\"*$/, "", LINE)
731 print LINE
734 [ "${i}" = "DESTDIR" ] && continue
735 echo "${i}=\"${j}\""
736 done > ${tmp}
737 # Reread the mixed version right now
738 . ./${tmp}
739 printf >&2 'done\n'
741 # We need to know about that now, in order to provide utility overwrites etc.
742 os_setup
744 msg 'Checking for remaining set of utilities'
745 check_tool grep "${grep:-`command -v grep`}"
747 # Before we step ahead with the other utilities perform a path cleanup first.
748 path_check PATH
750 # awk(1) above
751 check_tool cat "${cat:-`command -v cat`}"
752 check_tool chmod "${chmod:-`command -v chmod`}"
753 check_tool cp "${cp:-`command -v cp`}"
754 check_tool cmp "${cmp:-`command -v cmp`}"
755 # grep(1) above
756 check_tool mkdir "${mkdir:-`command -v mkdir`}"
757 check_tool mv "${mv:-`command -v mv`}"
758 # rm(1) above
759 check_tool sed "${sed:-`command -v sed`}"
760 check_tool sort "${sort:-`command -v sort`}"
761 check_tool tee "${tee:-`command -v tee`}"
763 check_tool chown "${chown:-`command -v chown`}" 1 ||
764 check_tool chown "/sbin/chown" 1 ||
765 check_tool chown "/usr/sbin/chown"
767 check_tool make "${MAKE:-`command -v make`}"
768 MAKE=${make}
769 check_tool strip "${STRIP:-`command -v strip`}" 1 &&
770 HAVE_STRIP=1 || HAVE_STRIP=0
772 # For ./cc-test.sh only
773 check_tool cksum "${cksum:-`command -v cksum`}"
775 # Update OPT_ options now, in order to get possible inter-dependencies right
776 option_update
778 # (No functions since some shells loose non-exported variables in traps)
779 trap "trap \"\" HUP INT TERM; exit 1" HUP INT TERM
780 trap "trap \"\" HUP INT TERM EXIT;\
781 ${rm} -rf ${newlst} ${tmp0}.* ${tmp0}* ${newmk} ${newev} ${newh}" EXIT
783 # Our configuration options may at this point still contain shell snippets,
784 # we need to evaluate them in order to get them expanded, and we need those
785 # evaluated values not only in our new configuration file, but also at hand..
786 printf >&2 'Evaluating all configuration items ... '
787 ${rm} -f ${newlst} ${newmk} ${newh}
788 exec 5<&0 6>&1 <${tmp} >${newlst}
789 while read line; do
791 if [ -n "${good_shell}" ]; then
792 i=${line%%=*}
793 [ "${i}" != "${i#OPT_}" ] && z=1
794 else
795 i=`${awk} -v LINE="${line}" 'BEGIN{
796 gsub(/=.*$/, "", LINE);\
797 print LINE
799 if echo "${i}" | ${grep} '^OPT_' >/dev/null 2>&1; then
804 eval j=\$${i}
805 if [ -n "${z}" ]; then
806 j="`echo ${j} | ${tr} '[A-Z]' '[a-z]'`"
807 if [ -z "${j}" ] || feat_val_no "${j}"; then
809 printf " /* #undef ${i} */\n" >> ${newh}
810 elif feat_val_yes "${j}"; then
811 if feat_val_require "${j}"; then
812 j=require
813 else
816 printf " /* #define ${i} */\n" >> ${newh}
817 else
818 msg 'ERROR: cannot parse <%s>' "${line}"
819 config_exit 1
821 else
822 printf "#define ${i} \"${j}\"\n" >> ${newh}
824 printf "${i} = ${j}\n" >> ${newmk}
825 printf "${i}=${j}\n"
826 eval "${i}=\"${j}\""
827 done
828 exec 0<&5 1>&6 5<&- 6<&-
829 printf >&2 'done\n'
831 # Add the known utility and some other variables
832 printf "#define VAL_UAGENT \"${VAL_SID}${VAL_NAIL}\"\n" >> ${newh}
833 printf "VAL_UAGENT = ${VAL_SID}${VAL_NAIL}\n" >> ${newmk}
835 printf "#define VAL_PRIVSEP \"${VAL_SID}${VAL_NAIL}-privsep\"\n" >> ${newh}
836 printf "VAL_PRIVSEP = \$(VAL_UAGENT)-privsep\n" >> ${newmk}
837 if feat_yes DOTLOCK; then
838 printf "OPTIONAL_PRIVSEP = \$(VAL_PRIVSEP)\n" >> ${newmk}
839 else
840 printf "OPTIONAL_PRIVSEP =\n" >> ${newmk}
843 for i in \
844 awk cat chmod chown cp cmp grep mkdir mv rm sed sort tee tr \
845 MAKE MAKEFLAGS make SHELL strip \
846 cksum; do
847 eval j=\$${i}
848 printf "${i} = ${j}\n" >> ${newmk}
849 printf "${i}=${j}\n" >> ${newlst}
850 printf "${i}=\"${j}\";export ${i}; " >> ${newev}
851 done
852 printf "\n" >> ${newev}
854 # Build a basic set of INCS and LIBS according to user environment.
855 path_check C_INCLUDE_PATH -I _INCS
856 INCS="${INCS} ${_INCS}"
857 path_check LD_LIBRARY_PATH -L _LIBS
858 LIBS="${LIBS} ${_LIBS}"
859 unset _INCS _LIBS
860 export C_INCLUDE_PATH LD_LIBRARY_PATH
862 # Some environments need runtime path flags to be able to go at all
863 ld_runtime_flags
865 ## Detect CC, whether we can use it, and possibly which CFLAGS we can use
867 cc_setup
869 ${cat} > ${tmp}.c << \!
870 #include <stdio.h>
871 #include <string.h>
872 static void doit(char const *s);
874 main(int argc, char **argv){
875 (void)argc;
876 (void)argv;
877 doit("Hello world");
878 return 0;
880 static void
881 doit(char const *s){
882 char buf[12];
883 memcpy(buf, s, strlen(s) +1);
884 puts(s);
888 if "${CC}" ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} \
889 -o ${tmp2} ${tmp}.c ${LIBS}; then
891 else
892 msg 'ERROR: i cannot compile a "Hello world" via'
893 msg ' %s' \
894 "${CC} ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} ${LIBS}"
895 msg 'ERROR: Please read INSTALL, rerun'
896 config_exit 1
899 # This may also update ld_runtime_flags() (again)
900 cc_flags
902 for i in \
903 INCS LIBS \
904 ; do
905 eval j=\$${i}
906 printf -- "${i}=${j}\n" >> ${newlst}
907 done
908 for i in \
909 CC \
910 CFLAGS \
911 LDFLAGS \
912 PATH C_INCLUDE_PATH LD_LIBRARY_PATH \
913 OSFULLSPEC \
914 ; do
915 eval j=\$${i}
916 printf -- "${i} = ${j}\n" >> ${newmk}
917 printf -- "${i}=${j}\n" >> ${newlst}
918 done
920 # Now finally check whether we already have a configuration and if so, whether
921 # all those parameters are still the same.. or something has actually changed
922 if [ -f ${lst} ] && ${cmp} ${newlst} ${lst} >/dev/null 2>&1; then
923 echo 'Configuration is up-to-date'
924 exit 0
925 elif [ -f ${lst} ]; then
926 echo 'Configuration has been updated..'
927 ( eval "${MAKE} -f ./mk.mk clean" )
928 echo
929 else
930 echo 'Shiny configuration..'
933 # Time to redefine helper 1
934 config_exit() {
935 ${rm} -f ${lst} ${h} ${mk}
936 exit ${1}
939 ${mv} -f ${newlst} ${lst}
940 ${mv} -f ${newev} ${ev}
941 ${mv} -f ${newh} ${h}
942 ${mv} -f ${newmk} ${mk}
944 if [ -z "${VERBOSE}" ]; then
945 printf -- "ECHO_CC = @echo ' 'CC \$(@);\n" >> ${mk}
946 printf -- "ECHO_LINK = @echo ' 'LINK \$(@);\n" >> ${mk}
947 printf -- "ECHO_GEN = @echo ' 'GEN \$(@);\n" >> ${mk}
948 printf -- "ECHO_TEST = @\n" >> ${mk}
949 printf -- "ECHO_CMD = @echo ' CMD';\n" >> ${mk}
950 printf -- "ECHO_BLOCK_BEGIN = @( \n" >> ${mk}
951 printf -- "ECHO_BLOCK_END = ) >/dev/null\n" >> ${mk}
954 ## Compile and link checking
956 tmp3=./${tmp0}3$$
957 log=./config.log
958 lib=./config.lib
959 inc=./config.inc
960 makefile=./config.mk
962 # (No function since some shells loose non-exported variables in traps)
963 trap "trap \"\" HUP INT TERM;\
964 ${rm} -f ${lst} ${h} ${mk} ${lib} ${inc}; exit 1" HUP INT TERM
965 trap "trap \"\" HUP INT TERM EXIT;\
966 ${rm} -rf ${tmp0}.* ${tmp0}* ${makefile}" EXIT
968 # Time to redefine helper 2
969 msg() {
970 fmt=${1}
971 shift
972 printf "*** ${fmt}\\n" "${@}"
973 printf -- "${fmt}\\n" "${@}" >&5
975 msg_nonl() {
976 fmt=${1}
977 shift
978 printf "*** ${fmt}\\n" "${@}"
979 printf -- "${fmt}" "${@}" >&5
982 exec 5>&2 > ${log} 2>&1
984 echo "${LIBS}" > ${lib}
985 echo "${INCS}" > ${inc}
986 ${cat} > ${makefile} << \!
987 .SUFFIXES: .o .c .x .y
988 .c.o:
989 $(CC) -I./ $(XINCS) $(CFLAGS) -c $(<)
990 .c.x:
991 $(CC) -I./ $(XINCS) -E $(<) > $(@)
993 $(CC) -I./ $(XINCS) $(CFLAGS) $(LDFLAGS) -o $(@) $(<) $(XLIBS)
996 _check_preface() {
997 variable=$1 topic=$2 define=$3
999 echo '**********'
1000 msg_nonl ' . %s ... ' "${topic}"
1001 echo "/* checked ${topic} */" >> ${h}
1002 ${rm} -f ${tmp} ${tmp}.o
1003 echo '*** test program is'
1004 { echo '#include <'"${h_name}"'>'; cat; } | ${tee} ${tmp}.c
1005 #echo '*** the preprocessor generates'
1006 #${make} -f ${makefile} ${tmp}.x
1007 #${cat} ${tmp}.x
1008 echo '*** results are'
1011 compile_check() {
1012 variable=$1 topic=$2 define=$3
1014 _check_preface "${variable}" "${topic}" "${define}"
1016 if ${make} -f ${makefile} XINCS="${INCS}" ./${tmp}.o &&
1017 [ -f ./${tmp}.o ]; then
1018 msg 'yes'
1019 echo "${define}" >> ${h}
1020 eval have_${variable}=yes
1021 return 0
1022 else
1023 echo "/* ${define} */" >> ${h}
1024 msg 'no'
1025 eval unset have_${variable}
1026 return 1
1030 _link_mayrun() {
1031 run=$1 variable=$2 topic=$3 define=$4 libs=$5 incs=$6
1033 _check_preface "${variable}" "${topic}" "${define}"
1035 feat_yes CROSS_BUILD && run=0
1037 if ${make} -f ${makefile} XINCS="${INCS} ${incs}" \
1038 XLIBS="${LIBS} ${libs}" ./${tmp} &&
1039 [ -f ./${tmp} ] &&
1040 { [ ${run} -eq 0 ] || ./${tmp}; }; then
1041 echo "*** adding INCS<${incs}> LIBS<${libs}>; executed: ${run}"
1042 msg 'yes'
1043 echo "${define}" >> ${h}
1044 LIBS="${LIBS} ${libs}"
1045 echo "${libs}" >> ${lib}
1046 INCS="${INCS} ${incs}"
1047 echo "${incs}" >> ${inc}
1048 eval have_${variable}=yes
1049 return 0
1050 else
1051 msg 'no'
1052 echo "/* ${define} */" >> ${h}
1053 eval unset have_${variable}
1054 return 1
1058 link_check() {
1059 _link_mayrun 0 "${1}" "${2}" "${3}" "${4}" "${5}"
1062 run_check() {
1063 _link_mayrun 1 "${1}" "${2}" "${3}" "${4}" "${5}"
1066 feat_def() {
1067 if feat_yes ${1}; then
1068 echo '#define HAVE_'${1}'' >> ${h}
1069 else
1070 echo '/* OPT_'${1}'=0 */' >> ${h}
1074 squeeze_em() {
1075 < "${1}" > "${2}" ${awk} \
1076 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
1079 ## Generics
1081 # May be multiline..
1082 [ -n "${OS_DEFINES}" ] && printf -- "${OS_DEFINES}" >> ${h}
1084 feat_def AMALGAMATION
1085 feat_def CROSS_BUILD
1086 feat_def DEBUG
1087 feat_def DEVEL
1088 feat_def DOCSTRINGS
1089 feat_def ERRORS
1090 feat_def NYD2
1091 feat_def NOMEMDBG
1093 if run_check inline '"inline" functions' \
1094 '#define HAVE_INLINE
1095 #define n_INLINE static inline' << \!
1096 static inline int ilf(int i){return ++i;}
1097 int main(void){return ilf(-1);}
1099 then
1101 elif run_check inline '"__inline" functions' \
1102 '#define HAVE_INLINE
1103 #define n_INLINE static __inline' << \!
1104 static __inline int ilf(int i){return ++i;}
1105 int main(void){return ilf(-1);}
1107 then
1111 if run_check endian 'Little endian byteorder' \
1112 '#define HAVE_BYTE_ORDER_LITTLE' << \!
1113 int main(void){
1114 enum {vBig = 1, vLittle = 0};
1115 union {unsigned short bom; unsigned char buf[2];} u;
1116 u.bom = 0xFEFF;
1117 return((u.buf[1] == 0xFE) ? vLittle : vBig);
1120 then
1124 ## Test for "basic" system-calls / functionality that is used by all parts
1125 ## of our program. Once this is done fork away BASE_LIBS and other BASE_*
1126 ## macros to be used by only the subprograms (potentially).
1128 if run_check clock_gettime 'clock_gettime(2)' \
1129 '#define HAVE_CLOCK_GETTIME' << \!
1130 #include <time.h>
1131 # include <errno.h>
1132 int main(void){
1133 struct timespec ts;
1135 if(!clock_gettime(CLOCK_REALTIME, &ts) || errno != ENOSYS)
1136 return 0;
1137 return 1;
1140 then
1142 elif run_check clock_gettime 'clock_gettime(2) (via -lrt)' \
1143 '#define HAVE_CLOCK_GETTIME' '-lrt' << \!
1144 #include <time.h>
1145 # include <errno.h>
1146 int main(void){
1147 struct timespec ts;
1149 if(!clock_gettime(CLOCK_REALTIME, &ts) || errno != ENOSYS)
1150 return 0;
1151 return 1;
1154 then
1156 elif run_check gettimeofday 'gettimeofday(2)' \
1157 '#define HAVE_GETTIMEOFDAY' << \!
1158 #include <stdio.h> /* For C89 NULL */
1159 #include <sys/time.h>
1160 # include <errno.h>
1161 int main(void){
1162 struct timeval tv;
1164 if(!gettimeofday(&tv, NULL) || errno != ENOSYS)
1165 return 0;
1166 return 1;
1169 then
1171 else
1172 have_no_subsecond_time=1
1175 if run_check nanosleep 'nanosleep(2)' \
1176 '#define HAVE_NANOSLEEP' << \!
1177 #include <time.h>
1178 # include <errno.h>
1179 int main(void){
1180 struct timespec ts;
1182 ts.tv_sec = 1;
1183 ts.tv_nsec = 100000;
1184 if(!nanosleep(&ts, NULL) || errno != ENOSYS)
1185 return 0;
1186 return 1;
1189 then
1191 elif run_check nanosleep 'nanosleep(2) (via -lrt)' \
1192 '#define HAVE_NANOSLEEP' '-lrt' << \!
1193 #include <time.h>
1194 # include <errno.h>
1195 int main(void){
1196 struct timespec ts;
1198 ts.tv_sec = 1;
1199 ts.tv_nsec = 100000;
1200 if(!nanosleep(&ts, NULL) || errno != ENOSYS)
1201 return 0;
1202 return 1;
1205 then
1207 # link_check is enough for this, that function is so old, trust the proto
1208 elif link_check sleep 'sleep(3)' \
1209 '#define HAVE_SLEEP' << \!
1210 #include <unistd.h>
1211 # include <errno.h>
1212 int main(void){
1213 if(!sleep(1) || errno != ENOSYS)
1214 return 0;
1215 return 1;
1218 then
1220 else
1221 msg 'ERROR: we require one of nanosleep(2) and sleep(3).'
1222 config_exit 1
1225 if run_check userdb 'gete?[gu]id(2), getpwuid(3), getpwnam(3)' << \!
1226 #include <pwd.h>
1227 #include <unistd.h>
1228 # include <errno.h>
1229 int main(void){
1230 struct passwd *pw;
1231 gid_t gid;
1232 uid_t uid;
1234 if((gid = getgid()) != 0)
1235 gid = getegid();
1236 if((uid = getuid()) != 0)
1237 uid = geteuid();
1238 if((pw = getpwuid(uid)) == NULL && errno == ENOSYS)
1239 return 1;
1240 if((pw = getpwnam("root")) == NULL && errno == ENOSYS)
1241 return 1;
1242 return 0;
1245 then
1247 else
1248 msg 'ERROR: we require user and group info / database searches.'
1249 msg 'That much Unix we indulge ourselfs.'
1250 config_exit 1
1253 if link_check ftruncate 'ftruncate(2)' \
1254 '#define HAVE_FTRUNCATE' << \!
1255 #include <unistd.h>
1256 #include <sys/types.h>
1257 int main(void){
1258 return (ftruncate(0, 0) != 0);
1261 then
1263 else
1264 msg 'ERROR: we require the ftruncate(2) system call.'
1265 config_exit 1
1268 if run_check sa_restart 'SA_RESTART (for sigaction(2))' << \!
1269 #include <signal.h>
1270 # include <errno.h>
1271 int main(void){
1272 struct sigaction nact, oact;
1274 nact.sa_handler = SIG_DFL;
1275 sigemptyset(&nact.sa_mask);
1276 nact.sa_flags = SA_RESTART;
1277 return !(!sigaction(SIGCHLD, &nact, &oact) || errno != ENOSYS);
1280 then
1282 else
1283 msg 'ERROR: we (yet) require the SA_RESTART flag for sigaction(2).'
1284 config_exit 1
1287 if link_check snprintf 'snprintf(3)' << \!
1288 #include <stdio.h>
1289 int main(void){
1290 char b[20];
1292 snprintf(b, sizeof b, "%s", "string");
1293 return 0;
1296 then
1298 else
1299 msg 'ERROR: we require the snprintf(3) function.'
1300 config_exit 1
1303 if link_check environ 'environ(3)' << \!
1304 #include <stdio.h> /* For C89 NULL */
1305 int main(void){
1306 extern char **environ;
1308 return environ[0] == NULL;
1311 then
1313 else
1314 msg 'ERROR: we require the environ(3) array for subprocess control.'
1315 config_exit 1
1318 if link_check setenv '(un)?setenv(3)' '#define HAVE_SETENV' << \!
1319 #include <stdlib.h>
1320 int main(void){
1321 setenv("s-mailx", "i want to see it cute!", 1);
1322 unsetenv("s-mailx");
1323 return 0;
1326 then
1328 elif link_check setenv 'putenv(3)' '#define HAVE_PUTENV' << \!
1329 #include <stdlib.h>
1330 int main(void){
1331 putenv("s-mailx=i want to see it cute!");
1332 return 0;
1335 then
1337 else
1338 msg 'ERROR: we require either the setenv(3) or putenv(3) functions.'
1339 config_exit 1
1342 if link_check termios 'termios.h and tc*(3) family' << \!
1343 #include <termios.h>
1344 int main(void){
1345 struct termios tios;
1347 tcgetattr(0, &tios);
1348 tcsetattr(0, TCSANOW | TCSADRAIN | TCSAFLUSH, &tios);
1349 return 0;
1352 then
1354 else
1355 msg 'ERROR: we require termios.h and the tc*() family of functions.'
1356 msg 'That much Unix we indulge ourselfs.'
1357 config_exit 1
1360 ## optional stuff
1362 if link_check vsnprintf 'vsnprintf(3)' << \!
1363 #include <stdarg.h>
1364 #include <stdio.h>
1365 static void dome(char *buf, size_t blen, ...){
1366 va_list ap;
1368 va_start(ap, buf);
1369 vsnprintf(buf, blen, "%s", ap);
1370 va_end(ap);
1372 int main(void){
1373 char b[20];
1375 dome(b, sizeof b, "string");
1376 return 0;
1379 then
1381 else
1382 feat_bail_required ERRORS
1385 if [ "${have_vsnprintf}" = yes ]; then
1386 link_check va_copy 'va_copy(3)' '#define HAVE_VA_COPY' << \!
1387 #include <stdarg.h>
1388 #include <stdio.h>
1389 static void dome2(char *buf, size_t blen, va_list src){
1390 va_list ap;
1392 va_copy(ap, src);
1393 vsnprintf(buf, blen, "%s", ap);
1394 va_end(ap);
1396 static void dome(char *buf, size_t blen, ...){
1397 va_list ap;
1399 va_start(ap, buf);
1400 dome2(buf, blen, ap)
1401 va_end(ap);
1403 int main(void){
1404 char b[20];
1406 dome(b, sizeof b, "string");
1407 return 0;
1412 run_check pathconf 'f?pathconf(2)' '#define HAVE_PATHCONF' << \!
1413 #include <unistd.h>
1414 #include <errno.h>
1415 int main(void){
1416 int rv = 0;
1418 errno = 0;
1419 rv |= !(pathconf(".", _PC_NAME_MAX) >= 0 || errno == 0 || errno != ENOSYS);
1420 errno = 0;
1421 rv |= !(pathconf(".", _PC_PATH_MAX) >= 0 || errno == 0 || errno != ENOSYS);
1423 /* Only link check */
1424 fpathconf(0, _PC_NAME_MAX);
1426 return rv;
1430 run_check pipe2 'pipe2(2)' '#define HAVE_PIPE2' << \!
1431 #include <fcntl.h>
1432 #include <unistd.h>
1433 # include <errno.h>
1434 int main(void){
1435 int fds[2];
1437 if(!pipe2(fds, O_CLOEXEC) || errno != ENOSYS)
1438 return 0;
1439 return 1;
1443 # We use this only then for now (need NOW+1)
1444 run_check utimensat 'utimensat(2)' '#define HAVE_UTIMENSAT' << \!
1445 #include <fcntl.h> /* For AT_* */
1446 #include <sys/stat.h>
1447 # include <errno.h>
1448 int main(void){
1449 struct timespec ts[2];
1451 ts[0].tv_nsec = UTIME_NOW;
1452 ts[1].tv_nsec = UTIME_OMIT;
1453 if(!utimensat(AT_FDCWD, "", ts, 0) || errno != ENOSYS)
1454 return 0;
1455 return 1;
1461 # XXX Add POSIX check once standardized
1462 if link_check posix_random 'arc4random(3)' '#define HAVE_POSIX_RANDOM 0' << \!
1463 #include <stdlib.h>
1464 int main(void){
1465 arc4random();
1466 return 0;
1469 then
1471 elif [ -n "${have_no_subsecond_time}" ]; then
1472 msg 'ERROR: %s %s' 'without a native random' \
1473 'one of clock_gettime(2) and gettimeofday(2) is required.'
1474 config_exit 1
1477 link_check putc_unlocked 'putc_unlocked(3)' '#define HAVE_PUTC_UNLOCKED' <<\!
1478 #include <stdio.h>
1479 int main(void){
1480 putc_unlocked('@', stdout);
1481 return 0;
1485 link_check fchdir 'fchdir(3)' '#define HAVE_FCHDIR' << \!
1486 #include <unistd.h>
1487 int main(void){
1488 fchdir(0);
1489 return 0;
1493 if run_check realpath 'realpath(3)' '#define HAVE_REALPATH' << \!
1494 #include <stdlib.h>
1495 int main(void){
1496 char x_buf[4096], *x = realpath(".", x_buf);
1498 return (x != NULL) ? 0 : 1;
1501 then
1502 if run_check realpath_malloc 'realpath(3) takes NULL' \
1503 '#define HAVE_REALPATH_NULL' << \!
1504 #include <stdlib.h>
1505 int main(void){
1506 char *x = realpath(".", NULL);
1508 if(x != NULL)
1509 free(x);
1510 return (x != NULL) ? 0 : 1;
1513 then
1518 ## optional and selectable
1520 if feat_no NOALLOCA; then
1521 # Due to NetBSD PR lib/47120 it seems best not to use non-cc-builtin
1522 # versions of alloca(3) since modern compilers just can't be trusted
1523 # not to overoptimize and silently break some code
1524 run_check alloca '__builtin_alloca()' \
1525 '#define HAVE_ALLOCA __builtin_alloca' << \!
1526 #include <stdio.h> /* For C89 NULL */
1527 int main(void){
1528 void *vp = __builtin_alloca(1);
1530 return (vp != NULL);
1535 if feat_yes DOTLOCK; then
1536 if run_check readlink 'readlink(2)' << \!
1537 #include <unistd.h>
1538 # include <errno.h>
1539 int main(void){
1540 char buf[128];
1542 if(!readlink("here", buf, sizeof buf) || errno != ENOSYS)
1543 return 0;
1544 return 1;
1547 then
1549 else
1550 feat_bail_required DOTLOCK
1554 if feat_yes DOTLOCK; then
1555 if run_check fchown 'fchown(2)' << \!
1556 #include <unistd.h>
1557 # include <errno.h>
1558 int main(void){
1559 if(!fchown(0, 0, 0) || errno != ENOSYS)
1560 return 0;
1561 return 1;
1564 then
1566 else
1567 feat_bail_required DOTLOCK
1571 ## Now it is the time to fork away the BASE_ series
1573 ${rm} -f ${tmp}
1574 squeeze_em ${inc} ${tmp}
1575 ${mv} ${tmp} ${inc}
1576 squeeze_em ${lib} ${tmp}
1577 ${mv} ${tmp} ${lib}
1579 echo "BASE_LIBS = `${cat} ${lib}`" >> ${mk}
1580 echo "BASE_INCS = `${cat} ${inc}`" >> ${mk}
1582 ## The remains are expected to be used only by the main MUA binary!
1584 link_check setlocale 'setlocale(3)' '#define HAVE_SETLOCALE' << \!
1585 #include <locale.h>
1586 int main(void){
1587 setlocale(LC_ALL, "");
1588 return 0;
1592 if [ "${have_setlocale}" = yes ]; then
1593 link_check c90amend1 'ISO/IEC 9899:1990/Amendment 1:1995' \
1594 '#define HAVE_C90AMEND1' << \!
1595 #include <limits.h>
1596 #include <stdlib.h>
1597 #include <wchar.h>
1598 #include <wctype.h>
1599 int main(void){
1600 char mbb[MB_LEN_MAX + 1];
1601 wchar_t wc;
1603 iswprint(L'c');
1604 towupper(L'c');
1605 mbtowc(&wc, "x", 1);
1606 mbrtowc(&wc, "x", 1, NULL);
1607 wctomb(mbb, wc);
1608 return (mblen("\0", 1) == 0);
1612 if [ "${have_c90amend1}" = yes ]; then
1613 link_check wcwidth 'wcwidth(3)' '#define HAVE_WCWIDTH' << \!
1614 #include <wchar.h>
1615 int main(void){
1616 wcwidth(L'c');
1617 return 0;
1622 link_check nl_langinfo 'nl_langinfo(3)' '#define HAVE_NL_LANGINFO' << \!
1623 #include <langinfo.h>
1624 #include <stdlib.h>
1625 int main(void){
1626 nl_langinfo(DAY_1);
1627 return (nl_langinfo(CODESET) == NULL);
1630 fi # have_setlocale
1632 link_check fnmatch 'fnmatch(3)' '#define HAVE_FNMATCH' << \!
1633 #include <fnmatch.h>
1634 int main(void){
1635 return (fnmatch("*", ".", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
1639 link_check dirent_d_type 'struct dirent.d_type' '#define HAVE_DIRENT_TYPE' << \!
1640 #include <dirent.h>
1641 int main(void){
1642 struct dirent de;
1643 return !(de.d_type == DT_UNKNOWN ||
1644 de.d_type == DT_DIR || de.d_type == DT_LNK);
1648 ## optional and selectable
1650 if feat_yes ICONV; then
1651 ${cat} > ${tmp2}.c << \!
1652 #include <stdio.h> /* For C89 NULL */
1653 #include <iconv.h>
1654 int main(void){
1655 iconv_t id;
1657 id = iconv_open("foo", "bar");
1658 iconv(id, NULL, NULL, NULL, NULL);
1659 iconv_close(id);
1660 return 0;
1663 < ${tmp2}.c link_check iconv 'iconv(3) functionality' \
1664 '#define HAVE_ICONV' ||
1665 < ${tmp2}.c link_check iconv 'iconv(3) functionality (via -liconv)' \
1666 '#define HAVE_ICONV' '-liconv' ||
1667 feat_bail_required ICONV
1668 else
1669 echo '/* OPT_ICONV=0 */' >> ${h}
1670 fi # feat_yes ICONV
1672 if feat_yes SOCKETS || feat_yes SPAM_SPAMD; then
1673 ${cat} > ${tmp2}.c << \!
1674 #include <sys/types.h>
1675 #include <sys/socket.h>
1676 #include <sys/un.h>
1677 # include <errno.h>
1678 int main(void){
1679 struct sockaddr_un soun;
1681 if(socket(AF_UNIX, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
1682 return 1;
1683 if(connect(0, (struct sockaddr*)&soun, 0) == -1 && errno == ENOSYS)
1684 return 1;
1685 if(shutdown(0, SHUT_RD | SHUT_WR | SHUT_RDWR) == -1 && errno == ENOSYS)
1686 return 1;
1687 return 0;
1691 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets' \
1692 '#define HAVE_UNIX_SOCKETS' ||
1693 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lnsl)' \
1694 '#define HAVE_UNIX_SOCKETS' '-lnsl' ||
1695 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lsocket -lnsl)' \
1696 '#define HAVE_UNIX_SOCKETS' '-lsocket -lnsl'
1699 if feat_yes SOCKETS; then
1700 ${cat} > ${tmp2}.c << \!
1701 #include "config.h"
1702 #include <sys/types.h>
1703 #include <sys/socket.h>
1704 #include <netinet/in.h>
1705 # include <errno.h>
1706 int main(void){
1707 struct sockaddr s;
1709 if(socket(AF_INET, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
1710 return 1;
1711 if(connect(0, &s, 0) == -1 && errno == ENOSYS)
1712 return 1;
1713 return 0;
1717 < ${tmp2}.c run_check sockets 'sockets' \
1718 '#define HAVE_SOCKETS' ||
1719 < ${tmp2}.c run_check sockets 'sockets (via -lnsl)' \
1720 '#define HAVE_SOCKETS' '-lnsl' ||
1721 < ${tmp2}.c run_check sockets 'sockets (via -lsocket -lnsl)' \
1722 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
1723 feat_bail_required SOCKETS
1724 else
1725 echo '/* OPT_SOCKETS=0 */' >> ${h}
1726 fi # feat_yes SOCKETS
1728 if feat_yes SOCKETS; then
1729 link_check getaddrinfo 'getaddrinfo(3)' \
1730 '#define HAVE_GETADDRINFO' << \!
1731 #include "config.h"
1732 #include <sys/types.h>
1733 #include <sys/socket.h>
1734 #include <stdio.h>
1735 #include <netdb.h>
1736 int main(void){
1737 struct addrinfo a, *ap;
1738 int lrv;
1740 switch((lrv = getaddrinfo("foo", "0", &a, &ap))){
1741 case EAI_NONAME:
1742 case EAI_SERVICE:
1743 default:
1744 fprintf(stderr, "%s\n", gai_strerror(lrv));
1745 case 0:
1746 break;
1748 return 0;
1753 if feat_yes SOCKETS && [ -z "${have_getaddrinfo}" ]; then
1754 compile_check arpa_inet_h '<arpa/inet.h>' \
1755 '#define HAVE_ARPA_INET_H' << \!
1756 #include "config.h"
1757 #include <sys/types.h>
1758 #include <sys/socket.h>
1759 #include <netdb.h>
1760 #include <netinet/in.h>
1761 #include <arpa/inet.h>
1764 ${cat} > ${tmp2}.c << \!
1765 #include "config.h"
1766 #include <sys/types.h>
1767 #include <sys/socket.h>
1768 #include <stdio.h>
1769 #include <string.h>
1770 #include <netdb.h>
1771 #include <netinet/in.h>
1772 #ifdef HAVE_ARPA_INET_H
1773 #include <arpa/inet.h>
1774 #endif
1775 int main(void){
1776 struct sockaddr_in servaddr;
1777 unsigned short portno;
1778 struct servent *ep;
1779 struct hostent *hp;
1780 struct in_addr **pptr;
1782 portno = 0;
1783 if((ep = getservbyname("POPPY-PORT", "tcp")) != NULL)
1784 portno = (unsigned short)ep->s_port;
1786 if((hp = gethostbyname("POPPY-HOST")) != NULL){
1787 pptr = (struct in_addr**)hp->h_addr_list;
1788 if(hp->h_addrtype != AF_INET)
1789 fprintf(stderr, "au\n");
1790 }else{
1791 switch(h_errno){
1792 case HOST_NOT_FOUND:
1793 case TRY_AGAIN:
1794 case NO_RECOVERY:
1795 case NO_DATA:
1796 break;
1797 default:
1798 fprintf(stderr, "au\n");
1799 break;
1803 memset(&servaddr, 0, sizeof servaddr);
1804 servaddr.sin_family = AF_INET;
1805 servaddr.sin_port = htons(portno);
1806 memcpy(&servaddr.sin_addr, *pptr, sizeof(struct in_addr));
1807 fprintf(stderr, "Would connect to %s:%d ...\n",
1808 inet_ntoa(**pptr), (int)portno);
1809 return 0;
1813 < ${tmp2}.c link_check gethostbyname 'get(serv|host)byname(3)' ||
1814 < ${tmp2}.c link_check gethostbyname \
1815 'get(serv|host)byname(3) (via -nsl)' '' '-lnsl' ||
1816 < ${tmp2}.c link_check gethostbyname \
1817 'get(serv|host)byname(3) (via -lsocket -nsl)' \
1818 '' '-lsocket -lnsl' ||
1819 feat_bail_required SOCKETS
1822 feat_yes SOCKETS &&
1823 run_check setsockopt 'setsockopt(2)' '#define HAVE_SETSOCKOPT' << \!
1824 #include <sys/socket.h>
1825 #include <stdlib.h>
1826 # include <errno.h>
1827 int main(void){
1828 int sockfd = 3;
1830 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, NULL, 0) == -1 &&
1831 errno == ENOSYS)
1832 return 1;
1833 return 0;
1837 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
1838 link_check so_sndtimeo 'SO_SNDTIMEO' '#define HAVE_SO_SNDTIMEO' << \!
1839 #include <sys/socket.h>
1840 #include <stdlib.h>
1841 int main(void){
1842 struct timeval tv;
1843 int sockfd = 3;
1845 tv.tv_sec = 42;
1846 tv.tv_usec = 21;
1847 setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv);
1848 setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
1849 return 0;
1853 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
1854 link_check so_linger 'SO_LINGER' '#define HAVE_SO_LINGER' << \!
1855 #include <sys/socket.h>
1856 #include <stdlib.h>
1857 int main(void){
1858 struct linger li;
1859 int sockfd = 3;
1861 li.l_onoff = 1;
1862 li.l_linger = 42;
1863 setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &li, sizeof li);
1864 return 0;
1868 if feat_yes SSL; then
1869 if link_check openssl 'OpenSSL (new style *_client_method(3ssl))' \
1870 '#define HAVE_SSL
1871 #define HAVE_OPENSSL 10100' '-lssl -lcrypto' << \!
1872 #include <openssl/ssl.h>
1873 #include <openssl/err.h>
1874 #include <openssl/x509v3.h>
1875 #include <openssl/x509.h>
1876 #include <openssl/rand.h>
1877 #ifdef OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
1878 # error We need TLSv1.
1879 #endif
1880 int main(void){
1881 SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
1883 SSL_CTX_free(ctx);
1884 PEM_read_PrivateKey(0, 0, 0, 0);
1885 return 0;
1888 then
1890 elif link_check openssl 'OpenSSL (old style *_client_method(3ssl))' \
1891 '#define HAVE_SSL
1892 #define HAVE_OPENSSL 10000' '-lssl -lcrypto' << \!
1893 #include <openssl/ssl.h>
1894 #include <openssl/err.h>
1895 #include <openssl/x509v3.h>
1896 #include <openssl/x509.h>
1897 #include <openssl/rand.h>
1898 #if defined OPENSSL_NO_SSL3 &&\
1899 defined OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
1900 # error We need one of SSLv3 and TLSv1.
1901 #endif
1902 int main(void){
1903 SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
1905 SSL_CTX_free(ctx);
1906 PEM_read_PrivateKey(0, 0, 0, 0);
1907 return 0;
1910 then
1912 else
1913 feat_bail_required SSL
1916 if [ "${have_openssl}" = 'yes' ]; then
1917 compile_check stack_of 'OpenSSL STACK_OF()' \
1918 '#define HAVE_OPENSSL_STACK_OF' << \!
1919 #include <stdio.h> /* For C89 NULL */
1920 #include <openssl/ssl.h>
1921 #include <openssl/err.h>
1922 #include <openssl/x509v3.h>
1923 #include <openssl/x509.h>
1924 #include <openssl/rand.h>
1925 int main(void){
1926 STACK_OF(GENERAL_NAME) *gens = NULL;
1928 printf("%p", gens); /* to use it */
1929 return 0;
1933 link_check ossl_conf 'OpenSSL_modules_load_file() support' \
1934 '#define HAVE_OPENSSL_CONFIG' << \!
1935 #include <stdio.h> /* For C89 NULL */
1936 #include <openssl/conf.h>
1937 int main(void){
1938 CONF_modules_load_file(NULL, NULL, CONF_MFLAGS_IGNORE_MISSING_FILE);
1939 CONF_modules_free();
1940 return 0;
1944 link_check ossl_conf_ctx 'OpenSSL SSL_CONF_CTX support' \
1945 '#define HAVE_OPENSSL_CONF_CTX' << \!
1946 #include "config.h"
1947 #include <openssl/ssl.h>
1948 #include <openssl/err.h>
1949 int main(void){
1950 #if HAVE_OPENSSL < 10100
1951 SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
1952 #else
1953 SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
1954 #endif
1955 SSL_CONF_CTX *cctx = SSL_CONF_CTX_new();
1957 SSL_CONF_CTX_set_flags(cctx,
1958 SSL_CONF_FLAG_FILE | SSL_CONF_FLAG_CLIENT |
1959 SSL_CONF_FLAG_CERTIFICATE | SSL_CONF_FLAG_SHOW_ERRORS);
1960 SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
1961 SSL_CONF_cmd(cctx, "Protocol", "ALL");
1962 SSL_CONF_CTX_finish(cctx);
1963 SSL_CONF_CTX_free(cctx);
1964 SSL_CTX_free(ctx);
1965 return 0;
1969 link_check rand_egd 'OpenSSL RAND_egd(3ssl)' \
1970 '#define HAVE_OPENSSL_RAND_EGD' << \!
1971 #include <openssl/rand.h>
1972 int main(void){
1973 return RAND_egd("some.where") > 0;
1977 if feat_yes SSL_ALL_ALGORITHMS; then
1978 if link_check ssl_all_algo 'OpenSSL all-algorithms support' \
1979 '#define HAVE_SSL_ALL_ALGORITHMS' << \!
1980 #include <openssl/evp.h>
1981 int main(void){
1982 OpenSSL_add_all_algorithms();
1983 EVP_get_cipherbyname("two cents i never exist");
1984 EVP_cleanup();
1985 return 0;
1988 then
1990 else
1991 feat_bail_required SSL_ALL_ALGORITHMS
1993 fi # SSL_ALL_ALGORITHMS
1995 if feat_yes MD5 && feat_no NOEXTMD5; then
1996 run_check openssl_md5 'MD5 digest in OpenSSL' \
1997 '#define HAVE_OPENSSL_MD5' << \!
1998 #include <stdlib.h>
1999 #include <string.h>
2000 #include <openssl/md5.h>
2001 int main(void){
2002 char const dat[] = "abrakadabrafidibus";
2003 char dig[16], hex[16 * 2];
2004 MD5_CTX ctx;
2005 size_t i, j;
2007 memset(dig, 0, sizeof(dig));
2008 memset(hex, 0, sizeof(hex));
2009 MD5_Init(&ctx);
2010 MD5_Update(&ctx, dat, sizeof(dat) - 1);
2011 MD5_Final(dig, &ctx);
2013 #define hexchar(n) ((n) > 9 ? (n) - 10 + 'a' : (n) + '0')
2014 for(i = 0; i < sizeof(hex) / 2; i++){
2015 j = i << 1;
2016 hex[j] = hexchar((dig[i] & 0xf0) >> 4);
2017 hex[++j] = hexchar(dig[i] & 0x0f);
2019 return !!memcmp("6d7d0a3d949da2e96f2aa010f65d8326", hex, sizeof(hex));
2022 fi # feat_yes MD5 && feat_no NOEXTMD5
2024 else
2025 echo '/* OPT_SSL=0 */' >> ${h}
2026 fi # feat_yes SSL
2028 if feat_yes SMTP; then
2029 echo '#define HAVE_SMTP' >> ${h}
2030 else
2031 echo '/* OPT_SMTP=0 */' >> ${h}
2034 if feat_yes POP3; then
2035 echo '#define HAVE_POP3' >> ${h}
2036 else
2037 echo '/* OPT_POP3=0 */' >> ${h}
2040 if feat_yes GSSAPI; then
2041 ${cat} > ${tmp2}.c << \!
2042 #include <gssapi/gssapi.h>
2043 int main(void){
2044 gss_import_name(0, 0, GSS_C_NT_HOSTBASED_SERVICE, 0);
2045 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2046 return 0;
2049 ${sed} -e '1s/gssapi\///' < ${tmp2}.c > ${tmp3}.c
2051 if command -v krb5-config >/dev/null 2>&1; then
2052 i=`command -v krb5-config`
2053 GSS_LIBS="`CFLAGS= ${i} --libs gssapi`"
2054 GSS_INCS="`CFLAGS= ${i} --cflags`"
2055 i='GSS-API via krb5-config(1)'
2056 else
2057 GSS_LIBS='-lgssapi'
2058 GSS_INCS=
2059 i='GSS-API in gssapi/gssapi.h, libgssapi'
2061 if < ${tmp2}.c link_check gss \
2062 "${i}" '#define HAVE_GSSAPI' "${GSS_LIBS}" "${GSS_INCS}" ||\
2063 < ${tmp3}.c link_check gss \
2064 'GSS-API in gssapi.h, libgssapi' \
2065 '#define HAVE_GSSAPI
2066 #define GSSAPI_REG_INCLUDE' \
2067 '-lgssapi' ||\
2068 < ${tmp2}.c link_check gss 'GSS-API in libgssapi_krb5' \
2069 '#define HAVE_GSSAPI' \
2070 '-lgssapi_krb5' ||\
2071 < ${tmp3}.c link_check gss \
2072 'GSS-API in libgssapi, OpenBSD-style (pre 5.3)' \
2073 '#define HAVE_GSSAPI
2074 #define GSS_REG_INCLUDE' \
2075 '-lgssapi -lkrb5 -lcrypto' \
2076 '-I/usr/include/kerberosV' ||\
2077 < ${tmp2}.c link_check gss 'GSS-API in libgss' \
2078 '#define HAVE_GSSAPI' \
2079 '-lgss' ||\
2080 link_check gss 'GSS-API in libgssapi_krb5, old-style' \
2081 '#define HAVE_GSSAPI
2082 #define GSSAPI_OLD_STYLE' \
2083 '-lgssapi_krb5' << \!
2084 #include <gssapi/gssapi.h>
2085 #include <gssapi/gssapi_generic.h>
2086 int main(void){
2087 gss_import_name(0, 0, gss_nt_service_name, 0);
2088 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2089 return 0;
2092 then
2094 else
2095 feat_bail_required GSSAPI
2097 else
2098 echo '/* OPT_GSSAPI=0 */' >> ${h}
2099 fi # feat_yes GSSAPI
2101 if feat_yes NETRC; then
2102 echo '#define HAVE_NETRC' >> ${h}
2103 else
2104 echo '/* OPT_NETRC=0 */' >> ${h}
2107 if feat_yes AGENT; then
2108 echo '#define HAVE_AGENT' >> ${h}
2109 else
2110 echo '/* OPT_AGENT=0 */' >> ${h}
2113 if feat_yes IDNA; then
2114 if link_check idna 'GNU Libidn' '#define HAVE_IDNA HAVE_IDNA_LIBIDNA' \
2115 '-lidn' << \!
2116 #include <idna.h>
2117 #include <idn-free.h>
2118 #include <stringprep.h>
2119 int main(void){
2120 char *utf8, *idna_ascii, *idna_utf8;
2122 utf8 = stringprep_locale_to_utf8("does.this.work");
2123 if (idna_to_ascii_8z(utf8, &idna_ascii, IDNA_USE_STD3_ASCII_RULES)
2124 != IDNA_SUCCESS)
2125 return 1;
2126 idn_free(idna_ascii);
2127 /* (Rather link check only here) */
2128 idna_utf8 = stringprep_convert(idna_ascii, "UTF-8", "de_DE");
2129 return 0;
2132 then
2134 elif link_check idna 'idnkit' '#define HAVE_IDNA HAVE_IDNA_IDNKIT' \
2135 '-lidnkit' << \!
2136 #include <stdio.h>
2137 #include <idn/api.h>
2138 #include <idn/result.h>
2139 int main(void){
2140 idn_result_t r;
2141 char ace_name[256];
2142 char local_name[256];
2144 r = idn_encodename(IDN_ENCODE_APP, "does.this.work", ace_name,
2145 sizeof(ace_name));
2146 if (r != idn_success) {
2147 fprintf(stderr, "idn_encodename failed: %s\n", idn_result_tostring(r));
2148 return 1;
2150 r = idn_decodename(IDN_DECODE_APP, ace_name, local_name, sizeof(local_name));
2151 if (r != idn_success) {
2152 fprintf(stderr, "idn_decodename failed: %s\n", idn_result_tostring(r));
2153 return 1;
2155 return 0;
2158 then
2160 else
2161 feat_bail_required IDNA
2164 if [ -n "${have_idna}" ]; then
2165 echo '#define HAVE_IDNA_LIBIDNA 0' >> ${h}
2166 echo '#define HAVE_IDNA_IDNKIT 1' >> ${h}
2168 else
2169 echo '/* OPT_IDNA=0 */' >> ${h}
2172 if feat_yes IMAP_SEARCH; then
2173 echo '#define HAVE_IMAP_SEARCH' >> ${h}
2174 else
2175 echo '/* OPT_IMAP_SEARCH=0 */' >> ${h}
2178 if feat_yes REGEX; then
2179 if link_check regex 'regular expressions' '#define HAVE_REGEX' << \!
2180 #include <regex.h>
2181 #include <stdlib.h>
2182 int main(void){
2183 int status;
2184 regex_t re;
2186 if (regcomp(&re, ".*bsd", REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
2187 return 1;
2188 status = regexec(&re, "plan9", 0,NULL, 0);
2189 regfree(&re);
2190 return !(status == REG_NOMATCH);
2193 then
2195 else
2196 feat_bail_required REGEX
2198 else
2199 echo '/* OPT_REGEX=0 */' >> ${h}
2202 if feat_yes READLINE; then
2203 __edrdlib() {
2204 link_check readline "for readline(3) (${1})" \
2205 '#define HAVE_READLINE' "${1}" << \!
2206 #include <stdio.h>
2207 #include <readline/history.h>
2208 #include <readline/readline.h>
2209 int main(void){
2210 char *rl;
2211 HISTORY_STATE *hs;
2212 HIST_ENTRY **he;
2213 int i;
2215 using_history();
2216 read_history("");
2217 stifle_history(242);
2218 rl = readline("Enter a line:");
2219 if (rl && *rl)
2220 add_history(rl);
2221 write_history("");
2222 rl_extend_line_buffer(10);
2223 rl_point = rl_end = 10;
2224 rl_pre_input_hook = (rl_hook_func_t*)NULL;
2225 rl_forced_update_display();
2226 clear_history();
2227 hs = history_get_history_state();
2228 i = hs->length;
2229 he = history_list();
2230 if (i > 0)
2231 rl = he[0]->line;
2232 rl_free_line_state();
2233 rl_cleanup_after_signal();
2234 rl_reset_after_signal();
2235 return 0;
2240 __edrdlib -lreadline ||
2241 __edrdlib '-lreadline -ltermcap' || feat_bail_required READLINE
2244 if feat_yes MLE && [ -z "${have_readline}" ] &&
2245 [ -n "${have_c90amend1}" ]; then
2246 have_mle=1
2247 echo '#define HAVE_MLE' >> ${h}
2248 else
2249 feat_bail_required MLE
2250 echo '/* OPT_{READLINE,MLE}=0 */' >> ${h}
2253 # Generic have-a-line-editor switch for those who need it below
2254 if [ -n "${have_mle}" ] ||
2255 [ -n "${have_readline}" ]; then
2256 have_cle=1
2259 if [ -n "${have_cle}" ] && feat_yes HISTORY; then
2260 echo '#define HAVE_HISTORY' >> ${h}
2261 else
2262 echo '/* OPT_HISTORY=0 */' >> ${h}
2265 if [ -n "${have_mle}" ] && feat_yes KEY_BINDINGS; then
2266 echo '#define HAVE_KEY_BINDINGS' >> ${h}
2267 else
2268 echo '/* OPT_KEY_BINDINGS=0 */' >> ${h}
2271 if feat_yes TERMCAP; then
2272 __termcaplib() {
2273 link_check termcap "termcap(5) (via ${4})" \
2274 "#define HAVE_TERMCAP${3}" "${1}" << _EOT
2275 #include <stdio.h>
2276 #include <stdlib.h>
2277 ${2}
2278 #include <term.h>
2279 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
2280 static int my_putc(int c){return putchar(c);}
2281 int main(void){
2282 char buf[1024+512], cmdbuf[2048], *cpb, *r1;
2283 int r2 = OK, r3 = ERR;
2285 tgetent(buf, getenv("TERM"));
2286 cpb = cmdbuf;
2287 r1 = tgetstr(UNCONST("cm"), &cpb);
2288 tgoto(r1, 1, 1);
2289 r2 = tgetnum(UNCONST("Co"));
2290 r3 = tgetflag(UNCONST("ut"));
2291 tputs("cr", 1, &my_putc);
2292 return (r1 == NULL || r2 == -1 || r3 == 0);
2294 _EOT
2297 __terminfolib() {
2298 link_check terminfo "terminfo(5) (via ${2})" \
2299 '#define HAVE_TERMCAP
2300 #define HAVE_TERMCAP_CURSES
2301 #define HAVE_TERMINFO' "${1}" << _EOT
2302 #include <stdio.h>
2303 #include <curses.h>
2304 #include <term.h>
2305 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
2306 static int my_putc(int c){return putchar(c);}
2307 int main(void){
2308 int er, r0, r1, r2;
2309 char *r3, *tp;
2311 er = OK;
2312 r0 = setupterm(NULL, 1, &er);
2313 r1 = tigetflag(UNCONST("bce"));
2314 r2 = tigetnum(UNCONST("colors"));
2315 r3 = tigetstr(UNCONST("cr"));
2316 tp = tparm(r3, NULL);
2317 tputs(tp, 1, &my_putc);
2318 return (r0 == ERR || r1 == -1 || r2 == -2 || r2 == -1 ||
2319 r3 == (char*)-1 || r3 == NULL);
2321 _EOT
2324 if feat_yes TERMCAP_PREFER_TERMINFO; then
2325 __terminfolib -ltinfo -ltinfo ||
2326 __terminfolib -lcurses -lcurses ||
2327 __terminfolib -lcursesw -lcursesw ||
2328 feat_bail_required TERMCAP_PREFER_TERMINFO
2331 if [ -z "${have_terminfo}" ]; then
2332 __termcaplib -ltermcap '' '' '-ltermcap' ||
2333 __termcaplib -ltermcap '#include <curses.h>' '
2334 #define HAVE_TERMCAP_CURSES' \
2335 'curses.h / -ltermcap' ||
2336 __termcaplib -lcurses '#include <curses.h>' '
2337 #define HAVE_TERMCAP_CURSES' \
2338 'curses.h / -lcurses' ||
2339 __termcaplib -lcursesw '#include <curses.h>' '
2340 #define HAVE_TERMCAP_CURSES' \
2341 'curses.h / -lcursesw' ||
2342 feat_bail_required TERMCAP
2344 if [ -n "${have_termcap}" ]; then
2345 run_check tgetent_null \
2346 "tgetent(3) of termcap(5) takes NULL buffer" \
2347 "#define HAVE_TGETENT_NULL_BUF" << _EOT
2348 #include <stdio.h> /* For C89 NULL */
2349 #include <stdlib.h>
2350 #ifdef HAVE_TERMCAP_CURSES
2351 # include <curses.h>
2352 #endif
2353 #include <term.h>
2354 int main(void){
2355 tgetent(NULL, getenv("TERM"));
2356 return 0;
2358 _EOT
2361 else
2362 echo '/* OPT_TERMCAP=0 */' >> ${h}
2363 echo '/* OPT_TERMCAP_PREFER_TERMINFO=0 */' >> ${h}
2366 if feat_yes SPAM_SPAMC; then
2367 echo '#define HAVE_SPAM_SPAMC' >> ${h}
2368 if command -v spamc >/dev/null 2>&1; then
2369 echo "#define SPAM_SPAMC_PATH \"`command -v spamc`\"" >> ${h}
2371 else
2372 echo '/* OPT_SPAM_SPAMC=0 */' >> ${h}
2375 if feat_yes SPAM_SPAMD && [ -n "${have_af_unix}" ]; then
2376 echo '#define HAVE_SPAM_SPAMD' >> ${h}
2377 else
2378 feat_bail_required SPAM_SPAMD
2379 echo '/* OPT_SPAM_SPAMD=0 */' >> ${h}
2382 feat_def SPAM_FILTER
2384 if feat_yes SPAM_SPAMC || feat_yes SPAM_SPAMD || feat_yes SPAM_FILTER; then
2385 echo '#define HAVE_SPAM' >> ${h}
2386 else
2387 echo '/* HAVE_SPAM */' >> ${h}
2390 if feat_yes QUOTE_FOLD &&\
2391 [ -n "${have_c90amend1}" ] && [ -n "${have_wcwidth}" ]; then
2392 echo '#define HAVE_QUOTE_FOLD' >> ${h}
2393 else
2394 feat_bail_required QUOTE_FOLD
2395 echo '/* OPT_QUOTE_FOLD=0 */' >> ${h}
2398 feat_def FILTER_HTML_TAGSOUP
2399 feat_def COLOUR
2400 feat_def DOTLOCK
2401 feat_def MD5
2402 feat_def NOMEMDBG
2404 ## Summarizing
2406 ${rm} -f ${tmp}
2407 squeeze_em ${inc} ${tmp}
2408 ${mv} ${tmp} ${inc}
2409 squeeze_em ${lib} ${tmp}
2410 ${mv} ${tmp} ${lib}
2412 # config.h
2413 ${mv} ${h} ${tmp}
2414 printf '#ifndef n_CONFIG_H\n# define n_CONFIG_H 1\n' > ${h}
2415 ${cat} ${tmp} >> ${h}
2416 ${rm} -f ${tmp}
2418 printf '\n/* The "feature string" */\n' >> ${h}
2419 printf '# if defined _ACCMACVAR_SOURCE || defined HAVE_AMALGAMATION\n' >> ${h}
2420 printf 'static char const _features[] = "MIME"\n' >> ${h}
2421 printf '# ifdef HAVE_SETLOCALE\n ",LOCALES"\n# endif\n' >> ${h}
2422 printf '# ifdef HAVE_C90AMEND1\n ",MULTIBYTE CHARSETS"\n# endif\n' >> ${h}
2423 printf '# ifdef HAVE_NL_LANGINFO\n ",TERMINAL CHARSET"\n# endif\n' >> ${h}
2424 printf '# ifdef HAVE_ICONV\n ",ICONV"\n# endif\n' >> ${h}
2425 printf '# ifdef HAVE_SOCKETS\n ",NETWORK"\n# endif\n' >> ${h}
2426 printf '# ifdef HAVE_SSL\n ",S/MIME,SSL/TLS"\n# endif\n' >> ${h}
2427 printf '# ifdef HAVE_SSL_ALL_ALGORITHMS\n ",SSL-ALL-ALGORITHMS"\n# endif\n'\
2428 >> ${h}
2429 printf '# ifdef HAVE_SMTP\n ",SMTP"\n# endif\n' >> ${h}
2430 printf '# ifdef HAVE_POP3\n ",POP3"\n# endif\n' >> ${h}
2431 printf '# ifdef HAVE_GSSAPI\n ",GSS-API"\n# endif\n' >> ${h}
2432 printf '# ifdef HAVE_MD5\n ",MD5 [APOP,CRAM-MD5]"\n# endif\n' >> ${h}
2433 printf '# ifdef HAVE_NETRC\n ",NETRC"\n# endif\n' >> ${h}
2434 printf '# ifdef HAVE_IDNA\n ",IDNA"\n# endif\n' >> ${h}
2435 printf '# ifdef HAVE_IMAP_SEARCH\n ",IMAP-SEARCH"\n# endif\n' >> ${h}
2436 printf '# ifdef HAVE_REGEX\n ",REGEX"\n# endif\n' >> ${h}
2437 printf '# ifdef HAVE_READLINE\n ",READLINE"\n# endif\n' >> ${h}
2438 printf '# ifdef HAVE_MLE\n ",MLE"\n# endif\n' >> ${h}
2439 printf '# ifdef HAVE_WCWIDTH\n " (WIDE GLYPHS)"\n# endif\n' >> ${h}
2440 printf '# ifdef HAVE_HISTORY\n ",HISTORY"\n# endif\n' >> ${h}
2441 printf '# ifdef HAVE_KEY_BINDINGS\n ",KEY-BINDINGS"\n# endif\n' >> ${h}
2442 printf '# ifdef HAVE_TERMCAP\n ",TERMCAP"\n# endif\n' >> ${h}
2443 printf '# ifdef HAVE_TERMINFO\n " (terminfo(5))"\n# endif\n' >> ${h}
2444 printf '# ifdef HAVE_SPAM_SPAMC\n ",SPAMC"\n# endif\n' >> ${h}
2445 printf '# ifdef HAVE_SPAM_SPAMD\n ",SPAMD"\n# endif\n' >> ${h}
2446 printf '# ifdef HAVE_SPAM_FILTER\n ",SPAMFILTER"\n# endif\n' >> ${h}
2447 printf '# ifdef HAVE_DOCSTRINGS\n ",DOCSTRINGS"\n# endif\n' >> ${h}
2448 printf '# ifdef HAVE_QUOTE_FOLD\n ",QUOTE-FOLD"\n# endif\n' >> ${h}
2449 printf '# ifdef HAVE_FILTER_HTML_TAGSOUP\n ",HTML-FILTER"\n# endif\n' >> ${h}
2450 printf '# ifdef HAVE_COLOUR\n ",COLOUR"\n# endif\n' >> ${h}
2451 printf '# ifdef HAVE_DOTLOCK\n ",DOTLOCK-FILES"\n# endif\n' >> ${h}
2452 printf '# ifdef HAVE_DEBUG\n ",DEBUG"\n# endif\n' >> ${h}
2453 printf '# ifdef HAVE_DEVEL\n ",DEVEL"\n# endif\n' >> ${h}
2454 printf '# ifdef HAVE_CROSS_BUILD\n ",CROSS-BUILD"\n# endif\n' >> ${h}
2455 printf ';\n# endif /* _ACCMACVAR_SOURCE || HAVE_AMALGAMATION */\n' >> ${h}
2457 # Create the real mk.mk
2458 # Note we cannout use explicit ./ filename prefix for source and object
2459 # pathnames because of a bug in bmake(1)
2460 ${rm} -rf ${tmp0}.* ${tmp0}*
2461 printf 'OBJ_SRC = ' >> ${mk}
2462 if feat_no AMALGAMATION; then
2463 for i in `printf '%s\n' *.c | ${sort}`; do
2464 if [ "${i}" = privsep.c ]; then
2465 continue
2467 printf "${i} " >> ${mk}
2468 done
2469 printf '\nAMALGAM_TARGET =\nAMALGAM_DEP =\n' >> ${mk}
2470 else
2471 printf 'main.c\nAMALGAM_TARGET = main.o\nAMALGAM_DEP = ' >> ${mk}
2473 printf '\n/* HAVE_AMALGAMATION: include sources */\n' >> ${h}
2474 printf '#elif _CONFIG_H + 0 == 1\n' >> ${h}
2475 printf '# undef _CONFIG_H\n' >> ${h}
2476 printf '# define _CONFIG_H 2\n' >> ${h}
2477 for i in `printf '%s\n' *.c | ${sort}`; do
2478 if [ "${i}" = "${j}" ] || [ "${i}" = main.c ] || \
2479 [ "${i}" = privsep.c ]; then
2480 continue
2482 printf "${i} " >> ${mk}
2483 printf "# include \"${i}\"\n" >> ${h}
2484 done
2485 echo >> ${mk}
2486 # tcc(1) fails on 2015-11-13 unless this #else clause existed
2487 echo '#else' >> ${h}
2490 printf '#endif /* n_CONFIG_H */\n' >> ${h}
2492 echo "LIBS = `${cat} ${lib}`" >> ${mk}
2493 echo "INCS = `${cat} ${inc}`" >> ${mk}
2494 echo >> ${mk}
2495 ${cat} ./mk-mk.in >> ${mk}
2497 ## Finished!
2499 ${cat} > ${tmp2}.c << \!
2500 #include "config.h"
2502 :The following optional features are enabled:
2503 #ifdef HAVE_SETLOCALE
2504 : + Locale support: Printable characters depend on the environment
2505 # ifdef HAVE_C90AMEND1
2506 : + Multibyte character support
2507 # endif
2508 # ifdef HAVE_NL_LANGINFO
2509 : + Automatic detection of terminal character set
2510 # endif
2511 #endif
2512 #ifdef HAVE_ICONV
2513 : + Character set conversion using iconv()
2514 #endif
2515 #ifdef HAVE_SOCKETS
2516 : + Network support
2517 #endif
2518 #ifdef HAVE_SSL
2519 # ifdef HAVE_OPENSSL
2520 : + S/MIME and SSL/TLS (OpenSSL)
2521 # endif
2522 # ifdef HAVE_SSL_ALL_ALGORITHMS
2523 : + + Support for more ("all") digest and cipher algorithms
2524 # endif
2525 #endif
2526 #ifdef HAVE_SMTP
2527 : + SMTP protocol
2528 #endif
2529 #ifdef HAVE_POP3
2530 : + POP3 protocol
2531 #endif
2532 #ifdef HAVE_GSSAPI
2533 : + GSS-API authentication
2534 #endif
2535 #ifdef HAVE_MD5
2536 : + MD5 message digest (APOP, CRAM-MD5)
2537 #endif
2538 #ifdef HAVE_NETRC
2539 : + .netrc file support
2540 #endif
2541 #ifdef HAVE_IDNA
2542 : + IDNA (internationalized domain names for applications) support
2543 #endif
2544 #ifdef HAVE_IMAP_SEARCH
2545 : + IMAP-style search expressions
2546 #endif
2547 #ifdef HAVE_REGEX
2548 : + Regular expression support (searches, conditional expressions etc.)
2549 #endif
2550 #if defined HAVE_READLINE || defined HAVE_MLE
2551 # ifdef HAVE_READLINE
2552 : + Command line editing via readline(3)
2553 # else
2554 # ifdef HAVE_WCWIDTH
2555 : + Command line editing via M(ailx)-L(ine)-E(ditor) (wide glyph support)
2556 # else
2557 : + Command line editing via M(ailx)-L(ine)-E(ditor) (no wide glyph support)
2558 # endif
2559 # endif
2560 # ifdef HAVE_HISTORY
2561 : + + History management
2562 # endif
2563 # ifdef HAVE_KEY_BINDINGS
2564 : + + Configurable key bindings
2565 # endif
2566 #endif
2567 #ifdef HAVE_TERMCAP
2568 # ifdef HAVE_TERMINFO
2569 : + Terminal capability queries (terminfo(5))
2570 # else
2571 : + Terminal capability queries (termcap(5))
2572 # endif
2573 #endif
2574 #ifdef HAVE_SPAM
2575 : + Spam management
2576 # ifdef HAVE_SPAM_SPAMC
2577 : + + Via spamc(1) (of spamassassin(1))
2578 # endif
2579 # ifdef HAVE_SPAM_SPAMD
2580 : + + Directly via spamd(1) (of spamassassin(1))
2581 # endif
2582 # ifdef HAVE_SPAM_FILTER
2583 : + + Via freely configurable *spam-filter-XY*s
2584 # endif
2585 #endif
2586 #ifdef HAVE_DOCSTRINGS
2587 : + Documentation summary strings
2588 #endif
2589 #ifdef HAVE_QUOTE_FOLD
2590 : + Extended *quote-fold*ing
2591 #endif
2592 #ifdef HAVE_FILTER_HTML_TAGSOUP
2593 : + Builtin HTML-to-text filter (for display purposes, primitive)
2594 #endif
2595 #ifdef HAVE_COLOUR
2596 : + Coloured message display (simple)
2597 #endif
2598 #ifdef HAVE_DOTLOCK
2599 : + Dotlock files and privilege-separated file dotlock program
2600 #endif
2602 :The following optional features are disabled:
2603 #ifndef HAVE_SETLOCALE
2604 : - Locale support: Only ASCII characters are recognized
2605 #endif
2606 # ifndef HAVE_C90AMEND1
2607 : - Multibyte character support
2608 # endif
2609 # ifndef HAVE_NL_LANGINFO
2610 : - Automatic detection of terminal character set
2611 # endif
2612 #ifndef HAVE_ICONV
2613 : - Character set conversion using iconv()
2614 : _ (Ooooh, no iconv(3), NO character set conversion possible! Really...)
2615 #endif
2616 #ifndef HAVE_SOCKETS
2617 : - Network support
2618 #endif
2619 #ifndef HAVE_SSL
2620 : - S/MIME and SSL/TLS
2621 #else
2622 # ifndef HAVE_SSL_ALL_ALGORITHMS
2623 : - Support for more S/MIME and SSL/TLS digest and cipher algorithms
2624 # endif
2625 #endif
2626 #ifndef HAVE_SMTP
2627 : - SMTP protocol
2628 #endif
2629 #ifndef HAVE_POP3
2630 : - POP3 protocol
2631 #endif
2632 #ifndef HAVE_GSSAPI
2633 : - GSS-API authentication
2634 #endif
2635 #ifndef HAVE_MD5
2636 : - MD5 message digest (APOP, CRAM-MD5)
2637 #endif
2638 #ifndef HAVE_NETRC
2639 : - .netrc file support
2640 #endif
2641 #ifndef HAVE_IDNA
2642 : - IDNA (internationalized domain names for applications) support
2643 #endif
2644 #ifndef HAVE_IMAP_SEARCH
2645 : - IMAP-style search expressions
2646 #endif
2647 #ifndef HAVE_REGEX
2648 : - Regular expression support
2649 #endif
2650 #if !defined HAVE_READLINE && !defined HAVE_MLE
2651 : - Command line editing and history
2652 #else
2653 # ifndef HAVE_HISTORY
2654 : + (Command line editing) - History management
2655 # endif
2656 # ifndef HAVE_KEY_BINDINGS
2657 : + (Command line editing) - Configurable key bindings
2658 # endif
2659 #endif
2660 #ifndef HAVE_TERMCAP
2661 : - Terminal capability queries
2662 #endif
2663 #ifndef HAVE_SPAM
2664 : - Spam management
2665 #endif
2666 #ifndef HAVE_DOCSTRINGS
2667 : - Documentation summary strings
2668 #endif
2669 #ifndef HAVE_QUOTE_FOLD
2670 : - Extended *quote-fold*ing
2671 #endif
2672 #ifndef HAVE_FILTER_HTML_TAGSOUP
2673 : - Builtin HTML-to-text filter (for display purposes, primitive)
2674 #endif
2675 #ifndef HAVE_COLOUR
2676 : - Coloured message display (simple)
2677 #endif
2678 #ifndef HAVE_DOTLOCK
2679 : - Dotlock files and privilege-separated file dotlock program
2680 #endif
2682 #if !defined HAVE_FNMATCH || !defined HAVE_FCHDIR ||\
2683 defined HAVE_DEBUG || defined HAVE_DEVEL
2684 :Remarks:
2685 # ifndef HAVE_FNMATCH
2686 : . The function fnmatch(3) could not be found.
2687 : _ Filename patterns like wildcard are not supported on your system.
2688 # endif
2689 # ifndef HAVE_FCHDIR
2690 : . The function fchdir(2) could not be found. We will use chdir(2)
2691 : _ instead. This is not a problem unless the current working
2692 : _ directory is changed while this program is inside of it.
2693 # endif
2694 # ifdef HAVE_DEBUG
2695 : . Debug enabled binary: not meant to be used by end-users: THANKS!
2696 # endif
2697 # ifdef HAVE_DEVEL
2698 : . Computers do not blunder.
2699 # endif
2701 #endif /* Remarks */
2702 :Setup:
2703 : . System-wide resource file: VAL_SYSCONFDIR/VAL_SYSCONFRC
2704 : . bindir: VAL_BINDIR
2705 #ifdef HAVE_DOTLOCK
2706 : . libexecdir: VAL_LIBEXECDIR
2707 #endif
2708 : . mandir: VAL_MANDIR
2709 : . MTA: VAL_MTA (argv[0] = VAL_MTA_ARGV0)
2710 : . $MAIL spool directory: VAL_MAIL
2714 ${make} -f ${makefile} ${tmp2}.x
2715 < ${tmp2}.x ${sed} -e '/^[^:]/d; /^$/d; s/^://' |
2716 while read l; do
2717 msg "${l}"
2718 done
2720 # s-it-mode