configure.ac revision ae5a67ad
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.1.5],
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-bzip2])
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
52AC_CHECK_FUNCS([mkstemp])
53
54AC_ARG_WITH(helpdir,
55        AS_HELP_STRING([--with-helpdir=<path>],
56                       [Set default directory for xman.help (default: ${datadir}/X11)]),
57        [HELPDIR="$withval"],
58        [HELPDIR=${datadir}/X11])
59AC_SUBST([HELPDIR])
60
61AC_ARG_WITH(sysmanpath,
62        AS_HELP_STRING([--with-sysmanpath=<path>],
63                       [Set default system man page search path]),
64        [SYSMANPATH="$withval"], [])
65if test x$SYSMANPATH != x; then
66    AC_DEFINE_UNQUOTED(SYSMANPATH, "$SYSMANPATH", 
67	[Default system man page search path (default: none)])
68fi
69
70AC_ARG_WITH(localmanpath,
71        AS_HELP_STRING([--with-localmanpath=<path>],
72                       [Set default local man page search path]),
73        [LOCALMANPATH="$withval"], [])
74if test x$LOCALMANPATH != x; then
75    AC_DEFINE_UNQUOTED(LOCALMANPATH, "$LOCALMANPATH", 
76	[Default local man page search path (default: none)])
77fi
78
79# Obtain compiler/linker options from depedencies
80PKG_CHECK_MODULES(XMAN, [xproto >= 7.0.17 xaw7 xt])
81
82AC_ARG_WITH(manconfig,
83        AS_HELP_STRING([--with-manconfig=<filename>],
84                       [Set default system man configuration file]),
85        [MANCONF="$withval"], [])
86if test x$MANCONF = x; then
87# Check for man page config files
88    AC_CHECK_FILE([/etc/man.conf], [MANCONF="/etc/man.conf"], 
89                  AC_CHECK_FILE([/etc/man.config], [MANCONF="/etc/man.config"], 
90                                AC_CHECK_FILE([/etc/manpath.config], [MANCONF="/etc/manpath.config"],
91                                              AC_CHECK_FILE([/usr/share/misc/man.conf], [MANCONF="/usr/share/misc/man.conf"]))))
92fi
93
94if test x$MANCONF != x ; then
95    AC_DEFINE_UNQUOTED(MANCONF, "$MANCONF", 
96	[Define to path to man config file if you have one])
97
98    # Try to determine format of config file
99    # would be better to somehow determine from the files themselves, but
100    # we'll guess based on pathname and OS for now (mirrors old Imake tests)
101    AC_MSG_CHECKING([man config file format])
102    if test x$MANCONF = x/etc/manpath.config ; then
103	MAN_CONFIG_STYLE="FreeBSD"
104    else
105	case $host_os in
106	*darwin* | *openbsd* | *netbsd* )
107	    MAN_CONFIG_STYLE="OpenBSD"
108	    ;;
109	*linux* | cygwin* )
110	    MAN_CONFIG_STYLE="Linux"
111	    ;;
112	*bsd* )
113	    MAN_CONFIG_STYLE="BSD"
114	    ;;
115	*)
116	    ;;
117	esac
118    fi
119    AC_MSG_RESULT($MAN_CONFIG_STYLE)
120
121    case $MAN_CONFIG_STYLE in
122	FreeBSD)
123	    AC_DEFINE([MANCONFIGSTYLE_FreeBSD],1,
124		[Define to 1 if you have FreeBSD format manpath.config])
125	    ;;
126	OpenBSD)
127	    AC_DEFINE([MANCONFIGSTYLE_OpenBSD],1,
128		[Define to 1 if you have OpenBSD format manpath.config])
129	    ;;
130	BSD)
131	    AC_DEFINE([MANCONFIGSTYLE_BSD],1,
132		[Define to 1 if you have BSD format manpath.config])
133	    ;;
134	Linux)
135	    AC_DEFINE([MANCONFIGSTYLE_Linux],1,
136		[Define to 1 if you have Linux format man.conf or man.config])
137	    ;;
138	*)
139	    AC_MSG_ERROR([Could not determine man page file config format.])
140    esac
141fi
142
143PKG_CHECK_MODULES(APPDEFS, xt)
144xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`
145AC_ARG_WITH(appdefaultdir,
146	AS_HELP_STRING([--with-appdefaultdir=<pathname>],
147	  [specify directory for app-defaults files (default is autodetected)]),
148	[appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
149AC_SUBST(appdefaultdir)
150
151if test "x$RELEASE_VERSION" != "x"; then
152	AC_DEFINE_UNQUOTED([RELEASE_VERSION], "$RELEASE_VERSION", 
153		[Release version string if set])
154fi
155
156AC_CONFIG_FILES([
157	Makefile
158	man/Makefile])
159AC_OUTPUT
160