mirror of
https://gitlab.freedesktop.org/pkg-config/pkg-config.git
synced 2026-05-08 12:28:13 +02:00
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.
This commit is contained in:
parent
4bce8b46b2
commit
305913a6b1
14 changed files with 9 additions and 59 deletions
|
|
@ -1,3 +1,5 @@
|
|||
TESTS_ENVIRONMENT = $(TESTS_SHELL)
|
||||
|
||||
TESTS = \
|
||||
check-cflags \
|
||||
check-libs \
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -1,10 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Make sure we're POSIX
|
||||
if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then
|
||||
PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
. ${srcdir}/common
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue