3 [ -z "${WANT_ASSERTS}" ] && WANT_ASSERTS
=0
4 if [ -z "${CONFIG}" ]; then
5 [ -f user.conf
] && . user.conf
9 WANT_JUNK
=0 WANT_SOCKET
=0
15 WANT_JUNK
=0 WANT_IMAP
=0 WANT_POP3
=0
18 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
19 echo >&2 'Possible values: MINIMAL, NETLESS, NETSEND'
33 if nwantfeat SOCKET
; then
34 WANT_IPV6
=0 WANT_SSL
=0
35 WANT_IMAP
=0 WANT_GSSAPI
=0 WANT_POP3
=0 WANT_SMTP
=0
37 if nwantfeat IMAP
&& nwantfeat POP3
&& nwantfeat SMTP
; then
38 WANT_SOCKET
=0 WANT_IPV6
=0 WANT_SSL
=0
42 if nwantfeat IMAP
; then
45 # If we don't need MD5 except for producing boundary and message-id strings,
46 # leave it off, plain old srand(3) should be enough for that purpose.
47 if nwantfeat SOCKET
&& nwantfeat JUNK
; then
49 elif wantfeat JUNK
; then
69 * Auto-generated by $0.
70 * Changes are lost when $0 is run again.
76 .SUFFIXES
: .o .c .x .y
78 $
(CC
) $
(CFLAGS
) $
(INCLUDES
) -c $
<
81 $
(CC
) $
(CFLAGS
) $
(INCLUDES
) -E $
< >$@
84 $
(CC
) $
(CFLAGS
) $
(INCLUDES
) $
(LDFLAGS
) $
< $
(LIBS
) -o $@
90 trap "rm -f $out $lib $inc $makefile; exit" 1 2 15
91 trap "rm -rf $tmp.*; rm -f $tmp $tmp2.? $tmp2 $tmp3.? $tmp3 $makefile" 0
96 printf "*** $fmt\\n" "$@"
97 printf "$fmt" "$@" >&5
105 echo '************************************************************'
106 msg
"checking $topic ... "
107 echo "/* checked $topic */" >>$out
109 echo '*** test program is'
111 #echo '*** the preprocessor generates'
112 #$make -f $makefile $tmp.x
114 echo '*** results are'
115 if $make -f $makefile $tmp.o
&& test -f $tmp.o
118 echo "$define" >>$out
119 eval have_
$variable=yes
122 echo "/* $define */" >>$out
124 eval unset have_
$variable
136 echo '************************************************************'
137 msg
"checking $topic ... "
138 echo "/* checked $topic */" >>$out
140 echo '*** test program is'
142 #echo '*** the preprocessor generates'
143 #$make -f $makefile $tmp.x
145 echo '*** results are'
146 if $make -f $makefile \
147 $tmp INCLUDES
="$INCLUDES $incs" LIBS
="$LIBS $libs" &&
151 echo "$define" >> $out
154 eval have_
$variable=yes
158 echo "/* $define */" >>$out
159 eval unset have_
$variable
164 link_check hello
'if a hello world program can be built' <<\
! ||
{ \
165 echo 'This problem is most certainly not specific to this software.' >&5; \
166 echo "Read the file '$log' and check your compiler installation." >&5; \
171 int main
(int argc
, char
*argv
[])
180 # Due to NetBSD PR lib/47120 it seems to be best to not use non-cc-builtin
181 # versions of alloca(3) since modern compilers just can't be trusted not to
182 # overoptimize and silently break some code
183 link_check alloca
'for __builtin_alloca()' \
184 '#define HAVE_ALLOCA __builtin_alloca' << \
!
192 compile_check ssize_t
'for ssize_t' '#define HAVE_SSIZE_T' <<\
!
193 #include <sys/types.h>
203 link_check snprintf
'for snprintf()' '#define HAVE_SNPRINTF' <<\
!
208 snprintf
(b
, sizeof b
, "%s", "string");
213 link_check putc_unlocked
'for putc_unlocked()' '#define HAVE_PUTC_UNLOCKED' <<\
!
217 putc_unlocked
('@', stdout
);
222 link_check fchdir
'for fchdir()' '#define HAVE_FCHDIR' <<\
!
231 link_check mmap
'for mmap()' '#define HAVE_MMAP' <<\
!
232 #include <sys/types.h>
233 #include <sys/mman.h>
236 mmap
(0, 0, 0, 0, 0, 0);
241 link_check mremap
'for mremap()' '#define HAVE_MREMAP' <<\
!
242 #include <sys/types.h>
243 #include <sys/mman.h>
246 mremap
(0, 0, 0, MREMAP_MAYMOVE
);
257 id
= iconv_open
("foo", "bar");
261 <$tmp2.c link_check
iconv 'for iconv functionality' '#define HAVE_ICONV' ||
262 <$tmp2.c link_check
iconv 'for iconv functionality in libiconv' \
263 '#define HAVE_ICONV' '-liconv'
265 link_check wctype
'for wctype functionality' '#define HAVE_WCTYPE_H' <<\
!
275 link_check wcwidth
'for wcwidth() ' '#define HAVE_WCWIDTH' <<\
!
284 link_check mbtowc
'for mbtowc()' '#define HAVE_MBTOWC' <<\
!
294 link_check setlocale
'for setlocale()' '#define HAVE_SETLOCALE' <<\
!
298 setlocale
(LC_ALL
, "");
303 link_check nl_langinfo
'for nl_langinfo()' '#define HAVE_NL_LANGINFO' <<\
!
304 #include <langinfo.h>
312 link_check mkstemp
'for mkstemp()' '#define HAVE_MKSTEMP' <<\
!
321 link_check fpathconf
'for fpathconf()' '#define HAVE_FPATHCONF' <<\
!
325 fpathconf
(0, _PC_PATH_MAX
);
330 link_check wordexp
'for wordexp()' '#define HAVE_WORDEXP' <<\
!
334 wordexp
((char
*)0, (wordexp_t
*)0, 0);
339 link_check getopt
'for getopt()' '#define HAVE_GETOPT' << \
!
341 int main
(int argc
, char
**argv
)
343 #if defined __GLIBC__ || defined __linux__
344 Argument and option reordering is not a desired feature.
346 getopt
(argc
, argv
, "oPt");
348 return (((long
)optarg
+ optind
) & 0x7F);
354 if wantfeat SOCKET
; then
355 compile_check arpa_inet_h
'for <arpa/inet.h>' \
356 '#define HAVE_ARPA_INET_H' << \
!
358 #include <sys/types.h>
359 #include <sys/socket.h>
361 #include <netinet/in.h>
362 #include <arpa/inet.h>
367 #include <sys/types.h>
368 #include <sys/socket.h>
370 #include <netinet/in.h>
371 #ifdef HAVE_ARPA_INET_H
372 #include <arpa/inet.h>
378 socket
(AF_INET
, SOCK_STREAM
, 0);
380 gethostbyname
("foo");
386 <$tmp2.c link_check sockets
'for sockets in libc' \
387 '#define HAVE_SOCKETS' ||
388 <$tmp2.c link_check sockets
'for sockets in libnsl' \
389 '#define HAVE_SOCKETS' '-lnsl' ||
390 <$tmp2.c link_check sockets \
391 'for sockets in libsocket and libnsl' \
392 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
395 # XXX Shouldn't it be a hard error if there is no socket support, then?
396 [ ${WANT_SOCKET} -eq 1 ] ||
397 WANT_IPV6
=0 WANT_SSL
=0 \
398 WANT_IMAP
=0 WANT_GSSAPI
=0 WANT_POP3
=0 WANT_SMTP
=0
401 if wantfeat IPV6
; then
402 link_check ipv6
'for IPv6 functionality' '#define USE_IPV6' << \
!
404 #include <sys/types.h>
405 #include <sys/socket.h>
407 #include <netinet/in.h>
408 #ifdef HAVE_ARPA_INET_H
409 #include <arpa/inet.h>
414 struct addrinfo a
, *ap
;
415 getaddrinfo
("foo", "0", &a
, &ap
);
422 if wantfeat IMAP
; then
423 echo "#define USE_IMAP" >> $out
425 echo "/* #define USE_IMAP */" >> $out
428 if wantfeat POP3
; then
429 echo "#define USE_POP3" >>$out
431 echo "/* #define USE_POP3 */" >> $out
434 if wantfeat SMTP
; then
435 echo "#define USE_SMTP" >>$out
437 echo "/* #define USE_SMTP */" >> $out
440 if wantfeat SSL
; then
441 link_check nss
'for Network Security Services (NSS)' '#define USE_SSL
443 '-lsmime3 -lnss3 -lssl3 -lnspr4 -lplc4' <<\
! || \
444 link_check openssl
'for sufficiently recent OpenSSL' \
446 #define USE_OPENSSL' '-lssl -lcrypto' << \
%
451 #include <pk11func.h>
456 #include <ciferfam.h>
457 #include <private/pprio.h>
461 PR_ImportTCPSocket
(0);
462 NSS_CMSSignerInfo_AddSMIMECaps
(0);
466 #include <openssl/ssl.h>
467 #include <openssl/err.h>
468 #include <openssl/x509v3.h>
469 #include <openssl/x509.h>
470 #include <openssl/rand.h>
474 SSLv23_client_method
();
475 PEM_read_PrivateKey
(0, 0, 0, 0);
480 if [ "${have_nss}" = 'yes' ]; then
481 compile_check genname_h
'for genname.h' \
482 '#define HAVE_GENNAME_H' << \
!
486 compile_check xconst_h
'for xconst.h' \
487 '#define HAVE_XCONST_H' << \
!
491 compile_check CERTAltNameEncodedContext \
492 'for CERTAltNameEncodedContext type' \
493 '#define HAVE_CERTAltNameEncodedContext' << \
!
499 #include <pk11func.h>
504 #include <ciferfam.h>
508 #ifdef HAVE_GENNAME_H
511 #include <private/pprio.h>
513 CERTAltNameEncodedContext foo
;
517 if [ "${have_openssl}" = 'yes' ]; then
518 compile_check stack_of
'for STACK_OF()' \
519 '#define HAVE_STACK_OF' << \
!
520 #include <openssl/ssl.h>
521 #include <openssl/err.h>
522 #include <openssl/x509v3.h>
523 #include <openssl/x509.h>
524 #include <openssl/rand.h>
528 STACK_OF
(GENERAL_NAME
) *gens
= NULL
;
529 printf("%p", gens
); /* to
make it used
*/
530 SSLv23_client_method
();
531 PEM_read_PrivateKey
(0, 0, 0, 0);
538 echo '/* Socket/SSL support not desired */' >> $out
541 if wantfeat GSSAPI
; then
543 #include <gssapi/gssapi.h>
547 gss_import_name
(0, 0, GSS_C_NT_HOSTBASED_SERVICE
, 0);
548 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
553 sed -e '1s/gssapi\///' < $tmp2.c
> $tmp3.c
555 <$tmp2.c link_check gssapi
'for GSSAPI in libgss' \
556 '#define USE_GSSAPI' '-lgss' ||
557 <$tmp2.c link_check gssapi
'for GSSAPI in libgssapi_krb5' \
558 '#define USE_GSSAPI' '-lgssapi_krb5' ||
559 link_check gssapi
'for GSSAPI in libgssapi_krb5, old-style' \
561 #define GSSAPI_OLD_STYLE' '-lgssapi_krb5' <<\
! || \
562 <$tmp3.c link_check gssapi
'for GSSAPI in libgssapi' \
564 #define GSSAPI_REG_INCLUDE' '-lgssapi' || \
565 <$tmp3.c link_check gssapi \
566 'for GSSAPI in libgssapi, OpenBSD-style' \
568 #define GSSAPI_REG_INCLUDE' \
569 '-lgssapi -lkrb5 -lcrypto' '-I/usr/include/kerberosV'
571 #include <gssapi/gssapi.h>
572 #include <gssapi/gssapi_generic.h>
576 gss_import_name
(0, 0, gss_nt_service_name
, 0);
577 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
583 echo '/* IMAP/GSSAPI support not desired */' >> $out
586 if wantfeat IDNA
; then
587 link_check idna
'for GNU Libidn' '#define USE_IDNA' '-lidn' << \
!
589 #include <stringprep.h>
594 char
*utf8
, *idna_ascii
;
597 utf8
= stringprep_locale_to_utf8
("does.this.work");
598 if (idna_to_ascii_8z
(utf8
, &idna_ascii
, IDNA_USE_STD3_ASCII_RULES
)
601 if (idna_to_unicode_8z4z
(idna_ascii
, &idna_uni
, 0) != IDNA_SUCCESS
)
602 return (1 + (unsigned char
)idna_strerror
(0)[0]);
603 if (tld_check_4z
(idna_uni
, &sz
, NULL
) != TLD_SUCCESS
)
604 return (2 + (unsigned char
)tld_strerror
(0)[0]);
610 echo '/* IDNA support not desired */' >> $out
613 if wantfeat JUNK
; then
614 echo "#define USE_JUNK" >> $out
616 echo "/* #define USE_JUNK */" >> $out
619 if wantfeat MD5
; then
620 echo "#define USE_MD5" >> $out
622 echo "/* #define USE_MD5 */" >> $out
625 if wantfeat ASSERTS
; then
626 echo "#define HAVE_ASSERTS" >> $out
628 echo "/* #define HAVE_ASSERTS */" >> $out
631 # Since we cat(1) the content of those to cc/"ld", convert them to single line
633 < "${1}" > "${2}" awk \
634 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
637 squeeze_em
"$inc" "$tmp"
639 squeeze_em
"$lib" "$tmp"
645 #ifdef HAVE_NL_LANGINFO
646 #include <langinfo.h>
649 :The following optional features are enabled
:
650 #ifdef HAVE_SETLOCALE
651 : + Locale support
: Printable characters depend on the environment
652 #if defined HAVE_MBTOWC && defined HAVE_WCTYPE_H
653 : + Multibyte character support
657 : + Character
set conversion using
iconv()
659 #if defined HAVE_SETLOCALE && defined HAVE_NL_LANGINFO && defined CODESET
660 : + Automatic detection of terminal character
set
666 : + Support
for Internet Protocol v6
(IPv6
)
669 : + S
/MIME and SSL
/TLS using Network Security Services
(NSS
)
672 : + S
/MIME and SSL
/TLS using OpenSSL
678 : + IMAP GSSAPI authentication
687 : + Junk-mail management
(Bayesian filtering
)
690 : + The MD5 message digest
693 : + IDNA
(internationalized domain names
for applications
) support
696 :The following optional features are disabled
:
697 #ifndef HAVE_SETLOCALE
698 : - Locale support
: Only ASCII characters are recognized
700 #if ! defined HAVE_SETLOCALE || ! defined HAVE_MBTOWC || !defined HAVE_WCTYPE_H
701 : - Multibyte character support
704 : - Character
set conversion using
iconv()
706 #if ! defined HAVE_SETLOCALE || ! defined HAVE_NL_LANGINFO || ! defined CODESET
707 : - Automatic detection of terminal character
set
713 : - Support
for Internet Protocol v6
(IPv6
)
715 #if ! defined USE_SSL && ! defined USE_NSS
716 : - SSL
/TLS
(network transport authentication and encryption
)
722 : - IMAP GSSAPI authentication
731 : - Junk-mail management
(Bayesian filtering
)
734 : - The MD5 message digest
737 : - IDNA
(internationalized domain names
for applications
) support
741 #ifndef HAVE_SNPRINTF
742 : * The
function snprintf
() could not be found. mailx will be compiled to use
743 : sprintf
() instead. This might overflow buffers
if input values are larger
744 : than expected. Use the resulting binary with care or update your system
745 : environment and start the configuration process again.
748 : * The
function fchdir
() could not be found. mailx will be compiled to use
749 : chdir
() instead. This is not a problem unless the current working
750 : directory of mailx is moved
while the IMAP cache is used.
753 : * A
(usable
) getopt
() functionality could not be found.
754 : A
builtin version is used instead.
757 : * WANT_ASSERTS is enabled
, the program binary will contain code assertions.
758 : There are also additional commands available
, like
"core".
759 : Such a binary is not meant to be used by end-users
, but only
for
760 : development purposes. Thanks
!
765 $make -f $makefile $tmp2.x
766 < $tmp2.x
>&5 sed '/^[^:]/d; /^$/d; s/^://'