Skip to content

Commit

Permalink
In maintainer mode, detect whether 'indent' is available and is GNU i…
Browse files Browse the repository at this point in the history
…ndent.

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.
  • Loading branch information
rdolbeau committed Apr 13, 2015
1 parent 131027a commit 38b93cc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion support/Makefile.codelets
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 38b93cc

Please sign in to comment.