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.6.7], [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 if test ! -f "$srcdir/gnulib/po/Makefile.in.in"; then
17 AC_MSG_ERROR([you must run ./autogen.sh before ./configure when building from revision control])
20 AC_CONFIG_HEADER([config.h])
23 # Define below date and version information to be put into man pages etc.
26 roff_version=`echo AC_PACKAGE_VERSION | sed 's/-/\\-/g'`
27 AC_SUBST([roff_version])dnl
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...
32 AC_ARG_ENABLE([setuid],
33 [AS_HELP_STRING([--enable-setuid[=ARG]], [install man setuid to user ARG [ARG=man]])
34 AS_HELP_STRING([--disable-setuid], [don't install man setuid])],
35 [if test "$enableval" = "yes"
39 if test "$enableval" = "no"
43 AC_MSG_NOTICE([Man will not be installed setuid])
47 AC_MSG_NOTICE([Man will be installed setuid $enableval])
48 AC_DEFINE_UNQUOTED([SECURE_MAN_UID], ["$man_owner"],
49 [Define as the setuid owner of man or undefine if not installing setuid.])
53 AC_DEFINE_UNQUOTED([SECURE_MAN_UID], ["$man_owner"])])
54 AC_ARG_ENABLE([undoc],
55 [AS_HELP_STRING([--enable-undoc=COMMAND], [suggest COMMAND for missing manual pages])],
56 [if test "$enableval" = "yes" || test "$enableval" = "no"
58 AC_MSG_ERROR([--enable-undoc requires an argument])
60 AC_MSG_NOTICE([Suggesting '$enableval' for missing manual pages])
61 AC_DEFINE_UNQUOTED([UNDOC_COMMAND], ["$enableval"],
62 [Define as the name of a command you want to suggest when a non-existent page is requested.])
65 [AS_HELP_STRING([--with-device=DEVICE], [use nroff with the output device DEVICE])],
66 [if test "$withval" = "yes" || test "$withval" = "no"
68 AC_MSG_ERROR([--with-device requires an argument])
70 nroff_device=" -T$withval"
73 [AS_HELP_STRING([--with-db=LIBRARY], [use database library LIBRARY (db5, db4, db3, db2, db1, db, gdbm, ndbm)])],
74 [if test "$withval" = "yes" || test "$withval" = "no"
76 AC_MSG_ERROR([--with-db requires an argument])
81 AC_ARG_WITH([config-file],
82 [AS_HELP_STRING([--with-config-file=CF], [use config file CF [CF=SYSCONFDIR/man_db.conf]])],
83 [if test "$withval" = "yes" || test "$withval" = "no"
85 AC_MSG_ERROR([--with-config-file requires an argument])
89 [: ${config_file=\$\{sysconfdir\}/man_db.conf}])
90 config_file_basename=${withval##*/}
91 config_file_dirname=`AS_DIRNAME(["$config_file"])`
92 AC_ARG_WITH([sections],
93 [AS_HELP_STRING([--with-sections=SECTIONS], [use manual page sections SECTIONS @<:@1 n l 8 3 0 2 5 4 9 6 7@:>@])],
94 [if test "$withval" = "yes" || test "$withval" = "no"
96 AC_MSG_ERROR([--with-sections requires an argument])
100 [: ${sections=1 n l 8 3 2 5 4 9 6 7}])
101 AC_ARG_ENABLE([automatic-create],
102 [AS_HELP_STRING([--enable-automatic-create], [allow man to create user databases on the fly])],
103 [if test "$enableval" = "yes"
105 AC_DEFINE([MAN_DB_CREATES], [1], [Allow man to create user databases on the fly.])
107 AC_ARG_ENABLE([automatic-update],
108 [AS_HELP_STRING([--disable-automatic-update], [don't allow man to update databases on the fly])],
109 [if test "$enableval" = "yes"
111 AC_DEFINE([MAN_DB_UPDATES], [1], [Allow man to update databases on the fly.])
113 [AC_DEFINE([MAN_DB_UPDATES], [1], [Allow man to update databases on the fly.])])
114 AC_ARG_ENABLE([cats],
115 [AS_HELP_STRING([--disable-cats], [don't allow man to create/update cat files])],
116 [if test "$enableval" = "yes"
118 AC_DEFINE([MAN_CATS], [1], [Allow man to create/update cat files.])
120 [AC_DEFINE([MAN_CATS], [1], [Allow man to create/update cat files.])])
121 AC_ARG_WITH([override-dir],
122 [AS_HELP_STRING([--with-override-dir=OVERRIDE], [use OVERRIDE as relative override dir inside the man path - the first directory to be searched when looking for man pages])],
123 [if test "$withval" = "yes" || test "$withval" = "no"
125 AC_MSG_ERROR([--with-override-dir requires an argument])
127 override_dir=$withval
129 [: ${override_dir=""}])
131 # Finish the argument parsing.
132 AC_SUBST([man_owner])dnl
133 AC_SUBST([man_mode])dnl
134 AC_SUBST([config_file])dnl
135 AC_SUBST([config_file_basename])dnl
136 AC_SUBST([config_file_dirname])dnl
137 AC_SUBST([sections])dnl
138 AC_SUBST([override_dir])dnl
140 # Check $PATH for the following programs and append suitable options.
144 CFLAGS="$CFLAGS -Wall"
147 dnl When compiled for BSD environment, each running `man'
148 dnl increases the system load as reported by uptime(1) by
149 dnl one. The reason for this behaviour is currently
150 dnl unknown, but the load increase does *not* reflect actual
151 dnl resource usage. To avoid it, compile for POSIX
153 CFLAGS="$CFLAGS -YPOSIX"
159 gl_WARN_ADD([-Wpointer-arith])
160 gl_WARN_ADD([-Wwrite-strings])
161 gl_WARN_ADD([-Wstrict-prototypes])
162 gl_WARN_ADD([-Wshadow])
163 gl_WARN_ADD([-Wformat-security])
164 gl_WARN_ADD([-Wredundant-decls])
165 gl_WARN_ADD([-Wno-missing-field-initializers])
169 AC_CHECK_PROGS([cat], [cat])
170 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
171 test -n "$browser" && browser="exec $browser"
172 AC_CHECK_PROGS([tr], [tr])
173 AC_CHECK_PROGS([grep], [grep])
174 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
175 test -n "$pager" && pager="$pager -s"
177 # Define below (in list of preference) *roff macros to check for.
178 macros="andoc an doc"
180 # We have problems here, as different systems have different *roff
181 # formatters and they accept different options and do different things :(
182 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
185 MAN_PROG_GNU_NROFF([$nroff])
186 if test "$man_cv_prog_gnu_nroff" != "yes"
188 MAN_PROG_HEIRLOOM_NROFF([$nroff])
190 if test -n "$nroff_device"
192 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
193 # We cannot cache this result as it can change between runs
195 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
200 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
203 AC_MSG_CHECKING([for appropriate nroff macro])
204 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
208 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
210 man_cv_prog_nroff_macro=-m$macro
215 if test -n "$man_cv_prog_nroff_macro"
217 if test "$man_cv_prog_heirloom_nroff" = "yes"
219 # Heirloom works best with some extra options:
220 # -mg: groff compatibility
221 # -msafe: disable privileged operations
222 # -mpadj: clean up line breaking
223 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
225 nroff="$nroff ${man_cv_prog_nroff_macro}"
226 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
227 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
229 AC_MSG_RESULT([ambiguous])
230 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
233 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
234 nroff="(nroff not installed)"
235 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
238 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
240 AC_CHECK_PROGS([troff], [groff])
244 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
248 AC_CHECK_PROGS([troff], [troff gtroff])
254 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
255 AC_MSG_CHECKING([for appropriate $TROFF options])
256 AC_CACHE_VAL([man_cv_prog_troff_options], [
257 # Do a quick test to see if -t works [AIX needs this], groff doesn't
258 # as it indicates pre-process with tbl.
259 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
260 && troff_filter="-t "
263 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
265 man_cv_prog_troff_options="${troff_filter}-m${macro}"
269 if test -n "$man_cv_prog_troff_options"
271 if test "$man_cv_prog_heirloom_nroff" = "yes"
273 # Heirloom works best with some extra options:
274 # -mg: groff compatibility
275 # -msafe: disable privileged operations
276 # -mpadj: clean up line breaking
277 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
279 troff="$troff $man_cv_prog_troff_options"
280 AC_MSG_RESULT([$man_cv_prog_troff_options])
282 AC_MSG_RESULT([ambiguous])
283 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
286 troff="(troff not installed)"
291 AC_CACHE_CHECK([whether nroff supports warning control],
292 [man_cv_prog_nroff_warnings], [
293 if test "x$troff_is_groff" = xyes && \
294 nroff -wmac </dev/null >/dev/null 2>&1
296 man_cv_prog_nroff_warnings=yes
298 man_cv_prog_nroff_warnings=no
300 if test "x$man_cv_prog_nroff_warnings" = xyes; then
301 AC_DEFINE([NROFF_WARNINGS], [1],
302 [Define if nroff supports warning control.])
306 AC_CHECK_PROGS([preconv], [gpreconv preconv])
308 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
310 AC_ARG_ENABLE([mb-groff],
311 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
312 [if test "$enableval" = "yes"
316 [if test -n "$preconv"
319 elif test -n "$troff" && test "$troff_is_groff" = "yes"
321 if $troff -Tnippon </dev/null >/dev/null 2>&1
326 AC_MSG_RESULT([$man_mb_groff])
327 if test "$man_mb_groff" = "yes"
329 AC_DEFINE([MULTIBYTE_GROFF], 1,
330 [Define if your groff installation has the Debian multibyte patch.])
333 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
334 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
335 # If we fail to find an neqn, use eqn and try to force it to output for an
336 # ascii device. As this is only relevant for equations (?), not using latin1
337 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
341 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
343 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
347 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
348 [man_cv_tbl_x_format], [
349 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
350 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
352 man_cv_tbl_x_format=yes
354 man_cv_tbl_x_format=no
356 if test "x$man_cv_tbl_x_format" = xyes
361 AC_SUBST([TBL_X_FORMAT])
362 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
363 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
364 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
365 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
366 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
367 test -n "$pic" && pic="$pic -S"
369 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
373 compressor="$gzip -c7"
376 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
377 if test -n "$compress"
379 uncompress="$compress -dc"
382 compressor="$compress -c"
386 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
391 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
397 dnl lzma not used/needed if we have xz
398 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
404 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
409 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
411 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
412 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
414 AC_SUBST([compressor])
415 AC_SUBST([compress_ext])
417 AC_SUBST([uncompress])
422 MAN_COMPRESS_LIB([z], [gzopen])
423 dnl To add more decompressors just follow the scheme above.
425 # Work out which manual page hierarchy scheme might be in use.
426 AC_ARG_ENABLE([mandirs],
427 [AS_HELP_STRING([--enable-mandirs=OS], [select manual page hierarchy organization (GNU, HPUX, IRIX, Solaris, BSD)])],
428 [AC_MSG_NOTICE([Using $enableval hierarchy organization(s)])
429 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$enableval"],
430 [Define to the manual page hierarchy organization(s) in use.])
431 MANDIR_LAYOUT="$enableval"],
434 *-hpux*) mandirs=HPUX;;
435 *-irix*) mandirs=IRIX;;
436 *-solaris*) mandirs=Solaris;;
437 *-*bsd*) mandirs=BSD;;
440 if test -n "$mandirs"; then
441 AC_MSG_NOTICE([Using $mandirs hierarchy organization])
442 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$mandirs"])
443 MANDIR_LAYOUT="$mandirs"
445 AC_MSG_NOTICE([Allowing any hierarchy organization])
446 AC_DEFINE([MANDIR_LAYOUT], [""])
449 AC_SUBST([MANDIR_LAYOUT])
451 # Check for various header files and associated libraries.
453 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
457 AC_CHECK_HEADERS([fcntl.h sys/file.h])
459 # Internationalization support.
460 AM_GNU_GETTEXT([external])
461 AM_GNU_GETTEXT_VERSION([0.18.1])
467 # Checks for structures and compiler characteristics.
474 # Check for pipeline library.
475 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.3.0])
477 # Find a suitable database interface header and library.
479 # Check for GNU dbm routines.
480 if test "$db" = "no" || test "$db" = "gdbm"
482 AC_CHECK_HEADER([gdbm.h], [
483 for lib in gdbm c dbm
485 AC_CHECK_LIB([$lib], [gdbm_fetch],
486 test "$lib" = "c" || DBLIBS="-l$lib"
487 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
488 AC_SUBST([DBTYPE], [gdbm])]
490 if test "$db" = "yes"
492 man_save_LIBS="$LIBS"
494 AC_CHECK_FUNCS([gdbm_exists])
495 LIBS="$man_save_LIBS"
501 # Check for Berkeley db routines (first version API).
502 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
503 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
504 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
505 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
506 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
508 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
509 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
511 # Check for UNIX ndbm routines.
512 if test "$db" = "no" || test "$db" = "ndbm"
514 AC_CHECK_HEADER([ndbm.h], [
515 for lib in ndbm c dbm
517 AC_CHECK_LIB([$lib], [dbm_fetch],
518 test "$lib" = "c" || DBLIBS="-l$lib"
519 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
520 AC_SUBST([DBTYPE], [ndbm])]
522 test "$db" = "yes" && break
526 if test "$db" != "yes"
530 AC_MSG_ERROR([Fatal: no supported database library/header found])
532 AC_MSG_ERROR([Fatal: $db: unsupported database library])
537 dnl MAN_ECHO_VAR(ENV-VARIABLE)
538 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
542 MAN_ECHO_VAR([CPPFLAGS])
543 MAN_ECHO_VAR([CFLAGS])
544 MAN_ECHO_VAR([LDFLAGS])
546 MAN_ECHO_VAR([DBLIBS])
548 # Transformed versions of program names for use in Automake variables.
549 MAN_TRANS_SUBST([apropos])
550 MAN_TRANS_SUBST([catman])
551 MAN_TRANS_SUBST([lexgrog])
552 MAN_TRANS_SUBST([man])
553 MAN_TRANS_SUBST([manconv])
554 MAN_TRANS_SUBST([mandb])
555 MAN_TRANS_SUBST([manpath])
556 MAN_TRANS_SUBST([whatis])
557 MAN_TRANS_SUBST([zsoelim])
559 # If we're cross-compiling, tests won't work.
560 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
562 AC_CONFIG_FILES([Makefile
564 gnulib/po/Makefile.in