2 # Check for specified utility (env var) - if unset, fail.
4 AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
5 [ if test -z "$2"; then
7 echo FATAL ERROR: $3 does not seem to be installed.
8 echo $1 cannot be built without a working $4 installation.
14 #check compiler can generate dependencies
16 AC_DEFUN([AC_PACKAGE_GCC_DEPS],
17 [AC_CACHE_CHECK(whether gcc -MM is supported,
19 [cat > conftest.c <<EOF
21 int main() { exit(0); }
24 if ${CC} -MM conftest.c >/dev/null 2>&1; then
27 rm -f conftest.c a.out
32 # Generic macro, sets up all of the global build variables.
33 # The following environment variables may be set to override defaults:
34 # CC MAKE LIBTOOL TAR ZIP eMAKEDEPEND AWK SED ECHO SORT
37 AC_DEFUN([AC_PACKAGE_UTILITIES],
41 AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler])
43 if test -z "$MAKE"; then
44 AC_PATH_PROG(MAKE, gmake,, /usr/bin:/usr/local/bin)
46 if test -z "$MAKE"; then
47 AC_PATH_PROG(MAKE, make,, /usr/bin)
51 AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make])
53 if test -z "$LIBTOOL"; then
54 AC_PATH_PROG(LIBTOOL, glibtool,, /usr/bin)
56 if test -z "$LIBTOOL"; then
57 AC_PATH_PROG(LIBTOOL, libtool,, /usr/bin:/usr/local/bin)
61 AC_PACKAGE_NEED_UTILITY($1, "$libtool", libtool, [GNU libtool])
63 if test -z "$TAR"; then
64 AC_PATH_PROG(TAR, tar,, /bin:/usr/local/bin:/usr/bin)
68 if test -z "$ZIP"; then
69 AC_PATH_PROG(ZIP, gzip,, /bin:/usr/bin:/usr/local/bin)
77 if test $ac_cv_gcc_nodeps = no; then
82 if test -z "$AWK"; then
83 AC_PATH_PROG(AWK, awk,, /bin:/usr/bin)
88 if test -z "$SED"; then
89 AC_PATH_PROG(SED, sed,, /bin:/usr/bin)
94 if test -z "$ECHO"; then
95 AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin)
100 if test -z "$SORT"; then
101 AC_PATH_PROG(SORT, sort,, /bin:/usr/bin)
106 dnl check if symbolic links are supported
109 if test "$enable_gettext" = yes; then
110 if test -z "$MSGFMT"; then
111 AC_PATH_PROG(MSGFMT, msgfmt,, /usr/bin:/usr/local/bin)
115 AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext)
117 if test -z "$MSGMERGE"; then
118 AC_PATH_PROG(MSGMERGE, msgmerge,, /usr/bin:/usr/local/bin)
122 AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext)
125 if test -z "$RPM"; then
126 AC_PATH_PROG(RPM, rpm,, /bin:/usr/bin)
131 dnl .. and what version is rpm
133 test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \
134 | awk '{print $NF}' | awk -F. '{V=1; print $V}'`
135 AC_SUBST(rpm_version)
136 dnl At some point in rpm 4.0, rpm can no longer build rpms, and
137 dnl rpmbuild is needed (rpmbuild may go way back; not sure)
138 dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm
139 if test $rpm_version -ge 4; then
140 AC_PATH_PROG(RPMBUILD, rpmbuild)