#!/bin/sh
#
-# Copyright (c) 2014 Ingo Schwarze <schwarze@openbsd.org>
+# Copyright (c) 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# Initialize all variables here,
# such that nothing can leak in from the environment.
-VERSION="1.13.1"
-echo "VERSION=\"${VERSION}\"" 1>&2
-echo "VERSION=\"${VERSION}\"" 1>&3
-
+MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
OSNAME=
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -f -`
HAVE_FGETLN=
HAVE_FTS=
HAVE_GETSUBOPT=
+HAVE_ISBLANK=
+HAVE_MKDTEMP=
HAVE_MMAP=
HAVE_REALLOCARRAY=
HAVE_STRCASESTR=
+HAVE_STRINGLIST=
HAVE_STRLCAT=
HAVE_STRLCPY=
HAVE_STRPTIME=
HAVE_STRSEP=
+HAVE_STRTONUM=
+HAVE_VASPRINTF=
HAVE_WCHAR=
HAVE_SQLITE3=
LIBDIR=
MANDIR=
EXAMPLEDIR=
+HOMEBREWDIR=
WWWPREFIX="/var/www"
HTDOCDIR=
CGIBINDIR=
+BINM_APROPOS="apropos"
+BINM_MAKEWHATIS="makewhatis"
+BINM_MAN="man"
+BINM_SOELIM="soelim"
+BINM_WHATIS="whatis"
+MANM_MAN="man"
+MANM_MANCONF="man.conf"
+MANM_MDOC="mdoc"
+MANM_ROFF="roff"
+MANM_EQN="eqn"
+MANM_TBL="tbl"
+
INSTALL="install"
INSTALL_PROGRAM=
INSTALL_LIB=
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 reallocarray REALLOCARRAY || true
runtest strcasestr STRCASESTR || true
+runtest stringlist STRINGLIST || true
runtest strlcat STRLCAT || true
runtest strlcpy STRLCPY || true
runtest strptime STRPTIME || true
runtest strsep STRSEP || true
+runtest strtonum STRTONUM || true
+runtest vasprintf VASPRINTF || true
runtest wchar WCHAR || true
# --- sqlite3 ---
# --- DBLIB ---
if [ ${BUILD_DB} -eq 0 ]; then
- DBLIB=
+ DBLIB="-lz"
elif [ -z "${DBLIB}" ]; then
- DBLIB="${DETECTLIB}"
+ DBLIB="${DETECTLIB} -lz"
echo "DBLIB=\"${DBLIB}\"" 1>&2
echo "DBLIB=\"${DBLIB}\"" 1>&3
echo 1>&3
fi
# --- manpath ---
-if [ ${BUILD_DB} -eq 0 ]; then
- HAVE_MANPATH=0
-elif ismanual manpath "${HAVE_MANPATH}"; then
+if ismanual manpath "${HAVE_MANPATH}"; then
:
elif manpath 1>&3 2>&3; then
echo "manpath: yes" 1>&2
#define MANDOC_CONFIG_H
#if defined(__linux__) || defined(__MINT__)
-#define _GNU_SOURCE /* getsubopt(), strcasestr(), strptime() */
+#define _GNU_SOURCE /* See test-*.c what needs this. */
#endif
__HEREDOC__
[ ${HAVE_FGETLN} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \
${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \
&& echo "#include <sys/types.h>"
+[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
[ ${HAVE_FGETLN} -eq 0 ] && echo "#include <stdio.h>"
echo
-echo "#define VERSION \"${VERSION}\""
+echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
+echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
+[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
cat << __HEREDOC__
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
#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_REALLOCARRAY ${HAVE_REALLOCARRAY}
#define HAVE_STRCASESTR ${HAVE_STRCASESTR}
+#define HAVE_STRINGLIST ${HAVE_STRINGLIST}
#define HAVE_STRLCAT ${HAVE_STRLCAT}
#define HAVE_STRLCPY ${HAVE_STRLCPY}
#define HAVE_STRPTIME ${HAVE_STRPTIME}
#define HAVE_STRSEP ${HAVE_STRSEP}
+#define HAVE_STRTONUM ${HAVE_STRTONUM}
+#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
#define HAVE_WCHAR ${HAVE_WCHAR}
#define HAVE_SQLITE3 ${HAVE_SQLITE3}
#define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR}
#define HAVE_OHASH ${HAVE_OHASH}
#define HAVE_MANPATH ${HAVE_MANPATH}
+#define BINM_APROPOS "${BINM_APROPOS}"
+#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
+#define BINM_MAN "${BINM_MAN}"
+#define BINM_SOELIM "${BINM_SOELIM}"
+#define BINM_WHATIS "${BINM_WHATIS}"
+
#if !defined(__BEGIN_DECLS)
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
[ ${HAVE_FGETLN} -eq 0 ] && \
echo "extern char *fgetln(FILE *, size_t *);"
-if [ ${HAVE_GETSUBOPT} -eq 0 ]; then
+[ ${HAVE_GETSUBOPT} -eq 0 ] && \
echo "extern int getsubopt(char **, char * const *, char **);"
- echo "extern char *suboptarg;"
-fi
+
+[ ${HAVE_ISBLANK} -eq 0 ] && \
+ echo "extern int isblank(int);"
+
+[ ${HAVE_MKDTEMP} -eq 0 ] && \
+ echo "extern char *mkdtemp(char *);"
[ ${HAVE_REALLOCARRAY} -eq 0 ] && \
echo "extern void *reallocarray(void *, size_t, size_t);"
[ ${HAVE_STRSEP} -eq 0 ] && \
echo "extern char *strsep(char **, const char *);"
+[ ${HAVE_STRTONUM} -eq 0 ] && \
+ echo "extern long long strtonum(const char *, long long, long long, const char **);"
+
+[ ${HAVE_VASPRINTF} -eq 0 ] && \
+ echo "extern int vasprintf(char **, const char *, va_list);"
+
echo
echo "#endif /* MANDOC_CONFIG_H */"
fi
BUILD_TARGETS="base-build"
-[ ${BUILD_DB} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} db-build"
[ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} cgi-build"
+INSTALL_TARGETS="base-install"
+[ ${BUILD_DB} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} db-install"
+[ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
cat << __HEREDOC__
-VERSION = ${VERSION}
BUILD_TARGETS = ${BUILD_TARGETS}
+INSTALL_TARGETS = ${INSTALL_TARGETS}
+CC = ${CC}
CFLAGS = ${CFLAGS}
DBLIB = ${DBLIB}
STATIC = ${STATIC}
WWWPREFIX = ${WWWPREFIX}
HTDOCDIR = ${HTDOCDIR}
CGIBINDIR = ${CGIBINDIR}
+BINM_APROPOS = ${BINM_APROPOS}
+BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
+BINM_MAN = ${BINM_MAN}
+BINM_SOELIM = ${BINM_SOELIM}
+BINM_WHATIS = ${BINM_WHATIS}
+MANM_MAN = ${MANM_MAN}
+MANM_MANCONF = ${MANM_MANCONF}
+MANM_MDOC = ${MANM_MDOC}
+MANM_ROFF = ${MANM_ROFF}
+MANM_EQN = ${MANM_EQN}
+MANM_TBL = ${MANM_TBL}
INSTALL = ${INSTALL}
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
INSTALL_LIB = ${INSTALL_LIB}
__HEREDOC__
[ ${BUILD_DB} -gt 0 ] && \
- echo "MAN_OBJS = \$(MANDOC_OBJS) \$(APROPOS_OBJS)"
+ echo "MAIN_OBJS = \$(BASE_OBJS) \$(DB_OBJS)"
echo "Makefile.local: written" 1>&2
echo "Makefile.local: written" 1>&3