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.6.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"
64 dnl libman intentionally has an undefined "sandbox" symbol
65 dnl which is supplied by each application. The Darwin
66 dnl linker refuses to do this by default, and needs some
68 CFLAGS="$CFLAGS -Wl,-flat_namespace,-undefined,suppress"
74 gl_WARN_ADD([-Wpointer-arith])
75 gl_WARN_ADD([-Wwrite-strings])
76 gl_WARN_ADD([-Wstrict-prototypes])
77 gl_WARN_ADD([-Wshadow])
78 gl_WARN_ADD([-Wformat-security])
79 gl_WARN_ADD([-Wredundant-decls])
80 gl_WARN_ADD([-Wno-missing-field-initializers])
85 LT_INIT([disable-static])
86 AC_CHECK_PROGS([cat], [cat])
87 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
88 test -n "$browser" && browser="exec $browser"
89 AC_CHECK_PROGS([tr], [tr])
90 AC_CHECK_PROGS([grep], [grep])
91 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
93 # Define below (in list of preference) *roff macros to check for.
96 # We have problems here, as different systems have different *roff
97 # formatters and they accept different options and do different things :(
98 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
101 MAN_PROG_GNU_NROFF([$nroff])
102 if test "$man_cv_prog_gnu_nroff" != "yes"
104 MAN_PROG_HEIRLOOM_NROFF([$nroff])
106 if test -n "$nroff_device"
108 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
109 # We cannot cache this result as it can change between runs
111 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
116 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
119 AC_MSG_CHECKING([for appropriate nroff macro])
120 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
124 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
126 man_cv_prog_nroff_macro=-m$macro
131 if test -n "$man_cv_prog_nroff_macro"
133 if test "$man_cv_prog_heirloom_nroff" = "yes"
135 # Heirloom works best with some extra options:
136 # -mg: groff compatibility
137 # -msafe: disable privileged operations
138 # -mpadj: clean up line breaking
139 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
141 nroff="$nroff ${man_cv_prog_nroff_macro}"
142 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
143 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
145 AC_MSG_RESULT([ambiguous])
146 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
149 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
150 nroff="(nroff not installed)"
151 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
154 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
156 AC_CHECK_PROGS([troff], [groff])
160 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
164 AC_CHECK_PROGS([troff], [troff gtroff])
170 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
171 AC_MSG_CHECKING([for appropriate $TROFF options])
172 AC_CACHE_VAL([man_cv_prog_troff_options], [
173 # Do a quick test to see if -t works [AIX needs this], groff doesn't
174 # as it indicates pre-process with tbl.
175 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
176 && troff_filter="-t "
179 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
181 man_cv_prog_troff_options="${troff_filter}-m${macro}"
185 if test -n "$man_cv_prog_troff_options"
187 if test "$man_cv_prog_heirloom_nroff" = "yes"
189 # Heirloom works best with some extra options:
190 # -mg: groff compatibility
191 # -msafe: disable privileged operations
192 # -mpadj: clean up line breaking
193 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
195 troff="$troff $man_cv_prog_troff_options"
196 AC_MSG_RESULT([$man_cv_prog_troff_options])
198 AC_MSG_RESULT([ambiguous])
199 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
202 troff="(troff not installed)"
207 AC_CACHE_CHECK([whether nroff supports warning control],
208 [man_cv_prog_nroff_warnings], [
209 if test "x$troff_is_groff" = xyes && \
210 nroff -wmac </dev/null >/dev/null 2>&1
212 man_cv_prog_nroff_warnings=yes
214 man_cv_prog_nroff_warnings=no
216 if test "x$man_cv_prog_nroff_warnings" = xyes; then
217 AC_DEFINE([NROFF_WARNINGS], [1],
218 [Define if nroff supports warning control.])
222 AC_CHECK_PROGS([preconv], [gpreconv preconv])
224 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
226 AC_ARG_ENABLE([mb-groff],
227 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
228 [if test "$enableval" = "yes"
232 [if test -n "$preconv"
235 elif test -n "$troff" && test "$troff_is_groff" = "yes"
237 if $troff -Tnippon </dev/null >/dev/null 2>&1
242 AC_MSG_RESULT([$man_mb_groff])
243 if test "$man_mb_groff" = "yes"
245 AC_DEFINE([MULTIBYTE_GROFF], 1,
246 [Define if your groff installation has the Debian multibyte patch.])
249 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
250 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
251 # If we fail to find an neqn, use eqn and try to force it to output for an
252 # ascii device. As this is only relevant for equations (?), not using latin1
253 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
257 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
259 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
263 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
264 [man_cv_tbl_x_format], [
265 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
266 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
268 man_cv_tbl_x_format=yes
270 man_cv_tbl_x_format=no
272 if test "x$man_cv_tbl_x_format" = xyes
277 AC_SUBST([TBL_X_FORMAT])
278 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
279 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
280 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
281 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
282 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
283 test -n "$pic" && pic="$pic -S"
285 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
289 compressor="$gzip -c7"
292 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
293 if test -n "$compress"
295 uncompress="$compress -dc"
298 compressor="$compress -c"
302 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
307 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
313 dnl lzma not used/needed if we have xz
314 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
320 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
325 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
327 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
328 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
330 AC_SUBST([compressor])
331 AC_SUBST([compress_ext])
333 AC_SUBST([uncompress])
338 MAN_COMPRESS_LIB([z], [gzopen])
339 dnl To add more decompressors just follow the scheme above.
341 # Check for various header files and associated libraries.
343 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
345 if test "$LEX" = ":" && (test ! -e src/lexgrog.c || test ! -e src/zsoelim.c)
347 AC_MSG_ERROR([flex is required when building from revision control])
350 AC_CHECK_HEADERS([sys/file.h linux/fiemap.h])
351 AC_CHECK_FUNCS([posix_fadvise])
353 # Internationalization support.
354 AM_GNU_GETTEXT([external])
355 AM_GNU_GETTEXT_VERSION([0.18.3])
361 # Checks for structures and compiler characteristics.
368 # Check for pipeline library.
369 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
371 # Find a suitable database interface header and library.
373 # Check for GNU dbm routines.
374 if test "$db" = "no" || test "$db" = "gdbm"
376 AC_CHECK_HEADER([gdbm.h], [
377 for lib in gdbm c dbm
379 AC_CHECK_LIB([$lib], [gdbm_fetch],
380 test "$lib" = "c" || DBLIBS="-l$lib"
381 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
382 AC_SUBST([DBTYPE], [gdbm])]
384 if test "$db" = "yes"
386 man_save_LIBS="$LIBS"
388 AC_CHECK_FUNCS([gdbm_exists])
389 LIBS="$man_save_LIBS"
395 # Check for Berkeley db routines (first version API).
396 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
397 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
398 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
399 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
400 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
402 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
403 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
405 # Check for UNIX ndbm routines.
406 if test "$db" = "no" || test "$db" = "ndbm"
408 AC_CHECK_HEADER([ndbm.h], [
409 for lib in ndbm c dbm
411 AC_CHECK_LIB([$lib], [dbm_fetch],
412 test "$lib" = "c" || DBLIBS="-l$lib"
413 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
414 AC_SUBST([DBTYPE], [ndbm])]
416 test "$db" = "yes" && break
420 AC_CHECK_HEADER([gdbm-ndbm.h], [
421 for lib in gdbm_compat c dbm
423 AC_CHECK_LIB([$lib], [dbm_fetch],
424 test "$lib" = "c" || DBLIBS="-l$lib"
425 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
426 AC_SUBST([DBTYPE], [ndbm])]
428 test "$db" = "yes" && break
433 if test "$db" != "yes"
437 AC_MSG_ERROR([Fatal: no supported database library/header found])
439 AC_MSG_ERROR([Fatal: $db: unsupported database library])
444 # Check for libseccomp library.
447 dnl MAN_ECHO_VAR(ENV-VARIABLE)
448 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
452 MAN_ECHO_VAR([CPPFLAGS])
453 MAN_ECHO_VAR([CFLAGS])
454 MAN_ECHO_VAR([LDFLAGS])
456 MAN_ECHO_VAR([DBLIBS])
458 # Transformed versions of program names for use in Automake variables.
459 MAN_TRANS_SUBST([apropos])
460 MAN_TRANS_SUBST([catman])
461 MAN_TRANS_SUBST([lexgrog])
462 MAN_TRANS_SUBST([man])
463 MAN_TRANS_SUBST([manconv])
464 MAN_TRANS_SUBST([mandb])
465 MAN_TRANS_SUBST([manpath])
466 MAN_TRANS_SUBST([whatis])
467 MAN_TRANS_SUBST([zsoelim])
469 # If we're cross-compiling, tests won't work.
470 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
472 # Are Gnulib translations available?
473 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gl/po/POTFILES.in"])
475 AC_CONFIG_FILES([Makefile
478 init/systemd/Makefile
509 if test -f "$srcdir/gl/po/Makefile.in.in"; then
510 AC_CONFIG_FILES([gl/po/Makefile.in])