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.3], [cjwatson@debian.org])
6 AC_CONFIG_AUX_DIR([tools])
7 AM_INIT_AUTOMAKE([1.10 -Wall -Wno-override -Werror foreign dist-xz no-dist-gzip])
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"
148 gl_WARN_ADD([-W], [CFLAGS])
149 gl_WARN_ADD([-Wpointer-arith], [CFLAGS])
150 gl_WARN_ADD([-Wwrite-strings], [CFLAGS])
151 gl_WARN_ADD([-Wstrict-prototypes], [CFLAGS])
152 gl_WARN_ADD([-Wshadow], [CFLAGS])
153 gl_WARN_ADD([-Wformat-security], [CFLAGS])
154 gl_WARN_ADD([-Wredundant-decls], [CFLAGS])
155 gl_WARN_ADD([-Wno-missing-field-initializers], [CFLAGS])
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)"
279 AC_CHECK_PROGS([preconv], [gpreconv preconv])
281 AC_MSG_CHECKING([for groff with Debian multibyte patch or real Unicode support])
283 AC_ARG_ENABLE([mb-groff],
284 [AS_HELP_STRING([--enable-mb-groff], [expect groff with Debian multibyte patch or real Unicode support])],
285 [if test "$enableval" = "yes"
289 [if test -n "$preconv"
292 elif test -n "$troff" && test "$troff_is_groff" = "yes"
294 if $troff -Tnippon </dev/null >/dev/null 2>&1
299 AC_MSG_RESULT([$man_mb_groff])
300 if test "$man_mb_groff" = "yes"
302 AC_DEFINE([MULTIBYTE_GROFF], 1,
303 [Define if your groff installation has the Debian multibyte patch.])
306 MAN_CHECK_PROGS([eqn], [EQN], [use EQN to preprocess equations], [eqn geqn])
307 MAN_CHECK_PROGS([neqn], [NEQN], [use NEQN to preprocess equations for character devices], [neqn gneqn])
308 # If we fail to find an neqn, use eqn and try to force it to output for an
309 # ascii device. As this is only relevant for equations (?), not using latin1
310 # should be acceptable. -Tlatin1 is ignored by some eqn implementations.
314 (test -n "$nroff_device" && neqn="$eqn -T$nroff_device" || neqn="$eqn -Tascii")
316 MAN_CHECK_PROGS([tbl], [TBL], [use TBL to preprocess tables], [tbl gtbl])
317 MAN_CHECK_PROGS([col], [COL], [use COL to filter formatting characters from output], [col gcol])
318 MAN_CHECK_PROGS([vgrind], [VGRIND], [use VGRIND to preprocess program sources], [vgrind gvgrind])
319 MAN_CHECK_PROGS([refer], [REFER], [use REFER to preprocess bibliographic references], [refer grefer])
320 MAN_CHECK_PROGS([grap], [GRAP], [use GRAP to preprocess graphs], [grap])
321 MAN_CHECK_PROGS([pic], [PIC], [use PIC to preprocess pictures], [pic gpic])
322 test -n "$pic" && pic="$pic -S"
324 MAN_CHECK_PROGS([gzip], [GZIP], [use GZIP as GNU compression utility], [gzip])
328 compressor="$gzip -c7"
331 MAN_CHECK_PROGS([compress], [COMPRESS], [use COMPRESS as UNIX compression utility], [compress])
332 if test -n "$compress"
334 uncompress="$compress -dc"
337 compressor="$compress -c"
341 MAN_CHECK_PROGS([bzip2], [BZIP2], [use BZIP2 as block-sorting compression utility], [bzip2])
346 MAN_CHECK_PROGS([xz], [XZ], [use XZ as Lempel-Ziv-Markov chain-Algorithm compression utility], [xz])
352 dnl lzma not used/needed if we have xz
353 MAN_CHECK_PROGS([lzma], [LZMA], [use LZMA as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzma])
359 MAN_CHECK_PROGS([lzip], [LZIP], [use LZIP as Lempel-Ziv-Markov chain-Algorithm compression utility], [lzip])
364 if test -n "$gzip" || test -n "$compress" || test -n "$bzip2" || test -n "$xz" || test -n "$lzip" || test -n "$lzma"
366 AC_DEFINE([COMP_CAT], [1], [Define if you have compressors and want to support compressed cat files.])
367 AC_DEFINE([COMP_SRC], [1], [Define if you have compressors and want to support compressed manual source.])
369 AC_SUBST([compressor])
370 AC_SUBST([compress_ext])
372 AC_SUBST([uncompress])
377 MAN_COMPRESS_LIB([z], [gzopen])
378 dnl To add more decompressors just follow the scheme above.
380 # Work out which manual page hierarchy scheme might be in use.
381 AC_ARG_ENABLE([mandirs],
382 [AS_HELP_STRING([--enable-mandirs=OS], [select manual page hierarchy organization (GNU, HPUX, IRIX, Solaris, BSD)])],
383 [AC_MSG_NOTICE([Using $enableval hierarchy organization(s)])
384 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$enableval"],
385 [Define to the manual page hierarchy organization(s) in use.])],
388 *-hpux*) mandirs=HPUX;;
389 *-irix*) mandirs=IRIX;;
390 *-solaris*) mandirs=Solaris;;
391 *-bsd*) mandirs=BSD;;
394 if test -n "$mandirs"; then
395 AC_MSG_NOTICE([Using $mandirs hierarchy organization])
396 AC_DEFINE_UNQUOTED([MANDIR_LAYOUT], ["$mandirs"])
398 AC_MSG_NOTICE([Allowing any hierarchy organization])
399 AC_DEFINE([MANDIR_LAYOUT], [""])
402 # Check for various header files and associated libraries.
404 dnl AC_PROG_LEX calls AC_TRY_LINK: must come after above 3
409 AC_CHECK_HEADERS([fcntl.h sys/file.h])
411 # Internationalization support.
412 AM_GNU_GETTEXT([external])
413 AM_GNU_GETTEXT_VERSION([0.18.1])
419 # Checks for structures and compiler characteristics.
426 # Check for pipeline library.
427 PKG_CHECK_MODULES([libpipeline], [libpipeline >= 1.1.0])
429 # Find a suitable database interface header and library.
431 # Check for GNU dbm routines.
432 if test "$db" = "no" || test "$db" = "gdbm"
434 AC_CHECK_HEADER([gdbm.h], [
435 for lib in gdbm c dbm
437 AC_CHECK_LIB([$lib], [gdbm_fetch],
438 test "$lib" = "c" || DBLIBS="-l$lib"
439 [AC_DEFINE([GDBM], [1], [Define if you have, and want to use, gdbm interface routines.])
440 AC_SUBST([DBTYPE], [gdbm])]
442 if test "$db" = "yes"
444 man_save_LIBS="$LIBS"
446 AC_CHECK_FUNCS([gdbm_exists])
447 LIBS="$man_save_LIBS"
453 # Check for Berkeley db routines (first version API).
454 MAN_CHECK_BDB([db5 db], [db5/db_185.h db_185.h], [db5 db-5])
455 MAN_CHECK_BDB([db4 db], [db4/db_185.h db_185.h], [db4 db-4])
456 MAN_CHECK_BDB([db3 db], [db3/db_185.h db_185.h], [db3])
457 MAN_CHECK_BDB([db2 db], [db_185.h db2/db_185.h db2_185.h], [db2 db])
458 MAN_CHECK_BDB([db1 db], [db/db.h db.h db1/db.h], [db db1])
460 dnl MAN_CHECK_BDB([db2], [db2_185.h], [db2 db c], [AC_DEFINE(DB_ON_LIBC)])
461 dnl MAN_CHECK_BDB([db2], [db2/db_185.h], [db2 db c])
462 dnl # from package libdb1-dev
463 dnl MAN_CHECK_BDB([db], [db/db.h], [db c])
464 dnl # from package libc6-dev
465 dnl # ########## statically linked #####
466 dnl MAN_CHECK_BDB([db], [db1/db.h], [db c], [AC_DEFINE(DB_ON_LIBC)])
468 # Check for UNIX ndbm routines.
469 if test "$db" = "no" || test "$db" = "ndbm"
471 AC_CHECK_HEADER([ndbm.h], [
472 for lib in ndbm c dbm
474 AC_CHECK_LIB([$lib], [dbm_fetch],
475 test "$lib" = "c" || DBLIBS="-l$lib"
476 [AC_DEFINE([NDBM], [1], [Define if you have, and want to use, ndbm interface routines.])
477 AC_SUBST([DBTYPE], [ndbm])]
479 test "$db" = "yes" && break
483 if test "$db" != "yes"
487 AC_MSG_ERROR([Fatal: no supported database library/header found])
489 AC_MSG_ERROR([Fatal: $db: unsupported database library])
494 dnl MAN_ECHO_VAR(ENV-VARIABLE)
495 define([MAN_ECHO_VAR], [AC_MSG_NOTICE([default $1 = "$$1"])])dnl
499 MAN_ECHO_VAR([CPPFLAGS])
500 MAN_ECHO_VAR([CFLAGS])
501 MAN_ECHO_VAR([LDFLAGS])
503 MAN_ECHO_VAR([DBLIBS])
505 # Transformed versions of program names for use in Automake variables.
506 MAN_TRANS_SUBST([apropos])
507 MAN_TRANS_SUBST([catman])
508 MAN_TRANS_SUBST([lexgrog])
509 MAN_TRANS_SUBST([man])
510 MAN_TRANS_SUBST([manconv])
511 MAN_TRANS_SUBST([mandb])
512 MAN_TRANS_SUBST([manpath])
513 MAN_TRANS_SUBST([whatis])
514 MAN_TRANS_SUBST([zsoelim])
516 # If we're cross-compiling, tests won't work.
517 AM_CONDITIONAL([CROSS_COMPILING], [test "x$cross_compiling" = xyes])
519 AC_CONFIG_FILES([Makefile
521 gnulib/po/Makefile.in