1 #@ make.rc defines the set of features and values used.
2 #@ Reading INSTALL first is beneficial.
4 #@ - Choosing a predefined CONFIG= disallows further option fine-tuning.
5 #@ (With some exceptions, e.g., OPT_DEBUG.)
7 #@ - Specifying settings on the command line will take precedence over
8 #@ the variables in here (correctly triggering build updates as
11 #@ - Features / options have an OPT_ prefix and usually need to be
12 #@ assigned a boolean value, as in OPT_IDNA=yes. Booleans are 1/0,
13 #@ y/n, true/false, yes/no and on/off (case doesn't matter).
15 #@ The value "require" is also a true boolean, but will in addition
16 #@ cause configuration to fail if the requested condition cannot be
17 #@ satisfied. This functionality is available where documented.
19 #@ - Values have a VAL_ prefix, and are assigned strings, for example
20 #@ VAL_PREFIX="/usr/local"
22 #@ Values which are only used during configuration, building, and / or
23 #@ installation have no prefix, e.g., DESTDIR, VERBOSE, awk, sed etc.
25 #@ Some values exist which offer "multiple choice", e.g., VAL_RANDOM
26 #@ (without accompanying feature option) and VAL_IDNA (with OPT_IDNA).
27 #@ This is used if different implementations exist, and can then be
28 #@ used to choose the desired one(s).
29 #@ The value must be a comma separated list of strings, for example
30 #@ "idn2,idn,idnkit", the case is ignored, but the order is important.
31 #@ The special strings "all" and "any" as well as the empty value
32 #@ are wildcard matches; if any entry in the list is a wildcard match,
33 #@ the entire list is ignored.
34 #@ The special string "error" will abort configuration once its list
35 #@ position is reached; this is only supported if documented, and not
36 #@ with an accompanying OPT_ (which then offers "require", as above).
38 #@ - This file is parsed by the shell: it is in sh(1), not in make(1)
39 #@ syntax. Evaluation occurs *after* it has been read, so command
40 #@ line overwrites take effect. To use multiline values, escape the
41 #@ newlines on all lines but the last with a reverse solidus (back-
42 #@ slash), as in "LINE \".
43 #@ To embed a shell variable unexpanded, use two: "XY=\\${HOME}".
44 #@ The parsing is sequential top-to-bottom (nonetheless), so that
45 #@ shell snippets in a value can refer only to stuff yet defined.
47 #@ - You may NOT comment out anything in here -- if you want to disable
48 #@ a feature, set it to a false boolean.
50 ## IDENTITIES, PATHS AND PROGRAMS ##
52 # Contact info (*contact-mail* and *contact-web*, respectively).
53 VAL_CONTACT_MAIL=s-mailx@lists.sdaoden.eu
54 VAL_CONTACT_WEB=https://www.sdaoden.eu/code.html
56 # The user ID our small privilege-separated helper program will be
57 # SETUID to, shall it be included ($OPT_DOTLOCK).
58 # Installation will then require the chown(1) program (as below) and
59 # sufficient privileges to perform a SETUID to this user ID.
62 # General prefix where S-nail should be installed.
65 # Fine tune individual locations, normally under $VAL_PREFIX.
66 # . the place of the S-nail program.
67 VAL_BINDIR="${VAL_PREFIX}/bin"
68 # . the place of the privilege-separated helper program, the name
69 # of which is [$VAL_SID$VAL_MAILX]-privsep (see below for $VAL_SID &
71 # (Only with $OPT_DOTLOCK.)
72 VAL_LIBEXECDIR="${VAL_PREFIX}/libexec"
74 VAL_MANDIR="${VAL_PREFIX}/share/man"
75 # . of the exemplary resource file.
76 VAL_SYSCONFDIR="${VAL_PREFIX}/etc"
78 # The variable $DESTDIR is prepended to all the paths from above at
79 # installation time; this feature can be used for, e.g., package
80 # building: if $VAL_PREFIX is "/usr/local", but $DESTDIR is set to "here",
81 # then S-nail will still think its $VAL_PREFIX is "/usr/local" whereas the
82 # build system will instead use "here/usr/local".
83 # NOTE: it cannot be set in here, but must be given on the command line
84 # when invoking the "install" make(1) (directly or indirectly).
85 # (That is, if you uncomment it, it'll be update-tracked...)
88 # Where the local mail system stores user $MAIL files.
90 if [ -d /var/spool/mail ]; then \
91 echo /var/spool/mail;\
96 # Path to the local MTA (Mail-Transfer-Agent).
98 if [ -x /usr/bin/sendmail ]; then \
99 echo /usr/bin/sendmail;\
100 elif [ -x /usr/lib/sendmail ]; then \
101 echo /usr/lib/sendmail;\
103 echo /usr/sbin/sendmail;\
106 # Today a lot of systems no longer use sendmail(1), but a different MTA.
107 # To ensure compatibility with sendmail(1), a system called
108 # mailwrapper(8) is often used, which selects the required service by
109 # looking at the name by which the program actually has been invoked.
110 # This variable can be used to adjust this name as necessary.
111 VAL_MTA_ARGV0=sendmail
113 # Default $SHELL (sh(1) path).
114 # Sometimes we simply invoke a command directly via execlp(2) instead of
115 # indirectly through *SHELL* -- in these cases execlp(2) may fallback to
116 # it's own built-in sh(1) path.
119 # Some more default fallback values, some of which are standardized
120 # and (thus)/or documented in the manual (changes not reflected there!).
121 # Note that default paths are often not (shell) quoted when displayed.
122 VAL_DEAD_BASENAME=dead.letter
123 VAL_DEAD="~/${VAL_DEAD_BASENAME}"
133 # Default locations of mime.types(5).
134 VAL_MIME_TYPES_USR=~/.mime.types
135 VAL_MIME_TYPES_SYS=/etc/mime.types
137 # The following tools may be provided a.k.a. overwritten,
138 # `command -v NAME` is used to query the utility otherwise:
139 # MAKE=, STRIP=, awk=, basename=, cat=, chmod=, cp=, cmp=, cksum=,
140 # grep=, mkdir=, mv=, pwd=, rm=, sed=, sort=, tee=, tr=, uname=
141 # Usually in administrator paths:
142 # chown= [$OPT_DOTLOCK]
143 # Note that awk(1), rm(1), tr(1) and uname(1) are needed before this
144 # file is read, all other utilities will be checked afterwards only.
145 # uname(1) is in fact needed before the initial OS setup and thus no OS
146 # specific adjustments (e.g., $PATH) have been performed yet, but its
147 # use can be circumvented by setting $OS (uname -s) and $OSFULLSPEC
148 # (uname -a: this is not baked into the binary, it is only used to
149 # recognize build environment changes). $OS must be all-lowercase.
150 # Due to the evaluation order of the build system all those programs are
151 # usually needed, but by setting any of the variables to true(1), as in
152 # chown=/usr/bin/true, availability of unneeded programs can be faked.
156 # Some operating systems only support the C/POSIX (7-bit, but eight bit
157 # bytes are passed through unchanged) and UTF-8 based locales, e.g.,
158 # Plan9, Musl based Linux variants and newer OpenBSD. For such
159 # environments we can avoid a lot of tests and may enable support for
160 # features which would otherwise not be available.
161 # Note: $OS is available as normalized all-lowercase upon evaluation.
162 OPT_ALWAYS_UNICODE_LOCALE=`\
163 if [ "${OS}" = openbsd ] || [ -f /lib/ld-musl-x86_64.so.1 ]; then \
169 # For cross-compilation purposes it may be useful to not actually run
170 # systemcall etc. tests (link and run the executable) but only to
171 # perform the link tests necessary to detect host environment.
174 # Whether package system, for example pkgsrc(7) on NetBSD and more,
175 # OpenCSW on SunOS/Solaris, etc., specific paths shall be automatically
176 # included in $C_INCLUDE_PATH and $LD_LIBRARY_PATH when seen?
179 # Shall S-nail try to automatically detect a compiler and detect and
180 # provide a set of known-good compiler flags? It will use $CC if this
181 # variable is set, otherwise a compiler is actively searched for.
182 # If this option is chosen additions to flags may still be provided
183 # by setting $EXTRA_CFLAGS and $EXTRA_LDFLAGS to whatever is desired.
184 # Thus: set this to false and use your normal $CC / $CFLAGS / $LDFLAGS,
185 # otherwise pass additional flags via $EXTRA_CFLAGS / $EXTRA_LDFLAGS:
186 # $ make EXTRA_CFLAGS=-std=c99 tangerine
187 # Whatever you do, the configuration is fixated and updates will force
188 # rebuilds. And far below in this file there is $OPT_FORCED_STACKPROT,
189 # too, which can be used to cause injection of stack protectors, but
190 # which normally happens for development and debug builds only.
191 # (Remember, file is parsed from top to bottom, sorry.)
194 # It is possible to compile S-nail as a "single-source", meaning that
195 # all source files are injected into a single compilation unit, which is
196 # then compiled. This allows the compiler to perform much more
197 # optimizations, and also reduces the management overhead that is used
198 # for / needed by the linker.
201 # Character set conversion enables reading and sending of mails in
202 # multiple character sets through usage of the iconv(3) library. Please
203 # read the manual section "Character sets" for the complete picture.
204 # This should usually be enabled; it can be "require"d.
207 # Whether support for Maildir E-mail directories shall be enabled.
210 # Major switch to toggle *all* network related protocols
211 # (POP3,SMTP,IMAP) and related/dependent stuff (GSS-API,TLS);
215 # If $OPT_SOCKETS: support for Secure Socket Layer (Transport Layer
216 # Security, TLS), i.e., encrypted socket connections; can be "require"d.
217 # It also automatically enables support for S/MIME message signing,
218 # verification, en- and decryption.
219 # This needs the OpenSSL (https://www.openssl.org) or LibreSSL
220 # (http://www.libressl.org) libraries.
223 # If $OPT_TLS: shall S-nail (try to) use mechanisms to support more
224 # digest and cipher algorithms than the few that are documented? For
225 # S/MIME *smime-cipher* for example this will cause
226 # EVP_get_cipherbyname(3) to be tried shall the (S-nail-) built-in
227 # knowledge not suffice to understand the user request. Will create
228 # a large statically linked binary; dynamically linked the costs only
229 # arise once the extended lookup is actually needed (the first time).
230 # Some TLS libraries will always support all algorithms.
231 # This can be "require"d.
232 OPT_TLS_ALL_ALGORITHMS=yes
234 # If $OPT_SOCKETS: support for SMTP protocol?
235 # (Directly sending mails over the network) Can be "require"d.
238 # If $OPT_SOCKETS: support for POP3 protocol?
239 # (Download of mails via POP protocol) Can be "require"d.
242 # If $OPT_SOCKETS: support for IMAP protocol?
243 # Requires $OPT_ICONV unless $OPT_ALWAYS_UNICODE_LOCALE, in which case
245 # (Reading of mails directly on the server) Can be "require"d.
248 # If $OPT_SOCKETS: support for GSS-API (Generic Security Services
249 # Application Programming Interface) based authentication, e.g.,
250 # Kerberos v5? Available for IMAP and SMTP; can be "require"d.
253 # Enabling the MD5 message digest adds support for several
254 # authentication possibilities: POP3 (APOP), IMAP and SMTP (CRAM-MD5).
255 # If you don't need those, you may turn them off by excluding MD5.
258 # If $OPT_SOCKETS: support for parsing of user and password credentials
259 # from the ~/.netrc file ($NETRC; see *netrc-lookup* manual entry).
262 # If $OPT_SOCKETS: passwords can also be looked up through an external
263 # "agent" in order to allow for encrypted password storage (see
264 # *agent-shell-lookup*).
265 # [Obsolete] Even though marked *v15-compat* this feature has been
266 # obsoleted; please use an encrypted .netrc file (via *netrc-pipe*) or
267 # encrypt a complete resource file and load this like, e.g.,
268 # source "gpg -qd ~/.mailprivate.gpg | "
271 # IDNA (internationalized domain names for applications) offers users
272 # the possibility to use domain names in their native language, i.e., to
273 # use non-US-ASCII content, as in, e.g., <www.räksmörgåsa.example>,
274 # which the IDNA algorithm would convert to
275 # <www.xn--rksmrgsa-0zap8p.example>. :)
276 # Multiple implementations are supported:
277 # . idnkit - idnkit, https://www.nic.ad.jp/ja/idn/idnkit/download,
278 # either of version 1 for IDNA 2003 or version 2 for IDNA 2008.
279 # . idn2 - GNU Libidn2 for IDNA 2008, https://www.gnu.org/software/libidn/,
280 # . idn - GNU Libidn for IDNA 2003, same,
281 # OPT_IDNA can be "require"d.
283 VAL_IDNA="idnkit,idn2,idn"
285 # IMAP-style SEARCH expressions can be supported. This addressing mode
286 # is available with all types of folders; for folders not located on
287 # IMAP servers, or for servers unable to execute the SEARCH command, the
288 # search is performed locally.
291 # Several different P(seudo) R(andom number) G(enerator) possibilities.
292 # No need for somewhat strong random is necessary.
293 # The following will be used as sole PRG implementations.
294 # . arc4 - we search for arc4random(3).
295 # . tls - if OPT_TLS is available the PRG of the TLS library can be used.
296 # The following will only be used to seed our builtin ARC4 PRG.
297 # . libgetrandom - getrandom(3) via C library.
298 # . sysgetrandom - getrandom(2) via SYSCALL.
299 # . urandom - reading from /dev/urandom.
300 # . builtin - a builtin ARC4 implementation with unscientific seeding.
301 # . (error - bail out)
302 VAL_RANDOM="arc4,tls,libgetrandom,sysgetrandom,urandom,builtin"
304 # Regular expression (re_format(7)) support for searches, conditional
305 # expressions etc., we use the extended ones, then; can be "require"d.
308 # Line editing and -history (manual "On terminal and line editor").
310 # If ISO C (ISO/IEC 9899:1990/Amendment 1:1995) is supported on the
311 # system then our built-in MLE (Mailx-Line-Editor) version can be used.
312 # An enabled & available OPT_TERMCAP may affect and improve the MLE.
315 # Add support for history management.
317 # Add support for `(un)?bind'ing of key sequences.
320 # Use termcap(5) for terminal control; can be "require"d.
321 # Today most environments ship a termcap(5) that in fact is part of
322 # terminfo(5), and acts as a converting wrapper for this library.
323 # To avoid this redundancy we also support terminfo(5), and use it
324 # instead if we find it (assuming that termcap(5) is a stub, then).
325 # Note that terminfo(5) offers access to more key sequences, e.g.,
326 # kLFT5, for which no termcap(5) entry exists.
327 # terminfo(5) support can (thus) be "require"d.
329 OPT_TERMCAP_VIA_TERMINFO=yes
331 # Enable the `errors' command; S-nail is a console-based application and
332 # thus errors may fly by pretty fast as other operations are in
333 # progress; or $PAGERs are started and clear errors off the screen. If
334 # enabled errors are duplicated as they happen and the `errors' command
335 # will show them when asked to.
338 # We may include `help' etc. strings for commands, increasing size a bit.
341 # It is possible to strip out (almost) all user interface and error messages.
342 # This might be interesting for automated use cases (only).
345 # Interaction with a spam email filter is possible.
346 # Refer to all commands and variables with a "spam" prefix, and
347 # see the manual example section "Handling spam".
349 # Support for interaction with spamassassin(1)s spamc(1).
350 # . [Obsolete] OPT_SPAM_SPAMD:
351 # Direct communication with spamassassin(1)s spamd(1).
352 # Needs unix(4) domain sockets (checked). Can be "require"d.
354 # Generic filter hook which can be used with e.g. bogofilter(1)
355 # and sylfilter(1): see documentation for the *spam-filter-**
356 # variables for expected application behaviour.
361 # A simple line-based quoting mechanism can be made available via the
362 # *quote-fold* mechanism. This will be turned off automatically if the
363 # required character classification is not available on the host.
365 # TODO shouldn't wrap lines when only WS or a NL-escaping \ follows
368 # We do have a very primitive HTML tagsoup filter which can be used to
369 # convert HTML to plain text for display purposes. If enabled it will
370 # be used for all MIME types which have the @h@ or @H@ type markers
371 # (more on this in the manual section "The mime.types files"). And
372 # which do not have any user defined MIME type handler, of course.
373 OPT_FILTER_HTML_TAGSOUP=yes
375 # A simple form of coloured output can optionally be produced.
378 # File dotlocking is performed for "system mailbox" (%[USER] and
379 # %:ANYFILE) MBOX files: when synchronizing any such FILE a FILE.lock
380 # file will be created in the directory of FILE, for the duration of the
381 # synchronization: set $OPT_DOTLOCK to support this traditional mail
382 # spool file locking.
383 # $VAL_MAIL(s) where normal system mailboxes reside are usually not
384 # writable by normal users, except that a user may read and write his
385 # own mailbox. But this means that a program run by the user cannot
386 # create a .lock file! The solution is to install a privilege-separated
387 # mini-program that has the sole purpose and functionality of managing
388 # the dotlock file in such situations -- and only then, as a last
389 # ressort. With it dotlock files can be created for any mailbox for
390 # which the invoking user has read (or read-write) permissions, and
391 # under the UID and GID of the mailbox itself! We call it -privsep.
392 # $OPT_DOTLOCK can be "require"d.
396 ## Normal users should not need to read any further
398 ## PATHS AND PROGRAMS, DEVELOPMENT ##
400 # To ease the life of forkers and packagers "our" name can be changed.
401 # The name is build by concatenating $VAL_SID and $VAL_MAILX, i.e.,
402 # $(VAL_SID)$(VAL_MAILX). Note that the final string must be longer
403 # than two characters and may not contain any whitespace.
407 # The name of the exemplary resource template.
408 # Note 1: not overwritten by "make install" if yet existent!
409 VAL_SYSCONFRC="${VAL_SID}${VAL_MAILX}.rc"
411 ## FEATURE SET, DEVELOPMENT ##
413 # Use debug compiler flags, enable some additional commands and code
414 # assertions. Note that setting this also enables our own memory
415 # canaries, which require a rather large amount of runtime memory.
418 # Experimental code etc.
419 # Note: this forcefully enables OPT_DEBUG
422 # We use the crypto libraries' MD5 implementation if possible, unless..
425 # With $OPT_AUTOCC we can make use of the ASan AddressSanitizer and ASan
426 # MemorySanitizer of Google
427 # (https://github.com/google/sanitizers/wiki/AddressSanitizer).
428 # Also USAN (https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html).
429 # These are definetely only useful for debugging.
430 # Also, external libraries are often problematic (e.g., ncursesw), and
431 # ASAN_MEMORY of the tried clang 4.0.0 (4.0.0-2 of ArchLinux) was faulty.
437 # With $OPT_AUTOCC we will use stack protector guards shall the
438 # detected compiler support them; this goes in line with our own (heap)
439 # memory canaries and will detect buffer overflows. It is usually only
440 # useful during development, i.e., in a debug environment that tests all
441 # aspects of a program. But today it is often used even in shipout code.
442 OPT_FORCED_STACKPROT=`\
443 if feat_yes DEVEL || feat_yes DEBUG; then \
449 # If $OPT_DEBUG is true we'll use a simple memory wrapper with
450 # canaries. This interferes with memory debuggers like valgrind(1) or
451 # the LLVM -fsanitize stuff. Enable this to not use our wrapper.
453 if feat_yes ASAN_MEMORY || feat_yes ASAN_ADDRESS; then \
459 # Our functions are instrumented with Not-Yet-Dead chirps, which print
460 # a function call trace when the program crashes. Whereas NYD will be
461 # used automatically when either of $OPT_DEBUG and $OPT_DEVEL is
462 # defined, an extended level of NYD is compiled in only on explicit
464 # TODO Separation in between NYD and NYD2 not yet fully done.
467 # vim:set tw=72: s-it-mode