Lines Matching +full:comp +full:- +full:config

5 # Copyright (c) 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
19 set -e
21 [ -w config.log ] && mv config.log config.log.old
22 [ -w config.h ] && mv config.h config.h.old
25 # 1 (stdout): config.h, Makefile.local
27 # 3: config.log
29 exec 3> config.log
30 echo "file config.log: writing..."
32 # --- default settings -------------------------------------------------
140 LN="ln -f"
142 # --- manual settings from configure.local -----------------------------
144 if [ -r ./configure.local ]; then
155 # --- tests functions --------------------------------------------------
161 [ -z "${3}" ] && return 1
176 ${COMP} -o test-${1} test-${1}.c ${3}
179 if ${COMP} -o "test-${1}" "${SOURCEDIR}/test-${1}.c" ${3} 1>&3 2>&3
190 if ./test-${1} 1>&3 2>&3; then
195 [ "${3}" = "-D_GNU_SOURCE" ] && NEED_GNU_SOURCE=1
196 [ "${3}" = "-D_OPENBSD_SOURCE" ] && NEED_OPENBSD_SOURCE=1
197 [ "${3}" = "-D_XPG4_2" ] && NEED_XPG4_2=1
198 [ "${3}" = "-lrt" ] && LD_NANOSLEEP="-lrt"
199 [ "${3}" = "-lsocket" ] && LD_RECVMSG="-lsocket"
200 [ "${3}" = "-lutil" ] && LD_OHASH="-lutil"
201 rm "test-${1}"
208 rm "test-${1}"
221 [ -n "${4}" ] && singletest "${1}" "${2}" "${4}" && return 0
226 # Select a UTF-8 locale.
228 [ -n "${HAVE_WCHAR}" ] && [ "${HAVE_WCHAR}" -eq 0 ] && return 0
231 UTF8_LOCALE=`locale -a | grep -i '^en_US\.UTF-*8$' | head -n 1`
232 if [ -z "${UTF8_LOCALE}" ]; then
233 UTF8_LOCALE=`locale -a | grep -i '\.UTF-*8' | head -n 1`
234 [ -n "${UTF8_LOCALE}" ] || return 1
242 # --- operating system -------------------------------------------------
244 if [ -n "${OSENUM}" ]; then
256 echo "tested operating system: ${OSDETECT} -> OSENUM=${OSENUM}" 1>&2
257 echo "tested operating system: ${OSDETECT} -> OSENUM=${OSENUM}" 1>&3
262 # --- compiler options -------------------------------------------------
264 DEFCFLAGS="-g -W -Wall -Wmissing-prototypes -Wstrict-prototypes -Wwrite-strings -Wno-unused-paramet…
266 if [ -n "${CFLAGS}" ]; then
267 COMP="${CC} ${CFLAGS} -Wno-unused -Werror"
269 COMP="${CC} ${DEFCFLAGS} -Wno-unused -Werror"
271 printf "%s" "tested ${CC} -W: " 1>&2
272 printf "%s" "testing ${CC} -W: " 1>&3
275 if [ -n "${CFLAGS}" ]; then
277 elif [ ${HAVE_WFLAG} -eq 0 ]; then
278 CFLAGS="-g"
286 COMP="${CC} ${CFLAGS}"
287 [ ${HAVE_WFLAG} -eq 0 ] || COMP="${COMP} -Wno-unused -Werror"
289 if [ -n "${STATIC}" ]; then
294 runtest noop STATIC -static || true
295 [ ${HAVE_STATIC} -eq 0 ] || STATIC="-static"
301 # --- tests for config.h ----------------------------------------------
303 # --- library functions ---
305 runtest cmsg CMSG "" "-D_XPG4_2" || true
306 runtest dirent-namlen DIRENT_NAMLEN || true
308 runtest be32toh SYS_ENDIAN -DSYS_ENDIAN || true
312 runtest getsubopt GETSUBOPT "" -D_GNU_SOURCE || true
316 runtest nanosleep NANOSLEEP "${LD_NANOSLEEP}" "-lrt" || true
323 runtest reallocarray REALLOCARRAY "" -D_OPENBSD_SOURCE || true
324 runtest recallocarray RECALLOCARRAY "" -D_OPENBSD_SOURCE || true
325 runtest recvmsg RECVMSG "${LD_RECVMSG}" "-lsocket" || true
326 runtest rewb-bsd REWB_BSD || true
327 runtest rewb-sysv REWB_SYSV || true
328 runtest strcasestr STRCASESTR "" -D_GNU_SOURCE || true
333 runtest strptime STRPTIME "" -D_GNU_SOURCE || true
335 runtest strtonum STRTONUM "" -D_OPENBSD_SOURCE || true
336 runtest vasprintf VASPRINTF "" -D_GNU_SOURCE || true
338 # --- fts ---
339 if [ "${1}" = "-depend" ]; then
348 elif runtest fts FTS_COMPARE_CONST -DFTS_COMPARE_CONST; then
354 # --- pager ---
356 if [ -n "${BINM_PAGER}" ]; then
358 elif less test-noop.c 1>/dev/null 2>&3; then
370 # --- tagging support in the pager ---
371 if ismanual "${BINM_PAGER} -T" LESS_T ${HAVE_LESS_T}; then
373 elif ${BINM_PAGER} -T /dev/null test-noop.c 1>/dev/null 2>&3; then
375 echo "tested ${BINM_PAGER} -T: yes" 1>&2
376 echo "tested ${BINM_PAGER} -T: yes" 1>&3
380 echo "tested ${BINM_PAGER} -T: no" 1>&2
381 echo "tested ${BINM_PAGER} -T: no" 1>&3
385 # --- wide character and locale support ---
387 runtest wchar WCHAR "-DUTF8_LOCALE=\"${UTF8_LOCALE}\"" \
388 "-D_GNU_SOURCE -DUTF8_LOCALE=\"${UTF8_LOCALE}\"" || true
396 # --- ohash ---
397 if [ "${1}" = "-depend" ]; then
403 runtest ohash OHASH "${LD_OHASH}" "-lutil" || true
405 if [ "${HAVE_OHASH}" -eq 0 ]; then
409 # --- required functions ---
410 if [ ${HAVE_ENDIAN} -eq 0 -a \
411 ${HAVE_SYS_ENDIAN} -eq 0 -a \
412 ${HAVE_NTOHL} -eq 0 ]; then
417 if [ "${HAVE_NANOSLEEP}" -eq 0 ]; then
422 if [ ${BUILD_CATMAN} -gt 0 -a "${HAVE_RECVMSG}" -eq 0 ]; then
428 if [ ${BUILD_CATMAN} -gt 0 -a "${HAVE_CMSG}" -eq 0 ]; then
434 [ "${FATAL}" -eq 0 ] || exit 1
436 # --- LDADD ---
437 LDADD="${LDADD} ${LD_NANOSLEEP} ${LD_RECVMSG} ${LD_OHASH} -lz"
442 # --- write config.h ---
444 exec > config.h
453 [ ${NEED_GNU_SOURCE} -eq 0 ] || echo "#define _GNU_SOURCE"
454 [ ${NEED_OPENBSD_SOURCE} -eq 0 ] || echo "#define _OPENBSD_SOURCE"
456 [ ${HAVE_GETLINE} -eq 0 -o \
457 ${HAVE_REALLOCARRAY} -eq 0 -o ${HAVE_RECALLOCARRAY} -eq 0 -o \
458 ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 -o \
459 ${HAVE_STRNDUP} -eq 0 ] \
461 [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include <stdarg.h>"
462 [ ${HAVE_GETLINE} -eq 0 ] && echo "#include <stdio.h>"
468 if [ ${DEBUG_MEMORY} -ne 0 ]; then
473 [ -n "${OSNAME}" ] && echo "#define OSNAME \"${OSNAME}\""
474 [ -n "${UTF8_LOCALE}" ] && echo "#define UTF8_LOCALE \"${UTF8_LOCALE}\""
475 [ -n "${READ_ALLOWED_PATH}" ] \
477 [ ${HAVE_ATTRIBUTE} -eq 0 ] && echo "#define __attribute__(x)"
478 [ ${HAVE_EFTYPE} -eq 0 ] && echo "#define EFTYPE EINVAL"
479 [ ${HAVE_O_DIRECTORY} -eq 0 ] && echo "#define O_DIRECTORY 0"
480 [ ${HAVE_PATH_MAX} -eq 0 ] && echo "#define PATH_MAX 4096"
481 if [ ${HAVE_ENDIAN} -eq 0 -a ${HAVE_SYS_ENDIAN} -eq 0 ]; then
530 if [ ${HAVE_ERR} -eq 0 ]; then
538 if [ ${HAVE_FTS} -eq 0 ]; then
541 if [ ${HAVE_GETLINE} -eq 0 ]; then
546 if [ ${HAVE_GETSUBOPT} -eq 0 ]; then
550 if [ ${HAVE_ISBLANK} -eq 0 ]; then
554 if [ ${HAVE_MKDTEMP} -eq 0 ]; then
558 if [ ${HAVE_MKSTEMPS} -eq 0 ]; then
562 if [ ${HAVE_OHASH} -eq 0 ]; then
565 if [ ${HAVE_PROGNAME} -eq 0 ]; then
571 if [ ${HAVE_REALLOCARRAY} -eq 0 ]; then
576 if [ ${HAVE_RECALLOCARRAY} -eq 0 ]; then
580 if [ ${HAVE_STRCASESTR} -eq 0 ]; then
584 if [ ${HAVE_STRINGLIST} -eq 0 ]; then
587 if [ ${HAVE_STRLCAT} -eq 0 ]; then
591 if [ ${HAVE_STRLCPY} -eq 0 ]; then
595 if [ ${HAVE_STRNDUP} -eq 0 ]; then
599 if [ ${HAVE_STRSEP} -eq 0 ]; then
603 if [ ${HAVE_STRTONUM} -eq 0 ]; then
607 if [ ${HAVE_VASPRINTF} -eq 0 ]; then
611 echo "file config.h: written" 1>&2
612 echo "file config.h: written" 1>&3
614 # --- tests for Makefile.local -----------------------------------------
618 [ -z "${BINDIR}" ] && BINDIR="${PREFIX}/bin"
619 [ -z "${SBINDIR}" ] && SBINDIR="${PREFIX}/sbin"
620 [ -z "${BIN_FROM_SBIN}" ] && BIN_FROM_SBIN="../bin"
621 [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc"
622 [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc"
623 [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man"
624 [ -z "${MISCDIR}" ] && MISCDIR="${PREFIX}/share/misc"
626 [ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs"
627 [ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin"
629 [ -z "${INSTALL_PROGRAM}" ] && INSTALL_PROGRAM="${INSTALL} -m 0555"
630 [ -z "${INSTALL_LIB}" ] && INSTALL_LIB="${INSTALL} -m 0444"
631 [ -z "${INSTALL_MAN}" ] && INSTALL_MAN="${INSTALL} -m 0444"
632 [ -z "${INSTALL_DATA}" ] && INSTALL_DATA="${INSTALL} -m 0444"
635 [ ${BUILD_CGI} -gt 0 ] && BUILD_TARGETS="man.cgi"
636 [ ${BUILD_CATMAN} -gt 0 ] && \
639 [ ${INSTALL_LIBMANDOC} -gt 0 ] && INSTALL_TARGETS="lib-install"
640 [ ${BUILD_CGI} -gt 0 ] && INSTALL_TARGETS="${INSTALL_TARGETS} cgi-install"
641 [ ${BUILD_CATMAN} -gt 0 ] && \
642 INSTALL_TARGETS="${INSTALL_TARGETS} catman-install"