automake: Check for 'indent' and fall back to 'cat' if not found.
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 29 May 2012 23:03:05 +0000 (16:03 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 30 May 2012 20:39:30 +0000 (13:39 -0700)
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.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50484
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
configs/autoconf.in
configure.ac

index 38f49a2..2a111c7 100644 (file)
@@ -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
index 20bd00b..9fb8149 100644 (file)
@@ -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