Imported Upstream version 2.9.4
[platform/upstream/man-db.git] / configure.ac
index 1543adc..f4fe224 100644 (file)
@@ -2,130 +2,48 @@ dnl Process this file with autoconf to produce a configure script.
 m4_pattern_forbid([^MAN_])
 
 # Initialise and check we're in the correct directory.
-AC_INIT([man-db], [2.6.3], [cjwatson@debian.org])
-AC_CONFIG_AUX_DIR([tools])
-AM_INIT_AUTOMAKE([1.10 -Wall -Wno-override -Werror foreign dist-xz no-dist-gzip])
+AC_INIT([man-db], [2.9.4], [cjwatson@debian.org])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([1.11 -Wall -Wno-override -Werror foreign dist-xz no-dist-gzip parallel-tests])
 AM_MAINTAINER_MODE
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-AC_PREREQ([2.59])
+AM_SILENT_RULES([yes])
+AC_PREREQ([2.63])
 AC_CONFIG_SRCDIR([src/man.c])
 AC_GNU_SOURCE
-AM_PROG_AR
-LT_INIT([disable-static])
-
-if test ! -f "$srcdir/gnulib/po/Makefile.in.in"; then
-       AC_MSG_ERROR([you must run ./autogen.sh before ./configure when building from revision control])
-fi
+MAN_TAR_SORT_NAME
 
 AC_CONFIG_HEADER([config.h])
 AC_CANONICAL_HOST
 
 # Define below date and version information to be put into man pages etc.
-date=2012-09-17
+date=2021-02-08
 AC_SUBST([date])dnl
 roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'`
 AC_SUBST([roff_version])dnl
 
+# Explicitly check for pkg-config early on, since otherwise the conditional
+# calls in MAN_ARG_SYSTEMDTMPFILESDIR and MAN_ARG_SYSTEMDSYSTEMUNITDIR are
+# problematic.
+PKG_PROG_PKG_CONFIG
+
 # We have to be a bit naughty here and supply options.
 # The autoconf literature states that only features that can be separately
 # 'built' should use --enable and friends. Oh well...
