]> git.cameronkatri.com Git - mandoc.git/blob - configure
delete trailing whitespace and space-tab sequences; no code change;
[mandoc.git] / configure
1 #!/bin/sh
2 #
3 # $Id: configure,v 1.71 2019/07/01 22:56:24 schwarze Exp $
4 #
5 # Copyright (c) 2014-2019 Ingo Schwarze <schwarze@openbsd.org>
6 #
7 # Permission to use, copy, modify, and distribute this software for any
8 # purpose with or without fee is hereby granted, provided that the above
9 # copyright notice and this permission notice appear in all copies.
10 #
11 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 set -e
20
21 [ -w config.log ] && mv config.log config.log.old
22 [ -w config.h ] && mv config.h config.h.old
23
24 # Output file descriptor usage:
25 # 1 (stdout): config.h, Makefile.local
26 # 2 (stderr): original stderr, usually to the console
27 # 3: config.log
28
29 exec 3> config.log
30 echo "file config.log: writing..."
31
32 # --- default settings -------------------------------------------------
33 # Initialize all variables here,
34 # such that nothing can leak in from the environment.
35
36 SOURCEDIR=`dirname "$0"`
37
38 MANPATH_BASE="/usr/share/man:/usr/X11R6/man"
39 MANPATH_DEFAULT="/usr/share/man:/usr/X11R6/man:/usr/local/man"
40 OSENUM=
41 OSNAME=
42 UTF8_LOCALE=
43
44 CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | env -i make -sf -`
45 CFLAGS=
46 LDADD=
47 LDFLAGS=
48 LD_NANOSLEEP=
49 LD_OHASH=
50 LD_RECVMSG=
51 STATIC=
52
53 BUILD_CGI=0
54 BUILD_CATMAN=0
55 INSTALL_LIBMANDOC=0
56
57 HAVE_CMSG=
58 HAVE_CMSG_XPG42=0
59 HAVE_DIRENT_NAMLEN=
60 HAVE_EFTYPE=
61 HAVE_ENDIAN=
62 HAVE_ERR=
63 HAVE_FTS=
64 HAVE_FTS_COMPARE_CONST=
65 HAVE_GETLINE=
66 HAVE_GETSUBOPT=
67 HAVE_ISBLANK=
68 HAVE_LESS_T=
69 HAVE_MKDTEMP=
70 HAVE_NANOSLEEP=
71 HAVE_NTOHL=
72 HAVE_O_DIRECTORY=
73 HAVE_OHASH=
74 HAVE_PATH_MAX=
75 HAVE_PLEDGE=
76 HAVE_PROGNAME=
77 HAVE_REALLOCARRAY=
78 HAVE_RECALLOCARRAY=
79 HAVE_RECVMSG=
80 HAVE_REWB_BSD=
81 HAVE_REWB_SYSV=
82 HAVE_SANDBOX_INIT=
83 HAVE_STRCASESTR=
84 HAVE_STRINGLIST=
85 HAVE_STRLCAT=
86 HAVE_STRLCPY=
87 HAVE_STRNDUP=
88 HAVE_STRPTIME=
89 HAVE_STRSEP=
90 HAVE_STRTONUM=
91 HAVE_SYS_ENDIAN=
92 HAVE_VASPRINTF=
93 HAVE_WCHAR=
94
95 NEED_GNU_SOURCE=0
96 NEED_OPENBSD_SOURCE=0
97
98 PREFIX="/usr/local"
99 BINDIR=
100 SBINDIR=
101 BIN_FROM_SBIN=
102 INCLUDEDIR=
103 LIBDIR=
104 MANDIR=
105 HOMEBREWDIR=
106
107 WWWPREFIX="/var/www"
108 HTDOCDIR=
109 CGIBINDIR=
110
111 BINM_APROPOS="apropos"
112 BINM_CATMAN="catman"
113 BINM_MAKEWHATIS="makewhatis"
114 BINM_MAN="man"
115 BINM_SOELIM="soelim"
116 BINM_WHATIS="whatis"
117 MANM_MAN="man"
118 MANM_MANCONF="man.conf"
119 MANM_MDOC="mdoc"
120 MANM_ROFF="roff"
121 MANM_EQN="eqn"
122 MANM_TBL="tbl"
123
124 INSTALL="install"
125 INSTALL_PROGRAM=
126 INSTALL_LIB=
127 INSTALL_MAN=
128 INSTALL_DATA=
129 LN="ln -f"
130
131 # --- manual settings from configure.local -----------------------------
132
133 if [ -r ./configure.local ]; then
134 echo "file configure.local: reading..." 1>&2
135 echo "file configure.local: reading..." 1>&3
136 cat ./configure.local 1>&3
137 . ./configure.local
138 else
139 echo "file configure.local: no (fully automatic configuration)" 1>&2
140 echo "file configure.local: no (fully automatic configuration)" 1>&3
141 fi
142 echo 1>&3
143
144 # --- tests functions --------------------------------------------------
145
146 # Check whether this HAVE_ setting is manually overridden.
147 # If yes, use the override, if no, do not decide anything yet.
148 # Arguments: test file name, test var name, manual value
149 ismanual() {
150 [ -z "${3}" ] && return 1
151 echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&2
152 echo "tested ${1}: HAVE_${2}=${3} (manual)" 1>&3
153 echo 1>&3
154 return 0
155 }
156
157 # Run a single autoconfiguration test.
158 # In case of success, enable the feature.
159 # In case of failure, do not decide anything yet.
160 # Arguments: test file name, test var name, additional CFLAGS
161 singletest() {
162 n=${1}${3}${4}
163 cat 1>&3 << __HEREDOC__
164 testing ${n} ...
165 ${COMP} -o test-${1} test-${1}.c ${3} ${4}
166 __HEREDOC__
167
168 if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} ${4} 1>&3 2>&3
169 then
170 echo "partial result of ${n}: ${CC} succeeded" 1>&3
171 else
172 echo "result of ${n}: ${CC} failed with exit status $?" 1>&3
173 echo "result of compiling ${n}: no" 1>&3
174 echo 1>&3
175 return 1
176 fi
177
178 if ./test-${1} 1>&3 2>&3; then
179 echo "tested ${n}: yes" 1>&2
180 echo "result of running ${n}: yes" 1>&3
181 echo 1>&3
182 eval HAVE_${2}=1
183 [ "X$3" = "X-D_GNU_SOURCE" ] && NEED_GNU_SOURCE=1
184 [ "X$3" = "X-D_OPENBSD_SOURCE" ] && NEED_OPENBSD_SOURCE=1
185 rm "test-${1}"
186 return 0
187 else
188 echo "result of ${n}: execution failed with exit status $?" 1>&3
189 echo "result of running ${n}: no" 1>&3
190 echo 1>&3
191 rm "test-${1}"
192 return 1
193 fi
194 }
195
196 # Run a complete autoconfiguration test, including the check for
197 # a manual override and disabling the feature on failure.
198 # Arguments: test file name, test var name, additional CFLAGS
199 runtest() {
200 eval _manual=\${HAVE_${2}}
201 ismanual "${1}" "${2}" "${_manual}" && return 0
202 singletest "${1}" "${2}" "${3}" "${4}" && return 0
203 echo "tested ${1}${3}${4}: no" 1>&2
204 eval HAVE_${2}=0
205 return 1
206 }
207
208 # Select a UTF-8 locale.
209 get_locale() {
210 [ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0
211 ismanual UTF8_LOCALE UTF8_LOCALE "$UTF8_LOCALE" && return 0
212 echo "testing UTF8_LOCALE ..." 1>&3
213 UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1`
214 if [ -z "${UTF8_LOCALE}" ]; then
215 UTF8_LOCALE=`locale -a | grep -i '\.UTF-*8' | head -n 1`
216 [ -n "${UTF8_LOCALE}" ] || return 1
217 fi
218 echo "selected UTF8_LOCALE=${UTF8_LOCALE}" 1>&2
219 echo "selected UTF8_LOCALE=${UTF8_LOCALE}" 1>&3
220 echo 1>&3
221 return 0;
222 }
223
224 # --- operating system -------------------------------------------------
225
226 if [ -n "${OSENUM}" ]; then
227 echo "OSENUM specified manually: ${OSENUM}" 1>&2
228 echo "OSENUM specified manually: ${OSENUM}" 1>&3
229 else
230 OSDETECT=`uname`
231 if [ "X${OSDETECT}" = "XNetBSD" ]; then
232 OSENUM=MANDOC_OS_NETBSD
233 elif [ "X${OSDETECT}" = "XOpenBSD" ]; then
234 OSENUM=MANDOC_OS_OPENBSD
235 else
236 OSENUM=MANDOC_OS_OTHER
237 fi
238 echo "tested operating system: ${OSDETECT} -> OSENUM=${OSENUM}" 1>&2
239 echo "tested operating system: ${OSDETECT} -> OSENUM=${OSENUM}" 1>&3
240 unset OSDETECT
241 fi
242 echo 1>&3
243
244 # --- compiler options -------------------------------------------------
245
246 DEFCFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-parameter"
247
248 if [ -n "${CFLAGS}" ]; then
249 COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
250 else
251 COMP="${CC} ${DEFCFLAGS} -Wno-unused -Werror"
252 fi
253 echo -n "tested ${CC} -W: " 1>&2
254 echo -n "testing ${CC} -W: " 1>&3
255 runtest noop WFLAG || true
256
257 if [ -n "${CFLAGS}" ]; then
258 echo "CFLAGS specified manually:" 1>&3
259 elif [ ${HAVE_WFLAG} -eq 0 ]; then
260 CFLAGS="-g"
261 else
262 CFLAGS="${DEFCFLAGS}"
263 fi
264 echo "selected CFLAGS=\"${CFLAGS}\"" 1>&2
265 echo "selected CFLAGS=\"${CFLAGS}\"" 1>&3
266 echo 1>&3
267
268 COMP="${CC} ${CFLAGS}"
269 [ ${HAVE_WFLAG} -eq 0 ] || COMP="${COMP} -Wno-unused -Werror"
270
271 if [ -n "${STATIC}" ]; then
272 echo "selected STATIC=\"${STATIC}\" (manual)" 1>&2
273 echo "selected STATIC=\"${STATIC}\" (manual)" 1>&3
274 echo 1>&3
275 else
276 runtest noop STATIC -static || true
277 [ ${HAVE_STATIC} -eq 0 ] || STATIC="-static"
278 echo "selected STATIC=\"${STATIC}\"" 1>&2
279 echo "selected STATIC=\"${STATIC}\"" 1>&3
280 echo 1>&3
281 fi
282
283 # --- tests for config.h ----------------------------------------------
284
285 # --- library functions ---
286 runtest dirent-namlen DIRENT_NAMLEN || true
287 runtest be32toh ENDIAN || true
288 runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true
289 runtest EFTYPE EFTYPE || true
290 runtest err ERR || true
291 runtest getline GETLINE || true
292 singletest getsubopt GETSUBOPT || \
293 runtest getsubopt GETSUBOPT -D_GNU_SOURCE || true
294 runtest isblank ISBLANK || true
295 runtest mkdtemp MKDTEMP || true
296 runtest ntohl NTOHL || true
297 runtest O_DIRECTORY O_DIRECTORY || true
298 runtest PATH_MAX PATH_MAX || true
299 runtest pledge PLEDGE || true
300 runtest sandbox_init SANDBOX_INIT || true
301 runtest progname PROGNAME || true
302 singletest reallocarray REALLOCARRAY || \
303 runtest reallocarray REALLOCARRAY -D_OPENBSD_SOURCE || true
304 singletest recallocarray RECALLOCARRAY || \
305 runtest recallocarray RECALLOCARRAY -D_OPENBSD_SOURCE || true
306 runtest rewb-bsd REWB_BSD || true
307 runtest rewb-sysv REWB_SYSV || true
308 singletest strcasestr STRCASESTR || \
309 runtest strcasestr STRCASESTR -D_GNU_SOURCE || true
310 runtest stringlist STRINGLIST || true
311 runtest strlcat STRLCAT || true
312 runtest strlcpy STRLCPY || true
313 runtest strndup STRNDUP || true
314 singletest strptime STRPTIME || \
315 runtest strptime STRPTIME -D_GNU_SOURCE || true
316 runtest strsep STRSEP || true
317 singletest strtonum STRTONUM || \
318 runtest strtonum STRTONUM -D_OPENBSD_SOURCE || true
319 singletest vasprintf VASPRINTF || \
320 runtest vasprintf VASPRINTF -D_GNU_SOURCE || true
321
322 if [ ${HAVE_ENDIAN} -eq 0 -a \
323 ${HAVE_SYS_ENDIAN} -eq 0 -a \
324 ${HAVE_NTOHL} -eq 0 ]; then
325 echo "FATAL: no endian conversion functions found" 1>&2
326 echo "FATAL: no endian conversion functions found" 1>&3
327 exit 1
328 fi
329
330 if ismanual fts FTS ${HAVE_FTS}; then
331 HAVE_FTS_COMPARE_CONST=0
332 elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then
333 HAVE_FTS=1
334 else
335 runtest fts FTS || true
336 fi
337
338 if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then
339 :
340 elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then
341 HAVE_LESS_T=1
342 echo "tested less -T: yes" 1>&2
343 echo "tested less -T: yes" 1>&3
344 echo 1>&3
345 else
346 HAVE_LESS_T=0
347 echo "tested less -T: no" 1>&2
348 echo "tested less -T: no" 1>&3
349 echo 1>&3
350 fi
351
352 # --- wide character and locale support ---
353 if get_locale; then
354 singletest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || \
355 runtest wchar WCHAR -D_GNU_SOURCE \
356 -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true
357 else
358 HAVE_WCHAR=0
359 echo "tested wchar: no (no UTF8_LOCALE)" 1>&2
360 echo "tested wchar: no (no UTF8_LOCALE)" 1>&3
361 echo 1>&3
362 fi
363
364 # --- nanosleep ---
365 if [ -n "${LD_NANOSLEEP}" ]; then
366 runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true
367 elif singletest nanosleep NANOSLEEP; then
368 :
369 elif runtest nanosleep NANOSLEEP "-lrt"; then
370 LD_NANOSLEEP="-lrt"
371 fi
372 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
373 echo "FATAL: nanosleep: no" 1>&2
374 echo "FATAL: nanosleep: no" 1>&3
375 exit 1
376 fi
377
378 if [ ${BUILD_CATMAN} -gt 0 ]; then
379 # --- recvmsg ---
380 if [ -n "${LD_RECVMSG}" ]; then
381 runtest recvmsg RECVMSG "${LD_RECVMSG}" || true
382 elif singletest recvmsg RECVMSG; then
383 :
384 elif runtest recvmsg RECVMSG "-lsocket"; then
385 LD_RECVMSG="-lsocket"
386 fi
387 if [ "${HAVE_RECVMSG}" -eq 0 ]; then
388 echo "FATAL: recvmsg: no" 1>&2
389 echo "FATAL: recvmsg: no" 1>&3
390 echo "Without recvmsg(2), you cannot BUILD_CATMAN." 1>&2
391 exit 1
392 fi
393
394 # --- cmsg ---
395 if singletest cmsg CMSG; then
396 :
397 elif runtest cmsg CMSG "-D_XPG4_2"; then
398 HAVE_CMSG_XPG42=1
399 fi
400 if [ "${HAVE_CMSG}" -eq 0 ]; then
401 echo "FATAL: cmsg: no" 1>&2
402 echo "FATAL: cmsg: no" 1>&3
403 echo "Without CMSG_FIRSTHDR(3), you cannot BUILD_CATMAN." 1>&2
404 exit 1
405 fi
406 fi
407
408 # --- ohash ---
409 if ismanual ohash OHASH "${HAVE_OHASH}"; then
410 :
411 elif [ -n "${LD_OHASH}" ]; then
412 runtest ohash OHASH "${LD_OHASH}" || true
413 elif singletest ohash OHASH; then
414 :
415 elif runtest ohash OHASH "-lutil"; then
416 LD_OHASH="-lutil"
417 fi
418 if [ "${HAVE_OHASH}" -eq 0 ]; then
419 LD_OHASH=
420 fi
421
422 # --- LDADD ---
423 LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
424 echo "selected LDADD=\"${LDADD}\"" 1>&2
425 echo "selected LDADD=\"${LDADD}\"" 1>&3
426 echo 1>&3
427
428 # --- write config.h ---
429
430 exec > config.h
431
432 cat << __HEREDOC__
433 #ifdef __cplusplus
434 #error "Do not use C++. See the INSTALL file."
435 #endif
436
437 #if !defined(__GNUC__) || (__GNUC__ < 4)
438 #define __attribute__(x)
439 #endif
440
441 __HEREDOC__
442
443 [ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
444 [ ${NEED_OPENBSD_SOURCE} -eq 0 ] || echo "#define _OPENBSD_SOURCE"
445
446 [ ${HAVE_GETLINE} -eq 0 -o \
447 ${HAVE_REALLOCARRAY} -eq 0 -o ${HAVE_RECALLOCARRAY} -eq 0 -o \
448 ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o \
449 ${HAVE_STRNDUP} -eq 0 ] \
450 && echo "#include <sys/types.h>"
451 [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
452 [ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
453
454 echo
455 echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
456 echo "#define MANPATH_BASE \"${MANPATH_BASE}\""
457 echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
458 echo "#define OSENUM ${OSENUM}"
459 [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
460 [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
461 [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
462 [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
463 [ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
464 [ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"
465 if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then
466 echo "#define be32toh ntohl"
467 echo "#define htobe32 htonl"
468 fi
469
470 cat << __HEREDOC__
471 #define HAVE_CMSG_XPG42 ${HAVE_CMSG_XPG42}
472 #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
473 #define HAVE_ENDIAN ${HAVE_ENDIAN}
474 #define HAVE_ERR ${HAVE_ERR}
475 #define HAVE_FTS ${HAVE_FTS}
476 #define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST}
477 #define HAVE_GETLINE ${HAVE_GETLINE}
478 #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
479 #define HAVE_ISBLANK ${HAVE_ISBLANK}
480 #define HAVE_LESS_T ${HAVE_LESS_T}
481 #define HAVE_MKDTEMP ${HAVE_MKDTEMP}
482 #define HAVE_NTOHL ${HAVE_NTOHL}
483 #define HAVE_PLEDGE ${HAVE_PLEDGE}
484 #define HAVE_PROGNAME ${HAVE_PROGNAME}
485 #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
486 #define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
487 #define HAVE_REWB_BSD ${HAVE_REWB_BSD}
488 #define HAVE_REWB_SYSV ${HAVE_REWB_SYSV}
489 #define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
490 #define HAVE_STRCASESTR ${HAVE_STRCASESTR}
491 #define HAVE_STRINGLIST ${HAVE_STRINGLIST}
492 #define HAVE_STRLCAT ${HAVE_STRLCAT}
493 #define HAVE_STRLCPY ${HAVE_STRLCPY}
494 #define HAVE_STRNDUP ${HAVE_STRNDUP}
495 #define HAVE_STRPTIME ${HAVE_STRPTIME}
496 #define HAVE_STRSEP ${HAVE_STRSEP}
497 #define HAVE_STRTONUM ${HAVE_STRTONUM}
498 #define HAVE_SYS_ENDIAN ${HAVE_SYS_ENDIAN}
499 #define HAVE_VASPRINTF ${HAVE_VASPRINTF}
500 #define HAVE_WCHAR ${HAVE_WCHAR}
501 #define HAVE_OHASH ${HAVE_OHASH}
502
503 #define BINM_APROPOS "${BINM_APROPOS}"
504 #define BINM_CATMAN "${BINM_CATMAN}"
505 #define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
506 #define BINM_MAN "${BINM_MAN}"
507 #define BINM_SOELIM "${BINM_SOELIM}"
508 #define BINM_WHATIS "${BINM_WHATIS}"
509
510 __HEREDOC__
511
512 if [ ${HAVE_ERR} -eq 0 ]; then
513 echo "extern void err(int, const char *, ...);"
514 echo "extern void errx(int, const char *, ...);"
515 echo "extern void warn(const char *, ...);"
516 echo "extern void warnx(const char *, ...);"
517 fi
518
519 [ ${HAVE_GETLINE} -eq 0 ] && \
520 echo "extern ssize_t getline(char **, size_t *, FILE *);"
521
522 [ ${HAVE_GETSUBOPT} -eq 0 ] && \
523 echo "extern int getsubopt(char **, char * const *, char **);"
524
525 [ ${HAVE_ISBLANK} -eq 0 ] && \
526 echo "extern int isblank(int);"
527
528 [ ${HAVE_MKDTEMP} -eq 0 ] && \
529 echo "extern char *mkdtemp(char *);"
530
531 if [ ${HAVE_PROGNAME} -eq 0 ]; then
532 echo "extern const char *getprogname(void);"
533 echo "extern void setprogname(const char *);"
534 fi
535
536 [ ${HAVE_REALLOCARRAY} -eq 0 ] && \
537 echo "extern void *reallocarray(void *, size_t, size_t);"
538
539 [ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
540 echo "extern void *recallocarray(void *, size_t, size_t, size_t);"
541
542 [ ${HAVE_STRCASESTR} -eq 0 ] && \
543 echo "extern char *strcasestr(const char *, const char *);"
544
545 [ ${HAVE_STRLCAT} -eq 0 ] && \
546 echo "extern size_t strlcat(char *, const char *, size_t);"
547
548 [ ${HAVE_STRLCPY} -eq 0 ] && \
549 echo "extern size_t strlcpy(char *, const char *, size_t);"
550
551 [ ${HAVE_STRNDUP} -eq 0 ] && \
552 echo "extern char *strndup(const char *, size_t);"
553
554 [ ${HAVE_STRSEP} -eq 0 ] && \
555 echo "extern char *strsep(char **, const char *);"
556
557 [ ${HAVE_STRTONUM} -eq 0 ] && \
558 echo "extern long long strtonum(const char *, long long, long long, const char **);"
559
560 [ ${HAVE_VASPRINTF} -eq 0 ] && \
561 echo "extern int vasprintf(char **, const char *, va_list);"
562
563 echo "file config.h: written" 1>&2
564 echo "file config.h: written" 1>&3
565
566 # --- tests for Makefile.local -----------------------------------------
567
568 exec > Makefile.local
569
570 [ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
571 [ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
572 [ -z "${BIN_FROM_SBIN}" ] && BIN_FROM_SBIN="../bin"
573 [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
574 [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc"
575 [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
576
577 [ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs"
578 [ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"
579
580 [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
581 [ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
582 [ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
583 [ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
584
585 BUILD_TARGETS=
586 [ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="man.cgi"
587 [ ${BUILD_CATMAN} -gt 0 ] && \
588 BUILD_TARGETS="${BUILD_TARGETS} mandocd catman"
589 INSTALL_TARGETS=
590 [ ${INSTALL_LIBMANDOC} -gt 0 ] && INSTALL_TARGETS="lib-install"
591 [ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
592 [ ${BUILD_CATMAN} -gt 0 ] && \
593 INSTALL_TARGETS="${INSTALL_TARGETS} catman-install"
594
595 cat << __HEREDOC__
596 BUILD_TARGETS = ${BUILD_TARGETS}
597 INSTALL_TARGETS = ${INSTALL_TARGETS}
598 CC = ${CC}
599 CFLAGS = ${CFLAGS}
600 LDADD = ${LDADD}
601 LDFLAGS = ${LDFLAGS}
602 STATIC = ${STATIC}
603 PREFIX = ${PREFIX}
604 BINDIR = ${BINDIR}
605 SBINDIR = ${SBINDIR}
606 BIN_FROM_SBIN = ${BIN_FROM_SBIN}
607 INCLUDEDIR = ${INCLUDEDIR}
608 LIBDIR = ${LIBDIR}
609 MANDIR = ${MANDIR}
610 WWWPREFIX = ${WWWPREFIX}
611 HTDOCDIR = ${HTDOCDIR}
612 CGIBINDIR = ${CGIBINDIR}
613 BINM_APROPOS = ${BINM_APROPOS}
614 BINM_CATMAN = ${BINM_CATMAN}
615 BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
616 BINM_MAN = ${BINM_MAN}
617 BINM_SOELIM = ${BINM_SOELIM}
618 BINM_WHATIS = ${BINM_WHATIS}
619 MANM_MAN = ${MANM_MAN}
620 MANM_MANCONF = ${MANM_MANCONF}
621 MANM_MDOC = ${MANM_MDOC}
622 MANM_ROFF = ${MANM_ROFF}
623 MANM_EQN = ${MANM_EQN}
624 MANM_TBL = ${MANM_TBL}
625 INSTALL = ${INSTALL}
626 INSTALL_PROGRAM = ${INSTALL_PROGRAM}
627 INSTALL_LIB = ${INSTALL_LIB}
628 INSTALL_MAN = ${INSTALL_MAN}
629 INSTALL_DATA = ${INSTALL_DATA}
630 LN = ${LN}
631 __HEREDOC__
632
633 echo "file Makefile.local: written" 1>&2
634 echo "file Makefile.local: written" 1>&3
635
636 exit 0