2014-11-22 18:08:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2017-06-08 19:29:07 +00:00
|
|
|
# $Id: configure,v 1.62 2017/03/04 16:36:29 schwarze Exp $
|
2017-01-21 13:01:39 +00:00
|
|
|
#
|
2017-02-19 17:41:20 +00:00
|
|
|
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org>
|
2014-11-22 18:08:25 +00:00
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
[ -w config.log ] && mv config.log config.log.old
|
|
|
|
[ -w config.h ] && mv config.h config.h.old
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
# Output file descriptor usage:
|
|
|
|
# 1 (stdout): config.h, Makefile.local
|
|
|
|
# 2 (stderr): original stderr, usually to the console
|
|
|
|
# 3: config.log
|
|
|
|
|
|
|
|
exec 3> config.log
|
|
|
|
echo "config.log: writing..."
|
|
|
|
|
|
|
|
# --- default settings -------------------------------------------------
|
|
|
|
# Initialize all variables here,
|
|
|
|
# such that nothing can leak in from the environment.
|
|
|
|
|
2017-02-19 17:41:20 +00:00
|
|
|
SOURCEDIR=`dirname "$0"`
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
|
2014-12-02 07:34:06 +00:00
|
|
|
OSNAME=
|
2017-01-21 13:01:39 +00:00
|
|
|
UTF8_LOCALE=
|
2014-12-02 07:34:06 +00:00
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
|
|
|
|
CFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings"
|
|
|
|
CFLAGS="${CFLAGS} -Wno-unused-parameter"
|
2016-07-23 11:45:42 +00:00
|
|
|
LDADD=
|
|
|
|
LDFLAGS=
|
2017-01-21 13:01:39 +00:00
|
|
|
LD_NANOSLEEP=
|
2016-07-23 11:45:42 +00:00
|
|
|
LD_OHASH=
|
2017-02-19 17:41:20 +00:00
|
|
|
LD_RECVMSG=
|
2014-12-02 07:34:06 +00:00
|
|
|
STATIC="-static"
|
|
|
|
|
|
|
|
BUILD_CGI=0
|
2017-02-19 17:41:20 +00:00
|
|
|
BUILD_CATMAN=0
|
2017-01-21 13:01:39 +00:00
|
|
|
INSTALL_LIBMANDOC=0
|
2014-12-02 07:34:06 +00:00
|
|
|
|
2017-02-19 17:41:20 +00:00
|
|
|
HAVE_CMSG=
|
|
|
|
HAVE_CMSG_XPG42=0
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_DIRENT_NAMLEN=
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_EFTYPE=
|
|
|
|
HAVE_ENDIAN=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_ERR=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_FTS=
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_FTS_COMPARE_CONST=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_GETLINE=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_GETSUBOPT=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_ISBLANK=
|
|
|
|
HAVE_MKDTEMP=
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_NANOSLEEP=
|
|
|
|
HAVE_NTOHL=
|
2017-02-19 17:41:20 +00:00
|
|
|
HAVE_O_DIRECTORY=
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_OHASH=
|
|
|
|
HAVE_PATH_MAX=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_PLEDGE=
|
|
|
|
HAVE_PROGNAME=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_REALLOCARRAY=
|
2017-02-19 17:41:20 +00:00
|
|
|
HAVE_RECVMSG=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_REWB_BSD=
|
|
|
|
HAVE_REWB_SYSV=
|
2016-07-23 11:45:42 +00:00
|
|
|
HAVE_SANDBOX_INIT=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_STRCASESTR=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_STRINGLIST=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_STRLCAT=
|
|
|
|
HAVE_STRLCPY=
|
|
|
|
HAVE_STRPTIME=
|
|
|
|
HAVE_STRSEP=
|
2015-03-02 16:45:41 +00:00
|
|
|
HAVE_STRTONUM=
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_SYS_ENDIAN=
|
2016-01-15 23:08:59 +00:00
|
|
|
HAVE_VASPRINTF=
|
2014-12-02 07:34:06 +00:00
|
|
|
HAVE_WCHAR=
|
|
|
|
|
|
|
|
PREFIX="/usr/local"
|
|
|
|
BINDIR=
|
|
|
|
SBINDIR=
|
2017-06-08 19:29:07 +00:00
|
|
|
BIN_FROM_SBIN=
|
2014-12-02 07:34:06 +00:00
|
|
|
INCLUDEDIR=
|
|
|
|
LIBDIR=
|
|
|
|
MANDIR=
|
2015-03-02 16:45:41 +00:00
|
|
|
HOMEBREWDIR=
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
WWWPREFIX="/var/www"
|
|
|
|
HTDOCDIR=
|
|
|
|
CGIBINDIR=
|
|
|
|
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_APROPOS="apropos"
|
2017-02-19 17:41:20 +00:00
|
|
|
BINM_CATMAN="catman"
|
2016-01-15 23:08:59 +00:00
|
|
|
BINM_MAKEWHATIS="makewhatis"
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_MAN="man"
|
2016-01-15 23:08:59 +00:00
|
|
|
BINM_SOELIM="soelim"
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_WHATIS="whatis"
|
|
|
|
MANM_MAN="man"
|
2016-01-15 23:08:59 +00:00
|
|
|
MANM_MANCONF="man.conf"
|
2014-12-25 21:33:25 +00:00
|
|
|
MANM_MDOC="mdoc"
|
|
|
|
MANM_ROFF="roff"
|
|
|
|
MANM_EQN="eqn"
|
|
|
|
MANM_TBL="tbl"
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
INSTALL="install"
|
|
|
|
INSTALL_PROGRAM=
|
|
|
|
INSTALL_LIB=
|
|
|
|
INSTALL_MAN=
|
|
|
|
INSTALL_DATA=
|
2017-02-19 17:41:20 +00:00
|
|
|
LN="ln -f"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
# --- manual settings from configure.local -----------------------------
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
if [ -r ./configure.local ]; then
|
2014-12-02 07:34:06 +00:00
|
|
|
echo "configure.local: reading..." 1>&2
|
|
|
|
echo "configure.local: reading..." 1>&3
|
|
|
|
cat ./configure.local 1>&3
|
|
|
|
. ./configure.local
|
|
|
|
else
|
|
|
|
echo "configure.local: no (fully automatic configuration)" 1>&2
|
|
|
|
echo "configure.local: no (fully automatic configuration)" 1>&3
|
|
|
|
fi
|
|
|
|
echo 1>&3
|
2014-11-22 18:08:25 +00:00
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
# --- tests for config.h ----------------------------------------------
|
|
|
|
|
|
|
|
COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
|
|
|
|
|
|
|
|
# Check whether this HAVE_ setting is manually overridden.
|
|
|
|
# If yes, use the override, if no, do not decide anything yet.
|
|
|
|
# Arguments: lower-case test name, manual value
|
|
|
|
ismanual() {
|
2017-01-21 13:01:39 +00:00
|
|
|
[ -z "${3}" ] && return 1
|
|
|
|
echo "${1}: manual (HAVE_${2}=${3})" 1>&2
|
|
|
|
echo "${1}: manual (HAVE_${2}=${3})" 1>&3
|
2014-12-02 07:34:06 +00:00
|
|
|
echo 1>&3
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run a single autoconfiguration test.
|
|
|
|
# In case of success, enable the feature.
|
|
|
|
# In case of failure, do not decide anything yet.
|
|
|
|
# Arguments: lower-case test name, upper-case test name, additional CFLAGS
|
|
|
|
singletest() {
|
|
|
|
cat 1>&3 << __HEREDOC__
|
2017-01-21 13:01:39 +00:00
|
|
|
${1}${3}: testing...
|
|
|
|
${COMP} -o test-${1} test-${1}.c ${3}
|
2014-12-02 07:34:06 +00:00
|
|
|
__HEREDOC__
|
|
|
|
|
2017-02-19 17:41:20 +00:00
|
|
|
if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} 1>&3 2>&3
|
|
|
|
then
|
2017-01-21 13:01:39 +00:00
|
|
|
echo "${1}${3}: ${CC} succeeded" 1>&3
|
2014-12-02 07:34:06 +00:00
|
|
|
else
|
2017-01-21 13:01:39 +00:00
|
|
|
echo "${1}${3}: ${CC} failed with $?" 1>&3
|
2014-12-02 07:34:06 +00:00
|
|
|
echo 1>&3
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ./test-${1} 1>&3 2>&3; then
|
2017-01-21 13:01:39 +00:00
|
|
|
echo "${1}${3}: yes" 1>&2
|
|
|
|
echo "${1}${3}: yes" 1>&3
|
2014-12-02 07:34:06 +00:00
|
|
|
echo 1>&3
|
|
|
|
eval HAVE_${2}=1
|
|
|
|
rm "test-${1}"
|
|
|
|
return 0
|
|
|
|
else
|
2017-01-21 13:01:39 +00:00
|
|
|
echo "${1}${3}: execution failed with $?" 1>&3
|
2014-12-02 07:34:06 +00:00
|
|
|
echo 1>&3
|
|
|
|
rm "test-${1}"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Run a complete autoconfiguration test, including the check for
|
|
|
|
# a manual override and disabling the feature on failure.
|
|
|
|
# Arguments: lower case name, upper case name, additional CFLAGS
|
2014-11-22 18:08:25 +00:00
|
|
|
runtest() {
|
2014-12-02 07:34:06 +00:00
|
|
|
eval _manual=\${HAVE_${2}}
|
2017-01-21 13:01:39 +00:00
|
|
|
ismanual "${1}" "${2}" "${_manual}" && return 0
|
2014-12-02 07:34:06 +00:00
|
|
|
singletest "${1}" "${2}" "${3}" && return 0
|
2017-01-21 13:01:39 +00:00
|
|
|
echo "${1}${3}: no" 1>&2
|
2014-12-02 07:34:06 +00:00
|
|
|
eval HAVE_${2}=0
|
|
|
|
return 1
|
2014-11-22 18:08:25 +00:00
|
|
|
}
|
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
# Select a UTF-8 locale.
|
|
|
|
get_locale() {
|
|
|
|
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0
|
|
|
|
ismanual UTF8_LOCALE UTF8_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
|
|
|
|
UTF8_LOCALE=`locale -a | grep -i '\.UTF-*8' | head -n 1`
|
|
|
|
[ -n "${UTF8_LOCALE}" ] || return 1
|
|
|
|
fi
|
|
|
|
echo "UTF8_LOCALE=${UTF8_LOCALE}" 1>&2
|
|
|
|
echo "UTF8_LOCALE=${UTF8_LOCALE}" 1>&3
|
|
|
|
echo 1>&3
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
# --- library functions ---
|
|
|
|
runtest dirent-namlen DIRENT_NAMLEN || true
|
2017-01-21 13:01:39 +00:00
|
|
|
runtest be32toh ENDIAN || true
|
|
|
|
runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true
|
|
|
|
runtest EFTYPE EFTYPE || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest err ERR || true
|
|
|
|
runtest getline GETLINE || true
|
2014-12-02 07:34:06 +00:00
|
|
|
runtest getsubopt GETSUBOPT || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest isblank ISBLANK || true
|
|
|
|
runtest mkdtemp MKDTEMP || true
|
2017-01-21 13:01:39 +00:00
|
|
|
runtest ntohl NTOHL || true
|
2017-02-19 17:41:20 +00:00
|
|
|
runtest O_DIRECTORY O_DIRECTORY || true
|
2017-01-21 13:01:39 +00:00
|
|
|
runtest PATH_MAX PATH_MAX || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest pledge PLEDGE || true
|
2016-07-23 11:45:42 +00:00
|
|
|
runtest sandbox_init SANDBOX_INIT || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest progname PROGNAME || true
|
2014-12-02 07:34:06 +00:00
|
|
|
runtest reallocarray REALLOCARRAY || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest rewb-bsd REWB_BSD || true
|
|
|
|
runtest rewb-sysv REWB_SYSV || true
|
2014-12-02 07:34:06 +00:00
|
|
|
runtest strcasestr STRCASESTR || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest stringlist STRINGLIST || true
|
2014-12-02 07:34:06 +00:00
|
|
|
runtest strlcat STRLCAT || true
|
|
|
|
runtest strlcpy STRLCPY || true
|
|
|
|
runtest strptime STRPTIME || true
|
|
|
|
runtest strsep STRSEP || true
|
2015-03-02 16:45:41 +00:00
|
|
|
runtest strtonum STRTONUM || true
|
2016-01-15 23:08:59 +00:00
|
|
|
runtest vasprintf VASPRINTF || true
|
2014-12-02 07:34:06 +00:00
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
if [ ${HAVE_ENDIAN} -eq 0 -a \
|
|
|
|
${HAVE_SYS_ENDIAN} -eq 0 -a \
|
|
|
|
${HAVE_NTOHL} -eq 0 ]; then
|
|
|
|
echo "FATAL: no endian conversion functions found" 1>&2
|
|
|
|
echo "FATAL: no endian conversion functions found" 1>&3
|
|
|
|
exit 1
|
2014-12-02 07:34:06 +00:00
|
|
|
fi
|
2017-01-21 13:01:39 +00:00
|
|
|
|
|
|
|
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
|
2014-12-02 07:34:06 +00:00
|
|
|
fi
|
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
# --- wide character and locale support ---
|
|
|
|
if get_locale; then
|
|
|
|
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true
|
2014-12-02 07:34:06 +00:00
|
|
|
else
|
2017-01-21 13:01:39 +00:00
|
|
|
HAVE_WCHAR=0
|
|
|
|
echo "wchar: no (no UTF8_LOCALE)" 1>&2
|
|
|
|
echo "wchar: no (no UTF8_LOCALE)" 1>&3
|
|
|
|
fi
|
|
|
|
|
|
|
|
# --- nanosleep ---
|
|
|
|
if [ -n "${LD_NANOSLEEP}" ]; then
|
|
|
|
runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true
|
|
|
|
elif singletest nanosleep NANOSLEEP; then
|
|
|
|
:
|
|
|
|
elif runtest nanosleep NANOSLEEP "-lrt"; then
|
|
|
|
LD_NANOSLEEP="-lrt"
|
|
|
|
fi
|
|
|
|
if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
|
|
|
|
echo "FATAL: nanosleep: no" 1>&2
|
|
|
|
echo "FATAL: nanosleep: no" 1>&3
|
|
|
|
exit 1
|
2014-12-02 07:34:06 +00:00
|
|
|
fi
|
|
|
|
|
2017-02-19 17:41:20 +00:00
|
|
|
if [ ${BUILD_CATMAN} -gt 0 ]; then
|
|
|
|
# --- recvmsg ---
|
|
|
|
if [ -n "${LD_RECVMSG}" ]; then
|
|
|
|
runtest recvmsg RECVMSG "${LD_RECVMSG}" || true
|
|
|
|
elif singletest recvmsg RECVMSG; then
|
|
|
|
:
|
|
|
|
elif runtest recvmsg RECVMSG "-lsocket"; then
|
|
|
|
LD_RECVMSG="-lsocket"
|
|
|
|
fi
|
|
|
|
if [ "${HAVE_RECVMSG}" -eq 0 ]; then
|
|
|
|
echo "FATAL: recvmsg: no" 1>&2
|
|
|
|
echo "FATAL: recvmsg: no" 1>&3
|
|
|
|
echo "Without recvmsg(2), you cannot BUILD_CATMAN." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# --- cmsg ---
|
|
|
|
if singletest cmsg CMSG; then
|
|
|
|
:
|
|
|
|
elif runtest cmsg CMSG "-D_XPG4_2"; then
|
|
|
|
HAVE_CMSG_XPG42=1
|
|
|
|
fi
|
|
|
|
if [ "${HAVE_CMSG}" -eq 0 ]; then
|
|
|
|
echo "FATAL: cmsg: no" 1>&2
|
|
|
|
echo "FATAL: cmsg: no" 1>&3
|
|
|
|
echo "Without CMSG_FIRSTHDR(3), you cannot BUILD_CATMAN." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
# --- ohash ---
|
2017-01-21 13:01:39 +00:00
|
|
|
if ismanual ohash OHASH "${HAVE_OHASH}"; then
|
2014-12-02 07:34:06 +00:00
|
|
|
:
|
2016-07-23 11:45:42 +00:00
|
|
|
elif [ -n "${LD_OHASH}" ]; then
|
|
|
|
runtest ohash OHASH "${LD_OHASH}" || true
|
2014-12-02 07:34:06 +00:00
|
|
|
elif singletest ohash OHASH; then
|
|
|
|
:
|
|
|
|
elif runtest ohash OHASH "-lutil"; then
|
2016-07-23 11:45:42 +00:00
|
|
|
LD_OHASH="-lutil"
|
2014-12-02 07:34:06 +00:00
|
|
|
fi
|
2016-07-23 11:45:42 +00:00
|
|
|
if [ "${HAVE_OHASH}" -eq 0 ]; then
|
|
|
|
LD_OHASH=
|
2014-12-02 07:34:06 +00:00
|
|
|
fi
|
|
|
|
|
2016-07-23 11:45:42 +00:00
|
|
|
# --- LDADD ---
|
2017-02-19 17:41:20 +00:00
|
|
|
LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
|
2016-07-23 11:45:42 +00:00
|
|
|
echo "LDADD=\"${LDADD}\"" 1>&2
|
|
|
|
echo "LDADD=\"${LDADD}\"" 1>&3
|
|
|
|
echo 1>&3
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
# --- write config.h ---
|
|
|
|
|
|
|
|
exec > config.h
|
|
|
|
|
|
|
|
cat << __HEREDOC__
|
2016-01-15 23:08:59 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
#error "Do not use C++. See the INSTALL file."
|
|
|
|
#endif
|
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
#if !defined(__GNUC__) || (__GNUC__ < 4)
|
|
|
|
#define __attribute__(x)
|
|
|
|
#endif
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
#if defined(__linux__) || defined(__MINT__)
|
|
|
|
#define _GNU_SOURCE /* See test-*.c what needs this. */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
__HEREDOC__
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
[ ${HAVE_GETLINE} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \
|
2014-12-02 07:34:06 +00:00
|
|
|
${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \
|
|
|
|
&& echo "#include <sys/types.h>"
|
2016-01-15 23:08:59 +00:00
|
|
|
[ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
|
|
|
|
[ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
2014-11-22 18:08:25 +00:00
|
|
|
echo
|
2016-01-15 23:08:59 +00:00
|
|
|
echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
|
|
|
|
echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
|
2014-12-02 07:34:06 +00:00
|
|
|
[ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
|
2017-01-21 13:01:39 +00:00
|
|
|
[ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
|
2015-03-02 16:45:41 +00:00
|
|
|
[ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
|
2017-01-21 13:01:39 +00:00
|
|
|
[ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
|
2017-02-19 17:41:20 +00:00
|
|
|
[ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
|
2017-01-21 13:01:39 +00:00
|
|
|
[ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"
|
|
|
|
if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then
|
|
|
|
echo "#define be32toh ntohl"
|
|
|
|
echo "#define htobe32 htonl"
|
|
|
|
fi
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
cat << __HEREDOC__
|
2017-02-19 17:41:20 +00:00
|
|
|
#define HAVE_CMSG_XPG42 ${HAVE_CMSG_XPG42}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
|
2017-01-21 13:01:39 +00:00
|
|
|
#define HAVE_ENDIAN ${HAVE_ENDIAN}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_ERR ${HAVE_ERR}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_FTS ${HAVE_FTS}
|
2017-01-21 13:01:39 +00:00
|
|
|
#define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_GETLINE ${HAVE_GETLINE}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_ISBLANK ${HAVE_ISBLANK}
|
|
|
|
#define HAVE_MKDTEMP ${HAVE_MKDTEMP}
|
2017-01-21 13:01:39 +00:00
|
|
|
#define HAVE_NTOHL ${HAVE_NTOHL}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_PLEDGE ${HAVE_PLEDGE}
|
|
|
|
#define HAVE_PROGNAME ${HAVE_PROGNAME}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_REWB_BSD ${HAVE_REWB_BSD}
|
|
|
|
#define HAVE_REWB_SYSV ${HAVE_REWB_SYSV}
|
2016-07-23 11:45:42 +00:00
|
|
|
#define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_STRCASESTR ${HAVE_STRCASESTR}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_STRINGLIST ${HAVE_STRINGLIST}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_STRLCAT ${HAVE_STRLCAT}
|
|
|
|
#define HAVE_STRLCPY ${HAVE_STRLCPY}
|
|
|
|
#define HAVE_STRPTIME ${HAVE_STRPTIME}
|
|
|
|
#define HAVE_STRSEP ${HAVE_STRSEP}
|
2015-03-02 16:45:41 +00:00
|
|
|
#define HAVE_STRTONUM ${HAVE_STRTONUM}
|
2017-01-21 13:01:39 +00:00
|
|
|
#define HAVE_SYS_ENDIAN ${HAVE_SYS_ENDIAN}
|
2016-01-15 23:08:59 +00:00
|
|
|
#define HAVE_VASPRINTF ${HAVE_VASPRINTF}
|
2014-12-02 07:34:06 +00:00
|
|
|
#define HAVE_WCHAR ${HAVE_WCHAR}
|
|
|
|
#define HAVE_OHASH ${HAVE_OHASH}
|
|
|
|
|
2014-12-25 21:33:25 +00:00
|
|
|
#define BINM_APROPOS "${BINM_APROPOS}"
|
2017-02-19 17:41:20 +00:00
|
|
|
#define BINM_CATMAN "${BINM_CATMAN}"
|
2016-01-15 23:08:59 +00:00
|
|
|
#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
|
2014-12-25 21:33:25 +00:00
|
|
|
#define BINM_MAN "${BINM_MAN}"
|
2016-01-15 23:08:59 +00:00
|
|
|
#define BINM_SOELIM "${BINM_SOELIM}"
|
2014-12-25 21:33:25 +00:00
|
|
|
#define BINM_WHATIS "${BINM_WHATIS}"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
__HEREDOC__
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
if [ ${HAVE_ERR} -eq 0 ]; then
|
|
|
|
echo "extern void err(int, const char *, ...);"
|
|
|
|
echo "extern void errx(int, const char *, ...);"
|
|
|
|
echo "extern void warn(const char *, ...);"
|
|
|
|
echo "extern void warnx(const char *, ...);"
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ ${HAVE_GETLINE} -eq 0 ] && \
|
|
|
|
echo "extern ssize_t getline(char **, size_t *, FILE *);"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
[ ${HAVE_GETSUBOPT} -eq 0 ] && \
|
|
|
|
echo "extern int getsubopt(char **, char * const *, char **);"
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
[ ${HAVE_ISBLANK} -eq 0 ] && \
|
|
|
|
echo "extern int isblank(int);"
|
|
|
|
|
|
|
|
[ ${HAVE_MKDTEMP} -eq 0 ] && \
|
|
|
|
echo "extern char *mkdtemp(char *);"
|
|
|
|
|
|
|
|
if [ ${HAVE_PROGNAME} -eq 0 ]; then
|
|
|
|
echo "extern const char *getprogname(void);"
|
|
|
|
echo "extern void setprogname(const char *);"
|
|
|
|
fi
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
[ ${HAVE_REALLOCARRAY} -eq 0 ] && \
|
|
|
|
echo "extern void *reallocarray(void *, size_t, size_t);"
|
|
|
|
|
|
|
|
[ ${HAVE_STRCASESTR} -eq 0 ] && \
|
|
|
|
echo "extern char *strcasestr(const char *, const char *);"
|
|
|
|
|
|
|
|
[ ${HAVE_STRLCAT} -eq 0 ] && \
|
|
|
|
echo "extern size_t strlcat(char *, const char *, size_t);"
|
|
|
|
|
|
|
|
[ ${HAVE_STRLCPY} -eq 0 ] && \
|
|
|
|
echo "extern size_t strlcpy(char *, const char *, size_t);"
|
|
|
|
|
|
|
|
[ ${HAVE_STRSEP} -eq 0 ] && \
|
|
|
|
echo "extern char *strsep(char **, const char *);"
|
|
|
|
|
2015-03-02 16:45:41 +00:00
|
|
|
[ ${HAVE_STRTONUM} -eq 0 ] && \
|
|
|
|
echo "extern long long strtonum(const char *, long long, long long, const char **);"
|
|
|
|
|
2016-01-15 23:08:59 +00:00
|
|
|
[ ${HAVE_VASPRINTF} -eq 0 ] && \
|
|
|
|
echo "extern int vasprintf(char **, const char *, va_list);"
|
|
|
|
|
2014-12-02 07:34:06 +00:00
|
|
|
echo "config.h: written" 1>&2
|
|
|
|
echo "config.h: written" 1>&3
|
|
|
|
|
|
|
|
# --- tests for Makefile.local -----------------------------------------
|
|
|
|
|
|
|
|
exec > Makefile.local
|
|
|
|
|
2017-06-08 19:29:07 +00:00
|
|
|
[ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
|
|
|
|
[ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
|
|
|
|
[ -z "${BIN_FROM_SBIN}" ] && BIN_FROM_SBIN="../bin"
|
|
|
|
[ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
|
|
|
|
[ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc"
|
|
|
|
[ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
2017-06-08 19:29:07 +00:00
|
|
|
[ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs"
|
|
|
|
[ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
[ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
|
|
|
|
[ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
|
|
|
|
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
|
|
|
|
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
|
|
|
|
|
2017-01-21 13:01:39 +00:00
|
|
|
BUILD_TARGETS=
|
2017-02-19 17:41:20 +00:00
|
|
|
[ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="man.cgi"
|
|
|
|
[ ${BUILD_CATMAN} -gt 0 ] && \
|
|
|
|
BUILD_TARGETS="${BUILD_TARGETS} mandocd catman"
|
2017-01-21 13:01:39 +00:00
|
|
|
INSTALL_TARGETS=
|
|
|
|
[ ${INSTALL_LIBMANDOC} -gt 0 ] && INSTALL_TARGETS="lib-install"
|
2014-12-25 21:33:25 +00:00
|
|
|
[ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
|
2017-02-19 17:41:20 +00:00
|
|
|
[ ${BUILD_CATMAN} -gt 0 ] && \
|
|
|
|
INSTALL_TARGETS="${INSTALL_TARGETS} catman-install"
|
2014-12-02 07:34:06 +00:00
|
|
|
|
|
|
|
cat << __HEREDOC__
|
|
|
|
BUILD_TARGETS = ${BUILD_TARGETS}
|
2014-12-25 21:33:25 +00:00
|
|
|
INSTALL_TARGETS = ${INSTALL_TARGETS}
|
2016-01-15 23:08:59 +00:00
|
|
|
CC = ${CC}
|
2014-12-02 07:34:06 +00:00
|
|
|
CFLAGS = ${CFLAGS}
|
2016-07-23 11:45:42 +00:00
|
|
|
LDADD = ${LDADD}
|
|
|
|
LDFLAGS = ${LDFLAGS}
|
2014-12-02 07:34:06 +00:00
|
|
|
STATIC = ${STATIC}
|
|
|
|
PREFIX = ${PREFIX}
|
|
|
|
BINDIR = ${BINDIR}
|
|
|
|
SBINDIR = ${SBINDIR}
|
2017-06-08 19:29:07 +00:00
|
|
|
BIN_FROM_SBIN = ${BIN_FROM_SBIN}
|
2014-12-02 07:34:06 +00:00
|
|
|
INCLUDEDIR = ${INCLUDEDIR}
|
|
|
|
LIBDIR = ${LIBDIR}
|
|
|
|
MANDIR = ${MANDIR}
|
|
|
|
WWWPREFIX = ${WWWPREFIX}
|
|
|
|
HTDOCDIR = ${HTDOCDIR}
|
|
|
|
CGIBINDIR = ${CGIBINDIR}
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_APROPOS = ${BINM_APROPOS}
|
2017-02-19 17:41:20 +00:00
|
|
|
BINM_CATMAN = ${BINM_CATMAN}
|
2016-01-15 23:08:59 +00:00
|
|
|
BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_MAN = ${BINM_MAN}
|
2016-01-15 23:08:59 +00:00
|
|
|
BINM_SOELIM = ${BINM_SOELIM}
|
2014-12-25 21:33:25 +00:00
|
|
|
BINM_WHATIS = ${BINM_WHATIS}
|
|
|
|
MANM_MAN = ${MANM_MAN}
|
2016-01-15 23:08:59 +00:00
|
|
|
MANM_MANCONF = ${MANM_MANCONF}
|
2014-12-25 21:33:25 +00:00
|
|
|
MANM_MDOC = ${MANM_MDOC}
|
|
|
|
MANM_ROFF = ${MANM_ROFF}
|
|
|
|
MANM_EQN = ${MANM_EQN}
|
|
|
|
MANM_TBL = ${MANM_TBL}
|
2014-12-02 07:34:06 +00:00
|
|
|
INSTALL = ${INSTALL}
|
|
|
|
INSTALL_PROGRAM = ${INSTALL_PROGRAM}
|
|
|
|
INSTALL_LIB = ${INSTALL_LIB}
|
|
|
|
INSTALL_MAN = ${INSTALL_MAN}
|
|
|
|
INSTALL_DATA = ${INSTALL_DATA}
|
2017-02-19 17:41:20 +00:00
|
|
|
LN = ${LN}
|
2014-12-02 07:34:06 +00:00
|
|
|
__HEREDOC__
|
|
|
|
|
|
|
|
echo "Makefile.local: written" 1>&2
|
|
|
|
echo "Makefile.local: written" 1>&3
|
2014-11-22 18:08:25 +00:00
|
|
|
|
|
|
|
exit 0
|