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 compile_check alloca_h
'for <alloca.h>' '#define HAVE_ALLOCA_H' <<\
!
184 link_check alloca
'for alloca()' '#define HAVE_ALLOCA' <<\
!
193 compile_check ssize_t
'for ssize_t' '#define HAVE_SSIZE_T' <<\
!
194 #include <sys/types.h>
204 link_check snprintf
'for snprintf()' '#define HAVE_SNPRINTF' <<\
!
209 snprintf
(b
, sizeof b
, "%s", "string");
214 link_check putc_unlocked
'for putc_unlocked()' '#define HAVE_PUTC_UNLOCKED' <<\
!
218 putc_unlocked
('@', stdout
);
223 link_check fchdir
'for fchdir()' '#define HAVE_FCHDIR' <<\
!
232 link_check mmap
'for mmap()' '#define HAVE_MMAP' <<\
!
233 #include <sys/types.h>
234 #include <sys/mman.h>
237 mmap
(0, 0, 0, 0, 0, 0);
242 link_check mremap
'for mremap()' '#define HAVE_MREMAP' <<\
!
243 #include <sys/types.h>
244 #include <sys/mman.h>
247 mremap
(0, 0, 0, MREMAP_MAYMOVE
);
258 id
= iconv_open
("foo", "bar");
262 <$tmp2.c link_check
iconv 'for iconv functionality' '#define HAVE_ICONV' ||
263 <$tmp2.c link_check
iconv 'for iconv functionality in libiconv' \
264 '#define HAVE_ICONV' '-liconv'
266 link_check wctype
'for wctype functionality' '#define HAVE_WCTYPE_H' <<\
!
276 link_check wcwidth
'for wcwidth() ' '#define HAVE_WCWIDTH' <<\
!
285 link_check mbtowc
'for mbtowc()' '#define HAVE_MBTOWC' <<\
!
295 link_check setlocale
'for setlocale()' '#define HAVE_SETLOCALE' <<\
!
299 setlocale
(LC_ALL
, "");
304 link_check nl_langinfo
'for nl_langinfo()' '#define HAVE_NL_LANGINFO' <<\
!
305 #include <langinfo.h>
313 link_check mkstemp
'for mkstemp()' '#define HAVE_MKSTEMP' <<\
!
322 link_check fpathconf
'for fpathconf()' '#define HAVE_FPATHCONF' <<\
!
326 fpathconf
(0, _PC_PATH_MAX
);
331 link_check wordexp
'for wordexp()' '#define HAVE_WORDEXP' <<\
!
335 wordexp
((char
*)0, (wordexp_t
*)0, 0);
340 link_check getopt
'for getopt()' '#define __WE_WILL_USE_SYS_GETOPT' << \
! || \
341 echo '#define USE_BUILTIN_GETOPT' >> $out
343 int main
(int argc
, char
**argv
)
345 getopt
(argc
, argv
, "oPt");
346 return ((long
)optarg
+ optind
) & 0x7F;
350 ## user.conf added later, indentation not adjusted ##
352 if wantfeat SOCKET
; then
354 compile_check arpa_inet_h
'for <arpa/inet.h>' '#define HAVE_ARPA_INET_H' <<\
!
356 #include <sys/types.h>
357 #include <sys/socket.h>
359 #include <netinet/in.h>
360 #include <arpa/inet.h>
365 #include <sys/types.h>
366 #include <sys/socket.h>
368 #include <netinet/in.h>
369 #ifdef HAVE_ARPA_INET_H
370 #include <arpa/inet.h>
371 #endif /* HAVE_ARPA_INET_H */
376 socket
(AF_INET
, SOCK_STREAM
, 0);
378 gethostbyname
("foo");
384 <$tmp2.c link_check sockets
'for socket functionality in libc' \
385 '#define HAVE_SOCKETS' ||
386 <$tmp2.c link_check sockets
'for socket functionality in libnsl' \
387 '#define HAVE_SOCKETS' '-lnsl' ||
388 <$tmp2.c link_check sockets \
389 'for socket functionality in libsocket and libnsl' \
390 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
393 # XXX Shouldn't it be a hard error if there is no socket support, then?
394 [ ${WANT_SOCKET} -eq 1 ] ||
395 WANT_IPV6
=0 WANT_SSL
=0 \
396 WANT_IMAP
=0 WANT_GSSAPI
=0 WANT_POP3
=0 WANT_SMTP
=0
399 if wantfeat IPV6
; then
401 link_check ipv6
'for IPv6 functionality' '#define USE_IPV6' << \
!
403 #include <sys/types.h>
404 #include <sys/socket.h>
406 #include <netinet/in.h>
407 #ifdef HAVE_ARPA_INET_H
408 #include <arpa/inet.h>
413 struct addrinfo a
, *ap
;
414 getaddrinfo
("foo", "0", &a
, &ap
);
421 if wantfeat IMAP
; then
422 echo "#define USE_IMAP" >> $out
424 echo "/* #define USE_IMAP */" >> $out
427 if wantfeat POP3
; then
428 echo "#define USE_POP3" >>$out
430 echo "/* #define USE_POP3 */" >> $out
433 if wantfeat SMTP
; then
434 echo "#define USE_SMTP" >>$out
436 echo "/* #define USE_SMTP */" >> $out
439 if wantfeat SSL
; then
441 link_check nss
'for Network Security Services (NSS)' '#define USE_SSL
442 #define USE_NSS' '-lsmime3 -lnss3 -lssl3 -lnspr4 -lplc4' <<\
! || \
443 link_check openssl
'for sufficiently recent OpenSSL' \
445 #define USE_OPENSSL' '-lssl -lcrypto' <<\
%
450 #include <pk11func.h>
455 #include <ciferfam.h>
456 #include <private/pprio.h>
460 PR_ImportTCPSocket
(0);
461 NSS_CMSSignerInfo_AddSMIMECaps
(0);
465 #include <openssl/ssl.h>
466 #include <openssl/err.h>
467 #include <openssl/x509v3.h>
468 #include <openssl/x509.h>
469 #include <openssl/rand.h>
473 SSLv23_client_method
();
474 PEM_read_PrivateKey
(0, 0, 0, 0);
478 if test x
$have_nss = xyes
480 compile_check genname_h
'for genname.h' '#define HAVE_GENNAME_H' <<\
!
483 compile_check xconst_h
'for xconst.h' '#define HAVE_XCONST_H' <<\
!
486 compile_check CERTAltNameEncodedContext \
487 'for CERTAltNameEncodedContext type' \
488 '#define HAVE_CERTAltNameEncodedContext' <<\
!
494 #include <pk11func.h>
499 #include <ciferfam.h>
503 #ifdef HAVE_GENNAME_H
506 #include <private/pprio.h>
508 CERTAltNameEncodedContext foo
;
512 if test x
$have_openssl = xyes
514 compile_check stack_of
'for STACK_OF()' '#define HAVE_STACK_OF' <<\
!
515 #include <openssl/ssl.h>
516 #include <openssl/err.h>
517 #include <openssl/x509v3.h>
518 #include <openssl/x509.h>
519 #include <openssl/rand.h>
523 STACK_OF
(GENERAL_NAME
) *gens
= NULL
;
524 printf("%p", gens
); /* to
make it used
*/
525 SSLv23_client_method
();
526 PEM_read_PrivateKey
(0, 0, 0, 0);
533 echo '/* Socket/SSL support not desired */' >> $out
535 if wantfeat GSSAPI
; then
538 #include <gssapi/gssapi.h>
542 gss_import_name
(0, 0, GSS_C_NT_HOSTBASED_SERVICE
, 0);
543 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
548 sed -e '1s/gssapi\///' < $tmp2.c
> $tmp3.c
550 <$tmp2.c link_check gssapi
'for GSSAPI in libgss' \
551 '#define USE_GSSAPI' '-lgss' ||
552 <$tmp2.c link_check gssapi
'for GSSAPI in libgssapi_krb5' \
553 '#define USE_GSSAPI' '-lgssapi_krb5' ||
554 link_check gssapi
'for GSSAPI in libgssapi_krb5, old-style' \
556 #define GSSAPI_OLD_STYLE' '-lgssapi_krb5' <<\
! || \
557 <$tmp3.c link_check gssapi
'for GSSAPI in libgssapi' \
559 #define GSSAPI_REG_INCLUDE' '-lgssapi' || \
560 <$tmp3.c link_check gssapi \
561 'for GSSAPI in libgssapi, OpenBSD-style' \
563 #define GSSAPI_REG_INCLUDE' \
564 '-lgssapi -lkrb5 -lcrypto' '-I/usr/include/kerberosV'
566 #include <gssapi/gssapi.h>
567 #include <gssapi/gssapi_generic.h>
571 gss_import_name
(0, 0, gss_nt_service_name
, 0);
572 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
578 echo '/* IMAP/GSSAPI support not desired */' >> $out
581 if wantfeat JUNK
; then
582 echo "#define USE_JUNK" >> $out
584 echo "/* #define USE_JUNK */" >> $out
587 if wantfeat MD5
; then
588 echo "#define USE_MD5" >> $out
590 echo "/* #define USE_MD5 */" >> $out
593 if wantfeat ASSERTS
; then
594 echo "#define HAVE_ASSERTS" >> $out
596 echo "/* #define HAVE_ASSERTS */" >> $out
599 # Since we cat(1) the content of those to cc/"ld", convert them to single line
601 < "${1}" > "${2}" awk \
602 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
605 squeeze_em
"$inc" "$tmp"
607 squeeze_em
"$lib" "$tmp"
613 #ifdef HAVE_NL_LANGINFO
614 #include <langinfo.h>
617 :The following optional features are enabled
:
618 #ifdef HAVE_SETLOCALE
619 : + Locale support
: Printable characters depend on the environment
620 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
621 : + Multibyte character support
623 #endif /* HAVE_SETLOCALE */
625 : + Character
set conversion using
iconv()
627 #if defined (HAVE_SETLOCALE) && defined (HAVE_NL_LANGINFO) && defined (CODESET)
628 : + Automatic detection of terminal character
set
634 : + Support
for Internet Protocol v6
(IPv6
)
637 : + S
/MIME and SSL
/TLS using Network Security Services
(NSS
)
640 : + S
/MIME and SSL
/TLS using OpenSSL
646 : + IMAP GSSAPI authentication
655 : + Junk-mail management
(Bayesian filtering
)
658 : + The MD5 message digest
661 :The following optional features are disabled
:
662 #ifndef HAVE_SETLOCALE
663 : - Locale support
: Only ASCII characters are recognized
665 #if !defined (HAVE_SETLOCALE) || !defined (HAVE_MBTOWC) || \
666 !defined
(HAVE_WCTYPE_H
)
667 : - Multibyte character support
670 : - Character
set conversion using
iconv()
672 #if !defined (HAVE_SETLOCALE) || !defined (HAVE_NL_LANGINFO) || \
674 : - Automatic detection of terminal character
set
680 : - Support
for Internet Protocol v6
(IPv6
)
682 #if ! defined USE_SSL && ! defined USE_NSS
683 : - SSL
/TLS
(network transport authentication and encryption
)
689 : - IMAP GSSAPI authentication
698 : - Junk-mail management
(Bayesian filtering
)
701 : - The MD5 message digest
705 #ifndef HAVE_SNPRINTF
706 : * The
function snprintf
() could not be found. mailx will be compiled to use
707 : sprintf
() instead. This might overflow buffers
if input values are larger
708 : than expected. Use the resulting binary with care or update your system
709 : environment and start the configuration process again.
712 : * The
function fchdir
() could not be found. mailx will be compiled to use
713 : chdir
() instead. This is not a problem unless the current working
714 : directory of mailx is moved
while the IMAP cache is used.
716 #ifndef __WE_WILL_USE_SYS_GETOPT
717 : * A
(usable
) getopt
() functionality could not be found. A simple
builtin
718 : version is used instead.
721 : * WANT_ASSERTS is enabled
, the program binary will contain code assertions.
722 : Such a binary is not meant to be used by end-users
, but only
for
723 : development purposes. Thanks
!
728 $make -f $makefile $tmp2.x
729 < $tmp2.x
>&5 sed '/^[^:]/d; /^$/d; s/^://'