build: Use ocamldep -all and -one-line flags instead of hacking the output.

We ran some sed scripts over the output of ocamldep to get them into a
single line format.  This actually broke the output of ocamldep,
combining multiple dependencies into single lines.  I didn't debug
exactly why our sed rules were broken because modern ocamldep has an
option (-one-line) which make this hacking unnecessary.

Another useful option (-all) is added so that all dependencies are
made explicit.

Since old ocamldep in RHEL 6 doesn't support these options, we have to
detect them at configure time.

The historical reason we were trying to combine entries into a single
line was so we could sort them.  That was only needed back when we
used to commit the dependency files (so the files were stable), but we
haven't committed dependency files in a long time.
This commit is contained in:
Richard W.M. Jones
2017-09-15 10:46:12 +01:00
parent 730c7fd352
commit 9ec726606c
2 changed files with 21 additions and 4 deletions

View File

@@ -56,6 +56,26 @@ AM_CONDITIONAL([HAVE_OCAMLOPT],
AM_CONDITIONAL([HAVE_OCAMLDOC],
[test "x$OCAMLDOC" != "xno"])
dnl Check if ocamldep has options -all and -one-line (not present in RHEL 6).
AC_MSG_CHECKING([if ocamldep has the -all option])
if ocamldep -all >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
OCAMLDEP_ALL="-all"
else
AC_MSG_RESULT([no])
OCAMLDEP_ALL=""
fi
AC_SUBST([OCAMLDEP_ALL])
AC_MSG_CHECKING([if ocamldep has the -one-line option])
if ocamldep -one-line >&AS_MESSAGE_LOG_FD 2>&1; then
AC_MSG_RESULT([yes])
OCAMLDEP_ONE_LINE="-one-line"
else
AC_MSG_RESULT([no])
OCAMLDEP_ONE_LINE=""
fi
AC_SUBST([OCAMLDEP_ONE_LINE])
if test "x$enable_daemon" = "xyes"; then
OCAML_PKG_hivex=no
AC_CHECK_OCAML_PKG(hivex)

View File

@@ -54,9 +54,6 @@ done
rm -f $output $output-t
@OCAMLFIND@ ocamldep $includes "$@" |
@SED@ 's/ *$//' |
@SED@ -e :a -e '/ *\\$/N; s/ *\\\n */ /; ta' |
sort > $output-t
@OCAMLFIND@ ocamldep @OCAMLDEP_ALL@ @OCAMLDEP_ONE_LINE@ $includes "$@" > $output-t
mv $output-t $output