From 38b93ccfc3786d1c23726dc939de558f4dd2a2d3 Mon Sep 17 00:00:00 2001 From: Romain Dolbeau Date: Mon, 13 Apr 2015 14:16:28 +0200 Subject: [PATCH] In maintainer mode, detect whether 'indent' is available and is GNU indent. BSD 'indent' in e.g. MacOSX doesn't support -kr, which is the default style in FFTW3. Fallback to 'indent' with no option for non-GNU 'indent', or 'cat' if 'indent' is not available. This should fix GitHub issue #13. --- configure.ac | 19 +++++++++++++++++++ support/Makefile.codelets | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e0a938580..abf6fcab2 100644 --- a/configure.ac +++ b/configure.ac @@ -446,6 +446,25 @@ if test "$ac_test_CFLAGS" != "set"; then fi fi +dnl check for a proper indent in maintainer mode +if test "$USE_MAINTAINER_MODE" = yes; then + AC_PATH_PROG(INDENT, indent, indent) + # if INDENT is set to 'indent' then we didn't find indent + if test "$INDENT" != indent ; then + AC_MSG_CHECKING(if $INDENT is GNU indent) + if $INDENT --version 2>/dev/null | head -n 1|grep "GNU indent" > /dev/null ; then + AC_MSG_RESULT(yes) + INDENT="$INDENT -kr -cs -i5 -l800 -fca -nfc1 -sc -sob -cli4 -TR -Tplanner -TV" + else + AC_MSG_RESULT(no) + AC_MSG_WARN($INDENT does not appear to be GNU indent.) + fi + else + AC_MSG_WARN(no indent program found: codelets will be ugly) + INDENT=cat + fi +fi + dnl ----------------------------------------------------------------------- AC_ARG_ENABLE(fortran, [AC_HELP_STRING([--disable-fortran],[don't include Fortran-callable wrappers])], enable_fortran=$enableval, enable_fortran=yes) diff --git a/support/Makefile.codelets b/support/Makefile.codelets index 27dbf3840..b7045e647 100644 --- a/support/Makefile.codelets +++ b/support/Makefile.codelets @@ -38,7 +38,7 @@ maintainer-clean-local: if MAINTAINER_MODE -INDENT = indent -kr -cs -i5 -l800 -fca -nfc1 -sc -sob -cli4 -TR -Tplanner -TV +#INDENT = indent -kr -cs -i5 -l800 -fca -nfc1 -sc -sob -cli4 -TR -Tplanner -TV TWOVERS = sh ${top_srcdir}/support/twovers.sh GENFFTDIR = ${top_builddir}/genfft GEN_NOTW = ${GENFFTDIR}/gen_notw.native