summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2012-08-19 07:36:36 -0700
committerDan Nicholson <dbn.lists@gmail.com>2012-08-19 08:03:00 -0700
commit305913a6b182dd57d185420b7eb4a71185dcf6ae (patch)
treeabaf36bb3c0d7e5eb32cdf9c62af99d2239f60f0 /configure.ac
parent4bce8b46b2835b43367467ef97e20ea47a1d8c83 (diff)
downloadpkg-config-305913a6b182dd57d185420b7eb4a71185dcf6ae.tar.gz
Handle POSIX shell for tests in configure and Makefile
Although the trick of finding a POSIX shell in the system PATH works fine most of the time, it has some drawbacks. * The commands must be copied into every test script. * The scripts are always forced to re-execute themselves. * There's no guarantee the sh found in `getconf PATH` is a POSIX shell and there's no way to override it. Move the handling of this shell to configure where we can detect it once. This gives preference to bash and ksh since they're typically POSIX compatible. It also uses the current PATH with the getconf PATH at the end which should allow things to work on platforms where getconf might not be available like mingw/msys. By specifying the shell in TESTS_ENVIRONMENT, automake will run each script with this shell and we can drop the re-exec dance.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac7
1 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 4788ee5..37fe831 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,13 @@ AC_PROG_CC
dnl Check for headers
AC_CHECK_HEADERS([dirent.h unistd.h sys/wait.h malloc.h])
+dnl A POSIX shell is required for the tests. If TEST_SHELL hasn't been
+dnl set on the command line then we try to find bash or ksh or sh from
+dnl the path. If none of those are available, we just use whatever
+dnl autoconf detected for configure.
+AC_ARG_VAR([TESTS_SHELL], [Path to a POSIX shell to be used for testing])
+conf_path="$PATH:`getconf PATH 2>/dev/null`"
+AC_PATH_PROGS([TESTS_SHELL], [bash ksh sh], [$CONFIG_SHELL], [$conf_path])
dnl
dnl Default pkg-config search path