version 1.72, 2020/02/05 15:12:11 |
version 1.74, 2020/06/14 23:40:31 |
|
|
# |
# |
# $Id$ |
# $Id$ |
# |
# |
# Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org> |
# Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org> |
# |
# |
# Permission to use, copy, modify, and distribute this software for any |
# Permission to use, copy, modify, and distribute this software for any |
# purpose with or without fee is hereby granted, provided that the above |
# purpose with or without fee is hereby granted, provided that the above |
Line 33 echo "file config.log: writing..." |
|
Line 33 echo "file config.log: writing..." |
|
# Initialize all variables here, |
# Initialize all variables here, |
# such that nothing can leak in from the environment. |
# such that nothing can leak in from the environment. |
|
|
SOURCEDIR=`dirname "$0"` |
SOURCEDIR=`dirname "${0}"` |
|
|
MANPATH_BASE="/usr/share/man:/usr/X11R6/man" |
MANPATH_BASE="/usr/share/man:/usr/X11R6/man" |
MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man" |
MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man" |
|
|
|
|
CC=cc |
CC=cc |
CFLAGS= |
CFLAGS= |
|
FATAL=0 |
LDADD= |
LDADD= |
LDFLAGS= |
LDFLAGS= |
LD_NANOSLEEP= |
LD_NANOSLEEP= |
|
|
INSTALL_LIBMANDOC=0 |
INSTALL_LIBMANDOC=0 |
|
|
HAVE_CMSG= |
HAVE_CMSG= |
HAVE_CMSG_XPG42=0 |
|
HAVE_DIRENT_NAMLEN= |
HAVE_DIRENT_NAMLEN= |
HAVE_EFTYPE= |
HAVE_EFTYPE= |
HAVE_ENDIAN= |
HAVE_ENDIAN= |
|
|
|
|
NEED_GNU_SOURCE=0 |
NEED_GNU_SOURCE=0 |
NEED_OPENBSD_SOURCE=0 |
NEED_OPENBSD_SOURCE=0 |
|
NEED_XPG4_2=0 |
|
|
PREFIX="/usr/local" |
PREFIX="/usr/local" |
BINDIR= |
BINDIR= |
|
|
# In case of failure, do not decide anything yet. |
# In case of failure, do not decide anything yet. |
# Arguments: test file name, test var name, additional CFLAGS |
# Arguments: test file name, test var name, additional CFLAGS |
singletest() { |
singletest() { |
n=${1}${3}${4} |
n=${1}${3} |
cat 1>&3 << __HEREDOC__ |
cat 1>&3 << __HEREDOC__ |
testing ${n} ... |
testing ${n} ... |
${COMP} -o test-${1} test-${1}.c ${3} ${4} |
${COMP} -o test-${1} test-${1}.c ${3} |
__HEREDOC__ |
__HEREDOC__ |
|
|
if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} ${4} 1>&3 2>&3 |
if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} 1>&3 2>&3 |
then |
then |
echo "partial result of ${n}: ${CC} succeeded" 1>&3 |
echo "partial result of ${n}: ${CC} succeeded" 1>&3 |
else |
else |
|
echo "tested ${n}: no (compilation failed)" 1>&2 |
echo "result of ${n}: ${CC} failed with exit status $?" 1>&3 |
echo "result of ${n}: ${CC} failed with exit status $?" 1>&3 |
echo "result of compiling ${n}: no" 1>&3 |
echo "result of compiling ${n}: no" 1>&3 |
echo 1>&3 |
echo 1>&3 |
|
|
echo "result of running ${n}: yes" 1>&3 |
echo "result of running ${n}: yes" 1>&3 |
echo 1>&3 |
echo 1>&3 |
eval HAVE_${2}=1 |
eval HAVE_${2}=1 |
[ "X$3" = "X-D_GNU_SOURCE" ] && NEED_GNU_SOURCE=1 |
[ "${3}" = "-D_GNU_SOURCE" ] && NEED_GNU_SOURCE=1 |
[ "X$3" = "X-D_OPENBSD_SOURCE" ] && NEED_OPENBSD_SOURCE=1 |
[ "${3}" = "-D_OPENBSD_SOURCE" ] && NEED_OPENBSD_SOURCE=1 |
|
[ "${3}" = "-D_XPG4_2" ] && NEED_XPG4_2=1 |
|
[ "${3}" = "-lrt" ] && LD_NANOSLEEP="-lrt" |
|
[ "${3}" = "-lsocket" ] && LD_RECVMSG="-lsocket" |
|
[ "${3}" = "-lutil" ] && LD_OHASH="-lutil" |
rm "test-${1}" |
rm "test-${1}" |
return 0 |
return 0 |
else |
else |
|
echo "tested ${n}: no (execution failed)" 1>&2 |
echo "result of ${n}: execution failed with exit status $?" 1>&3 |
echo "result of ${n}: execution failed with exit status $?" 1>&3 |
echo "result of running ${n}: no" 1>&3 |
echo "result of running ${n}: no" 1>&3 |
echo 1>&3 |
echo 1>&3 |
|
|
# Run a complete autoconfiguration test, including the check for |
# Run a complete autoconfiguration test, including the check for |
# a manual override and disabling the feature on failure. |
# a manual override and disabling the feature on failure. |
# Arguments: test file name, test var name, additional CFLAGS |
# Arguments: test file name, test var name, additional CFLAGS |
|
# The final argument can optionally be repeated a second time. |
runtest() { |
runtest() { |
eval _manual=\${HAVE_${2}} |
eval _manual=\${HAVE_${2}} |
ismanual "${1}" "${2}" "${_manual}" && return 0 |
ismanual "${1}" "${2}" "${_manual}" && return 0 |
singletest "${1}" "${2}" "${3}" "${4}" && return 0 |
singletest "${1}" "${2}" "${3}" && return 0 |
echo "tested ${1}${3}${4}: no" 1>&2 |
[ -n "${4}" ] && singletest "${1}" "${2}" "${4}" && return 0 |
eval HAVE_${2}=0 |
eval HAVE_${2}=0 |
return 1 |
return 1 |
} |
} |
|
|
# Select a UTF-8 locale. |
# Select a UTF-8 locale. |
get_locale() { |
get_locale() { |
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0 |
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0 |
ismanual UTF8_LOCALE UTF8_LOCALE "$UTF8_LOCALE" && return 0 |
ismanual UTF8_LOCALE UTF8_LOCALE "${UTF8_LOCALE}" && return 0 |
echo "testing UTF8_LOCALE ..." 1>&3 |
echo "testing UTF8_LOCALE ..." 1>&3 |
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1` |
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1` |
if [ -z "${UTF8_LOCALE}" ]; then |
if [ -z "${UTF8_LOCALE}" ]; then |
Line 228 if [ -n "${OSENUM}" ]; then |
|
Line 236 if [ -n "${OSENUM}" ]; then |
|
echo "OSENUM specified manually: ${OSENUM}" 1>&3 |
echo "OSENUM specified manually: ${OSENUM}" 1>&3 |
else |
else |
OSDETECT=`uname` |
OSDETECT=`uname` |
if [ "X${OSDETECT}" = "XNetBSD" ]; then |
if [ "${OSDETECT}" = "NetBSD" ]; then |
OSENUM=MANDOC_OS_NETBSD |
OSENUM=MANDOC_OS_NETBSD |
elif [ "X${OSDETECT}" = "XOpenBSD" ]; then |
elif [ "${OSDETECT}" = "OpenBSD" ]; then |
OSENUM=MANDOC_OS_OPENBSD |
OSENUM=MANDOC_OS_OPENBSD |
else |
else |
OSENUM=MANDOC_OS_OTHER |
OSENUM=MANDOC_OS_OTHER |
|
|
# --- tests for config.h ---------------------------------------------- |
# --- tests for config.h ---------------------------------------------- |
|
|
# --- library functions --- |
# --- library functions --- |
|
runtest cmsg CMSG "" "-D_XPG4_2" || true |
runtest dirent-namlen DIRENT_NAMLEN || true |
runtest dirent-namlen DIRENT_NAMLEN || true |
runtest be32toh ENDIAN || true |
runtest be32toh ENDIAN || true |
runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true |
runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true |
runtest EFTYPE EFTYPE || true |
runtest EFTYPE EFTYPE || true |
runtest err ERR || true |
runtest err ERR || true |
runtest getline GETLINE || true |
runtest getline GETLINE || true |
singletest getsubopt GETSUBOPT || \ |
runtest getsubopt GETSUBOPT "" -D_GNU_SOURCE || true |
runtest getsubopt GETSUBOPT -D_GNU_SOURCE || true |
|
runtest isblank ISBLANK || true |
runtest isblank ISBLANK || true |
runtest mkdtemp MKDTEMP || true |
runtest mkdtemp MKDTEMP || true |
|
runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" "-lrt" || true |
runtest ntohl NTOHL || true |
runtest ntohl NTOHL || true |
runtest O_DIRECTORY O_DIRECTORY || true |
runtest O_DIRECTORY O_DIRECTORY || true |
runtest PATH_MAX PATH_MAX || true |
runtest PATH_MAX PATH_MAX || true |
runtest pledge PLEDGE || true |
runtest pledge PLEDGE || true |
runtest sandbox_init SANDBOX_INIT || true |
runtest sandbox_init SANDBOX_INIT || true |
runtest progname PROGNAME || true |
runtest progname PROGNAME || true |
singletest reallocarray REALLOCARRAY || \ |
runtest reallocarray REALLOCARRAY "" -D_OPENBSD_SOURCE || true |
runtest reallocarray REALLOCARRAY -D_OPENBSD_SOURCE || true |
runtest recallocarray RECALLOCARRAY "" -D_OPENBSD_SOURCE || true |
singletest recallocarray RECALLOCARRAY || \ |
runtest recvmsg RECVMSG "${LD_RECVMSG}" "-lsocket" || true |
runtest recallocarray RECALLOCARRAY -D_OPENBSD_SOURCE || true |
|
runtest rewb-bsd REWB_BSD || true |
runtest rewb-bsd REWB_BSD || true |
runtest rewb-sysv REWB_SYSV || true |
runtest rewb-sysv REWB_SYSV || true |
singletest strcasestr STRCASESTR || \ |
runtest strcasestr STRCASESTR "" -D_GNU_SOURCE || true |
runtest strcasestr STRCASESTR -D_GNU_SOURCE || true |
|
runtest stringlist STRINGLIST || true |
runtest stringlist STRINGLIST || true |
runtest strlcat STRLCAT || true |
runtest strlcat STRLCAT || true |
runtest strlcpy STRLCPY || true |
runtest strlcpy STRLCPY || true |
runtest strndup STRNDUP || true |
runtest strndup STRNDUP || true |
singletest strptime STRPTIME || \ |
runtest strptime STRPTIME "" -D_GNU_SOURCE || true |
runtest strptime STRPTIME -D_GNU_SOURCE || true |
|
runtest strsep STRSEP || true |
runtest strsep STRSEP || true |
singletest strtonum STRTONUM || \ |
runtest strtonum STRTONUM "" -D_OPENBSD_SOURCE || true |
runtest strtonum STRTONUM -D_OPENBSD_SOURCE || true |
runtest vasprintf VASPRINTF "" -D_GNU_SOURCE || true |
singletest vasprintf VASPRINTF || \ |
|
runtest vasprintf VASPRINTF -D_GNU_SOURCE || true |
|
|
|
if [ ${HAVE_ENDIAN} -eq 0 -a \ |
# --- fts --- |
${HAVE_SYS_ENDIAN} -eq 0 -a \ |
if [ "${1}" = "-depend" ]; then |
${HAVE_NTOHL} -eq 0 ]; then |
HAVE_FTS=0 |
echo "FATAL: no endian conversion functions found" 1>&2 |
|
echo "FATAL: no endian conversion functions found" 1>&3 |
|
exit 1 |
|
fi |
|
|
|
if ismanual fts FTS ${HAVE_FTS}; then |
|
HAVE_FTS_COMPARE_CONST=0 |
HAVE_FTS_COMPARE_CONST=0 |
|
echo "tested fts: HAVE_FTS=0 (for make depend)" 1>&2 |
|
echo "tested fts: HAVE_FTS=0 (for make depend)" 1>&3 |
|
echo 1>&3 |
|
elif ismanual fts FTS ${HAVE_FTS}; then |
|
HAVE_FTS_COMPARE_CONST=0 |
elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then |
elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then |
HAVE_FTS=1 |
HAVE_FTS=1 |
else |
else |
runtest fts FTS || true |
runtest fts FTS || true |
fi |
fi |
|
|
|
# --- tagging support in the pager --- |
if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then |
if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then |
: |
: |
elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then |
elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then |
|
|
|
|
# --- wide character and locale support --- |
# --- wide character and locale support --- |
if get_locale; then |
if get_locale; then |
singletest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || \ |
runtest wchar WCHAR "-DUTF8_LOCALE=\"${UTF8_LOCALE}\"" \ |
runtest wchar WCHAR -D_GNU_SOURCE \ |
"-D_GNU_SOURCE -DUTF8_LOCALE=\"${UTF8_LOCALE}\"" || true |
-DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true |
|
else |
else |
HAVE_WCHAR=0 |
HAVE_WCHAR=0 |
echo "tested wchar: no (no UTF8_LOCALE)" 1>&2 |
echo "tested wchar: no (no UTF8_LOCALE)" 1>&2 |
|
|
echo 1>&3 |
echo 1>&3 |
fi |
fi |
|
|
# --- nanosleep --- |
# --- ohash --- |
if [ -n "${LD_NANOSLEEP}" ]; then |
if [ "${1}" = "-depend" ]; then |
runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true |
HAVE_OHASH=0 |
elif singletest nanosleep NANOSLEEP; then |
echo "tested ohash: HAVE_OHASH=0 (for make depend)" 1>&2 |
: |
echo "tested ohash: HAVE_OHASH=0 (for make depend)" 1>&3 |
elif runtest nanosleep NANOSLEEP "-lrt"; then |
echo 1>&3 |
LD_NANOSLEEP="-lrt" |
else |
|
runtest ohash OHASH "${LD_OHASH}" "-lutil" || true |
fi |
fi |
|
if [ "${HAVE_OHASH}" -eq 0 ]; then |
|
LD_OHASH= |
|
fi |
|
|
|
# --- required functions --- |
|
if [ ${HAVE_ENDIAN} -eq 0 -a \ |
|
${HAVE_SYS_ENDIAN} -eq 0 -a \ |
|
${HAVE_NTOHL} -eq 0 ]; then |
|
echo "FATAL: no endian conversion functions found" 1>&2 |
|
echo "FATAL: no endian conversion functions found" 1>&3 |
|
FATAL=1 |
|
fi |
if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
echo "FATAL: nanosleep: no" 1>&2 |
echo "FATAL: nanosleep: no" 1>&2 |
echo "FATAL: nanosleep: no" 1>&3 |
echo "FATAL: nanosleep: no" 1>&3 |
exit 1 |
FATAL=1 |
fi |
fi |
|
if [ ${BUILD_CATMAN} -gt 0 -a "${HAVE_RECVMSG}" -eq 0 ]; then |
if [ ${BUILD_CATMAN} -gt 0 ]; then |
echo "FATAL: recvmsg: no" 1>&2 |
# --- recvmsg --- |
echo "FATAL: recvmsg: no" 1>&3 |
if [ -n "${LD_RECVMSG}" ]; then |
echo "Without recvmsg(2), you cannot BUILD_CATMAN." 1>&2 |
runtest recvmsg RECVMSG "${LD_RECVMSG}" || true |
FATAL=1 |
elif singletest recvmsg RECVMSG; then |
|
: |
|
elif runtest recvmsg RECVMSG "-lsocket"; then |
|
LD_RECVMSG="-lsocket" |
|
fi |
|
if [ "${HAVE_RECVMSG}" -eq 0 ]; then |
|
echo "FATAL: recvmsg: no" 1>&2 |
|
echo "FATAL: recvmsg: no" 1>&3 |
|
echo "Without recvmsg(2), you cannot BUILD_CATMAN." 1>&2 |
|
exit 1 |
|
fi |
|
|
|
# --- cmsg --- |
|
if singletest cmsg CMSG; then |
|
: |
|
elif runtest cmsg CMSG "-D_XPG4_2"; then |
|
HAVE_CMSG_XPG42=1 |
|
fi |
|
if [ "${HAVE_CMSG}" -eq 0 ]; then |
|
echo "FATAL: cmsg: no" 1>&2 |
|
echo "FATAL: cmsg: no" 1>&3 |
|
echo "Without CMSG_FIRSTHDR(3), you cannot BUILD_CATMAN." 1>&2 |
|
exit 1 |
|
fi |
|
fi |
fi |
|
if [ ${BUILD_CATMAN} -gt 0 -a "${HAVE_CMSG}" -eq 0 ]; then |
# --- ohash --- |
echo "FATAL: cmsg: no" 1>&2 |
if ismanual ohash OHASH "${HAVE_OHASH}"; then |
echo "FATAL: cmsg: no" 1>&3 |
: |
echo "Without CMSG_FIRSTHDR(3), you cannot BUILD_CATMAN." 1>&2 |
elif [ -n "${LD_OHASH}" ]; then |
FATAL=1 |
runtest ohash OHASH "${LD_OHASH}" || true |
|
elif singletest ohash OHASH; then |
|
: |
|
elif runtest ohash OHASH "-lutil"; then |
|
LD_OHASH="-lutil" |
|
fi |
fi |
if [ "${HAVE_OHASH}" -eq 0 ]; then |
[ "${FATAL}" -eq 0 ] || exit 1 |
LD_OHASH= |
|
fi |
|
|
|
# --- LDADD --- |
# --- LDADD --- |
LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz" |
LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz" |
Line 466 if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 |
|
Line 451 if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 |
|
echo "#define be32toh ntohl" |
echo "#define be32toh ntohl" |
echo "#define htobe32 htonl" |
echo "#define htobe32 htonl" |
fi |
fi |
|
|
cat << __HEREDOC__ |
cat << __HEREDOC__ |
#define HAVE_CMSG_XPG42 ${HAVE_CMSG_XPG42} |
|
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} |
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} |
#define HAVE_ENDIAN ${HAVE_ENDIAN} |
#define HAVE_ENDIAN ${HAVE_ENDIAN} |
#define HAVE_ERR ${HAVE_ERR} |
#define HAVE_ERR ${HAVE_ERR} |
Line 499 cat << __HEREDOC__ |
|
Line 483 cat << __HEREDOC__ |
|
#define HAVE_VASPRINTF ${HAVE_VASPRINTF} |
#define HAVE_VASPRINTF ${HAVE_VASPRINTF} |
#define HAVE_WCHAR ${HAVE_WCHAR} |
#define HAVE_WCHAR ${HAVE_WCHAR} |
#define HAVE_OHASH ${HAVE_OHASH} |
#define HAVE_OHASH ${HAVE_OHASH} |
|
#define NEED_XPG4_2 ${NEED_XPG4_2} |
|
|
#define BINM_APROPOS "${BINM_APROPOS}" |
#define BINM_APROPOS "${BINM_APROPOS}" |
#define BINM_CATMAN "${BINM_CATMAN}" |
#define BINM_CATMAN "${BINM_CATMAN}" |