-AC_ARG_ENABLE([setuid],
-[AS_HELP_STRING([--enable-setuid[=ARG]], [install man setuid to user ARG [ARG=man]])
-AS_HELP_STRING([--disable-setuid], [don't install man setuid])],
-         [if test "$enableval" = "yes" 
-          then
-               enableval=man
-          fi
-          if test "$enableval" = "no" 
-          then
-               man_owner=
-               man_mode="755"
-               AC_MSG_NOTICE([Man will not be installed setuid])
-          else
-               man_owner=$enableval
-               man_mode="4755"
-               AC_MSG_NOTICE([Man will be installed setuid $enableval])
-               AC_DEFINE_UNQUOTED([SECURE_MAN_UID], ["$man_owner"],
-                                  [Define as the setuid owner of man or undefine if not installing setuid.])
-          fi],
-         [man_owner=man
-          man_mode="4755"
-          AC_DEFINE_UNQUOTED([SECURE_MAN_UID], ["$man_owner"])])
-AC_ARG_ENABLE([undoc],
-[AS_HELP_STRING([--enable-undoc=COMMAND], [suggest COMMAND for missing manual pages])],
-       [if test "$enableval" = "yes" || test "$enableval" = "no"
-        then
-               AC_MSG_ERROR([--enable-undoc requires an argument])
-        else
-               AC_MSG_NOTICE([Suggesting '$enableval' for missing manual pages])
-               AC_DEFINE_UNQUOTED([UNDOC_COMMAND], ["$enableval"],
-                                  [Define as the name of a command you want to suggest when a non-existent page is requested.])
-        fi])
-AC_ARG_WITH([device],
-[AS_HELP_STRING([--with-device=DEVICE], [use nroff with the output device DEVICE])],
-       [if test "$withval" = "yes" || test "$withval" = "no" 
-        then
-               AC_MSG_ERROR([--with-device requires an argument])
-        else
-               nroff_device=" -T$withval"
-        fi])
-AC_ARG_WITH([db],
-[AS_HELP_STRING([--with-db=LIBRARY], [use database library LIBRARY (db5, db4, db3, db2, db1, db, gdbm, ndbm)])],
-       [if test "$withval" = "yes" || test "$withval" = "no" 
-        then
-               AC_MSG_ERROR([--with-db requires an argument])
-        else
-               db=$withval
-        fi],
-       [: ${db=no}])
-AC_ARG_WITH([config-file],
-[AS_HELP_STRING([--with-config-file=CF], [use config file CF [CF=SYSCONFDIR/man_db.conf]])],
-       [if test "$withval" = "yes" || test "$withval" = "no"
-        then
-               AC_MSG_ERROR([--with-config-file requires an argument])
-        else
-               config_file=$withval
-        fi],
-       [: ${config_file=\$\{sysconfdir\}/man_db.conf}])
-config_file_basename=${withval##*/}
-config_file_dirname=`AS_DIRNAME(["$config_file"])`
-AC_ARG_WITH([sections],
-[AS_HELP_STRING([--with-sections=SECTIONS], [use manual page sections SECTIONS @<:@1 n l 8 3 0 2 5 4 9 6 7@:>@])],
-       [if test "$withval" = "yes" || test "$withval" = "no"
-        then
-               AC_MSG_ERROR([--with-sections requires an argument])
-        else
-               sections="$withval"
-        fi],
-       [: ${sections=1 n l 8 3 2 5 4 9 6 7}])
-AC_ARG_ENABLE([automatic-create],
-[AS_HELP_STRING([--enable-automatic-create], [allow man to create user databases on the fly])],
-       [if test "$enableval" = "yes"
-        then
-               AC_DEFINE([MAN_DB_CREATES], [1], [Allow man to create user databases on the fly.])
-        fi])
-AC_ARG_ENABLE([automatic-update],
-[AS_HELP_STRING([--disable-automatic-update], [don't allow man to update databases on the fly])],
-       [if test "$enableval" = "yes"
-        then
-               AC_DEFINE([MAN_DB_UPDATES], [1], [Allow man to update databases on the fly.])
-        fi],
-       [AC_DEFINE([MAN_DB_UPDATES], [1], [Allow man to update databases on the fly.])])
-AC_ARG_ENABLE([cats],
-[AS_HELP_STRING([--disable-cats], [don't allow man to create/update cat files])],
-       [if test "$enableval" = "yes"
-        then
-               AC_DEFINE([MAN_CATS], [1], [Allow man to create/update cat files.])
-        fi],
-       [AC_DEFINE([MAN_CATS], [1], [Allow man to create/update cat files.])])
-
-# Finish the argument parsing.
-AC_SUBST([man_owner])dnl
-AC_SUBST([man_mode])dnl
-AC_SUBST([config_file])dnl
-AC_SUBST([config_file_basename])dnl
-AC_SUBST([config_file_dirname])dnl
-AC_SUBST([sections])dnl
+MAN_ARG_CACHE_OWNER
+MAN_ARG_SETUID
+MAN_ARG_UNDOC
+MAN_ARG_DEVICE
+MAN_ARG_DB
+MAN_ARG_CONFIG_FILE
+MAN_ARG_SECTIONS
+MAN_ARG_AUTOMATIC_CREATE
+MAN_ARG_AUTOMATIC_UPDATE
+MAN_ARG_CATS
+MAN_ARG_OVERRIDE_DIR
+MAN_ARG_SYSTEMDTMPFILESDIR
+MAN_ARG_SYSTEMDSYSTEMUNITDIR
+MAN_ARG_MANDIRS
+MAN_ARG_MANUAL
 
 # Check $PATH for the following programs and append suitable options.
 AC_PROG_CC
@@ -143,26 +61,31 @@ case $host_os in
                CFLAGS="$CFLAGS -YPOSIX"
                ;;
 esac
-if test "$GCC" = yes
-then
-       gl_WARN_ADD([-W], [CFLAGS])
-       gl_WARN_ADD([-Wpointer-arith], [CFLAGS])
-       gl_WARN_ADD([-Wwrite-strings], [CFLAGS])
-       gl_WARN_ADD([-Wstrict-prototypes], [CFLAGS])
-       gl_WARN_ADD([-Wshadow], [CFLAGS])
-       gl_WARN_ADD([-Wformat-security], [CFLAGS])
-       gl_WARN_ADD([-Wredundant-decls], [CFLAGS])
-       gl_WARN_ADD([-Wno-missing-field-initializers], [CFLAGS])
-fi
+
+# Enable all reasonable GCC warnings.
+gl_MANYWARN_ALL_GCC([warnings])
+nw=
+nw="$nw -Wsystem-headers"
+nw="$nw -Wmissing-field-initializers"
+nw="$nw -Winline"
+gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
+for w in $warnings; do
+       gl_WARN_ADD([$w])
+done
+gl_WARN_ADD([-Wno-missing-field-initializers])
+# Disable use of VLAs by Gnulib to avoid tripping over -Wvla.
+AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs.])
+
 AC_PROG_INSTALL
 AC_PROG_LN_S
+AM_PROG_AR
+LT_INIT([disable-static])
 AC_CHECK_PROGS([cat], [cat])
 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
 test -n "$browser" && browser="exec $browser"
 AC_CHECK_PROGS([tr], [tr])
 AC_CHECK_PROGS([grep], [grep])
 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
-test -n "$pager" && pager="$pager -s"
 
 # Define below (in list of preference) *roff macros to check for.
 macros="andoc an doc"
@@ -218,7 +141,7 @@ dnl         nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
        else
                AC_MSG_RESULT([ambiguous])
                AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
-       fi 
+       fi
 else
        AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
        nroff="(nroff not installed)"
@@ -275,6 +198,31 @@ then
 else
        troff="(troff not installed)"
 fi
+dnl We want to end up with "-" written as "\-" in manual pages.  This
+dnl requires additional \-escaping corresponding to the following quote
+dnl removal steps:
+dnl   1) the following sed command
+dnl   2) the following assignment
+dnl   2) sed running on the substituted version of man/replace.sin.in
+troff_as_troff_input=`echo "$troff" | sed 's/-/\\\\\\\\-/g'`
+AC_SUBST([troff_as_troff_input])
+
+if test -n "$nroff"
+then
+       AC_CACHE_CHECK([whether nroff supports warning control],
+                      [man_cv_prog_nroff_warnings], [
+               if test "x$troff_is_groff" = xyes && \
+                  nroff -wmac </dev/null >/dev/null 2>&1
+               then
+                       man_cv_prog_nroff_warnings=yes
+               else
+                       man_cv_prog_nroff_warnings=no
+               fi])
+       if test "x$man_cv_prog_nroff_warnings" = xyes; then
+               AC_DEFINE([NROFF_WARNINGS], [1],
+                         [Define if nroff supports warning control.])
+       fi
+fi
 
 AC_CHECK_PROGS([preconv], [gpreconv preconv])
 
@@ -314,6 +262,24 @@ then
        (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
 fi
 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
+TBL_X_FORMAT=
+if test -n "$tbl"
+then
+       AC_CACHE_CHECK([whether tbl supports the 'x' format character],
+                      [man_cv_tbl_x_format], [
+               if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
+                  $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
+               then
+                       man_cv_tbl_x_format=yes
+               else
+                       man_cv_tbl_x_format=no
+               fi])
+       if test "x$man_cv_tbl_x_format" = xyes
+       then
+               TBL_X_FORMAT=x
+       fi
+fi
+AC_SUBST([TBL_X_FORMAT])
 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
@@ -361,10 +327,14 @@ if test -n "$lzip"
 then
        unlzip="$lzip -dc"
 fi
-if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
+MAN_CHECK_PROGS([zstd], [ZSTD], [use ZSTD as LZ77/entropy-coding compression utility], [zstd])
+if test -n "$zstd"
+then
+       unzstd="$zstd -dc"
+fi
+if test -n "$compressor"
 then
        AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
-       AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
 fi
 AC_SUBST([compressor])
 AC_SUBST([compress_ext])
@@ -374,43 +344,25 @@ AC_SUBST([bunzip2])
 AC_SUBST([unlzma])
 AC_SUBST([unxz])
 AC_SUBST([unlzip])
+AC_SUBST([unzstd])
 MAN_COMPRESS_LIB([z], [gzopen])
 dnl To add more decompressors just follow the scheme above.
 
-# Work out which manual page hierarchy scheme might be in use.
-AC_ARG_ENABLE([mandirs],
-[AS_HELP_STRING([--enable-mandirs=OS], [select manual page hierarchy organization (GNU, HPUX, IRIX, Solaris, BSD)])],
-       [AC_MSG_NOTICE([Using $enableval hierarchy organization(s)])
-        AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$enableval"],
-                           [Define to the manual page hierarchy organization(s) in use.])],
-       [case $host in
-               *-gnu)          mandirs=GNU;;
-               *-hpux*)        mandirs=HPUX;;
-               *-irix*)        mandirs=IRIX;;
-               *-solaris*)     mandirs=Solaris;;
-               *-bsd*)         mandirs=BSD;;
-               *)              mandirs=;;
-        esac
-        if test -n "$mandirs"; then
-               AC_MSG_NOTICE([Using $mandirs hierarchy organization])
-               AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$mandirs"])
-        else
-               AC_MSG_NOTICE([Allowing any hierarchy organization])
-               AC_DEFINE([MANDIR_LAYOUT], [""])
-        fi])
-
 # Check for various header files and associated libraries.
 AC_ISC_POSIX
 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
 AC_PROG_LEX
