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.5], [cjwatson@debian.org])
6 AC_CONFIG_AUX_DIR([tools])
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 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.])])
122 # Finish the argument parsing.
123 AC_SUBST([man_owner])dnl
124 AC_SUBST([man_mode])dnl
125 AC_SUBST([config_file])dnl
126 AC_SUBST([config_file_basename])dnl
127 AC_SUBST([config_file_dirname])dnl
128 AC_SUBST([sections])dnl
130 # Check $PATH for the following programs and append suitable options.
134 CFLAGS="$CFLAGS -Wall"
137 dnl When compiled for BSD environment, each running `man'
138 dnl increases the system load as reported by uptime(1) by
139 dnl one. The reason for this behaviour is currently
140 dnl unknown, but the load increase does *not* reflect actual
141 dnl resource usage. To avoid it, compile for POSIX
143 CFLAGS="$CFLAGS -YPOSIX"
149 gl_WARN_ADD([-Wpointer-arith])
150 gl_WARN_ADD([-Wwrite-strings])
151 gl_WARN_ADD([-Wstrict-prototypes])
152 gl_WARN_ADD([-Wshadow])
153 gl_WARN_ADD([-Wformat-security])
154 gl_WARN_ADD([-Wredundant-decls])
155 gl_WARN_ADD([-Wno-missing-field-initializers])
159 AC_CHECK_PROGS([cat], [cat])
160 MAN_CHECK_PROGS([browser], [BROWSER], [use BROWSER as default web browser], [www-browser lynx elinks w3m])
161 test -n "$browser" && browser="exec $browser"
162 AC_CHECK_PROGS([tr], [tr])
163 AC_CHECK_PROGS([grep], [grep])
164 MAN_CHECK_PROGS([pager], [PAGER], [use PAGER as default pager], [pager less more])
165 test -n "$pager" && pager="$pager -s"
167 # Define below (in list of preference) *roff macros to check for.
168 macros="andoc an doc"
170 # We have problems here, as different systems have different *roff
171 # formatters and they accept different options and do different things :(
172 MAN_CHECK_PROGS([nroff], [NROFF], [use NROFF as roff formatter for character devices], [nroff gnroff groff])
175 MAN_PROG_GNU_NROFF([$nroff])
176 if test "$man_cv_prog_gnu_nroff" != "yes"
178 MAN_PROG_HEIRLOOM_NROFF([$nroff])
180 if test -n "$nroff_device"
182 AC_MSG_CHECKING([that nroff works with argument$nroff_device])
183 # We cannot cache this result as it can change between runs
185 if $nroff $nroff_device </dev/null >/dev/null 2>&1 3>&1
190 AC_MSG_ERROR([nroff does not work with argument$nroff_device])
193 AC_MSG_CHECKING([for appropriate nroff macro])
194 AC_CACHE_VAL([man_cv_prog_nroff_macro], [
198 if $nroff -m$macro $nroff_device </dev/null >/dev/null 2>&1 3>&1
200 man_cv_prog_nroff_macro=-m$macro
205 if test -n "$man_cv_prog_nroff_macro"
207 if test "$man_cv_prog_heirloom_nroff" = "yes"
209 # Heirloom works best with some extra options:
210 # -mg: groff compatibility
211 # -msafe: disable privileged operations
212 # -mpadj: clean up line breaking
213 man_cv_prog_nroff_macro="-mg -msafe -mpadj ${man_cv_prog_nroff_macro}"
215 nroff="$nroff ${man_cv_prog_nroff_macro}"
216 dnl nroff="$nroff ${man_cv_prog_nroff_macro}${nroff_device}"
217 AC_MSG_RESULT([$man_cv_prog_nroff_macro])
219 AC_MSG_RESULT([ambiguous])
220 AC_MSG_WARN([please edit include/manconfig.h and add nroff definition])
223 AC_MSG_WARN([Cannot find an nroff-like program, formatting of manual page source will not be supported.])
224 nroff="(nroff not installed)"
225 AC_DEFINE([NROFF_MISSING], [1], [Define if you don't have nroff.])
228 dnl It would be nice to use MAN_CHECK_PROGS here, but how do we determine
230 AC_CHECK_PROGS([troff], [groff])
234 AC_DEFINE([TROFF_IS_GROFF], [1], [Define if you are using groff as troff.])
238 AC_CHECK_PROGS([troff], [troff gtroff])
244 AC_DEFINE([HAS_TROFF], [1], [Define if you have troff.])
245 AC_MSG_CHECKING([for appropriate $TROFF options])
246 AC_CACHE_VAL([man_cv_prog_troff_options], [
247 # Do a quick test to see if -t works [AIX needs this], groff doesn't
248 # as it indicates pre-process with tbl.
249 test "$TROFF" = "troff" && $troff -t </dev/null >/dev/null 2>&1 3>&1 \
250 && troff_filter="-t "
253 if $troff $troff_filter -m$macro </dev/null >/dev/null 2>&1 3>&1
255 man_cv_prog_troff_options="${troff_filter}-m${macro}"
259 if test -n "$man_cv_prog_troff_options"
261 if test "$man_cv_prog_heirloom_nroff" = "yes"
263 # Heirloom works best with some extra options:
264 # -mg: groff compatibility
265 # -msafe: disable privileged operations
266 # -mpadj: clean up line breaking
267 man_cv_prog_troff_options="-mg -msafe -mpadj ${man_cv_prog_troff_options}"
269 troff="$troff $man_cv_prog_troff_options"
270 AC_MSG_RESULT([$man_cv_prog_troff_options])
272 AC_MSG_RESULT([ambiguous])
273 AC_MSG_WARN([please edit include/manconfig.h and add troff definition])
276 troff="(troff not installed)"
281 AC_CACHE_CHECK([whether nroff supports warning control],
282 [man_cv_prog_nroff_warnings], [
283 if test "x$troff_is_groff" = xyes && \
284 nroff -wmac </dev/null >/dev/null 2>&1
286 man_cv_prog_nroff_warnings=yes
288 man_cv_prog_nroff_warnings=no
290 if test "x$man_cv_prog_nroff_warnings" = xyes; then
291 AC_DEFINE([NROFF_WARNINGS], [1],
292 [Define if nroff supports warning control.])
296 AC_CHECK_PROGS([preconv], [gpreconv preconv])
298 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
300 AC_ARG_ENABLE([mb-groff],
301 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
302 [if test "$enableval" = "yes"
306 [if test -n "$preconv"
309 elif test -n "$troff" && test "$troff_is_groff" = "yes"
311 if $troff -Tnippon </dev/null >/dev/null 2>&1
316 AC_MSG_RESULT([$man_mb_groff])
317 if test "$man_mb_groff" = "yes"
319 AC_DEFINE([MULTIBYTE_GROFF], 1,
320 [Define if your groff installation has the Debian multibyte patch.])
323 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
324 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
325 # If we fail to find an neqn, use eqn and try to force it to output for an
326 # ascii device. As this is only relevant for equations (?), not using latin1
327 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
331 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
333 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
337 AC_CACHE_CHECK([whether tbl supports the 'x' format character],
338 [man_cv_tbl_x_format], [
339 if (echo .TS; echo ';'; echo lx.; echo SENTINEL; echo .TE) | \
340 $tbl 2>/dev/null | grep SENTINEL >/dev/null 2>&1
342 man_cv_tbl_x_format=yes
344 man_cv_tbl_x_format=no
346 if test "x$man_cv_tbl_x_format" = xyes
351 AC_SUBST([TBL_X_FORMAT])
352 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
353 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
354 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
355 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
356 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
357 test -n "$pic" && pic="$pic -S"
359 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
363 compressor="$gzip -c7"
366 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
367 if test -n "$compress"
369 uncompress="$compress -dc"
372 compressor="$compress -c"
376 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
381 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
387 dnl lzma not used/needed if we have xz
388 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
394 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
399 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
401 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
402 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
404 AC_SUBST([compressor])
405 AC_SUBST([compress_ext])
407 AC_SUBST([uncompress])
412 MAN_COMPRESS_LIB([z], [gzopen])
413 dnl To add more decompressors just follow the scheme above.
415 # Work out which manual page hierarchy scheme might be in use.
416 AC_ARG_ENABLE([mandirs],
417 [AS_HELP_STRING([--enable-mandirs=OS], [select manual page hierarchy organization (GNU, HPUX, IRIX, Solaris, BSD)])],
418 [AC_MSG_NOTICE([Using $enableval hierarchy organization(s)])
419 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$enableval"],
420 [Define to the manual page hierarchy organization(s) in use.])
421 MANDIR_LAYOUT="$enableval"],
424 *-hpux*) mandirs=HPUX;;
425 *-irix*) mandirs=IRIX;;
426 *-solaris*) mandirs=Solaris;;
427 *-*bsd*) mandirs=BSD;;
430 if test -n "$mandirs"; then
431 AC_MSG_NOTICE([Using $mandirs hierarchy organization])
432 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$mandirs"])
433 MANDIR_LAYOUT="$mandirs"
435 AC_MSG_NOTICE([Allowing any hierarchy organization])
436 AC_DEFINE([MANDIR_LAYOUT], [""])
439 AC_SUBST([MANDIR_LAYOUT])
441 # Check for various header files and associated libraries.
443 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
447 AC_CHECK_HEADERS([fcntl.h sys/file.h])
449 # Internationalization support.
450 AM_GNU_GETTEXT([external])
451 AM_GNU_GETTEXT_VERSION([0.18.1])
457 # Checks for structures and compiler characteristics.
464 # Check for pipeline library.
465 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.1.0])
467 # Find a suitable database interface header and library.
469 # Check for GNU dbm routines.
470 if test "$db" = "no" || test "$db" = "gdbm"
472 AC_CHECK_HEADER([gdbm.h], [
473 for lib in gdbm c dbm
475 AC_CHECK_LIB([$lib], [gdbm_fetch],
476 test "$lib" = "c" || DBLIBS="-l$lib"
477 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
478 AC_SUBST([DBTYPE], [gdbm])]
480 if test "$db" = "yes"
482 man_save_LIBS="$LIBS"
484 AC_CHECK_FUNCS([gdbm_exists])
485 LIBS="$man_save_LIBS"
491 # Check for Berkeley db routines (first version API).
492 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
493 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
494 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
495 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
496 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1 c])
498 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
499 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
501 # Check for UNIX ndbm routines.
502 if test "$db" = "no" || test "$db" = "ndbm"
504 AC_CHECK_HEADER([ndbm.h], [
505 for lib in ndbm c dbm
507 AC_CHECK_LIB([$lib], [dbm_fetch],
508 test "$lib" = "c" || DBLIBS="-l$lib"
509 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
510 AC_SUBST([DBTYPE], [ndbm])]
512 test "$db" = "yes" && break
516 if test "$db" != "yes"
520 AC_MSG_ERROR([Fatal: no supported database library/header found])
522 AC_MSG_ERROR([Fatal: $db: unsupported database library])
527 dnl MAN_ECHO_VAR(ENV-VARIABLE)
528 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
532 MAN_ECHO_VAR([CPPFLAGS])
533 MAN_ECHO_VAR([CFLAGS])
534 MAN_ECHO_VAR([LDFLAGS])
536 MAN_ECHO_VAR([DBLIBS])
538 # Transformed versions of program names for use in Automake variables.
539 MAN_TRANS_SUBST([apropos])
540 MAN_TRANS_SUBST([catman])
541 MAN_TRANS_SUBST([lexgrog])
542 MAN_TRANS_SUBST([man])
543 MAN_TRANS_SUBST([manconv])
544 MAN_TRANS_SUBST([mandb])
545 MAN_TRANS_SUBST([manpath])
546 MAN_TRANS_SUBST([whatis])
547 MAN_TRANS_SUBST([zsoelim])
549 # If we're cross-compiling, tests won't work.
550 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
552 AC_CONFIG_FILES([Makefile
554 gnulib/po/Makefile.in