1 dnl Process this file with autoconf to produce a configure script.
2 m4_pattern_forbid([^MAN_])
4 # Initialise and check we're in the correct directory.
5 AC_INIT([man-db], [2.7.2], [cjwatson@debian.org])
6 AC_CONFIG_AUX_DIR([build-aux])
7 AM_INIT_AUTOMAKE([1.11 -Wall -Wno-override -Werror foreign dist-xz no-dist-gzip parallel-tests])
9 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
11 AC_CONFIG_SRCDIR([src/man.c])
13 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
14 LT_INIT([disable-static])
16 AC_CONFIG_HEADER([config.h])
19 # Define below date and version information to be put into man pages etc.
22 roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'`
23 AC_SUBST([roff_version])dnl
25 # We have to be a bit naughty here and supply options.
26 # The autoconf literature states that only features that can be separately
27 # 'built' should use --enable and friends. Oh well...
34 MAN_ARG_AUTOMATIC_CREATE
35 MAN_ARG_AUTOMATIC_UPDATE
38 MAN_ARG_SYSTEMDTMPFILESDIR
41 # Check $PATH for the following programs and append suitable options.
45 CFLAGS="$CFLAGS -Wall"
48 dnl When compiled for BSD environment, each running `man'
49 dnl increases the system load as reported by uptime(1) by
50 dnl one. The reason for this behaviour is currently
51 dnl unknown, but the load increase does *not* reflect actual
52 dnl resource usage. To avoid it, compile for POSIX
54 CFLAGS="$CFLAGS -YPOSIX"
60 gl_WARN_ADD([-Wpointer-arith])
61 gl_WARN_ADD([-Wwrite-strings])
62 gl_WARN_ADD([-Wstrict-prototypes])
63 gl_WARN_ADD([-Wshadow])
64 gl_WARN_ADD([-Wformat-security])
65 gl_WARN_ADD([-Wredundant-decls])
66 gl_WARN_ADD([-Wno-missing-field-initializers])
70 AC_CHECK_PROGS([cat], [cat])
71 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
72 test -n "$browser" && browser="exec $browser"
73 AC_CHECK_PROGS([tr], [tr])
74 AC_CHECK_PROGS([grep], [grep])
75 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
76 test -n "$pager" && pager="$pager -s"
78 # Define below (in list of preference) *roff macros to check for.
81 # We have problems here, as different systems have different *roff
82 # formatters and they accept different options and do different things :(
83 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
86 MAN_PROG_GNU_NROFF([$nroff])
87 if test "$man_cv_prog_gnu_nroff" != "yes"
89 MAN_PROG_HEIRLOOM_NROFF([$nroff])
91 if test -n "$nroff_device"
93 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
94 # We cannot cache this result as it can change between runs
96 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
101 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
104 AC_MSG_CHECKING([for appropriate nroff macro])
105 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
109 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
111 man_cv_prog_nroff_macro=-m$macro
116 if test -n "$man_cv_prog_nroff_macro"
118 if test "$man_cv_prog_heirloom_nroff" = "yes"
120 # Heirloom works best with some extra options:
121 # -mg: groff compatibility
122 # -msafe: disable privileged operations
123 # -mpadj: clean up line breaking
124 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
126 nroff="$nroff ${man_cv_prog_nroff_macro}"
127 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
128 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
130 AC_MSG_RESULT([ambiguous])
131 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
134 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
135 nroff="(nroff not installed)"
136 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
139 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
141 AC_CHECK_PROGS([troff], [groff])
145 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
149 AC_CHECK_PROGS([troff], [troff gtroff])
155 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
156 AC_MSG_CHECKING([for appropriate $TROFF options])
157 AC_CACHE_VAL([man_cv_prog_troff_options], [
158 # Do a quick test to see if -t works [AIX needs this], groff doesn't
159 # as it indicates pre-process with tbl.
160 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
161 && troff_filter="-t "
164 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
166 man_cv_prog_troff_options="${troff_filter}-m${macro}"
170 if test -n "$man_cv_prog_troff_options"
172 if test "$man_cv_prog_heirloom_nroff" = "yes"
174 # Heirloom works best with some extra options:
175 # -mg: groff compatibility
176 # -msafe: disable privileged operations
177 # -mpadj: clean up line breaking
178 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
180 troff="$troff $man_cv_prog_troff_options"
181 AC_MSG_RESULT([$man_cv_prog_troff_options])
183 AC_MSG_RESULT([ambiguous])
184 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
187 troff="(troff not installed)"
192 AC_CACHE_CHECK([whether nroff supports warning control],
193 [man_cv_prog_nroff_warnings], [
194 if test "x$troff_is_groff" = xyes && \
195 nroff -wmac </dev/null >/dev/null 2>&1
197 man_cv_prog_nroff_warnings=yes
199 man_cv_prog_nroff_warnings=no
201 if test "x$man_cv_prog_nroff_warnings" = xyes; then
202 AC_DEFINE([NROFF_WARNINGS], [1],
203 [Define if nroff supports warning control.])
207 AC_CHECK_PROGS([preconv], [gpreconv preconv])
209 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
211 AC_ARG_ENABLE([mb-groff],
212 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
213 [if test "$enableval" = "yes"
217 [if test -n "$preconv"
220 elif test -n "$troff" && test "$troff_is_groff" = "yes"
222 if $troff -Tnippon </dev/null >/dev/null 2>&1
227 AC_MSG_RESULT([$man_mb_groff])
228 if test "$man_mb_groff" = "yes"
230 AC_DEFINE([MULTIBYTE_GROFF], 1,
231 [Define if your groff installation has the Debian multibyte patch.])
234 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
235 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
236 # If we fail to find an neqn, use eqn and try to force it to output for an
237 # ascii device. As this is only relevant for equations (?), not using latin1
238 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
242 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
244 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
248 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
249 [man_cv_tbl_x_format], [
250 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
251 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
253 man_cv_tbl_x_format=yes
255 man_cv_tbl_x_format=no
257 if test "x$man_cv_tbl_x_format" = xyes
262 AC_SUBST([TBL_X_FORMAT])
263 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
264 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
265 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
266 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
267 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
268 test -n "$pic" && pic="$pic -S"
270 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
274 compressor="$gzip -c7"
277 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
278 if test -n "$compress"
280 uncompress="$compress -dc"
283 compressor="$compress -c"
287 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
292 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
298 dnl lzma not used/needed if we have xz
299 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
305 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
310 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
312 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
313 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
315 AC_SUBST([compressor])
316 AC_SUBST([compress_ext])
318 AC_SUBST([uncompress])
323 MAN_COMPRESS_LIB([z], [gzopen])
324 dnl To add more decompressors just follow the scheme above.
326 # Check for various header files and associated libraries.
328 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
331 AC_CHECK_HEADERS([fcntl.h sys/file.h linux/fiemap.h])
332 AC_CHECK_FUNCS([posix_fadvise])
334 # Internationalization support.
335 AM_GNU_GETTEXT([external])
336 AM_GNU_GETTEXT_VERSION([0.18.1])
342 # Checks for structures and compiler characteristics.
349 # Check for pipeline library.
350 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.4.0])
352 # Find a suitable database interface header and library.
354 # Check for GNU dbm routines.
355 if test "$db" = "no" || test "$db" = "gdbm"
357 AC_CHECK_HEADER([gdbm.h], [
358 for lib in gdbm c dbm
360 AC_CHECK_LIB([$lib], [gdbm_fetch],
361 test "$lib" = "c" || DBLIBS="-l$lib"
362 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
363 AC_SUBST([DBTYPE], [gdbm])]
365 if test "$db" = "yes"
367 man_save_LIBS="$LIBS"
369 AC_CHECK_FUNCS([gdbm_exists])
370 LIBS="$man_save_LIBS"
376 # Check for Berkeley db routines (first version API).
377 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
378 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
379 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
380 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
381 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
383 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
384 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
386 # Check for UNIX ndbm routines.
387 if test "$db" = "no" || test "$db" = "ndbm"
389 AC_CHECK_HEADER([ndbm.h], [
390 for lib in ndbm c dbm
392 AC_CHECK_LIB([$lib], [dbm_fetch],
393 test "$lib" = "c" || DBLIBS="-l$lib"
394 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
395 AC_SUBST([DBTYPE], [ndbm])]
397 test "$db" = "yes" && break
401 AC_CHECK_HEADER([gdbm-ndbm.h], [
402 for lib in gdbm_compat c dbm
404 AC_CHECK_LIB([$lib], [dbm_fetch],
405 test "$lib" = "c" || DBLIBS="-l$lib"
406 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
407 AC_SUBST([DBTYPE], [ndbm])]
409 test "$db" = "yes" && break
414 if test "$db" != "yes"
418 AC_MSG_ERROR([Fatal: no supported database library/header found])
420 AC_MSG_ERROR([Fatal: $db: unsupported database library])
425 dnl MAN_ECHO_VAR(ENV-VARIABLE)
426 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
430 MAN_ECHO_VAR([CPPFLAGS])
431 MAN_ECHO_VAR([CFLAGS])
432 MAN_ECHO_VAR([LDFLAGS])
434 MAN_ECHO_VAR([DBLIBS])
436 # Transformed versions of program names for use in Automake variables.
437 MAN_TRANS_SUBST([apropos])
438 MAN_TRANS_SUBST([catman])
439 MAN_TRANS_SUBST([lexgrog])
440 MAN_TRANS_SUBST([man])
441 MAN_TRANS_SUBST([manconv])
442 MAN_TRANS_SUBST([mandb])
443 MAN_TRANS_SUBST([manpath])
444 MAN_TRANS_SUBST([whatis])
445 MAN_TRANS_SUBST([zsoelim])
447 # If we're cross-compiling, tests won't work.
448 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
450 # Are Gnulib translations available?
451 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gnulib/po/POTFILES.in"])
453 AC_CONFIG_FILES([Makefile
456 init/systemd/Makefile
482 if test -f "$srcdir/gnulib/po/Makefile.in.in"; then
483 AC_CONFIG_FILES([gnulib/po/Makefile.in])