+if test "$LEX" = ":" && (test ! -e src/lexgrog.c || test ! -e src/zsoelim.c)
+then
+       AC_MSG_ERROR([flex is required when building from revision control])
+fi
 gl_INIT
-AC_HEADER_SYS_WAIT
-AC_HEADER_DIRENT
-AC_CHECK_HEADERS([fcntl.h sys/file.h])
+AC_CHECK_HEADERS([sys/file.h linux/fiemap.h])
+AC_CHECK_FUNCS([posix_fadvise])
 
 # Internationalization support.
 AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.1])
+AM_GNU_GETTEXT_VERSION([0.18.3])
 AC_SUBST([LINGUAS])
 AM_ICONV
 MAN_PO4A
@@ -424,7 +376,7 @@ AC_TYPE_UID_T
 AC_TYPE_SIZE_T
 
 # Check for pipeline library.
-PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.1.0])
+PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
 
 # Find a suitable database interface header and library.
 #
@@ -455,15 +407,10 @@ MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
-MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1])
+MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
 
 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
-dnl # from package libdb1-dev
-dnl MAN_CHECK_BDB([db], [db/db.h], [db c])
-dnl # from package libc6-dev
-dnl # ########## statically linked #####
-dnl MAN_CHECK_BDB([db], [db1/db.h], [db c], [AC_DEFINE(DB_ON_LIBC)])
 
 # Check for UNIX ndbm routines.
 if test "$db" = "no" || test "$db" = "ndbm"
