=================================================================== RCS file: /cvs/mandoc/configure,v retrieving revision 1.25 retrieving revision 1.38 diff -u -p -r1.25 -r1.38 --- mandoc/configure 2015/03/27 00:18:14 1.25 +++ mandoc/configure 2016/05/18 21:37:04 1.38 @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2014, 2015 Ingo Schwarze +# Copyright (c) 2014, 2015, 2016 Ingo Schwarze # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -16,8 +16,8 @@ set -e -[ -e config.log ] && mv config.log config.log.old -[ -e config.h ] && mv config.h config.h.old +[ -w config.log ] && mv config.log config.log.old +[ -w config.h ] && mv config.h config.h.old # Output file descriptor usage: # 1 (stdout): config.h, Makefile.local @@ -36,21 +36,29 @@ OSNAME= CC=`printf "all:\\n\\t@echo \\\$(CC)\\n" | make -f -` CFLAGS="-g -W -Wall -Wstrict-prototypes -Wno-unused-parameter -Wwrite-strings" -DBLIB= +LDADD= +LD_OHASH= +LD_SQLITE3= STATIC="-static" BUILD_DB=1 BUILD_CGI=0 HAVE_DIRENT_NAMLEN= -HAVE_FGETLN= +HAVE_ERR= HAVE_FTS= +HAVE_GETLINE= HAVE_GETSUBOPT= HAVE_ISBLANK= HAVE_MKDTEMP= HAVE_MMAP= +HAVE_PLEDGE= +HAVE_PROGNAME= HAVE_REALLOCARRAY= +HAVE_REWB_BSD= +HAVE_REWB_SYSV= HAVE_STRCASESTR= +HAVE_STRINGLIST= HAVE_STRLCAT= HAVE_STRLCPY= HAVE_STRPTIME= @@ -70,7 +78,6 @@ SBINDIR= INCLUDEDIR= LIBDIR= MANDIR= -EXAMPLEDIR= HOMEBREWDIR= WWWPREFIX="/var/www" @@ -78,9 +85,10 @@ HTDOCDIR= CGIBINDIR= BINM_APROPOS="apropos" +BINM_MAKEWHATIS="makewhatis" BINM_MAN="man" +BINM_SOELIM="soelim" BINM_WHATIS="whatis" -BINM_MAKEWHATIS="makewhatis" MANM_MAN="man" MANM_MANCONF="man.conf" MANM_MDOC="mdoc" @@ -96,7 +104,7 @@ INSTALL_DATA= # --- manual settings from configure.local ----------------------------- -if [ -e ./configure.local ]; then +if [ -r ./configure.local ]; then echo "configure.local: reading..." 1>&2 echo "configure.local: reading..." 1>&3 cat ./configure.local 1>&3 @@ -169,14 +177,20 @@ runtest() { # --- library functions --- runtest dirent-namlen DIRENT_NAMLEN || true -runtest fgetln FGETLN || true +runtest err ERR || true runtest fts FTS || true +runtest getline GETLINE || true runtest getsubopt GETSUBOPT || true runtest isblank ISBLANK || true runtest mkdtemp MKDTEMP || true runtest mmap MMAP || true +runtest pledge PLEDGE || true +runtest progname PROGNAME || true runtest reallocarray REALLOCARRAY || true +runtest rewb-bsd REWB_BSD || true +runtest rewb-sysv REWB_SYSV || true runtest strcasestr STRCASESTR || true +runtest stringlist STRINGLIST || true runtest strlcat STRLCAT || true runtest strlcpy STRLCPY || true runtest strptime STRPTIME || true @@ -186,28 +200,32 @@ runtest vasprintf VASPRINTF || true runtest wchar WCHAR || true # --- sqlite3 --- -DETECTLIB= if [ ${BUILD_DB} -eq 0 ]; then echo "BUILD_DB=0 (manual)" 1>&2 echo "BUILD_DB=0 (manual)" 1>&3 echo 1>&3 HAVE_SQLITE3=0 elif ismanual sqlite3 "${HAVE_SQLITE3}"; then - DETECTLIB="-lsqlite3" -elif [ -n "${DBLIB}" ]; then - runtest sqlite3 SQLITE3 "${DBLIB}" || true + if [ -z "${LD_SQLITE3}" ]; then + LD_SQLITE3="-lsqlite3" + fi +elif [ -n "${LD_SQLITE3}" ]; then + runtest sqlite3 SQLITE3 "${LD_SQLITE3}" || true elif singletest sqlite3 SQLITE3 "-lsqlite3"; then - DETECTLIB="-lsqlite3" + LD_SQLITE3="-lsqlite3" elif runtest sqlite3 SQLITE3 \ "-I/usr/local/include -L/usr/local/lib -lsqlite3"; then - DETECTLIB="-L/usr/local/lib -lsqlite3" + LD_SQLITE3="-L/usr/local/lib -lsqlite3" CFLAGS="${CFLAGS} -I/usr/local/include" fi -if [ ${BUILD_DB} -gt 0 -a ${HAVE_SQLITE3} -eq 0 ]; then - echo "BUILD_DB=0 (no sqlite3)" 1>&2 - echo "BUILD_DB=0 (no sqlite3)" 1>&3 - echo 1>&3 - BUILD_DB=0 +if [ ${HAVE_SQLITE3} -eq 0 ]; then + LD_SQLITE3= + if [ ${BUILD_DB} -gt 0 ]; then + echo "BUILD_DB=0 (no sqlite3)" 1>&2 + echo "BUILD_DB=0 (no sqlite3)" 1>&3 + echo 1>&3 + BUILD_DB=0 + fi fi # --- sqlite3_errstr --- @@ -215,35 +233,30 @@ if [ ${BUILD_DB} -eq 0 ]; then HAVE_SQLITE3_ERRSTR=1 elif ismanual sqlite3_errstr "${HAVE_SQLITE3_ERRSTR}"; then : -elif [ -n "${DBLIB}" ]; then - runtest sqlite3_errstr SQLITE3_ERRSTR "${DBLIB}" || true else - runtest sqlite3_errstr SQLITE3_ERRSTR "${DETECTLIB}" || true + runtest sqlite3_errstr SQLITE3_ERRSTR "${LD_SQLITE3}" || true fi # --- ohash --- -if [ ${BUILD_DB} -eq 0 ]; then - HAVE_OHASH=1 -elif ismanual ohash "${HAVE_OHASH}"; then +if ismanual ohash "${HAVE_OHASH}"; then : -elif [ -n "${DBLIB}" ]; then - runtest ohash OHASH "${DBLIB}" || true +elif [ -n "${LD_OHASH}" ]; then + runtest ohash OHASH "${LD_OHASH}" || true elif singletest ohash OHASH; then : elif runtest ohash OHASH "-lutil"; then - DETECTLIB="${DETECTLIB} -lutil" + LD_OHASH="-lutil" fi - -# --- DBLIB --- -if [ ${BUILD_DB} -eq 0 ]; then - DBLIB= -elif [ -z "${DBLIB}" ]; then - DBLIB="${DETECTLIB}" - echo "DBLIB=\"${DBLIB}\"" 1>&2 - echo "DBLIB=\"${DBLIB}\"" 1>&3 - echo 1>&3 +if [ "${HAVE_OHASH}" -eq 0 ]; then + LD_OHASH= fi +# --- LDADD --- +LDADD="${LDADD} ${LD_SQLITE3} ${LD_OHASH} -lz" +echo "LDADD=\"${LDADD}\"" 1>&2 +echo "LDADD=\"${LDADD}\"" 1>&3 +echo 1>&3 + # --- manpath --- if ismanual manpath "${HAVE_MANPATH}"; then : @@ -264,6 +277,10 @@ fi exec > config.h cat << __HEREDOC__ +#ifdef __cplusplus +#error "Do not use C++. See the INSTALL file." +#endif + #ifndef MANDOC_CONFIG_H #define MANDOC_CONFIG_H @@ -273,11 +290,11 @@ cat << __HEREDOC__ __HEREDOC__ -[ ${HAVE_FGETLN} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \ +[ ${HAVE_GETLINE} -eq 0 -o ${HAVE_REALLOCARRAY} -eq 0 -o \ ${HAVE_STRLCAT} -eq 0 -o ${HAVE_STRLCPY} -eq 0 ] \ && echo "#include " [ ${HAVE_VASPRINTF} -eq 0 ] && echo "#include " -[ ${HAVE_FGETLN} -eq 0 ] && echo "#include " +[ ${HAVE_GETLINE} -eq 0 ] && echo "#include " echo echo "#define MAN_CONF_FILE \"/etc/${MANM_MANCONF}\"" @@ -287,14 +304,20 @@ echo "#define MANPATH_DEFAULT \"${MANPATH_DEFAULT}\"" cat << __HEREDOC__ #define HAVE_DIRENT_NAMLEN ${HAVE_DIRENT_NAMLEN} -#define HAVE_FGETLN ${HAVE_FGETLN} +#define HAVE_ERR ${HAVE_ERR} #define HAVE_FTS ${HAVE_FTS} +#define HAVE_GETLINE ${HAVE_GETLINE} #define HAVE_GETSUBOPT ${HAVE_GETSUBOPT} #define HAVE_ISBLANK ${HAVE_ISBLANK} #define HAVE_MKDTEMP ${HAVE_MKDTEMP} #define HAVE_MMAP ${HAVE_MMAP} +#define HAVE_PLEDGE ${HAVE_PLEDGE} +#define HAVE_PROGNAME ${HAVE_PROGNAME} #define HAVE_REALLOCARRAY ${HAVE_REALLOCARRAY} +#define HAVE_REWB_BSD ${HAVE_REWB_BSD} +#define HAVE_REWB_SYSV ${HAVE_REWB_SYSV} #define HAVE_STRCASESTR ${HAVE_STRCASESTR} +#define HAVE_STRINGLIST ${HAVE_STRINGLIST} #define HAVE_STRLCAT ${HAVE_STRLCAT} #define HAVE_STRLCPY ${HAVE_STRLCPY} #define HAVE_STRPTIME ${HAVE_STRPTIME} @@ -308,30 +331,23 @@ cat << __HEREDOC__ #define HAVE_MANPATH ${HAVE_MANPATH} #define BINM_APROPOS "${BINM_APROPOS}" +#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}" #define BINM_MAN "${BINM_MAN}" +#define BINM_SOELIM "${BINM_SOELIM}" #define BINM_WHATIS "${BINM_WHATIS}" -#define BINM_MAKEWHATIS "${BINM_MAKEWHATIS}" -#if !defined(__BEGIN_DECLS) -# ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# else -# define __BEGIN_DECLS -# endif -#endif -#if !defined(__END_DECLS) -# ifdef __cplusplus -# define __END_DECLS } -# else -# define __END_DECLS -# endif -#endif - __HEREDOC__ -[ ${HAVE_FGETLN} -eq 0 ] && \ - echo "extern char *fgetln(FILE *, size_t *);" +if [ ${HAVE_ERR} -eq 0 ]; then + echo "extern void err(int, const char *, ...);" + echo "extern void errx(int, const char *, ...);" + echo "extern void warn(const char *, ...);" + echo "extern void warnx(const char *, ...);" +fi +[ ${HAVE_GETLINE} -eq 0 ] && \ + echo "extern ssize_t getline(char **, size_t *, FILE *);" + [ ${HAVE_GETSUBOPT} -eq 0 ] && \ echo "extern int getsubopt(char **, char * const *, char **);" @@ -341,6 +357,11 @@ __HEREDOC__ [ ${HAVE_MKDTEMP} -eq 0 ] && \ echo "extern char *mkdtemp(char *);" +if [ ${HAVE_PROGNAME} -eq 0 ]; then + echo "extern const char *getprogname(void);" + echo "extern void setprogname(const char *);" +fi + [ ${HAVE_REALLOCARRAY} -eq 0 ] && \ echo "extern void *reallocarray(void *, size_t, size_t);" @@ -380,7 +401,6 @@ exec > Makefile.local [ -z "${INCLUDEDIR}" ] && INCLUDEDIR="${PREFIX}/include/mandoc" [ -z "${LIBDIR}" ] && LIBDIR="${PREFIX}/lib/mandoc" [ -z "${MANDIR}" ] && MANDIR="${PREFIX}/man" -[ -z "${EXAMPLEDIR}" ] && EXAMPLEDIR="${PREFIX}/share/examples/mandoc" [ -z "${HTDOCDIR}" ] && HTDOCDIR="${WWWPREFIX}/htdocs" [ -z "${CGIBINDIR}" ] && CGIBINDIR="${WWWPREFIX}/cgi-bin" @@ -407,7 +427,7 @@ BUILD_TARGETS = ${BUILD_TARGETS} INSTALL_TARGETS = ${INSTALL_TARGETS} CC = ${CC} CFLAGS = ${CFLAGS} -DBLIB = ${DBLIB} +LDADD = ${LDADD} STATIC = ${STATIC} PREFIX = ${PREFIX} BINDIR = ${BINDIR} @@ -415,14 +435,14 @@ SBINDIR = ${SBINDIR} INCLUDEDIR = ${INCLUDEDIR} LIBDIR = ${LIBDIR} MANDIR = ${MANDIR} -EXAMPLEDIR = ${EXAMPLEDIR} WWWPREFIX = ${WWWPREFIX} HTDOCDIR = ${HTDOCDIR} CGIBINDIR = ${CGIBINDIR} BINM_APROPOS = ${BINM_APROPOS} +BINM_MAKEWHATIS = ${BINM_MAKEWHATIS} BINM_MAN = ${BINM_MAN} +BINM_SOELIM = ${BINM_SOELIM} BINM_WHATIS = ${BINM_WHATIS} -BINM_MAKEWHATIS = ${BINM_MAKEWHATIS} MANM_MAN = ${MANM_MAN} MANM_MANCONF = ${MANM_MANCONF} MANM_MDOC = ${MANM_MDOC}