2 #@ Please see INSTALL and make.rc instead.
7 # The feature set, to be kept in sync with make.rc
8 # If no documentation given, the option is used as such; if doc is a hyphen,
9 # entry is suppressed when configuration overview is printed: most likely for
10 # obsolete features etc.
12 ICONV='Character set conversion using iconv(3)' \
13 SOCKETS='Network support' \
14 SSL='SSL/TLS (OpenSSL)' \
15 SSL_ALL_ALGORITHMS='Support of all digest and cipher algorithms' \
16 SMTP='Simple Mail Transfer Protocol client' \
17 POP3='Post Office Protocol Version 3 client' \
18 GSSAPI='Generic Security Service authentication' \
19 NETRC='.netrc file support' \
21 MD5='MD5 message digest (APOP, CRAM-MD5)' \
22 IDNA='Internationalized Domain Names for Applications (encode only)' \
23 IMAP_SEARCH='IMAP-style search expressions' \
24 REGEX='Regular expressions' \
25 MLE='Mailx Line Editor' \
26 HISTORY='Line editor history management' \
27 KEY_BINDINGS='Configurable key bindings' \
28 TERMCAP='Terminal capability queries (termcap(5))' \
29 TERMCAP_VIA_TERMINFO='Terminal capability queries use terminfo(5)' \
30 ERRORS='Error log message ring' \
31 SPAM_SPAMC='Spam management via spamc(1) of spamassassin(1)' \
33 SPAM_FILTER='Freely configurable *spam-filter-..*s' \
34 DOCSTRINGS='Command documentation help strings' \
35 QUOTE_FOLD='Extended *quote-fold*ing' \
36 FILTER_HTML_TAGSOUP='Simple builtin HTML-to-text display filter' \
37 COLOUR='Coloured message display' \
38 DOTLOCK='Dotlock files and privilege-separated dotlock program' \
41 # Options which are automatically deduced from host environment, i.e., these
42 # need special treatment all around here to warp from/to OPT_ stuff
43 # setlocale, C90AMEND1, NL_LANGINFO, wcwidth
45 LOCALES='Locale support - printable characters etc. depend on environment' \
46 MBYTE_CHARSETS='Multibyte character sets' \
47 TERMINAL_CHARSET='Automatic detection of terminal character set' \
48 WIDE_GLYPHS='Wide glyph support' \
51 # Rather special options, for custom building, or which always exist.
52 # Mostly for generating the visual overview and the *feature* string
54 MIME='Multipurpose Internet Mail Extensions' \
55 SMIME='S/MIME message signing, verification, en- and decryption' \
56 CROSS_BUILD='Cross-compilation: trust any detected environment' \
57 DEBUG='Debug enabled binary, not for end-users: THANKS!' \
58 DEVEL='Computers do not blunder' \
61 # The problem is that we don't have any tools we can use right now, so
62 # encapsulate stuff in functions which get called in right order later on
84 option_parse OPTIONS_DETECT
"${XOPTIONS_DETECT}"
85 option_parse OPTIONS
"${XOPTIONS}"
86 option_parse OPTIONS_XTRA
"${XOPTIONS_XTRA}"
89 # Predefined CONFIG= urations take precedence over anything else
90 if [ -n "${CONFIG}" ]; then
99 [mM
][iI
][nN
][iI
][mM
][aA
][lL
])
105 [mM
][eE
][dD
][iI
][uU
][mM
])
111 OPT_HISTORY
=1 OPT_KEY_BINDINGS
=1
118 [nN
][eE
][tT
][sS
][eE
][nN
][dD
])
124 OPT_GSSAPI
=1 OPT_NETRC
=1 OPT_AGENT
=1
128 OPT_HISTORY
=1 OPT_KEY_BINDINGS
=1
133 [mM
][aA
][xX
][iI
][mM
][aA
][lL
])
137 [dD
][eE
][vV
][eE
][lL
])
138 OPT_DEVEL
=1 OPT_DEBUG
=1 OPT_NYD2
=1
141 [oO
][dD
][eE
][vV
][eE
][lL
])
146 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
147 echo >&2 ' NULL, NULLI, MINIMAL, MEDIUM, NETSEND, MAXIMAL'
154 # Inter-relationships
156 if feat_no SMTP
&& feat_no POP3
; then
159 if feat_no SOCKETS
; then
160 if feat_require SMTP
; then
161 msg
'ERROR: need SOCKETS for required feature SMTP'
164 if feat_require POP3
; then
165 msg
'ERROR: need SOCKETS for required feature POP3'
168 OPT_SSL
=0 OPT_SSL_ALL_ALGORITHMS
=0
169 OPT_SMTP
=0 OPT_POP3
=0
170 OPT_GSSAPI
=0 OPT_NETRC
=0 OPT_AGENT
=0
172 if feat_no SMTP
; then
177 OPT_HISTORY
=0 OPT_KEY_BINDINGS
=0
180 # If we don't need MD5 leave it alone
181 if feat_no SOCKETS
; then
185 if feat_yes DEVEL
; then
188 if feat_yes DEBUG
; then
189 OPT_NOALLOCA
=1 OPT_DEVEL
=1
196 h
=.
/config.h h_name
=config.h
199 newlst
=.
/config.lst-new
200 newmk
=.
/config.mk-new
201 newev
=.
/config.ev-new
207 ## -- >8 - << OPTIONS | OS/CC >> - 8< -- ##
209 # Note that potential duplicates in PATH, C_INCLUDE_PATH etc. will be cleaned
210 # via path_check() later on once possible
212 # TODO cc_maxopt is brute simple, we should compile test program and dig real
213 # compiler versions for known compilers, then be more specific
218 # We don't "have any utility": only path adjustments and such in here!
219 i
="${OS:-`uname -s`}"
221 if [ ${i} = SunOS
]; then
222 msg
'SunOS / Solaris? Applying some "early setup" rules ...'
223 _os_early_setup_sunos
227 _os_early_setup_sunos
() {
228 # According to standards(5), this is what we need to do
229 if [ -d /usr
/xpg4
]; then :; else
230 msg
'ERROR: On SunOS / Solaris we need /usr/xpg4 environment! Sorry.'
233 PATH
="/usr/xpg4/bin:/usr/ccs/bin:/usr/bin:${PATH}"
234 [ -d /usr
/xpg6
] && PATH
="/usr/xpg6/bin:${PATH}"
239 # OSFULLSPEC is used to recognize changes (i.e., machine type, updates etc.)
240 OSFULLSPEC
="${OS:-`uname -a | ${tr} '[A-Z]' '[a-z]'`}"
241 OS
="${OS:-`uname -s | ${tr} '[A-Z]' '[a-z]'`}"
242 msg
'Operating system is %s' ${OS}
244 if [ ${OS} = sunos
]; then
245 msg
' . have special SunOS / Solaris "setup" rules ...'
247 elif [ ${OS} = unixware
]; then
248 msg
' . have special UnixWare environmental rules ...'
249 if feat_yes AUTOCC
&& command -v cc
>/dev
/null
2>&1; then
251 feat_yes DEBUG
&& _CFLAGS
='-v -Xa -g' || _CFLAGS
='-Xa -O'
253 CFLAGS
="${_CFLAGS} ${EXTRA_CFLAGS}"
254 LDFLAGS
="${_LDFLAGS} ${EXTRA_LDFLAGS}"
255 export CC CFLAGS LDFLAGS
256 OPT_AUTOCC
=0 had_want_autocc
=1 need_R_ldflags
=-R
258 elif [ -n "${VERBOSE}" ]; then
259 msg
' . no special treatment for this system necessary or known'
262 # Sledgehammer: better set _GNU_SOURCE
263 # And in general: oh, boy!
264 OS_DEFINES
="${OS_DEFINES}#define _GNU_SOURCE\n"
265 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200809L\n"
266 #OS_DEFINES="${OS_DEFINES}#define _XOPEN_SOURCE 700\n"
267 #[ ${OS} = darwin ] && OS_DEFINES="${OS_DEFINES}#define _DARWIN_C_SOURCE\n"
269 # On pkgsrc(7) systems automatically add /usr/pkg/*
270 if [ -d /usr
/pkg
]; then
271 C_INCLUDE_PATH
="${C_INCLUDE_PATH}:/usr/pkg/include"
272 LD_LIBRARY_PATH
="${LD_LIBRARY_PATH}:/usr/pkg/lib"
277 C_INCLUDE_PATH
="/usr/xpg4/include:${C_INCLUDE_PATH}"
278 LD_LIBRARY_PATH
="/usr/xpg4/lib:${LD_LIBRARY_PATH}"
281 if [ -d /opt
/csw
]; then
282 C_INCLUDE_PATH
="${C_INCLUDE_PATH}:/opt/csw/include"
283 LD_LIBRARY_PATH
="${LD_LIBRARY_PATH}:/opt/csw/lib"
286 OS_DEFINES
="${OS_DEFINES}#define __EXTENSIONS__\n"
287 #OS_DEFINES="${OS_DEFINES}#define _POSIX_C_SOURCE 200112L\n"
289 [ -n "${cksum}" ] ||
cksum=/opt
/csw
/gnu
/cksum
290 if [ -x "${cksum}" ]; then :; else
291 msg
'ERROR: Not an executable program: %s' "${cksum}"
292 msg
'ERROR: We need a CRC-32 cksum(1), as specified in POSIX.'
293 msg
'ERROR: However, we do so only for tests.'
294 msg
'ERROR: If that is ok, set "cksum=/usr/bin/true", then rerun'
298 if feat_yes AUTOCC
; then
299 if command -v cc
>/dev
/null
2>&1; then
301 feat_yes DEBUG
&& _CFLAGS
="-v -Xa -g" || _CFLAGS
="-Xa -O"
303 CFLAGS
="${_CFLAGS} ${EXTRA_CFLAGS}"
304 LDFLAGS
="${_LDFLAGS} ${EXTRA_LDFLAGS}"
305 export CC CFLAGS LDFLAGS
306 OPT_AUTOCC
=0 had_want_autocc
=1 need_R_ldflags
=-R
308 # Assume gcc(1), which supports -R for compat
309 cc_maxopt
=2 force_no_stackprot
=1 need_R_ldflags
=-Wl,-R
314 # Check out compiler ($CC) and -flags ($CFLAGS)
316 # Even though it belongs into cc_flags we will try to compile and link
317 # something, so ensure we have a clean state regarding CFLAGS/LDFLAGS or
318 # EXTRA_CFLAGS/EXTRA_LDFLAGS
319 if feat_no AUTOCC
; then
321 # Ensure those don't do any harm
322 EXTRA_CFLAGS
= EXTRA_LDFLAGS
=
323 export EXTRA_CFLAGS EXTRA_LDFLAGS
327 export CFLAGS LDFLAGS
330 [ -n "${CC}" ] && [ "${CC}" != cc ] && { _cc_default; return; }
332 msg_nonl 'Searching for a usable C compiler .. $CC='
333 if { i="`command -v clang`"; }; then
335 elif { i="`command -v gcc`"; }; then
337 elif { i="`command -v c99`"; }; then
339 elif { i="`command -v tcc`"; }; then
341 elif { i="`command -v pcc`"; }; then
344 if [ "${CC}" = cc ]; then
346 elif { i="`command -v c89`"; }; then
349 msg 'boing booom tschak'
350 msg 'ERROR: I cannot find a compiler!'
351 msg ' Neither of clang(1), gcc(1), tcc(1), pcc(1), c89(1) and c99(1).'
352 msg ' Please set ${CC} environment variable, maybe ${CFLAGS}, rerun.'
361 if [ -z "${CC}" ]; then
362 msg 'To go on like you have chosen, please set $CC, rerun.'
366 if [ -z "${VERBOSE}" ] && [ -f ${lst} ] && feat_no DEBUG; then
369 msg 'Using C compiler ${CC}=%s' "${CC}"
374 if feat_yes AUTOCC; then
375 if [ -f ${lst} ] && feat_no DEBUG && [ -z "${VERBOSE}" ]; then
377 msg 'Detecting ${CFLAGS}/${LDFLAGS} for ${CC}=%s, just a second..' \
381 msg 'Testing usable ${CFLAGS}/${LDFLAGS} for ${CC}=%s' "${CC}"
384 i
=`echo "${CC}" | ${awk} 'BEGIN{FS="/"}{print $NF}'`
385 if { echo "${i}" | ${grep} tcc; } >/dev/null 2>&1; then
386 msg ' . have special tcc(1) environmental rules ...'
389 # As of pcc CVS 2016-04-02, stack protection support is announced but
390 # will break if used on Linux
391 if { echo "${i}" | ${grep} pcc; } >/dev
/null
2>&1; then
397 feat_no DEBUG
&& _CFLAGS
="-DNDEBUG ${_CFLAGS}"
398 CFLAGS
="${_CFLAGS} ${EXTRA_CFLAGS}"
399 LDFLAGS
="${_LDFLAGS} ${EXTRA_LDFLAGS}"
401 if feat_no DEBUG
; then
402 CFLAGS
="-DNDEBUG ${CFLAGS}"
406 export CFLAGS LDFLAGS
410 __cflags
=${_CFLAGS} __ldflags
=${_LDFLAGS}
417 if feat_yes DEBUG
; then
418 # May have problems to find libtcc cc_check -b
422 if ld_check
-Wl,-rpath =.
/ no
; then
423 need_R_ldflags
=-Wl,-rpath=
424 ld_runtime_flags
# update!
427 _CFLAGS
="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
428 unset __cflags __ldflags
431 _cc_flags_generic
() {
432 __cflags
=${_CFLAGS} __ldflags
=${_LDFLAGS}
434 feat_yes DEVEL
&& cc_check
-std=c89 || cc_check
-std=c99
436 # Check -g first since some others may rely upon -g / optim. level
437 if feat_yes DEBUG
; then
440 elif [ ${cc_maxopt} -gt 2 ] && cc_check
-O3; then
442 elif [ ${cc_maxopt} -gt 1 ] && cc_check
-O2; then
444 elif [ ${cc_maxopt} -gt 0 ] && cc_check
-O1; then
450 if feat_yes DEVEL
&& cc_check
-Weverything; then
455 cc_check
-Wbad-function-cast
456 cc_check
-Wcast-align
459 cc_check
-Wmissing-prototypes
462 cc_check
-Wwrite-strings
463 cc_check
-Wno-long-long
467 if feat_yes AMALGAMATION
&& feat_no DEVEL
; then
468 cc_check
-Wno-unused-function
470 feat_no DEVEL
&& cc_check
-Wno-unused-result # XXX do right way (pragma too)
472 cc_check
-fno-unwind-tables
473 cc_check
-fno-asynchronous-unwind-tables
474 cc_check
-fstrict-aliasing
475 if cc_check
-fstrict-overflow && feat_yes DEVEL
; then
476 cc_check
-Wstrict-overflow=5
479 if feat_yes DEBUG || feat_yes FORCED_STACKPROT
; then
480 if [ -z "${force_no_stackprot}" ]; then
481 if cc_check
-fstack-protector-strong ||
482 cc_check
-fstack-protector-all; then
483 cc_check
-D_FORTIFY_SOURCE=2
486 msg
'Not checking for -fstack-protector compiler option,'
487 msg
'since that caused errors in a "similar" configuration.'
488 msg
'You may turn off OPT_AUTOCC and use your own settings, rerun'
492 if feat_yes AMALGAMATION
; then
496 # LD (+ dependend CC)
498 if feat_yes DEVEL
; then
501 #if cc_check -fsanitize=memory &&
502 # ld_check -fsanitize=memory &&
503 # cc_check -fsanitize-memory-track-origins=2 &&
504 # ld_check -fsanitize-memory-track-origins=2; then
511 ld_check
-Wl,-z,relro
513 ld_check
-Wl,-z,noexecstack
514 if ld_check
-Wl,-rpath =.
/ no
; then
515 need_R_ldflags
=-Wl,-rpath=
516 ld_runtime_flags
# update!
517 elif ld_check
-Wl,-R .
/ no
; then
518 need_R_ldflags
=-Wl,-R
519 ld_runtime_flags
# update!
522 # Address randomization
524 if cc_check
-fPIE || cc_check
-fpie; then
525 ld_check
-pie || _CFLAGS
=${_ccfg}
529 _CFLAGS
="${_CFLAGS} ${__cflags}" _LDFLAGS="${_LDFLAGS} ${__ldflags}"
530 unset __cflags __ldflags
533 ## -- >8 - <<OS/CC | SUPPORT FUNS>> - 8< -- ##
536 ## - Heirloom sh(1) (and same origin) have _sometimes_ problems with ': >'
537 ## redirection, so use "printf '' >" instead
539 ## Very first: we undergo several states regarding I/O redirection etc.,
540 ## but need to deal with option updates from within all. Since all the
541 ## option stuff should be above the scissor line, define utility functions
542 ## and redefine them as necessary.
543 ## And, since we have those functions, simply use them for whatever
552 printf >&2 -- "${fmt}\\n" "${@}"
558 printf >&2 -- "${fmt}" "${@}"
561 t1
=ten10one1ten10one1
562 if ( [ ${t1##*ten10} = one1
] && [ ${t1#*ten10} = one1ten10one1
] &&
563 [ ${t1%%one1*} = ten10
] && [ ${t1%one1*} = ten10one1ten10
]
564 ) > /dev
/null
2>&1; then
571 # We need some standard utilities
574 n
=${1} i=${2} opt=${3:-0}
575 # Evaluate, just in case user comes in with shell snippets (..well..)
577 if type "${i}" >/dev
/null
2>&1; then # XXX why have i type not command -v?
578 [ -n "${VERBOSE}" ] && msg ' . ${%s} ... %s' "${n}" "${i}"
582 if [ ${opt} -eq 0 ]; then
583 msg
'ERROR: no trace of utility %s' "${n}"
589 # Our feature check environment
591 [ "x${1}" = x0
] ||
[ "x${1}" = xn
] ||
592 [ "x${1}" = xfalse ] || [ "x${1}" = xno ] || [ "x${1}" = xoff
]
596 [ "x${1}" = x1
] ||
[ "x${1}" = xy
] ||
597 [ "x${1}" = xtrue ] || [ "x${1}" = xyes ] || [ "x${1}" = xon
] ||
598 [ "x${1}" = xrequire
]
602 [ "x${1}" = xrequire
]
607 i
="`echo ${i} | ${tr} '[A-Z]' '[a-z]'`"
608 if feat_val_no
"${i}"; then
610 elif feat_val_yes
"${i}"; then
613 msg
"ERROR: %s: 0/n/false/no/off or 1/y/true/yes/on/require, got: %s" \
624 _feat_check
${1} && return 1
630 i
="`echo ${i} | ${tr} '[A-Z]' '[a-z]'`"
631 [ "x${i}" = xrequire
] ||
[ "x${i}" = xrequired
]
634 feat_bail_required
() {
635 if feat_require
${1}; then
636 msg
'ERROR: feature OPT_%s is required but not available' "${1}"
640 option_update
# XXX this is rather useless here (dependency chain..)
644 # Parse one of our XOPTIONS* in $2 and assign the sh(1) compatible list of
645 # options, without documentation, to $1
647 i
="`${awk} -v input=\"${2}\" '
650 voff = match(input, /[[:alnum:]_]+(='${j}'[^'${j}']+)?/)
653 v = substr(input, voff, RLENGTH)
654 input = substr(input, voff + RLENGTH)
657 d = substr(v, doff + 2, length(v) - doff - 1)
658 v = substr(v, 1, doff - 1)
668 # Return the "documentation string" for option $1, itself if none such
669 ${awk} -v want
="${1}" \
670 -v input
="${XOPTIONS_DETECT}${XOPTIONS}${XOPTIONS_XTRA}" '
673 voff = match(input, /[[:alnum:]_]+(='"'"'[^'"'"']+)?/)
676 v = substr(input, voff, RLENGTH)
677 input = substr(input, voff + RLENGTH)
680 d = substr(v, doff + 2, length(v) - doff - 1)
681 v = substr(v, 1, doff - 1)
695 # Join the values from make.rc into what currently is defined, not
696 # overwriting yet existing settings
698 # We want read(1) to perform backslash escaping in order to be able to use
699 # multiline values in make.rc; the resulting sh(1)/sed(1) code was very slow
700 # in VMs (see [fa2e248]), Aharon Robbins suggested the following
701 < ${rc} ${awk} 'BEGIN{line = ""}{
702 gsub
(/^
[[:space
:]]+/, "", $0)
703 gsub
(/[[:space
:]]+$
/, "", $0)
704 if(gsub
(/\\$
/, "", $0)){
709 if(index
(line
, "#") == 1){
711 }else if(length
(line
)){
717 if [ -n "${good_shell}" ]; then
720 i=`${awk} -v LINE="${line}" 'BEGIN
{
721 gsub
(/=.
*$
/, "", LINE
)
725 if [ "${i}" = "${line}" ]; then
726 msg 'ERROR
: invalid syntax
in: %s
' "${line}"
730 eval j="\$${i}" jx="\${${i}+x}"
731 if [ -n "${j}" ] || [ "${jx}" = x ]; then
734 j=`${awk} -v LINE="${line}" 'BEGIN
{
735 gsub
(/^
[^
=]*=/, "", LINE
)
736 gsub
(/^
\"*/, "", LINE
)
737 gsub
(/\"*$
/, "", LINE
)
741 [ "${i}" = "DESTDIR" ] && continue
744 # Reread the mixed version right now
749 # Expand the option values, which may contain shell snippets
750 ${rm} -f ${newlst} ${newmk} ${newh}
751 exec 5<&0 6>&1 <${tmp} >${newlst}
754 if [ -n "${good_shell}" ]; then
756 [ "${i}" != "${i#OPT_}" ] && z=1
758 i=`${awk} -v LINE="${line}" 'BEGIN
{
759 gsub
(/=.
*$
/, "", LINE
);\
762 if echo "${i}" | ${grep} '^OPT_
' >/dev/null 2>&1; then
768 if [ -n "${z}" ]; then
769 j="`echo ${j} | ${tr} '[A-Z
]' '[a-z
]'`"
770 if [ -z "${j}" ] || feat_val_no "${j}"; then
772 printf " /* #undef ${i} */\n" >> ${newh}
773 elif feat_val_yes "${j}"; then
774 if feat_val_require "${j}"; then
779 printf " /* #define ${i} */\n" >> ${newh}
781 msg 'ERROR
: cannot parse
<%s
>' "${line}"
785 printf "#define ${i} \"${j}\"\n" >> ${newh}
787 printf "${i} = ${j}\n" >> ${newmk}
791 exec 0<&5 1>&6 5<&- 6<&-
795 # "path_check VARNAME" or "path_check VARNAME FLAG VARNAME"
796 varname=${1} addflag=${2} flagvarname=${3}
804 [ -z "${i}" ] && continue
805 [ -d "${i}" ] || continue
806 # Skip any fakeroot packager environment
807 case "${i}" in *fakeroot*) continue;; esac
808 if [ -n "${j}" ]; then
809 if { z=${y}; echo "${z}"; } | ${grep} ":${i}:" >/dev/null 2>&1; then
814 [ -n "${addflag}" ] && k="${k} ${addflag}${i}"
819 [ -n "${addflag}" ] && k="${addflag}${i}"
822 eval "${varname}=\"${j}\""
823 [ -n "${addflag}" ] && eval "${flagvarname}=\"${k}\""
828 if [ -n "${need_R_ldflags}" ]; then
831 set -- ${LD_LIBRARY_PATH}
835 LDFLAGS="${LDFLAGS} ${need_R_ldflags}${i}"
836 _LDFLAGS="${_LDFLAGS} ${need_R_ldflags}${i}"
840 # Disable it for a possible second run.
845 [ -n "${cc_check_silent}" ] || msg_nonl ' . CC
%s ..
' "${1}"
847 ${_CFLAGS} ${1} ${EXTRA_CFLAGS} ${_LDFLAGS} ${EXTRA_LDFLAGS} \
848 -o ${tmp2} ${tmp}.c ${LIBS} >/dev/null 2>&1; then
849 _CFLAGS="${_CFLAGS} ${1}"
850 [ -n "${cc_check_silent}" ] || msg 'yes'
853 [ -n "${cc_check_silent}" ] || msg 'no
'
858 # $1=option [$2=option argument] [$3=if set, shall NOT be added to _LDFLAGS]
859 [ -n "${cc_check_silent}" ] || msg_nonl ' . LD
%s ..
' "${1}"
860 if "${CC}" ${INCS} ${_CFLAGS} ${_LDFLAGS} ${1}${2} ${EXTRA_LDFLAGS} \
861 -o ${tmp2} ${tmp}.c ${LIBS} >/dev/null 2>&1; then
862 [ -n "${3}" ] || _LDFLAGS="${_LDFLAGS} ${1}"
863 [ -n "${cc_check_silent}" ] || msg 'yes'
866 [ -n "${cc_check_silent}" ] || msg 'no
'
871 variable=$1 topic=$2 define=$3
874 msg_nonl ' .
%s ...
' "${topic}"
875 echo "/* checked ${topic} */" >> ${h}
876 ${rm} -f ${tmp} ${tmp}.o
877 echo '*** test program is
'
878 { echo '#include <'"${h_name}"'>'; cat; } | ${tee} ${tmp}.c
879 #echo '*** the preprocessor generates'
880 #${make} -f ${makefile} ${tmp}.x
882 echo '*** results are'
886 variable
=$1 topic
=$2 define
=$3
888 _check_preface
"${variable}" "${topic}" "${define}"
890 if ${make} -f ${makefile} XINCS="${INCS}" ./${tmp}.o
&&
891 [ -f .
/${tmp}.o
]; then
893 echo "${define}" >> ${h}
894 eval have_
${variable}=yes
897 echo "/* ${define} */" >> ${h}
899 eval unset have_
${variable}
905 run
=$1 variable
=$2 topic
=$3 define
=$4 libs
=$5 incs
=$6
907 _check_preface
"${variable}" "${topic}" "${define}"
909 feat_yes CROSS_BUILD
&& run
=0
911 if ${make} -f ${makefile} XINCS="${INCS} ${incs}" \
912 XLIBS="${LIBS} ${libs}" ./${tmp} &&
914 { [ ${run} -eq 0 ] || ./${tmp}; }; then
915 echo "*** adding INCS<${incs}> LIBS<${libs}>; executed: ${run}"
917 echo "${define}" >> ${h}
918 LIBS
="${LIBS} ${libs}"
919 echo "${libs}" >> ${lib}
920 INCS
="${INCS} ${incs}"
921 echo "${incs}" >> ${inc}
922 eval have_
${variable}=yes
926 echo "/* ${define} */" >> ${h}
927 eval unset have_
${variable}
933 _link_mayrun
0 "${1}" "${2}" "${3}" "${4}" "${5}"
937 _link_mayrun
1 "${1}" "${2}" "${3}" "${4}" "${5}"
941 if feat_yes
${1}; then
942 echo '#define HAVE_'${1}'' >> ${h}
944 echo '/* OPT_'${1}'=0 */' >> ${h}
949 < "${1}" > "${2}" ${awk} \
950 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
953 ## -- >8 - <<SUPPORT FUNS | RUNNING>> - 8< -- ##
955 # First of all, create new configuration and check whether it changed
957 # Very easy checks for the operating system in order to be able to adjust paths
958 # or similar very basic things which we need to be able to go at all
961 # Check those tools right now that we need before including $rc
962 msg 'Checking for basic utility set'
963 check_tool awk "${awk:-`command -v awk`}"
964 check_tool rm "${rm:-`command -v rm`}"
965 check_tool tr "${tr:-`command -v tr`}"
967 # Initialize the option set
968 msg_nonl 'Setting up configuration options ... '
972 # Include $rc, but only take from it what wasn't overwritten by the user from
973 # within the command line or from a chosen fixed CONFIG=
974 # Note we leave alone the values
975 trap "exit 1" HUP INT TERM
976 trap "${rm} -f ${tmp}" EXIT
978 msg_nonl 'Joining in %s ... ' ${rc}
982 # We need to know about that now, in order to provide utility overwrites etc.
985 msg 'Checking for remaining set of utilities'
986 check_tool grep "${grep:-`command -v grep`}"
988 # Before we step ahead with the other utilities perform a path cleanup first.
992 check_tool cat "${cat:-`command -v cat`}"
993 check_tool chmod "${chmod:-`command -v chmod`}"
994 check_tool cp "${cp:-`command -v cp`}"
995 check_tool cmp "${cmp:-`command -v cmp`}"
997 check_tool mkdir "${mkdir:-`command -v mkdir`}"
998 check_tool mv "${mv:-`command -v mv`}"
1000 check_tool sed "${sed:-`command -v sed`}"
1001 check_tool sort "${sort:-`command -v sort`}"
1002 check_tool tee "${tee:-`command -v tee`}"
1004 check_tool chown "${chown:-`command -v chown`}" 1 ||
1005 check_tool chown "/sbin
/chown
" 1 ||
1006 check_tool chown "/usr
/sbin
/chown
"
1008 check_tool make "${MAKE:-`command -v make`}"
1010 check_tool strip "${STRIP:-`command -v strip`}" 1 &&
1011 HAVE_STRIP=1 || HAVE_STRIP=0
1013 # For ./cc-test.sh only
1014 check_tool cksum "${cksum:-`command -v cksum`}"
1016 # Update OPT_ options now, in order to get possible inter-dependencies right
1019 # (No functions since some shells loose non-exported variables in traps)
1020 trap "trap \"\" HUP INT TERM
; exit 1" HUP INT TERM
1021 trap "trap \"\" HUP INT TERM EXIT
;\
1022 ${rm} -rf ${newlst} ${tmp0}.* ${tmp0}* ${newmk} ${newev} ${newh}" EXIT
1024 # Our configuration options may at this point still contain shell snippets,
1025 # we need to evaluate them in order to get them expanded, and we need those
1026 # evaluated values not only in our new configuration file, but also at hand..
1027 msg_nonl 'Evaluating all configuration items ... '
1031 # Add the known utility and some other variables
1032 printf "#define VAL_UAGENT \"${VAL_SID}${VAL_NAIL}\"\n" >> ${newh}
1033 printf "VAL_UAGENT = ${VAL_SID}${VAL_NAIL}\n" >> ${newmk}
1035 printf "#define VAL_PRIVSEP \"${VAL_SID}${VAL_NAIL}-privsep\"\n" >> ${newh}
1036 printf "VAL_PRIVSEP = \$(VAL_UAGENT)-privsep\n" >> ${newmk}
1037 if feat_yes DOTLOCK
; then
1038 printf "OPTIONAL_PRIVSEP = \$(VAL_PRIVSEP)\n" >> ${newmk}
1040 printf "OPTIONAL_PRIVSEP =\n" >> ${newmk}
1044 awk cat chmod chown
cp cmp grep mkdir
mv rm sed sort tee tr \
1045 MAKE MAKEFLAGS
make SHELL strip \
1048 printf "${i} = ${j}\n" >> ${newmk}
1049 printf "${i}=${j}\n" >> ${newlst}
1050 printf "${i}=\"${j}\";export ${i}; " >> ${newev}
1052 printf "\n" >> ${newev}
1054 # Build a basic set of INCS and LIBS according to user environment.
1055 path_check C_INCLUDE_PATH -I _INCS
1056 INCS="${INCS} ${_INCS}"
1057 path_check LD_LIBRARY_PATH -L _LIBS
1058 LIBS="${LIBS} ${_LIBS}"
1060 export C_INCLUDE_PATH LD_LIBRARY_PATH
1062 # Some environments need runtime path flags to be able to go at all
1065 ## Detect CC, whether we can use it, and possibly which CFLAGS we can use
1069 ${cat} > ${tmp}.c << \!
1072 static void doit(char const *s);
1074 main(int argc, char **argv){
1077 doit("Hello world
");
1081 doit(char const *s){
1083 memcpy(buf, s, strlen(s) +1);
1088 if "${CC}" ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} \
1089 -o ${tmp2} ${tmp}.c ${LIBS}; then
1092 msg
'ERROR: i cannot compile a "Hello world" via'
1094 "${CC} ${INCS} ${CFLAGS} ${EXTRA_CFLAGS} ${LDFLAGS} ${EXTRA_LDFLAGS} ${LIBS}"
1095 msg
'ERROR: Please read INSTALL, rerun'
1099 # This may also update ld_runtime_flags() (again)
1106 printf -- "${i}=${j}\n" >> ${newlst}
1112 PATH C_INCLUDE_PATH LD_LIBRARY_PATH \
1116 printf -- "${i} = ${j}\n" >> ${newmk}
1117 printf -- "${i}=${j}\n" >> ${newlst}
1120 # Now finally check whether we already have a configuration and if so, whether
1121 # all those parameters are still the same.. or something has actually changed
1122 if [ -f ${lst} ] && ${cmp} ${newlst} ${lst} >/dev/null 2>&1; then
1123 echo 'Configuration is up-to-date'
1125 elif [ -f ${lst} ]; then
1126 echo 'Configuration has been updated..'
1127 ( eval "${MAKE} -f .
/mk.mk clean
" )
1130 echo 'Shiny configuration..'
1133 # Time to redefine helper 1
1135 ${rm} -f ${lst} ${h} ${mk}
1139 ${mv} -f ${newlst} ${lst}
1140 ${mv} -f ${newev} ${ev}
1141 ${mv} -f ${newh} ${h}
1142 ${mv} -f ${newmk} ${mk}
1144 if [ -z "${VERBOSE}" ]; then
1145 printf -- "ECHO_CC
= @
echo ' 'CC \$
(@
);\n" >> ${mk}
1146 printf -- "ECHO_LINK
= @
echo ' 'LINK \$
(@
);\n" >> ${mk}
1147 printf -- "ECHO_GEN
= @
echo ' 'GEN \$
(@
);\n" >> ${mk}
1148 printf -- "ECHO_TEST
= @
\n" >> ${mk}
1149 printf -- "ECHO_CMD
= @
echo ' CMD';\n" >> ${mk}
1150 printf -- "ECHO_BLOCK_BEGIN
= @
( \n" >> ${mk}
1151 printf -- "ECHO_BLOCK_END
= ) >/dev
/null
\n" >> ${mk}
1154 ## Compile and link checking
1160 makefile=./config.mk
1162 # (No function since some shells loose non-exported variables in traps)
1163 trap "trap \"\" HUP INT TERM
;\
1164 ${rm} -f ${lst} ${h} ${mk} ${lib} ${inc}; exit 1" HUP INT TERM
1165 trap "trap \"\" HUP INT TERM EXIT
;\
1166 ${rm} -rf ${tmp0}.* ${tmp0}* ${makefile}" EXIT
1168 # Time to redefine helper 2
1172 printf "*** ${fmt}\\n
" "${@}"
1173 printf -- "${fmt}\\n
" "${@}" >&5
1178 printf "*** ${fmt}\\n
" "${@}"
1179 printf -- "${fmt}" "${@}" >&5
1183 exec 5>&2 > ${log} 2>&1
1185 echo "${LIBS}" > ${lib}
1186 echo "${INCS}" > ${inc}
1187 ${cat} > ${makefile} << \!
1188 .SUFFIXES: .o .c .x .y
1190 $(CC) -I./ $(XINCS) $(CFLAGS) -c $(<)
1192 $(CC) -I./ $(XINCS) -E $(<) > $(@)
1194 $(CC) -I./ $(XINCS) $(CFLAGS) $(LDFLAGS) -o $(@) $(<) $(XLIBS)
1199 # May be multiline..
1200 [ -n "${OS_DEFINES}" ] && printf -- "${OS_DEFINES}" >> ${h}
1202 feat_def AMALGAMATION
1203 feat_def CROSS_BUILD
1211 if run_check inline
'"inline" functions' \
1212 '#define HAVE_INLINE
1213 #define n_INLINE static inline' << \
!
1214 static inline int ilf
(int i
){return ++i
;}
1215 int main
(void
){return ilf
(-1);}
1219 elif run_check inline
'"__inline" functions' \
1220 '#define HAVE_INLINE
1221 #define n_INLINE static __inline' << \
!
1222 static __inline int ilf
(int i
){return ++i
;}
1223 int main
(void
){return ilf
(-1);}
1229 if run_check endian
'Little endian byteorder' \
1230 '#define HAVE_BYTE_ORDER_LITTLE' << \
!
1232 enum
{vBig
= 1, vLittle
= 0};
1233 union
{unsigned short bom
; unsigned char buf
[2];} u
;
1235 return((u.buf
[1] == 0xFE) ? vLittle
: vBig
);
1242 ## Test for "basic" system-calls / functionality that is used by all parts
1243 ## of our program. Once this is done fork away BASE_LIBS and other BASE_*
1244 ## macros to be used by only the subprograms (potentially).
1246 if run_check clock_gettime
'clock_gettime(2)' \
1247 '#define HAVE_CLOCK_GETTIME' << \
!
1253 if(!clock_gettime
(CLOCK_REALTIME
, &ts
) || errno
!= ENOSYS
)
1260 elif run_check clock_gettime
'clock_gettime(2) (via -lrt)' \
1261 '#define HAVE_CLOCK_GETTIME' '-lrt' << \
!
1267 if(!clock_gettime
(CLOCK_REALTIME
, &ts
) || errno
!= ENOSYS
)
1274 elif run_check gettimeofday
'gettimeofday(2)' \
1275 '#define HAVE_GETTIMEOFDAY' << \
!
1276 #include <stdio.h> /* For C89 NULL */
1277 #include <sys/time.h>
1282 if(!gettimeofday
(&tv
, NULL
) || errno
!= ENOSYS
)
1290 have_no_subsecond_time
=1
1293 if run_check nanosleep
'nanosleep(2)' \
1294 '#define HAVE_NANOSLEEP' << \
!
1301 ts.tv_nsec
= 100000;
1302 if(!nanosleep
(&ts
, NULL
) || errno
!= ENOSYS
)
1309 elif run_check nanosleep
'nanosleep(2) (via -lrt)' \
1310 '#define HAVE_NANOSLEEP' '-lrt' << \
!
1317 ts.tv_nsec
= 100000;
1318 if(!nanosleep
(&ts
, NULL
) || errno
!= ENOSYS
)
1325 # link_check is enough for this, that function is so old, trust the proto
1326 elif link_check
sleep 'sleep(3)' \
1327 '#define HAVE_SLEEP' << \
!
1331 if(!sleep(1) || errno
!= ENOSYS
)
1339 msg
'ERROR: we require one of nanosleep(2) and sleep(3).'
1343 if run_check userdb
'gete?[gu]id(2), getpwuid(3), getpwnam(3)' << \
!
1352 if((gid
= getgid
()) != 0)
1354 if((uid
= getuid
()) != 0)
1356 if((pw
= getpwuid
(uid
)) == NULL
&& errno
== ENOSYS
)
1358 if((pw
= getpwnam
("root")) == NULL
&& errno
== ENOSYS
)
1366 msg
'ERROR: we require user and group info / database searches.'
1367 msg
'That much Unix we indulge ourselfs.'
1371 if link_check ftruncate
'ftruncate(2)' \
1372 '#define HAVE_FTRUNCATE' << \
!
1374 #include <sys/types.h>
1376 return (ftruncate
(0, 0) != 0);
1382 msg
'ERROR: we require the ftruncate(2) system call.'
1386 if run_check sa_restart
'SA_RESTART (for sigaction(2))' << \
!
1390 struct sigaction nact
, oact
;
1392 nact.sa_handler
= SIG_DFL
;
1393 sigemptyset
(&nact.sa_mask
);
1394 nact.sa_flags
= SA_RESTART
;
1395 return !(!sigaction
(SIGCHLD
, &nact
, &oact
) || errno
!= ENOSYS
);
1401 msg
'ERROR: we (yet) require the SA_RESTART flag for sigaction(2).'
1405 if link_check snprintf
'snprintf(3)' << \
!
1410 snprintf
(b
, sizeof b
, "%s", "string");
1417 msg
'ERROR: we require the snprintf(3) function.'
1421 if link_check environ
'environ(3)' << \
!
1422 #include <stdio.h> /* For C89 NULL */
1424 extern char
**environ
;
1426 return environ
[0] == NULL
;
1432 msg
'ERROR: we require the environ(3) array for subprocess control.'
1436 if link_check setenv
'(un)?setenv(3)' '#define HAVE_SETENV' << \
!
1439 setenv
("s-mailx", "i want to see it cute!", 1);
1440 unsetenv
("s-mailx");
1446 elif link_check setenv
'putenv(3)' '#define HAVE_PUTENV' << \
!
1449 putenv
("s-mailx=i want to see it cute!");
1456 msg
'ERROR: we require either the setenv(3) or putenv(3) functions.'
1460 if link_check termios
'termios.h and tc*(3) family' << \
!
1461 #include <termios.h>
1463 struct termios tios
;
1465 tcgetattr
(0, &tios
);
1466 tcsetattr
(0, TCSANOW | TCSADRAIN | TCSAFLUSH
, &tios
);
1473 msg
'ERROR: we require termios.h and the tc*() family of functions.'
1474 msg
'That much Unix we indulge ourselfs.'
1480 if link_check vsnprintf
'vsnprintf(3)' << \
!
1483 static void dome
(char
*buf
, size_t blen
, ...
){
1487 vsnprintf
(buf
, blen
, "%s", ap
);
1493 dome
(b
, sizeof b
, "string");
1500 feat_bail_required ERRORS
1503 if [ "${have_vsnprintf}" = yes ]; then
1504 link_check va_copy
'va_copy(3)' '#define HAVE_VA_COPY' << \
!
1507 static void dome2
(char
*buf
, size_t blen
, va_list src
){
1511 vsnprintf
(buf
, blen
, "%s", ap
);
1514 static void dome
(char
*buf
, size_t blen
, ...
){
1518 dome2
(buf
, blen
, ap
);
1524 dome
(b
, sizeof b
, "string");
1530 run_check pathconf
'f?pathconf(2)' '#define HAVE_PATHCONF' << \
!
1537 rv |
= !(pathconf
(".", _PC_NAME_MAX
) >= 0 || errno
== 0 || errno
!= ENOSYS
);
1539 rv |
= !(pathconf
(".", _PC_PATH_MAX
) >= 0 || errno
== 0 || errno
!= ENOSYS
);
1541 /* Only link check
*/
1542 fpathconf
(0, _PC_NAME_MAX
);
1548 run_check pipe2
'pipe2(2)' '#define HAVE_PIPE2' << \
!
1555 if(!pipe2
(fds
, O_CLOEXEC
) || errno
!= ENOSYS
)
1561 # We use this only then for now (need NOW+1)
1562 run_check utimensat
'utimensat(2)' '#define HAVE_UTIMENSAT' << \
!
1563 #include <fcntl.h> /* For AT_* */
1564 #include <sys/stat.h>
1567 struct timespec ts
[2];
1569 ts
[0].tv_nsec
= UTIME_NOW
;
1570 ts
[1].tv_nsec
= UTIME_OMIT
;
1571 if(!utimensat
(AT_FDCWD
, "", ts
, 0) || errno
!= ENOSYS
)
1579 # XXX Add POSIX check once standardized
1580 if link_check posix_random
'arc4random(3)' '#define HAVE_POSIX_RANDOM 0' << \
!
1589 elif [ -n "${have_no_subsecond_time}" ]; then
1590 msg
'ERROR: %s %s' 'without a native random' \
1591 'one of clock_gettime(2) and gettimeofday(2) is required.'
1595 link_check putc_unlocked
'putc_unlocked(3)' '#define HAVE_PUTC_UNLOCKED' <<\
!
1598 putc_unlocked
('@', stdout
);
1603 link_check fchdir
'fchdir(3)' '#define HAVE_FCHDIR' << \
!
1611 if run_check realpath
'realpath(3)' '#define HAVE_REALPATH' << \
!
1614 char x_buf
[4096], *x
= realpath
(".", x_buf
);
1616 return (x
!= NULL
) ?
0 : 1;
1620 if run_check realpath_malloc
'realpath(3) takes NULL' \
1621 '#define HAVE_REALPATH_NULL' << \
!
1624 char
*x
= realpath
(".", NULL
);
1628 return (x
!= NULL
) ?
0 : 1;
1636 ## optional and selectable
1638 if feat_no NOALLOCA
; then
1639 # Due to NetBSD PR lib/47120 it seems best not to use non-cc-builtin
1640 # versions of alloca(3) since modern compilers just can't be trusted
1641 # not to overoptimize and silently break some code
1642 run_check alloca
'__builtin_alloca()' \
1643 '#define HAVE_ALLOCA __builtin_alloca' << \
!
1644 #include <stdio.h> /* For C89 NULL */
1646 void
*vp
= __builtin_alloca
(1);
1648 return (vp
!= NULL
);
1653 if feat_yes DOTLOCK
; then
1654 if run_check readlink
'readlink(2)' << \
!
1660 if(!readlink
("here", buf
, sizeof buf
) || errno
!= ENOSYS
)
1668 feat_bail_required DOTLOCK
1672 if feat_yes DOTLOCK
; then
1673 if run_check fchown
'fchown(2)' << \
!
1677 if(!fchown
(0, 0, 0) || errno
!= ENOSYS
)
1685 feat_bail_required DOTLOCK
1689 ## Now it is the time to fork away the BASE_ series
1692 squeeze_em
${inc} ${tmp}
1694 squeeze_em
${lib} ${tmp}
1697 echo "BASE_LIBS = `${cat} ${lib}`" >> ${mk}
1698 echo "BASE_INCS
= `${cat} ${inc}`" >> ${mk}
1700 ## The remains are expected to be used only by the main MUA binary!
1703 link_check setlocale 'setlocale(3)' '#define HAVE_SETLOCALE' << \!
1706 setlocale(LC_ALL, "");
1710 [ -n "${have_setlocale}" ] && OPT_LOCALES=1
1712 OPT_MBYTE_CHARSETS=0
1714 OPT_TERMINAL_CHARSET=0
1715 if [ -n "${have_setlocale}" ]; then
1716 link_check c90amend1 'ISO/IEC 9899:1990/Amendment 1:1995' \
1717 '#define HAVE_C90AMEND1' << \!
1723 char mbb[MB_LEN_MAX + 1];
1728 mbtowc(&wc, "x", 1);
1729 mbrtowc(&wc, "x", 1, NULL);
1731 return (mblen("\0", 1) == 0);
1734 [ -n "${have_c90amend1}" ] && OPT_MBYTE_CHARSETS=1
1736 if [ -n "${have_c90amend1}" ]; then
1737 link_check wcwidth 'wcwidth(3)' '#define HAVE_WCWIDTH' << \!
1744 [ -n "${have_wcwidth}" ] && OPT_WIDE_GLYPHS=1
1747 link_check nl_langinfo 'nl_langinfo(3)' '#define HAVE_NL_LANGINFO' << \!
1748 #include <langinfo.h>
1752 return (nl_langinfo(CODESET) == NULL);
1755 [ -n "${have_nl_langinfo}" ] && OPT_TERMINAL_CHARSET=1
1758 link_check fnmatch 'fnmatch(3)' '#define HAVE_FNMATCH' << \!
1759 #include <fnmatch.h>
1761 return (fnmatch("*", ".", FNM_PATHNAME | FNM_PERIOD) == FNM_NOMATCH);
1765 link_check dirent_d_type 'struct dirent.d_type' '#define HAVE_DIRENT_TYPE' << \!
1769 return !(de.d_type == DT_UNKNOWN ||
1770 de.d_type == DT_DIR || de.d_type == DT_LNK);
1774 ## optional and selectable
1776 if feat_yes ICONV; then
1777 ${cat} > ${tmp2}.c << \!
1778 #include <stdio.h> /* For C89 NULL */
1783 id = iconv_open("foo", "bar");
1784 iconv(id, NULL, NULL, NULL, NULL);
1789 < ${tmp2}.c link_check iconv 'iconv(3) functionality' \
1790 '#define HAVE_ICONV' ||
1791 < ${tmp2}.c link_check iconv 'iconv(3) functionality (via -liconv)' \
1792 '#define HAVE_ICONV' '-liconv' ||
1793 feat_bail_required ICONV
1795 echo '/* OPT_ICONV=0 */' >> ${h}
1798 if feat_yes SOCKETS || feat_yes SPAM_SPAMD; then
1799 ${cat} > ${tmp2}.c << \!
1800 #include <sys/types.h>
1801 #include <sys/socket.h>
1805 struct sockaddr_un soun;
1807 if(socket(AF_UNIX, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
1809 if(connect(0, (struct sockaddr*)&soun, 0) == -1 && errno == ENOSYS)
1811 if(shutdown(0, SHUT_RD | SHUT_WR | SHUT_RDWR) == -1 && errno == ENOSYS)
1817 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets' \
1818 '#define HAVE_UNIX_SOCKETS' ||
1819 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lnsl)' \
1820 '#define HAVE_UNIX_SOCKETS' '-lnsl' ||
1821 < ${tmp2}.c run_check af_unix 'AF_UNIX sockets (via -lsocket -lnsl)' \
1822 '#define HAVE_UNIX_SOCKETS' '-lsocket -lnsl'
1825 if feat_yes SOCKETS; then
1826 ${cat} > ${tmp2}.c << \!
1828 #include <sys/types.h>
1829 #include <sys/socket.h>
1830 #include <netinet/in.h>
1835 if(socket(AF_INET, SOCK_STREAM, 0) == -1 && errno == ENOSYS)
1837 if(connect(0, &s, 0) == -1 && errno == ENOSYS)
1843 < ${tmp2}.c run_check sockets 'sockets' \
1844 '#define HAVE_SOCKETS' ||
1845 < ${tmp2}.c run_check sockets 'sockets (via -lnsl)' \
1846 '#define HAVE_SOCKETS' '-lnsl' ||
1847 < ${tmp2}.c run_check sockets 'sockets (via -lsocket -lnsl)' \
1848 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
1849 feat_bail_required SOCKETS
1851 echo '/* OPT_SOCKETS=0 */' >> ${h}
1852 fi # feat_yes SOCKETS
1854 if feat_yes SOCKETS; then
1855 link_check getaddrinfo 'getaddrinfo(3)' \
1856 '#define HAVE_GETADDRINFO' << \!
1858 #include <sys/types.h>
1859 #include <sys/socket.h>
1863 struct addrinfo a, *ap;
1866 switch((lrv = getaddrinfo("foo", "0", &a, &ap))){
1870 fprintf(stderr, "%s\n", gai_strerror(lrv));
1879 if feat_yes SOCKETS && [ -z "${have_getaddrinfo}" ]; then
1880 compile_check arpa_inet_h '<arpa/inet.h>' \
1881 '#define HAVE_ARPA_INET_H' << \!
1883 #include <sys/types.h>
1884 #include <sys/socket.h>
1886 #include <netinet/in.h>
1887 #include <arpa/inet.h>
1890 ${cat} > ${tmp2}.c << \!
1892 #include <sys/types.h>
1893 #include <sys/socket.h>
1897 #include <netinet/in.h>
1898 #ifdef HAVE_ARPA_INET_H
1899 #include <arpa/inet.h>
1902 struct sockaddr_in servaddr;
1903 unsigned short portno;
1906 struct in_addr **pptr;
1909 if((ep = getservbyname("POPPY-PORT", "tcp")) != NULL)
1910 portno = (unsigned short)ep->s_port;
1912 if((hp = gethostbyname("POPPY-HOST")) != NULL){
1913 pptr = (struct in_addr**)hp->h_addr_list;
1914 if(hp->h_addrtype != AF_INET)
1915 fprintf(stderr, "au\n");
1918 case HOST_NOT_FOUND:
1924 fprintf(stderr, "au\n");
1929 memset(&servaddr, 0, sizeof servaddr);
1930 servaddr.sin_family = AF_INET;
1931 servaddr.sin_port = htons(portno);
1932 memcpy(&servaddr.sin_addr, *pptr, sizeof(struct in_addr));
1933 fprintf(stderr, "Would connect to %s:%d ...\n",
1934 inet_ntoa(**pptr), (int)portno);
1939 < ${tmp2}.c link_check gethostbyname 'get(serv|host)byname(3)' ||
1940 < ${tmp2}.c link_check gethostbyname \
1941 'get(serv|host)byname(3) (via -nsl)' '' '-lnsl' ||
1942 < ${tmp2}.c link_check gethostbyname \
1943 'get(serv|host)byname(3) (via -lsocket -nsl)' \
1944 '' '-lsocket -lnsl' ||
1945 feat_bail_required SOCKETS
1949 run_check setsockopt 'setsockopt(2)' '#define HAVE_SETSOCKOPT' << \!
1950 #include <sys/socket.h>
1956 if(setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, NULL, 0) == -1 &&
1963 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
1964 link_check so_sndtimeo 'SO_SNDTIMEO' '#define HAVE_SO_SNDTIMEO' << \!
1965 #include <sys/socket.h>
1973 setsockopt(sockfd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof tv);
1974 setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
1979 feat_yes SOCKETS && [ -n "${have_setsockopt}" ] &&
1980 link_check so_linger 'SO_LINGER' '#define HAVE_SO_LINGER' << \!
1981 #include <sys/socket.h>
1989 setsockopt(sockfd, SOL_SOCKET, SO_LINGER, &li, sizeof li);
1994 if feat_yes SSL; then
1995 if link_check openssl 'OpenSSL (new style *_client_method(3ssl))' \
1997 #define HAVE_OPENSSL 10100' '-lssl -lcrypto' << \!
1998 #include <openssl/ssl.h>
1999 #include <openssl/err.h>
2000 #include <openssl/x509v3.h>
2001 #include <openssl/x509.h>
2002 #include <openssl/rand.h>
2003 #ifdef OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
2004 # error We need TLSv1.
2007 SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
2010 PEM_read_PrivateKey(0, 0, 0, 0);
2016 elif link_check openssl 'OpenSSL (old style *_client_method(3ssl))' \
2018 #define HAVE_OPENSSL 10000' '-lssl -lcrypto' << \!
2019 #include <openssl/ssl.h>
2020 #include <openssl/err.h>
2021 #include <openssl/x509v3.h>
2022 #include <openssl/x509.h>
2023 #include <openssl/rand.h>
2024 #if defined OPENSSL_NO_SSL3 &&\
2025 defined OPENSSL_NO_TLS1 /* TODO only deduced from OPENSSL_NO_SSL[23]! */
2026 # error We need one of SSLv3 and TLSv1.
2029 SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
2032 PEM_read_PrivateKey(0, 0, 0, 0);
2039 feat_bail_required SSL
2042 if [ "${have_openssl}" = 'yes' ]; then
2043 compile_check stack_of 'OpenSSL STACK_OF()' \
2044 '#define HAVE_OPENSSL_STACK_OF' << \!
2045 #include <stdio.h> /* For C89 NULL */
2046 #include <openssl/ssl.h>
2047 #include <openssl/err.h>
2048 #include <openssl/x509v3.h>
2049 #include <openssl/x509.h>
2050 #include <openssl/rand.h>
2052 STACK_OF(GENERAL_NAME) *gens = NULL;
2054 printf("%p", gens); /* to use it */
2059 link_check ossl_conf 'OpenSSL_modules_load_file() support' \
2060 '#define HAVE_OPENSSL_CONFIG' << \!
2061 #include <stdio.h> /* For C89 NULL */
2062 #include <openssl/conf.h>
2064 CONF_modules_load_file(NULL, NULL, CONF_MFLAGS_IGNORE_MISSING_FILE);
2065 CONF_modules_free();
2070 link_check ossl_conf_ctx 'OpenSSL SSL_CONF_CTX support' \
2071 '#define HAVE_OPENSSL_CONF_CTX' << \!
2073 #include <openssl/ssl.h>
2074 #include <openssl/err.h>
2076 #if HAVE_OPENSSL < 10100
2077 SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method());
2079 SSL_CTX *ctx = SSL_CTX_new(TLS_client_method());
2081 SSL_CONF_CTX *cctx = SSL_CONF_CTX_new();
2083 SSL_CONF_CTX_set_flags(cctx,
2084 SSL_CONF_FLAG_FILE | SSL_CONF_FLAG_CLIENT |
2085 SSL_CONF_FLAG_CERTIFICATE | SSL_CONF_FLAG_SHOW_ERRORS);
2086 SSL_CONF_CTX_set_ssl_ctx(cctx, ctx);
2087 SSL_CONF_cmd(cctx, "Protocol", "ALL");
2088 SSL_CONF_CTX_finish(cctx);
2089 SSL_CONF_CTX_free(cctx);
2095 link_check rand_egd 'OpenSSL RAND_egd(3ssl)' \
2096 '#define HAVE_OPENSSL_RAND_EGD' << \!
2097 #include <openssl/rand.h>
2099 return RAND_egd("some.where") > 0;
2103 if feat_yes SSL_ALL_ALGORITHMS; then
2104 if link_check ssl_all_algo 'OpenSSL all-algorithms support' \
2105 '#define HAVE_SSL_ALL_ALGORITHMS' << \!
2106 #include <openssl/evp.h>
2108 OpenSSL_add_all_algorithms();
2109 EVP_get_cipherbyname("two cents i never exist");
2117 feat_bail_required SSL_ALL_ALGORITHMS
2119 fi # SSL_ALL_ALGORITHMS
2121 if feat_yes MD5 && feat_no NOEXTMD5; then
2122 run_check openssl_md5 'MD5 digest in OpenSSL' \
2123 '#define HAVE_OPENSSL_MD5' << \!
2126 #include <openssl/md5.h>
2128 char const dat[] = "abrakadabrafidibus";
2129 char dig[16], hex[16 * 2];
2133 memset(dig, 0, sizeof(dig));
2134 memset(hex, 0, sizeof(hex));
2136 MD5_Update(&ctx, dat, sizeof(dat) - 1);
2137 MD5_Final(dig, &ctx);
2139 #define hexchar(n) ((n) > 9 ? (n) - 10 + 'a' : (n) + '0')
2140 for(i = 0; i < sizeof(hex) / 2; i++){
2142 hex[j] = hexchar((dig[i] & 0xf0) >> 4);
2143 hex[++j] = hexchar(dig[i] & 0x0f);
2145 return !!memcmp("6d7d0a3d949da2e96f2aa010f65d8326", hex, sizeof(hex));
2148 fi # feat_yes MD5 && feat_no NOEXTMD5
2151 echo '/* OPT_SSL=0 */' >> ${h}
2154 if [ "${have_openssl}" = 'yes' ]; then
2160 if feat_yes SMTP; then
2161 echo '#define HAVE_SMTP' >> ${h}
2163 echo '/* OPT_SMTP=0 */' >> ${h}
2166 if feat_yes POP3; then
2167 echo '#define HAVE_POP3' >> ${h}
2169 echo '/* OPT_POP3=0 */' >> ${h}
2172 if feat_yes GSSAPI; then
2173 ${cat} > ${tmp2}.c << \!
2174 #include <gssapi/gssapi.h>
2176 gss_import_name(0, 0, GSS_C_NT_HOSTBASED_SERVICE, 0);
2177 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2181 ${sed} -e '1s/gssapi\///' < ${tmp2}.c > ${tmp3}.c
2183 if command -v krb5-config >/dev/null 2>&1; then
2184 i=`command -v krb5-config
`
2185 GSS_LIBS="`CFLAGS
= ${i} --libs gssapi
`"
2186 GSS_INCS="`CFLAGS
= ${i} --cflags`"
2187 i='GSS-API via krb5-config(1)'
2191 i='GSS-API in gssapi/gssapi.h, libgssapi'
2193 if < ${tmp2}.c link_check gss \
2194 "${i}" '#define HAVE_GSSAPI' "${GSS_LIBS}" "${GSS_INCS}" ||\
2195 < ${tmp3}.c link_check gss \
2196 'GSS-API in gssapi.h, libgssapi' \
2197 '#define HAVE_GSSAPI
2198 #define GSSAPI_REG_INCLUDE' \
2200 < ${tmp2}.c link_check gss 'GSS-API in libgssapi_krb5' \
2201 '#define HAVE_GSSAPI' \
2203 < ${tmp3}.c link_check gss \
2204 'GSS-API in libgssapi, OpenBSD-style (pre 5.3)' \
2205 '#define HAVE_GSSAPI
2206 #define GSS_REG_INCLUDE' \
2207 '-lgssapi -lkrb5 -lcrypto' \
2208 '-I/usr/include/kerberosV' ||\
2209 < ${tmp2}.c link_check gss 'GSS-API in libgss' \
2210 '#define HAVE_GSSAPI' \
2212 link_check gss 'GSS-API in libgssapi_krb5, old-style' \
2213 '#define HAVE_GSSAPI
2214 #define GSSAPI_OLD_STYLE' \
2215 '-lgssapi_krb5' << \!
2216 #include <gssapi/gssapi.h>
2217 #include <gssapi/gssapi_generic.h>
2219 gss_import_name(0, 0, gss_nt_service_name, 0);
2220 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
2227 feat_bail_required GSSAPI
2230 echo '/* OPT_GSSAPI=0 */' >> ${h}
2231 fi # feat_yes GSSAPI
2233 if feat_yes NETRC; then
2234 echo '#define HAVE_NETRC' >> ${h}
2236 echo '/* OPT_NETRC=0 */' >> ${h}
2239 if feat_yes AGENT; then
2240 echo '#define HAVE_AGENT' >> ${h}
2242 echo '/* OPT_AGENT=0 */' >> ${h}
2245 if feat_yes IDNA; then
2246 if link_check idna 'GNU Libidn' '#define HAVE_IDNA HAVE_IDNA_LIBIDNA' \
2249 #include <idn-free.h>
2250 #include <stringprep.h>
2252 char *utf8, *idna_ascii, *idna_utf8;
2254 utf8 = stringprep_locale_to_utf8("does.this.work");
2255 if (idna_to_ascii_8z(utf8, &idna_ascii, IDNA_USE_STD3_ASCII_RULES)
2258 idn_free(idna_ascii);
2259 /* (Rather link check only here) */
2260 idna_utf8 = stringprep_convert(idna_ascii, "UTF-8", "de_DE");
2266 elif link_check idna 'idnkit' '#define HAVE_IDNA HAVE_IDNA_IDNKIT' \
2269 #include <idn/api.h>
2270 #include <idn/result.h>
2274 char local_name[256];
2276 r = idn_encodename(IDN_ENCODE_APP, "does.this.work", ace_name,
2278 if (r != idn_success) {
2279 fprintf(stderr, "idn_encodename failed: %s\n", idn_result_tostring(r));
2282 r = idn_decodename(IDN_DECODE_APP, ace_name, local_name, sizeof(local_name));
2283 if (r != idn_success) {
2284 fprintf(stderr, "idn_decodename failed: %s\n", idn_result_tostring(r));
2293 feat_bail_required IDNA
2296 if [ -n "${have_idna}" ]; then
2297 echo '#define HAVE_IDNA_LIBIDNA 0' >> ${h}
2298 echo '#define HAVE_IDNA_IDNKIT 1' >> ${h}
2301 echo '/* OPT_IDNA=0 */' >> ${h}
2304 if feat_yes IMAP_SEARCH; then
2305 echo '#define HAVE_IMAP_SEARCH' >> ${h}
2307 echo '/* OPT_IMAP_SEARCH=0 */' >> ${h}
2310 if feat_yes REGEX; then
2311 if link_check regex 'regular expressions' '#define HAVE_REGEX' << \!
2318 if (regcomp(&re, ".*bsd", REG_EXTENDED | REG_ICASE | REG_NOSUB) != 0)
2320 status = regexec(&re, "plan9", 0,NULL, 0);
2322 return !(status == REG_NOMATCH);
2328 feat_bail_required REGEX
2331 echo '/* OPT_REGEX=0 */' >> ${h}
2334 if feat_yes MLE && [ -n "${have_c90amend1}" ]; then
2336 echo '#define HAVE_MLE' >> ${h}
2338 feat_bail_required MLE
2339 echo '/* OPT_MLE=0 */' >> ${h}
2342 # Generic have-a-line-editor switch for those who need it below
2343 if [ -n "${have_mle}" ]; then
2347 if [ -n "${have_cle}" ] && feat_yes HISTORY; then
2348 echo '#define HAVE_HISTORY' >> ${h}
2350 echo '/* OPT_HISTORY=0 */' >> ${h}
2353 if [ -n "${have_mle}" ] && feat_yes KEY_BINDINGS; then
2354 echo '#define HAVE_KEY_BINDINGS' >> ${h}
2356 echo '/* OPT_KEY_BINDINGS=0 */' >> ${h}
2359 if feat_yes TERMCAP; then
2361 link_check termcap "termcap(5) (via ${4})" \
2362 "#define HAVE_TERMCAP${3}" "${1}" << _EOT
2367 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
2368 static int my_putc(int c){return putchar(c);}
2370 char buf[1024+512], cmdbuf[2048], *cpb, *r1;
2371 int r2 = OK, r3 = ERR;
2373 tgetent(buf, getenv("TERM"));
2375 r1 = tgetstr(UNCONST("cm"), &cpb);
2377 r2 = tgetnum(UNCONST("Co"));
2378 r3 = tgetflag(UNCONST("ut"));
2379 tputs("cr", 1, &my_putc);
2380 return (r1 == NULL || r2 == -1 || r3 == 0);
2386 link_check terminfo "terminfo(5) (via ${2})" \
2387 '#define HAVE_TERMCAP
2388 #define HAVE_TERMCAP_CURSES
2389 #define HAVE_TERMINFO' "${1}" << _EOT
2393 #define UNCONST(P) ((void*)(unsigned long)(void const*)(P))
2394 static int my_putc(int c){return putchar(c);}
2400 r0 = setupterm(NULL, 1, &er);
2401 r1 = tigetflag(UNCONST("bce"));
2402 r2 = tigetnum(UNCONST("colors"));
2403 r3 = tigetstr(UNCONST("cr"));
2404 tp = tparm(r3, NULL);
2405 tputs(tp, 1, &my_putc);
2406 return (r0 == ERR || r1 == -1 || r2 == -2 || r2 == -1 ||
2407 r3 == (char*)-1 || r3 == NULL);
2412 if feat_yes TERMCAP_VIA_TERMINFO; then
2413 __terminfolib -ltinfo -ltinfo ||
2414 __terminfolib -lcurses -lcurses ||
2415 __terminfolib -lcursesw -lcursesw ||
2416 feat_bail_required TERMCAP_VIA_TERMINFO
2419 if [ -z "${have_terminfo}" ]; then
2420 __termcaplib -ltermcap '' '' '-ltermcap' ||
2421 __termcaplib -ltermcap '#include <curses.h>' '
2422 #define HAVE_TERMCAP_CURSES' \
2423 'curses.h / -ltermcap' ||
2424 __termcaplib -lcurses '#include <curses.h>' '
2425 #define HAVE_TERMCAP_CURSES' \
2426 'curses.h / -lcurses' ||
2427 __termcaplib -lcursesw '#include <curses.h>' '
2428 #define HAVE_TERMCAP_CURSES' \
2429 'curses.h / -lcursesw' ||
2430 feat_bail_required TERMCAP
2432 if [ -n "${have_termcap}" ]; then
2433 run_check tgetent_null \
2434 "tgetent(3) of termcap(5) takes NULL buffer" \
2435 "#define HAVE_TGETENT_NULL_BUF" << _EOT
2436 #include <stdio.h> /* For C89 NULL */
2438 #ifdef HAVE_TERMCAP_CURSES
2439 # include <curses.h>
2443 tgetent(NULL, getenv("TERM"));
2450 echo '/* OPT_TERMCAP=0 */' >> ${h}
2451 echo '/* OPT_TERMCAP_VIA_TERMINFO=0 */' >> ${h}
2454 if feat_yes SPAM_SPAMC; then
2455 echo '#define HAVE_SPAM_SPAMC' >> ${h}
2456 if command -v spamc >/dev/null 2>&1; then
2457 echo "#define SPAM_SPAMC_PATH \"`command -v spamc
`\"" >> ${h}
2460 echo '/* OPT_SPAM_SPAMC=0 */' >> ${h}
2463 if feat_yes SPAM_SPAMD && [ -n "${have_af_unix}" ]; then
2464 echo '#define HAVE_SPAM_SPAMD' >> ${h}
2466 feat_bail_required SPAM_SPAMD
2467 echo '/* OPT_SPAM_SPAMD=0 */' >> ${h}
2470 feat_def SPAM_FILTER
2472 if feat_yes SPAM_SPAMC || feat_yes SPAM_SPAMD || feat_yes SPAM_FILTER; then
2473 echo '#define HAVE_SPAM' >> ${h}
2475 echo '/* HAVE_SPAM */' >> ${h}
2478 if feat_yes QUOTE_FOLD &&\
2479 [ -n "${have_c90amend1}" ] && [ -n "${have_wcwidth}" ]; then
2480 echo '#define HAVE_QUOTE_FOLD' >> ${h}
2482 feat_bail_required QUOTE_FOLD
2483 echo '/* OPT_QUOTE_FOLD=0 */' >> ${h}
2486 feat_def FILTER_HTML_TAGSOUP
2495 squeeze_em ${inc} ${tmp}
2497 squeeze_em ${lib} ${tmp}
2502 printf '#ifndef n_CONFIG_H\n# define n_CONFIG_H 1\n' > ${h}
2503 ${cat} ${tmp} >> ${h}
2507 # Create the real mk.mk
2508 # Note we cannout use explicit ./ filename prefix for source and object
2509 # pathnames because of a bug in bmake(1)
2510 ${rm} -rf ${tmp0}.* ${tmp0}*
2511 printf 'OBJ_SRC = ' >> ${mk}
2512 if feat_no AMALGAMATION; then
2513 for i in `printf '%s\n' *.c |
${sort}`; do
2514 if [ "${i}" = privsep.c ]; then
2517 printf "${i} " >> ${mk}
2519 printf '\nAMALGAM_TARGET =\nAMALGAM_DEP =\n' >> ${mk}
2521 printf 'main.c\nAMALGAM_TARGET = main.o\nAMALGAM_DEP = ' >> ${mk}
2523 printf '\n/* HAVE_AMALGAMATION: include sources */\n' >> ${h}
2524 printf '#elif _CONFIG_H + 0 == 1\n' >> ${h}
2525 printf '# undef _CONFIG_H\n' >> ${h}
2526 printf '# define _CONFIG_H 2\n' >> ${h}
2527 for i in `printf '%s\n' *.c |
${sort}`; do
2528 if [ "${i}" = "${j}" ] || [ "${i}" = main.c ] || \
2529 [ "${i}" = privsep.c ]; then
2532 printf "${i} " >> ${mk}
2533 printf "# include \"${i}\"\n" >> ${h}
2536 # tcc(1) fails on 2015-11-13 unless this #else clause existed
2537 echo '#else' >> ${h}
2540 # Finally, create the string that is used by *feature* and `version
'.
2541 # Take this nice opportunity and generate a visual listing of included and
2542 # non-included features for the person who runs the configuration
2543 msg '\nThe following features are included
(+) or not
(-):'
2544 set -- ${OPTIONS_DETECT} ${OPTIONS} ${OPTIONS_XTRA}
2545 printf '/* The
"feature string" */\n' >> ${h}
2546 # Because + is expanded by *folder* if first in "echo $features", put something
2547 printf '#define VAL_FEATURES_CNT '${#}'\n#define VAL_FEATURES "#' >> ${h}
2551 sopt
="`echo ${opt} | ${tr} '[A-Z]_' '[a-z]-'`"
2552 feat_yes
${opt} && sign
=+ || sign
=-
2553 printf -- "${sep}${sign}${sopt}" >> ${h}
2555 i=`option_doc_of ${opt}`
2556 [ -z "${i}" ] && continue
2557 msg " %s
%s
: %s
" ${sign} ${sopt} "${i}"
2559 # TODO instead of using sh+tr+awk+printf, use awk, drop option_doc_of, inc here
2561 #${awk} -v opts="${OPTIONS_DETECT} ${OPTIONS} ${OPTIONS_XTRA}" \
2562 # -v xopts="${XOPTIONS_DETECT} ${XOPTIONS} ${XOPTIONS_XTRA}" \
2563 printf '"\n#endif /* n_CONFIG_H */\n' >> ${h}
2565 echo "LIBS = `${cat} ${lib}`" >> ${mk}
2566 echo "INCS
= `${cat} ${inc}`" >> ${mk}
2568 ${cat} ./mk-mk.in >> ${mk}
2573 msg ' . System-wide resource file: %s/%s' "${VAL_SYSCONFDIR}" "${VAL_SYSCONFRC}"
2574 msg ' . bindir: %s' "${VAL_BINDIR}"
2575 if feat_yes DOTLOCK; then
2576 msg ' . libexecdir: %s' "${VAL_LIBEXECDIR}"
2578 msg ' . mandir: %s' "${VAL_MANDIR}"
2579 msg ' . M(ail)T(ransfer)A(gent): %s (argv0 %s)' "${VAL_MTA}" "${VAL_MTA_ARGV0}"
2580 msg ' . $MAIL spool directory: %s' "${VAL_MAIL}"
2583 if [ -n "${have_fnmatch}" ] && [ -n "${have_fchdir}" ]; then
2587 if [ -z "${have_fnmatch}" ]; then
2588 msg ' . The function fnmatch(3) could not be found.'
2589 msg ' Filename patterns like wildcard are not supported on your system'
2591 if [ -z "${have_fchdir}" ]; then
2592 msg ' . The function fchdir(2) could not be found.'
2593 msg ' We will use chdir(2) instead.'
2594 msg ' This is a problem only if the current working directory is changed'
2595 msg ' while this program is inside of it'