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