1
2dnl  Copyright 2005 Red Hat, Inc.
3dnl 
4dnl  Permission to use, copy, modify, distribute, and sell this software and its
5dnl  documentation for any purpose is hereby granted without fee, provided that
6dnl  the above copyright notice appear in all copies and that both that
7dnl  copyright notice and this permission notice appear in supporting
8dnl  documentation, and that the name of Red Hat not be used in
9dnl  advertising or publicity pertaining to distribution of the software without
10dnl  specific, written prior permission.  Red Hat makes no
11dnl  representations about the suitability of this software for any purpose.  It
12dnl  is provided "as is" without express or implied warranty.
13dnl 
14dnl  RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15dnl  INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16dnl  EVENT SHALL RED HAT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17dnl  CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18dnl  DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19dnl  TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20dnl  PERFORMANCE OF THIS SOFTWARE.
21dnl
22dnl Process this file with autoconf to create configure.
23
24# Initialize Autoconf
25AC_PREREQ([2.60])
26AC_INIT([xman], [1.2.0],
27        [https://gitlab.freedesktop.org/xorg/app/xman/-/issues/], [xman])
28AC_CONFIG_SRCDIR([Makefile.am])
29AC_CONFIG_HEADERS([config.h])
30
31# Initialize Automake
32AM_INIT_AUTOMAKE([foreign dist-xz])
33
34# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
35m4_ifndef([XORG_MACROS_VERSION],
36	  [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
37XORG_MACROS_VERSION(1.8)
38XORG_DEFAULT_OPTIONS
39
40AC_CANONICAL_HOST
41
42AC_CHECK_PROG([GROFF], [groff], [found], [missing])
43if test "x$GROFF" = "xfound" ; then
44   AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.])
45fi
46
47AC_CHECK_PROG([MANDB], [mandb], [yes], [no])
48if test x"$MANDB" = xyes; then
49	AC_DEFINE([HAVE_MANDB], 1, [Define if the man implementation is man-db])
50fi
51
52# Checks for typedefs, structures, and compiler characteristics.
53AC_SYS_LARGEFILE
54
55# Checks for library functions.
56AC_CHECK_FUNCS([mkstemp])
57
58AC_ARG_WITH(helpdir,
59        AS_HELP_STRING([--with-helpdir=<path>],
60                       [Set default directory for xman.help (default: ${datadir}/X11)]),
61        [HELPDIR="$withval"],
62        [HELPDIR=${datadir}/X11])
63AC_SUBST([HELPDIR])
64
65AC_ARG_WITH(sysmanpath,
66        AS_HELP_STRING([--with-sysmanpath=<path>],
67                       [Set default system man page search path]),
68        [SYSMANPATH="$withval"], [])
69if test x$SYSMANPATH != x; then
70    AC_DEFINE_UNQUOTED(SYSMANPATH, "$SYSMANPATH", 
71	[Default system man page search path (default: none)])
72fi
73
74AC_ARG_WITH(localmanpath,
75        AS_HELP_STRING([--with-localmanpath=<path>],
76                       [Set default local man page search path]),
77        [LOCALMANPATH="$withval"], [])
78if test x$LOCALMANPATH != x; then
79    AC_DEFINE_UNQUOTED(LOCALMANPATH, "$LOCALMANPATH", 
80	[Default local man page search path (default: none)])
81fi
82
83# Obtain compiler/linker options from dependencies
84PKG_CHECK_MODULES(XMAN, [xproto >= 7.0.17 xaw7 xt])
85
86AC_ARG_WITH(manconfig,
87        AS_HELP_STRING([--with-manconfig=<filename>],
88                       [Set default system man configuration file]),
89        [MANCONF="$withval"], [])
90if test x$MANCONF = x; then
91# Check for man page config files
92    AC_CHECK_FILE([/etc/man.conf], [MANCONF="/etc/man.conf"], 
93                  AC_CHECK_FILE([/etc/man.config], [MANCONF="/etc/man.config"], 
94                                AC_CHECK_FILE([/etc/manpath.config], [MANCONF="/etc/manpath.config"],
95                                              AC_CHECK_FILE([/usr/share/misc/man.conf], [MANCONF="/usr/share/misc/man.conf"]))))
96fi
97
98if test x$MANCONF != x ; then
99    AC_DEFINE_UNQUOTED(MANCONF, "$MANCONF", 
100	[Define to path to man config file if you have one])
101
102    # Try to determine format of config file
103    # would be better to somehow determine from the files themselves, but
104    # we'll guess based on pathname and OS for now (mirrors old Imake tests)
105    AC_MSG_CHECKING([man config file format])
106    if test x$MANCONF = x/etc/manpath.config ; then
107	MAN_CONFIG_STYLE="FreeBSD"
108    else
109	case $host_os in
110	*darwin* | *openbsd* | *netbsd* )
111	    MAN_CONFIG_STYLE="OpenBSD"
112	    ;;
113	*linux* | cygwin* )
114	    MAN_CONFIG_STYLE="Linux"
115	    ;;
116	*bsd* )
117	    MAN_CONFIG_STYLE="BSD"
118	    ;;
119	*)
120	    ;;
121	esac
122    fi
123    AC_MSG_RESULT($MAN_CONFIG_STYLE)
124
125    case $MAN_CONFIG_STYLE in
126	FreeBSD)
127	    AC_DEFINE([MANCONFIGSTYLE_FreeBSD],1,
128		[Define to 1 if you have FreeBSD format manpath.config])
129	    ;;
130	OpenBSD)
131	    AC_DEFINE([MANCONFIGSTYLE_OpenBSD],1,
132		[Define to 1 if you have OpenBSD format manpath.config])
133	    ;;
134	BSD)
135	    AC_DEFINE([MANCONFIGSTYLE_BSD],1,
136		[Define to 1 if you have BSD format manpath.config])
137	    ;;
138	Linux)
139	    AC_DEFINE([MANCONFIGSTYLE_Linux],1,
140		[Define to 1 if you have Linux format man.conf or man.config])
141	    ;;
142	*)
143	    AC_MSG_ERROR([Could not determine man page file config format.])
144    esac
145fi
146
147PKG_CHECK_MODULES(APPDEFS, xt)
148xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`
149AC_ARG_WITH(appdefaultdir,
150	AS_HELP_STRING([--with-appdefaultdir=<pathname>],
151	  [specify directory for app-defaults files (default is autodetected)]),
152	[appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
153AC_SUBST(appdefaultdir)
154
155if test "x$RELEASE_VERSION" != "x"; then
156	AC_DEFINE_UNQUOTED([RELEASE_VERSION], "$RELEASE_VERSION", 
157		[Release version string if set])
158fi
159
160AC_CONFIG_FILES([
161	Makefile
162	man/Makefile])
163AC_OUTPUT
164