From bfcdc4969510997fe81debf52982641febfa1bdf Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Tue, 15 Mar 2011 15:35:14 +0800 Subject: [SHELL] Port to Solaris - Solaris lacks paths.h and the various _PATH_* #defines. Check for them in configure.ac and fall back on the usual suspects when they are missing. - Older Solaris lacks isblank(), and versions that have it use a macro. Check for the declaration in configure.ac and fall back on a naive version when missing. - Older Solaris does not support %jd (intmax_t) in format strings, but it does support the PRIdMAX macro from inttypes.h. Do a configure check for PRIdMAX and use it in the code. If it doesn't exist, define it to "lld" when sizeof(long long) equals sizeof(intmax_t) as this is more likely to work on older systems. Otherwise, use "jd" and hope for the best. - Older Solaris lacks stdint.h, but inttypes.h provides the same types and works on all platforms I've tried dash on, so just use it instead. - Older Solaris doesn't like it when vsnprintf() is passed a NULL buffer (in violation of the POSIX spec, of course). Pass a 1-byte dummy buffer instead. - Solaris lacks tempfile and mktemp programs. Fall back on a "good-enough" custom function in mkbuiltins. Signed-off-by: Brian Koropoff Signed-off-by: Herbert Xu --- src/mkbuiltins | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/mkbuiltins') diff --git a/src/mkbuiltins b/src/mkbuiltins index 99107c2..f562ae2 100644 --- a/src/mkbuiltins +++ b/src/mkbuiltins @@ -36,7 +36,20 @@ # @(#)mkbuiltins 8.2 (Berkeley) 5/4/95 tempfile=tempfile -if ! type tempfile > /dev/null 2>&1; then +if ! type tempfile > /dev/null 2>&1 && ! type mktemp > /dev/null 2>&1; then + _my_tempfile() + { + local index=0 + while test -f "${TMPDIR:-/tmp}/builtin.$$.$index"; do + index=`expr $index + 1` + done + + touch "${TMPDIR:-/tmp}/builtin.$$.$index" + echo "${TMPDIR:-/tmp}/builtin.$$.$index" + } + + tempfile="_my_tempfile" +elif ! type tempfile > /dev/null 2>&1; then tempfile="mktemp ${TMPDIR:-/tmp}/builtin.XXXXXX" fi -- cgit 1.4.1