diff --git a/Makefile.am b/Makefile.am index 58e98d0..53388b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,8 @@ doc : Doxyfile .PHONY: doc endif -INDENT_CMD = indent -br -brs -ce --line-length120 -nut -i2 +if HAS_INDENT +INDENT_ARGS = -br -brs -ce --line-length120 -nut -i2 indent: - find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]" -exec $(INDENT_CMD) '{}' \; + find $(top_srcdir)/libnfc $(top_srcdir)/include $(top_srcdir)/examples -name "*.[hc]" -exec $(INDENT) $(INDENT_ARGS) '{}' ';' +endif diff --git a/configure.ac b/configure.ac index f673de3..b0473a8 100644 --- a/configure.ac +++ b/configure.ac @@ -90,6 +90,16 @@ then fi AM_CONDITIONAL(DOC_ENABLED, [test x"$enable_doc" = xyes]) +# The indent target require GNU indent +AC_PATH_PROG([INDENT], [indent]) +AC_PATH_PROG([GINDENT], [gindent]) +if test x"$GINDENT" != x""; then + INDENT="$GINDENT" +fi + +AC_SUBST(INDENT) +AM_CONDITIONAL(HAS_INDENT, [test x"$INDENT" != x""]) + # Dependencies PKG_CONFIG_REQUIRES=""