summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2010-01-26 14:22:35 +1100
committerDave Chinner <david@fromorbit.com>2010-01-26 14:22:35 +1100
commit76f1b870d980f9fbef45298028e3a4a14d88c65f (patch)
treec054374e503ba5344f56331248d433cf70a5b56a /m4
parent82e1e14dba44ce53b93ef109d5479cafa3ac3596 (diff)
xfstests: Automatic build dependency calculations
Currently the xfstest builds do not have any automatic dependency calculations. It relies on a separate make depend run to build or update dependency information. It also relies on an external makedepend binary. If that binary does not exist, the dependencies do not get calculated. To remove the dependency on makedepend, gcc can be used instead as it has a command to generate dependency information. This patch changes the dependency rule building to use gcc. In case anyone uses an old (several years) gcc compiler or a compiler that doesn't support gcc compatible dependency generation, a new configure check is added to turn off dependency checking so builds can still be done. To use the dependencies automatically, we need to use a special include makefile directive to include the build dependencies into the current makefile. Essentially once the dependencies are calculated, they can be included into the makefile and make will recalculate the build dependencies automatically based on that information. Hence we get a build that automatically calculates and keeps dependencies up to date without dependence on any external tools. Signed-off-by: Dave Chinner <david@fromorbit.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'm4')
-rw-r--r--m4/package_utilies.m427
1 files changed, 23 insertions, 4 deletions
diff --git a/m4/package_utilies.m4 b/m4/package_utilies.m4
index c034a7c6..726406c8 100644
--- a/m4/package_utilies.m4
+++ b/m4/package_utilies.m4
@@ -11,9 +11,27 @@ AC_DEFUN([AC_PACKAGE_NEED_UTILITY],
])
#
+#check compiler can generate dependencies
+#
+AC_DEFUN([AC_PACKAGE_GCC_DEPS],
+ [AC_CACHE_CHECK(whether gcc -MM is supported,
+ ac_cv_gcc_nodeps,
+ [cat > conftest.c <<EOF
+ #include <stdio.h>
+ int main() { exit(0); }
+EOF
+ ac_cv_gcc_nodeps=no
+ if ${CC} -MM conftest.c >/dev/null 2>&1; then
+ ac_cv_gcc_nodeps=yes
+ fi
+ rm -f conftest.c a.out
+ ])
+ ])
+
+#
# Generic macro, sets up all of the global build variables.
# The following environment variables may be set to override defaults:
-# CC MAKE LIBTOOL TAR ZIP MAKEDEPEND AWK SED ECHO SORT
+# CC MAKE LIBTOOL TAR ZIP eMAKEDEPEND AWK SED ECHO SORT
# MSGFMT MSGMERGE RPM
#
AC_DEFUN([AC_PACKAGE_UTILITIES],
@@ -54,10 +72,11 @@ AC_DEFUN([AC_PACKAGE_UTILITIES],
zip=$ZIP
AC_SUBST(zip)
- if test -z "$MAKEDEPEND"; then
- AC_PATH_PROG(MAKEDEPEND, makedepend, /bin/true)
+ AC_PACKAGE_GCC_DEPS()
+ makedepend="$cc -MM"
+ if test $ac_cv_gcc_nodeps = no; then
+ makedepend=/bin/true
fi
- makedepend=$MAKEDEPEND
AC_SUBST(makedepend)
if test -z "$AWK"; then