2 #@ Please see INSTALL and make.rc instead.
7 # For heaven's sake auto-redirect on SunOS/Solaris
8 if [ "x${SHELL}" = x
] ||
[ "${SHELL}" = /bin
/sh
] && \
9 [ -f /usr
/xpg
4/bin
/sh
] && [ -x /usr
/xpg
4/bin
/sh
]; then
10 SHELL
=/usr
/xpg
4/bin
/sh
12 exec /usr
/xpg
4/bin
/sh
"${0}" "${@}"
14 [ -n "${SHELL}" ] || SHELL
=/bin
/sh
17 # The feature set, to be kept in sync with make.rc
18 # If no documentation given, the option is used as such; if doc is a hyphen,
19 # entry is suppressed when configuration overview is printed, and also in the
20 # *features* string: most likely for obsolete features etc.
22 ICONV='Character set conversion using iconv(3)' \
23 SOCKETS='Network support' \
24 SSL='SSL/TLS (OpenSSL / LibreSSL)' \
25 SSL_ALL_ALGORITHMS='Support of all digest and cipher algorithms' \
26 SMTP='Simple Mail Transfer Protocol client' \
27 POP3='Post Office Protocol Version 3 client' \
28 IMAP='IMAP v4r1 client' \
29 GSSAPI='Generic Security Service authentication' \
30 NETRC='.netrc file support' \
32 MD5='MD5 message digest (APOP, CRAM-MD5)' \
33 IDNA='Internationalized Domain Names for Applications (encode only)' \
34 IMAP_SEARCH='IMAP-style search expressions' \
35 REGEX='Regular expressions' \
36 MLE='Mailx Line Editor' \
37 HISTORY='Line editor history management' \
38 KEY_BINDINGS='Configurable key bindings' \
39 TERMCAP='Terminal capability queries (termcap(5))' \
40 TERMCAP_VIA_TERMINFO='Terminal capability queries use terminfo(5)' \
41 ERRORS='Log message ring' \
42 SPAM_SPAMC='Spam management via spamc(1) of spamassassin(1)' \
44 SPAM_FILTER='Freely configurable *spam-filter-..*s' \
45 DOCSTRINGS='Command documentation help strings' \
46 UISTRINGS='User interface and error message strings' \
47 QUOTE_FOLD='Extended *quote-fold*ing' \
48 FILTER_HTML_TAGSOUP='Simple built-in HTML-to-text display filter' \
49 COLOUR='Coloured message display' \
50 DOTLOCK='Dotlock files and privilege-separated dotlock program' \
53 # Options which are automatically deduced from host environment, i.e., these
54 # need special treatment all around here to warp from/to OPT_ stuff
55 # setlocale, C90AMEND1, NL_LANGINFO, wcwidth
57 LOCALES='Locale support - printable characters etc. depend on environment' \
58 MULTIBYTE_CHARSETS='Multibyte character sets' \
59 TERMINAL_CHARSET='Automatic detection of terminal character set' \
60 WIDE_GLYPHS='Wide glyph support' \
63 # Rather special options, for custom building, or which always exist.
64 # Mostly for generating the visual overview and the *features* string
66 MIME='Multipurpose Internet Mail Extensions' \
67 SMIME='S/MIME message signing, verification, en- and decryption' \
68 CROSS_BUILD='Cross-compilation: trust any detected environment' \
69 DEBUG='Debug enabled binary, not for end-users: THANKS!' \
70 DEVEL='Computers do not blunder' \
73 # To avoid too many recompilations we use a two-stage "configuration changed"
74 # detection, the first uses mk-config.lst, which only goes for actual user
75 # config settings etc. the second uses mk-config.h, which thus includes the
76 # things we have truly detected. This does not work well for multiple choice
77 # values of which only one will be really used, so those user wishes may not be
78 # placed in the header, only the really detected one (but that has to!).
79 # Used for grep(1), for portability assume fixed matching only.
80 H_BLACKLIST
='-e VAL_RANDOM -e VAL_IDNA'
82 # The problem is that we don't have any tools we can use right now, so
83 # encapsulate stuff in functions which get called in right order later on
99 OPT_DOTLOCK
=require OPT_ICONV
=require OPT_REGEX
=require
103 option_parse OPTIONS_DETECT
"${XOPTIONS_DETECT}"
104 option_parse OPTIONS
"${XOPTIONS}"
105 option_parse OPTIONS_XTRA
"${XOPTIONS_XTRA}"
108 # Predefined CONFIG= urations take precedence over anything else
109 if [ -n "${CONFIG}" ]; then
114 [nN
][uU
][lL
][lL
][iI
])
118 [mM
][iI
][nN
][iI
][mM
][aA
][lL
])
119 OPT_DOTLOCK
=require OPT_ICONV
=require OPT_REGEX
=require
126 OPT_HISTORY
=1 OPT_KEY_BINDINGS
=1
129 [nN
][eE
][tT
][sS
][eE
][nN
][dD
])
130 OPT_DOTLOCK
=require OPT_ICONV
=require OPT_REGEX
=require
134 OPT_GSSAPI
=1 OPT_NETRC
=1
142 OPT_HISTORY
=1 OPT_KEY_BINDINGS
=1
145 [mM
][aA
][xX
][iI
][mM
][aA
][lL
])
148 [dD
][eE
][vV
][eE
][lL
])
150 OPT_DEVEL
=1 OPT_DEBUG
=1 OPT_NYD2
=1
152 [oO
][dD
][eE
][vV
][eE
][lL
])
157 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
158 echo >&2 ' NULL, NULLI, MINIMAL, NETSEND, MAXIMAL'
162 msg_nonl
"CONFIG=${CONFIG} ... "
166 # Inter-relationships XXX sort this!
169 OPT_SSL_ALL_ALGORITHMS
=0
172 if feat_no SMTP
&& feat_no POP3
&& feat_no IMAP
; then
175 if feat_no SOCKETS
; then
176 if feat_require SMTP
; then
177 msg
'ERROR: need SOCKETS for required feature SMTP'
180 if feat_require POP3
; then
181 msg
'ERROR: need SOCKETS for required feature POP3'
184 if feat_require IMAP
; then
185 msg
'ERROR: need SOCKETS for required feature IMAP'
188 OPT_SSL
=0 OPT_SSL_ALL_ALGORITHMS
=0
189 OPT_SMTP
=0 OPT_POP3
=0 OPT_IMAP
=0
190 OPT_GSSAPI
=0 OPT_NETRC
=0 OPT_AGENT
=0
192 if feat_no SMTP
&& feat_no IMAP
; then
196 if feat_no ICONV
; then
197 if feat_yes IMAP
; then
198 if feat_yes ALWAYS_UNICODE_LOCALE
; then
199 msg
'WARN: no ICONV, keeping IMAP due to ALWAYS_UNICODE_LOCALE!'
200 elif feat_require IMAP
; then
201 msg
'ERROR: need ICONV for required feature IMAP'
204 msg
'ERROR: disabling IMAP due to missing ICONV'
209 if feat_yes IDNA
; then
210 if feat_require IDNA
; then
211 msg
'ERROR: need ICONV for required feature IDNA'
214 msg
'ERROR: disabling IDNA due to missing ICONV'
220 OPT_HISTORY
=0 OPT_KEY_BINDINGS
=0
223 # If we don't need MD5 leave it alone
224 if feat_no SOCKETS
; then
228 if feat_no TERMCAP
; then
229 OPT_TERMCAP_VIA_TERMINFO
=0
232 if feat_yes DEVEL
; then
240 h
=.
/mk-config.h h_name
=mk-config.h
243 newlst
=.
/mk-nconfig.lst
244 newmk
=.
/mk-nconfig.mk
245 oldmk
=.
/mk-oconfig.mk
246 newev
=.
/mk-nconfig.ev
253 ## -- >8 - << OPTIONS | OS/CC >> - 8< -- ##
255 # Note that potential duplicates in PATH, C_INCLUDE_PATH etc. will be cleaned
256 # via path_check() later on once possible
258 # TODO cc_maxopt is brute simple, we should compile test program and dig real
259 # compiler versions for known compilers, then be more specific
260 [ -n "${cc_maxopt}" ] || cc_maxopt
=100
261 #cc_force_no_stackprot=
264 #ld_rpath_not_runpath=
269 [ -n "${OS}" ] && [ -n "${OSENV}" ] && [ -n "${OSFULLSPEC}" ] ||
270 thecmd_testandset_fail uname uname
272 # We don't "have any utility": only path adjustments and such in here!
273 [ -n "${OS}" ] || OS
=`${uname} -s`
276 if [ ${OS} = SunOS
]; then
277 msg
'SunOS / Solaris? Applying some "early setup" rules ...'
278 _os_early_setup_sunos
282 _os_early_setup_sunos
() {
283 # According to standards(5), this is what we need to do
284 if [ -d /usr
/xpg4
]; then :; else
285 msg
'ERROR: On SunOS / Solaris we need /usr/xpg4 environment! Sorry.'
288 PATH
="/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:${PATH}"
289 [ -d /usr
/xpg6
] && PATH
="/usr/xpg6/bin:${PATH}"
294 # OSENV ends up in *build-osenv*
295 # OSFULLSPEC is used to recognize changes (i.e., machine type, updates
296 # etc.), it is not baked into the binary
297 OS
=`echo ${OS} | ${tr} '[A-Z]' '[a-z]'`
298 [ -n "${OSENV}" ] || OSENV
=`${uname} -sm`
299 [ -n "${OSFULLSPEC}" ] || OSFULLSPEC
=`${uname} -a`
300 msg
'Operating system is %s' ${OS}
302 if [ ${OS} = darwin
]; then
303 msg
' . have special Darwin environmental addons...'
304 LD_LIBRARY_PATH
=${LD_LIBRARY_PATH}:${DYLD_LIBRARY_PATH}
305 elif [ ${OS} = sunos
]; then
306 msg
' . have special SunOS / Solaris "setup" rules ...'
308 elif [ ${OS} = unixware
]; then
309 if feat_yes AUTOCC
&& acmd_set CC cc
; then
310 msg
' . have special UnixWare environmental rules ...'
311 feat_yes DEBUG
&& _CFLAGS
='-v -Xa -g' || _CFLAGS
='-Xa -O'
313 CFLAGS
="${_CFLAGS} ${EXTRA_CFLAGS}"
314 LDFLAGS
="${_LDFLAGS} ${EXTRA_LDFLAGS}"
315 export CC CFLAGS LDFLAGS
316 OPT_AUTOCC
=0 ld_need_R_flags
=-R
318 elif [ -n "${VERBOSE}" ]; then
319 msg
' . no special treatment for this system necessary or known'
322 # Sledgehammer: better set _GNU_SOURCE
323 # And in general: oh, boy!
324 OS_DEFINES
="${OS_DEFINES}#define _GNU_SOURCE\n"
325 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200809L\n"
326 #OS_DEFINES="${OS_DEFINES}#define _XOPEN_SOURCE 700\n"
327 #[ ${OS} = darwin ] && OS_DEFINES="${OS_DEFINES}#define _DARWIN_C_SOURCE\n"
329 # On pkgsrc(7) systems automatically add /usr/pkg/*
330 if [ -d /usr
/pkg
] && feat_yes USE_PKGSYS
; then
331 msg
' . found pkgsrc(7), merging C_INCLUDE_PATH and LD_LIBRARY_PATH'
332 C_INCLUDE_PATH
=/usr
/pkg
/include
:${C_INCLUDE_PATH}
333 LD_LIBRARY_PATH
=/usr
/pkg
/lib
:${LD_LIBRARY_PATH}
334 ld_rpath_not_runpath
=1
339 C_INCLUDE_PATH
=/usr
/xpg
4/include
:${C_INCLUDE_PATH}
340 LD_LIBRARY_PATH
=/usr
/xpg
4/lib
:${LD_LIBRARY_PATH}
343 if [ -d /opt
/csw
] && feat_yes USE_PKGSYS
; then
344 msg
' . found OpenCSW PKGSYS, merging C_INCLUDE_PATH and LD_LIBRARY_PATH'
345 C_INCLUDE_PATH
=/opt
/csw
/include
:${C_INCLUDE_PATH}
346 LD_LIBRARY_PATH
=/opt
/csw
/lib
:${LD_LIBRARY_PATH}
347 ld_no_bind_now
=1 ld_rpath_not_runpath
=1
349 if [ -d /opt
/schily
] && feat_yes USE_PKGSYS
; then
350 msg
' . found Schily PKGSYS, merging C_INCLUDE_PATH and LD_LIBRARY_PATH'
351 C_INCLUDE_PATH
=/opt
/schily
/include
:${C_INCLUDE_PATH}
352 LD_LIBRARY_PATH
=/opt
/schily
/lib
:${LD_LIBRARY_PATH}
353 ld_no_bind_now
=1 ld_rpath_not_runpath
=1
356 OS_DEFINES
="${OS_DEFINES}#define __EXTENSIONS__\n"
357 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200112L\n"
359 [ -n "${cksum}" ] ||
cksum=/opt
/csw
/gnu
/cksum
360 if [ -x "${cksum}" ]; then :; else
361 msg
'ERROR: Not an executable program: %s' "${cksum}"
362 msg
'ERROR: We need a CRC-32 cksum(1), as specified in POSIX.'
363 msg
'ERROR: However, we do so only for tests.'
364 msg
'ERROR: If that is ok, set "cksum=/usr/bin/true", then rerun'
368 if feat_yes AUTOCC
; then
369 if acmd_set CC cc
; then
370 feat_yes DEBUG
&& _CFLAGS
="-v -Xa -g" || _CFLAGS
="-Xa -O"
372 CFLAGS
="${_CFLAGS} ${EXTRA_CFLAGS}"
373 LDFLAGS
="${_LDFLAGS} ${EXTRA_LDFLAGS}"
374 export CC CFLAGS LDFLAGS
375 OPT_AUTOCC
=0 ld_need_R_flags
=-R
377 cc_maxopt
=2 cc_force_no_stackprot
=1
382 # Check out compiler ($CC) and -flags ($CFLAGS)
384 # Even though it belongs into cc_flags we will try to compile and link
385 # something, so ensure we have a clean state regarding CFLAGS/LDFLAGS or
386 # EXTRA_CFLAGS/EXTRA_LDFLAGS
387 if feat_no AUTOCC
; then
389 # Ensure those don't do any harm
390 EXTRA_CFLAGS
= EXTRA_LDFLAGS
=
391 export EXTRA_CFLAGS EXTRA_LDFLAGS
395 export CFLAGS LDFLAGS
398 [ -n "${CC}" ] && { _cc_default
; return; }
400 msg_nonl
'Searching for a usable C compiler .. $CC='
401 if acmd_set CC clang || acmd_set CC gcc ||
402 acmd_set CC tcc || acmd_set CC pcc ||
403 acmd_set CC c89 || acmd_set CC c99
; then
406 msg
'boing booom tschak'
407 msg
'ERROR: I cannot find a compiler!'
408 msg
' Neither of clang(1), gcc(1), tcc(1), pcc(1), c89(1) and c99(1).'
409 msg
' Please set ${CC} environment variable, maybe ${CFLAGS}, rerun.'
417 if [ -z "${CC}" ]; then
418 msg
'To go on like you have chosen, please set $CC, rerun.'
422 if [ -z "${VERBOSE}" ] && [ -f ${lst} ] && feat_no DEBUG
; then
425 msg
'Using C compiler ${CC}=%s' "${CC}"
430 if feat_yes AUTOCC
; then
431 if [ -f ${lst} ] && feat_no DEBUG
&& [ -z "${VERBOSE}" ]; then
433 msg
'Detecting ${CFLAGS}/${LDFLAGS} for ${CC}=%s, just a second..' \
437 msg
'Testing usable ${CFLAGS}/${LDFLAGS} for ${CC}=%s' "${CC}"
440 i=`echo "${CC}" | ${awk} 'BEGIN{FS="/"}{print $NF}'`
441 if { echo "${i}" | ${grep} tcc; } >/dev/null 2>&1; then
442 msg ' . have special tcc(1) environmental rules ...'
445 # As of pcc CVS 2016-04-02, stack protection support is announced but
446 # will break if used on Linux
447 if { echo "${i}" | ${grep} pcc; } >/dev/null 2>&1; then
448 cc_force_no_stackprot=1
453 feat_no DEBUG && _CFLAGS="-DNDEBUG ${_CFLAGS}"
454 CFLAGS="${_CFLAGS} ${EXTRA_CFLAGS}"
455 LDFLAGS="${_LDFLAGS} ${EXTRA_LDFLAGS}"
457 if feat_no DEBUG; then
458 CFLAGS="-DNDEBUG ${CFLAGS}"
461 export CFLAGS LDFLAGS
465 __cflags=${_CFLAGS} __ldflags=${_LDFLAGS}
473 if feat_yes DEBUG; then
474 # May have problems to find libtcc cc_check -b
478 if ld_check -Wl,-rpath =./ no; then
479 ld_need_R_flags=-Wl,-rpath=
480 if [ -z "${ld_rpath_not_runpath}" ]; then
481 ld_check -Wl,--enable-new-dtags
483 msg ' ! $LD_LIBRARY_PATH adjusted, not trying --enable-new-dtags'
485 ld_runtime_flags # update!
488 _CFLAGS="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
489 unset __cflags __ldflags
492 _cc_flags_generic() {
493 __cflags=${_CFLAGS} __ldflags=${_LDFLAGS}
495 feat_yes DEVEL && cc_check -std=c89 || cc_check -std=c99
497 # E.g., valgrind does not work well with high optimization
498 if [ ${cc_maxopt} -gt 1 ] && feat_yes NOMEMDBG &&
499 feat_no ASAN_ADDRESS && feat_no ASAN_MEMORY; then
500 msg ' ! OPT_NOMEMDBG, setting cc_maxopt=1 (-O1)'
503 # Check -g first since some others may rely upon -g / optim. level
504 if feat_yes DEBUG; then
507 elif [ ${cc_maxopt} -gt 2 ] && cc_check -O3; then
509 elif [ ${cc_maxopt} -gt 1 ] && cc_check -O2; then
511 elif [ ${cc_maxopt} -gt 0 ] && cc_check -O1; then
517 if feat_yes AMALGAMATION; then
521 #if feat_yes DEVEL && cc_check -Weverything; then
527 cc_check -Wbad-function-cast
528 cc_check -Wcast-align
531 cc_check -Wmissing-prototypes
534 cc_check -Wwrite-strings
535 cc_check -Wno-long-long
539 if feat_yes AMALGAMATION && feat_no DEVEL; then
540 cc_check -Wno-unused-function
542 feat_no DEVEL && cc_check -Wno-unused-result # XXX do right way (pragma too)
544 cc_check -fno-unwind-tables
545 cc_check -fno-asynchronous-unwind-tables
546 cc_check -fstrict-aliasing
547 if cc_check -fstrict-overflow && feat_yes DEVEL; then
548 cc_check -Wstrict-overflow=5
551 if feat_yes DEBUG || feat_yes FORCED_STACKPROT; then
552 if [ -z "${cc_force_no_stackprot}" ]; then
553 if cc_check -fstack-protector-strong ||
554 cc_check -fstack-protector-all; then
555 cc_check -D_FORTIFY_SOURCE=2
558 msg ' ! Not checking for -fstack-protector compiler option,'
559 msg ' ! since that caused errors in a "similar" configuration.'
560 msg ' ! You may turn off OPT_AUTOCC and use your own settings, rerun'
564 # LD (+ dependend CC)
566 if feat_yes ASAN_ADDRESS; then
568 if cc_check -fsanitize=address &&
569 ld_check -fsanitize=address; then
572 feat_bail_required ASAN_ADDRESS
577 if feat_yes ASAN_MEMORY; then
579 if cc_check -fsanitize=memory &&
580 ld_check -fsanitize=memory &&
581 cc_check -fsanitize-memory-track-origins=2 &&
582 ld_check -fsanitize-memory-track-origins=2; then
585 feat_bail_required ASAN_MEMORY
590 ld_check -Wl,-z,relro
591 if [ -z "${ld_no_bind_now}" ]; then
594 msg ' ! $LD_LIBRARY_PATH adjusted, not trying -Wl,-z,now'
596 ld_check -Wl,-z,noexecstack
597 if ld_check -Wl,-rpath =./ no; then
598 ld_need_R_flags=-Wl,-rpath=
599 # Choose DT_RUNPATH (after $LD_LIBRARY_PATH) over DT_RPATH (before)
600 if [ -z "${ld_rpath_not_runpath}" ]; then
601 ld_check -Wl,--enable-new-dtags
603 msg ' ! $LD_LIBRARY_PATH adjusted, not trying --enable-new-dtags'
605 ld_runtime_flags # update!
606 elif ld_check -Wl,-R ./ no; then
607 ld_need_R_flags=-Wl,-R
608 if [ -z "${ld_rpath_not_runpath}" ]; then
609 ld_check -Wl,--enable-new-dtags
611 msg ' ! $LD_LIBRARY_PATH adjusted, not trying --enable-new-dtags'
613 ld_runtime_flags # update!
616 # Address randomization
618 if cc_check -fPIE || cc_check -fpie; then
619 ld_check -pie || _CFLAGS=${_ccfg}
623 _CFLAGS="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
624 unset __cflags __ldflags
627 ## -- >8 - <<OS/CC | SUPPORT FUNS>> - 8< -- ##
630 ## - Heirloom sh(1) (and same origin) have _sometimes_ problems with ': >'
631 ## redirection, so use "printf '' >" instead
633 ## Very first: we undergo several states regarding I/O redirection etc.,
634 ## but need to deal with option updates from within all. Since all the
635 ## option stuff should be above the scissor line, define utility functions
636 ## and redefine them as necessary.
637 ## And, since we have those functions, simply use them for whatever
639 t1=ten10one1ten10one1
640 if ( [ ${t1##*ten10} = one1 ] && [ ${t1#*ten10} = one1ten10one1 ] &&
641 [ ${t1%%one1*} = ten10 ] && [ ${t1%one1*} = ten10one1ten10 ]
642 ) > /dev/null 2>&1; then
649 ( set -o noglob ) >/dev/null 2>&1 && noglob_shell=1 || unset noglob_shell
655 # which(1) not standardized, command(1) -v may return non-executable: unroll!
656 acmd_test() { __acmd "${1}" 1 0 0; }
657 acmd_test_fail() { __acmd "${1}" 1 1 0; }
658 acmd_set() { __acmd "${2}" 0 0 0 "${1}"; }
659 acmd_set_fail() { __acmd "${2}" 0 1 0 "${1}"; }
660 acmd_testandset() { __acmd "${2}" 1 0 0 "${1}"; }
661 acmd_testandset_fail() { __acmd "${2}" 1 1 0 "${1}"; }
662 thecmd_set() { __acmd "${2}" 0 0 1 "${1}"; }
663 thecmd_set_fail() { __acmd "${2}" 0 1 1 "${1}"; }
664 thecmd_testandset() { __acmd "${2}" 1 0 1 "${1}"; }
665 thecmd_testandset_fail() { __acmd "${2}" 1 1 1 "${1}"; }
667 pname=${1} dotest=${2} dofail=${3} verbok=${4} varname=${5}
669 if [ "${dotest}" -ne 0 ]; then
670 eval dotest=\$${varname}
671 if [ -n "${dotest}" ]; then
672 [ -n "${VERBOSE}" ] && [ ${verbok} -ne 0 ] &&
673 msg ' . ${%s} ... %s' "${pname}" "${dotest}"
679 [ -n "${noglob_shell}" ] && set -o noglob
681 [ -n "${noglob_shell}" ] && set +o noglob
685 if [ -z "${path}" ] || [ "${path}" = . ]; then
686 if [ -d "${PWD}" ]; then
692 if [ -f "${path}/${pname}" ] && [ -x "${path}/${pname}" ]; then
693 [ -n "${VERBOSE}" ] && [ ${verbok} -ne 0 ] &&
694 msg ' . ${%s} ... %s' "${pname}" "${path}/${pname}"
695 [ -n "${varname}" ] && eval ${varname}="${path}/${pname}"
700 # We may have no builtin string functions, we yet have no programs we can
701 # use, try to access once from the root, assuming it is an absolute path if
702 # that finds the executable
703 if ( cd && [ -f "${pname}" ] && [ -x "${pname}" ] ); then
704 [ -n "${VERBOSE}" ] && [ ${verbok} -ne 0 ] &&
705 msg ' . ${%s} ... %s' "${pname}" "${pname}"
706 [ -n "${varname}" ] && eval ${varname}="${pname}"
710 [ ${dofail} -eq 0 ] && return 1
711 msg 'ERROR: no trace of utility '"${pname}"
718 printf >&2 -- "${fmt}\\n" "${@}"
724 printf >&2 -- "${fmt}" "${@}"
727 # Our feature check environment
729 [ "x${1}" = x0 ] || [ "x${1}" = xn ] ||
730 [ "x${1}" = xfalse ] || [ "x${1}" = xno ] || [ "x${1}" = xoff ]
734 [ "x${1}" = x1 ] || [ "x${1}" = xy ] ||
735 [ "x${1}" = xtrue ] || [ "x${1}" = xyes ] || [ "x${1}" = xon ] ||
736 [ "x${1}" = xrequire ]
740 [ "x${1}" = xrequire ]
745 i="`echo ${i} |
${tr} '[A-Z]' '[a-z]'`"
746 if feat_val_no "${i}"; then
748 elif feat_val_yes "${i}"; then
751 msg "ERROR: %s: 0/n/false/no/off or 1/y/true/yes/on/require, got: %s" \
762 _feat_check ${1} && return 1
768 i="`echo ${i} |
${tr} '[A-Z]' '[a-z]'`"
769 [ "x${i}" = xrequire ] || [ "x${i}" = xrequired ]
772 feat_bail_required() {
773 if feat_require ${1}; then
774 msg 'ERROR: feature OPT_%s is required but not available' "${1}"
777 feat_is_unsupported "${1}"
781 [ ${#} -eq 1 ] && msg ' . (disabled: OPT_%s)' "${1}"
782 echo "/* OPT_${1} -> HAVE_${1} */" >> ${h}
785 feat_is_unsupported() {
786 msg ' ! NOTICE: unsupported: OPT_%s' "${1}"
787 echo "/* OPT_${1} -> HAVE_${1} */" >> ${h}
789 option_update # XXX this is rather useless here (dependency chain..)
793 if feat_yes ${1}; then
794 msg ' . %s ... yes' "${1}"
795 echo '#define HAVE_'${1}'' >> ${h}
798 feat_is_disabled "${@}"
804 # Parse one of our XOPTIONS* in $2 and assign the sh(1) compatible list of
805 # options, without documentation, to $1
807 i="`${awk} -v input
=\"${2}\" '
810 voff = match(input, /[[:alnum:]_]+(='${j}'[^'${j}']+)?/)
813 v = substr(input, voff, RLENGTH)
814 input = substr(input, voff + RLENGTH)
817 d = substr(v, doff + 2, length(v) - doff - 1)
818 v = substr(v, 1, doff - 1)
828 # Return the "documentation string" for option $1, itself if none such
830 ${awk} -v want="${1}" \
831 -v input="${XOPTIONS_DETECT}${XOPTIONS}${XOPTIONS_XTRA}" '
834 voff = match(input, /[[:alnum:]_]+(='${j}'[^'${j}']+)?/)
837 v = substr(input, voff, RLENGTH)
838 input = substr(input, voff + RLENGTH)
841 d = substr(v, doff + 2, length(v) - doff - 1)
842 v = substr(v, 1, doff - 1)
856 # Join the values from make.rc into what currently is defined, not
857 # overwriting yet existing settings
859 # We want read(1) to perform reverse solidus escaping in order to be able to
860 # use multiline values in make.rc; the resulting sh(1)/sed(1) code was very
861 # slow in VMs (see [fa2e248]), Aharon Robbins suggested the following
862 < ${rc} ${awk} 'BEGIN{line = ""}{
863 gsub(/^[[:space:]]+/, "", $0)
864 gsub(/[[:space:]]+$/, "", $0)
865 if(gsub(/\\$/, "", $0)){
870 if(index(line, "#") == 1){
872 }else if(length(line)){
878 if [ -n "${good_shell}" ]; then
881 i=`${awk} -v LINE
="${line}" 'BEGIN{
882 gsub(/=.*$/, "", LINE)
886 if [ "${i}" = "${line}" ]; then
887 msg 'ERROR: invalid syntax in: %s' "${line}"
891 eval j="\$${i}" jx="\${${i}+x}"
892 if [ -n "${j}" ] || [ "${jx}" = x ]; then
895 j=`${awk} -v LINE
="${line}" 'BEGIN{
896 gsub(/^[^=]*=/, "", LINE)
897 gsub(/^\"*/, "", LINE)
898 gsub(/\"*$/, "", LINE)
902 [ "${i}" = "DESTDIR" ] && continue
905 # Reread the mixed version right now
910 # Expand the option values, which may contain shell snippets
911 ${rm} -f ${newlst} ${newmk} ${newh}
912 exec 5<&0 6>&1 <${tmp} >${newlst}
915 if [ -n "${good_shell}" ]; then
917 [ "${i}" != "${i#OPT_}" ] && z=1
919 i=`${awk} -v LINE
="${line}" 'BEGIN{
920 gsub(/=.*$/, "", LINE);\
923 if echo "${i}" | ${grep} '^OPT_' >/dev/null 2>&1; then
929 if [ -n "${z}" ]; then
930 j="`echo ${j} |
${tr} '[A-Z]' '[a-z]'`"
931 if [ -z "${j}" ] || feat_val_no "${j}"; then
933 printf " /* #undef ${i} */\n" >> ${newh}
934 elif feat_val_yes "${j}"; then
935 if feat_val_require "${j}"; then
940 printf " /* #define ${i} */\n" >> ${newh}
942 msg 'ERROR: cannot parse <%s>' "${line}"
945 elif { echo ${i} | ${grep} ${H_BLACKLIST} >/dev/null 2>&1; }; then
948 printf "#define ${i} \"${j}\"\n" >> ${newh}
950 printf "${i} = ${j}\n" >> ${newmk}
954 exec 0<&5 1>&6 5<&- 6<&-
959 ${awk} -v HEAP="${2}" -v USER="${__expo__}" '
961 i = split(HEAP, ha, /[, ]/)
962 if((j = split(USER, ua, /[, ]/)) == 0)
966 if(us == "all" || us == "any")
969 for(ii = i; ii != 0; --ii)
970 if(tolower(ha[ii]) == us){
980 [ ${__rv__} -ne 0 ] && return ${__rv__}
982 if ${awk} -v USER="${__expo__}" '
984 if((j = split(USER, ua, /[, ]/)) == 0)
988 if(us == "all" || us == "any")
996 # Enfore lowercase also in otherwise unchanged user value..
997 eval "${1}"=\""`echo ${__expo__} | ${tr} '[A-Z]_' '[a-z]-'`"\"
1003 # "path_check VARNAME
" or "path_check VARNAME FLAG VARNAME
"
1004 varname=${1} addflag=${2} flagvarname=${3}
1007 [ -n "${noglob_shell}" ] && set -o noglob
1008 eval "set -- \$
${1}"
1009 [ -n "${noglob_shell}" ] && set +o noglob
1014 [ -z "${i}" ] && continue
1015 [ -d "${i}" ] || continue
1016 if [ -n "${j}" ]; then
1017 if { z=${y}; echo "${z}"; } | ${grep} ":${i}:" >/dev
/null
2>&1; then
1022 # But do not link any fakeroot path into our binaries!
1023 if [ -n "${addflag}" ]; then
1024 case "${i}" in *fakeroot
*) continue;; esac
1025 k
="${k} ${addflag}${i}"
1031 # But do not link any fakeroot path into our binaries!
1032 if [ -n "${addflag}" ]; then
1033 case "${i}" in *fakeroot
*) continue;; esac
1034 k
="${k} ${addflag}${i}"
1038 eval "${varname}=\"${j}\""
1039 [ -n "${addflag}" ] && eval "${flagvarname}=\"${k}\""
1043 ld_runtime_flags
() {
1044 if [ -n "${ld_need_R_flags}" ]; then
1047 set -- ${LD_LIBRARY_PATH}
1051 # But do not link any fakeroot path into our binaries!
1052 case "${i}" in *fakeroot
*) continue;; esac
1053 LDFLAGS
="${LDFLAGS} ${ld_need_R_flags}${i}"
1054 _LDFLAGS
="${_LDFLAGS} ${ld_need_R_flags}${i}"
1058 # Disable it for a possible second run.
1063 [ -n "${cc_check_silent}" ] || msg_nonl
' . CC %s .. ' "${1}"
1064 if "${CC}" ${INCS} \
1065 ${_CFLAGS} ${1} ${EXTRA_CFLAGS} ${_LDFLAGS} ${EXTRA_LDFLAGS} \
1066 -o ${tmp2} ${tmp}.c ${LIBS} >/dev
/null
2>&1; then
1067 _CFLAGS
="${_CFLAGS} ${1}"
1068 [ -n "${cc_check_silent}" ] || msg
'yes'
1071 [ -n "${cc_check_silent}" ] || msg
'no'
1076 # $1=option [$2=option argument] [$3=if set, shall NOT be added to _LDFLAGS]
1077 [ -n "${cc_check_silent}" ] || msg_nonl
' . LD %s .. ' "${1}"
1078 if "${CC}" ${INCS} ${_CFLAGS} ${_LDFLAGS} ${1}${2} ${EXTRA_LDFLAGS} \
1079 -o ${tmp2} ${tmp}.c ${LIBS} >/dev/null 2>&1; then
1080 [ -n "${3}" ] || _LDFLAGS="${_LDFLAGS} ${1}"
1081 [ -n "${cc_check_silent}" ] || msg 'yes'
1084 [ -n "${cc_check_silent}" ] || msg 'no'
1090 variable=$1 topic=$2 define=$3
1093 msg_nonl ' . %s ... ' "${topic}"
1094 #echo "/* checked
${topic} */" >> ${h}
1095 ${rm} -f ${tmp} ${tmp}.o
1096 if [ "${dump_test_program}" = 1 ]; then
1097 echo '*** test program is'
1098 { echo '#include <'"${h_name}"'>'; cat; } | ${tee} ${tmp}.c
1100 { echo '#include <'"${h_name}"'>'; cat; } > ${tmp}.c
1102 #echo '*** the preprocessor generates'
1103 #${make} -f ${makefile} ${tmp}.x
1105 echo '*** tests results'
1109 yesno
=$1 variable
=$2 topic
=$3 define
=$4 libs
=$5 incs
=$6
1112 msg_nonl
' . %s ... ' "${topic}"
1114 echo '*** enforced unchecked results are'
1115 if feat_val_yes
${yesno}; then
1116 if [ -n "${incs}" ] ||
[ -n "${libs}" ]; then
1117 echo "*** adding INCS<${incs}> LIBS<${libs}>"
1118 LIBS
="${LIBS} ${libs}"
1119 echo "${libs}" >> ${lib}
1120 INCS
="${INCS} ${incs}"
1121 echo "${incs}" >> ${inc}
1124 echo "${define}" >> ${h}
1125 eval have_
${variable}=yes
1128 #echo "/* ${define} */" >> ${h}
1130 eval unset have_
${variable}
1136 variable
=$1 topic
=$2 define
=$3
1138 _check_preface
"${variable}" "${topic}" "${define}"
1140 if ${make} -f ${makefile} XINCS="${INCS}" \
1141 CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
1143 [ -f ./${tmp}.o ]; then
1145 echo "${define}" >> ${h}
1146 eval have_${variable}=yes
1149 #echo "/* ${define} */" >> ${h}
1151 eval unset have_${variable}
1157 run=$1 variable=$2 topic=$3 define=$4 libs=$5 incs=$6
1159 _check_preface "${variable}" "${topic}" "${define}"
1161 if feat_yes CROSS_BUILD; then
1162 if [ ${run} = 1 ]; then
1167 if ${make} -f ${makefile} XINCS="${INCS} ${incs}" \
1168 CFLAGS
="${CFLAGS}" LDFLAGS
="${LDFLAGS}" \
1169 XLIBS
="${LIBS} ${libs}" \
1172 { [ ${run} -eq 0 ] || ./${tmp}; }; then
1173 echo "*** adding INCS<${incs}> LIBS<${libs}>; executed: ${run}"
1175 echo "${define}" >> ${h}
1176 LIBS
="${LIBS} ${libs}"
1177 echo "${libs}" >> ${lib}
1178 INCS
="${INCS} ${incs}"
1179 echo "${incs}" >> ${inc}
1180 eval have_
${variable}=yes
1184 #echo "/* ${define} */" >> ${h}
1185 eval unset have_
${variable}
1191 _link_mayrun
0 "${1}" "${2}" "${3}" "${4}" "${5}"
1195 _link_mayrun
1 "${1}" "${2}" "${3}" "${4}" "${5}"
1199 _link_mayrun
2 "${1}" "${2}" "${3}" "${4}" "${5}"
1203 < "${1}" > "${2}" ${awk} \
1204 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
1207 ## -- >8 - <<SUPPORT FUNS | RUNNING>> - 8< -- ##
1209 # First of all, create new configuration and check whether it changed
1211 # Very easy checks for the operating system in order to be able to adjust paths
1212 # or similar very basic things which we need to be able to go at all
1215 # Check those tools right now that we need before including $rc
1216 msg 'Checking for basic utility set'
1217 thecmd_testandset_fail awk awk
1218 thecmd_testandset_fail rm rm
1219 thecmd_testandset_fail tr tr
1221 # Initialize the option set
1222 msg_nonl 'Setting up configuration options ... '
1226 # Include $rc, but only take from it what wasn't overwritten by the user from
1227 # within the command line or from a chosen fixed CONFIG=
1228 # Note we leave alone the values
1229 trap "exit 1" HUP INT TERM
1230 trap "${rm} -f ${tmp}" EXIT
1232 msg_nonl 'Joining in %s ... ' ${rc}
1236 # We need to know about that now, in order to provide utility overwrites etc.
1239 msg 'Checking for remaining set of utilities'
1240 thecmd_testandset_fail grep grep
1242 # Before we step ahead with the other utilities perform a path cleanup first.
1246 thecmd_testandset_fail basename basename
1247 thecmd_testandset_fail cat cat
1248 thecmd_testandset_fail chmod chmod
1249 thecmd_testandset_fail cp cp
1250 thecmd_testandset_fail cmp cmp
1252 thecmd_testandset_fail mkdir mkdir
1253 thecmd_testandset_fail mv mv
1255 thecmd_testandset_fail sed sed
1256 thecmd_testandset_fail sort sort
1257 thecmd_testandset_fail tee tee
1259 thecmd_testandset chown chown ||
1260 PATH="/sbin
:${PATH}" thecmd_set chown chown ||
1261 PATH="/usr
/sbin
:${PATH}" thecmd_set_fail chown chown
1263 thecmd_testandset_fail MAKE make
1266 thecmd_testandset strip strip && HAVE_STRIP=1 || HAVE_STRIP=0
1268 # For ./cc-test.sh only
1269 thecmd_testandset_fail cksum cksum
1271 # Update OPT_ options now, in order to get possible inter-dependencies right
1274 # (No functions since some shells loose non-exported variables in traps)
1275 trap "trap \"\" HUP INT TERM
; exit 1" HUP INT TERM
1276 trap "trap \"\" HUP INT TERM EXIT
;\
1277 ${rm} -rf ${newlst} ${tmp0}.* ${tmp0}* \
1278 ${newmk} ${oldmk} ${newev} ${newh} ${oldh}" EXIT
1280 # Our configuration options may at this point still contain shell snippets,
1281 # we need to evaluate them in order to get them expanded, and we need those
1282 # evaluated values not only in our new configuration file, but also at hand..
1283 msg_nonl 'Evaluating all configuration items ... '
1287 printf "#define VAL_UAGENT \"${VAL_SID}${VAL_MAILX}\"\n" >> ${newh}
1288 printf "VAL_UAGENT = ${VAL_SID}${VAL_MAILX}\n" >> ${newmk}
1290 # The problem now is that the test should be able to run in the users linker
1291 # and path environment, so we need to place the test: rule first, before
1292 # injecting the relevant make variables. Set up necessary environment
1293 if [ -z "${VERBOSE}" ]; then
1294 printf -- "ECHO_CC
= @
echo ' 'CC \$
(@
);\n" >> ${newmk}
1295 printf -- "ECHO_LINK
= @
echo ' 'LINK \$
(@
);\n" >> ${newmk}
1296 printf -- "ECHO_GEN
= @
echo ' 'GEN \$
(@
);\n" >> ${newmk}
1297 printf -- "ECHO_TEST
= @
\n" >> ${newmk}
1298 printf -- "ECHO_CMD
= @
echo ' CMD';\n" >> ${newmk}
1299 printf -- "ECHO_BLOCK_BEGIN
= @
( \n" >> ${newmk}
1300 printf -- "ECHO_BLOCK_END
= ) >/dev
/null
\n" >> ${newmk}
1302 printf 'test: all\n\t$(ECHO_TEST)%s %scc-test.sh --check-only ./%s\n' \
1303 "${SHELL}" "${SRCDIR}" "${VAL_SID}${VAL_MAILX}" >> ${newmk}
1305 # Add the known utility and some other variables
1306 printf "#define VAL_PRIVSEP \"${VAL_SID}${VAL_MAILX}-privsep\"\n" >> ${newh}
1307 printf "VAL_PRIVSEP
= \$
(VAL_UAGENT
)-privsep\n" >> ${newmk}
1308 if feat_yes DOTLOCK; then
1309 printf "OPTIONAL_PRIVSEP
= \$
(VAL_PRIVSEP
)\n" >> ${newmk}
1311 printf "OPTIONAL_PRIVSEP
=\n" >> ${newmk}
1316 awk basename cat chmod chown cp cmp grep mkdir mv rm sed sort tee tr \
1317 MAKE MAKEFLAGS make SHELL strip \
1320 printf "${i} = ${j}\n" >> ${newmk}
1321 printf "${i}=${j}\n" >> ${newlst}
1322 printf "${i}=\"${j}\";export ${i}; " >> ${newev}
1324 # Note that makefile reads and eval'uates one line of this file, whereas other
1325 # consumers source it via .(1)
1326 printf "\n" >> ${newev}
1328 # Build a basic set of INCS and LIBS according to user environment.
1329 C_INCLUDE_PATH
="${CWDDIR}:${SRCDIR}:${C_INCLUDE_PATH}"
1330 path_check C_INCLUDE_PATH
-I _INCS
1331 INCS
="${INCS} ${_INCS}"
1332 path_check LD_LIBRARY_PATH
-L _LIBS
1333 LIBS
="${LIBS} ${_LIBS}"
1335 export C_INCLUDE_PATH LD_LIBRARY_PATH
1337 # Some environments need runtime path flags to be able to go at all
1340 ## Detect CC, whether we can use it, and possibly which CFLAGS we can use
1344 ${cat} > ${tmp}.c
<< \
!
1347 static void doit
(char const
*s
);
1349 main
(int argc
, char
**argv
){
1352 doit
("Hello world");
1356 doit
(char const
*s
){
1358 memcpy
(buf
, s
, strlen
(s
) +1);
1363 if "${CC}" ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} \
1364 -o ${tmp2} ${tmp}.c ${LIBS}; then
1367 msg 'ERROR: i cannot compile a "Hello world
" via'
1369 "${CC} ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} ${LIBS}"
1370 msg 'ERROR: Please read INSTALL, rerun'
1374 # This may also update ld_runtime_flags() (again)
1381 printf -- "${i}=${j}\n" >> ${newlst}
1387 PATH C_INCLUDE_PATH LD_LIBRARY_PATH \
1391 if [ -n "${j}" ]; then
1392 printf -- "${i} = ${j}\n" >> ${newmk}
1393 printf -- "${i}=${j}\n" >> ${newlst}
1397 # Now finally check whether we already have a configuration and if so, whether
1398 # all those parameters are still the same.. or something has actually changed
1400 if [ -f ${lst} ] && ${cmp} ${newlst} ${lst} >/dev
/null
2>&1; then
1401 echo 'Configuration is up-to-date'
1403 elif [ -f ${lst} ]; then
1405 echo 'Configuration has been updated..'
1407 echo 'Shiny configuration..'
1410 # Time to redefine helper 1
1412 ${rm} -f ${lst} ${h} ${mk}
1416 ${mv} -f ${newlst} ${lst}
1417 ${mv} -f ${newev} ${ev}
1418 [ -f ${h} ] && ${mv} -f ${h} ${oldh}
1419 ${mv} -f ${newh} ${h}
1420 [ -f ${mk} ] && ${mv} -f ${mk} ${oldmk}
1421 ${mv} -f ${newmk} ${mk}
1423 ## Compile and link checking
1429 makefile
=.
/${tmp0}.mk
1431 # (No function since some shells loose non-exported variables in traps)
1432 trap "trap \"\" HUP INT TERM;\
1433 ${rm} -f ${lst} ${oldh} ${h} ${oldmk} ${mk} ${lib} ${inc}; exit 1" \
1435 trap "trap \"\" HUP INT TERM EXIT;\
1436 ${rm} -rf ${oldh} ${oldmk} ${tmp0}.* ${tmp0}*" EXIT
1438 # Time to redefine helper 2
1442 printf "*** ${fmt}\\n" "${@}"
1443 printf -- "${fmt}\\n" "${@}" >&5
1448 printf "*** ${fmt}\\n" "${@}"
1449 printf -- "${fmt}" "${@}" >&5
1453 exec 5>&2 > ${log} 2>&1
1455 echo "${LIBS}" > ${lib}
1456 echo "${INCS}" > ${inc}
1457 ${cat} > ${makefile} << \
!
1458 .SUFFIXES
: .o .c .x .y
1460 $
(CC
) -I.
/ $
(XINCS
) $
(CFLAGS
) -c $
(<)
1462 $
(CC
) -I.
/ $
(XINCS
) -E $
(<) > $
(@
)
1464 $
(CC
) -I.
/ $
(XINCS
) $
(CFLAGS
) $
(LDFLAGS
) -o $
(@
) $
(<) $
(XLIBS
)
1469 # May be multiline..
1471 [ -n "${OS_DEFINES}" ] && printf -- "${OS_DEFINES}" >> ${h}
1472 echo '#define VAL_BUILD_OS "'"${OS}"'"' >> ${h}
1473 echo '#define VAL_BUILD_OSENV "'"${OSENV}"'"' >> ${h}
1475 # Generate n_err_number OS mappings
1478 feat_yes DEVEL && NV= || NV=noverbose
1479 SRCDIR="${SRCDIR}" TARGET="${h}" awk="${awk}" \
1480 ${SHELL} "${SRCDIR}"make-errors.sh ${NV} config
1481 ) | xrun_check oserrno 'OS error mapping table generated' || config_exit 1
1484 feat_def ALWAYS_UNICODE_LOCALE
1485 feat_def AMALGAMATION 0
1486 feat_def CROSS_BUILD
1491 feat_def ASAN_ADDRESS 0
1492 feat_def ASAN_MEMORY 0
1498 if xrun_check inline 'inline functions' \
1499 '#define HAVE_INLINE
1500 #define n_INLINE static inline' << \!
1501 static inline int ilf(int i){return ++i;}
1502 int main(void){return ilf(-1);}
1506 elif xrun_check inline 'inline functions (via __inline)' \
1507 '#define HAVE_INLINE
1508 #define n_INLINE static __inline' << \!
1509 static __inline int ilf(int i){return ++i;}
1510 int main(void){return ilf(-1);}
1516 ## Test for "basic
" system-calls / functionality that is used by all parts
1517 ## of our program. Once this is done fork away BASE_LIBS and other BASE_*
1518 ## macros to be used by only the subprograms (potentially).
1520 if run_check clock_gettime 'clock_gettime(2)' \
1521 '#define HAVE_CLOCK_GETTIME' << \!
1527 if(!clock_gettime(CLOCK_REALTIME, &ts) || errno != ENOSYS)
1534 elif run_check clock_gettime 'clock_gettime(2) (via -lrt)' \
1535 '#define HAVE_CLOCK_GETTIME' '-lrt' << \!
1541 if(!clock_gettime(CLOCK_REALTIME, &ts) || errno != ENOSYS)
1548 elif run_check gettimeofday 'gettimeofday(2)' \
1549 '#define HAVE_GETTIMEOFDAY' << \!
1550 #include <stdio.h> /* For C89 NULL */
1551 #include <sys/time.h>
1556 if(!gettimeofday(&tv, NULL) || errno != ENOSYS)
1564 have_no_subsecond_time=1
1567 if run_check nanosleep 'nanosleep(2)' \
1568 '#define HAVE_NANOSLEEP' << \!
1575 ts.tv_nsec = 100000;
1576 if(!nanosleep(&ts, NULL) || errno != ENOSYS)
1583 elif run_check nanosleep 'nanosleep(2) (via -lrt)' \
1584 '#define HAVE_NANOSLEEP' '-lrt' << \!
1591 ts.tv_nsec = 100000;
1592 if(!nanosleep(&ts, NULL) || errno != ENOSYS)
1599 # link_check is enough for this, that function is so old, trust the proto
1600 elif link_check sleep 'sleep(3)' \
1601 '#define HAVE_SLEEP' << \!
1605 if(!sleep(1) || errno != ENOSYS)
1613 msg 'ERROR: we require one of nanosleep(2) and sleep(3).'
1617 if run_check userdb 'gete?[gu]id(2), getpwuid(3), getpwnam(3)' << \!
1626 if((gid = getgid()) != 0)
1628 if((uid = getuid()) != 0)
1630 if((pw = getpwuid(uid)) == NULL && errno == ENOSYS)
1632 if((pw = getpwnam("root
")) == NULL && errno == ENOSYS)
1640 msg 'ERROR: we require user and group info / database searches.'
1641 msg 'That much Unix we indulge ourselfs.'
1645 if link_check ftruncate 'ftruncate(2)' \
1646 '#define HAVE_FTRUNCATE' << \!
1648 #include <sys/types.h>
1650 return (ftruncate(0, 0) != 0);
1656 # TODO support HAVE_FTRUNCATE *everywhere*, do not require this syscall!
1657 msg 'ERROR: we require the ftruncate(2) system call.'
1661 if run_check sa_restart 'SA_RESTART (for sigaction(2))' << \!
1665 struct sigaction nact, oact;
1667 nact.sa_handler = SIG_DFL;
1668 sigemptyset(&nact.sa_mask);
1669 nact.sa_flags = SA_RESTART;
1670 return !(!sigaction(SIGCHLD, &nact, &oact) || errno != ENOSYS);
1676 msg 'ERROR: we (yet) require the SA_RESTART flag for sigaction(2).'
1680 if link_check snprintf 'snprintf(3)' << \!
1685 snprintf(b, sizeof b, "%s
", "string
");
1692 msg 'ERROR: we require the snprintf(3) function.'
1696 if link_check environ 'environ(3)' << \!
1697 #include <stdio.h> /* For C89 NULL */
1699 extern char **environ;
1701 return environ[0] == NULL;
1707 msg 'ERROR: we require the environ(3) array for subprocess control.'
1711 if link_check setenv '(un)?setenv(3)' '#define HAVE_SETENV' << \!
1714 setenv("s-mailx
", "i want to see it cute
!", 1);
1715 unsetenv("s-mailx
");
1721 elif link_check setenv 'putenv(3)' '#define HAVE_PUTENV' << \!
1724 putenv("s-mailx
=i want to see it cute
!");
1731 msg 'ERROR: we require either the setenv(3) or putenv(3) functions.'
1735 if link_check termios 'termios.h and tc*(3) family' << \!
1736 #include <termios.h>
1738 struct termios tios;
1740 tcgetattr(0, &tios);
1741 tcsetattr(0, TCSANOW | TCSADRAIN | TCSAFLUSH, &tios);
1748 msg 'ERROR: we require termios.h and the tc[gs]etattr() family of functions.'
1749 msg 'That much Unix we indulge ourselfs.'
1755 if link_check vsnprintf 'vsnprintf(3)' << \!
1758 static void dome(char *buf, size_t blen, ...){
1762 vsnprintf(buf, blen, "%s
", ap);
1768 dome(b, sizeof b, "string
");
1775 feat_bail_required ERRORS
1778 if [ "${have_vsnprintf}" = yes ]; then
1780 link_check va_copy "va_copy
(3) (as
${2})" \
1781 "#define HAVE_N_VA_COPY
1782 #define n_va_copy ${2}" <<_EOT
1786 # if defined __va_copy && !defined va_copy
1787 # define va_copy __va_copy
1790 static void dome2
(char
*buf
, size_t blen
, va_list src
){
1794 vsnprintf
(buf
, blen
, "%s", ap
);
1797 static void dome
(char
*buf
, size_t blen
, ...
){
1801 dome2
(buf
, blen
, ap
);
1807 dome
(b
, sizeof b
, "string");
1812 __va_copy
0 va_copy || __va_copy
1 __va_copy
1815 run_check pathconf
'f?pathconf(2)' '#define HAVE_PATHCONF' << \
!
1822 rv |
= !(pathconf
(".", _PC_NAME_MAX
) >= 0 || errno
== 0 || errno
!= ENOSYS
);
1824 rv |
= !(pathconf
(".", _PC_PATH_MAX
) >= 0 || errno
== 0 || errno
!= ENOSYS
);
1826 /* Only link check
*/
1827 fpathconf
(0, _PC_NAME_MAX
);
1833 run_check pipe2
'pipe2(2)' '#define HAVE_PIPE2' << \
!
1840 if(!pipe2
(fds
, O_CLOEXEC
) || errno
!= ENOSYS
)
1846 link_check tcgetwinsize
'tcgetwinsize(3)' '#define HAVE_TCGETWINSIZE' << \
!
1847 #include <termios.h>
1851 tcgetwinsize
(0, &ws
);
1856 # We use this only then for now (need NOW+1)
1857 run_check utimensat
'utimensat(2)' '#define HAVE_UTIMENSAT' << \
!
1858 #include <fcntl.h> /* For AT_* */
1859 #include <sys/stat.h>
1862 struct timespec ts
[2];
1864 ts
[0].tv_nsec
= UTIME_NOW
;
1865 ts
[1].tv_nsec
= UTIME_OMIT
;
1866 if(!utimensat
(AT_FDCWD
, "", ts
, 0) || errno
!= ENOSYS
)
1874 # The random check has been moved to below SSL detection due to multiple choice
1875 # selection for PRG sources
1877 link_check putc_unlocked
'putc_unlocked(3)' '#define HAVE_PUTC_UNLOCKED' <<\
!
1880 putc_unlocked
('@', stdout
);
1885 link_check fchdir
'fchdir(3)' '#define HAVE_FCHDIR' << \
!
1893 if link_check realpath
'realpath(3)' '#define HAVE_REALPATH' << \
!
1896 char x_buf
[4096], *x
= realpath
(".", x_buf
);
1898 return (x
!= NULL
) ?
0 : 1;
1902 if run_check realpath_malloc
'realpath(3) takes NULL' \
1903 '#define HAVE_REALPATH_NULL' << \
!
1906 char
*x
= realpath
(".", NULL
);
1910 return (x
!= NULL
) ?
0 : 1;
1919 ## optional and selectable
1922 if feat_yes DOTLOCK
; then
1923 if run_check readlink
'readlink(2)' << \
!
1929 if(!readlink
("here", buf
, sizeof buf
) || errno
!= ENOSYS
)
1937 feat_bail_required DOTLOCK
1941 if feat_yes DOTLOCK
; then
1942 if run_check fchown
'fchown(2)' << \
!
1946 if(!fchown
(0, 0, 0) || errno
!= ENOSYS
)
1954 feat_bail_required DOTLOCK
1958 if feat_yes DOTLOCK
; then
1959 if run_check prctl_dumpable
'prctl(2) + PR_SET_DUMPABLE' \
1960 '#define HAVE_PRCTL_DUMPABLE' << \
!
1961 #include <sys/prctl.h>
1964 if(!prctl
(PR_SET_DUMPABLE
, 0) || errno
!= ENOSYS
)
1971 elif run_check prtrace_deny
'ptrace(2) + PT_DENY_ATTACH' \
1972 '#define HAVE_PTRACE_DENY' << \
!
1973 #include <sys/ptrace.h>
1976 if(ptrace
(PT_DENY_ATTACH
, 0, 0, 0) != -1 || errno
!= ENOSYS
)
1983 elif run_check setpflags_protect
'setpflags(2) + __PROC_PROTECT' \
1984 '#define HAVE_SETPFLAGS_PROTECT' << \
!
1988 if(!setpflags
(__PROC_PROTECT
, 1) || errno
!= ENOSYS
)
1998 ## Now it is the time to fork away the BASE_ series
2001 squeeze_em
${inc} ${tmp}
2003 squeeze_em
${lib} ${tmp}
2006 echo "BASE_LIBS = `${cat} ${lib}`" >> ${mk}
2007 echo "BASE_INCS
= `${cat} ${inc}`" >> ${mk}
2009 ## The remains are expected to be used only by the main MUA binary!
2012 link_check setlocale 'setlocale(3)' '#define HAVE_SETLOCALE' << \!
2015 setlocale(LC_ALL, "");
2019 [ -n "${have_setlocale}" ] && OPT_LOCALES=1
2021 OPT_MULTIBYTE_CHARSETS=0
2023 OPT_TERMINAL_CHARSET=0
2024 if [ -n "${have_setlocale}" ]; then
2025 link_check c90amend1 'ISO/IEC 9899:1990/Amendment 1:1995' \
2026 '#define HAVE_C90AMEND1' << \!
2032 char mbb[MB_LEN_MAX + 1];
2037 mbtowc(&wc, "x", 1);
2038 mbrtowc(&wc, "x", 1, NULL);
2040 return (mblen("\0", 1) == 0);
2043 [ -n "${have_c90amend1}" ] && OPT_MULTIBYTE_CHARSETS=1
2045 if [ -n "${have_c90amend1}" ]; then
2046 link_check wcwidth 'wcwidth(3)' '#define HAVE_WCWIDTH' << \!
2053 [ -n "${have_wcwidth}" ] && OPT_WIDE_GLYPHS=1
2056 link_check nl_langinfo 'nl_langinfo(3)' '#define HAVE_NL_LANGINFO' << \!
2057 #include <langinfo.h>
2061 return (nl_langinfo(CODESET) == NULL);
2064 [ -n "${have_nl_langinfo}" ] && OPT_TERMINAL_CHARSET=1
2067 link_check fnmatch 'fnmatch(3)' '#define HAVE_FNMATCH' << \!
2068 #include <fnmatch.h>
2070 return (fnmatch("*", ".", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
2074 link_check dirent_d_type 'struct dirent.d_type' '#define HAVE_DIRENT_TYPE' << \!
2078 return !(de.d_type == DT_UNKNOWN ||
2079 de.d_type == DT_DIR || de.d_type == DT_LNK);
2083 ## optional and selectable
2085 if feat_yes ICONV; then
2086 # To be able to create tests we need to figure out which replacement
2087 # sequence the iconv(3) implementation creates
2088 ${cat} > ${tmp2}.c << \!
2089 #include <stdio.h> /* For C89 NULL */
2093 char inb[16], oub[16], *inbp, *oubp;
2097 memcpy(inbp = inb, "\342\200\223", sizeof("\342\200\223"));
2098 inl = sizeof("\342\200\223") -1;
2102 if((id = iconv_open("ascii", "utf-8")) == (iconv_t)-1)
2104 if(iconv(id, &inbp, &inl, &oubp, &oul) == (size_t)-1)
2109 oul = (size_t)(oubp - oub);
2112 /* Character-wise replacement? */
2120 /* Byte-wise replacement? */
2121 if(oul == sizeof("\342\200\223") -1){
2122 if(!memcmp(oub, "???????", sizeof("\342\200\223") -1))
2124 if(!memcmp(oub, "*******", sizeof("\342\200\223") -1))
2131 < ${tmp2}.c link_check iconv 'iconv(3) functionality' \
2132 '#define HAVE_ICONV' ||
2133 < ${tmp2}.c link_check iconv 'iconv(3) functionality (via -liconv)' \
2134 '#define HAVE_ICONV' '-liconv' ||
2135 feat_bail_required ICONV
2137 if feat_no CROSS_BUILD; then
2138 { ./${tmp}; } >/dev/null 2>&1
2140 2) echo 'MAILX_ICONV_MODE=2;export MAILX_ICONV_MODE;' >> ${ev};;
2141 3) echo 'MAILX_ICONV_MODE=3;export MAILX_ICONV_MODE;' >> ${ev};;
2142 12) echo 'MAILX_ICONV_MODE=12;export MAILX_ICONV_MODE;' >> ${ev};;
2143 13) echo 'MAILX_ICONV_MODE=13;export MAILX_ICONV_MODE;' >> ${ev};;
2144 *) msg 'WARN: will restrict iconv(3) tests due to unknown replacement';;
2148 feat_is_disabled ICONV
2151 if feat_yes SOCKETS || feat_yes SPAM_SPAMD; then
2152 ${cat} > ${tmp2}.c << \!
2153 #include <sys/types.h>
2154 #include <sys/socket.h>
2158 struct sockaddr_un soun;
2160 if(socket(AF_UNIX, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
2162 if(connect(0, (struct sockaddr*)&soun, 0) == -1 && errno == ENOSYS)
2164 if(shutdown(0, SHUT_RD | SHUT_WR | SHUT_RDWR) == -1 && errno == ENOSYS)
2170 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets' \
2171 '#define HAVE_UNIX_SOCKETS' ||
2172 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lnsl)' \
2173 '#define HAVE_UNIX_SOCKETS' '-lnsl' ||
2174 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lsocket -lnsl)' \
2175 '#define HAVE_UNIX_SOCKETS' '-lsocket -lnsl'
2178 if feat_yes SOCKETS; then
2179 ${cat} > ${tmp2}.c << \!
2180 #include <sys/types.h>
2181 #include <sys/socket.h>
2182 #include <netinet/in.h>
2187 if(socket(AF_INET, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
2189 if(connect(0, &s, 0) == -1 && errno == ENOSYS)
2195 < ${tmp2}.c run_check sockets 'sockets' \
2196 '#define HAVE_SOCKETS' ||
2197 < ${tmp2}.c run_check sockets 'sockets (via -lnsl)' \
2198 '#define HAVE_SOCKETS' '-lnsl' ||
2199 < ${tmp2}.c run_check sockets 'sockets (via -lsocket -lnsl)' \
2200 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
2201 feat_bail_required SOCKETS
2203 feat_is_disabled SOCKETS
2204 fi # feat_yes SOCKETS
2206 if feat_yes SOCKETS; then
2207 link_check getaddrinfo 'getaddrinfo(3)' \
2208 '#define HAVE_GETADDRINFO' << \!
2209 #include <sys/types.h>
2210 #include <sys/socket.h>
2214 struct addrinfo a, *ap;
2217 switch((lrv = getaddrinfo("foo", "0", &a, &ap))){
2221 fprintf(stderr, "%s\n", gai_strerror(lrv));
2230 if feat_yes SOCKETS && [ -z "${have_getaddrinfo}" ]; then
2231 compile_check arpa_inet_h '<arpa/inet.h>' \
2232 '#define HAVE_ARPA_INET_H' << \!
2233 #include <sys/types.h>
2234 #include <sys/socket.h>
2236 #include <netinet/in.h>
2237 #include <arpa/inet.h>
2240 ${cat} > ${tmp2}.c << \!
2241 #include <sys/types.h>
2242 #include <sys/socket.h>
2246 #include <netinet/in.h>
2247 #ifdef HAVE_ARPA_INET_H
2248 #include <arpa/inet.h>
2251 struct sockaddr_in servaddr;
2252 unsigned short portno;
2255 struct in_addr **pptr;
2258 if((ep = getservbyname("POPPY-PORT", "tcp")) != NULL)
2259 portno = (unsigned short)ep->s_port;
2261 if((hp = gethostbyname("POPPY-HOST")) != NULL){
2262 pptr = (struct in_addr**)hp->h_addr_list;
2263 if(hp->h_addrtype != AF_INET)
2264 fprintf(stderr, "au\n");
2267 case HOST_NOT_FOUND:
2273 fprintf(stderr, "au\n");
2278 memset(&servaddr, 0, sizeof servaddr);
2279 servaddr.sin_family = AF_INET;
2280 servaddr.sin_port = htons(portno);
2281 memcpy(&servaddr.sin_addr, *pptr, sizeof(struct in_addr));
2282 fprintf(stderr, "Would connect to %s:%d ...\n",
2283 inet_ntoa(**pptr), (int)portno);
2288 < ${tmp2}.c link_check gethostbyname 'get(serv|host)byname(3)' ||
2289 < ${tmp2}.c link_check gethostbyname \
2290 'get(serv|host)byname(3) (via -nsl)' '' '-lnsl' ||
2291 < ${tmp2}.c link_check gethostbyname \
2292 'get(serv|host)byname(3) (via -lsocket -nsl)' \
2293 '' '-lsocket -lnsl' ||
2294 feat_bail_required SOCKETS
2298 run_check setsockopt 'setsockopt(2)' '#define HAVE_SETSOCKOPT' << \!
2299 #include <sys/socket.h>
2305 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, NULL, 0) == -1 &&
2312 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
2313 link_check so_sndtimeo 'SO_SNDTIMEO' '#define HAVE_SO_SNDTIMEO' << \!
2314 #include <sys/socket.h>
2322 setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv);
2323 setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
2328 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
2329 link_check so_linger 'SO_LINGER' '#define HAVE_SO_LINGER' << \!
2330 #include <sys/socket.h>
2338 setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &li, sizeof li);
2344 if feat_yes SSL; then # {{{
2345 # {{{ LibreSSL decided to define OPENSSL_VERSION_NUMBER with a useless value
2346 # instead of keeping it at the one that corresponds to the OpenSSL at fork
2347 # time: we need to test it first in order to get things right
2348 if compile_check _xssl 'TLS/SSL (LibreSSL)' \
2351 #define HAVE_XSSL_RESSL
2352 #define HAVE_XSSL_OPENSSL 0' << \!
2353 #include <openssl/opensslv.h>
2354 #ifdef LIBRESSL_VERSION_NUMBER
2361 VAL_SSL_FEATURES=libressl
2362 # TODO OPENSSL_IS_BORINGSSL, but never tried that one!
2363 elif compile_check _xssl 'TLS/SSL (OpenSSL >= v1.1.0)' \
2366 #define HAVE_XSSL_OPENSSL 0x10100' << \!
2367 #include <openssl/opensslv.h>
2368 #if OPENSSL_VERSION_NUMBER + 0 >= 0x10100000L
2375 VAL_SSL_FEATURES=libssl-0x10100
2376 elif compile_check _xssl 'TLS/SSL (OpenSSL)' \
2379 #define HAVE_XSSL_OPENSSL 0x10000' << \!
2380 #include <openssl/opensslv.h>
2381 #ifdef OPENSSL_VERSION_NUMBER
2388 VAL_SSL_FEATURES=libssl-0x10000
2390 feat_bail_required SSL
2393 if feat_yes SSL; then # {{{
2394 if [ -n "${ossl_v1_1}" ]; then
2395 without_check yes xssl 'TLS/SSL new style TLS_client_method(3ssl)' \
2396 '#define n_XSSL_CLIENT_METHOD TLS_client_method' \
2398 elif link_check xssl 'TLS/SSL new style TLS_client_method(3ssl)' \
2399 '#define n_XSSL_CLIENT_METHOD TLS_client_method' \
2400 '-lssl -lcrypto' << \!
2401 #include <openssl/ssl.h>
2402 #include <openssl/err.h>
2403 #include <openssl/x509v3.h>
2404 #include <openssl/x509.h>
2405 #include <openssl/rand.h>
2406 #ifdef OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
2407 # error We need TLSv1.
2410 SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
2413 PEM_read_PrivateKey(0, 0, 0, 0);
2419 elif link_check xssl 'TLS/SSL old style SSLv23_client_method(3ssl)' \
2420 '#define n_XSSL_CLIENT_METHOD SSLv23_client_method' \
2421 '-lssl -lcrypto' << \!
2422 #include <openssl/ssl.h>
2423 #include <openssl/err.h>
2424 #include <openssl/x509v3.h>
2425 #include <openssl/x509.h>
2426 #include <openssl/rand.h>
2427 #if defined OPENSSL_NO_SSL3 &&\
2428 defined OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
2429 # error We need one of SSLv3 and TLSv1.
2432 SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
2435 PEM_read_PrivateKey(0, 0, 0, 0);
2442 feat_bail_required SSL
2446 if feat_yes SSL; then # {{{
2447 if feat_yes SSL_ALL_ALGORITHMS; then
2448 if [ -n "${ossl_v1_1}" ]; then
2449 without_check yes ssl_all_algo 'TLS/SSL all-algorithms support' \
2450 '#define HAVE_SSL_ALL_ALGORITHMS'
2451 elif link_check ssl_all_algo 'TLS/SSL all-algorithms support' \
2452 '#define HAVE_SSL_ALL_ALGORITHMS' << \!
2453 #include <openssl/evp.h>
2455 OpenSSL_add_all_algorithms();
2456 EVP_get_cipherbyname("two cents i never exist");
2464 feat_bail_required SSL_ALL_ALGORITHMS
2466 elif [ -n "${ossl_v1_1}" ]; then
2467 without_check yes ssl_all_algo \
2468 'TLS/SSL all-algorithms (always available in v1.1.0+)' \
2469 '#define HAVE_SSL_ALL_ALGORITHMS'
2472 if [ -n "${ossl_v1_1}" ]; then
2473 without_check yes xssl_stack_of 'TLS/SSL STACK_OF()' \
2474 '#define HAVE_XSSL_STACK_OF'
2475 elif compile_check xssl_stack_of 'TLS/SSL STACK_OF()' \
2476 '#define HAVE_XSSL_STACK_OF' << \!
2477 #include <stdio.h> /* For C89 NULL */
2478 #include <openssl/ssl.h>
2479 #include <openssl/err.h>
2480 #include <openssl/x509v3.h>
2481 #include <openssl/x509.h>
2482 #include <openssl/rand.h>
2484 STACK_OF(GENERAL_NAME) *gens = NULL;
2486 printf("%p", gens); /* to use it */
2494 if [ -n "${ossl_v1_1}" ]; then
2495 without_check yes xssl_conf 'TLS/SSL OpenSSL_modules_load_file(3ssl)' \
2496 '#define HAVE_XSSL_CONFIG'
2497 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+modules-load-file"
2498 elif link_check xssl_conf \
2499 'TLS/SSL OpenSSL_modules_load_file(3ssl) support' \
2500 '#define HAVE_XSSL_CONFIG' << \!
2501 #include <stdio.h> /* For C89 NULL */
2502 #include <openssl/conf.h>
2504 CONF_modules_load_file(NULL, NULL, CONF_MFLAGS_IGNORE_MISSING_FILE);
2505 CONF_modules_free();
2510 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+modules-load-file"
2512 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},-modules-load-file"
2515 if [ -n "${ossl_v1_1}" ]; then
2516 without_check yes xssl_conf_ctx 'TLS/SSL SSL_CONF_CTX support' \
2517 '#define HAVE_XSSL_CONF_CTX'
2518 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+conf-ctx"
2519 elif link_check xssl_conf_ctx 'TLS/SSL SSL_CONF_CTX support' \
2520 '#define HAVE_XSSL_CONF_CTX' << \!
2521 #include <openssl/ssl.h>
2522 #include <openssl/err.h>
2524 SSL_CTX *ctx = SSL_CTX_new(n_XSSL_CLIENT_METHOD());
2525 SSL_CONF_CTX *cctx = SSL_CONF_CTX_new();
2527 SSL_CONF_CTX_set_flags(cctx,
2528 SSL_CONF_FLAG_FILE | SSL_CONF_FLAG_CLIENT |
2529 SSL_CONF_FLAG_CERTIFICATE | SSL_CONF_FLAG_SHOW_ERRORS);
2530 SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
2531 SSL_CONF_cmd(cctx, "Protocol", "ALL");
2532 SSL_CONF_CTX_finish(cctx);
2533 SSL_CONF_CTX_free(cctx);
2539 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+conf-ctx"
2541 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},-conf-ctx"
2544 if [ -n "${ossl_v1_1}" ]; then
2545 without_check yes xssl_ctx_config 'TLS/SSL SSL_CTX_config(3ssl)' \
2546 '#define HAVE_XSSL_CTX_CONFIG'
2547 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+ctx-config"
2548 elif [ -n "${have_xssl_conf}" ] && [ -n "${have_xssl_conf_ctx}" ] &&
2549 link_check xssl_ctx_config 'TLS/SSL SSL_CTX_config(3ssl)' \
2550 '#define HAVE_XSSL_CTX_CONFIG' << \!
2551 #include <stdio.h> /* For C89 NULL */
2552 #include <openssl/ssl.h>
2554 SSL_CTX_config(NULL, "SOMEVAL");
2559 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+ctx-config"
2561 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},-ctx-config"
2564 if [ -n "${ossl_v1_1}" ] && [ -n "${have_xssl_conf_ctx}" ]; then
2565 without_check yes xssl_set_maxmin_proto \
2566 'TLS/SSL SSL_CTX_set_min_proto_version(3ssl)' \
2567 '#define HAVE_XSSL_SET_MIN_PROTO_VERSION'
2568 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+ctx-set-maxmin-proto"
2569 elif link_check xssl_set_maxmin_proto \
2570 'TLS/SSL SSL_CTX_set_min_proto_version(3ssl)' \
2571 '#define HAVE_XSSL_SET_MIN_PROTO_VERSION' << \!
2572 #include <stdio.h> /* For C89 NULL */
2573 #include <openssl/ssl.h>
2575 SSL_CTX_set_min_proto_version(NULL, 0);
2576 SSL_CTX_set_max_proto_version(NULL, 10);
2581 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+ctx-set-maxmin-proto"
2583 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},-ctx-set-maxmin-proto"
2586 if link_check xssl_rand_egd 'TLS/SSL RAND_egd(3ssl)' \
2587 '#define HAVE_XSSL_RAND_EGD' << \!
2588 #include <openssl/rand.h>
2590 return RAND_egd("some.where") > 0;
2594 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},+rand-egd"
2596 VAL_SSL_FEATURES="${VAL_SSL_FEATURES},-rand-egd"
2598 fi # feat_yes SSL }}}
2600 if feat_yes SSL && feat_yes MD5 && feat_no NOEXTMD5; then # {{{
2601 run_check ssl_md5 'MD5 digest in the used crypto library' \
2602 '#define HAVE_XSSL_MD5' << \!
2605 #include <openssl/md5.h>
2607 char const dat[] = "abrakadabrafidibus";
2608 char dig[16], hex[16 * 2];
2612 memset(dig, 0, sizeof(dig));
2613 memset(hex, 0, sizeof(hex));
2615 MD5_Update(&ctx, dat, sizeof(dat) - 1);
2616 MD5_Final(dig, &ctx);
2618 #define hexchar(n) ((n) > 9 ? (n) - 10 + 'a' : (n) + '0')
2619 for(i = 0; i < sizeof(hex) / 2; i++){
2621 hex[j] = hexchar((dig[i] & 0xf0) >> 4);
2622 hex[++j] = hexchar(dig[i] & 0x0f);
2624 return !!memcmp("6d7d0a3d949da2e96f2aa010f65d8326", hex, sizeof(hex));
2629 if feat_yes SSL; then
2630 feat_def SSL_ALL_ALGORITHMS
2632 feat_bail_required SSL_ALL_ALGORITHMS
2635 feat_is_disabled SSL
2636 feat_is_disabled SSL_ALL_ALGORITHMS
2637 fi # }}} feat_yes SSL
2638 printf '#define VAL_SSL_FEATURES "#'"${VAL_SSL_FEATURES}"'"\n' >> ${h}
2640 if [ "${have_xssl}" = yes ]; then
2648 if val_allof VAL_RANDOM \
2649 "arc4,ssl,libgetrandom,sysgetrandom,urandom,builtin,error"; then
2652 msg 'ERROR: VAL_RANDOM with invalid entries: %s' "${VAL_RANDOM}"
2657 link_check arc4random 'VAL_RANDOM: arc4random(3)' \
2658 '#define HAVE_RANDOM n_RANDOM_IMPL_ARC4' << \!
2668 if feat_yes SSL; then
2669 msg ' . VAL_RANDOM: ssl ... yes'
2670 echo '#define HAVE_RANDOM n_RANDOM_IMPL_SSL' >> ${h}
2673 msg ' . VAL_RANDOM: ssl ... no'
2678 val_random_libgetrandom() {
2679 link_check getrandom 'VAL_RANDOM: getrandom(3) (in sys/random.h)' \
2680 '#define HAVE_RANDOM n_RANDOM_IMPL_GETRANDOM
2681 #define n_RANDOM_GETRANDOM_FUN(B,S) getrandom(B, S, 0)
2682 #define n_RANDOM_GETRANDOM_H <sys/random.h>' <<\!
2683 #include <sys/random.h>
2686 getrandom(buf, sizeof buf, 0);
2692 val_random_sysgetrandom() {
2693 link_check getrandom 'VAL_RANDOM: getrandom(2) (via syscall(2))' \
2694 '#define HAVE_RANDOM n_RANDOM_IMPL_GETRANDOM
2695 #define n_RANDOM_GETRANDOM_FUN(B,S) syscall(SYS_getrandom, B, S, 0)
2696 #define n_RANDOM_GETRANDOM_H <sys/syscall.h>' <<\!
2697 #include <sys/syscall.h>
2700 syscall(SYS_getrandom, buf, sizeof buf, 0);
2706 val_random_urandom() {
2707 msg_nonl ' . VAL_RANDOM: /dev/urandom ... '
2708 if feat_yes CROSS_BUILD; then
2709 msg 'yes (unchecked)'
2710 echo '#define HAVE_RANDOM n_RANDOM_IMPL_URANDOM' >> ${h}
2711 elif [ -f /dev/urandom ]; then
2713 echo '#define HAVE_RANDOM n_RANDOM_IMPL_URANDOM' >> ${h}
2721 val_random_builtin() {
2722 msg_nonl ' . VAL_RANDOM: builtin ... '
2723 if [ -n "${have_no_subsecond_time}" ]; then
2724 msg 'no\nERROR: %s %s' 'without a specialized PRG ' \
2725 'one of clock_gettime(2) and gettimeofday(2) is required.'
2729 echo '#define HAVE_RANDOM n_RANDOM_IMPL_BUILTIN' >> ${h}
2733 val_random_error() {
2734 msg 'ERROR: VAL_RANDOM search reached "error" entry'
2740 VAL_RANDOM="${VAL_RANDOM},error"
2741 set -- ${VAL_RANDOM}
2745 eval val_random_$randfun && break
2753 if feat_yes GSSAPI; then
2754 ${cat} > ${tmp2}.c << \!
2755 #include <gssapi/gssapi.h>
2757 gss_import_name(0, 0, GSS_C_NT_HOSTBASED_SERVICE, 0);
2758 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2762 ${sed} -e '1s/gssapi\///' < ${tmp2}.c > ${tmp3}.c
2764 if acmd_set i krb5-config; then
2765 GSS_LIBS="`CFLAGS
= ${i} --libs gssapi
`"
2766 GSS_INCS="`CFLAGS
= ${i} --cflags`"
2767 i='GSS-API via krb5-config(1)'
2771 i='GSS-API in gssapi/gssapi.h, libgssapi'
2773 if < ${tmp2}.c link_check gss \
2774 "${i}" '#define HAVE_GSSAPI' "${GSS_LIBS}" "${GSS_INCS}" ||\
2775 < ${tmp3}.c link_check gss \
2776 'GSS-API in gssapi.h, libgssapi' \
2777 '#define HAVE_GSSAPI
2778 #define GSSAPI_REG_INCLUDE' \
2780 < ${tmp2}.c link_check gss 'GSS-API in libgssapi_krb5' \
2781 '#define HAVE_GSSAPI' \
2783 < ${tmp3}.c link_check gss \
2784 'GSS-API in libgssapi, OpenBSD-style (pre 5.3)' \
2785 '#define HAVE_GSSAPI
2786 #define GSS_REG_INCLUDE' \
2787 '-lgssapi -lkrb5 -lcrypto' \
2788 '-I/usr/include/kerberosV' ||\
2789 < ${tmp2}.c link_check gss 'GSS-API in libgss' \
2790 '#define HAVE_GSSAPI' \
2792 link_check gss 'GSS-API in libgssapi_krb5, old-style' \
2793 '#define HAVE_GSSAPI
2794 #define GSSAPI_OLD_STYLE' \
2795 '-lgssapi_krb5' << \!
2796 #include <gssapi/gssapi.h>
2797 #include <gssapi/gssapi_generic.h>
2799 gss_import_name(0, 0, gss_nt_service_name, 0);
2800 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2807 feat_bail_required GSSAPI
2810 feat_is_disabled GSSAPI
2811 fi # feat_yes GSSAPI
2816 if feat_yes IDNA; then # {{{
2817 if val_allof VAL_IDNA "idnkit,idn2,idn"; then
2820 msg 'ERROR: VAL_IDNA with invalid entries: %s' "${VAL_IDNA}"
2825 link_check idna 'OPT_IDNA: GNU Libidn2' \
2826 '#define HAVE_IDNA n_IDNA_IMPL_LIBIDN2' '-lidn2' << \!
2829 char *idna_utf8, *idna_lc;
2831 if(idn2_to_ascii_8z("does.this.work", &idna_utf8,
2832 IDN2_NONTRANSITIONAL | IDN2_TRANSITIONAL) != IDN2_OK)
2834 if(idn2_to_unicode_8zlz(idna_utf8, &idna_lc, 0) != IDN2_OK)
2837 idn2_free(idna_utf8);
2844 link_check idna 'OPT_IDNA: GNU Libidn' \
2845 '#define HAVE_IDNA n_IDNA_IMPL_LIBIDN' '-lidn' << \!
2847 #include <idn-free.h>
2848 #include <stringprep.h> /* XXX we actually use our own iconv instead */
2850 char *utf8, *idna_ascii, *idna_utf8;
2852 utf8 = stringprep_locale_to_utf8("does.this.work");
2853 if (idna_to_ascii_8z(utf8, &idna_ascii, IDNA_USE_STD3_ASCII_RULES)
2856 idn_free(idna_ascii);
2857 /* (Rather link check only here) */
2858 idna_utf8 = stringprep_convert(idna_ascii, "UTF-8", "de_DE");
2865 link_check idna 'OPT_IDNA: idnkit' \
2866 '#define HAVE_IDNA n_IDNA_IMPL_IDNKIT' '-lidnkit' << \!
2868 #include <idn/api.h>
2869 #include <idn/result.h>
2873 char local_name[256];
2875 r = idn_encodename(IDN_ENCODE_APP, "does.this.work", ace_name,
2877 if (r != idn_success) {
2878 fprintf(stderr, "idn_encodename failed: %s\n", idn_result_tostring(r));
2881 r = idn_decodename(IDN_DECODE_APP, ace_name, local_name, sizeof(local_name));
2882 if (r != idn_success) {
2883 fprintf(stderr, "idn_decodename failed: %s\n", idn_result_tostring(r));
2892 feat_bail_required IDNA
2897 VAL_IDNA="${VAL_IDNA},bye"
2902 eval val_idna_$randfun && break
2905 feat_is_disabled IDNA
2908 feat_def IMAP_SEARCH
2910 if feat_yes REGEX; then
2911 if link_check regex 'regular expressions' '#define HAVE_REGEX' << \!
2919 status = regcomp(&re, ".*bsd", REG_EXTENDED | REG_ICASE | REG_NOSUB);
2920 xret = regerror(status, &re, NULL, 0);
2921 status = regexec(&re, "plan9", 0,NULL, 0);
2923 return !(status == REG_NOMATCH);
2929 feat_bail_required REGEX
2932 feat_is_disabled REGEX
2935 if feat_yes MLE; then
2936 if [ -n "${have_c90amend1}" ]; then
2938 echo '#define HAVE_MLE' >> ${h}
2940 feat_bail_required MLE
2943 feat_is_disabled MLE
2946 # Generic have-a-line-editor switch for those who need it below
2947 if [ -n "${have_mle}" ]; then
2951 if feat_yes HISTORY; then
2952 if [ -n "${have_cle}" ]; then
2953 echo '#define HAVE_HISTORY' >> ${h}
2955 feat_is_unsupported HISTORY
2958 feat_is_disabled HISTORY
2961 if feat_yes KEY_BINDINGS; then
2962 if [ -n "${have_mle}" ]; then
2963 echo '#define HAVE_KEY_BINDINGS' >> ${h}
2965 feat_is_unsupported KEY_BINDINGS
2968 feat_is_disabled KEY_BINDINGS
2971 if feat_yes TERMCAP; then # {{{
2974 link_check termcap "termcap(5) (via ${4}${ADDINC})" \
2975 "#define HAVE_TERMCAP${3}" "${1}" "${ADDINC}" << _EOT
2980 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
2981 static int my_putc(int c){return putchar(c);}
2983 char buf[1024+512], cmdbuf[2048], *cpb, *r1;
2984 int r2 = OK, r3 = ERR;
2986 tgetent(buf, getenv("TERM"));
2988 r1 = tgetstr(UNCONST("cm"), &cpb);
2990 r2 = tgetnum(UNCONST("Co"));
2991 r3 = tgetflag(UNCONST("ut"));
2992 tputs("cr", 1, &my_putc);
2993 return (r1 == NULL || r2 == -1 || r3 == 0);
2999 link_check terminfo "terminfo(5) (via ${2}${ADDINC})" \
3000 '#define HAVE_TERMCAP
3001 #define HAVE_TERMCAP_CURSES
3002 #define HAVE_TERMINFO' "${1}" "${ADDINC}" << _EOT
3006 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
3007 static int my_putc(int c){return putchar(c);}
3013 r0 = setupterm(NULL, 1, &er);
3014 r1 = tigetflag(UNCONST("bce"));
3015 r2 = tigetnum(UNCONST("colors"));
3016 r3 = tigetstr(UNCONST("cr"));
3017 tp = tparm(r3, NULL, NULL, 0,0,0,0,0,0,0);
3018 tputs(tp, 1, &my_putc);
3019 return (r0 == ERR || r1 == -1 || r2 == -2 || r2 == -1 ||
3020 r3 == (char*)-1 || r3 == NULL);
3025 if feat_yes TERMCAP_VIA_TERMINFO; then
3029 __terminfolib -ltinfo -ltinfo ||
3030 __terminfolib -lcurses -lcurses ||
3031 __terminfolib -lcursesw -lcursesw ||
3035 if [ -n "${xbail}" ] && [ -d /usr/local/include/ncurses ]; then
3036 ADDINC=' -I/usr/local/include/ncurses'
3039 if [ -n "${xbail}" ] && [ -d /usr/include/ncurses ]; then
3040 ADDINC=' -I/usr/include/ncurses'
3043 [ -n "${xbail}" ] && feat_bail_required TERMCAP_VIA_TERMINFO
3046 if [ -z "${have_terminfo}" ]; then
3050 __termcaplib -ltermcap '' '' '-ltermcap' ||
3051 __termcaplib -ltermcap '#include <curses.h>' '
3052 #define HAVE_TERMCAP_CURSES' \
3053 'curses.h / -ltermcap' ||
3054 __termcaplib -lcurses '#include <curses.h>' '
3055 #define HAVE_TERMCAP_CURSES' \
3056 'curses.h / -lcurses' ||
3057 __termcaplib -lcursesw '#include <curses.h>' '
3058 #define HAVE_TERMCAP_CURSES' \
3059 'curses.h / -lcursesw' ||
3063 if [ -n "${xbail}" ] && [ -d /usr/local/include/ncurses ]; then
3064 ADDINC=' -I/usr/local/include/ncurses'
3067 if [ -n "${xbail}" ] && [ -d /usr/include/ncurses ]; then
3068 ADDINC=' -I/usr/include/ncurses'
3071 [ -n "${xbail}" ] && feat_bail_required TERMCAP
3073 if [ -n "${have_termcap}" ]; then
3074 run_check tgetent_null \
3075 "tgetent(3) of termcap(5) takes NULL buffer" \
3076 "#define HAVE_TGETENT_NULL_BUF" << _EOT
3077 #include <stdio.h> /* For C89 NULL */
3079 #ifdef HAVE_TERMCAP_CURSES
3080 # include <curses.h>
3084 tgetent(NULL, getenv("TERM"));
3092 feat_is_disabled TERMCAP
3093 feat_is_disabled TERMCAP_VIA_TERMINFO
3096 if feat_def SPAM_SPAMC; then
3097 if acmd_set i spamc; then
3098 echo "#define SPAM_SPAMC_PATH \"${i}\"" >> ${h}
3102 if feat_yes SPAM_SPAMD; then
3103 if [ -n "${have_af_unix}" ]; then
3104 echo '#define HAVE_SPAM_SPAMD' >> ${h}
3106 feat_bail_required SPAM_SPAMD
3109 feat_is_disabled SPAM_SPAMD
3112 feat_def SPAM_FILTER
3114 if feat_yes SPAM_SPAMC || feat_yes SPAM_SPAMD || feat_yes SPAM_FILTER; then
3115 echo '#define HAVE_SPAM' >> ${h}
3117 echo '/* HAVE_SPAM */' >> ${h}
3120 if feat_yes QUOTE_FOLD; then
3121 if [ -n "${have_c90amend1}" ] && [ -n "${have_wcwidth}" ]; then
3122 echo '#define HAVE_QUOTE_FOLD' >> ${h}
3124 feat_bail_required QUOTE_FOLD
3127 feat_is_disabled QUOTE_FOLD
3130 feat_def FILTER_HTML_TAGSOUP
3138 squeeze_em ${inc} ${tmp}
3140 squeeze_em ${lib} ${tmp}
3145 printf '#ifndef n_MK_CONFIG_H\n# define n_MK_CONFIG_H 1\n' > ${h}
3146 ${cat} ${tmp} >> ${h}
3148 # We need these for correct "second stage configuration changed" detection */
3149 echo "/* `${cat} ${lib}` */" >> ${h}
3150 echo "/* `${cat} ${inc}` */" >> ${h}
3153 # Throw away all temporaries
3154 ${rm} -rf ${tmp0}.* ${tmp0}*
3156 # Create the string that is used by *features* and `version'.
3157 # Take this nice opportunity and generate a visual listing of included and
3158 # non-included features for the person who runs the configuration
3159 echo 'The following features are included (+) or not (-):' > ${tmp}
3160 set -- ${OPTIONS_DETECT} ${OPTIONS} ${OPTIONS_XTRA}
3161 printf '/* The "feature string
" */\n' >> ${h}
3162 # Because + is expanded by *folder* if first in "echo $features", put something
3163 printf '#define VAL_FEATURES_CNT '${#}'\n#define VAL_FEATURES "#' >> ${h}
3167 sdoc
=`option_doc_of ${opt}`
3168 [ -z "${sdoc}" ] && continue
3169 sopt
="`echo ${opt} | ${tr} '[A-Z]_' '[a-z]-'`"
3170 feat_yes
${opt} && sign
=+ || sign
=-
3171 printf -- "${sep}${sign}${sopt}" >> ${h}
3173 printf ' %s %s: %s\n' ${sign} ${sopt} "${sdoc}" >> ${tmp}
3175 # TODO instead of using sh+tr+awk+printf, use awk, drop option_doc_of, inc here
3177 #${awk} -v opts="${OPTIONS_DETECT} ${OPTIONS} ${OPTIONS_XTRA}" \
3178 # -v xopts="${XOPTIONS_DETECT} ${XOPTIONS} ${XOPTIONS_XTRA}" \
3179 printf '"\n' >> ${h}
3181 # Create the real mk-config.mk
3182 # Note we cannout use explicit ./ filename prefix for source and object
3183 # pathnames because of a bug in bmake(1)
3185 if feat_no AMALGAMATION
; then
3186 for i
in `printf '%s\n' "${SRCDIR}"*.c | ${sort}`; do
3187 i
=`basename "${i}" .c`
3188 if [ "${i}" = privsep
]; then
3191 objlist
="${objlist} ${i}.o"
3192 srclist
="${srclist} \$(SRCDIR)${i}.c"
3193 printf '%s: %s\n\t$(ECHO_CC)$(CC) $(CFLAGS) $(INCS) -c %s\n' \
3194 "${i}.o" "\$(SRCDIR)${i}.c" "\$(SRCDIR)${i}.c" >> ${mk}
3196 printf '\nAMALGAM_TARGET =\nAMALGAM_DEP =\n' >> ${mk}
3198 printf '%s:\n\t$(ECHO_CC)$(CC) $(CFLAGS) $(INCS) -c $(SRCDIR)%s\n' \
3199 "main.o
" "main.c
" >> ${mk}
3200 srclist=main.c objlist=main.o
3201 printf '\nAMALGAM_TARGET = main.o\nAMALGAM_DEP = ' >> ${mk}
3203 printf '\n/* HAVE_AMALGAMATION: include sources */\n' >> ${h}
3204 printf '#elif n_MK_CONFIG_H + 0 == 1\n' >> ${h}
3205 printf '# undef n_MK_CONFIG_H\n' >> ${h}
3206 printf '# define n_MK_CONFIG_H 2\n' >> ${h}
3207 for i in `printf '%s\n' "${SRCDIR}"*.c | ${sort}`; do
3209 if [ "${i}" = main.c ] ||
3210 [ "${i}" = privsep.c ]; then
3213 printf '$(SRCDIR)%s ' "${i}" >> ${mk}
3214 printf '# include "%s
%s
"\n' "${SRCDIR}" "${i}" >> ${h}
3218 printf 'OBJ_SRC = %s\nOBJ = %s\n' "${srclist}" "${objlist}" >> "${mk}"
3220 printf '#endif /* n_MK_CONFIG_H */\n' >> ${h}
3222 echo "LIBS = `${cat} ${lib}`" >> ${mk}
3223 echo "INCS
= `${cat} ${inc}`" >> ${mk}
3225 ${cat} "${SRCDIR}"make-config.in >> ${mk}
3229 # We have completed the new configuration header. Check whether *really*
3230 # Do the "second stage configuration changed" detection, exit if nothing to do
3231 if [ -f ${oldh} ]; then
3232 if ${cmp} ${h} ${oldh} >/dev/null 2>&1; then
3233 ${mv} -f ${oldh} ${h}
3234 msg 'Effective configuration is up-to-date'
3239 msg 'Effective configuration has been updated..'
3242 if [ -n "${config_updated}" ]; then
3243 msg 'Wiping away old objects and such'
3244 ( eval "${MAKE} -f ${oldmk} clean" )
3248 while read l; do msg "${l}"; done < ${tmp}
3251 msg ' . System-wide resource file: %s/%s' "${VAL_SYSCONFDIR}" "${VAL_SYSCONFRC}"
3252 msg ' . bindir: %s' "${VAL_BINDIR}"
3253 if feat_yes DOTLOCK; then
3254 msg ' . libexecdir: %s' "${VAL_LIBEXECDIR}"
3256 msg ' . mandir: %s' "${VAL_MANDIR}"
3257 msg ' . M(ail)T(ransfer)A(gent): %s (argv0: %s)' "${VAL_MTA}" "${VAL_MTA_ARGV0}"
3258 msg ' . $MAIL spool directory: %s' "${VAL_MAIL}"
3261 if [ -n "${have_fnmatch}" ] && [ -n "${have_fchdir}" ]; then
3265 if [ -z "${have_fnmatch}" ]; then
3266 msg ' . The function fnmatch(3) could not be found.'
3267 msg ' Filename patterns like wildcard are not supported on your system'
3269 if [ -z "${have_fchdir}" ]; then
3270 msg ' . The function fchdir(2) could not be found.'
3271 msg ' We will use chdir(2) instead.'
3272 msg ' This is a problem only if the current working directory is changed'
3273 msg ' while this program is inside of it'