summaryrefslogtreecommitdiff
path: root/gphoto-m4/gp-check-shell-environment.m4
blob: a3d6749b943211f78b852e186bdd8cbb8822dfe0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
dnl @synopsis GP_CHECK_SHELL_ENVIRONMENT([SHOW-LOCALE-VARS])
dnl 
dnl Check that the shell environment is sane.
dnl
dnl If SHOW-LOCALE-VARS is set to [true], print all LC_* and LANG*
dnl variables at configure time. (WARNING: This is not portable!)
dnl
dnl
AC_DEFUN([GP_CHECK_SHELL_ENVIRONMENT],
[
# make sure "cd" doesn't print anything on stdout
if test x"${CDPATH+set}" = xset
then
	CDPATH=:
	export CDPATH
fi

# make sure $() command substitution works
AC_MSG_CHECKING([for POSIX sh \$() command substitution])
if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" # ''''
then
	AC_MSG_RESULT([yes])
else
	AC_MSG_RESULT([no])
	uname=`uname 2>&1` # ''
	uname_a=`uname -a 2>&1` # ''
	AC_MSG_ERROR([

* POSIX sh \$() command substitution does not work with this shell.
*
* You are running a very rare species of shell. Please report this
* sighting to <${PACKAGE_BUGREPORT}>:
* SHELL=${SHELL}
* uname=${uname}
* uname-a=${uname_a}
* Please also include your OS and version.
*
* Run this configure script using a better (i.e. POSIX compliant) shell.
])
fi
dnl
m4_if([$1],[true],[dnl
printenv | grep -E '^(LC_|LANG)'
])dnl

dnl
])dnl
dnl