#!/bin/sh
#
-# $Id: configure,v 1.74 2020/06/14 23:40:31 schwarze Exp $
+# $Id: configure,v 1.77 2020/07/20 16:57:30 schwarze Exp $
#
# Copyright (c) 2014-2020 Ingo Schwarze <schwarze@openbsd.org>
#
BUILD_CATMAN=0
INSTALL_LIBMANDOC=0
+HAVE_ATTRIBUTE=
HAVE_CMSG=
HAVE_DIRENT_NAMLEN=
HAVE_EFTYPE=
NEED_OPENBSD_SOURCE=0
NEED_XPG4_2=0
+MANDOC_COBJS=
+SOELIM_COBJS=
+
PREFIX="/usr/local"
BINDIR=
SBINDIR=
BINM_MAN="man"
BINM_SOELIM="soelim"
BINM_WHATIS="whatis"
+BINM_PAGER=
MANM_MAN="man"
MANM_MANCONF="man.conf"
MANM_MDOC="mdoc"
# --- tests for config.h ----------------------------------------------
# --- library functions ---
+runtest attribute ATTRIBUTE || true
runtest cmsg CMSG "" "-D_XPG4_2" || true
runtest dirent-namlen DIRENT_NAMLEN || true
runtest be32toh ENDIAN || true
runtest fts FTS || true
fi
+# --- pager ---
+manual=
+if [ -n "${BINM_PAGER}" ]; then
+ manual=" (manual)"
+elif less test-noop.c 1>/dev/null 2>&3; then
+ BINM_PAGER=less
+ echo "tested less: yes" 1>&2
+ echo "tested less: yes" 1>&3
+else
+ BINM_PAGER=more
+ echo "tested less: no" 1>&2
+ echo "tested less: no" 1>&3
+fi
+echo "selected BINM_PAGER=${BINM_PAGER}${manual}" 1>&2
+echo "selected BINM_PAGER=${BINM_PAGER}${manual}" 1>&3
+
# --- tagging support in the pager ---
-if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then
+if ismanual "${BINM_PAGER} -T" LESS_T ${HAVE_LESS_T}; then
:
-elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then
+elif ${BINM_PAGER} -T /dev/null test-noop.c 1>/dev/null 2>&3; then
HAVE_LESS_T=1
- echo "tested less -T: yes" 1>&2
- echo "tested less -T: yes" 1>&3
+ echo "tested ${BINM_PAGER} -T: yes" 1>&2
+ echo "tested ${BINM_PAGER} -T: yes" 1>&3
echo 1>&3
else
HAVE_LESS_T=0
- echo "tested less -T: no" 1>&2
- echo "tested less -T: no" 1>&3
+ echo "tested ${BINM_PAGER} -T: no" 1>&2
+ echo "tested ${BINM_PAGER} -T: no" 1>&3
echo 1>&3
fi
#error "Do not use C++. See the INSTALL file."
#endif
-#if !defined(__GNUC__) || (__GNUC__ < 4)
-#define __attribute__(x)
-#endif
-
__HEREDOC__
[ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
[ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
+[ ${HAVE_ATTRIBUTE} -eq 0 ] && echo "#define __attribute__(x)"
[ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
[ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
[ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"
#define BINM_MAN "${BINM_MAN}"
#define BINM_SOELIM "${BINM_SOELIM}"
#define BINM_WHATIS "${BINM_WHATIS}"
+#define BINM_PAGER "${BINM_PAGER}"
__HEREDOC__
echo "extern void errx(int, const char *, ...);"
echo "extern void warn(const char *, ...);"
echo "extern void warnx(const char *, ...);"
+ MANDOC_COBJS="${MANDOC_COBJS} compat_err.o"
+ SOELIM_COBJS="${SOELIM_COBJS} compat_err.o"
fi
-
-[ ${HAVE_GETLINE} -eq 0 ] && \
+if [ ${HAVE_FTS} -eq 0 ]; then
+ MANDOC_COBJS="${MANDOC_COBJS} compat_fts.o"
+fi
+if [ ${HAVE_GETLINE} -eq 0 ]; then
echo "extern ssize_t getline(char **, size_t *, FILE *);"
-
-[ ${HAVE_GETSUBOPT} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_getline.o"
+ SOELIM_COBJS="${SOELIM_COBJS} compat_getline.o"
+fi
+if [ ${HAVE_GETSUBOPT} -eq 0 ]; then
echo "extern int getsubopt(char **, char * const *, char **);"
-
-[ ${HAVE_ISBLANK} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_getsubopt.o"
+fi
+if [ ${HAVE_ISBLANK} -eq 0 ]; then
echo "extern int isblank(int);"
-
-[ ${HAVE_MKDTEMP} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_isblank.o"
+fi
+if [ ${HAVE_MKDTEMP} -eq 0 ]; then
echo "extern char *mkdtemp(char *);"
-
+ MANDOC_COBJS="${MANDOC_COBJS} compat_mkdtemp.o"
+fi
+if [ ${HAVE_OHASH} -eq 0 ]; then
+ MANDOC_COBJS="${MANDOC_COBJS} compat_ohash.o"
+fi
if [ ${HAVE_PROGNAME} -eq 0 ]; then
echo "extern const char *getprogname(void);"
echo "extern void setprogname(const char *);"
+ MANDOC_COBJS="${MANDOC_COBJS} compat_progname.o"
+ SOELIM_COBJS="${SOELIM_COBJS} compat_progname.o"
fi
-
-[ ${HAVE_REALLOCARRAY} -eq 0 ] && \
+if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
echo "extern void *reallocarray(void *, size_t, size_t);"
-
-[ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_reallocarray.o"
+ SOELIM_COBJS="${SOELIM_COBJS} compat_reallocarray.o"
+fi
+if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
echo "extern void *recallocarray(void *, size_t, size_t, size_t);"
-
-[ ${HAVE_STRCASESTR} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_recallocarray.o"
+fi
+if [ ${HAVE_STRCASESTR} -eq 0 ]; then
echo "extern char *strcasestr(const char *, const char *);"
-
-[ ${HAVE_STRLCAT} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strcasestr.o"
+fi
+if [ ${HAVE_STRINGLIST} -eq 0 ]; then
+ SOELIM_COBJS="${SOELIM_COBJS} compat_stringlist.o"
+fi
+if [ ${HAVE_STRLCAT} -eq 0 ]; then
echo "extern size_t strlcat(char *, const char *, size_t);"
-
-[ ${HAVE_STRLCPY} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strlcat.o"
+fi
+if [ ${HAVE_STRLCPY} -eq 0 ]; then
echo "extern size_t strlcpy(char *, const char *, size_t);"
-
-[ ${HAVE_STRNDUP} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strlcpy.o"
+fi
+if [ ${HAVE_STRNDUP} -eq 0 ]; then
echo "extern char *strndup(const char *, size_t);"
-
-[ ${HAVE_STRSEP} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strndup.o"
+fi
+if [ ${HAVE_STRSEP} -eq 0 ]; then
echo "extern char *strsep(char **, const char *);"
-
-[ ${HAVE_STRTONUM} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strsep.o"
+fi
+if [ ${HAVE_STRTONUM} -eq 0 ]; then
echo "extern long long strtonum(const char *, long long, long long, const char **);"
-
-[ ${HAVE_VASPRINTF} -eq 0 ] && \
+ MANDOC_COBJS="${MANDOC_COBJS} compat_strtonum.o"
+fi
+if [ ${HAVE_VASPRINTF} -eq 0 ]; then
echo "extern int vasprintf(char **, const char *, va_list);"
-
+ MANDOC_COBJS="${MANDOC_COBJS} compat_vasprintf.o"
+fi
echo "file config.h: written" 1>&2
echo "file config.h: written" 1>&3
CFLAGS = ${CFLAGS}
LDADD = ${LDADD}
LDFLAGS = ${LDFLAGS}
+MANDOC_COBJS = ${MANDOC_COBJS}
+SOELIM_COBJS = ${SOELIM_COBJS}
STATIC = ${STATIC}
PREFIX = ${PREFIX}
BINDIR = ${BINDIR}