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
OUR_CPPFLAGS
rofl0r 2016-10-08 20:59:37 +01:00
parent e527b9ee64
commit 260578d00e
1 changed files with 17 additions and 9 deletions

26
configure vendored
View File

@ -2,6 +2,17 @@
prefix=/usr/local 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() { ismac() {
uname -s | grep Darwin >/dev/null uname -s | grep Darwin >/dev/null
} }
@ -20,12 +31,10 @@ isopenbsd() {
check_compile() { check_compile() {
printf "checking %s ... " "$1" printf "checking %s ... " "$1"
local tmp=$(mktemp) printf "$3" > "$tmpc"
printf "$3" > "$tmp".c
local res=0 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 || res=1
rm -f "$tmp".c "$tmp".o
test x$res = x0 && \ test x$res = x0 && \
{ printf "yes\n" ; test x"$2" = x || CPPFLAGS="$CPPFLAGS $2" ; } \ { printf "yes\n" ; test x"$2" = x || CPPFLAGS="$CPPFLAGS $2" ; } \
|| printf "no\n" || printf "no\n"
@ -42,13 +51,12 @@ check_define() {
check_compile_run() { check_compile_run() {
printf "checking %s ... " "$1" printf "checking %s ... " "$1"
local tmp=$(mktemp) printf "$2" > "$tmpc"
printf "$2" > "$tmp".c
local res=0 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 || res=1
test x$res = x0 && { "$tmp".out || res=1 ; } test x$res = x0 && { "$tmpc".out || res=1 ; }
rm -f "$tmp".c "$tmp".o "$tmp".out rm -f "$tmpc".out
test x$res = x0 && printf "yes\n" || printf "no\n" test x$res = x0 && printf "yes\n" || printf "no\n"
return $res return $res
} }