aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/configure
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2016-10-18 16:06:44 +0000
committerIngo Schwarze <schwarze@openbsd.org>2016-10-18 16:06:44 +0000
commite44ba034e73fa73b2e888b52b83419c54fec27f9 (patch)
tree6cab219214157ea95de7b9076373c5274db1ea82 /configure
parentb2605db9a7a1fdd7d3289acf2afd01ccb7e8668a (diff)
downloadmandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.tar.gz
mandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.tar.zst
mandoc-e44ba034e73fa73b2e888b52b83419c54fec27f9.zip
Compat glue for the FreeBSD comparison function prototype for fts_open(3)
which differs from what most other systems use. While here, improve diagnostic output of ./configure tests.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure39
1 files changed, 24 insertions, 15 deletions
diff --git a/configure b/configure
index 9d43a192..4b8b06cd 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $Id: configure,v 1.51 2016/08/10 12:50:24 schwarze Exp $
+# $Id: configure,v 1.52 2016/10/18 16:06:44 schwarze Exp $
#
# Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org>
#
@@ -53,6 +53,7 @@ HAVE_EFTYPE=
HAVE_ENDIAN=
HAVE_ERR=
HAVE_FTS=
+HAVE_FTS_COMPARE_CONST=
HAVE_GETLINE=
HAVE_GETSUBOPT=
HAVE_ISBLANK=
@@ -129,9 +130,9 @@ COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
# If yes, use the override, if no, do not decide anything yet.
# Arguments: lower-case test name, manual value
ismanual() {
- [ -z "${2}" ] && return 1
- echo "${1}: manual (${2})" 1>&2
- echo "${1}: manual (${2})" 1>&3
+ [ -z "${3}" ] && return 1
+ echo "${1}: manual (HAVE_${2}=${3})" 1>&2
+ echo "${1}: manual (HAVE_${2}=${3})" 1>&3
echo 1>&3
return 0
}
@@ -142,27 +143,27 @@ ismanual() {
# Arguments: lower-case test name, upper-case test name, additional CFLAGS
singletest() {
cat 1>&3 << __HEREDOC__
-${1}: testing...
+${1}${3}: testing...
${COMP} ${3} -o test-${1} test-${1}.c
__HEREDOC__
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
- echo "${1}: ${CC} failed with $?" 1>&3
+ echo "${1}${3}: ${CC} failed with $?" 1>&3
echo 1>&3
return 1
fi
if ./test-${1} 1>&3 2>&3; then
- echo "${1}: yes" 1>&2
- echo "${1}: yes" 1>&3
+ echo "${1}${3}: yes" 1>&2
+ echo "${1}${3}: yes" 1>&3
echo 1>&3
eval HAVE_${2}=1
rm "test-${1}"
return 0
else
- echo "${1}: execution failed with $?" 1>&3
+ echo "${1}${3}: execution failed with $?" 1>&3
echo 1>&3
rm "test-${1}"
return 1
@@ -174,9 +175,9 @@ __HEREDOC__
# Arguments: lower case name, upper case name, additional CFLAGS
runtest() {
eval _manual=\${HAVE_${2}}
- ismanual "${1}" "${_manual}" && return 0
+ ismanual "${1}" "${2}" "${_manual}" && return 0
singletest "${1}" "${2}" "${3}" && return 0
- echo "${1}: no" 1>&2
+ echo "${1}${3}: no" 1>&2
eval HAVE_${2}=0
return 1
}
@@ -184,7 +185,7 @@ runtest() {
# Select a UTF-8 locale.
get_locale() {
[ -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
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1`
if [ -z "${UTF8_LOCALE}" ]; then
@@ -204,7 +205,6 @@ runtest be32toh ENDIAN || true
runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true
runtest EFTYPE EFTYPE || true
runtest err ERR || true
-runtest fts FTS || true
runtest getline GETLINE || true
runtest getsubopt GETSUBOPT || true
runtest isblank ISBLANK || true
@@ -234,6 +234,14 @@ if [ ${HAVE_ENDIAN} -eq 0 -a \
exit 1
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 ---
if get_locale; then
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true
@@ -258,7 +266,7 @@ if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
fi
# --- ohash ---
-if ismanual ohash "${HAVE_OHASH}"; then
+if ismanual ohash OHASH "${HAVE_OHASH}"; then
:
elif [ -n "${LD_OHASH}" ]; then
runtest ohash OHASH "${LD_OHASH}" || true
@@ -320,6 +328,7 @@ cat << __HEREDOC__
#define HAVE_ENDIAN ${HAVE_ENDIAN}
#define HAVE_ERR ${HAVE_ERR}
#define HAVE_FTS ${HAVE_FTS}
+#define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST}
#define HAVE_GETLINE ${HAVE_GETLINE}
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
#define HAVE_ISBLANK ${HAVE_ISBLANK}