]> git.cameronkatri.com Git - mandoc.git/blob - configure
While we do not recommend the idiom ".Fl Fl long" for long options
[mandoc.git] / configure
1 #!/bin/sh
2 #
3 # $Id: configure,v 1.73 2020/03/13 17:31:44 schwarze Exp $
4 #
5 # Copyright (c) 2014-2020 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=cc
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 [ "$1" == "-depend" ]; then
331 HAVE_FTS=0
332 HAVE_FTS_COMPARE_CONST=0
333 echo "tested fts: HAVE_FTS=0 (for make depend)" 1>&2
334 echo "tested fts: HAVE_FTS=0 (for make depend)" 1>&3
335 echo 1>&3
336 elif ismanual fts FTS ${HAVE_FTS}; then
337 HAVE_FTS_COMPARE_CONST=0
338 elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then
339 HAVE_FTS=1
340 else
341 runtest fts FTS || true
342 fi
343
344 if ismanual "less -T" LESS_T ${HAVE_LESS_T}; then
345 :
346 elif less -ET /dev/null test-noop.c 1>/dev/null 2>&3; then
347 HAVE_LESS_T=1
348 echo "tested less -T: yes" 1>&2
349 echo "tested less -T: yes" 1>&3
350 echo 1>&3
351 else
352 HAVE_LESS_T=0
353 echo "tested less -T: no" 1>&2
354 echo "tested less -T: no" 1>&3
355 echo 1>&3
356 fi
357
358 # --- wide character and locale support ---
359 if get_locale; then
360 singletest wchar WCHAR -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || \
361 runtest wchar WCHAR -D_GNU_SOURCE \
362 -DUTF8_LOCALE=\"${UTF8_LOCALE}\" || true
363 else
364 HAVE_WCHAR=0
365 echo "tested wchar: no (no UTF8_LOCALE)" 1>&2
366 echo "tested wchar: no (no UTF8_LOCALE)" 1>&3
367 echo 1>&3
368 fi
369
370 # --- nanosleep ---
371 if [ -n "${LD_NANOSLEEP}" ]; then
372 runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" || true
373 elif singletest nanosleep NANOSLEEP; then
374 :
375 elif runtest nanosleep NANOSLEEP "-lrt"; then
376 LD_NANOSLEEP="-lrt"
377 fi
378 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
379 echo "FATAL: nanosleep: no" 1>&2
380 echo "FATAL: nanosleep: no" 1>&3
381 exit 1
382 fi
383
384 if [ ${BUILD_CATMAN} -gt 0 ]; then
385 # --- recvmsg ---
386 if [ -n "${LD_RECVMSG}" ]; then
387 runtest recvmsg RECVMSG "${LD_RECVMSG}" || true
388 elif singletest recvmsg RECVMSG; then
389 :
390 elif runtest recvmsg RECVMSG "-lsocket"; then
391 LD_RECVMSG="-lsocket"
392 fi
393 if [ "${HAVE_RECVMSG}" -eq 0 ]; then
394 echo "FATAL: recvmsg: no" 1>&2
395 echo "FATAL: recvmsg: no" 1>&3
396 echo "Without recvmsg(2), you cannot BUILD_CATMAN." 1>&2
397 exit 1
398 fi
399
400 # --- cmsg ---
401 if singletest cmsg CMSG; then
402 :
403 elif runtest cmsg CMSG "-D_XPG4_2"; then
404 HAVE_CMSG_XPG42=1
405 fi
406 if [ "${HAVE_CMSG}" -eq 0 ]; then
407 echo "FATAL: cmsg: no" 1>&2
408 echo "FATAL: cmsg: no" 1>&3
409 echo "Without CMSG_FIRSTHDR(3), you cannot BUILD_CATMAN." 1>&2
410 exit 1
411 fi
412 fi
413
414 # --- ohash ---
415 if [ "$1" == "-depend" ]; then
416 HAVE_OHASH=0
417 echo "tested ohash: HAVE_OHASH=0 (for make depend)" 1>&2
418 echo "tested ohash: HAVE_OHASH=0 (for make depend)" 1>&3
419 echo 1>&3
420 elif ismanual ohash OHASH "${HAVE_OHASH}"; then
421 :
422 elif [ -n "${LD_OHASH}" ]; then
423 runtest ohash OHASH "${LD_OHASH}" || true
424 elif singletest ohash OHASH; then
425 :
426 elif runtest ohash OHASH "-lutil"; then
427 LD_OHASH="-lutil"
428 fi
429 if [ "${HAVE_OHASH}" -eq 0 ]; then
430 LD_OHASH=
431 fi
432
433 # --- LDADD ---
434 LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
435 echo "selected LDADD=\"${LDADD}\"" 1>&2
436 echo "selected LDADD=\"${LDADD}\"" 1>&3
437 echo 1>&3
438
439 # --- write config.h ---
440
441 exec > config.h
442
443 cat << __HEREDOC__
444 #ifdef __cplusplus
445 #error "Do not use C++. See the INSTALL file."
446 #endif
447
448 #if !defined(__GNUC__) || (__GNUC__ < 4)
449 #define __attribute__(x)
450 #endif
451
452 __HEREDOC__
453
454 [ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
455 [ ${NEED_OPENBSD_SOURCE} -eq 0 ] || echo "#define _OPENBSD_SOURCE"
456
457 [ ${HAVE_GETLINE} -eq 0 -o \
458 ${HAVE_REALLOCARRAY} -eq 0 -o ${HAVE_RECALLOCARRAY} -eq 0 -o \
459 ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o \
460 ${HAVE_STRNDUP} -eq 0 ] \
461 && echo "#include <sys/types.h>"
462 [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
463 [ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
464
465 echo
466 echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\""
467 echo "#define MANPATH_BASE \"${MANPATH_BASE}\""
468 echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\""
469 echo "#define OSENUM ${OSENUM}"
470 [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
471 [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
472 [ -n "${HOMEBREWDIR}" ] && echo "#define HOMEBREWDIR \"${HOMEBREWDIR}\""
473 [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
474 [ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
475 [ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"
476 if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then
477 echo "#define be32toh ntohl"
478 echo "#define htobe32 htonl"
479 fi
480
481 cat << __HEREDOC__
482 #define HAVE_CMSG_XPG42 ${HAVE_CMSG_XPG42}
483 #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN}
484 #define HAVE_ENDIAN ${HAVE_ENDIAN}
485 #define HAVE_ERR ${HAVE_ERR}
486 #define HAVE_FTS ${HAVE_FTS}
487 #define HAVE_FTS_COMPARE_CONST ${HAVE_FTS_COMPARE_CONST}
488 #define HAVE_GETLINE ${HAVE_GETLINE}
489 #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT}
490 #define HAVE_ISBLANK ${HAVE_ISBLANK}
491 #define HAVE_LESS_T ${HAVE_LESS_T}
492 #define HAVE_MKDTEMP ${HAVE_MKDTEMP}
493 #define HAVE_NTOHL ${HAVE_NTOHL}
494 #define HAVE_PLEDGE ${HAVE_PLEDGE}
495 #define HAVE_PROGNAME ${HAVE_PROGNAME}
496 #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY}
497 #define HAVE_RECALLOCARRAY ${HAVE_RECALLOCARRAY}
498 #define HAVE_REWB_BSD ${HAVE_REWB_BSD}
499 #define HAVE_REWB_SYSV ${HAVE_REWB_SYSV}
500 #define HAVE_SANDBOX_INIT ${HAVE_SANDBOX_INIT}
501 #define HAVE_STRCASESTR ${HAVE_STRCASESTR}
502 #define HAVE_STRINGLIST ${HAVE_STRINGLIST}
503 #define HAVE_STRLCAT ${HAVE_STRLCAT}
504 #define HAVE_STRLCPY ${HAVE_STRLCPY}
505 #define HAVE_STRNDUP ${HAVE_STRNDUP}
506 #define HAVE_STRPTIME ${HAVE_STRPTIME}
507 #define HAVE_STRSEP ${HAVE_STRSEP}
508 #define HAVE_STRTONUM ${HAVE_STRTONUM}
509 #define HAVE_SYS_ENDIAN ${HAVE_SYS_ENDIAN}
510 #define HAVE_VASPRINTF ${HAVE_VASPRINTF}
511 #define HAVE_WCHAR ${HAVE_WCHAR}
512 #define HAVE_OHASH ${HAVE_OHASH}
513
514 #define BINM_APROPOS "${BINM_APROPOS}"
515 #define BINM_CATMAN "${BINM_CATMAN}"
516 #define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}"
517 #define BINM_MAN "${BINM_MAN}"
518 #define BINM_SOELIM "${BINM_SOELIM}"
519 #define BINM_WHATIS "${BINM_WHATIS}"
520
521 __HEREDOC__
522
523 if [ ${HAVE_ERR} -eq 0 ]; then
524 echo "extern void err(int, const char *, ...);"
525 echo "extern void errx(int, const char *, ...);"
526 echo "extern void warn(const char *, ...);"
527 echo "extern void warnx(const char *, ...);"
528 fi
529
530 [ ${HAVE_GETLINE} -eq 0 ] && \
531 echo "extern ssize_t getline(char **, size_t *, FILE *);"
532
533 [ ${HAVE_GETSUBOPT} -eq 0 ] && \
534 echo "extern int getsubopt(char **, char * const *, char **);"
535
536 [ ${HAVE_ISBLANK} -eq 0 ] && \
537 echo "extern int isblank(int);"
538
539 [ ${HAVE_MKDTEMP} -eq 0 ] && \
540 echo "extern char *mkdtemp(char *);"
541
542 if [ ${HAVE_PROGNAME} -eq 0 ]; then
543 echo "extern const char *getprogname(void);"
544 echo "extern void setprogname(const char *);"
545 fi
546
547 [ ${HAVE_REALLOCARRAY} -eq 0 ] && \
548 echo "extern void *reallocarray(void *, size_t, size_t);"
549
550 [ ${HAVE_RECALLOCARRAY} -eq 0 ] && \
551 echo "extern void *recallocarray(void *, size_t, size_t, size_t);"
552
553 [ ${HAVE_STRCASESTR} -eq 0 ] && \
554 echo "extern char *strcasestr(const char *, const char *);"
555
556 [ ${HAVE_STRLCAT} -eq 0 ] && \
557 echo "extern size_t strlcat(char *, const char *, size_t);"
558
559 [ ${HAVE_STRLCPY} -eq 0 ] && \
560 echo "extern size_t strlcpy(char *, const char *, size_t);"
561
562 [ ${HAVE_STRNDUP} -eq 0 ] && \
563 echo "extern char *strndup(const char *, size_t);"
564
565 [ ${HAVE_STRSEP} -eq 0 ] && \
566 echo "extern char *strsep(char **, const char *);"
567
568 [ ${HAVE_STRTONUM} -eq 0 ] && \
569 echo "extern long long strtonum(const char *, long long, long long, const char **);"
570
571 [ ${HAVE_VASPRINTF} -eq 0 ] && \
572 echo "extern int vasprintf(char **, const char *, va_list);"
573
574 echo "file config.h: written" 1>&2
575 echo "file config.h: written" 1>&3
576
577 # --- tests for Makefile.local -----------------------------------------
578
579 exec > Makefile.local
580
581 [ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
582 [ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
583 [ -z "${BIN_FROM_SBIN}" ] && BIN_FROM_SBIN="../bin"
584 [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
585 [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc"
586 [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
587
588 [ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs"
589 [ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"
590
591 [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
592 [ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
593 [ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
594 [ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
595
596 BUILD_TARGETS=
597 [ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="man.cgi"
598 [ ${BUILD_CATMAN} -gt 0 ] && \
599 BUILD_TARGETS="${BUILD_TARGETS} mandocd catman"
600 INSTALL_TARGETS=
601 [ ${INSTALL_LIBMANDOC} -gt 0 ] && INSTALL_TARGETS="lib-install"
602 [ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
603 [ ${BUILD_CATMAN} -gt 0 ] && \
604 INSTALL_TARGETS="${INSTALL_TARGETS} catman-install"
605
606 cat << __HEREDOC__
607 BUILD_TARGETS = ${BUILD_TARGETS}
608 INSTALL_TARGETS = ${INSTALL_TARGETS}
609 CC = ${CC}
610 CFLAGS = ${CFLAGS}
611 LDADD = ${LDADD}
612 LDFLAGS = ${LDFLAGS}
613 STATIC = ${STATIC}
614 PREFIX = ${PREFIX}
615 BINDIR = ${BINDIR}
616 SBINDIR = ${SBINDIR}
617 BIN_FROM_SBIN = ${BIN_FROM_SBIN}
618 INCLUDEDIR = ${INCLUDEDIR}
619 LIBDIR = ${LIBDIR}
620 MANDIR = ${MANDIR}
621 WWWPREFIX = ${WWWPREFIX}
622 HTDOCDIR = ${HTDOCDIR}
623 CGIBINDIR = ${CGIBINDIR}
624 BINM_APROPOS = ${BINM_APROPOS}
625 BINM_CATMAN = ${BINM_CATMAN}
626 BINM_MAKEWHATIS = ${BINM_MAKEWHATIS}
627 BINM_MAN = ${BINM_MAN}
628 BINM_SOELIM = ${BINM_SOELIM}
629 BINM_WHATIS = ${BINM_WHATIS}
630 MANM_MAN = ${MANM_MAN}
631 MANM_MANCONF = ${MANM_MANCONF}
632 MANM_MDOC = ${MANM_MDOC}
633 MANM_ROFF = ${MANM_ROFF}
634 MANM_EQN = ${MANM_EQN}
635 MANM_TBL = ${MANM_TBL}
636 INSTALL = ${INSTALL}
637 INSTALL_PROGRAM = ${INSTALL_PROGRAM}
638 INSTALL_LIB = ${INSTALL_LIB}
639 INSTALL_MAN = ${INSTALL_MAN}
640 INSTALL_DATA = ${INSTALL_DATA}
641 LN = ${LN}
642 __HEREDOC__
643
644 echo "file Makefile.local: written" 1>&2
645 echo "file Makefile.local: written" 1>&3
646
647 exit 0