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.8.5], [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
47 # Check $PATH for the following programs and append suitable options.
51 CFLAGS="$CFLAGS -Wall"
54 dnl When compiled for BSD environment, each running `man'
55 dnl increases the system load as reported by uptime(1) by
56 dnl one. The reason for this behaviour is currently
57 dnl unknown, but the load increase does *not* reflect actual
58 dnl resource usage. To avoid it, compile for POSIX
60 CFLAGS="$CFLAGS -YPOSIX"
66 gl_WARN_ADD([-Wpointer-arith])
67 gl_WARN_ADD([-Wwrite-strings])
68 gl_WARN_ADD([-Wstrict-prototypes])
69 gl_WARN_ADD([-Wshadow])
70 gl_WARN_ADD([-Wformat-security])
71 gl_WARN_ADD([-Wredundant-decls])
72 gl_WARN_ADD([-Wno-missing-field-initializers])
77 LT_INIT([disable-static])
78 AC_CHECK_PROGS([cat], [cat])
79 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
80 test -n "$browser" && browser="exec $browser"
81 AC_CHECK_PROGS([tr], [tr])
82 AC_CHECK_PROGS([grep], [grep])
83 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
85 # Define below (in list of preference) *roff macros to check for.
88 # We have problems here, as different systems have different *roff
89 # formatters and they accept different options and do different things :(
90 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
93 MAN_PROG_GNU_NROFF([$nroff])
94 if test "$man_cv_prog_gnu_nroff" != "yes"
96 MAN_PROG_HEIRLOOM_NROFF([$nroff])
98 if test -n "$nroff_device"
100 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
101 # We cannot cache this result as it can change between runs
103 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
108 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
111 AC_MSG_CHECKING([for appropriate nroff macro])
112 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
116 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
118 man_cv_prog_nroff_macro=-m$macro
123 if test -n "$man_cv_prog_nroff_macro"
125 if test "$man_cv_prog_heirloom_nroff" = "yes"
127 # Heirloom works best with some extra options:
128 # -mg: groff compatibility
129 # -msafe: disable privileged operations
130 # -mpadj: clean up line breaking
131 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
133 nroff="$nroff ${man_cv_prog_nroff_macro}"
134 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
135 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
137 AC_MSG_RESULT([ambiguous])
138 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
141 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
142 nroff="(nroff not installed)"
143 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
146 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
148 AC_CHECK_PROGS([troff], [groff])
152 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
156 AC_CHECK_PROGS([troff], [troff gtroff])
162 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
163 AC_MSG_CHECKING([for appropriate $TROFF options])
164 AC_CACHE_VAL([man_cv_prog_troff_options], [
165 # Do a quick test to see if -t works [AIX needs this], groff doesn't
166 # as it indicates pre-process with tbl.
167 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
168 && troff_filter="-t "
171 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
173 man_cv_prog_troff_options="${troff_filter}-m${macro}"
177 if test -n "$man_cv_prog_troff_options"
179 if test "$man_cv_prog_heirloom_nroff" = "yes"
181 # Heirloom works best with some extra options:
182 # -mg: groff compatibility
183 # -msafe: disable privileged operations
184 # -mpadj: clean up line breaking
185 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
187 troff="$troff $man_cv_prog_troff_options"
188 AC_MSG_RESULT([$man_cv_prog_troff_options])
190 AC_MSG_RESULT([ambiguous])
191 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
194 troff="(troff not installed)"
199 AC_CACHE_CHECK([whether nroff supports warning control],
200 [man_cv_prog_nroff_warnings], [
201 if test "x$troff_is_groff" = xyes && \
202 nroff -wmac </dev/null >/dev/null 2>&1
204 man_cv_prog_nroff_warnings=yes
206 man_cv_prog_nroff_warnings=no
208 if test "x$man_cv_prog_nroff_warnings" = xyes; then
209 AC_DEFINE([NROFF_WARNINGS], [1],
210 [Define if nroff supports warning control.])
214 AC_CHECK_PROGS([preconv], [gpreconv preconv])
216 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
218 AC_ARG_ENABLE([mb-groff],
219 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
220 [if test "$enableval" = "yes"
224 [if test -n "$preconv"
227 elif test -n "$troff" && test "$troff_is_groff" = "yes"
229 if $troff -Tnippon </dev/null >/dev/null 2>&1
234 AC_MSG_RESULT([$man_mb_groff])
235 if test "$man_mb_groff" = "yes"
237 AC_DEFINE([MULTIBYTE_GROFF], 1,
238 [Define if your groff installation has the Debian multibyte patch.])
241 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
242 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
243 # If we fail to find an neqn, use eqn and try to force it to output for an
244 # ascii device. As this is only relevant for equations (?), not using latin1
245 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
249 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
251 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
255 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
256 [man_cv_tbl_x_format], [
257 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
258 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
260 man_cv_tbl_x_format=yes
262 man_cv_tbl_x_format=no
264 if test "x$man_cv_tbl_x_format" = xyes
269 AC_SUBST([TBL_X_FORMAT])
270 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
271 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
272 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
273 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
274 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
275 test -n "$pic" && pic="$pic -S"
277 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
281 compressor="$gzip -c7"
284 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
285 if test -n "$compress"
287 uncompress="$compress -dc"
290 compressor="$compress -c"
294 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
299 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
305 dnl lzma not used/needed if we have xz
306 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
312 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
317 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
319 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
320 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
322 AC_SUBST([compressor])
323 AC_SUBST([compress_ext])
325 AC_SUBST([uncompress])
330 MAN_COMPRESS_LIB([z], [gzopen])
331 dnl To add more decompressors just follow the scheme above.
333 # Check for various header files and associated libraries.
335 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
337 if test "$LEX" = ":" && (test ! -e src/lexgrog.c || test ! -e src/zsoelim.c)
339 AC_MSG_ERROR([flex is required when building from revision control])
342 AC_CHECK_HEADERS([fcntl.h sys/file.h linux/fiemap.h])
343 AC_CHECK_FUNCS([lchown posix_fadvise])
345 # Internationalization support.
346 AM_GNU_GETTEXT([external])
347 AM_GNU_GETTEXT_VERSION([0.18.3])
353 # Checks for structures and compiler characteristics.
360 # Check for pipeline library.
361 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
363 # Find a suitable database interface header and library.
365 # Check for GNU dbm routines.
366 if test "$db" = "no" || test "$db" = "gdbm"
368 AC_CHECK_HEADER([gdbm.h], [
369 for lib in gdbm c dbm
371 AC_CHECK_LIB([$lib], [gdbm_fetch],
372 test "$lib" = "c" || DBLIBS="-l$lib"
373 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
374 AC_SUBST([DBTYPE], [gdbm])]
376 if test "$db" = "yes"
378 man_save_LIBS="$LIBS"
380 AC_CHECK_FUNCS([gdbm_exists])
381 LIBS="$man_save_LIBS"
387 # Check for Berkeley db routines (first version API).
388 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
389 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
390 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
391 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
392 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
394 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
395 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
397 # Check for UNIX ndbm routines.
398 if test "$db" = "no" || test "$db" = "ndbm"
400 AC_CHECK_HEADER([ndbm.h], [
401 for lib in ndbm c dbm
403 AC_CHECK_LIB([$lib], [dbm_fetch],
404 test "$lib" = "c" || DBLIBS="-l$lib"
405 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
406 AC_SUBST([DBTYPE], [ndbm])]
408 test "$db" = "yes" && break
412 AC_CHECK_HEADER([gdbm-ndbm.h], [
413 for lib in gdbm_compat 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
425 if test "$db" != "yes"
429 AC_MSG_ERROR([Fatal: no supported database library/header found])
431 AC_MSG_ERROR([Fatal: $db: unsupported database library])
436 # Check for libseccomp library.
439 dnl MAN_ECHO_VAR(ENV-VARIABLE)
440 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
444 MAN_ECHO_VAR([CPPFLAGS])
445 MAN_ECHO_VAR([CFLAGS])
446 MAN_ECHO_VAR([LDFLAGS])
448 MAN_ECHO_VAR([DBLIBS])
450 # Transformed versions of program names for use in Automake variables.
451 MAN_TRANS_SUBST([apropos])
452 MAN_TRANS_SUBST([catman])
453 MAN_TRANS_SUBST([lexgrog])
454 MAN_TRANS_SUBST([man])
455 MAN_TRANS_SUBST([manconv])
456 MAN_TRANS_SUBST([mandb])
457 MAN_TRANS_SUBST([manpath])
458 MAN_TRANS_SUBST([whatis])
459 MAN_TRANS_SUBST([zsoelim])
461 # If we're cross-compiling, tests won't work.
462 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
464 # Are Gnulib translations available?
465 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gl/po/POTFILES.in"])
467 AC_CONFIG_FILES([Makefile
470 init/systemd/Makefile
501 if test -f "$srcdir/gl/po/Makefile.in.in"; then
502 AC_CONFIG_FILES([gl/po/Makefile.in])