version 1.43.2.5, 2016/10/20 17:51:45 |
version 1.43.2.12, 2017/02/21 17:04:04 |
|
|
# |
# |
# $Id$ |
# $Id$ |
# |
# |
# Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze@openbsd.org> |
# Copyright (c) 2014, 2015, 2016, 2017 Ingo Schwarze <schwarze@openbsd.org> |
# |
# |
# Permission to use, copy, modify, and distribute this software for any |
# Permission to use, copy, modify, and distribute this software for any |
# purpose with or without fee is hereby granted, provided that the above |
# purpose with or without fee is hereby granted, provided that the above |
Line 33 echo "config.log: writing..." |
|
Line 33 echo "config.log: writing..." |
|
# Initialize all variables here, |
# Initialize all variables here, |
# such that nothing can leak in from the environment. |
# such that nothing can leak in from the environment. |
|
|
|
SOURCEDIR=`dirname "$0"` |
|
|
MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man" |
MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man" |
OSNAME= |
OSNAME= |
UTF8_LOCALE= |
UTF8_LOCALE= |
|
|
LD_SQLITE3= |
LD_SQLITE3= |
STATIC="-static" |
STATIC="-static" |
|
|
BUILD_DB=1 |
|
BUILD_CGI=0 |
BUILD_CGI=0 |
|
|
HAVE_DIRENT_NAMLEN= |
HAVE_DIRENT_NAMLEN= |
HAVE_EFTYPE= |
HAVE_EFTYPE= |
HAVE_ERR= |
HAVE_ERR= |
HAVE_FTS= |
HAVE_FTS= |
|
HAVE_FTS_COMPARE_CONST= |
HAVE_GETLINE= |
HAVE_GETLINE= |
HAVE_GETSUBOPT= |
HAVE_GETSUBOPT= |
HAVE_ISBLANK= |
HAVE_ISBLANK= |
Line 110 INSTALL_PROGRAM= |
|
Line 112 INSTALL_PROGRAM= |
|
INSTALL_LIB= |
INSTALL_LIB= |
INSTALL_MAN= |
INSTALL_MAN= |
INSTALL_DATA= |
INSTALL_DATA= |
|
LN="ln -f" |
|
|
# --- manual settings from configure.local ----------------------------- |
# --- manual settings from configure.local ----------------------------- |
|
|
Line 132 COMP="${CC} ${CFLAGS} -Wno-unused -Werror" |
|
Line 135 COMP="${CC} ${CFLAGS} -Wno-unused -Werror" |
|
# If yes, use the override, if no, do not decide anything yet. |
# If yes, use the override, if no, do not decide anything yet. |
# Arguments: lower-case test name, manual value |
# Arguments: lower-case test name, manual value |
ismanual() { |
ismanual() { |
[ -z "${2}" ] && return 1 |
[ -z "${3}" ] && return 1 |
echo "${1}: manual (${2})" 1>&2 |
echo "${1}: manual (HAVE_${2}=${3})" 1>&2 |
echo "${1}: manual (${2})" 1>&3 |
echo "${1}: manual (HAVE_${2}=${3})" 1>&3 |
echo 1>&3 |
echo 1>&3 |
return 0 |
return 0 |
} |
} |
|
|
# Arguments: lower-case test name, upper-case test name, additional CFLAGS |
# Arguments: lower-case test name, upper-case test name, additional CFLAGS |
singletest() { |
singletest() { |
cat 1>&3 << __HEREDOC__ |
cat 1>&3 << __HEREDOC__ |
${1}: testing... |
${1}${3}: testing... |
${COMP} ${3} -o test-${1} test-${1}.c |
${COMP} -o test-${1} test-${1}.c ${3} |
__HEREDOC__ |
__HEREDOC__ |
|
|
if ${COMP} ${3} -o "test-${1}" "test-${1}.c" 1>&3 2>&3; then |
if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} 1>&3 2>&3 |
echo "${1}: ${CC} succeeded" 1>&3 |
then |
|
echo "${1}${3}: ${CC} succeeded" 1>&3 |
else |
else |
echo "${1}: ${CC} failed with $?" 1>&3 |
echo "${1}${3}: ${CC} failed with $?" 1>&3 |
echo 1>&3 |
echo 1>&3 |
return 1 |
return 1 |
fi |
fi |
|
|
if ./test-${1} 1>&3 2>&3; then |
if ./test-${1} 1>&3 2>&3; then |
echo "${1}: yes" 1>&2 |
echo "${1}${3}: yes" 1>&2 |
echo "${1}: yes" 1>&3 |
echo "${1}${3}: yes" 1>&3 |
echo 1>&3 |
echo 1>&3 |
eval HAVE_${2}=1 |
eval HAVE_${2}=1 |
rm "test-${1}" |
rm "test-${1}" |
return 0 |
return 0 |
else |
else |
echo "${1}: execution failed with $?" 1>&3 |
echo "${1}${3}: execution failed with $?" 1>&3 |
echo 1>&3 |
echo 1>&3 |
rm "test-${1}" |
rm "test-${1}" |
return 1 |
return 1 |
|
|
# Arguments: lower case name, upper case name, additional CFLAGS |
# Arguments: lower case name, upper case name, additional CFLAGS |
runtest() { |
runtest() { |
eval _manual=\${HAVE_${2}} |
eval _manual=\${HAVE_${2}} |
ismanual "${1}" "${_manual}" && return 0 |
ismanual "${1}" "${2}" "${_manual}" && return 0 |
singletest "${1}" "${2}" "${3}" && return 0 |
singletest "${1}" "${2}" "${3}" && return 0 |
echo "${1}: no" 1>&2 |
echo "${1}${3}: no" 1>&2 |
eval HAVE_${2}=0 |
eval HAVE_${2}=0 |
return 1 |
return 1 |
} |
} |
|
|
# Select a UTF-8 locale. |
# Select a UTF-8 locale. |
get_locale() { |
get_locale() { |
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0 |
[ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0 |
ismanual UTF8_LOCALE "$UTF8_LOCALE" && return 0 |
ismanual UTF8_LOCALE UTF8_LOCALE "$UTF8_LOCALE" && return 0 |
echo "UTF8_LOCALE: testing..." 1>&3 |
echo "UTF8_LOCALE: testing..." 1>&3 |
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1` |
UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1` |
if [ -z "${UTF8_LOCALE}" ]; then |
if [ -z "${UTF8_LOCALE}" ]; then |
|
|
runtest dirent-namlen DIRENT_NAMLEN || true |
runtest dirent-namlen DIRENT_NAMLEN || true |
runtest EFTYPE EFTYPE || true |
runtest EFTYPE EFTYPE || true |
runtest err ERR || true |
runtest err ERR || true |
runtest fts FTS || true |
|
runtest getline GETLINE || true |
runtest getline GETLINE || true |
runtest getsubopt GETSUBOPT || true |
runtest getsubopt GETSUBOPT || true |
runtest isblank ISBLANK || true |
runtest isblank ISBLANK || true |
Line 227 runtest strsep STRSEP || true |
|
Line 230 runtest strsep STRSEP || true |
|
runtest strtonum STRTONUM || true |
runtest strtonum STRTONUM || true |
runtest vasprintf VASPRINTF || true |
runtest vasprintf VASPRINTF || true |
|
|
|
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 --- |
# --- wide character and locale support --- |
if get_locale; then |
if get_locale; then |
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true |
runtest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true |
|
|
fi |
fi |
|
|
# --- sqlite3 --- |
# --- sqlite3 --- |
if [ ${BUILD_DB} -eq 0 ]; then |
if [ -n "${LD_SQLITE3}" ]; then |
echo "BUILD_DB=0 (manual)" 1>&2 |
|
echo "BUILD_DB=0 (manual)" 1>&3 |
|
echo 1>&3 |
|
HAVE_SQLITE3=0 |
|
elif ismanual sqlite3 "${HAVE_SQLITE3}"; then |
|
if [ -z "${LD_SQLITE3}" ]; then |
|
LD_SQLITE3="-lsqlite3" |
|
fi |
|
elif [ -n "${LD_SQLITE3}" ]; then |
|
runtest sqlite3 SQLITE3 "${LD_SQLITE3}" || true |
runtest sqlite3 SQLITE3 "${LD_SQLITE3}" || true |
elif singletest sqlite3 SQLITE3 "-lsqlite3"; then |
elif singletest sqlite3 SQLITE3 "-lsqlite3"; then |
LD_SQLITE3="-lsqlite3" |
LD_SQLITE3="-lsqlite3" |
Line 254 elif runtest sqlite3 SQLITE3 \ |
|
Line 256 elif runtest sqlite3 SQLITE3 \ |
|
"-I/usr/local/include -L/usr/local/lib -lsqlite3"; then |
"-I/usr/local/include -L/usr/local/lib -lsqlite3"; then |
LD_SQLITE3="-L/usr/local/lib -lsqlite3" |
LD_SQLITE3="-L/usr/local/lib -lsqlite3" |
CFLAGS="${CFLAGS} -I/usr/local/include" |
CFLAGS="${CFLAGS} -I/usr/local/include" |
|
COMP="${COMP} -I/usr/local/include" |
fi |
fi |
if [ ${HAVE_SQLITE3} -eq 0 ]; then |
if [ ${HAVE_SQLITE3} -eq 0 ]; then |
LD_SQLITE3= |
echo "FATAL: no sqlite3" 1>&2 |
if [ ${BUILD_DB} -gt 0 ]; then |
echo "FATAL: no sqlite3" 1>&3 |
echo "BUILD_DB=0 (no sqlite3)" 1>&2 |
echo "Use release 1.14.1 to build without SQLite." 1>&2 |
echo "BUILD_DB=0 (no sqlite3)" 1>&3 |
exit 1 |
echo 1>&3 |
|
BUILD_DB=0 |
|
fi |
|
fi |
fi |
|
|
# --- sqlite3_errstr --- |
# --- sqlite3_errstr --- |
if [ ${BUILD_DB} -eq 0 ]; then |
if ismanual sqlite3_errstr SQLITE3_ERRSTR "${HAVE_SQLITE3_ERRSTR}"; then |
HAVE_SQLITE3_ERRSTR=1 |
|
elif ismanual sqlite3_errstr "${HAVE_SQLITE3_ERRSTR}"; then |
|
: |
: |
else |
else |
runtest sqlite3_errstr SQLITE3_ERRSTR "${LD_SQLITE3}" || true |
runtest sqlite3_errstr SQLITE3_ERRSTR "${LD_SQLITE3}" || true |
Line 289 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
|
Line 287 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then |
|
fi |
fi |
|
|
# --- ohash --- |
# --- ohash --- |
if ismanual ohash "${HAVE_OHASH}"; then |
if ismanual ohash OHASH "${HAVE_OHASH}"; then |
: |
: |
elif [ -n "${LD_OHASH}" ]; then |
elif [ -n "${LD_OHASH}" ]; then |
runtest ohash OHASH "${LD_OHASH}" || true |
runtest ohash OHASH "${LD_OHASH}" || true |
Line 309 echo "LDADD=\"${LDADD}\"" 1>&3 |
|
Line 307 echo "LDADD=\"${LDADD}\"" 1>&3 |
|
echo 1>&3 |
echo 1>&3 |
|
|
# --- manpath --- |
# --- manpath --- |
if ismanual manpath "${HAVE_MANPATH}"; then |
if ismanual manpath MANPATH "${HAVE_MANPATH}"; then |
: |
: |
elif manpath 1>&3 2>&3; then |
elif manpath 1>&3 2>&3; then |
echo "manpath: yes" 1>&2 |
echo "manpath: yes" 1>&2 |
Line 361 cat << __HEREDOC__ |
|
Line 359 cat << __HEREDOC__ |
|
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} |
#define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} |
#define HAVE_ERR ${HAVE_ERR} |
#define HAVE_ERR ${HAVE_ERR} |
#define HAVE_FTS ${HAVE_FTS} |
#define HAVE_FTS ${HAVE_FTS} |
|
#define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST} |
#define HAVE_GETLINE ${HAVE_GETLINE} |
#define HAVE_GETLINE ${HAVE_GETLINE} |
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} |
#define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} |
#define HAVE_ISBLANK ${HAVE_ISBLANK} |
#define HAVE_ISBLANK ${HAVE_ISBLANK} |
Line 381 cat << __HEREDOC__ |
|
Line 380 cat << __HEREDOC__ |
|
#define HAVE_STRTONUM ${HAVE_STRTONUM} |
#define HAVE_STRTONUM ${HAVE_STRTONUM} |
#define HAVE_VASPRINTF ${HAVE_VASPRINTF} |
#define HAVE_VASPRINTF ${HAVE_VASPRINTF} |
#define HAVE_WCHAR ${HAVE_WCHAR} |
#define HAVE_WCHAR ${HAVE_WCHAR} |
#define HAVE_SQLITE3 ${HAVE_SQLITE3} |
|
#define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR} |
#define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR} |
#define HAVE_OHASH ${HAVE_OHASH} |
#define HAVE_OHASH ${HAVE_OHASH} |
#define HAVE_MANPATH ${HAVE_MANPATH} |
#define HAVE_MANPATH ${HAVE_MANPATH} |
|
|
[ ${HAVE_REALLOCARRAY} -eq 0 ] && \ |
[ ${HAVE_REALLOCARRAY} -eq 0 ] && \ |
echo "extern void *reallocarray(void *, size_t, size_t);" |
echo "extern void *reallocarray(void *, size_t, size_t);" |
|
|
[ ${BUILD_DB} -gt 0 -a ${HAVE_SQLITE3_ERRSTR} -eq 0 ] && |
[ ${HAVE_SQLITE3_ERRSTR} -eq 0 ] && |
echo "extern const char *sqlite3_errstr(int);" |
echo "extern const char *sqlite3_errstr(int);" |
|
|
[ ${HAVE_STRCASESTR} -eq 0 ] && \ |
[ ${HAVE_STRCASESTR} -eq 0 ] && \ |
Line 463 exec > Makefile.local |
|
Line 461 exec > Makefile.local |
|
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444" |
[ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444" |
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444" |
[ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444" |
|
|
if [ ${BUILD_DB} -eq 0 -a ${BUILD_CGI} -gt 0 ]; then |
BUILD_TARGETS="" |
echo "BUILD_CGI=0 (no BUILD_DB)" 1>&2 |
[ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} man.cgi" |
echo "BUILD_CGI=0 (no BUILD_DB)" 1>&3 |
INSTALL_TARGETS="base-install db-install" |
BUILD_CGI=0 |
|
fi |
|
|
|
BUILD_TARGETS="base-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" |
[ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install" |
|
|
cat << __HEREDOC__ |
cat << __HEREDOC__ |
Line 508 INSTALL_PROGRAM = ${INSTALL_PROGRAM} |
|
Line 499 INSTALL_PROGRAM = ${INSTALL_PROGRAM} |
|
INSTALL_LIB = ${INSTALL_LIB} |
INSTALL_LIB = ${INSTALL_LIB} |
INSTALL_MAN = ${INSTALL_MAN} |
INSTALL_MAN = ${INSTALL_MAN} |
INSTALL_DATA = ${INSTALL_DATA} |
INSTALL_DATA = ${INSTALL_DATA} |
|
LN = ${LN} |
__HEREDOC__ |
__HEREDOC__ |
|
|
[ ${BUILD_DB} -gt 0 ] && \ |
|
echo "MAIN_OBJS = \$(BASE_OBJS) \$(DB_OBJS)" |
|
|
|
echo "Makefile.local: written" 1>&2 |
echo "Makefile.local: written" 1>&2 |
echo "Makefile.local: written" 1>&3 |
echo "Makefile.local: written" 1>&3 |