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.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])
14 AC_CONFIG_HEADER([config.h])
17 # Define below date and version information to be put into man pages etc.
20 roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'`
21 AC_SUBST([roff_version])dnl
23 # Explicitly check for pkg-config early on, since otherwise the conditional
24 # call in MAN_ARG_SYSTEMDTMPFILESDIR is problematic.
27 # We have to be a bit naughty here and supply options.
28 # The autoconf literature states that only features that can be separately
29 # 'built' should use --enable and friends. Oh well...
37 MAN_ARG_AUTOMATIC_CREATE
38 MAN_ARG_AUTOMATIC_UPDATE
41 MAN_ARG_SYSTEMDTMPFILESDIR
44 # Check $PATH for the following programs and append suitable options.
48 CFLAGS="$CFLAGS -Wall"
51 dnl When compiled for BSD environment, each running `man'
52 dnl increases the system load as reported by uptime(1) by
53 dnl one. The reason for this behaviour is currently
54 dnl unknown, but the load increase does *not* reflect actual
55 dnl resource usage. To avoid it, compile for POSIX
57 CFLAGS="$CFLAGS -YPOSIX"
63 gl_WARN_ADD([-Wpointer-arith])
64 gl_WARN_ADD([-Wwrite-strings])
65 gl_WARN_ADD([-Wstrict-prototypes])
66 gl_WARN_ADD([-Wshadow])
67 gl_WARN_ADD([-Wformat-security])
68 gl_WARN_ADD([-Wredundant-decls])
69 gl_WARN_ADD([-Wno-missing-field-initializers])
73 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
74 LT_INIT([disable-static])
75 AC_CHECK_PROGS([cat], [cat])
76 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
77 test -n "$browser" && browser="exec $browser"
78 AC_CHECK_PROGS([tr], [tr])
79 AC_CHECK_PROGS([grep], [grep])
80 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
82 # Define below (in list of preference) *roff macros to check for.
85 # We have problems here, as different systems have different *roff
86 # formatters and they accept different options and do different things :(
87 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
90 MAN_PROG_GNU_NROFF([$nroff])
91 if test "$man_cv_prog_gnu_nroff" != "yes"
93 MAN_PROG_HEIRLOOM_NROFF([$nroff])
95 if test -n "$nroff_device"
97 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
98 # We cannot cache this result as it can change between runs
100 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
105 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
108 AC_MSG_CHECKING([for appropriate nroff macro])
109 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
113 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
115 man_cv_prog_nroff_macro=-m$macro
120 if test -n "$man_cv_prog_nroff_macro"
122 if test "$man_cv_prog_heirloom_nroff" = "yes"
124 # Heirloom works best with some extra options:
125 # -mg: groff compatibility
126 # -msafe: disable privileged operations
127 # -mpadj: clean up line breaking
128 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
130 nroff="$nroff ${man_cv_prog_nroff_macro}"
131 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
132 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
134 AC_MSG_RESULT([ambiguous])
135 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
138 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
139 nroff="(nroff not installed)"
140 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
143 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
145 AC_CHECK_PROGS([troff], [groff])
149 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
153 AC_CHECK_PROGS([troff], [troff gtroff])
159 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
160 AC_MSG_CHECKING([for appropriate $TROFF options])
161 AC_CACHE_VAL([man_cv_prog_troff_options], [
162 # Do a quick test to see if -t works [AIX needs this], groff doesn't
163 # as it indicates pre-process with tbl.
164 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
165 && troff_filter="-t "
168 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
170 man_cv_prog_troff_options="${troff_filter}-m${macro}"
174 if test -n "$man_cv_prog_troff_options"
176 if test "$man_cv_prog_heirloom_nroff" = "yes"
178 # Heirloom works best with some extra options:
179 # -mg: groff compatibility
180 # -msafe: disable privileged operations
181 # -mpadj: clean up line breaking
182 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
184 troff="$troff $man_cv_prog_troff_options"
185 AC_MSG_RESULT([$man_cv_prog_troff_options])
187 AC_MSG_RESULT([ambiguous])
188 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
191 troff="(troff not installed)"
196 AC_CACHE_CHECK([whether nroff supports warning control],
197 [man_cv_prog_nroff_warnings], [
198 if test "x$troff_is_groff" = xyes && \
199 nroff -wmac </dev/null >/dev/null 2>&1
201 man_cv_prog_nroff_warnings=yes
203 man_cv_prog_nroff_warnings=no
205 if test "x$man_cv_prog_nroff_warnings" = xyes; then
206 AC_DEFINE([NROFF_WARNINGS], [1],
207 [Define if nroff supports warning control.])
211 AC_CHECK_PROGS([preconv], [gpreconv preconv])
213 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
215 AC_ARG_ENABLE([mb-groff],
216 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
217 [if test "$enableval" = "yes"
221 [if test -n "$preconv"
224 elif test -n "$troff" && test "$troff_is_groff" = "yes"
226 if $troff -Tnippon </dev/null >/dev/null 2>&1
231 AC_MSG_RESULT([$man_mb_groff])
232 if test "$man_mb_groff" = "yes"
234 AC_DEFINE([MULTIBYTE_GROFF], 1,
235 [Define if your groff installation has the Debian multibyte patch.])
238 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
239 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
240 # If we fail to find an neqn, use eqn and try to force it to output for an
241 # ascii device. As this is only relevant for equations (?), not using latin1
242 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
246 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
248 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
252 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
253 [man_cv_tbl_x_format], [
254 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
255 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
257 man_cv_tbl_x_format=yes
259 man_cv_tbl_x_format=no
261 if test "x$man_cv_tbl_x_format" = xyes
266 AC_SUBST([TBL_X_FORMAT])
267 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
268 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
269 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
270 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
271 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
272 test -n "$pic" && pic="$pic -S"
274 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
278 compressor="$gzip -c7"
281 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
282 if test -n "$compress"
284 uncompress="$compress -dc"
287 compressor="$compress -c"
291 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
296 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
302 dnl lzma not used/needed if we have xz
303 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
309 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
314 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
316 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
317 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
319 AC_SUBST([compressor])
320 AC_SUBST([compress_ext])
322 AC_SUBST([uncompress])
327 MAN_COMPRESS_LIB([z], [gzopen])
328 dnl To add more decompressors just follow the scheme above.
330 # Check for various header files and associated libraries.
332 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
335 AC_CHECK_HEADERS([fcntl.h sys/file.h linux/fiemap.h])
336 AC_CHECK_FUNCS([lchown posix_fadvise])
338 # Internationalization support.
339 AM_GNU_GETTEXT([external])
340 AM_GNU_GETTEXT_VERSION([0.18.3])
346 # Checks for structures and compiler characteristics.
353 # Check for pipeline library.
354 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.5.0])
356 # Find a suitable database interface header and library.
358 # Check for GNU dbm routines.
359 if test "$db" = "no" || test "$db" = "gdbm"
361 AC_CHECK_HEADER([gdbm.h], [
362 for lib in gdbm c dbm
364 AC_CHECK_LIB([$lib], [gdbm_fetch],
365 test "$lib" = "c" || DBLIBS="-l$lib"
366 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
367 AC_SUBST([DBTYPE], [gdbm])]
369 if test "$db" = "yes"
371 man_save_LIBS="$LIBS"
373 AC_CHECK_FUNCS([gdbm_exists])
374 LIBS="$man_save_LIBS"
380 # Check for Berkeley db routines (first version API).
381 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
382 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
383 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
384 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
385 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
387 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
388 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
390 # Check for UNIX ndbm routines.
391 if test "$db" = "no" || test "$db" = "ndbm"
393 AC_CHECK_HEADER([ndbm.h], [
394 for lib in ndbm c dbm
396 AC_CHECK_LIB([$lib], [dbm_fetch],
397 test "$lib" = "c" || DBLIBS="-l$lib"
398 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
399 AC_SUBST([DBTYPE], [ndbm])]
401 test "$db" = "yes" && break
405 AC_CHECK_HEADER([gdbm-ndbm.h], [
406 for lib in gdbm_compat c dbm
408 AC_CHECK_LIB([$lib], [dbm_fetch],
409 test "$lib" = "c" || DBLIBS="-l$lib"
410 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
411 AC_SUBST([DBTYPE], [ndbm])]
413 test "$db" = "yes" && break
418 if test "$db" != "yes"
422 AC_MSG_ERROR([Fatal: no supported database library/header found])
424 AC_MSG_ERROR([Fatal: $db: unsupported database library])
429 # Check for libseccomp library.
432 dnl MAN_ECHO_VAR(ENV-VARIABLE)
433 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
437 MAN_ECHO_VAR([CPPFLAGS])
438 MAN_ECHO_VAR([CFLAGS])
439 MAN_ECHO_VAR([LDFLAGS])
441 MAN_ECHO_VAR([DBLIBS])
443 # Transformed versions of program names for use in Automake variables.
444 MAN_TRANS_SUBST([apropos])
445 MAN_TRANS_SUBST([catman])
446 MAN_TRANS_SUBST([lexgrog])
447 MAN_TRANS_SUBST([man])
448 MAN_TRANS_SUBST([manconv])
449 MAN_TRANS_SUBST([mandb])
450 MAN_TRANS_SUBST([manpath])
451 MAN_TRANS_SUBST([whatis])
452 MAN_TRANS_SUBST([zsoelim])
454 # If we're cross-compiling, tests won't work.
455 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
457 # Are Gnulib translations available?
458 AM_CONDITIONAL([HAVE_GNULIB_PO], [test -f "$srcdir/gl/po/POTFILES.in"])
460 AC_CONFIG_FILES([Makefile
463 init/systemd/Makefile
493 if test -f "$srcdir/gl/po/Makefile.in.in"; then
494 AC_CONFIG_FILES([gl/po/Makefile.in])