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.4], [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])
77 # Define below (in list of preference) *roff macros to check for.
80 # We have problems here, as different systems have different *roff
81 # formatters and they accept different options and do different things :(
82 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
85 MAN_PROG_GNU_NROFF([$nroff])
86 if test "$man_cv_prog_gnu_nroff" != "yes"
88 MAN_PROG_HEIRLOOM_NROFF([$nroff])
90 if test -n "$nroff_device"
92 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
93 # We cannot cache this result as it can change between runs
95 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
100 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
103 AC_MSG_CHECKING([for appropriate nroff macro])
104 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
108 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
110 man_cv_prog_nroff_macro=-m$macro
115 if test -n "$man_cv_prog_nroff_macro"
117 if test "$man_cv_prog_heirloom_nroff" = "yes"
119 # Heirloom works best with some extra options:
120 # -mg: groff compatibility
121 # -msafe: disable privileged operations
122 # -mpadj: clean up line breaking
123 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
125 nroff="$nroff ${man_cv_prog_nroff_macro}"
126 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
127 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
129 AC_MSG_RESULT([ambiguous])
130 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
133 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
134 nroff="(nroff not installed)"
135 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
138 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
140 AC_CHECK_PROGS([troff], [groff])
144 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
148 AC_CHECK_PROGS([troff], [troff gtroff])
154 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
155 AC_MSG_CHECKING([for appropriate $TROFF options])
156 AC_CACHE_VAL([man_cv_prog_troff_options], [
157 # Do a quick test to see if -t works [AIX needs this], groff doesn't
158 # as it indicates pre-process with tbl.
159 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
160 && troff_filter="-t "
163 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
165 man_cv_prog_troff_options="${troff_filter}-m${macro}"
169 if test -n "$man_cv_prog_troff_options"
171 if test "$man_cv_prog_heirloom_nroff" = "yes"
173 # Heirloom works best with some extra options:
174 # -mg: groff compatibility
175 # -msafe: disable privileged operations
176 # -mpadj: clean up line breaking
177 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
179 troff="$troff $man_cv_prog_troff_options"
180 AC_MSG_RESULT([$man_cv_prog_troff_options])
182 AC_MSG_RESULT([ambiguous])
183 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
186 troff="(troff not installed)"
191 AC_CACHE_CHECK([whether nroff supports warning control],
192 [man_cv_prog_nroff_warnings], [
193 if test "x$troff_is_groff" = xyes && \
194 nroff -wmac </dev/null >/dev/null 2>&1
196 man_cv_prog_nroff_warnings=yes
198 man_cv_prog_nroff_warnings=no
200 if test "x$man_cv_prog_nroff_warnings" = xyes; then
201 AC_DEFINE([NROFF_WARNINGS], [1],
202 [Define if nroff supports warning control.])
206 AC_CHECK_PROGS([preconv], [gpreconv preconv])
208 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
210 AC_ARG_ENABLE([mb-groff],
211 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
212 [if test "$enableval" = "yes"
216 [if test -n "$preconv"
219 elif test -n "$troff" && test "$troff_is_groff" = "yes"
221 if $troff -Tnippon </dev/null >/dev/null 2>&1
226 AC_MSG_RESULT([$man_mb_groff])
227 if test "$man_mb_groff" = "yes"
229 AC_DEFINE([MULTIBYTE_GROFF], 1,
230 [Define if your groff installation has the Debian multibyte patch.])
233 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
234 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
235 # If we fail to find an neqn, use eqn and try to force it to output for an
236 # ascii device. As this is only relevant for equations (?), not using latin1
237 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
241 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
243 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
247 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
248 [man_cv_tbl_x_format], [
249 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
250 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
252 man_cv_tbl_x_format=yes
254 man_cv_tbl_x_format=no
256 if test "x$man_cv_tbl_x_format" = xyes
261 AC_SUBST([TBL_X_FORMAT])
262 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
263 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
264 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
265 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
266 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
267 test -n "$pic" && pic="$pic -S"
269 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
273 compressor="$gzip -c7"
276 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
277 if test -n "$compress"
279 uncompress="$compress -dc"
282 compressor="$compress -c"
286 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
291 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
297 dnl lzma not used/needed if we have xz
298 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
304 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
309 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
311 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
312 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
314 AC_SUBST([compressor])
315 AC_SUBST([compress_ext])
317 AC_SUBST([uncompress])
322 MAN_COMPRESS_LIB([z], [gzopen])
323 dnl To add more decompressors just follow the scheme above.
325 # Check for various header files and associated libraries.
327 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
330 AC_CHECK_HEADERS([fcntl.h sys/file.h linux/fiemap.h])
331 AC_CHECK_FUNCS([posix_fadvise])
333 # Internationalization support.
334 AM_GNU_GETTEXT([external])
335 AM_GNU_GETTEXT_VERSION([0.18.1])
341 # Checks for structures and compiler characteristics.
348 # Check for pipeline library.
349 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.4.0])
351 # Find a suitable database interface header and library.
353 # Check for GNU dbm routines.
354 if test "$db" = "no" || test "$db" = "gdbm"
356 AC_CHECK_HEADER([gdbm.h], [
357 for lib in gdbm c dbm
359 AC_CHECK_LIB([$lib], [gdbm_fetch],
360 test "$lib" = "c" || DBLIBS="-l$lib"
361 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
362 AC_SUBST([DBTYPE], [gdbm])]
364 if test "$db" = "yes"
366 man_save_LIBS="$LIBS"
368 AC_CHECK_FUNCS([gdbm_exists])
369 LIBS="$man_save_LIBS"
375 # Check for Berkeley db routines (first version API).
376 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
377 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
378 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
379 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
380 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
382 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
383 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
385 # Check for UNIX ndbm routines.
386 if test "$db" = "no" || test "$db" = "ndbm"
388 AC_CHECK_HEADER([ndbm.h], [
389 for lib in ndbm c dbm
391 AC_CHECK_LIB([$lib], [dbm_fetch],
392 test "$lib" = "c" || DBLIBS="-l$lib"
393 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
394 AC_SUBST([DBTYPE], [ndbm])]
396 test "$db" = "yes" && break
400 AC_CHECK_HEADER([gdbm-ndbm.h], [
401 for lib in gdbm_compat 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
413 if test "$db" != "yes"
417 AC_MSG_ERROR([Fatal: no supported database library/header found])
419 AC_MSG_ERROR([Fatal: $db: unsupported database library])
424 dnl MAN_ECHO_VAR(ENV-VARIABLE)
425 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
429 MAN_ECHO_VAR([CPPFLAGS])
430 MAN_ECHO_VAR([CFLAGS])
431 MAN_ECHO_VAR([LDFLAGS])
433 MAN_ECHO_VAR([DBLIBS])
435 # Transformed versions of program names for use in Automake variables.
436 MAN_TRANS_SUBST([apropos])
437 MAN_TRANS_SUBST([catman])
438 MAN_TRANS_SUBST([lexgrog])
439 MAN_TRANS_SUBST([man])
440 MAN_TRANS_SUBST([manconv])
441 MAN_TRANS_SUBST([mandb])
442 MAN_TRANS_SUBST([manpath])
443 MAN_TRANS_SUBST([whatis])
444 MAN_TRANS_SUBST([zsoelim])
446 # If we're cross-compiling, tests won't work.
447 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
449 # Are Gnulib translations available?
450 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gnulib/po/POTFILES.in"])
452 AC_CONFIG_FILES([Makefile
455 init/systemd/Makefile
481 if test -f "$srcdir/gnulib/po/Makefile.in.in"; then
482 AC_CONFIG_FILES([gnulib/po/Makefile.in])