1dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS])
2dnl
3dnl Check that the shell environment is sane.
4dnl
5dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG*
6dnl variables at configure time. (WARNING: This is not portable!)
7dnl
8dnl
9AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT],
10[
11# make sure "cd" doesn't print anything on stdout
12if test x"${CDPATH+set}" = xset
13then
14	CDPATH=:
15	export CDPATH
16fi
17
18# make sure $() command substitution works
19AC_MSG_CHECKING([for POSIX sh \$() command substitution])
20if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # ''''
21then
22	AC_MSG_RESULT([yes])
23else
24	AC_MSG_RESULT([no])
25	uname=`uname 2>&1` # ''
26	uname_a=`uname -a 2>&1` # ''
27	AC_MSG_ERROR([
28
29* POSIX sh \$() command substition does not work with this shell.
30*
31* You are running a very rare species of shell. Please report this
32* sighting to <${PACKAGE_BUGREPORT}>:
33* SHELL=${SHELL}
34* uname=${uname}
35* uname-a=${uname_a}
36* Please also include your OS and version.
37*
38* Run this configure script using a better (i.e. POSIX compliant) shell.
39])
40fi
41dnl
42m4_if([$1],[true],[dnl
43printenv | grep -E '^(LC_|LANG)'
44])dnl
45
46dnl
47])dnl
48dnl
49