1 dnl Copyright (C) 2003, 2004, 2005, 2006, 2007 Silicon Graphics, Inc.
3 dnl This program is free software: you can redistribute it and/or modify it
4 dnl under the terms of the GNU General Public License as published by
5 dnl the Free Software Foundation, either version 2 of the License, or
6 dnl (at your option) any later version.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 dnl GNU General Public License for more details.
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # Check for specified utility (env var) - if unset, fail.
18 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
19 [ if test -z "$2"; then
21 echo FATAL ERROR: $3 does not seem to be installed.
22 echo $1 cannot be built without a working $4 installation.
28 # Generic macro, sets up all of the global build variables.
29 # The following environment variables may be set to override defaults:
30 # CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
31 # MSGFMT MSGMERGE XGETTEXT RPM
33 AC_DEFUN([AC_PACKAGE_UTILITIES],
37 AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
39 search_path="$PATH$PATH_SEPARATOR/usr/freeware/bin$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR/usr/local/bin"
41 AC_PATH_PROGS(MAKE, gmake make,, $search_path)
44 AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
46 AC_PATH_PROG(TAR, tar,, $search_path)
50 AC_PATH_PROG(ZIP, gzip,, $search_path)
54 AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
55 makedepend=$MAKEDEPEND
58 AC_PATH_PROG(AWK, awk,, $search_path)
62 AC_PATH_PROG(SED, sed,, $search_path)
66 AC_PATH_PROG(ECHO, echo,, $search_path)
70 AC_PATH_PROG(SORT, sort,, $search_path)
74 dnl check if symbolic links are supported
77 if test "$enable_gettext" = yes; then
78 AC_PATH_PROG(MSGFMT, msgfmt,, $search_path)
81 AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
83 AC_PATH_PROG(MSGMERGE, msgmerge,, $search_path)
86 AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
88 AC_PATH_PROG(XGETTEXT, xgettext,, $search_path)
91 AC_PACKAGE_NEED_UTILITY($1, "$xgettext", xgettext, gettext)
93 AC_DEFINE([ENABLE_GETTEXT], 1, [enable gettext])
96 AC_PATH_PROG(RPM, rpm,, $search_path)
100 dnl .. and what version is rpm
102 test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
103 | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
104 AC_SUBST(rpm_version)
105 dnl At some point in rpm 4.0, rpm can no longer build rpms, and
106 dnl rpmbuild is needed (rpmbuild may go way back; not sure)
107 dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm
108 if test $rpm_version -ge 4; then
109 AC_PATH_PROG(RPMBUILD, rpmbuild)