4 # Sccsid @(#)makeconfig 1.44 (gritter) 5/26/09
7 if [ -z "${CONFIG}" ]; then
8 [ -f user.conf
] && . user.conf
12 WANT_JUNK
=0 WANT_SOCKET
=0
18 WANT_JUNK
=0 WANT_IMAP
=0 WANT_POP3
=0
21 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
22 echo >&2 'Possible values: MINIMAL, NETLESS, NETSEND'
30 [ -z "${i}" ] && return 0
31 [ "${i}" = "0" ] && return 1
35 if ! wantfeat IMAP
&& ! wantfeat POP3
&& ! wantfeat SMTP
; then
39 if ! wantfeat IMAP
; then
58 * Auto-generated by $0.
59 * Changes are lost when $0 is run again.
63 # Auto-generated by $0.
64 # Changes are lost when $0 is run again.
66 # need one non-empty line
71 # Auto-generated by $0.
72 # Changes are lost when $0 is run again.
74 # need one non-empty line
79 trap "rm -f $out $lib $inc; exit" 1 2 15
80 trap "rm -f $tmp.? $tmp $tmp2.? $tmp2 $tmp3.? $tmp3" 0
85 printf "*** $fmt\\n" "$@"
86 printf "$fmt" "$@" >&5
94 echo '************************************************************'
95 msg
"checking $topic ... "
96 echo "/* checked $topic */" >>$out
98 echo '*** test program is'
100 #echo '*** the preprocessor generates'
103 echo '*** results are'
104 if $make $tmp.o
&& test -f $tmp.o
107 echo "$define" >>$out
108 eval have_
$variable=yes
111 echo "/* $define */" >>$out
113 eval unset have_
$variable
125 echo '************************************************************'
126 msg
"checking $topic ... "
127 echo "/* checked $topic */" >>$out
129 echo '*** test program is'
131 #echo '*** the preprocessor generates'
134 echo '*** results are'
135 if $make $tmp INCLUDES
="$INCLUDES $incs" LIBS
="$LIBS $libs" &&
139 echo "$define" >>$out
146 eval have_
$variable=yes
150 echo "/* $define */" >>$out
151 eval unset have_
$variable
156 link_check hello
'if a hello world program can be built' <<\
! ||
{ \
157 echo 'This problem is most certainly not specific to this software.' >&5; \
158 echo "Read the file '$log' and check your compiler installation." >&5; \
163 int main
(int argc
, char
*argv
[])
170 compile_check alloca_h
'for <alloca.h>' '#define HAVE_ALLOCA_H' <<\
!
174 link_check alloca
'for alloca()' '#define HAVE_ALLOCA' <<\
!
183 compile_check ssize_t
'for ssize_t' '#define HAVE_SSIZE_T' <<\
!
184 #include <sys/types.h>
194 link_check snprintf
'for snprintf()' '#define HAVE_SNPRINTF' <<\
!
199 snprintf
(b
, sizeof b
, "%s", "string");
204 link_check fchdir
'for fchdir()' '#define HAVE_FCHDIR' <<\
!
213 link_check mmap
'for mmap()' '#define HAVE_MMAP' <<\
!
214 #include <sys/types.h>
215 #include <sys/mman.h>
218 mmap
(0, 0, 0, 0, 0, 0);
223 link_check mremap
'for mremap()' '#define HAVE_MREMAP' <<\
!
224 #include <sys/types.h>
225 #include <sys/mman.h>
228 mremap
(0, 0, 0, MREMAP_MAYMOVE
);
239 id
= iconv_open
("foo", "bar");
243 <$tmp2.c link_check
iconv 'for iconv functionality' '#define HAVE_ICONV' ||
244 <$tmp2.c link_check
iconv 'for iconv functionality in libiconv' \
245 '#define HAVE_ICONV' '-liconv'
247 link_check wctype
'for wctype functionality' '#define HAVE_WCTYPE_H' <<\
!
257 link_check wcwidth
'for wcwidth() ' '#define HAVE_WCWIDTH' <<\
!
266 link_check mbtowc
'for mbtowc()' '#define HAVE_MBTOWC' <<\
!
276 link_check setlocale
'for setlocale()' '#define HAVE_SETLOCALE' <<\
!
280 setlocale
(LC_ALL
, "");
285 link_check nl_langinfo
'for nl_langinfo()' '#define HAVE_NL_LANGINFO' <<\
!
286 #include <langinfo.h>
294 link_check mkstemp
'for mkstemp()' '#define HAVE_MKSTEMP' <<\
!
303 link_check fpathconf
'for fpathconf()' '#define HAVE_FPATHCONF' <<\
!
307 fpathconf
(0, _PC_PATH_MAX
);
312 link_check wordexp
'for wordexp()' '#define HAVE_WORDEXP' <<\
!
316 wordexp
((char
*)0, (wordexp_t
*)0, 0);
321 ## user.conf added later, indentation not adjusted ##
323 if wantfeat SOCKET
; then
325 compile_check arpa_inet_h
'for <arpa/inet.h>' '#define HAVE_ARPA_INET_H' <<\
!
327 #include <sys/types.h>
328 #include <sys/socket.h>
330 #include <netinet/in.h>
331 #include <arpa/inet.h>
336 #include <sys/types.h>
337 #include <sys/socket.h>
339 #include <netinet/in.h>
340 #ifdef HAVE_ARPA_INET_H
341 #include <arpa/inet.h>
342 #endif /* HAVE_ARPA_INET_H */
347 socket
(AF_INET
, SOCK_STREAM
, 0);
349 gethostbyname
("foo");
355 <$tmp2.c link_check sockets
'for socket functionality in libc' \
356 '#define HAVE_SOCKETS' ||
357 <$tmp2.c link_check sockets
'for socket functionality in libnsl' \
358 '#define HAVE_SOCKETS' '-lnsl' ||
359 <$tmp2.c link_check sockets \
360 'for socket functionality in libsocket and libnsl' \
361 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
364 #link_check ipv6 'for IPv6 functionality' '#define HAVE_IPv6_FUNCS' <<\!
366 ##include <sys/types.h>
367 ##include <sys/socket.h>
369 ##include <netinet/in.h>
370 ##ifdef HAVE_ARPA_INET_H
371 ##include <arpa/inet.h>
372 ##endif /* HAVE_ARPA_INET_H */
376 # struct addrinfo a, *ap;
377 # getaddrinfo("foo", "0", &a, &ap);
382 [ ${WANT_SOCKET} -eq 1 ] ||
383 WANT_IMAP
=0 WANT_POP3
=0 WANT_SMTP
=0 WANT_SSL
=0 WANT_GSSAPI
=0
384 if wantfeat IMAP
; then
385 echo "#define USE_IMAP" >> $out
387 echo "/* #define USE_IMAP */" >> $out
389 if wantfeat POP3
; then
390 echo "#define USE_POP3" >>$out
392 echo "/* #define USE_POP3 */" >> $out
394 if wantfeat SMTP
; then
395 echo "#define USE_SMTP" >>$out
397 echo "/* #define USE_SMTP */" >> $out
400 echo '/* Socket (IMAP/POP3/SMTP) support not configured */' >> $out
401 WANT_IMAP
=0 WANT_POP3
=0 WANT_SMTP
=0 WANT_SSL
=0 WANT_GSSAPI
=0
403 if wantfeat SSL
; then
405 link_check nss
'for Network Security Services (NSS)' '#define USE_SSL
406 #define USE_NSS' '-lsmime3 -lnss3 -lssl3 -lnspr4 -lplc4' <<\
! || \
407 link_check openssl
'for sufficiently recent OpenSSL' \
409 #define USE_OPENSSL' '-lssl -lcrypto' <<\
%
414 #include <pk11func.h>
419 #include <ciferfam.h>
420 #include <private/pprio.h>
424 PR_ImportTCPSocket
(0);
425 NSS_CMSSignerInfo_AddSMIMECaps
(0);
429 #include <openssl/ssl.h>
430 #include <openssl/err.h>
431 #include <openssl/x509v3.h>
432 #include <openssl/x509.h>
433 #include <openssl/rand.h>
437 SSLv23_client_method
();
438 PEM_read_PrivateKey
(0, 0, 0, 0);
442 if test x
$have_nss = xyes
444 compile_check genname_h
'for genname.h' '#define HAVE_GENNAME_H' <<\
!
447 compile_check xconst_h
'for xconst.h' '#define HAVE_XCONST_H' <<\
!
450 compile_check CERTAltNameEncodedContext \
451 'for CERTAltNameEncodedContext type' \
452 '#define HAVE_CERTAltNameEncodedContext' <<\
!
458 #include <pk11func.h>
463 #include <ciferfam.h>
467 #ifdef HAVE_GENNAME_H
470 #include <private/pprio.h>
472 CERTAltNameEncodedContext foo
;
476 if test x
$have_openssl = xyes
478 compile_check stack_of
'for STACK_OF()' '#define HAVE_STACK_OF' <<\
!
479 #include <openssl/ssl.h>
480 #include <openssl/err.h>
481 #include <openssl/x509v3.h>
482 #include <openssl/x509.h>
483 #include <openssl/rand.h>
487 STACK_OF
(GENERAL_NAME
) *gens
= NULL
;
488 printf("%p", gens
); /* to
make it used
*/
489 SSLv23_client_method
();
490 PEM_read_PrivateKey
(0, 0, 0, 0);
497 echo '/* Socket/SSL support not configured */' >> $out
499 if wantfeat GSSAPI
; then
502 #include <gssapi/gssapi.h>
506 gss_import_name
(0, 0, GSS_C_NT_HOSTBASED_SERVICE
, 0);
507 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
512 sed -e '1s/gssapi\///' < $tmp2.c
> $tmp3.c
514 <$tmp2.c link_check gssapi
'for GSSAPI in libgss' \
515 '#define USE_GSSAPI' '-lgss' ||
516 <$tmp2.c link_check gssapi
'for GSSAPI in libgssapi_krb5' \
517 '#define USE_GSSAPI' '-lgssapi_krb5' ||
518 link_check gssapi
'for GSSAPI in libgssapi_krb5, old-style' \
520 #define GSSAPI_OLD_STYLE' '-lgssapi_krb5' <<\
! || \
521 <$tmp3.c link_check gssapi
'for GSSAPI in libgssapi' \
523 #define GSSAPI_REG_INCLUDE' '-lgssapi' || \
524 <$tmp3.c link_check gssapi \
525 'for GSSAPI in libgssapi, OpenBSD-style' \
527 #define GSSAPI_REG_INCLUDE' \
528 '-lgssapi -lkrb5 -lcrypto' '-I/usr/include/kerberosV'
530 #include <gssapi/gssapi.h>
531 #include <gssapi/gssapi_generic.h>
535 gss_import_name
(0, 0, gss_nt_service_name
, 0);
536 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
542 echo '/* IMAP/GSSAPI support not configured */' >> $out
545 if wantfeat JUNK
; then
546 echo "#define USE_JUNK" >>$out
548 echo "/* #define USE_JUNK */" >> $out
553 #ifdef HAVE_NL_LANGINFO
554 #include <langinfo.h>
557 :The following optional features are enabled
:
558 #ifdef HAVE_SETLOCALE
559 : + Locale support
: Printable characters depend on the environment
560 #if defined (HAVE_MBTOWC) && defined (HAVE_WCTYPE_H)
561 : + Multibyte character support
563 #endif /* HAVE_SETLOCALE */
565 : + Character
set conversion using
iconv()
567 #if defined (HAVE_SETLOCALE) && defined (HAVE_NL_LANGINFO) && defined (CODESET)
568 : + Automatic detection of terminal character
set
571 # if defined USE_IMAP && defined USE_POP3 && defined USE_SMTP
572 : + Networking support
(IMAP
, POP3
, and SMTP
)
575 : + Networking support
(IMAP
)
578 : + Networking support
(POP3
)
581 : + Networking support
(SMTP
)
586 : + IMAP GSSAPI authentication
588 #if defined (USE_NSS)
589 : + S
/MIME and SSL
/TLS using Network Security Services
(NSS
)
591 #if defined (USE_OPENSSL)
592 : + S
/MIME and SSL
/TLS using OpenSSL
595 : + Gunnar Ritter
's junk-mail management
598 :The following optional features are disabled:
599 #ifndef HAVE_SETLOCALE
600 : - Locale support: Only ASCII characters are recognized
602 #if !defined (HAVE_SETLOCALE) || !defined (HAVE_MBTOWC) || \
603 !defined (HAVE_WCTYPE_H)
604 : - Multibyte character support
607 : - Character set conversion using iconv()
609 #if !defined (HAVE_SETLOCALE) || !defined (HAVE_NL_LANGINFO) || \
611 : - Automatic detection of terminal character set
614 : - Networking support (IMAP, POP3, and SMTP)
617 : - Networking support (IMAP)
620 : - Networking support (POP3)
623 : - Networking support (SMTP)
627 : - IMAP GSSAPI authentication
630 : - SSL/TLS (network transport authentication and encryption)
633 : - Gunnar Ritter's junk-mail management
637 #ifndef HAVE_SNPRINTF
638 : * The
function snprintf
() could not be found. mailx will be compiled to use
639 : sprintf
() instead. This might overflow buffers
if input values are larger
640 : than expected. Use the resulting binary with care or update your system
641 : environment and start the configuration process again.
644 : * The
function fchdir
() could not be found. mailx will be compiled to use
645 : chdir
() instead. This is not a problem unless the current working
646 : directory of mailx is moved
while the IMAP cache is used.
651 (hash cc
) && cc
-E $tmp2.c |
sed '/^[^:]/d; /^$/d; s/^://' >&5