Home | History | Annotate | Line # | Download | only in dist
configure revision 1.6
      1  1.1     joerg #!/bin/sh
      2  1.1     joerg #
      3  1.5  christos # Copyright (c) 2014, 2015, 2016 Ingo Schwarze <schwarze (at] openbsd.org>
      4  1.1     joerg #
      5  1.1     joerg # Permission to use, copy, modify, and distribute this software for any
      6  1.1     joerg # purpose with or without fee is hereby granted, provided that the above
      7  1.1     joerg # copyright notice and this permission notice appear in all copies.
      8  1.1     joerg #
      9  1.1     joerg # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     10  1.1     joerg # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     11  1.1     joerg # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     12  1.1     joerg # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     13  1.1     joerg # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     14  1.1     joerg # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     15  1.1     joerg # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     16  1.1     joerg 
     17  1.1     joerg set -e
     18  1.4  christos DIR="`dirname "$0"`"
     19  1.1     joerg 
     20  1.5  christos [ -w config.log ] && mv config.log config.log.old
     21  1.5  christos [ -w config.h   ] && mv config.h config.h.old
     22  1.1     joerg 
     23  1.2  christos # Output file descriptor usage:
     24  1.2  christos # 1 (stdout): config.h, Makefile.local
     25  1.2  christos # 2 (stderr): original stderr, usually to the console
     26  1.2  christos # 3: config.log
     27  1.1     joerg 
     28  1.2  christos exec 3> config.log
     29  1.2  christos echo "config.log: writing..."
     30  1.2  christos 
     31  1.2  christos # --- default settings -------------------------------------------------
     32  1.2  christos # Initialize all variables here,
     33  1.2  christos # such that nothing can leak in from the environment.
     34  1.2  christos 
     35  1.5  christos MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
     36  1.2  christos OSNAME=
     37  1.4  christos MAKEFLAGS=
     38  1.2  christos 
     39  1.2  christos CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -f -`
     40  1.2  christos CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings"
     41  1.5  christos LDADD=
     42  1.5  christos LDFLAGS=
     43  1.5  christos LD_OHASH=
     44  1.5  christos LD_SQLITE3=
     45  1.2  christos STATIC="-static"
     46  1.2  christos 
     47  1.2  christos BUILD_DB=1
     48  1.2  christos BUILD_CGI=0
     49  1.2  christos 
     50  1.2  christos HAVE_DIRENT_NAMLEN=
     51  1.5  christos HAVE_ERR=
     52  1.2  christos HAVE_FTS=
     53  1.5  christos HAVE_GETLINE=
     54  1.2  christos HAVE_GETSUBOPT=
     55  1.5  christos HAVE_ISBLANK=
     56  1.5  christos HAVE_MKDTEMP=
     57  1.2  christos HAVE_MMAP=
     58  1.5  christos HAVE_PLEDGE=
     59  1.5  christos HAVE_PROGNAME=
     60  1.2  christos HAVE_REALLOCARRAY=
     61  1.5  christos HAVE_REWB_BSD=
     62  1.5  christos HAVE_REWB_SYSV=
     63  1.5  christos HAVE_SANDBOX_INIT=
     64  1.2  christos HAVE_STRCASESTR=
     65  1.5  christos HAVE_STRINGLIST=
     66  1.2  christos HAVE_STRLCAT=
     67  1.2  christos HAVE_STRLCPY=
     68  1.2  christos HAVE_STRPTIME=
     69  1.2  christos HAVE_STRSEP=
     70  1.2  christos HAVE_STRTONUM=
     71  1.5  christos HAVE_VASPRINTF=
     72  1.2  christos HAVE_WCHAR=
     73  1.2  christos 
     74  1.2  christos HAVE_SQLITE3=
     75  1.2  christos HAVE_SQLITE3_ERRSTR=
     76  1.2  christos HAVE_OHASH=
     77  1.2  christos HAVE_MANPATH=
     78  1.2  christos 
     79  1.2  christos PREFIX="/usr/local"
     80  1.2  christos BINDIR=
     81  1.2  christos SBINDIR=
     82  1.2  christos INCLUDEDIR=
     83  1.2  christos LIBDIR=
     84  1.2  christos MANDIR=
     85  1.2  christos HOMEBREWDIR=
     86  1.2  christos 
     87  1.2  christos WWWPREFIX="/var/www"
     88  1.2  christos HTDOCDIR=
     89  1.2  christos CGIBINDIR=
     90  1.2  christos 
     91  1.2  christos BINM_APROPOS="apropos"
     92  1.5  christos BINM_MAKEWHATIS="makewhatis"
     93  1.2  christos BINM_MAN="man"
     94  1.5  christos BINM_SOELIM="soelim"
     95  1.2  christos BINM_WHATIS="whatis"
     96  1.2  christos MANM_MAN="man"
     97  1.5  christos MANM_MANCONF="man.conf"
     98  1.2  christos MANM_MDOC="mdoc"
     99  1.2  christos MANM_ROFF="roff"
    100  1.2  christos MANM_EQN="eqn"
    101  1.2  christos MANM_TBL="tbl"
    102  1.2  christos 
    103  1.2  christos INSTALL="install"
    104  1.2  christos INSTALL_PROGRAM=
    105  1.2  christos INSTALL_LIB=
    106  1.2  christos INSTALL_MAN=
    107  1.2  christos INSTALL_DATA=
    108  1.2  christos 
    109  1.2  christos # --- manual settings from configure.local -----------------------------
    110  1.2  christos 
    111  1.5  christos if [ -r ./configure.local ]; then
    112  1.2  christos 	echo "configure.local: reading..." 1>&2
    113  1.2  christos 	echo "configure.local: reading..." 1>&3
    114  1.2  christos 	cat ./configure.local 1>&3
    115  1.2  christos 	. ./configure.local
    116  1.2  christos else
    117  1.2  christos 	echo "configure.local: no (fully automatic configuration)" 1>&2
    118  1.2  christos 	echo "configure.local: no (fully automatic configuration)" 1>&3
    119  1.2  christos fi
    120  1.2  christos echo 1>&3
    121  1.2  christos 
    122  1.2  christos # --- tests for config.h  ----------------------------------------------
    123  1.2  christos 
    124  1.2  christos COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
    125  1.2  christos 
    126  1.2  christos # Check whether this HAVE_ setting is manually overridden.
    127  1.2  christos # If yes, use the override, if no, do not decide anything yet.
    128  1.2  christos # Arguments: lower-case test name, manual value
    129  1.2  christos ismanual() {
    130  1.2  christos 	[ -z "${2}" ] && return 1
    131  1.2  christos 	echo "${1}: manual (${2})" 1>&2
    132  1.2  christos 	echo "${1}: manual (${2})" 1>&3
    133  1.2  christos 	echo 1>&3
    134  1.2  christos 	return 0
    135  1.2  christos }
    136  1.2  christos 
    137  1.2  christos # Run a single autoconfiguration test.
    138  1.2  christos # In case of success, enable the feature.
    139  1.2  christos # In case of failure, do not decide anything yet.
    140  1.2  christos # Arguments: lower-case test name, upper-case test name, additional CFLAGS
    141  1.2  christos singletest() {
    142  1.2  christos 	cat 1>&3 << __HEREDOC__
    143  1.2  christos ${1}: testing...
    144  1.2  christos ${COMP} ${3} -o test-${1} test-${1}.c
    145  1.2  christos __HEREDOC__
    146  1.2  christos 
    147  1.4  christos 	if ${COMP} ${3} -o "test-${1}" "${DIR}/test-${1}.c" 1>&3 2>&3; then
    148  1.2  christos 		echo "${1}: ${CC} succeeded" 1>&3
    149  1.2  christos 	else
    150  1.2  christos 		echo "${1}: ${CC} failed with $?" 1>&3
    151  1.2  christos 		echo 1>&3
    152  1.2  christos 		return 1
    153  1.2  christos 	fi
    154  1.2  christos 
    155  1.2  christos 	if ./test-${1} 1>&3 2>&3; then
    156  1.2  christos 		echo "${1}: yes" 1>&2
    157  1.2  christos 		echo "${1}: yes" 1>&3
    158  1.2  christos 		echo 1>&3
    159  1.2  christos 		eval HAVE_${2}=1
    160  1.2  christos 		rm "test-${1}"
    161  1.2  christos 		return 0
    162  1.2  christos 	else
    163  1.2  christos 		echo "${1}: execution failed with $?" 1>&3
    164  1.2  christos 		echo 1>&3
    165  1.2  christos 		rm "test-${1}"
    166  1.2  christos 		return 1
    167  1.2  christos 	fi
    168  1.2  christos }
    169  1.2  christos 
    170  1.2  christos # Run a complete autoconfiguration test, including the check for
    171  1.2  christos # a manual override and disabling the feature on failure.
    172  1.2  christos # Arguments: lower case name, upper case name, additional CFLAGS
    173  1.1     joerg runtest() {
    174  1.2  christos 	eval _manual=\${HAVE_${2}}
    175  1.2  christos 	ismanual "${1}" "${_manual}" && return 0
    176  1.2  christos 	singletest "${1}" "${2}" "${3}" && return 0
    177  1.2  christos 	echo "${1}: no" 1>&2
    178  1.2  christos 	eval HAVE_${2}=0
    179  1.2  christos 	return 1
    180  1.1     joerg }
    181  1.1     joerg 
    182  1.2  christos # --- library functions ---
    183  1.2  christos runtest dirent-namlen	DIRENT_NAMLEN	|| true
    184  1.5  christos runtest err		ERR		|| true
    185  1.2  christos runtest fts		FTS		|| true
    186  1.5  christos runtest getline		GETLINE		|| true
    187  1.2  christos runtest getsubopt	GETSUBOPT	|| true
    188  1.5  christos runtest isblank		ISBLANK		|| true
    189  1.5  christos runtest mkdtemp		MKDTEMP		|| true
    190  1.2  christos runtest mmap		MMAP		|| true
    191  1.5  christos runtest pledge		PLEDGE		|| true
    192  1.5  christos runtest sandbox_init	SANDBOX_INIT	|| true
    193  1.5  christos runtest progname	PROGNAME	|| true
    194  1.2  christos runtest reallocarray	REALLOCARRAY	|| true
    195  1.5  christos runtest rewb-bsd	REWB_BSD	|| true
    196  1.5  christos runtest rewb-sysv	REWB_SYSV	|| true
    197  1.2  christos runtest strcasestr	STRCASESTR	|| true
    198  1.5  christos runtest stringlist	STRINGLIST	|| true
    199  1.2  christos runtest strlcat		STRLCAT		|| true
    200  1.2  christos runtest strlcpy		STRLCPY		|| true
    201  1.2  christos runtest strptime	STRPTIME	|| true
    202  1.2  christos runtest strsep		STRSEP		|| true
    203  1.2  christos runtest strtonum	STRTONUM	|| true
    204  1.5  christos runtest vasprintf	VASPRINTF	|| true
    205  1.2  christos runtest wchar		WCHAR		|| true
    206  1.2  christos 
    207  1.2  christos # --- sqlite3 ---
    208  1.2  christos if [ ${BUILD_DB} -eq 0 ]; then
    209  1.2  christos 	echo "BUILD_DB=0 (manual)" 1>&2
    210  1.2  christos 	echo "BUILD_DB=0 (manual)" 1>&3
    211  1.2  christos 	echo 1>&3
    212  1.2  christos 	HAVE_SQLITE3=0
    213  1.2  christos elif ismanual sqlite3 "${HAVE_SQLITE3}"; then
    214  1.5  christos 	if [ -z "${LD_SQLITE3}" ]; then
    215  1.5  christos 		LD_SQLITE3="-lsqlite3"
    216  1.5  christos 	fi
    217  1.5  christos elif [ -n "${LD_SQLITE3}" ]; then
    218  1.5  christos 	runtest sqlite3 SQLITE3 "${LD_SQLITE3}" || true
    219  1.2  christos elif singletest sqlite3 SQLITE3 "-lsqlite3"; then
    220  1.5  christos 	LD_SQLITE3="-lsqlite3"
    221  1.2  christos elif runtest sqlite3 SQLITE3 \
    222  1.2  christos 		"-I/usr/local/include -L/usr/local/lib -lsqlite3"; then
    223  1.5  christos 	LD_SQLITE3="-L/usr/local/lib -lsqlite3"
    224  1.2  christos 	CFLAGS="${CFLAGS} -I/usr/local/include"
    225  1.2  christos fi
    226  1.5  christos if [ ${HAVE_SQLITE3} -eq 0 ]; then
    227  1.5  christos 	LD_SQLITE3=
    228  1.5  christos 	if [ ${BUILD_DB} -gt 0 ]; then
    229  1.5  christos 		echo "BUILD_DB=0 (no sqlite3)" 1>&2
    230  1.5  christos 		echo "BUILD_DB=0 (no sqlite3)" 1>&3
    231  1.5  christos 		echo 1>&3
    232  1.5  christos 		BUILD_DB=0
    233  1.5  christos 	fi
    234  1.2  christos fi
    235  1.2  christos 
    236  1.2  christos # --- sqlite3_errstr ---
    237  1.2  christos if [ ${BUILD_DB} -eq 0 ]; then
    238  1.2  christos 	HAVE_SQLITE3_ERRSTR=1
    239  1.2  christos elif ismanual sqlite3_errstr "${HAVE_SQLITE3_ERRSTR}"; then
    240  1.2  christos 	:
    241  1.2  christos else
    242  1.5  christos 	runtest sqlite3_errstr SQLITE3_ERRSTR "${LD_SQLITE3}" || true
    243  1.2  christos fi
    244  1.2  christos 
    245  1.2  christos # --- ohash ---
    246  1.5  christos if ismanual ohash "${HAVE_OHASH}"; then
    247  1.2  christos 	:
    248  1.5  christos elif [ -n "${LD_OHASH}" ]; then
    249  1.5  christos 	runtest ohash OHASH "${LD_OHASH}" || true
    250  1.2  christos elif singletest ohash OHASH; then
    251  1.2  christos 	:
    252  1.2  christos elif runtest ohash OHASH "-lutil"; then
    253  1.5  christos 	LD_OHASH="-lutil"
    254  1.5  christos fi
    255  1.5  christos if [ "${HAVE_OHASH}" -eq 0 ]; then
    256  1.5  christos 	LD_OHASH=
    257  1.2  christos fi
    258  1.2  christos 
    259  1.5  christos # --- LDADD ---
    260  1.5  christos LDADD="${LDADD} ${LD_SQLITE3} ${LD_OHASH} -lz"
    261  1.5  christos echo "LDADD=\"${LDADD}\"" 1>&2
    262  1.5  christos echo "LDADD=\"${LDADD}\"" 1>&3
    263  1.5  christos echo 1>&3
    264  1.2  christos 
    265  1.2  christos # --- manpath ---
    266  1.2  christos if ismanual manpath "${HAVE_MANPATH}"; then
    267  1.2  christos 	:
    268  1.2  christos elif manpath 1>&3 2>&3; then
    269  1.2  christos 	echo "manpath: yes" 1>&2
    270  1.2  christos 	echo "manpath: yes" 1>&3
    271  1.2  christos 	echo 1>&3
    272  1.2  christos 	HAVE_MANPATH=1
    273  1.2  christos else
    274  1.2  christos 	echo "manpath: no" 1>&2
    275  1.2  christos 	echo "manpath: no" 1>&3
    276  1.2  christos 	echo 1>&3
    277  1.2  christos 	HAVE_MANPATH=0
    278  1.2  christos fi
    279  1.2  christos 
    280  1.2  christos # --- write config.h ---
    281  1.2  christos 
    282  1.2  christos exec > config.h
    283  1.2  christos 
    284  1.2  christos cat << __HEREDOC__
    285  1.5  christos #ifdef __cplusplus
    286  1.5  christos #error "Do not use C++.  See the INSTALL file."
    287  1.5  christos #endif
    288  1.5  christos 
    289  1.2  christos #ifndef MANDOC_CONFIG_H
    290  1.2  christos #define MANDOC_CONFIG_H
    291  1.2  christos 
    292  1.2  christos #ifdef HAVE_NBTOOL_CONFIG_H
    293  1.2  christos #include "nbtool_config.h"
    294  1.2  christos #endif
    295  1.2  christos 
    296  1.2  christos #if defined(__linux__) || defined(__MINT__)
    297  1.2  christos #define _GNU_SOURCE	/* See test-*.c what needs this. */
    298  1.2  christos #endif
    299  1.2  christos 
    300  1.2  christos __HEREDOC__
    301  1.2  christos 
    302  1.5  christos [ ${HAVE_GETLINE} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \
    303  1.2  christos   ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \
    304  1.2  christos 	&& echo "#include <sys/types.h>"
    305  1.5  christos [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
    306  1.5  christos [ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
    307  1.2  christos 
    308  1.1     joerg echo
    309  1.5  christos echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
    310  1.5  christos echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
    311  1.2  christos [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
    312  1.2  christos [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
    313  1.2  christos 
    314  1.2  christos cat << __HEREDOC__
    315  1.2  christos #ifndef HAVE_NBTOOL_CONFIG_H
    316  1.2  christos #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
    317  1.5  christos #define HAVE_ERR ${HAVE_ERR}
    318  1.2  christos #define HAVE_FTS ${HAVE_FTS}
    319  1.5  christos #define HAVE_GETLINE ${HAVE_GETLINE}
    320  1.2  christos #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
    321  1.5  christos #define HAVE_ISBLANK ${HAVE_ISBLANK}
    322  1.5  christos #define HAVE_MKDTEMP ${HAVE_MKDTEMP}
    323  1.2  christos #define HAVE_MMAP ${HAVE_MMAP}
    324  1.5  christos #define HAVE_PLEDGE ${HAVE_PLEDGE}
    325  1.5  christos #define HAVE_PROGNAME ${HAVE_PROGNAME}
    326  1.2  christos #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
    327  1.5  christos #define HAVE_REWB_BSD ${HAVE_REWB_BSD}
    328  1.5  christos #define HAVE_REWB_SYSV ${HAVE_REWB_SYSV}
    329  1.5  christos #define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
    330  1.2  christos #define HAVE_STRCASESTR ${HAVE_STRCASESTR}
    331  1.5  christos #define HAVE_STRINGLIST ${HAVE_STRINGLIST}
    332  1.2  christos #define HAVE_STRLCAT ${HAVE_STRLCAT}
    333  1.2  christos #define HAVE_STRLCPY ${HAVE_STRLCPY}
    334  1.2  christos #define HAVE_STRPTIME ${HAVE_STRPTIME}
    335  1.2  christos #define HAVE_STRSEP ${HAVE_STRSEP}
    336  1.2  christos #define HAVE_STRTONUM ${HAVE_STRTONUM}
    337  1.5  christos #define HAVE_VASPRINTF ${HAVE_VASPRINTF}
    338  1.2  christos #define HAVE_WCHAR ${HAVE_WCHAR}
    339  1.2  christos #define HAVE_SQLITE3 ${HAVE_SQLITE3}
    340  1.2  christos #define HAVE_SQLITE3_ERRSTR ${HAVE_SQLITE3_ERRSTR}
    341  1.2  christos #define HAVE_OHASH ${HAVE_OHASH}
    342  1.2  christos #define HAVE_MANPATH ${HAVE_MANPATH}
    343  1.2  christos #endif
    344  1.2  christos 
    345  1.2  christos #define BINM_APROPOS "${BINM_APROPOS}"
    346  1.5  christos #define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
    347  1.2  christos #define BINM_MAN "${BINM_MAN}"
    348  1.5  christos #define BINM_SOELIM "${BINM_SOELIM}"
    349  1.2  christos #define BINM_WHATIS "${BINM_WHATIS}"
    350  1.2  christos 
    351  1.5  christos __HEREDOC__
    352  1.2  christos 
    353  1.5  christos if [ ${HAVE_ERR} -eq 0 ]; then
    354  1.5  christos 	echo "extern	void	  err(int, const char *, ...);"
    355  1.5  christos 	echo "extern	void	  errx(int, const char *, ...);"
    356  1.5  christos 	echo "extern	void	  warn(const char *, ...);"
    357  1.5  christos 	echo "extern	void	  warnx(const char *, ...);"
    358  1.5  christos fi
    359  1.2  christos 
    360  1.5  christos [ ${HAVE_GETLINE} -eq 0 ] && \
    361  1.5  christos 	echo "extern	ssize_t	  getline(char **, size_t *, FILE *);"
    362  1.2  christos 
    363  1.2  christos [ ${HAVE_GETSUBOPT} -eq 0 ] && \
    364  1.2  christos 	echo "extern	int	  getsubopt(char **, char * const *, char **);"
    365  1.2  christos 
    366  1.6     joerg if [ ${HAVE_ISBLANK} -eq 0 ]; then
    367  1.6     joerg 	echo "#undef isblank"
    368  1.5  christos 	echo "extern	int	  isblank(int);"
    369  1.6     joerg fi
    370  1.5  christos 
    371  1.5  christos [ ${HAVE_MKDTEMP} -eq 0 ] && \
    372  1.5  christos 	echo "extern	char	 *mkdtemp(char *);"
    373  1.5  christos 
    374  1.5  christos if [ ${HAVE_PROGNAME} -eq 0 ]; then
    375  1.5  christos 	echo "extern 	const char *getprogname(void);"
    376  1.5  christos 	echo "extern	void	  setprogname(const char *);"
    377  1.5  christos fi
    378  1.5  christos 
    379  1.2  christos [ ${HAVE_REALLOCARRAY} -eq 0 ] && \
    380  1.2  christos 	echo "extern	void	 *reallocarray(void *, size_t, size_t);"
    381  1.2  christos 
    382  1.2  christos [ ${BUILD_DB} -gt 0 -a ${HAVE_SQLITE3_ERRSTR} -eq 0 ] &&
    383  1.2  christos 	echo "extern	const char *sqlite3_errstr(int);"
    384  1.2  christos 
    385  1.2  christos [ ${HAVE_STRCASESTR} -eq 0 ] && \
    386  1.2  christos 	echo "extern	char	 *strcasestr(const char *, const char *);"
    387  1.2  christos 
    388  1.2  christos [ ${HAVE_STRLCAT} -eq 0 ] && \
    389  1.2  christos 	echo "extern	size_t	  strlcat(char *, const char *, size_t);"
    390  1.2  christos 
    391  1.2  christos [ ${HAVE_STRLCPY} -eq 0 ] && \
    392  1.2  christos 	echo "extern	size_t	  strlcpy(char *, const char *, size_t);"
    393  1.2  christos 
    394  1.2  christos [ ${HAVE_STRSEP} -eq 0 ] && \
    395  1.3     joerg 	echo "#undef strsep"
    396  1.2  christos 	echo "extern	char	 *strsep(char **, const char *);"
    397  1.2  christos 
    398  1.2  christos [ ${HAVE_STRTONUM} -eq 0 ] && \
    399  1.2  christos 	echo "extern	long long strtonum(const char *, long long, long long, const char **);"
    400  1.2  christos 
    401  1.5  christos [ ${HAVE_VASPRINTF} -eq 0 ] && \
    402  1.5  christos 	echo "extern	int	  vasprintf(char **, const char *, va_list);"
    403  1.5  christos 
    404  1.1     joerg echo
    405  1.2  christos echo "#endif /* MANDOC_CONFIG_H */"
    406  1.2  christos 
    407  1.2  christos echo "config.h: written" 1>&2
    408  1.2  christos echo "config.h: written" 1>&3
    409  1.2  christos 
    410  1.2  christos # --- tests for Makefile.local -----------------------------------------
    411  1.2  christos 
    412  1.2  christos exec > Makefile.local
    413  1.2  christos 
    414  1.2  christos [ -z "${BINDIR}"     ] && BINDIR="${PREFIX}/bin"
    415  1.2  christos [ -z "${SBINDIR}"    ] && SBINDIR="${PREFIX}/sbin"
    416  1.2  christos [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
    417  1.2  christos [ -z "${LIBDIR}"     ] && LIBDIR="${PREFIX}/lib/mandoc"
    418  1.2  christos [ -z "${MANDIR}"     ] && MANDIR="${PREFIX}/man"
    419  1.2  christos 
    420  1.2  christos [ -z "${HTDOCDIR}"   ] && HTDOCDIR="${WWWPREFIX}/htdocs"
    421  1.2  christos [ -z "${CGIBINDIR}"  ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"
    422  1.2  christos 
    423  1.2  christos [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
    424  1.2  christos [ -z "${INSTALL_LIB}"     ] && INSTALL_LIB="${INSTALL} -m 0444"
    425  1.2  christos [ -z "${INSTALL_MAN}"     ] && INSTALL_MAN="${INSTALL} -m 0444"
    426  1.2  christos [ -z "${INSTALL_DATA}"    ] && INSTALL_DATA="${INSTALL} -m 0444"
    427  1.2  christos 
    428  1.2  christos if [ ${BUILD_DB} -eq 0 -a ${BUILD_CGI} -gt 0 ]; then
    429  1.2  christos 	echo "BUILD_CGI=0 (no BUILD_DB)" 1>&2
    430  1.2  christos 	echo "BUILD_CGI=0 (no BUILD_DB)" 1>&3
    431  1.2  christos 	BUILD_CGI=0
    432  1.2  christos fi
    433  1.2  christos 
    434  1.2  christos BUILD_TARGETS="base-build"
    435  1.2  christos [ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="${BUILD_TARGETS} cgi-build"
    436  1.2  christos INSTALL_TARGETS="base-install"
    437  1.2  christos [ ${BUILD_DB}  -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} db-install"
    438  1.2  christos [ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
    439  1.2  christos 
    440  1.2  christos cat << __HEREDOC__
    441  1.2  christos BUILD_TARGETS	= ${BUILD_TARGETS}
    442  1.2  christos INSTALL_TARGETS	= ${INSTALL_TARGETS}
    443  1.5  christos CC		= ${CC}
    444  1.2  christos CFLAGS		= ${CFLAGS}
    445  1.5  christos LDADD		= ${LDADD}
    446  1.5  christos LDFLAGS		= ${LDFLAGS}
    447  1.2  christos STATIC		= ${STATIC}
    448  1.2  christos PREFIX		= ${PREFIX}
    449  1.2  christos BINDIR		= ${BINDIR}
    450  1.2  christos SBINDIR		= ${SBINDIR}
    451  1.2  christos INCLUDEDIR	= ${INCLUDEDIR}
    452  1.2  christos LIBDIR		= ${LIBDIR}
    453  1.2  christos MANDIR		= ${MANDIR}
    454  1.2  christos WWWPREFIX	= ${WWWPREFIX}
    455  1.2  christos HTDOCDIR	= ${HTDOCDIR}
    456  1.2  christos CGIBINDIR	= ${CGIBINDIR}
    457  1.2  christos BINM_APROPOS	= ${BINM_APROPOS}
    458  1.5  christos BINM_MAKEWHATIS	= ${BINM_MAKEWHATIS}
    459  1.2  christos BINM_MAN	= ${BINM_MAN}
    460  1.5  christos BINM_SOELIM	= ${BINM_SOELIM}
    461  1.2  christos BINM_WHATIS	= ${BINM_WHATIS}
    462  1.2  christos MANM_MAN	= ${MANM_MAN}
    463  1.5  christos MANM_MANCONF	= ${MANM_MANCONF}
    464  1.2  christos MANM_MDOC	= ${MANM_MDOC}
    465  1.2  christos MANM_ROFF	= ${MANM_ROFF}
    466  1.2  christos MANM_EQN	= ${MANM_EQN}
    467  1.2  christos MANM_TBL	= ${MANM_TBL}
    468  1.2  christos INSTALL		= ${INSTALL}
    469  1.2  christos INSTALL_PROGRAM	= ${INSTALL_PROGRAM}
    470  1.2  christos INSTALL_LIB	= ${INSTALL_LIB}
    471  1.2  christos INSTALL_MAN	= ${INSTALL_MAN}
    472  1.2  christos INSTALL_DATA	= ${INSTALL_DATA}
    473  1.2  christos __HEREDOC__
    474  1.2  christos 
    475  1.2  christos [ ${BUILD_DB} -gt 0 ] && \
    476  1.2  christos 	echo "MAIN_OBJS	= \$(BASE_OBJS) \$(DB_OBJS)"
    477  1.2  christos 
    478  1.2  christos echo "Makefile.local: written" 1>&2
    479  1.2  christos echo "Makefile.local: written" 1>&3
    480  1.1     joerg 
    481  1.1     joerg exit 0
    482