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.9.1], [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])
11 AC_CONFIG_SRCDIR([src/man.c])
15 AC_CONFIG_HEADER([config.h])
18 # Define below date and version information to be put into man pages etc.
21 roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'`
22 AC_SUBST([roff_version])dnl
24 # Explicitly check for pkg-config early on, since otherwise the conditional
25 # calls in MAN_ARG_SYSTEMDTMPFILESDIR and MAN_ARG_SYSTEMDSYSTEMUNITDIR are
29 # We have to be a bit naughty here and supply options.
30 # The autoconf literature states that only features that can be separately
31 # 'built' should use --enable and friends. Oh well...
39 MAN_ARG_AUTOMATIC_CREATE
40 MAN_ARG_AUTOMATIC_UPDATE
43 MAN_ARG_SYSTEMDTMPFILESDIR
44 MAN_ARG_SYSTEMDSYSTEMUNITDIR
48 # Check $PATH for the following programs and append suitable options.
52 CFLAGS="$CFLAGS -Wall"
55 dnl When compiled for BSD environment, each running `man'
56 dnl increases the system load as reported by uptime(1) by
57 dnl one. The reason for this behaviour is currently
58 dnl unknown, but the load increase does *not* reflect actual
59 dnl resource usage. To avoid it, compile for POSIX
61 CFLAGS="$CFLAGS -YPOSIX"
65 # Enable all reasonable GCC warnings.
66 gl_MANYWARN_ALL_GCC([warnings])
68 nw="$nw -Wsystem-headers"
69 nw="$nw -Wmissing-field-initializers"
71 gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
72 for w in $warnings; do
75 gl_WARN_ADD([-Wno-missing-field-initializers])
76 # Disable use of VLAs by Gnulib to avoid tripping over -Wvla.
77 AC_DEFINE([GNULIB_NO_VLA], [1], [Define to 1 to disable use of VLAs.])
82 LT_INIT([disable-static])
83 AC_CHECK_PROGS([cat], [cat])
84 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
85 test -n "$browser" && browser="exec $browser"
86 AC_CHECK_PROGS([tr], [tr])
87 AC_CHECK_PROGS([grep], [grep])
88 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
90 # Define below (in list of preference) *roff macros to check for.
93 # We have problems here, as different systems have different *roff
94 # formatters and they accept different options and do different things :(
95 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
98 MAN_PROG_GNU_NROFF([$nroff])
99 if test "$man_cv_prog_gnu_nroff" != "yes"
101 MAN_PROG_HEIRLOOM_NROFF([$nroff])
103 if test -n "$nroff_device"
105 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
106 # We cannot cache this result as it can change between runs
108 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
113 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
116 AC_MSG_CHECKING([for appropriate nroff macro])
117 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
121 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
123 man_cv_prog_nroff_macro=-m$macro
128 if test -n "$man_cv_prog_nroff_macro"
130 if test "$man_cv_prog_heirloom_nroff" = "yes"
132 # Heirloom works best with some extra options:
133 # -mg: groff compatibility
134 # -msafe: disable privileged operations
135 # -mpadj: clean up line breaking
136 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
138 nroff="$nroff ${man_cv_prog_nroff_macro}"
139 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
140 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
142 AC_MSG_RESULT([ambiguous])
143 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
146 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
147 nroff="(nroff not installed)"
148 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
151 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
153 AC_CHECK_PROGS([troff], [groff])
157 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
161 AC_CHECK_PROGS([troff], [troff gtroff])
167 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
168 AC_MSG_CHECKING([for appropriate $TROFF options])
169 AC_CACHE_VAL([man_cv_prog_troff_options], [
170 # Do a quick test to see if -t works [AIX needs this], groff doesn't
171 # as it indicates pre-process with tbl.
172 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
173 && troff_filter="-t "
176 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
178 man_cv_prog_troff_options="${troff_filter}-m${macro}"
182 if test -n "$man_cv_prog_troff_options"
184 if test "$man_cv_prog_heirloom_nroff" = "yes"
186 # Heirloom works best with some extra options:
187 # -mg: groff compatibility
188 # -msafe: disable privileged operations
189 # -mpadj: clean up line breaking
190 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
192 troff="$troff $man_cv_prog_troff_options"
193 AC_MSG_RESULT([$man_cv_prog_troff_options])
195 AC_MSG_RESULT([ambiguous])
196 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
199 troff="(troff not installed)"
201 dnl We want to end up with "-" written as "\-" in manual pages. This
202 dnl requires additional \-escaping corresponding to the following quote
204 dnl 1) the following sed command
205 dnl 2) the following assignment
206 dnl 2) sed running on the substituted version of man/replace.sin.in
207 troff_as_troff_input=`echo "$troff" | sed 's/-/\\\\\\\\-/g'`
208 AC_SUBST([troff_as_troff_input])
212 AC_CACHE_CHECK([whether nroff supports warning control],
213 [man_cv_prog_nroff_warnings], [
214 if test "x$troff_is_groff" = xyes && \
215 nroff -wmac </dev/null >/dev/null 2>&1
217 man_cv_prog_nroff_warnings=yes
219 man_cv_prog_nroff_warnings=no
221 if test "x$man_cv_prog_nroff_warnings" = xyes; then
222 AC_DEFINE([NROFF_WARNINGS], [1],
223 [Define if nroff supports warning control.])
227 AC_CHECK_PROGS([preconv], [gpreconv preconv])
229 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
231 AC_ARG_ENABLE([mb-groff],
232 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
233 [if test "$enableval" = "yes"
237 [if test -n "$preconv"
240 elif test -n "$troff" && test "$troff_is_groff" = "yes"
242 if $troff -Tnippon </dev/null >/dev/null 2>&1
247 AC_MSG_RESULT([$man_mb_groff])
248 if test "$man_mb_groff" = "yes"
250 AC_DEFINE([MULTIBYTE_GROFF], 1,
251 [Define if your groff installation has the Debian multibyte patch.])
254 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
255 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
256 # If we fail to find an neqn, use eqn and try to force it to output for an
257 # ascii device. As this is only relevant for equations (?), not using latin1
258 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
262 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
264 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
268 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
269 [man_cv_tbl_x_format], [
270 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
271 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
273 man_cv_tbl_x_format=yes
275 man_cv_tbl_x_format=no
277 if test "x$man_cv_tbl_x_format" = xyes
282 AC_SUBST([TBL_X_FORMAT])
283 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
284 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
285 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
286 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
287 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
288 test -n "$pic" && pic="$pic -S"
290 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
294 compressor="$gzip -c7"
297 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
298 if test -n "$compress"
300 uncompress="$compress -dc"
303 compressor="$compress -c"
307 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
312 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
318 dnl lzma not used/needed if we have xz
319 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
325 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
330 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
332 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
334 AC_SUBST([compressor])
335 AC_SUBST([compress_ext])
337 AC_SUBST([uncompress])
342 MAN_COMPRESS_LIB([z], [gzopen])
343 dnl To add more decompressors just follow the scheme above.
345 # Check for various header files and associated libraries.
347 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
349 if test "$LEX" = ":" && (test ! -e src/lexgrog.c || test ! -e src/zsoelim.c)
351 AC_MSG_ERROR([flex is required when building from revision control])
354 AC_CHECK_HEADERS([sys/file.h linux/fiemap.h])
355 AC_CHECK_FUNCS([posix_fadvise])
357 # Internationalization support.
358 AM_GNU_GETTEXT([external])
359 AM_GNU_GETTEXT_VERSION([0.18.3])
365 # Checks for structures and compiler characteristics.
372 # Check for pipeline library.
373 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
375 # Find a suitable database interface header and library.
377 # Check for GNU dbm routines.
378 if test "$db" = "no" || test "$db" = "gdbm"
380 AC_CHECK_HEADER([gdbm.h], [
381 for lib in gdbm c dbm
383 AC_CHECK_LIB([$lib], [gdbm_fetch],
384 test "$lib" = "c" || DBLIBS="-l$lib"
385 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
386 AC_SUBST([DBTYPE], [gdbm])]
388 if test "$db" = "yes"
390 man_save_LIBS="$LIBS"
392 AC_CHECK_FUNCS([gdbm_exists])
393 LIBS="$man_save_LIBS"
399 # Check for Berkeley db routines (first version API).
400 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
401 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
402 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
403 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
404 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
406 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
407 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
409 # Check for UNIX ndbm routines.
410 if test "$db" = "no" || test "$db" = "ndbm"
412 AC_CHECK_HEADER([ndbm.h], [
413 for lib in ndbm c dbm
415 AC_CHECK_LIB([$lib], [dbm_fetch],
416 test "$lib" = "c" || DBLIBS="-l$lib"
417 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
418 AC_SUBST([DBTYPE], [ndbm])]
420 test "$db" = "yes" && break
424 AC_CHECK_HEADER([gdbm-ndbm.h], [
425 for lib in gdbm_compat c dbm
427 AC_CHECK_LIB([$lib], [dbm_fetch],
428 test "$lib" = "c" || DBLIBS="-l$lib"
429 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
430 AC_SUBST([DBTYPE], [ndbm])]
432 test "$db" = "yes" && break
437 if test "$db" != "yes"
441 AC_MSG_ERROR([Fatal: no supported database library/header found])
443 AC_MSG_ERROR([Fatal: $db: unsupported database library])
448 # Check for libseccomp library.
451 dnl MAN_ECHO_VAR(ENV-VARIABLE)
452 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
456 MAN_ECHO_VAR([CPPFLAGS])
457 MAN_ECHO_VAR([CFLAGS])
458 MAN_ECHO_VAR([LDFLAGS])
460 MAN_ECHO_VAR([DBLIBS])
462 # Transformed versions of program names for use in Automake variables.
463 MAN_TRANS_SUBST([apropos])
464 MAN_TRANS_SUBST([catman])
465 MAN_TRANS_SUBST([lexgrog])
466 MAN_TRANS_SUBST([man])
467 MAN_TRANS_SUBST([man-recode])
468 MAN_TRANS_SUBST([manconv])
469 MAN_TRANS_SUBST([mandb])
470 MAN_TRANS_SUBST([manpath])
471 MAN_TRANS_SUBST([whatis])
472 MAN_TRANS_SUBST([zsoelim])
474 # If we're cross-compiling, tests won't work.
475 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
477 # Are Gnulib translations available?
478 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gl/po/POTFILES.in"])
480 AC_CONFIG_FILES([Makefile
483 init/systemd/Makefile
514 if test -f "$srcdir/gl/po/Makefile.in.in"; then
515 AC_CONFIG_FILES([gl/po/Makefile.in])