[Mesa-dev] [PATCH] automake: Check for 'indent' and fall back to 'cat' if not found.

Kenneth Graunke kenneth at whitecape.org
Tue May 29 16:07:15 PDT 2012


The glapi generator code uses indent to produce more readable code.
However, we don't want to make GNU indent a hard build dependency; check
for it in configure.ac and fall back to 'cat' if it's not available.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 configs/autoconf.in |    4 ++++
 configure.ac        |    5 +++++
 2 files changed, 9 insertions(+)

Oops.  Yeah, I actually ran into that the other day too...had to
install GNU indent.  I totally agree, now that we build every time,
we need to make sure it's possible to build without it.

Hopefully this should do the trick.  I tested it both with and without
indent, and it seemed to work fine.

The one case it won't handle is if you have a program called 'indent'
that isn't GNU indent (and thus doesn't accept those options).

diff --git a/configs/autoconf.in b/configs/autoconf.in
index 38f49a2..2a111c7 100644
--- a/configs/autoconf.in
+++ b/configs/autoconf.in
@@ -64,6 +64,10 @@ NM = @NM@
 # Perl
 PERL = @PERL@
 
+# Indent (used for generating dispatch tables)
+INDENT = @INDENT@
+INDENT_FLAGS = @INDENT_FLAGS@
+
 # Python and flags (generally only needed by the developers)
 PYTHON2 = @PYTHON2@
 PYTHON_FLAGS = -t -O -O
diff --git a/configure.ac b/configure.ac
index 20bd00b..9fb8149 100644
--- a/configure.ac
+++ b/configure.ac
@@ -72,6 +72,11 @@ AC_PROG_LEX
 
 AC_PATH_PROG([PERL], [perl])
 
+AC_CHECK_PROG(INDENT, indent, indent, cat)
+if test "x$INDENT" != "xcat"; then
+    AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool')
+fi
+
 dnl Our fallback install-sh is a symlink to minstall. Use the existing
 dnl configuration in that case.
 AC_PROG_INSTALL
-- 
1.7.10.2



More information about the mesa-dev mailing list