configure.ac revision 6d36ef34
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
24AC_PREREQ([2.60])
25AC_INIT([xman], [1.1.3],
26        [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xman])
27AM_INIT_AUTOMAKE([foreign dist-bzip2])
28AM_MAINTAINER_MODE
29
30# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
31m4_ifndef([XORG_MACROS_VERSION],
32	  [m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
33XORG_MACROS_VERSION(1.8)
34XORG_DEFAULT_OPTIONS
35
36AC_CONFIG_HEADERS([config.h])
37
38AC_CANONICAL_HOST
39
40AC_CHECK_PROG([GROFF], [groff], [found], [missing])
41if test "x$GROFF" = "xfound" ; then
42   AC_DEFINE([HAS_GROFF], 1, [Define to 1 if you have the groff package.])
43fi
44
45AC_CHECK_FUNCS([mkstemp])
46
47AC_ARG_WITH(helpdir,
48        AS_HELP_STRING([--with-helpdir=<path>],
49                       [Set default directory for xman.help (default: ${datadir}/X11)]),
50        [HELPDIR="$withval"],
51        [HELPDIR=${datadir}/X11])
52AC_SUBST([HELPDIR])
53
54AC_ARG_WITH(sysmanpath,
55        AS_HELP_STRING([--with-sysmanpath=<path>],
56                       [Set default system man page search path]),
57        [SYSMANPATH="$withval"], [])
58if test x$SYSMANPATH != x; then
59    AC_DEFINE_UNQUOTED(SYSMANPATH, "$SYSMANPATH", 
60	[Default system man page search path (default: none)])
61fi
62
63AC_ARG_WITH(localmanpath,
64        AS_HELP_STRING([--with-localmanpath=<path>],
65                       [Set default local man page search path]),
66        [LOCALMANPATH="$withval"], [])
67if test x$LOCALMANPATH != x; then
68    AC_DEFINE_UNQUOTED(LOCALMANPATH, "$LOCALMANPATH", 
69	[Default local man page search path (default: none)])
70fi
71
72# Obtain compiler/linker options from depedencies
73PKG_CHECK_MODULES(XMAN, [xproto >= 7.0.17 xaw7 xt])
74
75AC_ARG_WITH(manconfig,
76        AS_HELP_STRING([--with-manconfig=<filename>],
77                       [Set default system man configuration file]),
78        [MANCONF="$withval"], [])
79if test x$MANCONF = x; then
80# Check for man page config files
81    AC_CHECK_FILE([/etc/man.conf], [MANCONF="/etc/man.conf"], 
82                  AC_CHECK_FILE([/etc/man.config], [MANCONF="/etc/man.config"], 
83                                AC_CHECK_FILE([/etc/manpath.config], [MANCONF="/etc/manpath.config"],
84                                              AC_CHECK_FILE([/usr/share/misc/man.conf], [MANCONF="/usr/share/misc/man.conf"]))))
85fi
86
87if test x$MANCONF != x ; then
88    AC_DEFINE_UNQUOTED(MANCONF, "$MANCONF", 
89	[Define to path to man config file if you have one])
90
91    # Try to determine format of config file
92    # would be better to somehow determine from the files themselves, but
93    # we'll guess based on pathname and OS for now (mirrors old Imake tests)
94    AC_MSG_CHECKING([man config file format])
95    if test x$MANCONF = x/etc/manpath.config ; then
96	MAN_CONFIG_STYLE="FreeBSD"
97    else
98	case $host_os in
99	*darwin* | *openbsd* | *netbsd* )
100	    MAN_CONFIG_STYLE="OpenBSD"
101	    ;;
102	*linux* | cygwin* )
103	    MAN_CONFIG_STYLE="Linux"
104	    ;;
105	*bsd* )
106	    MAN_CONFIG_STYLE="BSD"
107	    ;;
108	*)
109	    ;;
110	esac
111    fi
112    AC_MSG_RESULT($MAN_CONFIG_STYLE)
113
114    case $MAN_CONFIG_STYLE in
115	FreeBSD)
116	    AC_DEFINE([MANCONFIGSTYLE_FreeBSD],1,
117		[Define to 1 if you have FreeBSD format manpath.config])
118	    ;;
119	OpenBSD)
120	    AC_DEFINE([MANCONFIGSTYLE_OpenBSD],1,
121		[Define to 1 if you have OpenBSD format manpath.config])
122	    ;;
123	BSD)
124	    AC_DEFINE([MANCONFIGSTYLE_BSD],1,
125		[Define to 1 if you have BSD format manpath.config])
126	    ;;
127	Linux)
128	    AC_DEFINE([MANCONFIGSTYLE_Linux],1,
129		[Define to 1 if you have Linux format man.conf or man.config])
130	    ;;
131	*)
132	    AC_MSG_ERROR([Could not determine man page file config format.])
133    esac
134fi
135
136PKG_CHECK_MODULES(APPDEFS, xt)
137xt_appdefaultdir=`$PKG_CONFIG --variable=appdefaultdir xt`
138AC_ARG_WITH(appdefaultdir,
139	AS_HELP_STRING([--with-appdefaultdir=<pathname>],
140	  [specify directory for app-defaults files (default is autodetected)]),
141	[appdefaultdir="$withval"], [appdefaultdir="${xt_appdefaultdir}"])
142AC_SUBST(appdefaultdir)
143
144if test "x$RELEASE_VERSION" != "x"; then
145	AC_DEFINE_UNQUOTED([RELEASE_VERSION], "$RELEASE_VERSION", 
146		[Release version string if set])
147fi
148
149AC_CONFIG_FILES([
150	Makefile
151	man/Makefile])
152AC_OUTPUT
153