aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/configure
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-10-11 21:12:54 +0000
commitf9e640f1c0dc5d4fbffde207f2a4b0350d1a0019 (patch)
treeab150c9d46fcd3c701e8245e2f3d5ccbab0db7be /configure
parentede48977046b65029014a425213d622d938c74c4 (diff)
downloadmandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.gz
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.tar.zst
mandoc-f9e640f1c0dc5d4fbffde207f2a4b0350d1a0019.zip
Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, let's provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. The compat module has an UCB Copyright (c) 1993...
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure13
1 files changed, 13 insertions, 0 deletions
diff --git a/configure b/configure
index 7a3bb306..7bafcdde 100755
--- a/configure
+++ b/configure
@@ -43,12 +43,14 @@ BUILD_DB=1
BUILD_CGI=0
HAVE_DIRENT_NAMLEN=
+HAVE_ERR=
HAVE_FGETLN=
HAVE_FTS=
HAVE_GETSUBOPT=
HAVE_ISBLANK=
HAVE_MKDTEMP=
HAVE_MMAP=
+HAVE_PROGNAME=
HAVE_REALLOCARRAY=
HAVE_STRCASESTR=
HAVE_STRINGLIST=
@@ -171,12 +173,14 @@ runtest() {
# --- library functions ---
runtest dirent-namlen DIRENT_NAMLEN || true
+runtest err ERR || true
runtest fgetln FGETLN || true
runtest fts FTS || true
runtest getsubopt GETSUBOPT || true
runtest isblank ISBLANK || true
runtest mkdtemp MKDTEMP || true
runtest mmap MMAP || true
+runtest progname PROGNAME || true
runtest reallocarray REALLOCARRAY || true
runtest strcasestr STRCASESTR || true
runtest stringlist STRINGLIST || true
@@ -286,16 +290,19 @@ echo
echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
+[ ${HAVE_PROGNAME} -eq 0 ] && echo "#define __progname mandoc_progname"
[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
cat << __HEREDOC__
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
+#define HAVE_ERR ${HAVE_ERR}
#define HAVE_FGETLN ${HAVE_FGETLN}
#define HAVE_FTS ${HAVE_FTS}
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
#define HAVE_ISBLANK ${HAVE_ISBLANK}
#define HAVE_MKDTEMP ${HAVE_MKDTEMP}
#define HAVE_MMAP ${HAVE_MMAP}
+#define HAVE_PROGNAME ${HAVE_PROGNAME}
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
#define HAVE_STRCASESTR ${HAVE_STRCASESTR}
#define HAVE_STRINGLIST ${HAVE_STRINGLIST}
@@ -334,6 +341,12 @@ cat << __HEREDOC__
__HEREDOC__
+if [ ${HAVE_ERR} -eq 0 ]; then
+ echo "extern void err(int, const char *, ...);"
+ echo "extern void warn(const char *, ...);"
+ echo "extern void warnx(const char *, ...);"
+fi
+
[ ${HAVE_FGETLN} -eq 0 ] && \
echo "extern char *fgetln(FILE *, size_t *);"