• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Copyright (C) 2005-2021 Hans Ulrich Niedermann <gp@n-dimensional.de>
9dnl SPDX-License-Identifier: LGPL-2.0-or-later
10dnl
11AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT],
12[
13# make sure "cd" doesn't print anything on stdout
14if test x"${CDPATH+set}" = xset
15then
16	CDPATH=:
17	export CDPATH
18fi
19
20# make sure $() command substitution works
21AC_MSG_CHECKING([for POSIX sh \$() command substitution])
22if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # ''''
23then
24	AC_MSG_RESULT([yes])
25else
26	AC_MSG_RESULT([no])
27	uname=`uname 2>&1` # ''
28	uname_a=`uname -a 2>&1` # ''
29	AC_MSG_ERROR([
30
31* POSIX sh \$() command substitution does not work with this shell.
32*
33* You are running a very rare species of shell. Please report this
34* sighting to <${PACKAGE_BUGREPORT}>:
35* SHELL=${SHELL}
36* uname=${uname}
37* uname-a=${uname_a}
38* Please also include your OS and version.
39*
40* Run this configure script using a better (i.e. POSIX compliant) shell.
41])
42fi
43dnl
44m4_if([$1],[true],[dnl
45printenv | grep -E '^(LC_|LANG)'
46])dnl
47
48dnl
49])dnl
50dnl
51