version 1.51, 2016/08/10 12:50:24 |
version 1.52, 2016/10/18 16:06:44 |
|
|
HAVE_ENDIAN= |
HAVE_ENDIAN= |
HAVE_ERR= |
HAVE_ERR= |
HAVE_FTS= |
HAVE_FTS= |
|
HAVE_FTS_COMPARE_CONST= |
HAVE_GETLINE= |
HAVE_GETLINE= |
HAVE_GETSUBOPT= |
HAVE_GETSUBOPT= |
HAVE_ISBLANK= |
HAVE_ISBLANK= |
Line 129 COMP="${CC} ${CFLAGS} -Wno-unused -Werror" |
|
Line 130 COMP="${CC} ${CFLAGS} -Wno-unused -Werror" |
|
# If yes, use the override, if no, do not decide anything yet. |
# If yes, use the override, if no, do not decide anything yet. |
# Arguments: lower-case test name, manual value |
# Arguments: lower-case test name, manual value |
ismanual() { |
ismanual() { |
[ -z "${2}" ] && return 1 |
[ -z "${3}" ] && return 1 |
echo "${1}: manual (${2})" 1>&2 |
echo "${1}: manual (HAVE_${2}=${3})" 1>&2 |
echo "${1}: manual (${2})" 1>&3 |
echo "${1}: manual (HAVE_${2}=${3})" 1>&3 |
echo 1>&3 |
echo 1>&3 |
return 0 |
return 0 |
} |
} |
|
|
# Arguments: lower-case test name, upper-case test name, additional CFLAGS |
# Arguments: lower-case test name, upper-case test name, additional CFLAGS |
singletest() { |
singletest() { |
cat 1>&3 << __HEREDOC__ |
cat 1>&3 << __HEREDOC__ |
${1}: testing... |
${1}${3}: testing... |
${COMP} ${3} -o test-${1} test-${1}.c |
${COMP} ${3} -o test-${1} test-${1}.c |
__HEREDOC__ |
__HEREDOC__ |
|
|
if ${COMP} ${3} -o "test-${1}" "test-${1}.c" 1>&3 2>&3; then |
if ${COMP} ${3} -o "test-${1}" "test-${1}.c" 1>&3 2>&3; then |
echo "${1}: ${CC} succeeded" 1>&3 |
echo "${1}${3}: ${CC} succeeded" 1>&3 |
else |
else |
echo "${1}: ${CC} failed with $?" 1>&3 |
echo "${1}${3}: ${CC} failed with $?" 1>&3 |
echo 1>&3 |
echo 1>&3 |
return 1 |
return 1 |
fi |
fi |
|
|
if ./test-${1} 1>&3 2>&3; then |
if ./test-${1} 1>&3 2>&3; then |
echo "${1}: yes" 1>&2 |
echo "${1}${3}: yes" 1>&2 |
echo "${1}: yes" 1>&3 |
echo "${1}${3}: yes" 1>&3 |
echo 1>&3 |
echo 1>&3 |
eval HAVE_${2}=1 |
eval HAVE_${2}=1 |
rm "test-${1}" |
rm "test-${1}" |
return 0 |
return 0 |
else |
else |
echo "${1}: execution failed with $?" 1>&3 |
echo "${1}${3}: execution failed with $?" 1>&3 |
echo 1>&3 |
echo 1>&3 |
rm "test-${1}" |
rm "test-${1}" |
return 1 |
return 1 |
|
|
# Arguments: lower case name, upper case name, additional CFLAGS |
# Arguments: lower case name, upper case name, additional CFLAGS |
runtest() { |
runtest() { |
eval _manual=\${HAVE_${2}} |
eval _manual=\${HAVE_${2}} |
ismanual "${1}" "${_manual}" && return 0 |
ismanual "${1}" "${2}" "${_manual}" && return 0 |
singletest "${1}" "${2}" "${3}" && return 0 |
singletest "${1}" "${2}" "${3}" && return 0 |
echo "${1}: no" 1>&2 |
echo "${1}${3}: no" 1>&2 |
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" && return 0 |
ismanual UTF8_LOCALE UTF_LOCALE "$UTF8_LOCALE" && return 0 |
echo "UTF8_LOCALE: testing..." 1>&3 |
echo "UTF8_LOCALE: testing..." 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 204 runtest be32toh ENDIAN || true |
|
Line 205 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 fts FTS || true |
|
runtest getline GETLINE || true |
runtest getline GETLINE || true |
runtest getsubopt GETSUBOPT || true |
runtest getsubopt GETSUBOPT || true |
runtest isblank ISBLANK || true |
runtest isblank ISBLANK || true |
Line 234 if [ ${HAVE_ENDIAN} -eq 0 -a \ |
|
Line 234 if [ ${HAVE_ENDIAN} -eq 0 -a \ |
|
exit 1 |
exit 1 |
fi |
fi |
|
|
|
if ismanual fts FTS ${HAVE_FTS}; then |
|
HAVE_FTS_COMPARE_CONST=0 |
|
elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then |
|
HAVE_FTS=1 |
|
else |
|
runtest fts FTS || true |
|
fi |
|
|
# --- wide character and locale support --- |
# --- wide character and locale support --- |
if get_locale; then |
if get_locale; then |
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true |
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true |
Line 258 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
|
Line 266 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
|
fi |
fi |
|
|
# --- ohash --- |
# --- ohash --- |
if ismanual ohash "${HAVE_OHASH}"; then |
if ismanual ohash OHASH "${HAVE_OHASH}"; then |
: |
: |
elif [ -n "${LD_OHASH}" ]; then |
elif [ -n "${LD_OHASH}" ]; then |
runtest ohash OHASH "${LD_OHASH}" || true |
runtest ohash OHASH "${LD_OHASH}" || true |
Line 320 cat << __HEREDOC__ |
|
Line 328 cat << __HEREDOC__ |
|
#define HAVE_ENDIAN ${HAVE_ENDIAN} |
#define HAVE_ENDIAN ${HAVE_ENDIAN} |
#define HAVE_ERR ${HAVE_ERR} |
#define HAVE_ERR ${HAVE_ERR} |
#define HAVE_FTS ${HAVE_FTS} |
#define HAVE_FTS ${HAVE_FTS} |
|
#define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST} |
#define HAVE_GETLINE ${HAVE_GETLINE} |
#define HAVE_GETLINE ${HAVE_GETLINE} |
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} |
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} |
#define HAVE_ISBLANK ${HAVE_ISBLANK} |
#define HAVE_ISBLANK ${HAVE_ISBLANK} |