789 |
[$3], [$2])]) |
[$3], [$2])]) |
790 |
|
|
791 |
|
|
792 |
# AS_TMPDIR(PREFIX) |
# AS_TMPDIR(PREFIX, [DIRECTORY = $TMPDIR [= /tmp]]) |
793 |
# ----------------- |
# ------------------------------------------------- |
794 |
# Create as safely as possible a temporary directory which name is |
# Create as safely as possible a temporary directory in DIRECTORY |
795 |
# inspired by PREFIX (should be 2-4 chars max), and set trap |
# which name is inspired by PREFIX (should be 2-4 chars max), and set |
796 |
# mechanisms to remove it. |
# trap mechanisms to remove it. |
797 |
m4_define([AS_TMPDIR], |
m4_define([AS_TMPDIR], |
798 |
[# Create a temporary directory, and hook for its removal unless debugging. |
[# Create a temporary directory, and hook for its removal unless debugging. |
799 |
$debug || |
$debug || |
803 |
} |
} |
804 |
|
|
805 |
# Create a (secure) tmp directory for tmp files. |
# Create a (secure) tmp directory for tmp files. |
806 |
: ${TMPDIR=/tmp} |
m4_if([$2], [], [: ${TMPDIR=/tmp}]) |
807 |
{ |
{ |
808 |
tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && |
tmp=`(umask 077 && mktemp -d -q "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` && |
809 |
test -n "$tmp" && test -d "$tmp" |
test -n "$tmp" && test -d "$tmp" |
810 |
} || |
} || |
811 |
{ |
{ |
812 |
tmp=$TMPDIR/$1$$-$RANDOM |
tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM |
813 |
(umask 077 && mkdir $tmp) |
(umask 077 && mkdir $tmp) |
814 |
} || |
} || |
815 |
{ |
{ |
816 |
echo "$me: cannot create a temporary directory in $TMPDIR" >&2 |
echo "$me: cannot create a temporary directory in m4_default([$2], [$TMPDIR])" >&2 |
817 |
AS_EXIT |
AS_EXIT |
818 |
}dnl |
}dnl |
819 |
])# AS_TMPDIR |
])# AS_TMPDIR |