@@ -477,7 +424,20 @@ then
                    AC_SUBST([DBTYPE], [ndbm])]
                   db=yes, db=no)
       test "$db" = "yes" && break
+    done], db=no)
+  if test "$db" = no
+  then
+    AC_CHECK_HEADER([gdbm-ndbm.h], [
+      for lib in gdbm_compat c dbm
+      do
+       AC_CHECK_LIB([$lib], [dbm_fetch],
+                    test "$lib" = "c" || DBLIBS="-l$lib"
+                    [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
+                     AC_SUBST([DBTYPE], [ndbm])]
+                    db=yes, db=no)
+       test "$db" = "yes" && break
       done], db=no)
+  fi
 fi 
 
 if test "$db" != "yes"
@@ -491,6 +451,9 @@ then
 fi
 AC_SUBST([DBLIBS])
 
+# Check for libseccomp library.
+MAN_LIBSECCOMP
+
 dnl MAN_ECHO_VAR(ENV-VARIABLE)
 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
 dnl
@@ -507,6 +470,7 @@ MAN_TRANS_SUBST([apropos])
 MAN_TRANS_SUBST([catman])
 MAN_TRANS_SUBST([lexgrog])
 MAN_TRANS_SUBST([man])
+MAN_TRANS_SUBST([man-recode])
 MAN_TRANS_SUBST([manconv])
 MAN_TRANS_SUBST([mandb])
 MAN_TRANS_SUBST([manpath])
@@ -516,9 +480,13 @@ MAN_TRANS_SUBST([zsoelim])
 # If we're cross-compiling, tests won't work.
 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
 
+# Are Gnulib translations available?
+AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gl/po/POTFILES.in"])
+
 AC_CONFIG_FILES([Makefile
-       gnulib/lib/Makefile
-       gnulib/po/Makefile.in
+       gl/lib/Makefile
+       init/Makefile
+       init/systemd/Makefile
        lib/Makefile
        src/Makefile
        src/man_db.conf
@@ -526,6 +494,7 @@ AC_CONFIG_FILES([Makefile
        man/Makefile
        man/replace.sin
        man/po4a/Makefile
+       man/da/Makefile
        man/de/Makefile
        man/es/Makefile
        man/fr/Makefile
@@ -534,7 +503,14 @@ AC_CONFIG_FILES([Makefile
        man/ja/Makefile
        man/nl/Makefile
        man/pl/Makefile
+       man/pt/Makefile
+       man/pt_BR/Makefile
+       man/ro/Makefile
        man/ru/Makefile
+       man/sr/Makefile
+       man/sv/Makefile
+       man/tr/Makefile
+       man/zh_CN/Makefile
        manual/Makefile
        libdb/Makefile
        docs/Makefile
@@ -542,4 +518,7 @@ AC_CONFIG_FILES([Makefile
        include/comp_src.h
        include/manconfig.h
        po/Makefile.in])
+if test -f "$srcdir/gl/po/Makefile.in.in"; then
+       AC_CONFIG_FILES([gl/po/Makefile.in])
+fi
 AC_OUTPUT