Skip to content

Commit

Permalink
Prefer bash, when running test.sh script
Browse files Browse the repository at this point in the history
Look for bash, to make it possible to run "make test"
on platforms where it is not the /bin/sh implementation.

It is possible to build ccache without it, when only
running the limited unit tests (with "make quicktest").
  • Loading branch information
afbjorklund authored and jrosdahl committed Jan 29, 2018
1 parent 13db1e5 commit 01e5169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Prerequisites
To build ccache from the source repository, you need:

- A C compiler (for instance GCC)
- GNU Bourne Again SHell (bash) for tests.
- [AsciiDoc](http://www.methods.co.nz/asciidoc/) to build the documentation.
- [Autoconf](http://www.gnu.org/software/autoconf/)
- [gperf](http://www.gnu.org/software/gperf/)
Expand Down
5 changes: 3 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ sysconfdir = @sysconfdir@
installcmd = @INSTALL@

AR = @AR@
SH = @SH@
CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
Expand Down Expand Up @@ -101,7 +102,7 @@ perf: ccache$(EXEEXT)
.PHONY: test
test: ccache$(EXEEXT) test/main$(EXEEXT)
test/main$(EXEEXT)
CC='$(CC)' $(srcdir)/test.sh
CC='$(CC)' $(SH) $(srcdir)/test.sh

.PHONY: quicktest
quicktest: test/main$(EXEEXT)
Expand All @@ -125,7 +126,7 @@ distclean: clean
.PHONY: installcheck
installcheck: ccache$(EXEEXT) test/main$(EXEEXT)
test/main$(EXEEXT)
CCACHE=$(bindir)/ccache CC='$(CC)' $(srcdir)/test.sh
CCACHE=$(bindir)/ccache CC='$(CC)' $(SH) $(srcdir)/test.sh

.c.o:
$(CC) $(all_cppflags) $(all_cflags) -c -o $@ $<
Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ if test -z "$AR"; then
AC_MSG_ERROR(cannot find ar)
fi

# Prefer bash, needed for test.sh
AC_PATH_TOOL(SH, bash, "/bin/sh")

# If GCC, turn on warnings.
if test "x$GCC" = "xyes"; then
CFLAGS="$CFLAGS -Wall -W"
Expand Down

0 comments on commit 01e5169

Please sign in to comment.