summaryrefslogtreecommitdiff
path: root/gphoto-m4/gp-check-shell-environment.m4
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2015-08-01 13:04:09 +0200
committerMarcus Meissner <marcus@jet.franken.de>2015-08-01 13:04:09 +0200
commit12db94ab3c8feb7ad3c9eef9818e689a2edcfd0c (patch)
tree7ce7caa33a060e50825d8f246f565fe70ec21afe /gphoto-m4/gp-check-shell-environment.m4
parent5f0ec7086a3bfaf5641cdb007736e939f07f0b70 (diff)
downloadlibgphoto2-12db94ab3c8feb7ad3c9eef9818e689a2edcfd0c.tar.gz
imported the libgphoto m4 tree
Diffstat (limited to 'gphoto-m4/gp-check-shell-environment.m4')
-rw-r--r--gphoto-m4/gp-check-shell-environment.m448
1 files changed, 48 insertions, 0 deletions
diff --git a/gphoto-m4/gp-check-shell-environment.m4 b/gphoto-m4/gp-check-shell-environment.m4
new file mode 100644
index 000000000..b9850e7aa
--- /dev/null
+++ b/gphoto-m4/gp-check-shell-environment.m4
@@ -0,0 +1,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 substition 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