diff options
author | rofl0r <retnyg@gmx.net> | 2016-10-08 22:59:37 +0300 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2016-10-08 23:02:13 +0300 |
commit | 260578d00e5e96a1bee217ad2dd97e75d5c1f190 (patch) | |
tree | fb0786dadf25acbe9a86c6c09934779a41c0af79 | |
parent | e527b9ee64f86f708b1ec952e01d2a0cbe9a9350 (diff) |
configure: do not use mktemp
apparently mktemp on OSX 10.9.5 requires a parameter.
instead of playing whack-a-mole with apple we now use the portable
code from musl's configure script which should work everywhere.
adresses #142
-rwxr-xr-x | configure | 26 |
1 files changed, 17 insertions, 9 deletions
@@ -2,6 +2,17 @@ prefix=/usr/local +# Get a temporary filename +i=0 +set -C +while : ; do i=$(($i+1)) +tmpc="./conf$$-$PPID-$i.c" +2>|/dev/null > "$tmpc" && break +test "$i" -gt 50 && fail "$0: cannot create temporary file $tmpc" +done +set +C +trap 'rm "$tmpc"' EXIT INT QUIT TERM HUP + ismac() { uname -s | grep Darwin >/dev/null } @@ -20,12 +31,10 @@ isopenbsd() { check_compile() { printf "checking %s ... " "$1" - local tmp=$(mktemp) - printf "$3" > "$tmp".c + printf "$3" > "$tmpc" local res=0 - $CC $CPPFLAGS $2 $CFLAGS -c "$tmp".c -o "$tmp".o >/dev/null 2>&1 \ + $CC $CPPFLAGS $2 $CFLAGS -c "$tmpc" -o /dev/null >/dev/null 2>&1 \ || res=1 - rm -f "$tmp".c "$tmp".o test x$res = x0 && \ { printf "yes\n" ; test x"$2" = x || CPPFLAGS="$CPPFLAGS $2" ; } \ || printf "no\n" @@ -42,13 +51,12 @@ check_define() { check_compile_run() { printf "checking %s ... " "$1" - local tmp=$(mktemp) - printf "$2" > "$tmp".c + printf "$2" > "$tmpc" local res=0 - $CC $CPPFLAGS $CFLAGS "$tmp".c -o "$tmp".out >/dev/null 2>&1 \ + $CC $CPPFLAGS $CFLAGS "$tmpc" -o "$tmpc".out >/dev/null 2>&1 \ || res=1 - test x$res = x0 && { "$tmp".out || res=1 ; } - rm -f "$tmp".c "$tmp".o "$tmp".out + test x$res = x0 && { "$tmpc".out || res=1 ; } + rm -f "$tmpc".out test x$res = x0 && printf "yes\n" || printf "no\n" return $res } |