]>
Commit | Line | Data |
---|---|---|
14735703 JT |
1 | # Path to search an utility |
2 | PATH=/bin:/usr/bin:/usr/local/bin:/usr/freeware/bin:/opt/local/bin | |
3 | ||
16c44ed2 NS |
4 | # |
5 | # Check for specified utility (env var) - if unset, fail. | |
1b758ea9 | 6 | # |
16c44ed2 NS |
7 | AC_DEFUN([AC_PACKAGE_NEED_UTILITY], |
8 | [ if test -z "$2"; then | |
9 | echo | |
10 | echo FATAL ERROR: $3 does not seem to be installed. | |
11 | echo $1 cannot be built without a working $4 installation. | |
12 | exit 1 | |
13 | fi | |
14 | ]) | |
15 | ||
16 | # | |
d9320881 DC |
17 | #check compiler can generate dependencies |
18 | # | |
19 | AC_DEFUN([AC_PACKAGE_GCC_DEPS], | |
20 | [AC_CACHE_CHECK(whether gcc -MM is supported, | |
21 | ac_cv_gcc_nodeps, | |
22 | [cat > conftest.c <<EOF | |
23 | #include <stdio.h> | |
24 | int main() { exit(0); } | |
25 | EOF | |
26 | ac_cv_gcc_nodeps=no | |
27 | if ${CC} -MM conftest.c >/dev/null 2>&1; then | |
28 | ac_cv_gcc_nodeps=yes | |
29 | fi | |
30 | rm -f conftest.c a.out | |
31 | ]) | |
32 | ]) | |
33 | # | |
16c44ed2 NS |
34 | # Generic macro, sets up all of the global build variables. |
35 | # The following environment variables may be set to override defaults: | |
36 | # CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT | |
1b758ea9 | 37 | # MSGFMT MSGMERGE XGETTEXT RPM |
16c44ed2 NS |
38 | # |
39 | AC_DEFUN([AC_PACKAGE_UTILITIES], | |
c0211f67 | 40 | [ AC_PROG_CC |
16c44ed2 NS |
41 | cc="$CC" |
42 | AC_SUBST(cc) | |
43 | AC_PACKAGE_NEED_UTILITY($1, "$cc", cc, [C compiler]) | |
44 | ||
45 | if test -z "$MAKE"; then | |
14735703 | 46 | AC_PATH_PROG(MAKE, gmake,, $PATH) |
c0211f67 NS |
47 | fi |
48 | if test -z "$MAKE"; then | |
14735703 | 49 | AC_PATH_PROG(MAKE, make,, $PATH) |
16c44ed2 NS |
50 | fi |
51 | make=$MAKE | |
52 | AC_SUBST(make) | |
53 | AC_PACKAGE_NEED_UTILITY($1, "$make", make, [GNU make]) | |
54 | ||
16c44ed2 | 55 | if test -z "$TAR"; then |
14735703 | 56 | AC_PATH_PROG(TAR, tar,, $PATH) |
16c44ed2 NS |
57 | fi |
58 | tar=$TAR | |
59 | AC_SUBST(tar) | |
60 | if test -z "$ZIP"; then | |
14735703 | 61 | AC_PATH_PROG(ZIP, gzip,, $PATH) |
16c44ed2 | 62 | fi |
c0211f67 | 63 | |
16c44ed2 NS |
64 | zip=$ZIP |
65 | AC_SUBST(zip) | |
c0211f67 | 66 | |
d9320881 DC |
67 | AC_PACKAGE_GCC_DEPS() |
68 | makedepend="$cc -MM" | |
69 | if test $ac_cv_gcc_nodeps = no; then | |
70 | makedepend=/bin/true | |
16c44ed2 | 71 | fi |
16c44ed2 | 72 | AC_SUBST(makedepend) |
c0211f67 | 73 | |
16c44ed2 | 74 | if test -z "$AWK"; then |
c0211f67 | 75 | AC_PATH_PROG(AWK, awk,, /bin:/usr/bin) |
16c44ed2 NS |
76 | fi |
77 | awk=$AWK | |
78 | AC_SUBST(awk) | |
c0211f67 | 79 | |
16c44ed2 | 80 | if test -z "$SED"; then |
c0211f67 | 81 | AC_PATH_PROG(SED, sed,, /bin:/usr/bin) |
16c44ed2 NS |
82 | fi |
83 | sed=$SED | |
84 | AC_SUBST(sed) | |
c0211f67 | 85 | |
16c44ed2 | 86 | if test -z "$ECHO"; then |
c0211f67 | 87 | AC_PATH_PROG(ECHO, echo,, /bin:/usr/bin) |
16c44ed2 NS |
88 | fi |
89 | echo=$ECHO | |
90 | AC_SUBST(echo) | |
c0211f67 | 91 | |
16c44ed2 | 92 | if test -z "$SORT"; then |
c0211f67 | 93 | AC_PATH_PROG(SORT, sort,, /bin:/usr/bin) |
16c44ed2 NS |
94 | fi |
95 | sort=$SORT | |
96 | AC_SUBST(sort) | |
97 | ||
98 | dnl check if symbolic links are supported | |
99 | AC_PROG_LN_S | |
100 | ||
101 | if test "$enable_gettext" = yes; then | |
102 | if test -z "$MSGFMT"; then | |
14735703 | 103 | AC_PATH_PROG(MSGFMT, msgfmt,, $PATH) |
16c44ed2 NS |
104 | fi |
105 | msgfmt=$MSGFMT | |
106 | AC_SUBST(msgfmt) | |
107 | AC_PACKAGE_NEED_UTILITY($1, "$msgfmt", msgfmt, gettext) | |
c0211f67 | 108 | |
16c44ed2 | 109 | if test -z "$MSGMERGE"; then |
14735703 | 110 | AC_PATH_PROG(MSGMERGE, msgmerge,, $PATH) |
16c44ed2 NS |
111 | fi |
112 | msgmerge=$MSGMERGE | |
113 | AC_SUBST(msgmerge) | |
114 | AC_PACKAGE_NEED_UTILITY($1, "$msgmerge", msgmerge, gettext) | |
1b758ea9 NS |
115 | |
116 | if test -z "$XGETTEXT"; then | |
14735703 | 117 | AC_PATH_PROG(XGETTEXT, xgettext,, $PATH) |
1b758ea9 NS |
118 | fi |
119 | xgettext=$XGETTEXT | |
120 | AC_SUBST(xgettext) | |
121 | AC_PACKAGE_NEED_UTILITY($1, "$xgettext", xgettext, gettext) | |
16c44ed2 NS |
122 | fi |
123 | ||
124 | if test -z "$RPM"; then | |
14735703 | 125 | AC_PATH_PROG(RPM, rpm,, $PATH) |
16c44ed2 NS |
126 | fi |
127 | rpm=$RPM | |
128 | AC_SUBST(rpm) | |
c0211f67 | 129 | |
16c44ed2 NS |
130 | dnl .. and what version is rpm |
131 | rpm_version=0 | |
a903a4ff | 132 | test -n "$RPM" && test -x "$RPM" && rpm_version=`$RPM --version \ |
16c44ed2 NS |
133 | | awk '{print $NF}' | awk -F. '{V=1; print $V}'` |
134 | AC_SUBST(rpm_version) | |
135 | dnl At some point in rpm 4.0, rpm can no longer build rpms, and | |
136 | dnl rpmbuild is needed (rpmbuild may go way back; not sure) | |
137 | dnl So, if rpm version >= 4.0, look for rpmbuild. Otherwise build w/ rpm | |
138 | if test $rpm_version -ge 4; then | |
139 | AC_PATH_PROG(RPMBUILD, rpmbuild) | |
140 | rpmbuild=$RPMBUILD | |
141 | else | |
142 | rpmbuild=$RPM | |
143 | fi | |
144 | AC_SUBST(rpmbuild) | |
145 | ]) |