2 #@ Please see `INSTALL' and `conf.rc' instead.
9 chmod=`command -pv chmod`
12 grep=`command -pv grep`
13 make="${MAKE:-`command -pv make`}"
14 mkdir
=`command -pv mkdir`
20 STRIP
=`command -pv strip`
21 [ ${?} -eq 0 ] && HAVE_STRIP
=1 || HAVE_STRIP
=0
23 # Predefined CONFIG= urations take precedence over anything else
24 if [ -n "${CONFIG}" ]; then
29 WANT_READLINE
=0 WANT_EDITLINE
=0 WANT_NCL
=0
37 WANT_READLINE
=0 WANT_EDITLINE
=0
44 WANT_READLINE
=0 WANT_EDITLINE
=0
49 echo >&2 "Unknown CONFIG= setting: ${CONFIG}"
50 echo >&2 'Possible values: MINIMAL, MEDIUM, NETSEND'
57 if nwantfeat SOCKETS
; then
58 WANT_IPV6
=0 WANT_SSL
=0
59 WANT_IMAP
=0 WANT_GSSAPI
=0 WANT_POP3
=0 WANT_SMTP
=0
61 if nwantfeat IMAP
&& nwantfeat POP3
&& nwantfeat SMTP
; then
62 WANT_SOCKETS
=0 WANT_IPV6
=0 WANT_SSL
=0
64 if nwantfeat IMAP
; then
67 # If we don't need MD5 except for producing boundary and message-id strings,
68 # leave it off, plain old srand(3) should be enough for that purpose.
69 if nwantfeat SOCKETS
; then
72 if wantfeat DEBUG
; then
77 # Check out compiler ($CC) and -flags ($CFLAGS)
81 if [ -z "${CC}" ] ||
[ "${CC}" = cc
]; then
83 if { CC
="`command -v clang`"; }; then
85 elif { CC
="`command -v gcc`"; }; then
87 elif { CC
="`command -v c89`"; }; then
88 [ "${i}" = UnixWare
] && _CFLAGS
='-v -O'
89 elif { CC
="`command -v c99`"; }; then
93 echo >&2 ' I cannot find a compiler!'
94 echo >&2 ' Neither of clang(1), gcc(1), c89(1) and c99(1).'
95 echo >&2 ' Please set the CC environment variable, maybe CFLAGS also.'
101 ccver
=`${CC} --version 2>/dev/null`
103 if { i
=$ccver; echo "${i}"; } |
${grep} -q -i -e gcc
-e clang
; then
104 #if echo "${i}" | ${grep} -q -i -e gcc -e 'clang version 1'; then
106 _CFLAGS
='-std=c89 -O2'
107 _CFLAGS
="${_CFLAGS} -Wall -Wextra -pedantic"
108 _CFLAGS
="${_CFLAGS} -fno-unwind-tables -fno-asynchronous-unwind-tables"
109 _CFLAGS
="${_CFLAGS} -fstrict-aliasing"
110 _CFLAGS
="${_CFLAGS} -Wbad-function-cast -Wcast-align -Wcast-qual"
111 _CFLAGS
="${_CFLAGS} -Winit-self -Wshadow -Wunused -Wwrite-strings"
112 if { i
=$ccver; echo "${i}"; } |
${grep} -q -e 'clang version 1'; then
115 _CFLAGS
="${_CFLAGS} -fstrict-overflow -Wstrict-overflow=5"
116 if wantfeat AMALGAMATION
&& nwantfeat DEBUG
; then
117 _CFLAGS
="${_CFLAGS} -Wno-unused-function"
119 if { i
=$ccver; echo "${i}"; } |
${grep} -q -i -e clang
; then
120 _CFLAGS
="${_CFLAGS} -Wno-unused-result" # TODO handle the right way
123 _CFLAGS
="${_CFLAGS} -Wno-long-long" # ISO C89 has no 'long long'...
124 # elif { i=$ccver; echo "${i}"; } | ${grep} -q -i -e clang; then
126 # _CFLAGS='-std=c89 -O3 -g -Weverything -Wno-long-long'
127 elif [ -z "${_CFLAGS}" ]; then
131 if nwantfeat DEBUG
; then
132 _CFLAGS
="${_CFLAGS} -DNDEBUG"
134 _CFLAGS
="${_CFLAGS} -g";
135 if [ "${stackprot}" = yes ]; then
136 _CFLAGS
="${_CFLAGS} -fstack-protector-all "
137 _CFLAGS
="${_CFLAGS} -Wstack-protector -D_FORTIFY_SOURCE=2"
140 _CFLAGS
="${_CFLAGS} ${ADDCFLAGS}"
141 _LDFLAGS
="${_LDFLAGS} ${ADDLDFLAGS}" # XXX -Wl,--sort-common,[-O1]
142 export _CFLAGS _LDFLAGS
144 if wantfeat AUTOCC
; then
147 export CFLAGS LDFLAGS
154 ## - Heirloom sh(1) (and same origin) have problems with ': >' redirection,
155 ## so use "printf '' >" instead
156 ## - Heirloom sh(1) and maybe more execute loops with redirection in a subshell
157 ## (but don't export eval's from within), therefore we need to (re)include
158 ## variable assignments at toplevel instead (via reading temporary files)
160 ## First of all, create new configuration and check wether it changed ##
167 newlst
=.
/config.lst-new
168 newmk
=.
/config.mk-new
173 # Only incorporate what wasn't overwritten from command line / CONFIG
174 trap "${rm} -f ${tmp}; exit" 1 2 15
175 trap "${rm} -f ${tmp}" 0
178 < ${conf} ${sed} -e '/^[ \t]*#/d' -e '/^$/d' -e 's/[ \t]*$//' |
180 i
=`echo ${line} | ${sed} -e 's/=.*$//'`
181 eval j
=\$
${i} jx=\${${i}+x}
182 if [ -n "${j}" ] ||
[ "${jx}" = x
]; then
200 # (No function since some shells loose non-exported variables in traps)
201 trap "${rm} -f ${tmp} ${newlst} ${newmk} ${newh}; exit" 1 2 15
202 trap "${rm} -f ${tmp} ${newlst} ${newmk} ${newh}" 0
203 ${rm} -f ${newlst} ${newmk} ${newh}
206 i
=`echo ${line} | ${sed} -e 's/=.*$//'`
208 if [ -z "${j}" ] ||
[ "${j}" = 0 ]; then
209 printf "/*#define ${i}*/\n" >> ${newh}
210 elif [ "${j}" = 1 ]; then
211 printf "#define ${i}\n" >> ${newh}
213 printf "#define ${i} \"${j}\"\n" >> ${newh}
215 printf "${i} = ${j}\n" >> ${newmk}
216 printf "${i}=\"${j}\"\n"
217 done < ${tmp} > ${newlst}
220 printf "#define UAGENT \"${SID}${NAIL}\"\n" >> ${newh}
221 printf "UAGENT
= ${SID}${NAIL}\n" >> ${newmk}
225 printf "CC = ${CC}\n" >> ${newmk}
226 printf "_CFLAGS = ${_CFLAGS}\nCFLAGS = ${CFLAGS}\n" >> ${newmk}
227 printf "_LDFLAGS
= ${_LDFLAGS}\nLDFLAGS = ${LDFLAGS}\n" >> ${newmk}
228 printf "CMP=${cmp}\nCHMOD=${chmod}\nCP=${cp}\nMKDIR=${mkdir}\nRM=${rm}\n"\
230 printf "STRIP=${STRIP}\nHAVE_STRIP=${HAVE_STRIP}\n" >> ${newmk}
231 # (We include the cc(1)/ld(1) environment only for update detection..)
232 printf "CC
=\"${CC}\"\n" >> ${newlst}
233 printf "_CFLAGS
=\"${_CFLAGS}\"\nCFLAGS=\"${CFLAGS}\"\n" >> ${newlst}
234 printf "_LDFLAGS=\"${_LDFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n" >> ${newlst}
235 printf "CMP
=${cmp}\nCHMOD=${chmod}\nCP=${cp}\nMKDIR=${mkdir}\nRM=${rm}\n"\
237 printf "STRIP
=${STRIP}\nHAVE_STRIP=${HAVE_STRIP}\n" >> ${newlst}
239 if [ -f ${lst} ] && ${cmp} ${newlst} ${lst} >/dev
/null
2>&1; then
242 [ -f ${lst} ] && echo 'configuration updated..' ||
echo 'shiny configuration..'
244 ${mv} -f ${newlst} ${lst}
245 ${mv} -f ${newh} ${h}
246 ${mv} -f ${newmk} ${mk}
248 ## Compile and link checking ##
258 # (No function since some shells loose non-exported variables in traps)
259 trap "${rm} -f ${lst} ${h} ${mk} ${lib} ${inc} ${src} ${makefile}; exit" 1 2 15
260 trap "${rm} -rf ${tmp0}.* ${tmp0}* ${makefile}" 0
262 exec 5>&2 > ${log} 2>&1
265 # ${src} is only created if WANT_AMALGAMATION
267 ${cat} > ${makefile} << \
!
268 .SUFFIXES
: .o .c .x .y
272 $
(CC
) $
(XINCS
) -E $
< >$@
274 $
(CC
) $
(XINCS
) -o $@ $
< $
(XLIBS
)
282 printf "*** ${fmt}\\n" "${@}"
283 printf "${fmt}" "${@}" >&5
287 variable
=$1 topic
=$2 define
=$3
290 msg
"checking ${topic} ... "
291 echo "/* checked ${topic} */" >> ${h}
292 ${rm} -f ${tmp} ${tmp}.o
293 echo '*** test program is'
295 #echo '*** the preprocessor generates'
296 #${make} -f ${makefile} ${tmp}.x
298 echo '*** results are'
302 variable
=$1 topic
=$2 define
=$3
304 _check_preface
"${variable}" "${topic}" "${define}"
306 if ${make} -f ${makefile} XINCS="${INCS}" ./${tmp}.o
&&
307 [ -f .
/${tmp}.o
]; then
309 echo "${define}" >> ${h}
310 eval have_
${variable}=yes
313 echo "/* ${define} */" >> ${h}
315 eval unset have_
${variable}
321 run
=$1 variable
=$2 topic
=$3 define
=$4 libs
=$5 incs
=$6
323 _check_preface
"${variable}" "${topic}" "${define}"
325 if ${make} -f ${makefile} XINCS="${INCS} ${incs}" \
326 XLIBS="${LIBS} ${libs}" ./${tmp} &&
328 { [ ${run} -eq 0 ] || ./${tmp}; }; then
329 echo "*** adding INCS<${incs}> LIBS<${libs}>"
331 echo "${define}" >> ${h}
332 LIBS
="${LIBS} ${libs}"
333 echo "${libs}" >> ${lib}
334 INCS
="${INCS} ${incs}"
335 echo "${incs}" >> ${inc}
336 eval have_
${variable}=yes
340 echo "/* ${define} */" >> ${h}
341 eval unset have_
${variable}
347 _link_mayrun
0 "${1}" "${2}" "${3}" "${4}" "${5}"
351 _link_mayrun
1 "${1}" "${2}" "${3}" "${4}" "${5}"
354 # Build a basic set of INCS and LIBS according to user environment.
355 # On pkgsrc(7) systems automatically add /usr/pkg/*
356 if [ -n "${C_INCLUDE_PATH}" ]; then
359 set -- ${C_INCLUDE_PATH}
361 # for i; do -- new in POSIX Issue 7 + TC1
364 [ "${i}" = '/usr/pkg/include' ] && continue
365 INCS
="${INCS} -I${i}"
368 [ -d /usr
/pkg
/include
] && INCS
="${INCS} -I/usr/pkg/include"
369 echo "${INCS}" >> ${inc}
371 if [ -n "${LD_LIBRARY_PATH}" ]; then
374 set -- ${LD_LIBRARY_PATH}
376 # for i; do -- new in POSIX Issue 7 + TC1
379 [ "${i}" = '/usr/pkg/lib' ] && continue
380 LIBS
="${LIBS} -L${i}"
383 [ -d /usr
/pkg
/lib
] && LIBS
="${LIBS} -L/usr/pkg/lib"
384 echo "${LIBS}" >> ${lib}
388 # Better set _GNU_SOURCE (if we are on Linux only?)
389 # Fixes compilation on Slackware 14 + (with at least clang(1)).
390 # Since i've always defined this on GNU/Linux, i'm even surprised it works
391 # without!! Didn't check this yet (and TinyCore uses different environment).
392 echo '#define _GNU_SOURCE' >> ${h}
394 link_check hello
'if a hello world program can be built' << \
! ||
{\
395 echo >&5 'This oooops is most certainly not related to me.';\
396 echo >&5 "Read the file ${log} and check your compiler environment.";\
397 ${rm} -f ${lst} ${h} ${mk};\
402 int main
(int argc
, char
*argv
[])
411 link_check termios
'for termios.h and tc*() family' << \
! ||
{\
412 echo >&5 'We require termios.h and the tc*() family of functions.';\
413 echo >&5 "That much Unix we indulge ourselfs.";\
414 ${rm} -f ${lst} ${h} ${mk};\
422 tcsetattr
(0, TCSADRAIN | TCSAFLUSH
, &tios
);
427 link_check snprintf
'for snprintf()' '#define HAVE_SNPRINTF' << \
!
432 snprintf
(b
, sizeof b
, "%s", "string");
437 link_check putc_unlocked
'for putc_unlocked()' '#define HAVE_PUTC_UNLOCKED' <<\
!
441 putc_unlocked
('@', stdout
);
446 link_check fchdir
'for fchdir()' '#define HAVE_FCHDIR' << \
!
455 link_check mmap
'for mmap()' '#define HAVE_MMAP' << \
!
456 #include <sys/types.h>
457 #include <sys/mman.h>
460 mmap
(0, 0, 0, 0, 0, 0);
465 link_check mremap
'for mremap()' '#define HAVE_MREMAP' << \
!
466 #include <sys/types.h>
467 #include <sys/mman.h>
470 mremap
(0, 0, 0, MREMAP_MAYMOVE
);
475 link_check wctype
'for wctype functionality' '#define HAVE_WCTYPE_H' << \
!
485 link_check wcwidth
'for wcwidth() ' '#define HAVE_WCWIDTH' << \
!
494 link_check mbtowc
'for mbtowc()' '#define HAVE_MBTOWC' << \
!
504 link_check mbrtowc
'for mbrtowc()' '#define HAVE_MBRTOWC' << \
!
509 mbrtowc
(&wc, "x", 1, NULL
);
514 link_check mblen
'for mblen()' '#define HAVE_MBLEN' << \
!
518 return mblen
("\0", 1) == 0;
522 link_check setlocale
'for setlocale()' '#define HAVE_SETLOCALE' << \
!
526 setlocale
(LC_ALL
, "");
531 link_check nl_langinfo
'for nl_langinfo()' '#define HAVE_NL_LANGINFO' << \
!
532 #include <langinfo.h>
540 link_check mkstemp
'for mkstemp()' '#define HAVE_MKSTEMP' << \
!
549 # Note: run_check, thus we also get only the desired implementation...
550 run_check realpath
'for realpath()' '#define HAVE_REALPATH' << \
!
554 char
*x
= realpath
(".", NULL
), *y
= realpath
("/", NULL
);
555 return (x
!= NULL
&& y
!= NULL
) ?
0 : 1;
559 link_check wordexp
'for wordexp()' '#define HAVE_WORDEXP' << \
!
563 wordexp
((char
*)0, (wordexp_t
*)0, 0);
570 if wantfeat DEBUG
; then
571 echo '#define HAVE_DEBUG' >> ${h}
574 if wantfeat AMALGAMATION
; then
575 echo '#define HAVE_AMALGAMATION' >> ${h}
578 if nwantfeat NOALLOCA
; then
579 # Due to NetBSD PR lib/47120 it seems best not to use non-cc-builtin
580 # versions of alloca(3) since modern compilers just can't be trusted
581 # not to overoptimize and silently break some code
582 link_check alloca
'for __builtin_alloca()' \
583 '#define HAVE_ALLOCA __builtin_alloca' << \
!
586 void
*vp
= __builtin_alloca
(1);
592 if nwantfeat NOGETOPT
; then
593 link_check getopt
'for getopt()' '#define HAVE_GETOPT' << \
!
595 int main
(int argc
, char
**argv
)
597 #if defined __GLIBC__ || defined __linux__
598 Argument and option reordering is not a desired feature.
600 getopt
(argc
, argv
, "oPt");
602 return (((long
)optarg
+ optind
) & 0x7F);
609 if wantfeat ICONV
; then
610 ${cat} > ${tmp2}.c
<< \
!
616 id
= iconv_open
("foo", "bar");
620 < ${tmp2}.c link_check
iconv 'for iconv functionality' \
621 '#define HAVE_ICONV' ||
622 < ${tmp2}.c link_check
iconv \
623 'for iconv functionality in libiconv' \
624 '#define HAVE_ICONV' '-liconv'
626 echo '/* WANT_ICONV=0 */' >> ${h}
629 if wantfeat SOCKETS
; then
630 compile_check arpa_inet_h
'for <arpa/inet.h>' \
631 '#define HAVE_ARPA_INET_H' << \
!
633 #include <sys/types.h>
634 #include <sys/socket.h>
636 #include <netinet/in.h>
637 #include <arpa/inet.h>
640 ${cat} > ${tmp2}.c
<< \
!
642 #include <sys/types.h>
643 #include <sys/socket.h>
645 #include <netinet/in.h>
646 #ifdef HAVE_ARPA_INET_H
647 #include <arpa/inet.h>
653 socket
(AF_INET
, SOCK_STREAM
, 0);
655 gethostbyname
("foo");
660 < ${tmp2}.c link_check sockets
'for sockets in libc' \
661 '#define HAVE_SOCKETS' ||
662 < ${tmp2}.c link_check sockets
'for sockets in libnsl' \
663 '#define HAVE_SOCKETS' '-lnsl' ||
664 < ${tmp2}.c link_check sockets \
665 'for sockets in libsocket and libnsl' \
666 '#define HAVE_SOCKETS' '-lsocket -lnsl' ||
669 # XXX Shouldn't it be a hard error if there is no socket support, then?
672 echo '/* WANT_SOCKETS=0 */' >> ${h}
673 fi # wantfeat SOCKETS
676 link_check setsockopt
'for setsockopt()' '#define HAVE_SETSOCKOPT' << \
!
677 #include <sys/socket.h>
682 setsockopt
(sockfd
, SOL_SOCKET
, SO_KEEPALIVE
, NULL
, 0);
687 wantfeat SOCKETS
&& [ -n "${have_setsockopt}" ] &&
688 link_check so_sndtimeo
'for SO_SNDTIMEO' '#define HAVE_SO_SNDTIMEO' << \
!
689 #include <sys/socket.h>
697 setsockopt
(sockfd
, SOL_SOCKET
, SO_SNDTIMEO
, &tv
, sizeof tv
);
698 setsockopt
(sockfd
, SOL_SOCKET
, SO_RCVTIMEO
, &tv
, sizeof tv
);
703 wantfeat SOCKETS
&& [ -n "${have_setsockopt}" ] &&
704 link_check so_linger
'for SO_LINGER' '#define HAVE_SO_LINGER' << \
!
705 #include <sys/socket.h>
713 setsockopt
(sockfd
, SOL_SOCKET
, SO_LINGER
, &li
, sizeof li
);
718 if wantfeat IPV6
; then
719 link_check ipv6
'for IPv6 functionality' '#define HAVE_IPV6' << \
!
721 #include <sys/types.h>
722 #include <sys/socket.h>
724 #include <netinet/in.h>
725 #ifdef HAVE_ARPA_INET_H
726 #include <arpa/inet.h>
731 struct addrinfo a
, *ap
;
732 getaddrinfo
("foo", "0", &a
, &ap
);
737 echo '/* WANT_IPV6=0 */' >> ${h}
740 if wantfeat IMAP
; then
741 echo '#define HAVE_IMAP' >> ${h}
743 echo '/* WANT_IMAP=0 */' >> ${h}
746 if wantfeat POP3
; then
747 echo '#define HAVE_POP3' >> ${h}
749 echo '/* WANT_POP3=0 */' >> ${h}
752 if wantfeat SMTP
; then
753 echo '#define HAVE_SMTP' >> ${h}
755 echo '/* WANT_SMTP=0 */' >> ${h}
758 if wantfeat SSL
; then
759 link_check openssl
'for sufficiently recent OpenSSL' \
761 #define HAVE_OPENSSL' '-lssl -lcrypto' << \
!
762 #include <openssl/ssl.h>
763 #include <openssl/err.h>
764 #include <openssl/x509v3.h>
765 #include <openssl/x509.h>
766 #include <openssl/rand.h>
768 #if defined OPENSSL_NO_SSL2 && defined OPENSSL_NO_SSL3 &&\
769 defined OPENSSL_NO_TLS1
770 # error We need one of (SSLv2 and) SSLv3 and TLS1.
775 SSLv23_client_method
();
776 #ifndef OPENSSL_NO_SSL3
777 SSLv3_client_method
();
779 #ifndef OPENSSL_NO_TLS1
780 TLSv1_client_method
();
781 # ifdef TLS1_1_VERSION
782 TLSv1_1_client_method
();
784 # ifdef TLS1_2_VERSION
785 TLSv1_2_client_method
();
788 PEM_read_PrivateKey
(0, 0, 0, 0);
793 if [ "${have_openssl}" = 'yes' ]; then
794 compile_check stack_of
'for OpenSSL STACK_OF()' \
795 '#define HAVE_STACK_OF' << \
!
796 #include <openssl/ssl.h>
797 #include <openssl/err.h>
798 #include <openssl/x509v3.h>
799 #include <openssl/x509.h>
800 #include <openssl/rand.h>
804 STACK_OF
(GENERAL_NAME
) *gens
= NULL
;
805 printf("%p", gens
); /* to
make it used
*/
810 run_check openssl_md5
'for MD5 digest in OpenSSL' \
811 '#define HAVE_OPENSSL_MD5' << \
!
813 #include <openssl/md5.h>
817 char const dat
[] = "abrakadabrafidibus";
818 char
dig[16], hex
[16 * 2];
822 memset
(dig, 0, sizeof
(dig));
823 memset
(hex
, 0, sizeof
(hex
));
825 MD5_Update
(&ctx
, dat
, sizeof
(dat
) - 1);
826 MD5_Final
(dig, &ctx
);
828 #define hexchar(n) ((n)>9 ? (n)-10+'a' : (n)+'0')
829 for (i
= 0; i
< sizeof
(hex
) / 2; i
++) {
831 hex[j] = hexchar((dig[i] & 0xf0) >> 4);
832 hex[++j] = hexchar(dig[i] & 0x0f);
834 return !!memcmp("6d7d0a3d949da2e96f2aa010f65d8326", hex, sizeof(hex));
840 echo '/* WANT_SSL=0 */' >> ${h}
843 if wantfeat GSSAPI; then
844 ${cat} > ${tmp2}.c << \!
845 #include <gssapi/gssapi.h>
849 gss_import_name(0, 0, GSS_C_NT_HOSTBASED_SERVICE, 0);
850 gss_init_sec_context(0,0,0,0,0,0,0,0,0,0,0,0,0);
854 ${sed} -e '1s/gssapi\///' < ${tmp2}.c > ${tmp3}.c
856 if command -v krb5-config >/dev/null 2>&1; then
857 i
=`command -v krb5-config`
858 GSSAPI_LIBS
="`CFLAGS= ${i} --libs gssapi`"
859 GSSAPI_INCS
="`CFLAGS= ${i} --cflags`"
860 i
='for GSSAPI via krb5-config(1)'
862 GSSAPI_LIBS
='-lgssapi'
864 i
='for GSSAPI in gssapi/gssapi.h, libgssapi'
866 < ${tmp2}.c link_check gssapi \
867 "${i}" '#define HAVE_GSSAPI' \
868 "${GSSAPI_LIBS}" "${GSSAPI_INCS}" ||\
869 < ${tmp3}.c link_check gssapi \
870 'for GSSAPI in gssapi.h, libgssapi' \
872 #define GSSAPI_REG_INCLUDE' \
874 < ${tmp2}.c link_check gssapi
'for GSSAPI in libgssapi_krb5' \
875 '#define HAVE_GSSAPI' \
877 < ${tmp3}.c link_check gssapi \
878 'for GSSAPI in libgssapi, OpenBSD-style (pre 5.3)' \
880 #define GSSAPI_REG_INCLUDE' \
881 '-lgssapi -lkrb5 -lcrypto' \
882 '-I/usr/include/kerberosV' ||\
883 < ${tmp2}.c link_check gssapi
'for GSSAPI in libgss' \
884 '#define HAVE_GSSAPI' \
886 link_check gssapi
'for GSSAPI in libgssapi_krb5, old-style' \
888 #define GSSAPI_OLD_STYLE' \
889 '-lgssapi_krb5' << \
!
890 #include <gssapi/gssapi.h>
891 #include <gssapi/gssapi_generic.h>
895 gss_import_name
(0, 0, gss_nt_service_name
, 0);
896 gss_init_sec_context
(0,0,0,0,0,0,0,0,0,0,0,0,0);
901 echo '/* WANT_GSSAPI=0 */' >> ${h}
904 if wantfeat IDNA
; then
905 link_check idna
'for GNU Libidn' '#define HAVE_IDNA' '-lidn' << \
!
907 #include <stringprep.h>
910 char
*utf8
, *idna_ascii
, *idna_utf8
;
911 utf8
= stringprep_locale_to_utf8
("does.this.work");
912 if (idna_to_ascii_8z
(utf8
, &idna_ascii
, IDNA_USE_STD3_ASCII_RULES
)
915 /* (Rather link check only here
) */
916 idna_utf8
= stringprep_convert
(idna_ascii
, "UTF-8", "de_DE");
921 echo '/* WANT_IDNA=0 */' >> ${h}
924 if wantfeat READLINE
; then
926 link_check readline
"for readline(3) (${1})" \
927 '#define HAVE_READLINE' "${1}" << \
!
929 #include <readline/history.h>
930 #include <readline/readline.h>
937 rl
= readline
("Enter a line:");
941 rl_extend_line_buffer
(10);
942 rl_point
= rl_end
= 10;
943 rl_pre_input_hook
= (rl_hook_func_t
*)NULL
;
944 rl_forced_update_display
();
946 rl_free_line_state
();
947 rl_cleanup_after_signal
();
948 rl_reset_after_signal
();
954 __edrdlib
-lreadline ||
955 __edrdlib
'-lreadline -ltermcap'
956 [ -n "${have_readline}" ] && WANT_TABEXPAND
=1
959 if wantfeat EDITLINE
&& [ -z "${have_readline}" ]; then
961 link_check editline
"for editline(3) (${1})" \
962 '#define HAVE_EDITLINE' "${1}" << \
!
963 #include <histedit.h>
964 static char
* getprompt
(void
) { return (char
*)"ok"; }
968 EditLine
*el_el
= el_init
("TEST", stdin
, stdout
, stderr
);
969 History
*el_hcom
= history_init
();
970 history(el_hcom
, &he
, H_SETSIZE
, 242);
971 el_set
(el_el
, EL_SIGNAL
, 0);
972 el_set
(el_el
, EL_TERMINAL
, NULL
);
973 el_set
(el_el
, EL_HIST
, &history, el_hcom
);
974 el_set
(el_el
, EL_EDITOR
, "emacs");
975 el_set
(el_el
, EL_PROMPT
, &getprompt
);
976 el_source
(el_el
, NULL
);
978 /* TODO add loader and addfn checks
*/
979 history_end
(el_hcom
);
986 __edlib
'-ledit -ltermcap'
987 [ -n "${have_editline}" ] && WANT_TABEXPAND
=0
990 if wantfeat NCL
&& [ -z "${have_editline}" ] && [ -z "${have_readline}" ] &&\
991 [ -n "${have_mbrtowc}" ] && [ -n "${have_wctype}" ]; then
993 echo '#define HAVE_NCL' >> ${h}
995 echo '/* WANT_{READLINE,EDITLINE,NCL}=0 */' >> ${h}
998 if [ -n "${have_ncl}" ] ||
[ -n "${have_editline}" ] ||\
999 [ -n "${have_readline}" ]; then
1003 if [ -n "${have_cle}" ] && wantfeat TABEXPAND
; then
1004 echo '#define HAVE_TABEXPAND' >> ${h}
1006 echo '/* WANT_TABEXPAND=0 */' >> ${h}
1009 if [ -n "${have_cle}" ] && wantfeat HISTORY
; then
1010 echo '#define HAVE_HISTORY' >> ${h}
1012 echo '/* WANT_HISTORY=0 */' >> ${h}
1015 if wantfeat QUOTE_FOLD
&&\
1016 [ -n "${have_mbrtowc}" ] && [ -n "${have_wcwidth}" ]; then
1017 echo '#define HAVE_QUOTE_FOLD' >> ${h}
1019 echo '/* WANT_QUOTE_FOLD=0 */' >> ${h}
1022 if wantfeat DOCSTRINGS
; then
1023 echo '#define HAVE_DOCSTRINGS' >> ${h}
1025 echo '/* WANT_DOCSTRINGS=0 */' >> ${h}
1028 if wantfeat SPAM
; then
1029 echo '#define HAVE_SPAM' >> ${h}
1030 if command -v spamc
>/dev
/null
2>&1; then
1031 echo "#define SPAMC_PATH \"`command -v spamc`\"" >> ${h}
1034 echo '/* WANT_SPAM=0 */' >> ${h}
1037 if wantfeat MD5
; then
1038 echo '#define HAVE_MD5' >> ${h}
1040 echo '/* WANT_MD5=0 */' >> ${h}
1045 # Since we cat(1) the content of those to cc/"ld", convert them to single line
1047 < "${1}" > "${2}" ${awk} \
1048 'BEGIN {ORS = " "} /^[^#]/ {print} {next} END {ORS = ""; print "\n"}'
1051 squeeze_em ${inc} ${tmp}
1053 squeeze_em ${lib} ${tmp}
1058 printf '#ifndef _CONFIG_H\n# define _CONFIG_H\n' > ${h}
1059 ${cat} ${tmp} >> ${h}
1061 printf '\n/* The "feature string
", for "simplicity
" and lex.c */\n' >> ${h}
1062 printf '#ifdef _MAIN_SOURCE\n' >> ${h}
1063 printf '# ifdef HAVE_AMALGAMATION\nstatic\n# endif\n' >> ${h}
1064 printf 'char const features[] = "MIME
"\n' >> ${h}
1065 printf '# ifdef HAVE_DOCSTRINGS\n ",DOCSTRINGS
"\n# endif\n' >> ${h}
1066 printf '# ifdef HAVE_ICONV\n ",ICONV
"\n# endif\n' >> ${h}
1067 printf '# ifdef HAVE_SETLOCALE\n ",LOCALES
"\n# endif\n' >> ${h}
1068 printf '# ifdef HAVE_C90AMEND1\n ",MULTIBYTE CHARSETS
"\n# endif\n' >> ${h}
1069 printf '# ifdef HAVE_NL_LANGINFO\n ",TERMINAL CHARSET
"\n# endif\n' >> ${h}
1070 printf '# ifdef HAVE_SOCKETS\n ",NETWORK
"\n# endif\n' >> ${h}
1071 printf '# ifdef HAVE_IPV6\n ",IPv6
"\n# endif\n' >> ${h}
1072 printf '# ifdef HAVE_SSL\n ",S
/MIME
,SSL
/TSL
"\n# endif\n' >> ${h}
1073 printf '# ifdef HAVE_IMAP\n ",IMAP
"\n# endif\n' >> ${h}
1074 printf '# ifdef HAVE_GSSAPI\n ",GSSAPI
"\n# endif\n' >> ${h}
1075 printf '# ifdef HAVE_POP3\n ",POP3
"\n# endif\n' >> ${h}
1076 printf '# ifdef HAVE_SMTP\n ",SMTP
"\n# endif\n' >> ${h}
1077 printf '# ifdef HAVE_SPAM\n ",SPAM
"\n# endif\n' >> ${h}
1078 printf '# ifdef HAVE_IDNA\n ",IDNA
"\n# endif\n' >> ${h}
1079 printf '# ifdef HAVE_READLINE\n ",READLINE
"\n# endif\n' >> ${h}
1080 printf '# ifdef HAVE_EDITLINE\n ",EDITLINE
"\n# endif\n' >> ${h}
1081 printf '# ifdef HAVE_NCL\n ",NCL
"\n# endif\n' >> ${h}
1082 printf '# ifdef HAVE_TABEXPAND\n ",TABEXPAND
"\n# endif\n' >> ${h}
1083 printf '# ifdef HAVE_HISTORY\n ",HISTORY MANAGEMENT
"\n# endif\n' >> ${h}
1084 printf '# ifdef HAVE_QUOTE_FOLD\n ",QUOTE-FOLD
"\n# endif\n' >> ${h}
1085 printf '# ifdef HAVE_DEBUG\n ",DEBUG
"\n# endif\n' >> ${h}
1086 printf ';\n#endif /* _MAIN_SOURCE */\n' >> ${h}
1088 printf '#endif /* _CONFIG_H */\n' >> ${h}
1091 # Create the real mk.mk
1092 ${rm} -rf ${tmp0}.* ${tmp0}*
1093 printf 'OBJ_SRC = ' >> ${mk}
1094 if nwantfeat AMALGAMATION; then
1096 echo 'OBJ_DEP =' >> ${mk}
1098 j=`echo "${src}" | sed 's/^.\///'`
1099 echo "${j}" >> ${mk}
1100 printf 'OBJ_DEP = main.c ' >> ${mk}
1101 printf '#define _MAIN_SOURCE\n' >> ${src}
1102 printf '#include "nail.h
"\n#include "main.c
"\n' >> ${src}
1104 if [ "${i}" = "${j}" ] || [ "${i}" = main.c ]; then
1107 printf "${i} " >> ${mk}
1108 printf "#include \"${i}\"\n" >> ${src}
1113 echo "LIBS = `${cat} ${lib}`" >> ${mk}
1114 echo "INCLUDES
= `${cat} ${inc}`" >> ${mk}
1116 ${cat} ./mk-mk.in >> ${mk}
1120 ${cat} > ${tmp2}.c << \!
1122 #ifdef HAVE_NL_LANGINFO
1123 #include <langinfo.h>
1126 :The following optional features are enabled:
1128 : + Character set conversion using iconv()
1130 #ifdef HAVE_SETLOCALE
1131 : + Locale support: Printable characters depend on the environment
1132 # if defined HAVE_MBTOWC && defined HAVE_WCTYPE_H
1133 : + Multibyte character support
1135 # if defined HAVE_NL_LANGINFO && defined CODESET
1136 : + Automatic detection of terminal character set
1143 : + Support for Internet Protocol v6 (IPv6)
1146 # ifdef HAVE_OPENSSL
1147 : + S/MIME and SSL/TLS using OpenSSL
1154 : + IMAP GSSAPI authentication
1163 : + Interaction with spam filters
1166 : + IDNA (internationalized domain names for applications) support
1168 #if defined HAVE_READLINE || defined HAVE_EDITLINE || defined HAVE_NCL
1169 : + Command line editing
1170 # ifdef HAVE_TABEXPAND
1171 : + + Tabulator expansion
1173 # ifdef HAVE_HISTORY
1174 : + + History management
1177 #ifdef HAVE_QUOTE_FOLD
1178 : + Extended *quote-fold*ing
1181 :The following optional features are disabled:
1183 : - Character set conversion using iconv()
1185 #ifndef HAVE_SETLOCALE
1186 : - Locale support: Only ASCII characters are recognized
1188 #if ! defined HAVE_SETLOCALE || ! defined HAVE_MBTOWC || !defined HAVE_WCTYPE_H
1189 : - Multibyte character support
1191 #if ! defined HAVE_SETLOCALE || ! defined HAVE_NL_LANGINFO || ! defined CODESET
1192 : - Automatic detection of terminal character set
1194 #ifndef HAVE_SOCKETS
1198 : - Support for Internet Protocol v6 (IPv6)
1200 #if ! defined HAVE_SSL
1201 : - SSL/TLS (network transport authentication and encryption)
1207 : - IMAP GSSAPI authentication
1216 : - Interaction with spam filters
1219 : - IDNA (internationalized domain names for applications) support
1221 #if !defined HAVE_READLINE && !defined HAVE_EDITLINE && !defined HAVE_NCL
1222 : - Command line editing and history
1224 #ifndef HAVE_QUOTE_FOLD
1225 : - Extended *quote-fold*ing
1229 #ifndef HAVE_SNPRINTF
1230 : . The function snprintf() could not be found. mailx will be compiled to use
1231 : sprintf() instead. This might overflow buffers if input values are larger
1232 : than expected. Use the resulting binary with care or update your system
1233 : environment and start the configuration process again.
1236 : . The function fchdir() could not be found. mailx will be compiled to use
1237 : chdir() instead. This is not a problem unless the current working
1238 : directory of mailx is moved while the IMAP cache is used.
1241 : . Using a minimal builtin POSIX-like getopt()
1244 : . Debug enabled binary: not meant to be used by end-users: THANKS!
1249 ${make} -f ${makefile} ${tmp2}.x
1250 < ${tmp2}.x >&5 ${sed} -e '/^[^:]/d; /^$/d; s/^://'
1252 # vim:set fenc=utf-8:s-it-mode